vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   if else conditionals (https://vborg.vbsupport.ru/showthread.php?t=151708)

T_Richardson 07-08-2007 06:09 PM

if else conditionals
 
I have a custom page and I want only members to view it and direct guests the login/register page/popup.

Something like:

PHP Code:

<if condition="$show['member']">
page contents
<else />
what code goes here to have the login page?
</if> 


ragtek 07-08-2007 06:32 PM

you could make this in the php file:
exec_header_redirect("login.php");

T_Richardson 07-08-2007 07:07 PM

I put that code directly under <?php and got this error:


Quote:

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 07:11 PM

in templates php isn't allowed

you could make it in the php file
PHP Code:

if ($vbulletin->userinfo['userid']){
   eval(
'print_output("' fetch_template('your_template') . '");');
}
else
{
  
exec_header_redirect("login.php");



Guest190829 07-08-2007 07:11 PM

Use print_no_permission();

It will display a nice display message with login form as well. :)

ragtek 07-08-2007 07: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 07: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 08:15 PM

Quote:

Originally Posted by T_Richardson (Post 1286123)
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 08:17 PM

They are getting it for the default vb pages, but not the ones I created.

edgecutioner 08-04-2007 10:36 AM

what't the whole code?


All times are GMT. The time now is 02:14 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01448 seconds
  • Memory Usage 1,730KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete