MyBB Community Forums

Full Version: make a private page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello MyBB I am trying to make a page for a group on my forum that only two groups can see that page, can someone please show me how to do that?


I have used Google, but I found no answers.


Thanks for your time and help!

Have a nice day
You'd need to use php.

Something like this:
if (in_array($mybb->user['usergroup'] , array(X,X)))error_no_permission();
Replace X and X with the two usergroup ids.
(2012-07-14, 09:19 PM)vernier Wrote: [ -> ]You'd need to use php.

Something like this:
if (in_array($mybb->user['usergroup'] , array(X,X)))error_no_permission();
Replace X and X with the two usergroup ids.

It does not work for some reason. I added the Admins Group and the VIP group, and it shows that I have no permissions ;o

<?php

define("IN_MYBB", 1);

require_once "./global.php";




define("IN_MYBB", 1);
define('THIS_SCRIPT', 'showteam.php');
if (in_array($mybb->user['usergroup'] , array(4,9)))error_no_permission(); 


?>
Oh sorry, misread the title. I thought the thread said 'two groups can't see the page'

My apologies.

Use something like this:


<?php

define("IN_MYBB", 1);

require_once "./global.php";




define("IN_MYBB", 1);
define('THIS_SCRIPT', 'showteam.php');
if (in_array($mybb->user['usergroup'] , array(4,9))) {
	//All your pages content here
}

else {
	error_no_permission(); 
}

?> 
(2012-07-14, 10:21 PM)vernier Wrote: [ -> ]Oh sorry, misread the title. I thought the thread said 'two groups can't see the page'

My apologies.

Use something like this:


<?php

define("IN_MYBB", 1);

require_once "./global.php";




define("IN_MYBB", 1);
define('THIS_SCRIPT', 'showteam.php');
if (in_array($mybb->user['usergroup'] , array(4,9))) {
	//All your pages content here
}

else {
	error_no_permission(); 
}

?> 
yaya thank you! now I have to find out how to use it on my template xD, thank you very much
You could use something like this:

<?php

define("IN_MYBB", 1);

require_once "./global.php";

add_breadcrumb("Title here", "somename.php");

if (in_array($mybb->user['usergroup'] , array(4,9))) {

	eval("\$html = \"".$templates->get("example")."\";"); 

output_page($html);
}

else {
	error_no_permission(); 
}

?>

example is the template name. You can create a template: Admincp -> Templates & Style -> Templates -> Your Template Set -> Add Template

Change that to your template name & in the template, you could use something like this:

<html>
<head>
<title>{$mybb->settings['bbname']} - Page Name</title>
{$headerinclude}
</head>
<body>
{$header}
{$footer}
</body>
</html>

You could add your content between the {$header} & {$footer} tags.
(2012-07-14, 10:40 PM)vernier Wrote: [ -> ]You could use something like this:

<?php

define("IN_MYBB", 1);

require_once "./global.php";

add_breadcrumb("Title here", "somename.php");

if (in_array($mybb->user['usergroup'] , array(4,9))) {

	eval("\$html = \"".$templates->get("example")."\";"); 

output_page($html);
}

else {
	error_no_permission(); 
}

?>

example is the template name. You can create a template: Admincp -> Templates & Style -> Templates -> Your Template Set -> Add Template

Change that to your template name & in the template, you could use something like this:

<html>
<head>
<title>{$mybb->settings['bbname']} - Page Name</title>
{$headerinclude}
</head>
<body>
{$header}
{$footer}
</body>
</html>

You could add your content between the {$header} & {$footer} tags.
Thank you, you're a great help. When I am done ill vote you as best answer. Smile
No worries! Smile

If you have any more questions, feel free to ask Smile
(2012-07-14, 10:53 PM)vernier Wrote: [ -> ]No worries! Smile

If you have any more questions, feel free to ask Smile

Thanks it worked! Smile

Guess its true... You learn something new everyday Big Grin.