Want to create your very own vBulletin powered page which includes the header, footer, and the user permissions system as well?
Well now you can
Want to know how it will look? Take a look at the attached screenshot below!
Now includes the Who's Online modification! Also, instructions included on how to create your own pages that are integrated with current vBulletin files!
I'm going to give you a generic page but you can easily modify the contents of the page by changing the template
So here we go
Instructions:
Create a new file, whatever you want to call it (let's say test.php).
Open up test.php and add the following (replace TEST with whatever template you want to show):
PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS ####################### define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'test'); // change this depending on your filename
// ################### 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( 'TEST', );
// pre-cache templates used by specific actions $actiontemplates = array(
Be sure to change 'TEST' to the actual template name, and change 'test' to the filename. Also, change 'Test Page' to whatever you want to show in the navbar, such as 'Viewing Member Profile' (just an example).
Now create the template, called TEST with the following content:
Replace 'xxx' with whatever you want ?do= in the query string to be (for example, replace 'xxx' with 'showprofile' so then someone would type in example.php?do=showprofile to view this template.) Then of course, change TEMPLATE_XXX to your template name, it's that simple!
--------------- Added [DATE]1250445420[/DATE] at [TIME]1250445420[/TIME] ---------------
Quote:
Originally Posted by Lynne
Try changing this:
Code:
if (!$vbulletin->userinfo['userid']) print_no_permission();
To something more like this:
Code:
if (!$vbulletin->userinfo['userid'] OR !is_member_of($bbuserinfo, 5, 6, 7)) print_no_permission();
That will give an error if the user is not logged in or if the member is not a member of usergroups 5,6, or 7.
Quote:
Originally Posted by ilrglen
Will this then send them to the 'no permission page' or another error page?
Actually, to break down the code Lynne posted a little more,
The part print_no_permission(); spits out a "No Permission" error for the user if they are not registered or in the usergroups 5,6,7 which would obviously be this part of the code: if (!$vbulletin->userinfo['userid'] OR !is_member_of($bbuserinfo, 5, 6, 7))
if (!$vbulletin->userinfo['userid']) print_no_permission();
To something more like this:
Code:
if (!$vbulletin->userinfo['userid'] OR !is_member_of($bbuserinfo, 5, 6, 7)) print_no_permission();
That will give an error if the user is not logged in or if the member is not a member of usergroups 5,6, or 7.
Okay, I tried this and it worked when I was logged out but not when I was logged in. I am in Group 5 and it said I did not have sufficient permissions. Should this phrase not be
Code:
if (!$vbulletin->userinfo['userid'] OR !is_member_of($bbuserinfo, 1, 2, 3, 4)) print_no_permission();
I want the error page for groups 1, 2, 3, 4 and people not logged in.
Okay, I tried this and it worked when I was logged out but not when I was logged in. I am in Group 5 and it said I did not have sufficient permissions. Should this phrase not be
Code:
if (!$vbulletin->userinfo['userid'] OR !is_member_of($bbuserinfo, 1, 2, 3, 4)) print_no_permission();
I want the error page for groups 1, 2, 3, 4 and people not logged in.
Whoops, it should have been like this ($vbulletin->userinfo, not $bbuserinfo <- changed in post above now also):
Code:
if (!$vbulletin->userinfo['userid'] OR !is_member_of($vbulletin->userinfo, 5,6,7)) print_no_permission();
In firstpost, the code for the custom php should be changed:
Instead of
PHP Code:
error_reporting(E_ALL & ~E_NOTICE);
it should read
PHP Code:
error_reporting(E_ALL & ~E_NOTICE & ~8192);
to reflect the latest change introduced with 3.8.4 to take care of the PHP 5.3.0-related problems.
Perhaps the OP or one of the mods could take care of that.