Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    JComments component    General discussion    Topic: I cant see avatars
Pages: [1]   Go Down
  Print  
Author Topic: I cant see avatars  (Read 2187 times)
0 Members and 1 Guest are viewing this topic.
quetedigo
Newbie
*

Karma: 0
Offline Offline

Posts: 2


« on: March 22, 2010, 18:38:44 »

Hi,

I just install the module Jcomment with the necessary plugins (avatar, plugin), but I can not see the avatars in the comments and "recent comments" module. I'm testing the component with Joomla 1.5.15 in a local server with Internet access.





- I activated in the module "enable mambots" and "show avatars" options.
- I also have published the jcomment plugin with "avatar source" and "NoAvatar" with the "Gravatar" option.
- On tab "permissions" (preferences), I've activated the "show Gravatar" box for registered and unregistered users.

I do not know what the problem. I hope a little help. Thank you.
Logged
quetedigo
Newbie
*

Karma: 0
Offline Offline

Posts: 2


« Reply #1 on: May 18, 2010, 03:55:17 »

Hi guys,

here the solution for a custom gravatar for unregistered users:

Edit /plugins/jcomments/jcomments.avatar.php

Code:

//FIND CODE
return 'http://www.gravatar.com/avatar.php?gravatar_id='. md5(strtolower($email)) .'&default=' . urlencode($mainframe->getCfg('live_site') . '/components/com_jcomments/images/no_avatar.png');


//REPLACE
return 'http://www.gravatar.com/avatar.php?gravatar_id='. md5(strtolower($email)).'&s=32&d=wavatar';
 


//FIND CODE
$comments[$i]->avatar = '<img src="http://www.gravatar.com/avatar.php?gravatar_id='. md5($comments[$i]->email) .'&default=' . urlencode($mainframe->getCfg('live_site') . '/components/com_jcomments/images/no_avatar.png') . '" alt="" border="0" />';


//REPLACE
$comments[$i]->avatar = '<img src="http://www.gravatar.com/avatar.php?gravatar_id='.md5(strtolower($comments[$i]->email)).'&amp;s=32&amp;d=wavatar" alt="" border="0" />';
 


//FIND CODE
case 'jomsocial':
if (count($users)) {
       $db->setQuery('SELECT userid, thumb as avatar FROM #__community_users WHERE userid in (' . implode(',', $users)  . ')');
       $avatars = $db->loadObjectList('userid');
unset($users);
} else {
$avatars = array();
}
 
for ($i=0,$n=count($comments); $i < $n; $i++) {
$userid = (int) $comments[$i]->userid;
 
// profile link
$comments[$i]->profileLink = $userid ? JRoute::_('index.php?option=com_community&view=profile&userid=' . $userid) : '';
 
// avatar
       if (isset($avatars[$userid]) && $avatars[$userid]->avatar != '') {
         if (file_exists(JPATH_SITE . DS . $avatars[$userid]->avatar)) {
$comments[$i]->avatar = plgJCommentsAvatarImg(JURI::base() . $avatars[$userid]->avatar);
         } else {
$comments[$i]->avatar = '';
       }
} else {
$comments[$i]->avatar = '';
       }
}
unset($avatars);
break;
 

//REPLACE
case 'jomsocial':
if (count($users)) {
       $db->setQuery('SELECT userid, thumb as avatar FROM #__community_users WHERE userid in (' . implode(',', $users)  . ')');
       $avatars = $db->loadObjectList('userid');
unset($users);
} else {
$avatars = array();
}
 
for ($i=0,$n=count($comments); $i < $n; $i++) {
$userid = (int) $comments[$i]->userid;
 
// profile link
$comments[$i]->profileLink = $userid ? JRoute::_('index.php?option=com_community&view=profile&userid=' . $userid) : '';
 
// avatar
if (isset($avatars[$userid]) && $avatars[$userid]->avatar != '' && $avatars[$userid]->avatar != 'components/com_community/assets/default_thumb.jpg') {
         if (file_exists(JPATH_SITE . DS . $avatars[$userid]->avatar)) {
$comments[$i]->avatar = plgJCommentsAvatarImg(JURI::base() . $avatars[$userid]->avatar);
         } else {
$comments[$i]->avatar = '';
       }
} else {
$comments[$i]->avatar = '';
       }
}
unset($avatars);
break;


This is valid for Gravatar and JoomSocial.

Regards!!
« Last Edit: May 18, 2010, 03:58:26 by quetedigo » Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #2 on: May 18, 2010, 04:10:53 »

@quetedigo: Thank you for this patch (some fixes already applyed in upcoming JComments Avatar version). But some changes I don't understand.

What reason you replace default avatar with wavatar?

From Gravatar.com (http://ru.gravatar.com/site/implement/url):
Quote
You can specify a "default" or "d" parameter to the URL, this should be urlencoded so as to make it to our servers intact.

And one more. In JomSocial code you've added only this condition:

Code:
$avatars[$userid]->avatar != 'components/com_community/assets/default_thumb.jpg'

or I've missed some other changes?
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
freethinker
Newbie
*

Karma: 0
Offline Offline

Posts: 9


Email
« Reply #3 on: May 27, 2010, 16:04:21 »

my jcomments isn't appearing any users avatars  Sad
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #4 on: May 27, 2010, 16:05:34 »

my jcomments isn't appearing any users avatars  Sad
See here: http://www.joomlatune.com/jcomments-avatars.html
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
freethinker
Newbie
*

Karma: 0
Offline Offline

Posts: 9


Email
« Reply #5 on: May 27, 2010, 17:05:56 »

Thanks a LOT
*just had to activate the "Show Gravatar" in permissions  Grin
Logged
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    General discussion    Topic: I cant see avatars
 
Jump to: