latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Auto login and redirect query

Home Forums Community Forum Auto login and redirect query

This topic contains 10 replies, has 3 voices. Last updated by  Cristián Lávaque 3 years, 10 months ago.

Topic Author Topic
Posted: Tuesday Feb 26th, 2013 at 4:16 pm #43262

I’ve been using a “hack” which I’ve uploaded to the mu-plugins folder that automatically logged people in and redirected them to the login welcome page when they registered on my site. The hack that I was using is shown below:

<?php
add_action('ws_plugin__s2member_during_configure_user_registration', 's2_auto_login_after_registration');
function s2_auto_login_after_registration($vars = array()) {
if (!is_admin() && $vars['processed'] === 'yes') {
wp_new_user_notification($vars['user_id'], $vars['pass']);
wp_set_auth_cookie($vars['user_id'], false, is_ssl());
c_ws_plugin__s2member_login_redirects::login_redirect($vars['login']);
}
}

But in the last week or two (I can't recall exactly) it stopped working.

From reading around on the forums, it seems that this is the hack I should be using:
http://www.s2member.com/kb/auto-login-upon-registration/

I have followed the instructions in the post, and also have the latest version of s2member installed, but this latest hack does not work in the way the old one did.

It appears to log people in (although still shows the register screen with the yellow "Thank you. Please login" alert), but does not redirect them to the log in welcome page.

Is there anything I need to add to the code in order to send people straight to the login welcome page after registration, rather than leave them on the registration page?

Thanks, Christian

FYI: I have configured a Special Redirection URL, rather than use a page from the login redirection dropdown menu.

List Of Topic Replies

Viewing 10 replies - 1 through 10 (of 10 total)
Author Replies
Author Replies
Posted: Thursday Feb 28th, 2013 at 8:03 am #43399

Hi Christian.

Could you submit your site’s info and let me know when you did so I take a look at your installation with the hack and test the registration to see how the hack behaves? Thanks! s2Member® » Private Contact Form

Posted: Monday Mar 4th, 2013 at 4:34 am #43684

Hi Cristián,

Just to let you know I have sent you my site info via the private contact form.

Thanks, Christian

Posted: Wednesday Mar 6th, 2013 at 2:28 am #43832

Thanks Christian.

I just tried the dashboard login and it didn’t let me in. Could you verify the credentials and resend it? I just emailed you about it, you can reply to that email with the correct login info.

Thanks!

Posted: Wednesday Mar 6th, 2013 at 3:37 am #43835

Thanks, got the password and could login.

I did several tests hunting down the problem and finally found it. I fixed it in your installation and will let Jason know what it was so he can update the article.

Please remove all the accounts I created doing this. :P

Posted: Thursday Mar 7th, 2013 at 11:39 am #43965

That’s great Cristián, thanks for your help, I really appreciate it.

Posted: Friday Mar 8th, 2013 at 12:49 pm #44093

No problem. :)

Posted: Monday Mar 11th, 2013 at 8:50 pm #44293
alancheuk
Username: alancheuk

I found the same problem with my use of the hack. Could you please post the fix or send it to me?

Posted: Tuesday Mar 12th, 2013 at 7:22 am #44349

Hi Alan.

The article has already been updated with the fixed code since the problem was found here. :)

http://www.s2member.com/kb/auto-login-upon-registration/

Posted: Tuesday Mar 12th, 2013 at 8:45 am #44355
alancheuk
Username: alancheuk

Thanks, it works great!

Posted: Tuesday Mar 12th, 2013 at 9:54 am #44357

:)

Viewing 10 replies - 1 through 10 (of 10 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.