Commit adf39639 authored by Ruslan Kabalin's avatar Ruslan Kabalin
Browse files

Fix false user avatar in message reply form (bug #663763)


Signed-off-by: default avatarRuslan Kabalin <ruslan.kabalin@luns.net.uk>
parent 9f171de5
......@@ -1837,9 +1837,27 @@ function install_system_dashboard_view() {
* gravatar.
*/
function profile_icon_url($user, $maxwidth=40, $maxheight=40) {
global $USER;
static $usercache = array();
if (is_array($user)) {
$user = (object)$user;
}
else if (is_numeric($user)) {
if (isset($usercache[$user])) {
$user = $usercache[$user];
}
else if ($user == $USER->get('id')) {
$user = new StdClass;
$user->id = $USER->get('id');
$user->profileicon = $USER->get('profileicon');
$user->email = $USER->get('email');
$usercache[$user->id] = $user;
}
else {
$user = $usercache[$user] = get_record('usr', 'id', $user);
}
}
if (!property_exists($user, 'profileicon') || !property_exists($user, 'email')) {
throw new SystemException('profile_icon_url requires a user with profileicon & email properties');
}
......
......@@ -6,7 +6,7 @@
{foreach from=$messages item=message}
<tr class="{cycle values='r0,r1'}">
<td style="width: 20px;">
<img src="{profile_icon_url user=$user maxwidth=20 maxheight=20}" alt="">
<img src="{profile_icon_url user=$message->from maxwidth=20 maxheight=20}" alt="">
</td>
<td>
<h5>
......
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