MyBB Community Forums

Full Version: Load Template with certain usergroups
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Alright at the moment I have when people on my forum go to www.website.com/live.php it loads a template called "live" but only if you are a certain member. I got the following code:

<?php
define("IN_MYBB", 1);
$templatelist = "live";
require_once './global.php';

if($mybb->usergroup['canmodcp'] || $mybb->usergroup['issupermod'] || $mybb->usergroup['cancp'] || $mybb->user['usergroup'] == 9)
{
     // User is a Moderator || Super Moderator || Administrator || Subscriber
}

if(!$mybb->user['uid'] || $mybb->user['usergroup'] == 1 || $mybb->user['usergroup'] == 2 || $mybb->user['usergroup'] == 5 || $mybb->user['usergroup'] == 7)
{
     // User is a Guest || Registered || Awaiting Activation || Banned
     error_no_permission();
} 

add_breadcrumb("Watch Live", "live.php"); // (2)

eval("\$live_home = \"".$templates->get("live")."\";");
output_page($live_home);
?>

Now this works 100% perfect but now what I want to do is that if you are for example:
if($mybb->usergroup['canmodcp'] || $mybb->usergroup['issupermod'] || $mybb->usergroup['cancp'] || $mybb->user['usergroup'] == 9)
{
     // User is a Moderator || Super Moderator || Administrator || Subscriber
}
the template "goldlive" gets loaded.

and if you are:
if(!$mybb->user['uid'] || $mybb->user['usergroup'] == 1 || $mybb->user['usergroup'] == 2 || $mybb->user['usergroup'] == 5 || $mybb->user['usergroup'] == 7)
{
     // User is a Guest || Registered || Awaiting Activation || Banned
     error_no_permission();
} 
the template "live" gets loaded.

Basically I want it so if you are in a certain user group it loads a certain template in the live.php. I believe this is possible but I am horrible with PHP. Anyone care to help?

Thanks,
Bob