• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

PHP [ZNOTEACC] How to hide options in manage account

mano368

Senior Support Team Member
Staff member
Support Team
Joined
Sep 2, 2011
Messages
646
Solutions
46
Reaction score
296
Location
Brazil
Hello,

How can I hide options if your account doesn't have access to this type of voucher?

For example, I want to hide "change gender" and "change name" until the player buy in store the voucher needed to use these features.

When he buys a voucher, then the option to change sex will appear.. or change name.

the options is in myaccount.php:
PHP:
                                                <select id="action" name="action" class="form-control" onChange="changedOption(this)">
                                                    <option value="none" selected>Select action</option>
                                                    <option value="toggle_hide">Toggle hide</option>
                                                    <option value="change_comment">Change comment</option>
                                                    <option value="change_gender">Change gender</option>
                                                    <option value="change_name">Change name</option>
                                                    <option value="delete_character" class="needconfirmation">Delete character</option>
                                                </select>

Thank you for your help in advance!
 
Solution
Not very familiarized with ZnoteACC but this should work

Query
PHP:
ALTER TABLE `znote_accounts` ADD `sex_and_name` INT (2) NOT NULL DEFAULT 0;

PHP Code
PHP:
<select id="action" name="action" class="form-control" onChange="changedOption(this)">
    <option value="none" selected>Select action</option>
    <option value="toggle_hide">Toggle hide</option>
    <option value="change_comment">Change comment</option>

    <?php $data = user_znote_account_data($session_user_id, 'sex_and_name'); ?>
    <?php if ($data['sex_and_name'] == 1): ?>
        <option value="change_gender">Change gender</option>
        <option value="change_name">Change name</option>
    <?php endif; ?>

    <option value="delete_character"...
Not very familiarized with ZnoteACC but this should work

Query
PHP:
ALTER TABLE `znote_accounts` ADD `sex_and_name` INT (2) NOT NULL DEFAULT 0;

PHP Code
PHP:
<select id="action" name="action" class="form-control" onChange="changedOption(this)">
    <option value="none" selected>Select action</option>
    <option value="toggle_hide">Toggle hide</option>
    <option value="change_comment">Change comment</option>

    <?php $data = user_znote_account_data($session_user_id, 'sex_and_name'); ?>
    <?php if ($data['sex_and_name'] == 1): ?>
        <option value="change_gender">Change gender</option>
        <option value="change_name">Change name</option>
    <?php endif; ?>

    <option value="delete_character" class="needconfirmation">Delete character</option>
</select>
-----------------------------------------------------------------------------------------------------------------------------------------------------
EDIT: If you want separate accesses, use this one instead
PHP:
<select id="action" name="action" class="form-control" onChange="changedOption(this)">
    <option value="none" selected>Select action</option>
    <option value="toggle_hide">Toggle hide</option>
    <option value="change_comment">Change comment</option>

    <?php $data = user_znote_account_data($session_user_id, 'change_sex', 'change_name'); ?>
    <?php if ($data['change_sex'] == 1): ?> <option value="change_gender">Change gender</option> <?php endif; ?>
    <?php if ($data['change_name'] == 1): ?> <option value="change_name">Change name</option> <?php endif; ?>

    <option value="delete_character" class="needconfirmation">Delete character</option>
</select>

Now on znote_accounts table just add 2 columns, change_sex and change_name
 
Last edited:
Solution
Not very familiarized with ZnoteACC but this should work

Query
PHP:
ALTER TABLE `znote_accounts` ADD `sex_and_name` INT (2) NOT NULL DEFAULT 0;

PHP Code
PHP:
<select id="action" name="action" class="form-control" onChange="changedOption(this)">
    <option value="none" selected>Select action</option>
    <option value="toggle_hide">Toggle hide</option>
    <option value="change_comment">Change comment</option>

    <?php $data = user_znote_account_data($session_user_id, 'sex_and_name'); ?>
    <?php if ($data['sex_and_name'] == 1): ?>
        <option value="change_gender">Change gender</option>
        <option value="change_name">Change name</option>
    <?php endif; ?>

    <option value="delete_character" class="needconfirmation">Delete character</option>
</select>
-----------------------------------------------------------------------------------------------------------------------------------------------------
EDIT: If you want separate accesses, use this one instead
PHP:
<select id="action" name="action" class="form-control" onChange="changedOption(this)">
    <option value="none" selected>Select action</option>
    <option value="toggle_hide">Toggle hide</option>
    <option value="change_comment">Change comment</option>

    <?php $data = user_znote_account_data($session_user_id, 'change_sex', 'change_name'); ?>
    <?php if ($data['change_sex'] == 1): ?> <option value="change_gender">Change gender</option> <?php endif; ?>
    <?php if ($data['change_name'] == 1): ?> <option value="change_name">Change name</option> <?php endif; ?>

    <option value="delete_character" class="needconfirmation">Delete character</option>
</select>

Now on znote_accounts table just add 2 columns, change_sex and change_name
Cant do the same to check znote_shop_ordes if account has order type 2(change name) instead of checking new tables?
 
Not very familiarized with ZnoteACC but this should work

Query
PHP:
ALTER TABLE `znote_accounts` ADD `sex_and_name` INT (2) NOT NULL DEFAULT 0;

PHP Code
PHP:
<select id="action" name="action" class="form-control" onChange="changedOption(this)">
    <option value="none" selected>Select action</option>
    <option value="toggle_hide">Toggle hide</option>
    <option value="change_comment">Change comment</option>

    <?php $data = user_znote_account_data($session_user_id, 'sex_and_name'); ?>
    <?php if ($data['sex_and_name'] == 1): ?>
        <option value="change_gender">Change gender</option>
        <option value="change_name">Change name</option>
    <?php endif; ?>

    <option value="delete_character" class="needconfirmation">Delete character</option>
</select>
-----------------------------------------------------------------------------------------------------------------------------------------------------
EDIT: If you want separate accesses, use this one instead
PHP:
<select id="action" name="action" class="form-control" onChange="changedOption(this)">
    <option value="none" selected>Select action</option>
    <option value="toggle_hide">Toggle hide</option>
    <option value="change_comment">Change comment</option>

    <?php $data = user_znote_account_data($session_user_id, 'change_sex', 'change_name'); ?>
    <?php if ($data['change_sex'] == 1): ?> <option value="change_gender">Change gender</option> <?php endif; ?>
    <?php if ($data['change_name'] == 1): ?> <option value="change_name">Change name</option> <?php endif; ?>

    <option value="delete_character" class="needconfirmation">Delete character</option>
</select>

Now on znote_accounts table just add 2 columns, change_sex and change_name
Ok, So using your help i managed to somehow do what i wanted, i don't know if it's correct but it seems to work.

I created the function that return orders by type.
PHP:
function shop_account_order_type($type) {
    $accid = (int)getSession('user_id');
    $type = (int)$type;
    return mysql_select_multi("SELECT `type` FROM `znote_shop_orders` WHERE `account_id`='$accid' AND `type`= '$type';");
}

And then using it, I put it as described by you, since I would just like to activate the option if the player has an order.

PHP:
<?php if (shop_account_order_type(3)): ?> <option value="change_gender" class="needconfirm">Change gender</option> <?php endif; ?>

Thank You Bro
 
Ok, So using your help i managed to somehow do what i wanted, i don't know if it's correct but it seems to work.

I created the function that return orders by type.
PHP:
function shop_account_order_type($type) {
    $accid = (int)getSession('user_id');
    $type = (int)$type;
    return mysql_select_multi("SELECT `type` FROM `znote_shop_orders` WHERE `account_id`='$accid' AND `type`= '$type';");
}

And then using it, I put it as described by you, since I would just like to activate the option if the player has an order.

PHP:
<?php if (shop_account_order_type(3)): ?> <option value="change_gender" class="needconfirm">Change gender</option> <?php endif; ?>

Thank You Bro
Hi,
Sorry for being noob but where did you put these codes? :D
 
Hi,
Sorry for being noob but where did you put these codes? :D
The function, just go to engine->function->users.php search for shop and put bellow the last one.

And the change gender is in myaccount.php, just change one for another and where is 3 is the type, 3 for gender and 4 to name change.
remember to use this instead of the code above because I put a confirm buttom in my vouchers:

PHP:
<?php if (shop_account_order_type(3)): ?> <option value="change_gender">Change gender</option> <?php endif; ?>
 
The function, just go to engine->function->users.php search for shop and put bellow the last one.

And the change gender is in myaccount.php, just change one for another and where is 3 is the type, 3 for gender and 4 to name change.
remember to use this instead of the code above because I put a confirm buttom in my vouchers:

PHP:
<?php if (shop_account_order_type(3)): ?> <option value="change_gender">Change gender</option> <?php endif; ?>
Thank you!!!
 
Back
Top