MyBB Community Forums

Full Version: Page accessible only to specific user groups
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to make a php page accessible only to specific user groups?

Note: i use Page Manager plugin for the page i made.
You can try something like below:

$usergroups = array(4, 3);

if(!in_array($mybb->user['usergroup'], $usergroups)) {

error_no_permission();

}


Edit the usergroups variable to your desire.
Thanks for fast reply im little noob can you explain me where i need to paste this?
What 'page' you want to restrict?
(2018-05-13, 06:10 PM)SickMelody Wrote: [ -> ]Thanks for fast reply im little noob can you explain me where i need to paste this?

Put it within the <php and ?> tag on whatever page you want to restrict. You may want to edit what groups are restricted by putting the group id(s) here separated by commas

$usergroups = array(4, 3);