Skip Navigation

[Resolved] Need Help to Implement User Login/Registration in the end of Frontend Post form

This support ticket is created 3 years, 7 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
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: Africa/Casablanca (GMT+01:00)

Author
Posts
#2003047

Hi Guys,
I wanna know if the Toolset frontend post submission form can allow me to add a user login/registration form at the end of the form and before submitting the post data, User needs to log in or register, and then based on the user account, post data will be submitted and this submitted post will be assigned to the user.

For Example, I am a new visitor in a real estate website, and I want to submit a property but I don't have an account or I am not logged into my account. and I simply open the property listing form and start filling the property data and at the end, I log in or register my self and once my account is created or I am logged to my account using Ajax or something then this enter property will be assigned to my account.

So Please let me know if this is something possible with Toolset forms somehow.

#2003553

Hello and thank you for contacting the Toolset support.

Toolset forms, for a post or for users, allow to create or edit ONLY ONE post or user at a time. So, this feature is not available by default. But you can still implement it using a custom code.

What can be implemented without custom code is to have a page with a login form and/or registration form. The login form can be configured to redirect to the create post form. The registration form can be configured to redirect to the login form.

With some custom code, you can implement that. Add a generic field for the user email, and if you want a generic field for the username. Then using custom code hooked to the cred_save_data action, you can check if a user with the same email exists. If it exists, make it the author of the post. If it does not exists, create a new user with this email, and make it the author of the post.
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

Check these similar tickets for inspiration:
- https://toolset.com/forums/topic/cred-before-save-data-allow-only-one-submition-of-the-form/
- https://toolset.com/forums/topic/associate-a-post-with-a-user-and-only-allow-user-to-create-that-one-post/
- https://toolset.com/forums/topic/creating-a-custom-post-type-with-cred-and-user-registration-at-the-same-time/#post-1182310
- https://toolset.com/forums/topic/automatic-post-creation-on-registration/
- https://toolset.com/forums/topic/form-to-create-new-user-and-cpt-item/

I hope this helps. Let me know if you have any questions.