Support » Plugins » [Plugin: Maintenance Mode] 5.2 breaks pluggable function architecture

  • Unfortunately, this plugin (at least version 5.2) breaks core functionality of WordPress 2.x by breaking the Pluggable functions architecture.

    Line 37 of the plugin forces pluggable.php to load. This is *very* undesired.

    WordPress is architected to load pluggable.php after all plugins load. This is a base assertion. Because this plugin forces pluggable.php to load out of order, it causes ALL PLUGINS that load after this maintenance mode plugin to NOT BE ABLE TO PLUG FUNCTIONS.

    See how the pluggable functions work:

    Then see wp-settings lines 595-601 to see how plugins and pluggable.php are loaded.

    No known workaround.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Yes, I ran into this problem as well. I’m the s2Member developer for WordPress, and my plugin is broken by Maintenance Mode.

    Please, please, please, remove the pluggable.php include call. A WordPress plugin should never force this file to be loaded ahead of others. ~Thanks. Otherwise, I’m a huge fan of your plugin!

    The documentation even has an example how current_user_can is used properly:

    has this been fixed or is there a patch available for this problem?

    A user recently reported this problem to me with my own plugin, Register Plus Redux. I wanted to hack together a fork of this plugin that fixes this issue, mwillberg, I don’t see the fix you mentioned on that page, can you clarify? I was considering nestling the include into the functions he uses current_user_can, to see if that would remotely help.

    I did some heavy digging into the Maintenance Mode code and came up with the following changes to correct Maintenance Mode’s faux pas.

    In maintenance-mode.php, comment out the following line (37):
    if (!function_exists('wp_get_current_user')) require (ABSPATH . WPINC . '/pluggable.php');

    Also in maintenance-mode.php, change the following line (632) from:
    add_action('plugins_loaded', array($myMaMo, 'ApplyMaintenanceMode'));

    So what we just did was remove the import of pluggable.php and delayed the initialization of Maintenance Mode until all other plugins are loaded (including pluggable). So no more jumping the gun!

    Has been fixed in the meantime (plugin version 5.3), thanks to radiok:

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Maintenance Mode] 5.2 breaks pluggable function architecture’ is closed to new replies.