PriMoThemes — now s2Member® (official notice)
This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™
<?php
add_action('ws_plugin__s2member_during_configure_user_registration_front_side', 's2_auto_login_after_registration');
function s2_auto_login_after_registration($vars = array()) {
wp_set_auth_cookie($vars['user_id'], false, is_ssl());
wp_redirect(S2MEMBER_LOGIN_WELCOME_PAGE_URL);
exit;
}
?>
add_action('ws_plugin__s2member_during_configure_user_registration_front_side', 's2_auto_login_after_registration');
function s2_auto_login_after_registration($vars = array()) {
wp_set_auth_cookie($vars['user_id'], false, is_ssl());
$referer = remove_query_arg( array( 'action', 'instance' ), wp_get_referer() );
wp_redirect( $referer );
exit;
}
function auto_login($userID) {
if (!is_user_logged_in()) {
$user = get_userdata($userID);
$user_id = $user->ID;
$user_login = $user->user_login;
//login
wp_set_current_user($user_id, $user_login);
wp_set_auth_cookie( $user_id, $remember, $secure );
do_action('wp_login', $user_login);
}
}
add_action('user_register', 'auto_login');
candy wrote:I am sorry Christian, but your code definitely does not log the user in
It prevents that second screen to appear (the one which usually appears after registration, asking the fresh user to log in) but when I try to access a page which would only be available to a registered user, it sends me to the memberships page, asking me to pay again! (which is wrong). And the user is definitely not "in".
Users browsing this forum: Google [Bot], Yahoo [Bot] and 0 guests