Joomla Components and Professional Joomla Templates

      
    | 

JoomlaComment and JomSocial integration

( 9 Votes )

Many of you have requested the possibility to show jomsocial avatar in comments. Now I finally found the time to install jomSocial and to write the necessary code for this. You will find the option to show jomsocial avatar in the next version of joomlacomment, but for those who are not afraid to make changes to comment.class.php and want to test the code you are welcome to do so.

The first thing you will need to do is to open comment.class.php and go around line 2262 (this is the post_htmlCode function): Find this code:
if ($this->_avatar) {
if(JString::strpos($this->_avatar,"gallery/")===false) {
$path = JURI::base()."/images/comprofiler/tn$this->_avatar";
} else {

$path = JURI::base()."/images/comprofiler/$this->_avatar";
}

$html     = str_replace('{avatar_picture}', $this->profileLink("<img class='avatar' src='$path' alt='avatar' />", $this->_user_id), $html);
} else if ($this->_gravatar) {
$gravatar_email = $this->_item['email'];
$default = JURI::base().'components/com_comment/assets/images/nophoto.jpg';
$size = 60;
// Prepare the gravatar image
$path = "http://www.gravatar.com/avatar.php?gravatar_id=".md5(strtolower($gravatar_email)).
"&default=".urlencode($default)."&size=".$size;

$html = str_replace('{avatar_picture}', $this->profileLink("<img class='avatar' src='$path' alt='avatar' />", $this->_user_id), $html);
}

and change it to this:

//if ($this->_avatar) {
//            if(JString::strpos($this->_avatar,"gallery/")===false) {
//                $path = JURI::base()."/images/comprofiler/tn$this->_avatar";
//            } else {
//    
//                    $path = JURI::base()."/images/comprofiler/$this->_avatar";
//            }
//    
//            $html     = str_replace('{avatar_picture}', $this->profileLink("<img class='avatar' src='$path' alt='avatar' />", $this->_user_id), $html);
//        } else if ($this->_gravatar) {
//            $gravatar_email = $this->_item['email'];
//            $default = JURI::base().'components/com_comment/assets/images/nophoto.jpg';
//            $size = 60;
//            // Prepare the gravatar image
//            $path = "http://www.gravatar.com/avatar.php?gravatar_id=".md5(strtolower($gravatar_email)).
//                        "&default=".urlencode($default)."&size=".$size;
//    
//            $html = str_replace('{avatar_picture}', $this->profileLink("<img class='avatar' src='$path' alt='avatar' />", $this->_user_id), $html);
//        }

Now after the above code add this:

$path = JURI::root() . $this->jomSocialAvatar($this->_item['userid']);
$html = str_replace('{avatar_picture}', $this->jomSocialProfileLink("<img class='avatar' src='$path' alt='avatar' />", $this->_item['userid']), $html);

After the closing bracet "{" of the post_htmlCode function add those 2 functions:

function jomSocialProfileLink($s, $id) {
if ($id) {
$link = JRoute::_('index.php?option=com_community&view=profile&userid='.$id);
return "<a href='$link'>".$s."</a>";
} else {
return $s;
}

}
function jomSocialAvatar ($id) {
if($id) {
$database =& JFactory::getDBO();

$query = 'SELECT thumb FROM #__community_users WHERE userid = ' . $id;
$database->setQuery($query);
$result = $database->loadObject();
return $result->thumb;
} else {
return 'components/com_community/assets/default_thumb.jpg';
}
}

This should be everything! Don't forget to enable the use of avatar in the backend. Please report back! I've tested this code on a system with only one account - the administrator one :) I will be happy to hear that it works as well on a community website :)

Comments (14)
  • petunia
    avatar

    hi daniel, i have no test your code yet, but i want to share this that i have found on another community, is a hack to show jomsocial avatar in comments and also you can choose from backend wich avatar you want to show, jomsocial, CB, gravatar or none.

    This hack was made by jsharim, i have test it and works for me, maybe this could help you with integration. :)

    http://www.4shared.com/file/140851433/6ef67a74/joomlacomment_js_cb.html

  • SKDA  - SEO for joomlacomment + comprofiler
    avatar

    http://compojoom.com/component/comprofiler/userprofile/petunia
    I see this link display. How to make it?
    Thanks!

  • Alejandro  - did not work
    avatar

    Do i need to have CB installed? Maybe you can post the file for download.

    A.

  • Alejandro  - Yes it works fine... sorry about last post
    avatar

    Just Great THNX!!!!!!!!!!

  • Alejandro  - error whne using micosoft explorer
    avatar

    Daniel. I change code to use jomsocial avatar but get an error while commenting using micosoft explorer... please try the site so you get the error message. Still the message does get posted, but error is confusing users.

    A.

  • Daniel Dimitrov
    avatar

    Alejandro you are not really using joomlacomment, are you? What I see is jcomment

  • Alejandro  - That´s right
    avatar

    I had to change. But I found a plugin -Jbolo - that was causing problems everywhere. So it is possible that was the problem with IE adn Joomla Comment. Good luck.

  • John  - Awesome
    avatar

    This helped me alot thanks :)

  • kay  - Yeaaaaaaaaaah
    avatar

    Good show my people... Big up to Essence too...Fuck da bull shit you guys are making it...And i'm so down with it...Keep doing what you do my niggaz. Much LOVE.... PEACE..... Fred from Italy.

  • Vladimir
    avatar

    I have a new version RC1 of the code is different. Can never forced to work, otherwise I have JomSocial 1.5.248.

    Can you explain more?

  • Antony
    avatar

    Great Joomla! Extension.It's The Best Comment Component that I've ever used.I installed it in my Joomla! site and it works like a charm.Easy to configure with a lot of features to get it working just like you want it.

  • Steve
    avatar

    I can't find the file to edit in compojoomcomment (pro version). Where can I make these changes in it? Thanks!

  • Daniel Dimitrov
    avatar

    [url=http://compojoom.com/forum/25-compojoomcomment/45-newbies-area/9482-linking-jomsocial-profile- avatar]here[/url]

Write comment
Your Contact Details:
Gravatar enabled
Comment:
[b] [i] [u] [s] [url] [quote] [code] [img]   
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch::(:shock:
:X:side::):P:unsure::woohoo::huh::whistle:;):s :!::?::idea::arrow:
Security

Testimonials

Best support, fast upgrades

I don't really leave as many reviews as I should, but the support provided by Daniel is on par with the other leading extensions support groups.
I bought the component and installed it, and had questions about some customization (support for JomSocial + Avatars). I posted my questions on the forum, and within a couple of hours I had a very helpful response. I used to use the free !JoomlaComment extension, but when I saw that they went "pro" I definitely trusted their work on my site....

Professional coded..

Easy and quick install, a lot of features (antispam protection, quoting previous comments, reply to comments, rss and e-mail subscription...). I've tested some other comment modules for joomla and compojoom is one of the best because of the features and I've found no bug at all during testing...

Read all testimonials >>

Newsletter




Our Blog

Hacking competition is over (1)
02.09.2010, 01:32:
I'm sad to announce that our hacking competition is over. However I'm really happy to say that the latest compojoomComment 4.1.7 couldn't be cracked : ...
Read more

Latest Forum Posts

by admin
Today 09:42:36
by admin
Today 07:07:26
by hensonjiew@gmail.com
Today 06:27:37
by admin
Yesterday 13:01:51
by admin
Yesterday 13:00:03

Who's online

We have 2007 guests and 1 member online

Subscribe

You need a support subscription to download our commercial extensions

clickbuy

Advertisement