Skip to content

Commit

Permalink
Improved display name
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninjasoturi committed Mar 17, 2021
1 parent a5091dd commit 2f97c37
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.046.1
2.1.076.2
2 changes: 1 addition & 1 deletion config/config.json.example
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion logic/get_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion mods/change_trainername.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}
"
);
Expand Down
4 changes: 2 additions & 2 deletions mods/trainer_code.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions mods/trainer_name.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
]
];
}
Expand Down

0 comments on commit 2f97c37

Please sign in to comment.