The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Permission based links? Is it possible?
I've created several vbpowered pages which no matter what I do, I cannot get them to use permissions.
So........... I'd like to know if it's possible to hide the pages and just make a link to them, but make the link permission based? I'd like to make it so only registered users see the link and guests don't. |
#2
|
||||
|
||||
Are you doing this in vBulletin templates?
|
#3
|
|||
|
|||
Yes, that is correct. They are all vbulletin templates, produced with this hack. I tried over and over and over to get the usergroup perms to work on the temps, but all the pages are still viewable to guests. I am now hoping I can hide the link only and make that viewable to only certain user groups.
https://vborg.vbsupport.ru/showthrea...t=powered+page |
#4
|
|||
|
|||
If your just trying to make it where guests can't view the pages, in the php file which in that tutorial would be test.php add this code below where global.php is included
PHP Code:
|
#5
|
|||
|
|||
Like this?
Code:
<?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'downloads'); // 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( 'downloads', ); // pre-cache templates used by specific actions $actiontemplates = array( ); // ######################### REQUIRE BACK-END ############################ require_once('./global.php'); if (!$vbulletin->userinfo['userid']){ //user not logged in, give no permission message.. make a new template } else{ //user is logged in, fetch the template for the page. } // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### $navbits = array(); $navbits[$parent] = 'downloads'; $navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') . '";'); eval('print_output("' . fetch_template('downloads') . '");'); ?> |
#6
|
|||
|
|||
Quote:
eval('print_output("' . fetch_template('downloads') . '");'); except have it fetch a template you create saying they don't have permissions PHP Code:
|
#7
|
|||
|
|||
like this?
Code:
<?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'downloads'); // 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( 'downloads', ); // pre-cache templates used by specific actions $actiontemplates = array( ); // ######################### REQUIRE BACK-END ############################ require_once('./global.php'); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### $navbits = array(); $navbits[$parent] = 'downloads'; $navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') . '";'); if (!$vbulletin->userinfo['userid']){ //user not logged in, give no permission message eval('print_output("' . fetch_template('reg') . '");'); } else{ //user is logged in, fetch the template for the page. eval('print_output("' . fetch_template('downloads') . '");'); } ?> |
#8
|
|||
|
|||
Exactly...
|
#9
|
|||
|
|||
Doesn't work for me. Oh well. Guess I'll go back to using the cmps hide mod then. Thanks for your help.
|
#10
|
|||
|
|||
Ive just tried exactly what you posted with 3.7 and it worked. Are you sure that your default style holds the 'reg' template?
here are some screenshots of it working on my board... the downloads template is just the code for the template from that tutorial you posted with the title part changed to 'Downloads' and the reg template is the same code except with the title changed to 'You can't view this page' |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|