WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Maintenance Mode] 5.2 breaks pluggable function architecture (7 posts)

  1. diablodale
    Member
    Posted 4 years ago #

    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:
    http://codex.wordpress.org/Plugin_API#Pluggable_Functions

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

    No known workaround.

    http://wordpress.org/extend/plugins/maintenance-mode/

  2. PriMoThemes
    Member
    Posted 4 years ago #

    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!

  3. mwillberg
    Member
    Posted 4 years ago #

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

    http://codex.wordpress.org/Adding_Administration_Menus

  4. Anointed
    Member
    Posted 3 years ago #

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

  5. radiok
    Member
    Posted 3 years ago #

    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.

    http://wordpress.org/extend/plugins/register-plus-redux/

  6. radiok
    Member
    Posted 3 years ago #

    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:
    $myMaMo->ApplyMaintenanceMode();
    To:
    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!

    http://radiok.info/blog/the-case-of-maintenance-mode/

  7. Michael_
    Member
    Posted 3 years ago #

    Has been fixed in the meantime (plugin version 5.3), thanks to radiok:
    http://wordpress.org/extend/plugins/maintenance-mode/changelog/

Topic Closed

This topic has been closed to new replies.

About this Topic