Commit e0a74760 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Get profile icons with user records on group members page & online users


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent bb9ece16
......@@ -2143,7 +2143,7 @@ function onlineusers_sideblock() {
$user->profileiconurl = get_config('wwwroot') . 'thumb.php?type=profileicon&id=' . $user->id . '&size=20x20&earlyexpiry=1';
}
else {
$user->profileiconurl = get_config('wwwroot') . 'thumb.php?type=profileicon&id=' . $user->id . '&size=20x20';
$user->profileiconurl = profile_icon_url($user, 20, 20);
}
// If the user is an MNET user, show where they've come from
......
......@@ -1672,7 +1672,13 @@ function install_system_profile_view() {
/**
* Return profile icon url for a user
* Return profile icon url for a user. Use this to quickly get a url
* when you already have a bunch of user records with profileicon id &
* email address.
*
* Avoids reloading the 'no user photo' image for each user separately
* when we know they have no profile icon, and avoids the redirect to
* gravatar.
*/
function profile_icon_url($user, $maxwidth=40, $maxheight=40) {
if (is_array($user)) {
......
......@@ -372,7 +372,7 @@ class PluginSearchInternal extends PluginSearch {
if ($count > 0) {
$data = get_records_sql_assoc('
SELECT
u.id, u.firstname, u.lastname, u.username, u.email, u.staff, ' . db_format_tsfield('gm.ctime', 'jointime') . $gm_role . '
u.id, u.firstname, u.lastname, u.username, u.email, u.profileicon, u.staff, ' . db_format_tsfield('gm.ctime', 'jointime') . $gm_role . '
FROM
{usr} u
INNER JOIN {' . $group_member . '} gm ON (gm.member = u.id) ' . $where . '
......
......@@ -3,7 +3,7 @@
<tr class="{cycle values='r0,r1'}">
{foreach from=$row item=r}
<td>
<div class="fl"><img src="{$WWWROOT}thumb.php?type=profileicon&amp;maxsize=40&amp;id={$r.id|escape}" alt=""></div>
<div class="fl"><img src="{profile_icon_url user=$r maxwidth=40 maxheight=40}" alt=""></div>
<h3><a href="{$WWWROOT}user/view.php?id={$r.id|escape}">{$r.name|escape}</a></h3>
{if $r.role}
<div class="rel">
......
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