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
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
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?
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/