Giter VIP home page Giter VIP logo

lj-maintenance-mode's Introduction

Maintenance Mode

Description

As a web developer working with Wordpress almost every day, very often I came across problem that If I wanted simple maintenance plugin to do some updates on my or client's website, I came across all these useless and overcomplicated plugins until I decided that I'll make one myself which will be the one I'll be confident and happy to use with ease.

Maintenance Mode is very simple and it's using Wordpress's wp_die() function which is core function of Wordpress, which makes this plugin feel and work as a part of Wordpress core. There is settings page under "Settings" in the main wp-admin menu where you can enable maintenance mode or change content using WYSIWYG editor so you can also add pictures, links etc. When activated and logged in as admin, you can see website as usual, rest of the users / visitors can see maintenance mode. You can see the maintenance mode as admin in preview mode using preview link on the settings page or simply open website in private mode or different browser to double check if it's enabled and working. There is also indicator in admin bar that changes colour to red when maintenance mode is enabled.

Features:

  • Simplicity - Built to be as simple as possible. Easy to use.
  • Customisable - WYSIWYG available in full glory. You can add images and other media including links and pretty much everything you can do with WYSIWYG. Text / Code tab is available too for custom markup.
  • Works on mobile - Because of it's simplicity, maintenance mode works very well on mobile devices.
  • NO ADS - No ads. Seriously.
  • NO PAID UPGRADES - No paid upgrades. Seriously.
  • Updates - Regular updates and maintenance.
  • Support - Support button available.
  • Preview - Preview button available.
  • Compact - It's developed to be as compact as possible.
  • Role Control - User Role control is available since 2.0
  • WPML Compatible - Plugin is compatible with WPML plugin
  • Optional widgets - Optionally add widgets above and/or below the content
  • Optional style sheet - Optionally add a custom style sheet
  • Optional ability to add code snippet - Optionally add a code snippet to the page.
  • Support for Analytify plugin - If you use the Analytify plugin, you can automatically insert the Google Analytics tracking code.

Bugs and pull requests are welcomed.

Filters

ljmm_site_title - Filter page title while in maintenance mode

ljmm_admin_bar_indicator_enabled - Control visibility of admin bar indicator

limm_css_filename - The filename of the CSS style sheet (as found in the theme's stylesheet directory) - just the filename, for example: maintenance.min.css. (Note: you do not need to use this filter for a stylesheet; see FAQs below.)

ljmm_css_url - The url of the css file.

Actions

ljmm_before_mm - Runs at the beginning of core maintenance method

Wordpress Info

  • Requires at least: 3.5.0
  • Tested up to: 4.9

Installation

  1. Upload lj-maintenance-mode to the /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Navigate to Settings -> Maintenance Mode or simply click on Admin Bar indicator for settings to enable maintenance mode.

FAQ

  1. Is this plugin really ad free ?
    Yes.

  2. Can I change background colour?
    Not through the admin interface. You can use a custom stylesheet (see next FAQ) to do this, however.

  3. What is the default stylesheet?
    By default, the plugin will use a stylesheet named maintenance.min.css in the theme's stylesheet folder. You can specify a different filename by using a Filter (above).

  4. How do I add widgets?
    Click "Advanced Settings" and mark the checkbox to add widget areas. Then you will find two new widget areas in WordPress's Widgets page, for above and below the content.

  5. Plugin doesn't seem to work. What should I do ?
    First, if you are using Cache plugin such as WP Super Cache or W3 Total Cache, flush all your cache. Secondly, disable all other plugins and try enabling just Maintenance Mode and see if problem persist. This should solve most common problems. If not, don't hesitate to contact me via Support button from Settings page

Changelog

See the CHANGELOG.MD.

lj-maintenance-mode's People

Contributors

atakanau avatar bcien avatar christophherr avatar edwarddekker avatar gablau avatar gabrielbijleveld avatar gedeminas avatar lukasjuhas avatar relgit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lj-maintenance-mode's Issues

Admin is logged in not detected when instalation is in subfolder

From wordpress org:

Just wanted to let you know that the plugin won’t detect an admin is logged in if the installation of WP is in a subfolder and then configured to work with the root URL.

ie, WP in: domain.com/wp/
with site url set to: domain.com/

The plugin will display maintenance mode but will not detect that I am logged in.

This is not a huge issue, but I hope it can be addressed in the future, as I love this plugin!

Maintenance hook

Hi!
Some WordPress starter themes (like sage) uses theme wrappers (more detail).
Therefore, for the proper operation of your plugin, I propose to replace this:
add_action('get_header', array( $this, 'maintenance' ));
with this:
add_action('template_redirect', array( $this, 'maintenance' ));

  • Possibly replace add_action get_header with template_redirect
  • Or find a better, alternative workaround?

2 suggestions to your awesome plugin!

I have 2 minor suggestions I make locally to your awesome plugin, that fixes the only 2 issues we always have. I can make a pull request if you prefer, just let me know.

  1. Line breaks not respected.
    – In your get_content() method (line 534) of lj-maintenance-mode.php you are using wpautop, but not nl2br. Because you are not using the WordPress get_content, you are losing the line breaks. To fix this simply put nl2br after the wpautop line e.g.
    $content = apply_filters(‘wpautop’, $content);
    $content = nl2br($content);

  2. No html wrapper
    – Styling the css is limited because you don’t wrap the content in a div wrapper. If you were to wrap all the content in a div wrap (or even 2 would be better), then the styling possibilities would be far greater. e.g. we usually want our maintenance page to be a logo with contact details, center aligned vertical and horizontal. Without a div wrapper this is not possible.
    – An easy solution is this (line 560):
    return ‘

    ’ . $analytify . $code . $stylesheet . $widget_before . $content . $widget_after . ‘
    ’;

Thanks for such an aweosme plugin, I appreciate the simplicity!!

Maintenance Mode: Disabled/Enabled

Hello,
I am using your Maintenance Mode and I like it.
Because it is very simple and useful.

I have a proposal and posted here. But it is not the issue.
On the top of the web page, current Maintenance Mode status is shown as Disabled or Enabled.
I sometimes confuse it as the site is Disabled or Enabled.
But it means the Maintenance Mode is Disabled or Enabled.
So I think if the message is, for example, Site Hidden or Site Shown, it is better. How about?

BackUpBuddy compatibility

From Gordon and his support chat:

In regards to getting everything to work in maintenance mode, you'll need to find out what is preventing WordPress from connecting back to itself while in maintenance mode. WordPress will need to be able to connect back to /wp-cron.php and /wp-admin/admin-ajax.php. A lot of maintenance/coming soon/etc. plugins do not account for the fact that WordPress needs to connect back to itself. And unfortunately, I'm not involved with any of those types of plugins, so I'm not aware of any that are written well and account for the fact that WordPress needs to connect back to itself. You may want to contact the developers of the plugin/application you are using for maintenance mode to see if there is an option within their plugin/application to allow WordPress to connect back to itself. Perhaps through the whitelisting of an IP Address, Hostname, etc.

roles table prefix

Hi,
with new version 2.0 of your great plugins, the function get_option( 'wp_user_roles' );
not work on website that change te default $table_prefix to the wp-config.php file like:
$table_prefix = 'newprefix_';

so the correct option name is: get_option( 'newprefix_user_roles' )

I think should be something like this:

global $wpdb;
get_option($wpdb->prefix.'user_roles');

Best regards

Page Builder by SiteOrigin compatiblity

From support:
"There is a conflict between Maintence Mode and Page Builder by SiteOrigin plug-in.

When Page Builder by SiteOrigin is active it prevents the maintence mode message from being displayed, ie only the white rectangle is displayed, without a message."

Anyone else having issues?

double check styling action hook

From Wordpress Support:

esemlabel (@esemlabel)
Maybe the line in public function __construct(), that adds red background to admin_menu_bar button, should be added in ‘admin_bar_menu’ hook, because background is missing at frontend when mm is enabled.

add_action('admin_head', array( $this, 'style' ));

//change to
add_action('admin_bar_menu', array( $this, 'style' ));

Site stuck in Maintenance mode - cannot access wp-admin

I put my site into maintenance mode about a week ago. I was able to access wp-admin OK.
NOW I am locked out by maintenance mode! wp-admin just gives me the maintenance mode screen. How do I get back in? Why has this happened? I've just been updating woocommerce products.
I have access to the site files and database OK. Please help. If all else fails I can restore a backup but I have done many updates during site maintenance and do not want to lose them.
Please Please help.
Thanks.

Better handling of maintenance mode - possibly adding support for core updates maintenance mode?

Wordpress forums transcript

Serious issue when Enabled
esemlabel (@esemlabel)
1 hour, 43 minutes ago
Hi there,

The main reason I use “lj maintenance mode” is for updating active theme files.
But after enabling Maintenance Mode, the message page with 503 status appears only if a folder of the active theme exist on server. So when enabling 503 and delete active theme folder after that, the empty page with status code 200 will appear instead of 503, until the new revision of theme is finished copying, for example via ftp.

I think the maintenance page shouldn’t be dependent on existing of plugin’ or theme’s files at all, because mostly Maintenance Mode is enabled to update something like themes or plugin.

Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
Plugin AuthorLukas Juhas (@lukasneptun) 
1 hour, 29 minutes ago
Hi there,

The plugin itself is not dependant on the theme, it’s a standalone plugin which uses core WordPress function so I don’t think this has something to do with the plugin.

It would probably worth trying this with different maintenance plugins as I think the same problem will occur just because WordPress is dependant on the theme etc.

I fear that this is something I cannot control via plugin but I’m welcome to suggestions.

At the end, is it worth developing a solution for a few seconds, maybe couple of minutes while new files get’s uploaded?

WordPress handles updates by placing a “.maintenance” file in the root which then gives you the message “briefly unavailable for maintenance” but of course that applies only for updates – not whilst copying files.

I would be more than happy if anyone has a good and simple idea of a workaround, otherwise I don’t think I can do much.

I hope that helps at least a bit.

Lukas

esemlabel (@esemlabel) 
26 minutes ago
Maybe you can use one of these solutions?

1. The plugin can change the active theme to any temporary one with just a single empty index.php in it on a fly when enabling, and reactivate main theme when disabling maintenance. BUT it is not a good idea since many themes do a lot on ‘after_switch_theme’ hook. Unless you can bypass all main theme functions that uses this or similar hooks, grab their names – then temporary remove_action in foreach() when restoring main theme.

2. Generate a copy of maintenance page from its settings page into /wp-content/maintenance.php file (delete on plugin deactivating). The WP will use this file not only when plugin’s maintenance mode is enabled, but for its plugins and core updates too, instead of boring ‘Briefly unavailable for scheduled maintenance. Check back in a minute.’ message. One more thing you need is creat .maintenance file with <?php $upgrading = time(); ?> in it, and delete on disabling maintenance mode. But remember to recreat .maintenance file on load if it was deleted after core or any other wp updates has finished, if ‘ljmm-enabled’ is still enabled. After creating /wp-content/maintenance.php file you will see active Drop-in on plugins page:


I prefer the 2 one, it looks more simple and fast.

Doesn’t seem to work with WP 6.6.1

I recently started using your plugin because I find it simple and functional, so perfect.
If you have time it would be really great if you could take a look at it and fix it to make it work again to the latest version.

Thanks!

Admin bar - remove on disable - Feature Request

The menu item Admin bar takes up a lot of precious horizontal pixel space.

"Maintenance Mode: Enabled"
"Maintenance Mode: Disabled"

Having this appear all the time even when the Disabled state is going to be nearly all the time doesn't make sense. Also the text is unnecessarily long.

  • Feature request: either have the Admin bar item not displayed when Maintenance Mode is Disabled, OR have an option to have it or not in settings
  • Feature request: change the text displayed in the Admin bar a lot shorter, such as: Maint:On / Maint:Off. Same meaning, less screen real estate.

Default styles

Hi!
I cannot grasp where default styles are coming from.
I use maintenance.min.css but it clashes with injected styles before.
I want to get rid of them:

<style type="text/css">
		html {
			background: #f1f1f1;
		}
		body {
			background: #fff;
			color: #444;
			font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
			margin: 2em auto;
			padding: 1em 2em;
			max-width: 700px;
			-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.13);
			box-shadow: 0 1px 3px rgba(0,0,0,0.13);
		}
		h1 {
			border-bottom: 1px solid #dadada;
			clear: both;
			color: #666;
			font-size: 24px;
			margin: 30px 0 0 0;
			padding: 0;
			padding-bottom: 7px;
		}
		#error-page {
			margin-top: 50px;
		}
		#error-page p {
			font-size: 14px;
			line-height: 1.5;
			margin: 25px 0 20px;
		}
		#error-page code {
			font-family: Consolas, Monaco, monospace;
		}
		ul li {
			margin-bottom: 10px;
			font-size: 14px ;
		}
		a {
			color: #0073aa;
		}
		a:hover,
		a:active {
			color: #00a0d2;
		}
		a:focus {
			color: #124964;
		    -webkit-box-shadow:
		    	0 0 0 1px #5b9dd9,
				0 0 2px 1px rgba(30, 140, 190, .8);
		    box-shadow:
		    	0 0 0 1px #5b9dd9,
				0 0 2px 1px rgba(30, 140, 190, .8);
			outline: none;
		}
		.button {
			background: #f7f7f7;
			border: 1px solid #ccc;
			color: #555;
			display: inline-block;
			text-decoration: none;
			font-size: 13px;
			line-height: 26px;
			height: 28px;
			margin: 0;
			padding: 0 10px 1px;
			cursor: pointer;
			-webkit-border-radius: 3px;
			-webkit-appearance: none;
			border-radius: 3px;
			white-space: nowrap;
			-webkit-box-sizing: border-box;
			-moz-box-sizing:    border-box;
			box-sizing:         border-box;

			-webkit-box-shadow: 0 1px 0 #ccc;
			box-shadow: 0 1px 0 #ccc;
		 	vertical-align: top;
		}

		.button.button-large {
			height: 30px;
			line-height: 28px;
			padding: 0 12px 2px;
		}

		.button:hover,
		.button:focus {
			background: #fafafa;
			border-color: #999;
			color: #23282d;
		}

		.button:focus  {
			border-color: #5b9dd9;
			-webkit-box-shadow: 0 0 3px rgba( 0, 115, 170, .8 );
			box-shadow: 0 0 3px rgba( 0, 115, 170, .8 );
			outline: none;
		}

		.button:active {
			background: #eee;
			border-color: #999;
		 	-webkit-box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
		 	box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
		 	-webkit-transform: translateY(1px);
		 	-ms-transform: translateY(1px);
		 	transform: translateY(1px);
		}

			</style>

Title option

As per request / suggestion - add setting to change meta title while in maintenance mode.

Google Analytics

From Jack on WP Support forums:
"I've used the plugin and worked on my site for a day before I turned it off again. Now I notice almost 2000 not found url's and about 200 found server errors in Google Webmaster Tools. I've never had that before with other maintenance mode plugins. I love it by the way that it is so simple and light."

possible solution: nofollow meta tag

not compatible with 2022 onwards

Took me around an hour to figure out that this plugin will not work with my latest installation of Wordpress....which was using 2022 theme, (as default)

By the way, I tried three other similar "coming soon" plugins, all of them were also not working with 2022 theme of Wordpress. I guess they have made a huge change which is no longer compatible with the old themes and plugins.

Template

Considering switching wp_die() template to a custom one with bit of more flexibility. Would you prefer to keep plugin as it is or would you prefer to have a bit more flexibility, such as change background colour, change width etc. ?

Possible poll in the next update.

Add Filter(s)

Add possible filter for maintenance mode so it's possible to add extra / specific rules,

e.g. if using plugin that changes the login page location to front end for example, developer can add a rule where if it's that specific login page, do not show maintenance mode if enabled.

This should add a bit more flexibility.

To be added soon...

WP-CLI support

Jerry Hudgins (@laureldigital)
This is a very useful plugin; thanks for your work on it.

I’d like to suggest a small feature enhancement to make it even more useful: simple enable/disable support via WP-CLI command. This would permit temporary lockout of new user-generated content or E-commerce transactions during cron-driven scripted operations such as backup or content import.

Cache Plugin Compatibility

From WordPress plugins review by https://profiles.wordpress.org/otinokyad

"If you are running a caching plugin -- I am using WP Super Cache -- be advised that enabling M. Mode may appear not to have any effect. If that happens to you, go to the settings page for your cache plugin and empty/clear/delete the cache, assuming that it gives you that capability (WP Super Cache does), before you enable M. Mode. And the same after you disable it -- empty/clear/delete the cache, otherwise your M. Mode message will continue to appear!"

Either find solution to clear cache when enabled or disabled, or add notice if cache plugin exists, to clear the cahce in order to make it work properly.

Any other ideas ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.