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: My own solution for Jcomments Avatar for Community Builder!
Pages: [1] 2   Go Down
  Print  
Author Topic: My own solution for Jcomments Avatar for Community Builder!  (Read 6056 times)
0 Members and 1 Guest are viewing this topic.
osman007
Jr. Member
**

Karma: 1
Offline Offline

Posts: 22


Email
« on: April 13, 2012, 21:34:45 »

Hello Jcomments en Community Builder users. I couldn’t wait for SMART to develope the Avatar plugin, so I made code for persons like me who can’t wait. I am not an expert developer, just a script kid.

It’s simpel.

Step 1:
Open /components/com_jcomments/tpl/default/tpl_comment.php

Step 2:
Replace:
====================
<div class="comment-avatar"><?php echo $comment->avatar; ?></div>
====================

By:
====================
<?php
  $database = & JFactory::getDBO();
  $jcommentaarid = $comment->userid;
  $sql = "SELECT avatar FROM #__comprofiler WHERE user_id= {$jcommentaarid}";
  $database->setQuery( $sql );
  $avatarmut = $database->loadResult();
?>

<div class="comment-avatar"><img src="images/comprofiler/tn<?php echo $avatarmut; ?>" title="<?php echo $avatarmut; ?>" width="36" height="36"/></div>
====================

Greetings,

Osman


Logged
ABTOP
Sr. Member
****

Karma: 17
Offline Offline

Posts: 399



WWW
« Reply #1 on: April 13, 2012, 22:57:28 »

I hope this doesn't burden your database too much.
Logged

No personal messages unless you are a friend or you have money for me.
osman007
Jr. Member
**

Karma: 1
Offline Offline

Posts: 22


Email
« Reply #2 on: April 13, 2012, 23:32:32 »

I know, but it's better than nothing  Wink
Logged
jeronemitchell
Newbie
*

Karma: 0
Offline Offline

Posts: 1


« Reply #3 on: April 25, 2012, 01:04:16 »

I registered to this site specifically to say "thank you". Your code worked like a charm, and since my website is one of those "me and my friends" projects, I'm not terribly worried about too many database i/o's or anything like that.

You saved me quite a bit of time and sanity!
Logged
sla
Newbie
*

Karma: 0
Offline Offline

Posts: 5


« Reply #4 on: April 26, 2012, 14:27:25 »

It works, thanks a lot!
Slawa
www.jedziemynasycylie.pl
Logged
osman007
Jr. Member
**

Karma: 1
Offline Offline

Posts: 22


Email
« Reply #5 on: April 27, 2012, 17:26:37 »

I registered to this site specifically to say "thank you". Your code worked like a charm, and since my website is one of those "me and my friends" projects, I'm not terribly worried about too many database i/o's or anything like that.

You saved me quite a bit of time and sanity!


You're welcome!  Grin
Logged
mikel2004
Newbie
*

Karma: 0
Offline Offline

Posts: 6


« Reply #6 on: May 17, 2012, 19:50:12 »

Somebody can write the Avatar code for JomSocial?

Thanks a lot!
Logged
sla
Newbie
*

Karma: 0
Offline Offline

Posts: 5


« Reply #7 on: May 21, 2012, 18:53:38 »

Hello Jcomments en Community Builder users. I couldn’t wait for SMART to develope the Avatar plugin, so I made code for persons like me who can’t wait. I am not an expert developer, just a script kid.
It works as I have written before, but only when you are registered and you have the avatar. In any other case it gives broken picture instead of the picture of "no avatar". May be it can be repair in any simple way?
Logged
totohariko
Jr. Member
**

Karma: 1
Offline Offline

Posts: 19


« Reply #8 on: May 22, 2012, 19:33:39 »

Hello,

Thanks for this, it works.

The photos have weird dimensions, though. Is it possible to display each picture with its original dimensions ?

Thanks in advance.
« Last Edit: May 22, 2012, 20:37:56 by totohariko » Logged
totohariko
Jr. Member
**

Karma: 1
Offline Offline

Posts: 19


« Reply #9 on: May 22, 2012, 21:27:53 »

Actually, I figured out how not to resize avatars.
In previous code modification for /components/com_jcomments/tpl/default/tpl_comment.php

Replace
Code:
<?php
  $database 
= & JFactory::getDBO();
  
$jcommentaarid $comment->userid;
  
$sql "SELECT avatar FROM #__comprofiler WHERE user_id= {$jcommentaarid}";
  
$database->setQuery$sql );
  
$avatarmut $database->loadResult();
?>


<div class="comment-avatar"><img src="images/comprofiler/tn<?php echo $avatarmut?>" title="<?php echo $avatarmut?>" width="36" height="36"/></div>

with:
Code:
<?php
  $database 
= & JFactory::getDBO();
  
$jcommentaarid $comment->userid;
  
$sql "SELECT avatar FROM #__comprofiler WHERE user_id= {$jcommentaarid}";
  
$database->setQuery$sql );
  
$avatarmut $database->loadResult();
?>


<div class="comment-avatar"><img src="images/comprofiler/tn<?php echo $avatarmut?>" title="<?php echo $avatarmut?>/></div>

and in /components/com_jcomments/tpl/default/style.css

search for:
Code:
/* Avatar */
#comments .comment-avatar img {width: 32px;border: none !important;}

replace with:
Code:
/* Avatar */
#comments .comment-avatar img { resize:none; width: auto; height: auto; border: none !important;}
Logged
sla
Newbie
*

Karma: 0
Offline Offline

Posts: 5


« Reply #10 on: May 23, 2012, 12:42:52 »

Hello, Thanks for this, it works...
Maybe you know what about these broken images when no avatar choosen? Like here: http://www.jedziemynasycylie.pl/sycylia-dokad/152-sycylia-dokad.html#comments? Thanks!
Logged
polhallen
Newbie
*

Karma: 0
Offline Offline

Posts: 3


Email
« Reply #11 on: September 15, 2012, 17:32:33 »

Hello and thanks!

with your last code, also emotions shows big!

thanks

Pol
« Last Edit: September 15, 2012, 17:46:28 by polhallen » Logged
polhallen
Newbie
*

Karma: 0
Offline Offline

Posts: 3


Email
« Reply #12 on: September 15, 2012, 17:59:31 »

is there a way to do same thing to "JComments Latest    " module?
Logged
trt
Newbie
*

Karma: 0
Offline Offline

Posts: 7


« Reply #13 on: December 11, 2012, 03:19:38 »

Actually, I figured out how not to resize avatars.
In previous code modification for /components/com_jcomments/tpl/default/tpl_comment.php

Replace
Code:
<?php
  $database 
= & JFactory::getDBO();
  
$jcommentaarid $comment->userid;
  
$sql "SELECT avatar FROM #__comprofiler WHERE user_id= {$jcommentaarid}";
  
$database->setQuery$sql );
  
$avatarmut $database->loadResult();
?>


<div class="comment-avatar"><img src="images/comprofiler/tn<?php echo $avatarmut?>" title="<?php echo $avatarmut?>" width="36" height="36"/></div>

with:
Code:
<?php
  $database 
= & JFactory::getDBO();
  
$jcommentaarid $comment->userid;
  
$sql "SELECT avatar FROM #__comprofiler WHERE user_id= {$jcommentaarid}";
  
$database->setQuery$sql );
  
$avatarmut $database->loadResult();
?>


<div class="comment-avatar"><img src="images/comprofiler/tn<?php echo $avatarmut?>" title="<?php echo $avatarmut?>/></div>

and in /components/com_jcomments/tpl/default/style.css

search for:
Code:
/* Avatar */
#comments .comment-avatar img {width: 32px;border: none !important;}

replace with:
Code:
/* Avatar */
#comments .comment-avatar img { resize:none; width: auto; height: auto; border: none !important;}


this is just cb users use for from avatar gallery.About non user or uploading own avatar? Not working
Logged
mjvvorst
Newbie
*

Karma: 0
Offline Offline

Posts: 2


Email
« Reply #14 on: December 14, 2012, 05:51:29 »

Osman,
Many thanks for your modifications!
Works like a charm, but be aware that it doesn't work when GZIP compression in the Joomla Global Configuration is enabled!
It took me several hours before I found out that this should be disabled (at least on my site).
Mark
Logged
Pages: [1] 2   Go Up
  Print  
JoomlaTune Support Forum    JComments component    General discussion    Topic: My own solution for Jcomments Avatar for Community Builder!
 
Jump to: