Skip to content

Instantly share code, notes, and snippets.

@joje47
Created September 27, 2016 04:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joje47/8c02420c3a37d6b7e86a5007109e1e01 to your computer and use it in GitHub Desktop.
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.
<?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