MyBB Community Forums
Make Selective Usergroups By Pass from Password protected forums - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Resources (https://community.mybb.com/forum-8.html)
+--- Forum: Tutorials (https://community.mybb.com/forum-38.html)
+--- Thread: Make Selective Usergroups By Pass from Password protected forums (/thread-92532.html)



Make Selective Usergroups By Pass from Password protected forums - Yaldaram - 2011-04-18

If you want to make selective Usergroups to ByPass Password Protected Forums, then here is how;

Open ./inc/functions.php file and find;
function check_forum_password($fid, $pid=0)
{
	global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache;
	
	$showform = true;
and Change it to;
function check_forum_password($fid, $pid=0)
{
	global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache;
	
	$showform = true;

	$groups = array(3,4,6,8);
	if (!in_array($mybb->user['usergroup'],$groups))
	{

Now within the same file, find;
			$_SERVER['REQUEST_URI'] = htmlspecialchars_uni($_SERVER['REQUEST_URI']);
			eval("\$pwform = \"".$templates->get("forumdisplay_password")."\";");
			output_page($pwform);
		}
		exit;
	}
}

and add a single } at the end of the string, like that;
			$_SERVER['REQUEST_URI'] = htmlspecialchars_uni($_SERVER['REQUEST_URI']);
			eval("\$pwform = \"".$templates->get("forumdisplay_password")."\";");
			output_page($pwform);
		}
		exit;
	}
}
}

Now Change 3,4,6,8 in the above array() to the Usergroup IDs you wish to allow them to ByPass pasword protected forums Wink