Hi

A simple question really. Did a few searches already and couldnt find anyone who was trying to do this.

How to hide "Operating in off-line mode." ?

So it set the site offline, because I'm developing it still. Now I'd like to get rid of that annoying message, as it really confuses me when trying to get the page looks right. Is there an easy way to achieve this?

Regards
Henry

Comments

tom_buytaert’s picture

you could also put the site on-line, and then protect the site with a password.

http://webdesign.about.com/od/htaccess/ht/hthtaccess.htm

KingHenry’s picture

Thanks for your reply. A brilliant idea. Unfortunately that doesnt server the purpose this time, as at the moment Im still letting my test users to the site thru the page/user page. That approach would make that a bit harder. :)

Any other ideas? ;)

recrit’s picture

could put something like this in your theme's preprocess_page function to remove it and still have any other messages still displayed.

/** FOR DEVELOPMENT ONLY **/
  $msgs = &$vars['messages'];
  $msgs = preg_replace('/^.*Operating in off\-line mode.*$/m', '', $msgs);
  if (strpos($msgs, '<li>') === FALSE) {
    $msgs = '';
  }
Josephnewyork’s picture

That code left an unclosed div in my messages. But anyways, you should altar the data before its themed as Its cleaner and faster than regexing the themed output.

Just throw this in your template.php...

/**
 * Removes the off-line status message.
 * Only use during development or for
 * client approvals.
 *
 * @param $proceed
 *   Bool for removing or not.
 */
function off_line_status($proceed=FALSE) {
	if(!$proceed) return;
	if(is_array($_SESSION['messages']['status'])) {
    $offline = l(t('Operating in off-line mode.'), 'admin/settings/site-maintenance');
    $statuses = array();
    foreach($_SESSION['messages']['status'] as $status) {
        if($status != $offline) $statuses[] = $status;
    }
    if(!count($statuses))    {
        unset($_SESSION['messages']['status']);
    } else {
        $_SESSION['messages']['status'] = $statuses;
    }
  }
}
off_line_status(TRUE);
krisrobinson’s picture

Thank you for this. I always like to hide this while I'm theming stuffs.

ilfelice’s picture

How to do this in D7?