MyBB Community Forums

Full Version: Group leaders
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I noticed that the $groupleaders var is in global.php, but I can't seem to use it properly. I have a script that gets all groups and lists them, I have it up at http://gamingforums.net

Leaders are stored in mybb_groupleaders though, unless the table prefix is changed of course (I'm using TABLE_PREFIX Wink) as rows, I can probably do it if I used a query per group, but for external mysql servers a query per group is a lot, so I planned to filter them via PHP.

Since $groupleaders already exists from global.php I won't need to bother with that part, but the array structure is as followed (from a localhost test board):

Array ( [1] => Array ( [0] => Array ( [lid] => 1 [gid] => 1 [uid] => 1 [canmanagemembers] => 1 [canmanagerequests] => 1 [caninvitemembers] => 1 ) [1] => Array ( [lid] => 2 [gid] => 4 [uid] => 1 [canmanagemembers] => 1 [canmanagerequests] => 1 [caninvitemembers] => 1 ) ) )

$groupleader['1']['0']['gid'] would give me 1 in that case, which works.

I need to get all group leaders for a specific gid, and then use implode or something to add ', ' between them, perhaps I'm going about it wrong but I can't seem to figure out how to do just that.
What about using the array_intersect_key function?