MyBB Community Forums

Full Version: Make page only visible for logged in members
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Alright, got a radio running on my forum.
I want to make it so only logged in members are allowed to tune in, whilst members that ain't logged in get a message that they either have to login or register.

The page; http://sharetune.net/misc.php?page=radio
You are using pagemanager so may I ask if you have the use MyBB template checked?
(2012-12-22, 07:46 PM)JordanMussi Wrote: [ -> ]You are using pagemanager so may I ask if you have the use MyBB template checked?

Yes it is.
Right can I ask you to uncheck it and add the following code at the beginning
<?php

global $mybb, $lang, $headerinclude, $header, $theme, $footer;
 
add_breadcrumb("Radio", "misc.php?page=radio");
if(!$mybb->user['uid'])
{
	error_no_permission();
}
$template .= '<html>
<head>
<title>'.$pages['name'].' - '.$mybb->settings['bbname'].'</title>
{$headerinclude}
</head>
<body>
{$header}
and this code at the end
<br/>
{$footer}
</body>
</html>';

$template=str_replace("\'", "'", addslashes($template));

eval("\$page=\"".$template."\";");

output_page($page);
?>
add you code in the middle but make sure you add a (\)before (')
Its giving me an error saying the page couldn't load when I add your code in and turn off the use mybb template.
(2012-12-22, 08:09 PM)one1one Wrote: [ -> ]Its giving me an error saying the page couldn't load when I add your code in and turn off the use mybb template.

Secound this. Thanks for all help.
Right I have changed the code but you need to make sure that you have all the appostifys (') have a backslash (\) in front of them.