VirtualBurn
07-30-2005, 10:00 PM
This hack will enable you to;
Stop Guests viewing non-vb pages
Stop Registered users viewing non-vb pages
Prompt with custom information
Allow 'specified' Group to access
For example:
This code stops my guests (ID:0) and my registered users (ID:2) from accesing the non-vb pages but with let the 'Premium Member' group (ID:9) walk right in.
################################################## ##
1. Create new phrase [ACP --> Lang & Phrases --> Phrase Manager --> Add New Phrase]
Phrase Type: Permissions
Varname: nonvb_restrict
Text: Your Message
e.g.Ticket support & Live support is an advanced feature only available to 'Premium Members'.<br /><br />
Please use the subscription service to enable this feature.
################################################## ##
2. Create new Template [ACP --> Styles & Templates --> Style Manager --> Add new template]
Style: Default style
Title: nonvb_restrict
template: Copy below$stylevar[htmldoctype]
<html id="vb" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle] - $pagetitle</title>
$headinclude
</head>
<body>
$header
$navbar
<table border="2" width="100%" cellspacing="1" cellpadding="1" >
<tr>
<td class="tcat">
Notice!
</td>
</tr>
<tr>
<td class="alt1" align="center"><br />
$vbphrase[nonvb_restrict]
<br /><br />
</td></tr>
</table>
$footer
</body>
</html>
################################################## ##
3. Protect Pages
In each of the non-vb pages you wish to protect find:require_once("./global.php");
and add the following code after:// ## NONVB_RESTRICT ##
if ($bbuserinfo['userid'] == 0 or $bbuserinfo['usergroupid'] == 2 and !is_member_of($bbuserinfo, 9))
{
eval('print_output("' . fetch_template('nonvb_restrict') . '");');
}
// ## END OF NONVB_RESTRICT
change the numbers in red as you desire.
0 = user ID 'Guest'
2 = group ID 'Registered'
9 = group ID 'Premium'
This has been tested, implemented and working.
Original code by 'Gary King' although his hack was different, various questions and suggestions throughout the thread prompted me to put this together.
Stop Guests viewing non-vb pages
Stop Registered users viewing non-vb pages
Prompt with custom information
Allow 'specified' Group to access
For example:
This code stops my guests (ID:0) and my registered users (ID:2) from accesing the non-vb pages but with let the 'Premium Member' group (ID:9) walk right in.
################################################## ##
1. Create new phrase [ACP --> Lang & Phrases --> Phrase Manager --> Add New Phrase]
Phrase Type: Permissions
Varname: nonvb_restrict
Text: Your Message
e.g.Ticket support & Live support is an advanced feature only available to 'Premium Members'.<br /><br />
Please use the subscription service to enable this feature.
################################################## ##
2. Create new Template [ACP --> Styles & Templates --> Style Manager --> Add new template]
Style: Default style
Title: nonvb_restrict
template: Copy below$stylevar[htmldoctype]
<html id="vb" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle] - $pagetitle</title>
$headinclude
</head>
<body>
$header
$navbar
<table border="2" width="100%" cellspacing="1" cellpadding="1" >
<tr>
<td class="tcat">
Notice!
</td>
</tr>
<tr>
<td class="alt1" align="center"><br />
$vbphrase[nonvb_restrict]
<br /><br />
</td></tr>
</table>
$footer
</body>
</html>
################################################## ##
3. Protect Pages
In each of the non-vb pages you wish to protect find:require_once("./global.php");
and add the following code after:// ## NONVB_RESTRICT ##
if ($bbuserinfo['userid'] == 0 or $bbuserinfo['usergroupid'] == 2 and !is_member_of($bbuserinfo, 9))
{
eval('print_output("' . fetch_template('nonvb_restrict') . '");');
}
// ## END OF NONVB_RESTRICT
change the numbers in red as you desire.
0 = user ID 'Guest'
2 = group ID 'Registered'
9 = group ID 'Premium'
This has been tested, implemented and working.
Original code by 'Gary King' although his hack was different, various questions and suggestions throughout the thread prompted me to put this together.