jQuery(document).ready(function($) {
// Perform AJAX login on form submit
$('form#loginform').on('submit', function(e){
$.ajax({
type: 'POST',
dataType: 'json',
url: '/wp-admin/admin-ajax.php',
data: {
'action': 'ajaxlogin', //calls wp_ajax_nopriv_ajaxlogin
'username': $('form#loginform #user_login').val(),
'password': $('form#loginform #user_pass').val(),},
success: function(data){
if (data.loggedin == false){
alert ('yeap');
}
}
});
});
});
add_action( 'login_head', 'load_ajax_login_script' );
function load_ajax_login_script() {
wp_enqueue_script('ajax_login_script', '/wp-content/plugins/login_page_changer/closewind.js');
}
add_action( 'wp_ajax_ajaxlogin', 'ajax_login' );
add_action( 'wp_ajax_nopriv_ajaxlogin', 'ajax_login' );
function ajax_login(){
$info = array(
$info['user_login'] = $_POST['username'],
$info['user_password'] = $_POST['password']
);
$user_signon = wp_signon( $info, false );
if ( is_wp_error($user_signon) ){
echo json_encode(array('loggedin'=>false,));
} else {
echo json_encode(array('loggedin'=>true,));
}
die();
}
jQuery(document).ready(function($) {
// Perform AJAX login on form submit
$('form#loginform').on('submit', function(e){
$.ajax({
type: 'POST',
dataType: 'json',
url: '/wp-admin/admin-ajax.php',
data: {
'action': 'ajaxlogin', //calls wp_ajax_nopriv_ajaxlogin
'username': $('form#loginform #user_login').val(),
'password': $('form#loginform #user_pass').val(),},
success: function(data){
if (data.loggedin == false){
alert ('yeap');
}
$('form#loginform').hide(); // or remove();
}
});
});
});
$user_signon = wp_signon( $info, false );
if ( is_wp_error($user_signon) ){
echo json_encode(array('loggedin'=>false,));
} else {
echo json_encode(array('loggedin'=>true,));
}
jQuery(document).ready(function($) {
// Perform AJAX login on form submit
$('form#loginform').on('submit', function(e){
// Stop the form from submitting so we can use ajax.
e.preventDefault();
$.ajax({
type: 'POST',
dataType: 'json',
url: '/wp-admin/admin-ajax.php',
data: {
'action': 'ajaxlogin', //calls wp_ajax_nopriv_ajaxlogin
'username': $('form#loginform #user_login').val(),
'password': $('form#loginform #user_pass').val()},
success: function(data){
if (data.loggedin === true){
parent.location.reload(true);
} else {
alert ('nope')
}
}
});
});
});
add_action( 'wp_ajax_ajaxlogin', 'ajax_login' );
add_action( 'wp_ajax_nopriv_ajaxlogin', 'ajax_login' );
function ajax_login(){
// Nonce is checked, get the POST data and sign user on
$info = array();
$info['user_login'] = $_POST['username'];
$info['user_password'] = $_POST['password'];
$info['remember'] = true;
$user_signon = wp_signon( $info, false );
if ( is_wp_error($user_signon) ){
echo json_encode(array('loggedin' => false,));
} else {
echo json_encode(array('loggedin' => true,));
}
die();
}