PDA

View Full Version : Disable maintenance for external pages?


Riotblade
03-28-2009, 12:19 AM
Hi, I'm using the basic integration method by calling global.php. Today, I put the Forum into maintenance mode to find out that whatever calls global.php will be redirected to the maintenance page. I was wondering if there was any way to prevent this?

Thanks

Lynne
03-28-2009, 02:11 AM
If your page is calling global.php, then it will follow the same maintenance 'rules'. global.php looks at your user properties and if you aren't an admin, you get the maintenance page.

Riotblade
03-28-2009, 02:56 AM
I dont suppose there's a way around it such as moving the maintenance code to another file? I dont want the forum maintenance to interfere with my main site.

JamesAB
03-28-2009, 04:24 AM
You can use the global_start hook and tell it to bypass this on certain pages.

Here's a snippet I used.

if (in_array(THIS_SCRIPT, array('400_forum', '401_forum', '403_forum',
'404_forum', '500_forum')))
{
$vbulletin->options['bbactive'] = true;
$servertoobusy = 0;
$vbulletin->userinfo['permissions']['forumpermissions'] |= $vbulletin->
bf_ugp_forumpermissions['canview'];
}

Just change the THIS_SCRIPT array to contain your external pages.

Riotblade
03-28-2009, 04:41 AM
Thanks for the snippet. However, in what form do my pages show up in the THIS_SCRIPT array? Let's say I'm loading it from "http://domain.com" or "http://domain.com/page.php". Do they show up with the http:// stripped?

Lynne
03-28-2009, 02:50 PM
THIS_SCRIPT is defined at the top of your php page. For instance, this is at the top of the showthread.php page:
define('THIS_SCRIPT', 'showthread');

Riotblade
03-28-2009, 04:30 PM
Works great, thanks

My next question would be if it's possible to create a session for each guest who visits the external pages to include them in the total "Who's online" count.

TigerC10
03-28-2009, 04:32 PM
It already does that... If you view the "who's online" page, it'll show you guests and members. The bottom of the forum home says, "x people online, y members and z guests". If your custom pages aren't compatible with the "who's online" stuff, then guests won't be shown.

View this article:
https://vborg.vbsupport.ru/showthread.php?t=157329