MyBB Community Forums

Full Version: How do I add no permissions page to custom page/link
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So, basically I'm trying to add the no permissions page - http://prntscr.com/3s47w3 - to either a custom page or a link like so /premium.php

- Thanks.
(2014-06-12, 03:41 PM)Krave Wrote: [ -> ]So, basically I'm trying to add the no permissions page - http://prntscr.com/3s47w3 - to either a custom page or a link like so /premium.php

- Thanks.

use the correct function in your custom code you may need to include some core mybb files in your script ... (global.php etc) then call the function you need ... if you wish to alter the error page away from default for this error only you may wish to just code it in 'premium.php' as an 'if' statement but without knowing the exact result it is difficult to give an exact answer[/php]
Here's an example of what I mean: http://prntscr.com/3s5580

I tried to click on the upgrade link and it comes up with this because I'm not logged in. I'm trying to do the same thing but with the permissions page if it's possible.
<?php
define("IN_MYBB", 1);
require_once "global.php";
if(!$mybb->user['uid'])
{
error_no_permission();
}
// Rest of your code goes here
?>
(2014-06-12, 05:18 PM)dragonexpert Wrote: [ -> ]
<?php
define("IN_MYBB", 1);
require_once "global.php";
if(!$mybb->user['uid'])
{
error_no_permission();
}
// Rest of your code goes here
?>

So it'd be something like so:
<?php
define("IN_MYBB", 1);
require_once "global.php";
if(!$mybb->user['uid'])
{
error_no_permission();
}
define('IN_MYBB', 1); require "./global.php";
add_breadcrumb("Premium", "premium.php"); 
eval("\$html = \"".$templates->get("Premium_Page")."\";"); 
output_page($html);
?>
The code you post is defining a constant twice which will result in a parse error. You should also use require_once instead of require because if the file is already included and you use require, it loads it again.