Has anyone built a plugin to color usernames of a certain group differently when displayed. For example all forum moderators names would higlight red instead of the default color. We are switching over to gossamer and our current system has this functionality.
Sep 5, 2002, 2:32 AM
Enthusiast (524 posts)
Sep 5, 2002, 2:32 AM
Post #2 of 8
Views: 5264
Not a plugin but here's what I did:
http://www.gossamer-threads.com/...orum.cgi?post=202590
Safe swoops
Sangiro
http://www.gossamer-threads.com/...orum.cgi?post=202590
Safe swoops
Sangiro
Is there any way to do it other than when actually viewing the post. In particular on the category and forum list pages?
Also, for some reason I cannot seem to make anyone belong to the moderators group. When I view the groups I can see the moderators group, but when I try to add a user to it that group does not appear in the list of available groups.
Thanks for the help so far.
Also, for some reason I cannot seem to make anyone belong to the moderators group. When I view the groups I can see the moderators group, but when I try to add a user to it that group does not appear in the list of available groups.
Thanks for the help so far.
Sep 6, 2002, 10:21 AM
Enthusiast (648 posts)
Sep 6, 2002, 10:21 AM
Post #5 of 8
Views: 5226
This post may help you out. It concerns giving someone admin rights not for the admin panel but only for the forum :
http://www.gossamer-threads.com/...i?post=187369#187369
Jag
Significant Media
http://www.gossamer-threads.com/...i?post=187369#187369
Jag
Significant Media
Sep 7, 2002, 8:02 AM
Veteran (2577 posts)
Sep 7, 2002, 8:02 AM
Post #7 of 8
Views: 5204
I think having a different color setting assignable by the admin would make a nice addition / suggestion for another feature in the core script.
http://www.iuni.com/...tware/web/index.html
Links Plugins
http://www.iuni.com/...tware/web/index.html
Links Plugins
Sep 13, 2002, 12:21 PM
Novice (6 posts)
Sep 13, 2002, 12:21 PM
Post #8 of 8
Views: 5168
I have this almost working now based on groups with the folowing handly little function (Thanks to the other Jason):
sub colorize_user {
my ($username, $user_id) = @_;
# if no user_id was passed look it up
if (!$user_id and $username) {
$user_id = $DB->table("User")->select(user_id => {user_username => $username})->fetchrow;
}
# now color
if ($user_id and $username) {
# Color OSI Staff group
if ($DB->table("UserGroup")->count({user_id_fk => $user_id, group_id_fk => 42 })) {
$username = qq|<span style="color:#990000; font:bold">| . GT::CGI::html_escape($username). qq|</span>|;
}
# Color Moderator group
elsif ($DB->table("UserGroup")->count({user_id_fk => $user_id, group_id_fk => 43 })) {
$username = qq|<span style="color:#009900; font:bold">| . GT::CGI::html_escape($username). qq|</span>|;
}
}
return "$username";
}
In my templates I use it like this:
<%colorize_user($forum_last_poster)%>
Problem is the html generated by the sub gets escaped before it's printed (< changes to < and so on). So <span style="color:blah">User</span> just prints out instead of actually affecting the color of the text.
How do I keep this from happening?
Code:
sub colorize_user {
my ($username, $user_id) = @_;
# if no user_id was passed look it up
if (!$user_id and $username) {
$user_id = $DB->table("User")->select(user_id => {user_username => $username})->fetchrow;
}
# now color
if ($user_id and $username) {
# Color OSI Staff group
if ($DB->table("UserGroup")->count({user_id_fk => $user_id, group_id_fk => 42 })) {
$username = qq|<span style="color:#990000; font:bold">| . GT::CGI::html_escape($username). qq|</span>|;
}
# Color Moderator group
elsif ($DB->table("UserGroup")->count({user_id_fk => $user_id, group_id_fk => 43 })) {
$username = qq|<span style="color:#009900; font:bold">| . GT::CGI::html_escape($username). qq|</span>|;
}
}
return "$username";
}
In my templates I use it like this:
<%colorize_user($forum_last_poster)%>
Problem is the html generated by the sub gets escaped before it's printed (< changes to < and so on). So <span style="color:blah">User</span> just prints out instead of actually affecting the color of the text.
How do I keep this from happening?