Skip to content

Instantly share code, notes, and snippets.

@technosailor
Created December 16, 2014 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save technosailor/4291141273e21c885f6b to your computer and use it in GitHub Desktop.
Save technosailor/4291141273e21c885f6b to your computer and use it in GitHub Desktop.
$user_creds = array(
'user_login' => $member_data['member-username'],
'user_password' => $member_data['member-password'],
//'remember' => false
);
$user = wp_signon( $user_creds, true );
if( is_wp_error( $user ) ) {
$result['redirect'] = site_url( '/login/?error=failed_login' );
}
else {
file_put_contents( ABSPATH . '/log.txt', print_r( $user, true ) );
//wp_set_current_user( $user->ID, $user->data->user_login );
wp_set_auth_cookie( $user->ID, false, true );
//do_action( 'wp_login', $user->data->user_login );
$result['redirect'] = site_url( '/join/become-a-member/get-started?id=' . $user->ID );
}
@Mamaduka
Copy link

Try to hook in set_auth_cookie and check, if params are set. If everything is good there then setcookie is failing for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment