The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Check persmissions using PHP?
Hi all,
I have a small question concerning custom php code. I want to include a link to a php file on my forum that everyone can see. This php script should then check if the user is logged in. If he is, he is redirected to the content. If not, he gets a message that he does not have permission. I found the following code (this example should only work for admins), but that does not work. <?php if ($vbulletin->userinfo['usergroupid'] == '6' ) { echo "Welcome to the premium section!"; } else { echo "You do not have permission for this page"; } ?> I outputted the usergroupid variable, but it is just empty. I am completely new to vbulletin, so this might be a very noobish question. But please help Thanks in advance! |
#2
|
||||
|
||||
You need to include global.php in the page in order to check for permissions. See this - [How-To] vBulletin API Basics: Creating Custom Pages & Misc. Then you can check for usergroups by doing this:
PHP Code:
|
#3
|
|||
|
|||
Great, thanks for the quick reply, I'll get to it right away.
|
#4
|
||||
|
||||
Or you could just use:
PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|