Skip to main content

JomSocial avatar display

1.5K Views
0 Replies
1 min read
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:

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.

0 Replies

No Replies Yet

Topic Author

M

monkeyman

@provitiligo

Topic Stats

Created Sunday, 08 December 2013 13:08
Last Updated Sunday, 08 December 2013 13:08
Replies 0
Views 1.5K
Likes 0

Share This Topic