MyBB Community Forums
[F] Wrong query - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Community Archive (https://community.mybb.com/forum-106.html)
+--- Forum: Archived Forums (https://community.mybb.com/forum-143.html)
+---- Forum: Archived Development and Support (https://community.mybb.com/forum-155.html)
+----- Forum: Archived Bug Reports (https://community.mybb.com/forum-74.html)
+------ Forum: MyBB 1.2.2 (https://community.mybb.com/forum-49.html)
+------ Thread: [F] Wrong query (/thread-15780.html)



[F] Wrong query - Michael S. - 2007-01-28

In inc/class_session.php:
$query = $db->simple_select(TABLE_PREFIX."usergroups", "usergroup", "gid='".$mybb->user['banoldgroup']."'", array('limit' => 1)); 
			$group = $db->fetch_array($query);
			$mybb->user['usergroup'] = $group['usergroup'];
The problem is that there's no column with the name usergroup in the table usergroups. Do we need the query? It think it should be just this line:
$mybb->user['usergroup'] = $mybb->user['banoldgroup'];



RE: Wrong query - Ryan Gordon - 2007-01-28

In inc/class_session.php find:

$query = $db->simple_select(TABLE_PREFIX."usergroups", "usergroup", "gid='".$mybb->user['banoldgroup']."'", array('limit' => 1));
$group = $db->fetch_array($query);
$mybb->user['usergroup'] = $group['usergroup'];
$mybbgroups = $mybb->user['usergroup'];

and replace with

$mybb->user['usergroup'] = $mybb->user['banoldgroup'];
$mybb->user['displaygroup'] = $mybb->user['banolddisplaygroup'];
$mybb->user['additionalgroups'] = $mybb->user['banoldadditionalgroups'];
if($mybb->user['additionalgroups'])
{
	$mybb->user['additionalgroups'] = ','.$mybb->user['additionalgroups'];
}
$mybbgroups = $mybb->user['usergroup'].$mybb->user['additionalgroups'];



RE: [F] Wrong query - Ryan Gordon - 2007-01-28

This bug has been fixed in the latest code.

Please note the latest code is not live on the site or for download. An update will be released which contains this fix.