Created
September 27, 2016 04:14
-
-
Save joje47/8c02420c3a37d6b7e86a5007109e1e01 to your computer and use it in GitHub Desktop.
Show how you get locked out when using current_user_can in a plugin that get's network activated.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: Lock your self out | |
* Plugin URI: https://ngo-portal.org | |
* Description: Show how you get locked out when using current_user_can in a plugin that get's network activated. | |
* Just put this file in your plugins folder and go to plugins, network activate it, and you will get locked out. | |
* To get back in use ftp and rename this file (I use to add _ after filename like so lock-your-self-out.php_ | |
* Reload your browser. Now your back in. | |
* Version: 0.0.1 | |
* Author: George Bredberg | |
* Author URI: https://datagaraget.se | |
* License GPLv3 | |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html | |
*/ | |
if(!function_exists('wp_get_current_user')) { require_once(ABSPATH . "wp-includes/pluggable.php"); } | |
// Down locks me out of admin area... | |
if (!(current_user_can('manage_options'))) { | |
echo "<h1><center>Doing something here....</center></h1>"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment