PDA

View Full Version : PHP page for guests...


wolfe
11-08-2016, 07:09 PM
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
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
<vb:if condition="$bbuserinfo['userid'] == 0">
show this to guests
</vb:if>

or use the below in your php:
if ($bbuserinfo['userid'] == 0)
{
do this for guests
}

wolfe
11-09-2016, 05:13 PM
Post your page code. You probably have some code in there that requires the user to login.

<?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?

wolfe
11-10-2016, 06:39 AM
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

its more than a condition issue mate.

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

no thats why im trying to make it viewable to guests like he login.php or sendmessage.php files are they use the template / theme but are visible to guests without allowing guests to see the forum before logging it :)

Lynne
11-10-2016, 04:09 PM
Hmmm, I'm not so sure how easy it is going to be then to get them to see the page. If it's just a welcome page, perhaps you can just do an HTML page instead?

wolfe
11-10-2016, 07:56 PM
all sorted editing the class_bootstrap.php thanks for the help people.