function checkout_login() {
if (!is_user_logged_in() && isset($_REQUEST['user_email'])) {
//get the user's email from the checkout page
$user_email = $_REQUEST['user_email'];
//automatically log them in, and redirect them
global $wpdb;
$get_user_login = $wpdb->get_row('SELECT u.user_login FROM wp_users u WHERE u.user_email = "'.$user_email.'"');
$user_login = $get_user_login->user_login;
$user = get_userdatabylogin($user_login);
$user_id = $user->ID;
wp_set_auth_cookie($user_id);
wp_redirect('http://www.example.com/thank-you/');
exit;
}
}
add_action('init', 'checkout_login');
Statistics: Posted by jevans161 — January 7th, 2012, 12:58 pm
Statistics: Posted by Cristián Lávaque — January 7th, 2012, 4:21 am
Statistics: Posted by jevans161 — January 5th, 2012, 5:50 pm
Statistics: Posted by Cristián Lávaque — January 4th, 2012, 3:25 pm
Statistics: Posted by jevans161 — January 3rd, 2012, 8:41 pm
Statistics: Posted by Raam Dev — January 3rd, 2012, 5:54 pm
Statistics: Posted by jevans161 — January 3rd, 2012, 1:55 pm
Statistics: Posted by Cristián Lávaque — January 3rd, 2012, 6:29 am
Statistics: Posted by jevans161 — January 2nd, 2012, 12:26 pm
Statistics: Posted by jevans161 — December 31st, 2011, 1:16 pm
Statistics: Posted by Cristián Lávaque — December 31st, 2011, 7:24 am
Statistics: Posted by jevans161 — December 30th, 2011, 10:49 pm