Membership2 Upgrade breaks AutoLogin

Membership 2 Pro:
Current Version: You have version installed.
Upgrade Version: Update to

Hi: We use some custom code for AutoLogin integration.
The code is based around this function:

function core_AutoLogin($WPUserName,$WPPassword) {
	$creds = array();
	$creds['user_login'] = $WPUserName;
	$creds['user_password'] = $WPPassword;
	$creds['remember'] = false;
	$user = wp_signon( $creds, false );
	if ( is_wp_error($user) ){
		echo $user->get_error_message();
		wp_set_current_user($user->ID, $WPUserName);
		if ($user->ID > 0)
			wp_redirect( home_url()."/startup" );

Our AutoLogin code above works fine on Membership2 version
However, after upgrading Membership2 onto latest version, our AutoLogin code breaks.

Access active until 3:55pm in 5 days
Please Advise...

  • Rupok

    Hi VirtualArtists,

    Can you please explain what this code does? I mean, does it automatically makes your users logged in to your subsites if you login to your main site? Or does it login to all sites if you login to any subsite? Can you please tell us how we can regenerate your scenario so we can troubleshoot the issue better? We need to know this because to make this code work, we need to test it. Shall we just paste in in functions.php file or do we need to do something else to see it in action?

    Please send us as much details as you can. If necessary, I'll forward this to our SLS (Second Level Support) team. I'm looking forward to hearing from you and resolving this issue as soon as possible.

    Have a nice day. Cheers!

  • VirtualArtists

    Hi : Yes - this code has one purpose: To automatically login the User into this one WP sub-site from a "Non-WordPress" parent site. That is all, no other sites are involved - only one Parent (non-wp) site, and this child/sub-site which is WordPress.

    Yes - this code starts in functions.php. The best way to test - would be to copy this into functions.php, then "hard code" the $WPUserName and $WPPassword. First make sure you can get the auto-login code above working with our Current Version: Membership2 version .
    After that try Upgrade to Membership2 Version: Update to - which currently breaks this code from our production site.

    Hopefully you will be able to replicate this issue.
    Please Advise...

  • Kasia Swiderska

    Hello VirtualArtists,

    I'm afraid I'm not able to get that code to work with or without Membership activated - are you sure we can get it to work only with that one function in functions.php?
    I will ping our Second Line Support team to take a look on this one - they might be able to see what could possibly change in Membership so that code stopped working.
    As soon I'll get more info I'll post it here.

    kind regards,

  • Kasia Swiderska

    Hello VirtualArtists,

    SLS developer checked that code and pointed that hook/action is missing there. Can you send completed code or provide FTP access maybe? If FTP is possible could you please send in the following via our secure contact form :

    - Mark to my attention, the subject line should contain only: ATTN: Kasia Swiderska
    - Do not include anything else in the subject line, doing so may delay our response due to how email filtering works.
    - Link back to this thread
    - Include WordPress admin access details (login address, username & password)
    - Include FTP log-in details (hostname, username & password)
    - Include any relevant URLs for your site

    IMPORTANT: Please make sure you select "I have a different question" for your topic, so it doesn't go back to the forums - this and the subject line ensure that it gets assigned to me.

    Please confirm here when you send those

    kind regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.