JomSocial avatar display
JomSocial avatar display
There's a pretty tricky issue with JomSocial avatar display. If you choose in settings to display user avatar from JomSocial and login to site, questions from guests (created_by = 0) will have YOUR OWN avatar in questions list (popular, latest etc.).
Problem lies in answers model, line 194:
If question is from quest, then created_by and created_by_alias will be NULL. So in answers default template, when you call CJFunctions::get_user_avatar() function $item->created_by parameter will be equal NULL as well. Now follow it and in functions.php file on line 762 you'll find:
$userid here equals NULL. It appears, that if no user ID is given, JomSocial takes current logged user ID and that's why avatar will be displayed improperly.
For now I applied a quick fix for template. I put this:
Before this line:
It looks good now, but probably should should tweak Db query a bit.
Problem lies in answers model, line 194:
u1.id as created_by, u1.username as created_by_alias,
If question is from quest, then created_by and created_by_alias will be NULL. So in answers default template, when you call CJFunctions::get_user_avatar() function $item->created_by parameter will be equal NULL as well. Now follow it and in functions.php file on line 762 you'll find:
$user = CFactory::getUser( $userid );
$userid here equals NULL. It appears, that if no user ID is given, JomSocial takes current logged user ID and that's why avatar will be displayed improperly.
For now I applied a quick fix for template. I put this:
<?php if(!$item->created_by) $item->created_by = 0; ?>
Before this line:
<?php if($this->params->get('user_avatar') != 'none'):?>
It looks good now, but probably should should tweak Db query a bit.
Access to viewing replies is restricted.
Showing 1 of 1 replies
You do not have permissions for replying to this topic.