Skip Navigation

[Resolved] Automatically log-in new users

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 – 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/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Waqar 10 months ago.

Assisted by: Waqar.

Author
Posts
#2684170

If unregistered users click a link to a page with a form for creating a post, I want them to fill out a register form first and then continue on to the original page (with the form for adding a post) without having to log in. Are the following instructions still good for accomplishing this? https://toolset.com/forums/topic/automatically-log-in-user-after-created/#post-621650

#2684189

Hi,

Thank you for contacting us and I'd be happy to assist.

Yes, the code from that other support ticket should still work to automatically 'log in' the user, after submitting the form to register a new user.

Note: As explained in the following guide, you can always show different content to members and non-member guests. This way, you won't have to redirect them to a different page to register/log-in:
https://toolset.com/course-chapter/templates-for-visitors-and-members/

regards,
Waqar

#2684295

Thanks. As a follow-up, I have a page with a form for adding a post and I want to force visitors to register or log in before filling out the form. Regardless of whether it's a new registration or not, I want to send them immediately to the form (without having to log in , in the case of new users).

To further complicate things, I have multiple custom post types, each with their own forms for adding posts. And again, I want to force users to register or log in before they can access the appropriate form. What's the best way to do this? Will I need separate login/registration forms for each post type to insure the user is being redirected to the correct form?

#2684553

Thanks for writing back.

You won't have to create separate login and register forms for each page or each post type's form.

1. You'll create a content template 'For non-logged-in users' and place the login form and the register form in that.

2. Next, you'll create a post group and set all pages with new post forms, which shouldn't be accessible to non-logged-in visitors, under this post group.

3. In this post group's settings, you can select the new content template from step 1, so that when non-logged-in visitors visit any of those pages, they see the login and register form and not the regular content (i.e. the new post forms).

All these steps are explained in the following guide:
https://toolset.com/lesson-placement/lesson-placements-1645837-1655635/