Arven |
08-26-2010 10:08 AM |
Using the vB Login for a page
Hi!
Hit me with a hammer, I can't find the right keyword to search for it - maybe you can point me into the right direction.
I want to program a page that offers different content based on the user group a person is registered for in vb (currently 3.6.8, but I'll likely update to 3.8.6).
So: Everybody is allowed to see content A, but only those registered for the group "members" are allowed to see content B.
How do I do that in vB?
I have done something like this in the past, but got stuck:
Code:
<?php
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// ##################### DEFINE IMPORTANT CONSTANTS #######################
// change the line below to the actual filename without ".php" extention.
// the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation.
define('THIS_SCRIPT', 'uwodb');
// #################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array(
// change the lines below to the list of actual templates used in the script
'uwodb_test',
'uwodb_fullaccess',
);
// pre-cache templates used by specific actions
$actiontemplates = array();
// ########################## REQUIRE BACK-END ############################
require_once('./global.php');
// #################### HARD CODE JAVASCRIPT PATHS ########################
$headinclude = str_replace('clientscript', $vbulletin->options['bburl'] . '/clientscript', $headinclude);
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
$navbits = array();
// change the line below to contain whatever you want to show in the navbar (title of your custom page)
$navbits[$parent] = 'the Ultimate Warlord Online Deck Builder';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
// change the line below to contain the name of the actual main output template used in your script
if (is_member_of($vbulletin->userinfo, 14) OR is_member_of($vbulletin->userinfo, 16)) // is_member_of($vbulletin->userinfo, 6) OR
{
eval('print_output("' . fetch_template('uwodb_test') . '");');
}
elseif (is_member_of($vbulletin->userinfo, 6) OR is_member_of($vbulletin->userinfo, 2)) {
eval('print_output("' . fetch_template('uwodb_test') . '");');
//eval('print_output("' . fetch_template('uwodb_free') . '");');
}
else {
print_no_permission();
}
?>
Basically all I want to use is a header (even that is optional) and the vb user administration/cookies/whatever.
Thanks!
|