Restrict/allow users/groups - non vb pages
This modification is in the archives.
This hack will enable you to;
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. Code:
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 Code:
$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: Code:
require_once("./global.php"); Code:
// ## 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
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. Download No files for download. Screenshots
|