Posts: 6
Threads: 2
Joined: Oct 2014
2014-10-28, 02:37:28
(This post was last modified: 2015-09-10, 00:16:12 by fripsy.
Edit Reason: Updated version
)
Hello all,
Today I released a simple plugin that enables you to put your site in "Maintenance Mode".
Download GSMaintenance here
Installation is straight forward, just copy the files in your plugin folder and off you go!
Should you have any problems or questions, please feel free to ask!
Cheers,
Frank.
Changelog:
v1.0.6 (09/09/2015)
- added UTF-8 in meta (thanks Arcio, Tyblitz)
- added stripslashes (thanks Arcio, Tyblitz)
- changed Dutch translation
- added exception for administrator (thanks Tyblitz)
v1.0.5 (14/01/2015)
- added German language file (thanks to phpman)
v1.0.4 (27/10/2014)
- returns STATUS 503 (Service unavailable) when in Maintenance (thanks to shawn_a)
- added French and Dutch language file
v1.0.3 (27/10/2014)
- bug: ckEditor didn't always show
v1.0.2 (27/10/2014)
- initial release
Posts: 6,267
Threads: 182
Joined: Sep 2011
You should probably also send a 503 for maint for SEO purposes
Not sure if you can in GS with that hook, but you can always check if headers not already sent.
Posts: 6,267
Threads: 182
Joined: Sep 2011
You can send httpd codes and content, they are not mutually exclusive.
PHP Code: header("HTTP/1.0 503"); echo "maintenance message"; die();
Posts: 6
Threads: 0
Joined: Feb 2015
Hi, this can be usefull while setting up the site. One suggestion/wish: can you please add option to show the web even in maintenance mode for certain (configurable) IPs? Thus I could for example cooperate with customer on web creation on the final hosting server and set that me and the customer would see the site during creation, while the rest of world will see the maintenance notice until the web is ready.
Posts: 1
Threads: 0
Joined: Mar 2015
In my case (ver 3.3.1) dont work well
Need two small changes
plugins/GSMaintenance.php
line 120 add <meta charset="utf-8">
Quote:echo '<html xmlns="http://www.w3.org/1999/xhtml"><head><meta charset="utf-8"><meta name="keywords" content="';
line 138 add stripslashes()
Quote:$xml->addChild('message', stripslashes(html_entity_decode($_POST['gsm_msg'], ENT_QUOTES, "utf-8")));
Posts: 48
Threads: 5
Joined: Apr 2015
2015-04-27, 18:25:03
(This post was last modified: 2015-04-27, 18:26:38 by maco-nl.)
Hi just installed this plug in and works like a charm in V 3.3.5
it would be (as maf already said) a great feature when the admin could still see the website (perhaps trough adding their IP ? )
a other small point is the dutch translation, (little write error)Desactiveer must be Deactiveer
here is the correction :
PHP Code: <?php
$i18n = array( 'DESCRIPTION' => 'Zet uw site in "Onderhoudsmodus".', 'CHECKBOX' => 'Aciveer / Deactiveer "Onderhoudsmodus".', );
?>
Regards Mandy
Posts: 305
Threads: 15
Joined: Mar 2014
2015-04-27, 19:40:39
(This post was last modified: 2015-04-27, 19:42:05 by Tyblitz.)
(2015-04-27, 18:25:03)maco-nl Wrote: it would be (as maf already said) a great feature when the admin could still see the website (perhaps trough adding their IP ? )
This is pretty simple to achieve in the GS3.1+ versions. GS sets a cookie to tell it whether the admin is logged in. Hide the webpage when the cookie is not present:
PHP Code: global $USR; if (isset($USR) && $USR == get_cookie('GS_ADMIN_USERNAME')) { // do nothing } else { // hide website }
As for the Dutch translation, "Schakel Onderhoudsmodus in/uit" would be even more correct (although it doesn't matter that much).
Posts: 48
Threads: 5
Joined: Apr 2015
(2015-04-27, 19:40:39)Tyblitz Wrote: PHP Code: global $USR; if (isset($USR) && $USR == get_cookie('GS_ADMIN_USERNAME')) { // do nothing } else { // hide website }
As for the Dutch translation, "Schakel Onderhoudsmodus in/uit" would be even more correct (although it doesn't matter that much).
Hi Tybliz,
Many thanks for your fast reply and code
eh , i'm new with GS and need still to discover a lot ,,can you help me out where to add this code ?
the way i was thinking about to add an ip , so you can add also two ip's so a other person can also see the website
(i'm busy with a website for a kids gym club) they use now a other cms but it is far to difficult for the people who arange the content , so i found GS and this is easy for them to keep their site more up to date )
so they could also see what i'm doing and give some directions if they want something else
in very short dutch i'm agree with in/uit tought i translate it a bit more in a common way
Posts: 305
Threads: 15
Joined: Mar 2014
2015-04-28, 05:02:58
(This post was last modified: 2015-04-28, 05:27:27 by Tyblitz.)
Don't know about the IP address whitelisting, but adding an if clause in the gsm_pre function will display maintenance mode only if $USR is not set or $USR is not equal to the GS_ADMIN_USERNAME cookie ( that is, you will see it if you are logged in to the backend):
Also addressed the issue with stripslashes and charset, and removed duplicate <head> tag and changed the HTML doc to HTML5.
If the plugin author thinks this is useful, (s)he is free to include it in next version.
You can download the unofficial update here:
gsmaintenance.zip (Size: 4.16 KB / Downloads: 18)
Posts: 6
Threads: 2
Joined: Oct 2014
2015-09-09, 23:50:56
(This post was last modified: 2015-09-10, 00:16:48 by fripsy.)
Wow, I just stumbled on my own plugin... I totally forgot it... didn't get any messages from the forum...
Well, thanks for all the suggestions above.
@Tyblitz
Thanks for updating v1.0.5.
I just updated the version to 1.0.6 and re-added the 503 service unavailable, just to let mr. Google know not to index now, but to come back and try after an hour.
@maf
I like the idea of an ip whitelist, it could be very handy to let your customer see you in action while developing...
I will look into this.
Meanwhile, I'll put v1.0.6 online.
Cheers,
Frank
Posts: 48
Threads: 5
Joined: Apr 2015
2015-09-10, 00:42:39
(This post was last modified: 2015-09-10, 00:43:27 by maco-nl.)
Hi Frank that will be a great feature
the plug in works great and like it a lot
thanks to Tybliz it is possible to put the site in maintenance and still see the website as admin
but would be indeed great when you could add 2 ip adresses
PS Tyblitz sorry for my huge delay to answer you , the modification works as a charm
thanks thanks thanks :-)
Posts: 53
Threads: 11
Joined: Mar 2015
Hi,
I found an error in all four of the language files, causing the checkbox message not to expand. (it shows '{GSMaintenance/CHECKBOX}' instead).
There is an extraneous trailing colon (','), and that's a syntax error.
You may also want to delete the '?>' at the end. Many web developers do this with php includes because any extra characters after the '?>' could cause unintentional html output.
Posts: 23
Threads: 9
Joined: Jan 2020
2020-04-13, 17:43:23
(This post was last modified: 2020-04-14, 19:10:03 by Domi.)
Hi,
how can I put some code in the editor; I try something like this but this doesn't work :
<div class="text-center my-4"><img alt="Maintenance" border="0" class="img-fluid screenshot" height="419" src="<?php get_theme_url(); ?>/images/under-construction.png" width="902" /></div>
could be fine to get access to the php function in you plug-in.
any help ?
thanks in advance,
Domi.
|