NEW - Group Comment Plugin…
Posted: 24 June 2008 08:09 AM   [ Ignore ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10835
Joined  04-15-2006

Hiya,

I made this plugin exceptionally quickly in reply to a thread here.

Igor wanted a way to be able to style comments from a certain group differently to everyone elses.

This plugin should hopefully address that need. Whilst it is possible to style the original entry authors comments differently (scroll down to see my method wink ) this plugin allows you to style all members of a certain group differently.

Usage Instructions :

CSS Code

.group-comment {
        text
-transform: uppercase;
}
.not-a-group-comment {
        text
-transform: lowercase;
}

Obviously the CSS can be anything you need and you can use DIVs and anything else that you like in between the conditional shown below to lay out your comments just the way you want them

ExpressionEngine Code - Goes inside {exp:comment:entries} tag pair

{exp:group_comment member_id="{author_id}" group_id="1"}
{if belongs_to_group}
<p class="group-comment">{comment}</p>
{if:else}
<p class="not-a-group-comment">{comment}</p>
{/if}
{
/exp:group_comment}

Hope that helps someone somewhere. As mentioned before this was written in about 2 minutes so hopefully should work wink

Best wishes,

Mark

File Attachments
pi.group_comment.php.zip  (File Size: 2KB - Downloads: 236)
 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 26 June 2008 06:06 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  530
Joined  04-23-2008

Mark,

Good contribution! Couldn’t this work already? By running a conditional like so:

{if group_id != "1" AND group_id != "6"}
  Regular Comment
{if
:else}
  Super Admin
/ Editor group Comment

Managed to get it to work, but took me time to figure out to use an AND rather than a OR.

 Signature 

Danny Tam » Twitter | LinkedIn | Facebook | Flickr

Profile
 
 
Posted: 26 June 2008 07:05 AM   [ Ignore ]   [ # 2 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10835
Joined  04-15-2006

Well that’s just not fair if it does work as I couldn’t see a group_id anywhere in the comment entries variables tag pair listed in the documents downer

I just did a really quick cursory test and it seems as though what you have there does work! All my time wasted making the plugin due to either something missing in the documents or me not looking properly?

I may still be wrong as it was a really quick test though.

Sheesh am I going to be upset if I did all that just to find out there is a group_id variable that I have missed somewhere!!!

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 01 October 2008 12:17 PM   [ Ignore ]   [ # 3 ]  
Grad Student
Rank
Total Posts:  37
Joined  07-24-2003

When I attempt to use {group_id} it returns the same regardless of the posters group.

Profile
 
 
Posted: 06 November 2008 05:19 PM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  530
Joined  04-23-2008

dchrist,

I can confirm that my original method listed above does work. I’ve had it used in live examples before. Alas, I’ve yet to try it on new builds of EE but will give this a shot and will update this thread with results.

 Signature 

Danny Tam » Twitter | LinkedIn | Facebook | Flickr

Profile
 
 
Posted: 31 December 2009 08:28 AM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  129
Joined  11-05-2007

The {group_id} appears to return the group id of the currently logged in user, not the group id of the comment’s author. For some reason, the comments module doesn’t return the comment author’s group id.

I took the liberty of updating this plugin to support multiple groups. So, if you want to check if an author is a member of one of three groups you could do something like this.

{exp:group_comment member_id="{author_id}" group_id="1|6|8"}
    {if belongs_to_group}
        I am in one of these groups
!
    
{if:else}
        I am not in one of these groups
.
    
{/if}
{
/exp:group_comment}

Beware that this plugin adds a sql query for every comment on the page. Turning on caching for that template will help.

File Attachments
pi.group_comment.php.zip  (File Size: 2KB - Downloads: 30)
 Signature 

Looking for EE developers. PM me for details.

Profile
 
 
Posted: 01 February 2010 02:49 AM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  523
Joined  03-18-2007

Thanks for doing that Jason, very helpful.

Edit: I took my previously modified version down because of a possible bug with the caching.

-Matt

 Signature 

Follow me on Twitter: twitter.com/mrw

Profile
 
 
Posted: 03 March 2010 11:51 AM   [ Ignore ]   [ # 7 ]  
Summer Student
Total Posts:  14
Joined  10-27-2009

Thanks guys, this helped a ton!

Profile
 
 
Posted: 04 March 2010 11:09 AM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  129
Joined  11-05-2007

Matt, would you mind updating this thread if you get the bug worked out? Caching would be a great addition.

 Signature 

Looking for EE developers. PM me for details.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 03:47 PM
Total Registered Members: 120512 Total Logged-in Users: 76
Total Topics: 126580 Total Anonymous Users: 38
Total Replies: 665474 Total Guests: 328
Total Posts: 792054    
Members ( View Memberlist )
Newest Members:  12sarah123CasERispukgendaleOptimizaiofficeiEclipsekinkadebbbBenAbramsasantisteban