aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--phpBB/phpbb/group/helper.php8
-rw-r--r--tests/group/helper_get_name_string_test.php7
2 files changed, 9 insertions, 6 deletions
diff --git a/phpBB/phpbb/group/helper.php b/phpBB/phpbb/group/helper.php
index 9a53df68d3..21a09e4e63 100644
--- a/phpBB/phpbb/group/helper.php
+++ b/phpBB/phpbb/group/helper.php
@@ -109,6 +109,8 @@ class helper
*/
public function get_name_string($mode, $group_id, $group_name, $group_colour = '', $custom_profile_url = false)
{
+ $s_is_bots = ($group_name === 'BOTS');
+
// This switch makes sure we only run code required for the mode
switch ($mode)
{
@@ -117,7 +119,7 @@ class helper
case 'colour':
// Build correct group colour
- $group_colour = ($group_colour) ? '#' . $group_colour : '';
+ $group_colour = $group_colour ? '#' . $group_colour : '';
// Return colour
if ($mode === 'colour')
@@ -146,7 +148,7 @@ class helper
// Build correct profile url - only show if not anonymous and permission to view profile if registered user
// For anonymous the link leads to a login page.
- if ($group_id && ($this->user->data['user_id'] == ANONYMOUS || $this->auth->acl_get('u_viewprofile')))
+ if ($group_id && !$s_is_bots && ($this->user->data['user_id'] == ANONYMOUS || $this->auth->acl_get('u_viewprofile')))
{
$profile_url = ($custom_profile_url !== false) ? $custom_profile_url . '&g=' . (int) $group_id : str_replace(array('={GROUP_ID}', '=%7BGROUP_ID%7D'), '=' . (int) $group_id, $this->name_strings['base_url']);
}
@@ -167,7 +169,7 @@ class helper
if (!isset($group_name_string))
{
- if (($mode === 'full' && empty($profile_url)) || $mode === 'no_profile')
+ if (($mode === 'full' && empty($profile_url)) || $mode === 'no_profile' || $s_is_bots)
{
$group_name_string = str_replace(array('{GROUP_COLOUR}', '{GROUP_NAME}'), array($group_colour, $group_name), (!$group_colour) ? $this->name_strings['tpl_noprofile'] : $this->name_strings['tpl_noprofile_colour']);
}
diff --git a/tests/group/helper_get_name_string_test.php b/tests/group/helper_get_name_string_test.php
index 7ea0f156e4..565602a346 100644
--- a/tests/group/helper_get_name_string_test.php
+++ b/tests/group/helper_get_name_string_test.php
@@ -39,7 +39,7 @@ class phpbb_group_helper_get_name_string_test extends phpbb_group_helper_test_ca
{
return array(
// Should be fine
- array(0, 'Bots', 'AA0000', false, 'Bots'),
+ array(0, 'BOTS', 'AA0000', false, 'Bots'),
array(1, 'new_group', '', false, 'Some new group'),
array(2, 'group_with_ümlauts', '', 'http://www.example.org/group.php?mode=show', 'Should work'),
@@ -80,7 +80,8 @@ class phpbb_group_helper_get_name_string_test extends phpbb_group_helper_test_ca
global $phpbb_root_path, $phpEx;
return array(
- array(0, 'Bots', '000000', false, '<span class="username-coloured" style="color: #000000;">Bots</span>'),
+ array(0, 'BOTS', '000000', false, '<span class="username-coloured" style="color: #000000;">Bots</span>'),
+ array(1, 'BOTS', '111111', false, '<span class="username-coloured" style="color: #111111;">Bots</span>'),
array(7, 'new_group', 'FFA500', false, '<a class="username-coloured" href="' . $phpbb_root_path . 'memberlist.' . $phpEx . '?mode=group&amp;g=7" style="color: #FFA500;">Some new group</a>'),
array(14, 'Awesome group', '', 'http://www.example.org/group.php?mode=show', '<a class="username" href="http://www.example.org/group.php?mode=show&amp;g=14">Awesome group</a>'),
);
@@ -97,7 +98,7 @@ class phpbb_group_helper_get_name_string_test extends phpbb_group_helper_test_ca
public function get_name_string_no_profile_data()
{
return array(
- array(0, 'Bots', '000000', false, '<span class="username-coloured" style="color: #000000;">Bots</span>'),
+ array(0, 'BOTS', '000000', false, '<span class="username-coloured" style="color: #000000;">Bots</span>'),
array(1, 'new_group', '', false, '<span class="username">Some new group</span>'),
arraY(2, 'not_uppercase', 'FF0000', false, '<span class="username-coloured" style="color: #FF0000;">not_uppercase</span>'),
array(5, 'Awesome group', '', 'http://www.example.org/group.php?mode=show', '<span class="username">Awesome group</span>'),