MyBB Community Forums

Full Version: [F] Forum Management - Setting permisions (when all perms are 0)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When all permissions are unchecked: (in ADMINDIR/index.php?module=forum/management&fid=FID#tab_permissions)
foreach($mybb->input['permissions'] as $gid => $permission)

will not work:
Warning [2] Invalid argument supplied for foreach() - Line: 1662 - File: admin/modules/forum/management.php PHP 4.3.11 (Linux)

File: /admin/modules/forum/management.php Line: 1662 Function: unknown

it might be only me but I can't seem to fix it :/
In /admin/modules/forum/management.php find:

foreach($mybb->input['permissions'] as $gid => $permission)
{
	foreach(array('canview','canpostthreads','canpostreplys','canpostpolls','canpostattachments') as $name)
	{
		if($permission[$name])
		{
			$permissions[$name][$gid] = 1;
		}
		else
		{
			$permissions[$name][$gid] = 0;
		}
	}
}

replace with

if(empty($mybb->input['permissions']))
{
	$mybb->input['permissions'] = array();
}
foreach($mybb->input['permissions'] as $gid => $permission)
{
	foreach(array('canview','canpostthreads','canpostreplys','canpostpolls','canpostattachments') as $name)
	{
		if($permission[$name])
		{
			$permissions[$name][$gid] = 1;
		}
		else
		{
			$permissions[$name][$gid] = 0;
		}
	}
}
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group