aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2009-12-31 17:07:34 +0000
committerAndreas Fischer <bantu@phpbb.com>2009-12-31 17:07:34 +0000
commit771774f09a4234cbe46fe8f561f721ef682a2ced (patch)
tree81fcc30b3ae860513725be7974cf865dd61ef669 /phpBB
parenta096b3d981a67bf1316eca328e9819ed157f1e15 (diff)
downloadforums-771774f09a4234cbe46fe8f561f721ef682a2ced.tar
forums-771774f09a4234cbe46fe8f561f721ef682a2ced.tar.gz
forums-771774f09a4234cbe46fe8f561f721ef682a2ced.tar.bz2
forums-771774f09a4234cbe46fe8f561f721ef682a2ced.tar.xz
forums-771774f09a4234cbe46fe8f561f721ef682a2ced.zip
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
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/docs/CHANGELOG.html1
-rw-r--r--phpBB/memberlist.php33
2 files changed, 28 insertions, 6 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 1293b26447..06be5f5db3 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -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>
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index 06e0d7a4ed..4d3060780f 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -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