[Resolved] Automatically log-in user after registration
This thread is resolved. Here is a description of the problem and solution.
Problem:
How to automatically log-in users who register with an email address (not username) using a CRED new user form?
Solution:
Custom code is required, and note that the wp_signon() function requires a username, the email address is not sufficient, but can be used within the code to retrieve the username.
That will create a debug log called debug.log in your wp-content directory which you can examine in any text editor. Try signing up with the form again and then inspect the log.
Yes, sure, as I don't want to break anything on your live site.
I will mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete.
I double-checked with the documentation for wp_signon and you must provide the username, not the email address.
So I rewrote the code to retrieve the username of the new user using the email address and tested it locally and confirmed it worked, so you can replace the original code on your site with this code and you should hopefully find the same.
Thanks for that code Nigel, it works perfectly!! I want to save this code somehow, it would be great to have it as functionality within Toolset automatically
@paige you could add it to your theme's functions.php file, but a better place would be as a code snippet at Toolset > Settings > Custom Code, so you don't lose it if you swap theme.