vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   PHP page for guests... (https://vborg.vbsupport.ru/showthread.php?t=323842)

wolfe 11-08-2016 07:09 PM

PHP page for guests...
 
Hi I tried to make a PHP landing page using the global.php so its links to the database but it always requires people to login before showing it how can I make it visible even if the rest of the site is locked out for guests :) thanks

RichieBoy67 11-08-2016 07:22 PM

You can use a conditional but I'm not exactly sure what you are trying to do.

Dragonsys 11-08-2016 07:29 PM

sounds like he has a vb page which he wants to display to guests, even though VB is not viewable to guests (forces a login to view)

wolfe 11-08-2016 09:01 PM

Quote:

Originally Posted by Dragonsys (Post 2578010)
sounds like he has a vb page which he wants to display to guests, even though VB is not viewable to guests (forces a login to view)

thats exactly what im after on vB 4.2.3

Lynne 11-08-2016 09:13 PM

Post your page code. You probably have some code in there that requires the user to login.

wolfe 11-08-2016 09:20 PM

it happens when i include the global.php file if I dont it works but it does not grab the theme info..

Im trying to use the Standard error template and add an intro video inside where the error message is as a welcome page but it requires a login when I include the global.php which I have to when displaying the theme / templates.

Dragonsys 11-09-2016 01:36 PM

You probably need to add the below conditional to your page template
Code:

<vb:if condition="$bbuserinfo['userid'] == 0">
show this to guests
</vb:if>

or use the below in your php:
Code:

if ($bbuserinfo['userid'] == 0)
{
do this for guests
}


wolfe 11-09-2016 05:13 PM

Quote:

Originally Posted by Lynne (Post 2578013)
Post your page code. You probably have some code in there that requires the user to login.

Code:

<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################

define('THIS_SCRIPT', 'welcome');
define('CSRF_PROTECTION', true);
// 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('WELCOME_PAGE');

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
// if your page is outside of your normal vb forums directory, you should change directories by uncommenting the next line
// chdir ('/path/to/your/forums');
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

$navbits = construct_navbits(array('' => 'Welcome PAge'));
$navbar = render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'Welcome Page';

// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######

$templater = vB_Template::create('WELCOME_PAGE');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());

?>


Dragonsys 11-09-2016 06:44 PM

Since you don't have any custom php code in there (you are just displaying a template), I would try adding the conditional to your template

Lynne 11-10-2016 01:13 AM

Do you allow Unregistered Users to view the regular start page of your site?


All times are GMT. The time now is 04:57 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.01188 seconds
  • Memory Usage 1,736KB
  • 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
  • (3)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete