Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2009-06-06 06:26:24

trichome
Member
Registered: 2008-05-22
Posts: 42

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.net/files.php?pid=56 and http://www.punres.net/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

Offline

#2 2009-06-06 06:31:54

Smartys
Former Developer
Registered: 2008-04-27
Posts: 3,139
Website

Re: Adding an icon beside the usernames of certain usergroups

Looks good to me

Offline

#3 2009-06-06 06:38:04

trichome
Member
Registered: 2008-05-22
Posts: 42

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)

Offline

#4 2009-06-06 15:18:42

Smartys
Former Developer
Registered: 2008-04-27
Posts: 3,139
Website

Re: Adding an icon beside the usernames of certain usergroups

$cur_post['g_id']

Offline

#5 2009-06-06 15:57:34

Paul
Developer
From: Wales, UK
Registered: 2008-04-27
Posts: 1,653

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 18:10:46

trichome
Member
Registered: 2008-05-22
Posts: 42

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

Offline

Board footer

Powered by FluxBB