FluxBB Forums
Unfortunately no one can be told what FluxBB is - you have to see it for yourself.
You are not logged in.
Announcement
FluxBB 1.4.2 and FluxBB 1.2.23 are released, fixing a critical vulnerability in PHP's unserialize() function. Please upgrade ASAP.
#1 2009-06-06 07:26:24
- trichome
- Member
- Registered: 2008-05-22
- Posts: 24
Adding an icon beside the usernames of certain usergroups
First off, 1.4 is rockin'. Thanks for all the hard work. ![]()
I'd like to do what the title says. I found a couple mods on punres along the same lines (http://www.punres.org/files.php?pid=56 and http://www.punres.org/files.php?pid=445) and managed to sort of get something working.
Basically just editing viewtopic.php, replacing:
<dt><strong><?php echo $username ?></strong></dt>with
<?php
if ($user_title == $lang_common['Administrator']) {
?><dt><strong class="admicon"><?php echo $username ?></strong></dt><?php
}
elseif ($user_title == $lang_common['Moderator']) {
?><dt><strong class="modicon"><?php echo $username ?></strong></dt><?php
}
else { ?><dt><strong><?php echo $username ?></strong></dt><?php }
?>This of course only works when the the users title is either 'Administrator' or 'Moderator'.
I tried to figure it out from examples in existing files but my php is super weak.
Something with these?
($pun_user['g_id'] == PUN_ADMIN
($pun_user['g_moderator'] == '1'Thanks for any ideas. ![]()
Offline
#2 2009-06-06 07:31:54
- Smartys
- Former developer
- Registered: 2008-04-27
- Posts: 2,878
- Website
Re: Adding an icon beside the usernames of certain usergroups
Looks good to me
Offline
#3 2009-06-06 07:38:04
- trichome
- Member
- Registered: 2008-05-22
- Posts: 24
Re: Adding an icon beside the usernames of certain usergroups
Good to hear it's in the right direction. ![]()
What would be the correct way to make it take effect depending the usergroup rather than the user's title?
Something like
if ($group_id == '2')I'm php illiterate. :\
Last edited by trichome (2009-06-06 08:10:44)
Offline
#4 2009-06-06 16:18:42
- Smartys
- Former developer
- Registered: 2008-04-27
- Posts: 2,878
- Website
Re: Adding an icon beside the usernames of certain usergroups
$cur_post['g_id']
Offline
#5 2009-06-06 16:57:34
- Paul
- Site Admin
- From: Wales, UK
- Registered: 2008-04-27
- Posts: 1,600
Re: Adding an icon beside the usernames of certain usergroups
Why not just class="group-<?php echo $cur_post['g_id'] ?>"
Or $group_class = 'group-'.$cur_post['g_id']; then you can echo group_class in the post wrapper div and set all aspects of the posts style according to group.
The only thing worse than finding a bug is knowing I created it in the first place.
Offline
#6 2009-06-06 19:10:46
- trichome
- Member
- Registered: 2008-05-22
- Posts: 24
Re: Adding an icon beside the usernames of certain usergroups
Thanks a million, guys.
I'm using class="group-<?php echo $cur_post['g_id'] ?>"
What an elegant solution. ![]()
Offline
