Keyword

Jcomment Avatar for K2

  • Massoud
  • Massoud's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 10 months ago #106274 by Massoud
Jcomment Avatar for K2 was created by Massoud
I've been using Jcomment as main comment system for K2, but unforunatly the JComment Avatar Plugins have not been updated for J2.5, So I've been trying to update it to bring K2 Avatars to JComment,

now I Have this part of code in a Switch case, Please help me to update it from the K2 1.5 to 2.5 to get it work properly

case 'k2':
if (count($users)) {
$db->setQuery('SELECT userid, image as avatar FROM #__k2_users WHERE userid in ('.implode(',', $users).')');
$avatars = $db->loadObjectList('userid');
}

require_once (JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'route.php');
require_once (JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'utilities.php');

$avatarA = JPATH_SITE.DS.'media'.DS.'k2'.DS.'users'.DS;
$avatarL = JURI::root().'media/k2/users/';

for ($i=0,$n=count($comments); $i < $n; $i++) {
$userid = (int) $comments[$i]->userid;

// profile link
$comments[$i]->profileLink = $userid ? JRoute::_(K2HelperRoute::getUserRoute($userid)) : '';

// avatar
if (isset($avatars[$userid]) && $avatars[$userid]->avatar != '') {
if (file_exists($avatarA.$avatars[$userid]->avatar)) {
$comments[$i]->avatar = plgJCommentsAvatarImg($avatarL.$avatars[$userid]->avatar);
}
}
}
break;



Thank you so much in advance for any sort of helps.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum