Comments + Avatar
Posted: Wed Jan 18, 2012 11:35 pm
Hi,
I need some php coding help and I am using jomsocial + joomla. I am trying to get the avatar to show for the right user that made the comment. At the moment when a user comments it displays the users name and generates the link with their name to their correct profile. I have also got it so that the avatar links to the correct profile of the user that made the comment.
The avatar image is where I have the problem because it displays the image of the logged in user and not the user that made the comment. How do I connect the two?
At the top of the appropriate .php file I have added the following to get the jomsocial info.
Further down where the comment portion is in the same file I have
New to php and any help would be appreciated.
Thx.
I need some php coding help and I am using jomsocial + joomla. I am trying to get the avatar to show for the right user that made the comment. At the moment when a user comments it displays the users name and generates the link with their name to their correct profile. I have also got it so that the avatar links to the correct profile of the user that made the comment.
The avatar image is where I have the problem because it displays the image of the logged in user and not the user that made the comment. How do I connect the two?
At the top of the appropriate .php file I have added the following to get the jomsocial info.
Code: Select all
$jspath = JPATH_BASE.DS.'components'.DS.'com_community';
include_once($jspath.DS.'libraries'.DS.'core.php');
require_once( JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'userpoints.php');
$user =& CFactory::getUser();
$avatar = $user->getThumbAvatar();
$name = $user->getDisplayName();Code: Select all
<div class="comment comment_<? echo $k; ?>">
<?php $userprofile_link= JRoute::_( 'index.php?option=com_community&view=profile&userid='. $comment->user_id); ?>
<div class="comment_name"><a href="<? echo $userprofile_link; ?>"><? echo $comment->username; ?><img src="<?php echo $avatar; ?>" title="<?php echo $name ?>" alt="<?php echo $name ?>" /></a></div>
<div class="date"><? echo JHTML::_('date', $comment->date, JText::_('DATE_FORMAT_LC2')); ?></div>
<div class="comment_text"><? echo $comment->comment; ?></div>
</div>Thx.