Quantcast
Channel: MyBB Community Forums - Tutorials
Viewing all articles
Browse latest Browse all 690

How To Restrict Access To Any Page

$
0
0
Hello,

In this basic tutorial I will be showing you have to restrict access to any page on MyBB to certain user groups.

1. Go to your forums root and find the page / file you want to restrict.
2. Open it with NotePad++ or something like that.
3. Add this code to the file

PHP Code:
$allowed = array('4','3','6','12','13'); // The numbers are the usergroup IDs

if(!in_array($mybb->user['usergroup'], $allowed))
{
    
error('You are not allowed to access this page.''Page Name');


4. Change the numbers to the user group IDs that are allowed to access the page.
5. Change the error message and the page name.

That's it save the file and place it back into your forums root.

Viewing all articles
Browse latest Browse all 690

Trending Articles