MyBB Community Forums

Full Version: Group leader!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I think on the /showteam.php how it show you the team members i also think it should have next to the name of the leader of that group (Leader)

so for eg: ChrisR (Leader)
on my forum it would look like that

do you know what i mean that so would so good so people know are the group leaders.
I was thinking of this too, a while ago.
Very good idea
Possible solution :

Open showteam.php

Find
PHP Code:
        $user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']); 

Add below
PHP Code:
        $query $db->simple_select(TABLE_PREFIX."groupleaders""*""uid='{$user['uid']}' && gid='{$usergroup['gid']}'");
        if(
$db->num_rows($query) != 0)
        {
            
$user['username'] .= " (Leader)";
        } 
That solution seems inefficient. You should only do one query to determine the group's leader(s) instead of once per user in that group.
Thats why i wrote "Possible Solution" ...
Dunno if this works (untested):

Find:
PHP Code:
$query $db->simple_select(TABLE_PREFIX."users""uid, username, displaygroup, usergroup, ignorelist, hideemail, receivepms""displaygroup IN ($groups_in) OR (displaygroup='0' AND usergroup IN ($groups_in)) OR uid IN ($users_in)", array('order_by' => 'username')); 
Replace with:
PHP Code:
$query $db->query("SELECT u.uid, username, displaygroup, usergroup, ignorelist, hideemail, receivepms, g.lid
FROM "
.TABLE_PREFIX."users u
LEFT JOIN "
.TABLE_PREFIX."groupleaders g ON u.uid=g.uid
WHERE displaygroup IN ($groups_in) OR (displaygroup='0' AND usergroup IN ($groups_in)) OR uid IN ($users_in)
ORDER BY 'username'"
); 

Find:
PHP Code:
$user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']); 
After, add:
PHP Code:
        // we'll be cheeky, and assume that a valid g.lid means a leader
        
if($user['lid'])
            
$user['username'] .= ' (leader)'
This was a Suggestion! i did not post it here to get the code but its nice of you making up the code.
Reference URL's