Skip to content

Commit

Permalink
Merge branch 'MDL-48525-28' of git://github.com/jleyva/moodle into MO…
Browse files Browse the repository at this point in the history
…ODLE_28_STABLE
  • Loading branch information
stronk7 committed Feb 2, 2015
2 parents 9555ae2 + 6dbf42a commit 36125f8
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions message/externallib.php
Expand Up @@ -444,12 +444,11 @@ public static function get_contacts() {
'unread' => $contact->messagecount
);

// Try to get the user picture, but sometimes this method can return null.
$userdetails = user_get_user_details($contact, null, array('profileimageurl', 'profileimageurlsmall'));
if (!empty($userdetails)) {
$newcontact['profileimageurl'] = $userdetails['profileimageurl'];
$newcontact['profileimageurlsmall'] = $userdetails['profileimageurlsmall'];
}
$usercontextid = context_user::instance($contact->id)->id;
$newcontact['profileimageurl'] = moodle_url::make_webservice_pluginfile_url(
$usercontextid, 'user', 'icon', null, '/', 'f1')->out(false);
$newcontact['profileimageurlsmall'] = moodle_url::make_webservice_pluginfile_url(
$usercontextid, 'user', 'icon', null, '/', 'f2')->out(false);

$allcontacts[$mode][$key] = $newcontact;
}
Expand Down Expand Up @@ -577,12 +576,11 @@ public static function search_contacts($searchtext, $onlymycourses = false) {
$user->phone1 = null;
$user->phone2 = null;

// Try to get the user picture, but sometimes this method can return null.
$userdetails = user_get_user_details($user, null, array('profileimageurl', 'profileimageurlsmall'));
if (!empty($userdetails)) {
$newuser['profileimageurl'] = $userdetails['profileimageurl'];
$newuser['profileimageurlsmall'] = $userdetails['profileimageurlsmall'];
}
$usercontextid = context_user::instance($user->id)->id;
$newuser['profileimageurl'] = moodle_url::make_webservice_pluginfile_url(
$usercontextid, 'user', 'icon', null, '/', 'f1')->out(false);
$newuser['profileimageurlsmall'] = moodle_url::make_webservice_pluginfile_url(
$usercontextid, 'user', 'icon', null, '/', 'f2')->out(false);

$user = $newuser;
}
Expand Down

0 comments on commit 36125f8

Please sign in to comment.