I'm trying to fork this plugin to use the user email to login, as opposed to Username.
The plugin is http://wordpress.org/plugins/wp-modal-login/
Is there a nice way to do this, perhaps by a filter to get this plugin to work with email credentials?
I've tried using this filter:
function custom_login() {
$data = array();
$data['user_login'] = sanitize_user( $_REQUEST['username'] );
$data['user_email'] = sanitize_user( $_REQUEST['user_email'] );
$data['user_password'] = sanitize_text_field( $_REQUEST['password'] );
$data['rememberme'] = sanitize_text_field( $_REQUEST['rememberme'] );
$data['user_login'] = sanitize_user( $_REQUEST['user_email'] );
$user = wp_signon( $creds, false );
if ( is_wp_error($user) )
echo $user->get_error_message();
}
// run it before the headers and cookies are sent
add_action( 'after_setup_theme', 'custom_login' );