Jump to content
TNG Community
RLByrd

Maintenance mode splash page

Recommended Posts

RLByrd

I'm running version 13.0.4, and occasionally put the site in maintenance mode for updates.  Granted, being in maintenance mode does display a small label on each page, but what I'd really prefer is to simply display a splash page with no access at all during maintenance mode time periods.

I could go into my template and code one, but being an IT person by trade and thus natively lazy, I thought I'd see if someone had perhaps already invented that wheel.

Feedback welcome.

Share this post


Link to post
Share on other sites
RLByrd

I'm sure there's a more elegant way to do this, but here's how I handled it.

Create a splash page to your liking--I captured the HTML from my existing page so the look and feel are the same.  Save it in your webroot with a name like "maintmode.html."

Add this bit of code at the bottom of tng_begin.php

if (($tngconfig['maint']) && ( ! $allow_admin )) {
          header("Location: https://www.houseofbyrd.com/gen/maintmode.html");
          die();
}

That's it. Now non-admin  users will get the splash page or the standard maintenance page, and admin  users that are already logged in will be unaffected.

Share this post


Link to post
Share on other sites
Philip Roy

Nice! This was something I was keen to see improved a couple of years ago...

My site isn't that active, but if I need to do some major work, I just do this to give people a heads up in advance...

GOES INTO INDEX.PHP OF TEMPLATE JUST AFTER </style>


<!-- MAINTENANCE ALERT START -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">  
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>  
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>  

<div class="alert alert-warning alert-dismissible fade show" role="alert">
  <strong>Site Maintenance Planned</strong> - The site will be offline at 5pm NZ for 30 minutes whilst I do some maintenance on the site. Apologies for any inconvenience this may cause. Cheers, Phil.
  <button type="button" class="close" data-dismiss="alert" aria-label="Close">
    <span aria-hidden="true">&times;</span>
  </button>
</div>
<!-- MAINTENANCE ALERT END -->

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×