The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Maintenance mode
#3
heres what I've done,

create a new file maintenance.php, add the usual require init.php, header.php & navigation.php. add your html as you please and don't forget to require your footers aswell. anything is possible here including the use of fancy coming soon pages with countdowns etc.

in header.php

i changed:

<pre>
Code:
//dealing with if the user is logged in
if($user->isLoggedIn()){
    if (($settings->site_offline==1) && (!in_array($user->data()->id, $master_account)) && ($currentPage != 'login.php')){
        die("The site is currently offline.");
    }
}

//deal with non logged in users
if(!$user->isLoggedIn()){
    if (($settings->site_offline==1) && ($currentPage != 'login.php')){
        die("The site is currently offline.");
    }
}
//notifiy master_account that the site is offline
if($user->isLoggedIn()){
    if (($settings->site_offline==1) && (in_array($user->data()->id, $master_account)) && ($currentPage != 'login.php')){
        err("<br>The site is currently offline.");
    }
}
</pre>


and replaced with:

`//dealing with if the user is logged in
if($user->isLoggedIn() && !checkMenu(2,$user->data()->id)){
if (($settings->site_offline==1) && (!in_array($user->data()->id, $master_account)) && ($currentPage != 'login.php') && ($currentPage != 'maintenance.php')){
Redirect::to($us_url_root.'users/maintenance.php');
}
}

//deal with non logged in users
if(!$user->isLoggedIn() && !checkMenu(2,$user->data()->id)){
if (($settings->site_offline==1) && ($currentPage != 'login.php') && ($currentPage != 'maintenance.php')){
Redirect::to($us_url_root.'users/maintenance.php');
}
}

//notifiy master_account that the site is offline
if($user->isLoggedIn()){
if (($settings->site_offline==1) && (in_array($user->data()->id, $master_account)) && ($currentPage != 'login.php') && ($currentPage != 'maintenance.php')){

err("<br>The site is currently offline.");
}
}
'

now users are redirected to the maintenance page, you can go one further and have a link available only to admins to login

hope thats some use
  Reply


Messages In This Thread
Maintenance mode - by emanresu - 01-27-2017, 01:54 PM
Maintenance mode - by mudmin - 02-03-2017, 02:18 PM
Maintenance mode - by firestorm - 05-03-2017, 05:33 PM
Maintenance mode - by Brandin - 05-06-2017, 11:36 AM
Maintenance mode - by firestorm - 05-08-2017, 05:48 AM
Maintenance mode - by mudmin - 05-09-2017, 10:15 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)