Skip Navigation

[Resolved] cred forms-default sign in form

This support ticket is created 3 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 3 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#1807635

Can the default sign in form allow the person to be logged in as soon the person creates a user without being logged out ?

this is my situation. I have a membership where every new subscriber have the role of author. This new "author" subscriber at the moment of filling out the new user form, when they hit submit button they will be logged in immediately, and continue in my website for membership only. In their "my account page" they will be prompted to create a post which will be their kiosky in my website.

right now, I don't know if there is a glitch in the form, but the new user cannot write a post immediately after creating the new user. The redirect field in the signup form is not controlling the process, then, the person needs to re-login using the credentials previously used when new user create form was submitted. I needed it to function this way so my new members don't have the hassle to have to sign in and then fill the next form completing their registration in my website. I want to stream line and make a quick signup process. the new signed in users will not be able to access the benefits of the site, untill this two process take place. that is creating the user and creating their first post which will be their kiosky or face for their products in my website.

Thanks

#1808099

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

There is no such feature available that will allow you to auto login after user gets register but we have a workaround for it and users are using this effectively and efficiently for auto-login feature.

You can add the following line of code to "Custom Code" section offered by Toolset:
=> https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/

add_action( 'cred_save_data', 'tssupp_cred_autologin', 10, 2 );
function tssupp_cred_autologin( $post_id, $form_data ){

	if ( $form_data['id'] == 99999 ) { // Edit as required

		if ( !empty( $_POST['user_login'] ) && !empty( $_POST['user_pass'] ) ) {

			// get the user credentials from the $_POST object
			$user = array(
				'user_login'	=>	$_POST['user_login'],
				'user_password'	=>	$_POST['user_pass'],
				'remember'		=>	true
			);
			$login = wp_signon( $user, false );

			if ( is_wp_error($login) ) {
				error_log( $login->get_error_message() );
			}

		}
	}
}

Where:
- You can change the 99999 with your original form ID.

More info:
=> https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

Please let me know if you will require further assistance on this issue.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.