From 2f97c37beb4a9f6c06fc5015436a1d83f6ddd40f Mon Sep 17 00:00:00 2001 From: Ninjasoturi <52629375+Ninjasoturi@users.noreply.github.com> Date: Wed, 17 Mar 2021 20:45:39 +0200 Subject: [PATCH] Improved display name --- VERSION | 2 +- config/config.json.example | 2 +- logic/get_user.php | 2 +- mods/change_trainername.php | 3 ++- mods/trainer_code.php | 4 ++-- mods/trainer_name.php | 8 ++++---- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/VERSION b/VERSION index 1a1425e4..ff740703 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.046.1 +2.1.076.2 diff --git a/config/config.json.example b/config/config.json.example index e477b969..da7a4b3d 100644 --- a/config/config.json.example +++ b/config/config.json.example @@ -1,5 +1,5 @@ { - "VERSION":"2.1.046.1", + "VERSION":"2.1.076.2", "DB_HOST":"localhost", "DB_NAME":"your_database_name", "DB_USER":"your_database_user", diff --git a/logic/get_user.php b/logic/get_user.php index 53f6a2d8..46c554a3 100644 --- a/logic/get_user.php +++ b/logic/get_user.php @@ -73,7 +73,7 @@ function get_user($user_id, $public = true, $return_row = false) function check_trainername($row){ global $config; // if Custom Trainername is enabled by config - if($config->CUSTOM_TRAINERNAME == false || check_for_empty_string($row['trainername']) || $row['display_name'] != 1){ // trainername not set by user + if($config->CUSTOM_TRAINERNAME == false || check_for_empty_string($row['trainername']) || (isset($row['display_name']) && $row['display_name'] != 1)){ // trainername not set by user // check if Telegram-@Nick is set if(!check_for_empty_string($row['nick']) && $config->RAID_POLL_SHOW_NICK_OVER_NAME){ // set Telegram-@Nick as Name inside the bot diff --git a/mods/change_trainername.php b/mods/change_trainername.php index 79374892..51d02e5a 100644 --- a/mods/change_trainername.php +++ b/mods/change_trainername.php @@ -11,7 +11,8 @@ my_query( " UPDATE users - SET trainername = '{$trainername}' + SET trainername = '{$trainername}', + display_name = IF(trainername is null, 0, 1) WHERE user_id = {$userid} " ); diff --git a/mods/trainer_code.php b/mods/trainer_code.php index a30b918b..0ced1b15 100644 --- a/mods/trainer_code.php +++ b/mods/trainer_code.php @@ -56,10 +56,10 @@ $keys[] = [ [ 'text' => getTranslation('back'), - 'callback_data' => $mode.':trainer_code:cancel' + 'callback_data' => '0:trainer_code:cancel' ],[ 'text' => getTranslation('delete'), - 'callback_data' => $mode.':trainer_code:delete' + 'callback_data' => '0:trainer_code:delete' ] ]; // Answer callback. diff --git a/mods/trainer_name.php b/mods/trainer_name.php index 877a6f77..ce7b3dbe 100644 --- a/mods/trainer_name.php +++ b/mods/trainer_name.php @@ -73,23 +73,23 @@ $keys[] = [ [ 'text' => getTranslation('switch_display_name'), - 'callback_data' => $mode.':trainer_name:switch' + 'callback_data' => '0:trainer_name:switch' ] ]; $keys[] = [ [ 'text' => getTranslation('trainername_edit'), - 'callback_data' => $mode.':trainer_name:add' + 'callback_data' => '0:trainer_name:add' ],[ 'text' => getTranslation('delete'), - 'callback_data' => $mode.':trainer_name:delete' + 'callback_data' => '0:trainer_name:delete' ] ]; }else { $keys[] = [ [ 'text' => getTranslation('trainername_add'), - 'callback_data' => $mode.':trainer_name:add' + 'callback_data' => '0:trainer_name:add' ] ]; }