View Full Version : if else conditionals
T_Richardson
07-08-2007, 07:09 PM
I have a custom page and I want only members to view it and direct guests the login/register page/popup.
Something like:
<if condition="$show['member']">
page contents
<else />
what code goes here to have the login page?
</if>
ragtek
07-08-2007, 07:32 PM
you could make this in the php file:
exec_header_redirect("login.php");
T_Richardson
07-08-2007, 08:07 PM
I put that code directly under <?php and got this error:
Fatal error: Call to undefined function: exec_header_redirect() in /home/alliedte/public_html/stats.php on line 2
Is there more to this code?
ragtek
07-08-2007, 08:11 PM
in templates php isn't allowed
you could make it in the php file
if ($vbulletin->userinfo['userid']){
eval('print_output("' . fetch_template('your_template') . '");');
}
else
{
exec_header_redirect("login.php");
}
Guest190829
07-08-2007, 08:11 PM
Use print_no_permission();
It will display a nice display message with login form as well. :)
ragtek
07-08-2007, 08:13 PM
lol
ok thats easier:D
in your php file after including global.php make this:
if (!$vbulletin->userinfo['userid']) print_no_permission();
that should be enought
T_Richardson
07-08-2007, 08:22 PM
got it - thank you very much for your help.
Now when guests view those pages I modified to show the No permissions login page, it still says that they are viewing that page and not the "No permissions" page in "Who's Online".
Guest190829
07-08-2007, 09:15 PM
got it - thank you very much for your help.
Now when guests view those pages I modified to show the No permissions login page, it still says that they are viewing that page and not the "No permissions" page in "Who's Online".
There should be a little stop sign image indicating they are getting A No Permissions error on Who's Online.
T_Richardson
07-08-2007, 09:17 PM
They are getting it for the default vb pages, but not the ones I created.
edgecutioner
08-04-2007, 11:36 AM
what't the whole code?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.