News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Maintenance mode and custom php pages

Started by rcane, August 09, 2023, 12:16:55 PM

Previous topic - Next topic

rcane

Good morning,

I have some custom php pages (just forms and such) on my forum. 

Maintenance mode doesn't seem to restrict access to those (I'm guess for folks that have a session still logged in?).

Where can I find the table that has the maintenance mode status value?

Is it something that SSI can check?

Else, I could make a query and put up a message (instead of page content) if the query tests positive.

Diego Andrés

By default there's no permission to access in maintenance mode, so checking if the user is an admin should do exactly the same.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Sesquipedalian

Add the following near the top of your custom pages:

require_once('path/to/SSI.PHP');
Obviously, use the real path to SSI.php.

This will cause SSI.php to run as part of loading your custom page. SSI.php will check the maintenance mode status of your forum and block access if necessary.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Kindred

Maintenance mode is set in Settings.php, not the database...  so the value is loaded and should be available as a global setting
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

rcane

Thanks.  I've already got SSI required.

I saw several people using the page while it was mx mode on.  I guess they were already logged in.

For the moment I just put a conditional on $maintenance and wrapped it around the html content.  That tested fine.

Thanks Kindred.  I also found an old post I made on this subject.   You need an additional button next  to "solved".     "dummy found he already asked this"

Advertisement: