Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(isset($_POST['user_login']) && !empty($_POST['user_login'])):
- $incorrect_login = FALSE;
- require_once(ABSPATH . WPINC . '/registration.php');
- // Grab User Data
- if(strpos($_POST['user_login'], '@')):
- $user_data = get_user_by('email', trim($_POST['user_login']));
- else:
- $user_data = get_user_by('login', trim($_POST['user_login']));
- endif;
- // If the Username or Email Match
- if($user_data):
- // Set Vars
- $user_login = $user_data->user_login;
- $user_email = $user_data->user_email;
- // Set a New Password Reset Key
- $key = wp_generate_password(20, false);
- $var = wp_update_user(array('ID' => $user_data->ID, 'user_activation_key' => $key));
- $wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login));
- // If No Username or Email Match - Return Error
- else:
- $incorrect_login = TRUE;
- endif;
- else:
- $incorrect_login = TRUE;
- endif;
Add Comment
Please, Sign In to add comment