Skip Navigation

[Resolved] Auto login in a specific form and redirect to specific URL

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 7 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#553427

How can I make a specific form perform the auto login action and then redirect to a specific URL?

#553756

Dear Fernando,

There isn't such a built-in feature within Toolset plugins, and I don't think it is built-in feature of wordpress, you will always need to enter a user name and password
There is a login form shortcode within Views plugin:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-login-form

but you can search it in wordpress.org, for example:
https://wordpress.org/plugins/search/autologin/

Hope this helps

#553780

I have a function that performs autologin after registration and it works correctly, but I need to be able to apply it only to a specific form, how can I do it?

This is the function:

function auto_login_new_user( $user_id ) {
wp_set_current_user($user_id);
wp_set_auth_cookie($user_id);
// You can change home_url() to the specific URL,such as
//wp_redirect( 'hidden link' );
wp_redirect( home_url() );
exit;
}
add_action( 'user_register', 'auto_login_new_user' );

#553796

If you are using CRED form to register the new users, I suggest you try with CRED action hook "cred_save_data" to trigger your custom PHP function, there you can specific the CRED form ID, see our document:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
Agument form_id: The form ID.

The forum ‘Types Community Support’ is closed to new topics and replies.