joeguilmette / wp-local-toolbox

A simple plugin to set different defaults for local, staging and production servers.
GNU General Public License v3.0
78 stars 13 forks source link

Show notice when WPLT is not in mu-plugins #21

Open joeguilmette opened 8 years ago

joeguilmette commented 8 years ago

I tried this:

$mu_plugins = 'false';
// check if plugin is in mu-plugins
function my_plugin_override() {
    $mu_plugins = 'true';
}
add_action( 'muplugins_loaded', 'my_plugin_override' );

if ($mu_plugins == 'false') {
    function wplt_not_in_muplugins() {
        ?>
<div class="notice notice-info is-dismissible">
<h2><?php _e( 'NOPE', 'wp-local-toolbox' ); ?></h2>
<p><?php _e( "WP Local Toolbox is configured with constants added to your wp-config.php file.", 'wp-local-toolbox' ); ?></p>
<p><?php _e( "Read more: ", 'wp-local-toolbox' ); ?><a href="https://github.com/joeguilmette/wp-local-toolbox" style="top:0">https://github.com/joeguilmette/wp-local-toolbox</a></p>
</div>
        <?php
    }
    add_action( 'admin_notices', 'wplt_not_in_muplugins' );
}
echo $mu_plugins.$mu_plugins.$mu_plugins.$mu_plugins.$mu_plugins.$mu_plugins.$mu_plugins.$mu_plugins.$mu_plugins.$mu_plugins.$mu_plugins.$mu_plugins.$mu_plugins.$mu_plugins;

But couldn't get it to work.