Commit 0c6500f3 authored by Nigel McNie's avatar Nigel McNie
Browse files

Remove get_invited_groups. It's only called in one place.

parent 237bdbae
......@@ -94,23 +94,6 @@ function group_remove_user($group, $userid) {
}
}
/**
* all groups the user has pending invites to
*
* @param int userid (optional, defaults to $USER id)
* @return array of group db rows
*/
function get_invited_groups($userid=0) {
$userid = optional_userid($userid);
return get_records_sql_array('SELECT g.*, gmi.ctime, gmi.reason
FROM {group} g
JOIN {group_member_invite} gmi ON gmi.group = g.id
WHERE gmi.member = ? AND g.deleted = ?', array($userid, 0));
}
/**
* Establishes what role a user has in a given group.
*
......
......@@ -1707,7 +1707,10 @@ function profile_sideblock() {
}
$data['unreadnotifications'] = call_static_method(generate_class_name('notification', 'internal'), 'unread_count', $USER->get('id'));
$data['unreadnotificationsmessage'] = $data['unreadnotifications'] == 1 ? get_string('unreadmessage') : get_string('unreadmessages');
$invitedgroups = get_invited_groups();
$invitedgroups = get_records_sql_array('SELECT g.*, gmi.ctime, gmi.reason
FROM {group} g
JOIN {group_member_invite} gmi ON gmi.group = g.id
WHERE gmi.member = ? AND g.deleted = ?', array($USER->get('id'), 0));
$data['invitedgroups'] = $invitedgroups ? count($invitedgroups) : 0;
$data['invitedgroupsmessage'] = $data['invitedgroups'] == 1 ? get_string('invitedgroup') : get_string('invitedgroups');
$data['pendingfriends'] = count_records('usr_friend_request', 'owner', $USER->get('id'));
......
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