Commit 4257af12 authored by Nigel McNie's avatar Nigel McNie
Browse files

Fixed the group display in the sideblock. Now differentiates between groups you own and others.

parent 43f7da3f
......@@ -1804,7 +1804,13 @@ function profile_sideblock() {
$data['invitedgroupsmessage'] = $data['invitedgroups'] == 1 ? get_string('invitedgroup') : get_string('invitedgroups');
$data['pendingfriends'] = count_records('usr_friend_request', 'owner', $USER->get('id'));
$data['pendingfriendsmessage'] = $data['pendingfriends'] == 1 ? get_string('pendingfriend') : get_string('pendingfriends');
$data['groups'] = array();
$data['groups'] = get_records_sql_array(
"SELECT g.id, g.name, gm.role
FROM {group} g
JOIN {group_member} gm ON (gm.group = g.id)
WHERE gm.member = ?
AND g.deleted = 0
ORDER BY gm.role = 'admin' DESC, gm.role, g.id", array($USER->get('id')));
$data['views'] = get_records_sql_array(
'SELECT v.id, v.title
FROM {view} v
......
......@@ -26,10 +26,10 @@
{/if}
{if $data.groups}
<li>
<a href="{$WWWROOT}group/mygroups.php?filter=owner">{str tag="groups"}:</a>
<a href="{$WWWROOT}group/mygroups.php">{str tag="groups"}:</a>
<ul>
{foreach from=$data.groups item=group}
<li><a href="{$WWWROOT}group/view.php?id={$group->id}">{$group->name|escape}</a></li>
<li><a href="{$WWWROOT}group/view.php?id={$group->id}">{$group->name|escape}</a>{if $group->role == 'admin'} (admin){/if}</li>
{/foreach}
</ul>
</li>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment