I was wondering, is it possible to make it to where users can't view a page unless they're of a certain rank?
If it was possible, would I put it in the php or edit it through the template?
For example;
Member --> Staff Lounge --> Access Denied
Staff --> Staff Lounge --> Access Granted
Thanks!
Zane.
Put this at the beginning of your custom page script:
$allowed_gids = array(3, 4, 6); // Allowed group IDs
if(!isset($mybb->user['usergroup']) || !in_array($allowed_gids, $mybb->user['usergroup']))
{
error_no_permission();
}
$allowed_gids = array(3, 4, 6); // Allowed group IDs
if(!isset($mybb->user['usergroup']) || !in_array($mybb->user['usergroup'], $allowed_gids))
{
error_no_permission();
}
[quote pid='1318496' dateline='1541742853']
$allowed_gids = array(3, 4, 6); // Allowed group IDs
if(!isset($mybb->user['usergroup']) || !in_array($allowed_gids, $mybb->user['usergroup']))
{
error_no_permission();
}
[/quote]
I tried and it gave me this error:
It also creates a blank page if I place the code on top. If I place the code on the bottom however, it repeats the website. This is my code for it.
[php]<?php
define('IN_MYBB', 1); require "./global.php";
add_breadcrumb("GCN | Staff", "staff.php");
eval("\$html = \"".$templates->get("staff")."\";");
output_page($html);
$allowed_gids = array(4, 9, 8, 10, 3); // Allowed group IDs
if(!isset($mybb->user['usergroup']) || !in_array($allowed_gids, $mybb->user['usergroup']))
{
error_no_permission();
}
?>
[/php]
Lol. Silly mistake. Needle comes before haystack.
if(!isset($mybb->user['usergroup']) || !in_array($mybb->user['usergroup'], $allowed_gids))
Sorry.
(2018-11-10, 08:46 AM)effone Wrote: [ -> ]Lol. Silly mistake. Needle comes before haystack.
if(!isset($mybb->user['usergroup']) || !in_array($mybb->user['usergroup'], $allowed_gids))
Sorry.
No need to be sorry! This worked. Thank you so much