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: Any way to highlight or change the color of a comment made by an administrator.
Pages: [1] 2   Go Down
  Print  
Author Topic: Any way to highlight or change the color of a comment made by an administrator.  (Read 3395 times)
0 Members and 1 Guest are viewing this topic.
ninjapanda500
Newbie
*

Karma: 0
Offline Offline

Posts: 5


Email
« on: January 05, 2011, 13:29:33 »

I would really really like to have to feature, it is very important for my site to be able to determine the difference between user levels.
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #1 on: January 07, 2011, 04:23:28 »

Yes, you can... Every comment has additional CSS class which depends on user's usergroup. For super administrator it would be 'usertype-super-administrator'. So if you will look at comment's source code you'll find something like:

Code:
<div class="comment-box usertype-super-administrator">

So you can define your own styling for class 'usertype-super-administrator':
Code: (css)
.usertype-super-administrator {color: red !important;}
Logged

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

Karma: 0
Offline Offline

Posts: 5


Email
« Reply #2 on: January 08, 2011, 05:22:14 »

I'm not seeing this is the html... it each comment div simply says
Code:
<div id="comment-item-11" class="even">

I am using the K2 plugin, if that make any difference.
Logged
ninjapanda500
Newbie
*

Karma: 0
Offline Offline

Posts: 5


Email
« Reply #3 on: January 08, 2011, 05:24:53 »

Okay, I see the comment-box div now, but it still doesn't have an indication of user type.
This is an example comment on my site
Code:
<div class="comment-box">
<span class="comments-vote">
<span id="comment-vote-holder-11">
<a onclick="jcomments.voteComment(11, 1);return false;" title="Good comment!" class="vote-good" href="#"></a><a onclick="jcomments.voteComment(11, -1);return false;" title="Poor comment!" class="vote-poor" href="#"></a>
<span class="vote-none">0</span>
</span>
</span>
<a id="comment-11" href="****">#</a>
<span class="comment-author">***</span>
<span class="comment-date">2011-01-07 14:30</span>
<div id="comment-body-11" class="comment-body">****</div>
<span class="comments-buttons">
<a onclick="jcomments.showReply(11); return false;" href="#">Reply</a>
 | <a onclick="jcomments.showReply(11,1); return false;" href="#">Reply with quote</a> |
<a onclick="jcomments.quoteComment(11); return false;" href="#">Quote</a>
</span>
</div>

I starred out all the action comment info
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #4 on: January 09, 2011, 02:40:57 »

Okay, I see the comment-box div now, but it still doesn't have an indication of user type.
May be you're using earlier version? Or comments template from pervious JComments version... In JComments 2.2.0.2 this is already present. You can check this in /components/com_jcomments/tpl/default/tpl_comment.php file. It must contain code like:

Code: (php)
if (isset($comment->usertype)) {
$commentBoxIndentStyle .= ' usertype-' . $comment->usertype;
}
Logged

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

Karma: 0
Offline Offline

Posts: 5


Email
« Reply #5 on: January 10, 2011, 13:39:37 »

Ahh, I know what's wrong now. I am using a different template, even though my component is up to date. Do you think you can help explain how to add it into the template I'm using?
Logged
ninjapanda500
Newbie
*

Karma: 0
Offline Offline

Posts: 5


Email
« Reply #6 on: January 10, 2011, 13:45:23 »

I got it on my own. I just copied that code you gave me into the current template and it works now! Thanks for your help!
Logged
Thatoo
Newbie
*

Karma: 0
Offline Offline

Posts: 10


« Reply #7 on: September 17, 2011, 20:36:43 »

Hi,
I'm really interested by this function.
I have joomla 1.5.23 and jcomments 2.2.0.2.

in the source code of my web pages, I found what you said
Code:
Code:
<div class="comment-box usertype-super-administrator">

and in /components/com_jcomments/tpl/default/tpl_comment.php file, I found what you said,
Code: (php)
Code:
if (isset($comment->usertype)) {
$commentBoxIndentStyle .= ' usertype-' . $comment->usertype;
}


and what I understood is that I have to add in one css file :
Code: (css)
Code:
.usertype-super-administrator {color: red !important;}

So my question is simple, in which file and where in this file, I have to add this line?

Thank you so much for your help.
Logged
Thatoo
Newbie
*

Karma: 0
Offline Offline

Posts: 10


« Reply #8 on: September 17, 2011, 22:14:16 »

I finaly found.
I had to add this line in /components/com_jcomments/tpl/default/style.css file :

Code:
#comments .usertype-super-administrator .comment-body {background-color: red !important;}

just after
Code:
/* Date and Time*/
#comments .comment-date {font-size: 10px;color: #999;margin: 0;padding: 0 0 0 12px;background: url(images/jc_date.gif) no-repeat center left}
#comments .comment-body {color: #777;margin: 6px 0 0;padding:0 0 2px}
Logged
mb21
Newbie
*

Karma: -17
Offline Offline

Posts: 13


« Reply #9 on: September 25, 2011, 02:48:51 »

Somewhat related to this, is there any way you can change a comment's color based on the number of votes up or down? For example, if someone gets +5, it could be green or something like that. I've seen it on other blogs (not joomla) so it's probably possible. I just don't know how.
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #10 on: October 07, 2011, 15:19:16 »

@mb21: This could be implemented by small JComments' template modification.

1. Open /components/com_jcomments/tpl/default/tpl_comment.php
2. Find code:
Code: (php)
if (isset($comment->usertype)) {
$commentBoxIndentStyle .= ' usertype-' . $comment->usertype;
}
3. Add next code:
Code: (php)
$commentVote = intval($comment->isgood) - intval($comment->ispoor);
if ($commentVote != 0)  {
$commentBoxIndentStyle .=  (($commentVote >= 0) ? ' positive-' : ' negative-') . ($commentVote - ($commentVote % 5));
}

After this all comments which have non-zero rating will got additional CSS classes like (positive-5, positive-10, positive-15... or negative-5, negative-10..). So you will be able to color them as you want.


Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #11 on: October 10, 2011, 21:24:38 »

Something like this:
Code: (css)
#comments .positive-10 .comment-body {background-color: blue !important;}
#comments .positive-5 .comment-body {background-color: green !important;}
#comments .negative-5 .comment-body {background-color: red !important;}

If comment will have rating from 5 to 9 it's text will be green, if rating from 10 to 19 - it will be blue, and if it's rating will be negative (from -5 to -9) it will be red.
Logged

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

Karma: -17
Offline Offline

Posts: 13


« Reply #12 on: October 11, 2011, 01:50:02 »

Ah, thanks a lot.

Can I change it to % 4? and use

Code:
#comments .positive-4 .comment-body {background-color: green !important;}
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #13 on: October 11, 2011, 01:58:01 »

The expression $a % $b returns remainder of $a divided by $b. So if we have $commentVote = 23, the expression  ($commentVote % 5) will return 3 and $commentVote - 3 will return 20...  So the value '5' allows us to get styles for each 5th rates: 5, 10, 15, 20...

If you change 5 to 4 it will create styles for each 4 rates: 4, 8, 12, 16...
Logged

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

Karma: -17
Offline Offline

Posts: 13


« Reply #14 on: October 11, 2011, 02:59:27 »

One additional question about this and then I'm done bothering you. Rather than using the comment-body, can I use rbox_m (the entire comment)? I tried that, but it didn't seem to work. I'd like to have the entire comment (not just the body) have the background.
Logged
Pages: [1] 2   Go Up
  Print  
JoomlaTune Support Forum    JComments component    General discussion    Topic: Any way to highlight or change the color of a comment made by an administrator.
 
Jump to: