Problem:
This issue here is that the user wanted to automatically log in their customers after they have registered for the site.
Solution:
This can be done by using the custom code below.
/** * Auto-login new CRED user */ add_action( 'cred_save_data', 'tssupp_cred_autologin', 10, 2 ); function tssupp_cred_autologin( $post_id, $form_data ){ if ( 597 == $form_data['id'] ) { // Edit as required if ( !empty( $_POST['user_email'] ) && !empty( $_POST['user_pass'] ) ) { // get the user credentials from the $_POST object $user = array( 'user_login' => $_POST['user_email'], 'user_password' => $_POST['user_pass'], 'remember' => true ); $login = wp_signon( $user, false ); if ( is_wp_error($login) ) { error_log( $login->get_error_message() ); } } } }
Replace 597 with the ID of your form.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
This topic contains 2 replies, has 2 voices.
Last updated by 5 years, 4 months ago.
Assisted by: Shane.