views:

20

answers:

1

Hi.

For some reason it seems that WP3.0 is bugged with everything relate to maintenance-mode.

The 2 maintenance-mode plugins (maintenance-mode & wp-maintenance-mode) cause the following problems:

  1. wp-maintenance-mode doesn't allow u login as an admin. He just blocks you at the wp-login page.
  2. wp-maintenance-mode even doesnt influence a thing.

The same thing happend to me when I tried to write it by myself using this tutorial.

This line worked perfect and showed the built-in maintenance screen, but when I tried to add the condition for is_user_logged_in(), the mode stops working, letting you see the cliend & back end, when u r logged in or logged out.

What can I do? Thanks for all the answerers.

A: 

The is_user_logged_in() function the tutorial provides is pretty terrible, and it's why you're getting false positives for being 'logged in'.

Instead, load the pluggable file that contains the default WordPress is_user_logged_in() function;

require_once (ABSPATH . WPINC . '/pluggable.php');
if ( ! stristr($_SERVER['REQUEST_URI'], '/wp-admin') && ! stristr($_SERVER['REQUEST_URI'], '/wp-login.php') && ! is_user_logged_in() )
    $upgrading = time();
else
    $upgrading = 0;
TheDeadMedic
Thank you man for your answer.I've loaded the pluggable file and I got this error- "Fatal error: Call to undefined function is_ssl()". I read and it seems like I have to dig into the php definitions of the server.I'm giving up and will upload everything so fast, that my users won't sense the update :)
Shlomi.A.
Just add this line before the others; `require_once (ABSPATH . WPINC . '/functions.php');`!
TheDeadMedic