phpBB2 style Group Legend display

A selection of code snippets.
Post Reply
User avatar
kinerity
Administrator
Administrator
Posts: 7
Joined: Sun Apr 28, 2019 4:08 am
Name: Kailey Truscott

phpBB2 style Group Legend display

Post by kinerity » Sun Apr 28, 2019 4:44 am

This snippet will modify the group legend to look like it did back on phpBB2.

Open index.php

Find:

Code: Select all

$legend = array();
while ($row = $db->sql_fetchrow($result))
{
	$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
	$group_name = $group_helper->get_name($row['group_name']);

	if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
	{
		$legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
	}
	else
	{
		$legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . $group_name . '</a>';
	}
}
$db->sql_freeresult($result);

$legend = implode($user->lang['COMMA_SEPARATOR'], $legend);
Replace with:

Code: Select all

$legend = array();
while ($row = $db->sql_fetchrow($result))
{
	$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
	$group_name = $group_helper->get_name($row['group_name']);

	if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
	{
		$legend[] = '[<span' . $colour_text . '>' . $group_name . '</span>]';
	}
	else
	{
		$legend[] = '[<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . $group_name . '</a>]';
	}
}
$db->sql_freeresult($result);

$legend = implode(' ', $legend);
Open viewonline.php

Find:

Code: Select all

$legend = '';
while ($row = $db->sql_fetchrow($result))
{
	if ($row['group_name'] == 'BOTS')
	{
		$legend .= (($legend != '') ? ', ' : '') . '<span style="color:#' . $row['group_colour'] . '">' . $user->lang['G_BOTS'] . '</span>';
	}
	else
	{
		$legend .= (($legend != '') ? ', ' : '') . '<a style="color:#' . $row['group_colour'] . '" href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . $group_helper->get_name($row['group_name']) . '</a>';
	}
}
$db->sql_freeresult($result);
Replace with:

Code: Select all

$legend = array();
while ($row = $db->sql_fetchrow($result))
{
	if ($row['group_name'] == 'BOTS')
	{
		$legend[] = '[<span style="color:#' . $row['group_colour'] . '">' . $user->lang['G_BOTS'] . '</span>]';
	}
	else
	{
		$legend[] = '[<a style="color:#' . $row['group_colour'] . '" href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . $group_helper->get_name($row['group_name']) . '</a>]';
	}
}
$db->sql_freeresult($result);

$legend = implode(' ', $legend);

Post Reply