MyBB Community Forums

Full Version: Hide an area for a specific User Group
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
First , see here ~ http://www.elitev2.com/videos.php

Under the Videos I want to insert another table, but only upgraded members can see it.

How do I do that?
You will have to add this to videos.php and add the content of videos in a new template called videos. Create the template in global templates.

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

if($mybb->user['usergroup'] == 6 || $mybb->user['usergroup'] == 3 || $mybb->user['usergroup'] == 4 || $mybb->user['usergroup'] == 9 || $mybb->user['usergroup'] == 2)
{
     // User is a Moderator || Super Moderator || Administrator || Subscriber || Registered
     eval("\$videos_home = \"".$templates->get("videos")."\";");
     output_page($videos_home);
}

if($mybb->user['usergroup'] == 1 || $mybb->user['usergroup'] == 5 || $mybb->user['usergroup'] == 7)
{
     // User is a Guest || Awaiting Activation || Banned
     error_no_permission();
}
add_breadcrumb("Watch Videos", "videos.php"); // (2)
?>
Thanks Alot Bob Smile
Hmm... didn't work,

Created a template named videoelite, and changed it in the code but nothing showed up?

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

if($mybb->user['usergroup'] == 6 || $mybb->user['usergroup'] == 3 || $mybb->user['usergroup'] == 4 || $mybb->user['usergroup'] == 9 || $mybb->user['usergroup'] == 2)
{
     // User is a Moderator || Super Moderator || Administrator || Subscriber || Registered
     eval("\$videoelite_home = \"".$templates->get("videoelite")."\";");
     output_page($videoelite_home);
}

if($mybb->user['usergroup'] == 1 || $mybb->user['usergroup'] == 5 || $mybb->user['usergroup'] == 7)
{
     // User is a Guest || Awaiting Activation || Banned
     error_no_permission();
}
add_breadcrumb("Watch Videos", "videos.php"); // (2)
?>


In videoelite I had
<table border="0" cellspacing="1" cellpadding="4" class="tborder"> 
<tr> 
<td class="thead" colspan="5"><strong>elite</strong></td> 
</tr>
</table>
Try this:

<?php
define('IN_MYBB', 1); 
require "global.php"; 

add_breadcrumb("Watch Videos", "videos.php");

if($mybb->user['usergroup'] == 6 || $mybb->user['usergroup'] == 3 || $mybb->user['usergroup'] == 4 || $mybb->user['usergroup'] == 9 || $mybb->user['usergroup'] == 2)
{
     // User is a Moderator || Super Moderator || Administrator || Subscriber || Registered
     eval("\$videoelite_home = \"".$templates->get("videoelite")."\";");
     output_page($videoelite_home);
}

if($mybb->user['usergroup'] == 1 || $mybb->user['usergroup'] == 5 || $mybb->user['usergroup'] == 7)
{
     // User is a Guest || Awaiting Activation || Banned
     error_no_permission();
}
?>
(2010-06-27, 04:06 PM)NeoFusion720 Wrote: [ -> ]Thanks Alot Bob Smile
Hmm... didn't work,

Created a template named videoelite, and changed it in the code but nothing showed up?

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

if($mybb->user['usergroup'] == 6 || $mybb->user['usergroup'] == 3 || $mybb->user['usergroup'] == 4 || $mybb->user['usergroup'] == 9 || $mybb->user['usergroup'] == 2)
{
     // User is a Moderator || Super Moderator || Administrator || Subscriber || Registered
     eval("\$videoelite_home = \"".$templates->get("videoelite")."\";");
     output_page($videoelite_home);
}

if($mybb->user['usergroup'] == 1 || $mybb->user['usergroup'] == 5 || $mybb->user['usergroup'] == 7)
{
     // User is a Guest || Awaiting Activation || Banned
     error_no_permission();
}
add_breadcrumb("Watch Videos", "videos.php"); // (2)
?>


In videoelite I had
<table border="0" cellspacing="1" cellpadding="4" class="tborder"> 
<tr> 
<td class="thead" colspan="5"><strong>elite</strong></td> 
</tr>
</table>
Make sure to have the PHP code I gave you in the videos.php file and the content you want to get displayed in the template. The template has to be created in the Global Templates and cant be created under a theme.
still nothin showin up?
The code given here is to output an entire page, that's what output_page does. If you want this in the videos page, put this somewhere in the videos.php file:

if(in_array($mybb->user['usergroup'], array(6,3,4,9,2)))
{
     eval("\$videoelite_home = \"".$templates->get("videoelite")."\";");
}

Then just put $videoelite_home wherever you want it to show on the page.
Still did not work, this is pissing me off
Paste the whole of the videos.php file and the contents of your videos template. This can't not work if you're doing it right.