Topic: Adding an icon beside the usernames of certain usergroups

First off, 1.4 is rockin'. Thanks for all the hard work. cool

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. smile

Re: Adding an icon beside the usernames of certain usergroups

Looks good to me

Re: Adding an icon beside the usernames of certain usergroups

Good to hear it's in the right direction. smile

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 07:10:44)

Re: Adding an icon beside the usernames of certain usergroups

$cur_post['g_id']

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.

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. cool