1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-19 15:17:16 +01:00

Remove complex query, add true sorting for viewprofile group list. Related to #31845

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10393 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Andreas Fischer 2009-12-31 17:07:34 +00:00
parent a096b3d981
commit 771774f09a
2 changed files with 28 additions and 6 deletions

View File

@ -130,6 +130,7 @@
<li>[Fix] Do not use group colours for usernames on print view. (Bug #30315 - Patch by Pasqualle)</li>
<li>[Fix] Pagination of User Notes in MCP uses two different config values. (Bug #56025)</li>
<li>[Fix] List hidden groups on viewprofile where the viewing user is also a member. (Bug #31845)</li>
<li>[Fix] Properly sort viewprofile group list by group_name.</li>
<li>[Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)</li>
<li>[Change] Log activation through inactive users ACP. (Bug #30145)</li>
<li>[Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)</li>

View File

@ -440,10 +440,10 @@ switch ($mode)
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug
WHERE ' . $db->sql_in_set('ug.user_id', $sql_uid_ary) . '
AND g.group_id = ug.group_id
AND ug.user_pending = 0
ORDER BY g.group_type, g.group_name';
AND ug.user_pending = 0';
$result = $db->sql_query($sql);
// Devide data into profile data and current user data
$profile_groups = $user_groups = array();
while ($row = $db->sql_fetchrow($result))
{
@ -461,19 +461,40 @@ switch ($mode)
}
$db->sql_freeresult($result);
$group_options = '';
// Filter out hidden groups and sort groups by name
$group_data = $group_sort = array();
foreach ($profile_groups as $row)
{
// Skip over hidden groups the user cannot see
if (!$auth_hidden_groups && $row['group_type'] == GROUP_HIDDEN && !isset($user_groups[$row['group_id']]))
if ($row['group_type'] == GROUP_SPECIAL)
{
// Lookup group name in language dictionary
if (isset($user->lang['G_' . $row['group_name']]))
{
$row['group_name'] = $user->lang['G_' . $row['group_name']];
}
}
else if (!$auth_hidden_groups && $row['group_type'] == GROUP_HIDDEN && !isset($user_groups[$row['group_id']]))
{
// Skip over hidden groups the user cannot see
continue;
}
$group_options .= '<option value="' . $row['group_id'] . '"' . (($row['group_id'] == $member['group_id']) ? ' selected="selected"' : '') . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
$group_sort[$row['group_id']] = utf8_clean_string($row['group_name']);
$group_data[$row['group_id']] = $row;
}
unset($profile_groups);
unset($user_groups);
asort($group_sort);
$group_options = '';
foreach ($group_sort as $group_id => $null)
{
$row = $group_data[$group_id];
$group_options .= '<option value="' . $row['group_id'] . '"' . (($row['group_id'] == $member['group_id']) ? ' selected="selected"' : '') . '>' . $row['group_name'] . '</option>';
}
unset($group_data);
unset($group_sort);
// What colour is the zebra
$sql = 'SELECT friend, foe