MyBB Community Forums

Full Version: Group name.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there. In the plugin settings I have the ability to set display to groups (a plugin for the needs of my forum), these groups segregate comma (read the GID).
 $display = " IN (" . $mybb->settings['group_display'] . ")";
Well, now downloading the database name of the group:
$sql = $db->query("
	SELECT g.gid, g.title
        FROM ".TABLE_PREFIX."usergroups g     
        WHERE g.gid $display      
    "); 
Well, the result Downloads take a while loop.
That is:

	while($group = $db->fetch_array($sql)) 
Okay, retrieves the names of groups, but only the first one (the one entered in the settings (GID)) So, for example, 4 If I wanted this type 4,3,2 and so the result will be displayed with GID 4
What am I doing wrong?
First off, MyBB cache's the usergroups so doing

$groups = $cache->read("usergroups");

Is better.

Also, if you're wondering why it fetches 3,2 before 4 is because IN doesn't care about the order you put, so doing such as
$groups[4]['title']

Is the best.

Now I might have written it a bit wrong as I'm on my phone and I don't remember too much, hope it helps