From c82c6f8d8cd337da2e6bcd33e6b9a90c13964423 Mon Sep 17 00:00:00 2001 From: Zoddo Date: Sat, 29 Mar 2014 18:26:21 +0100 Subject: [PATCH 1/2] [ticket/12275] Fix a bug on the event "core.modify_username_string" Call the event "core.modify_username_string" also if $mode is "colour", "username" or "profile". PHPBB3-12275 --- phpBB/includes/functions_content.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 8122b87e4b..37d04c1ba0 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -1319,7 +1319,8 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', // Return colour if ($mode == 'colour') { - return $username_colour; + $username_string = $username_colour; + break; } // no break; @@ -1339,7 +1340,8 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', // Return username if ($mode == 'username') { - return $username; + $username_string = $username; + break; } // no break; @@ -1360,19 +1362,23 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', // Return profile if ($mode == 'profile') { - return $profile_url; + $username_string = $profile_url; + break; } // no break; } - - if (($mode == 'full' && !$profile_url) || $mode == 'no_profile') + + if (empty($username_string)) { - $username_string = str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_noprofile'] : $_profile_cache['tpl_noprofile_colour']); - } - else - { - $username_string = str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_profile'] : $_profile_cache['tpl_profile_colour']); + if (($mode == 'full' && !$profile_url) || $mode == 'no_profile') + { + $username_string = str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_noprofile'] : $_profile_cache['tpl_noprofile_colour']); + } + else + { + $username_string = str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_profile'] : $_profile_cache['tpl_profile_colour']); + } } /** From aa5f268ea5d0e9107f5c8154e10a85c46ad20273 Mon Sep 17 00:00:00 2001 From: Zoddo Date: Mon, 14 Apr 2014 22:02:48 +0200 Subject: [PATCH 2/2] [ticket/12275] Change if (empty) to if (!isset) PHPBB3-12275 --- phpBB/includes/functions_content.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 37d04c1ba0..f420ba8ac4 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -1369,7 +1369,7 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', // no break; } - if (empty($username_string)) + if (!isset($username_string)) { if (($mode == 'full' && !$profile_url) || $mode == 'no_profile') {