Created
October 25, 2013 18:53
-
-
Save rohmann/7159907 to your computer and use it in GitHub Desktop.
Tool to esaclate an admin to super admin in WordPress
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: Escalate to Super Admin | |
Plugin URI: https://gist.github.com/rohmann/7159907 | |
Description: Tool to convert normal admin to super admin. | |
Place in mu-plugins folder. Then visit /wp-admin with a normal admin account. Next, go to the network dashboard to test it. Finally, delete this plugin to prevent abuse | |
Author: Alexander Rohmann | |
Author URI: https://gist.github.com/rohmann | |
Version: 1.0 | |
*/ | |
require_once(ABSPATH . 'wp-admin/includes/ms.php'); | |
add_action('admin_init','escalate_to_super_admin'); | |
function escalate_to_super_admin(){ | |
if(current_user_can('manage_options') && !is_super_admin(get_current_user_id())) | |
grant_super_admin(get_current_user_id()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment