Skip Navigation

[Resolved] Show Different Forms Based On User Data

This support ticket is created 3 years, 2 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)

This topic contains 3 replies, has 2 voices.

Last updated by Jamal 3 years, 2 months ago.

Assisted by: Jamal.

Author
Posts
#2166085

I have built a way for users who are logged in to create a program they have that is shown on the front end of the site.

I want to be able to send them to a page that will show a user the form to create a program if they don't already have one and I want to also show the edit form on the page if the user does have a program so they can edit it.

How can I make that happen?

Thanks!

Ryan

#2166533

Hello Ryan and thank you for contacting Toolset support.

You can create a view that queries the user posts. Put the edit form inside of the loop. And put the create form in the Loop template section.

Please check this article, it is a bit similar. The article does not use the edit form, and keep the loop empty. You, on the other hand, will need to put the edit form inside the loop. This way, if the user already has a post, he can edit it.
https://toolset.com/course-lesson/how-to-create-custom-searches-and-relationships-for-users/#forms-templates-and-views-to-create

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

#2168161

Ok, so I created a content template with a view in it.

I added a loop block to the view and then put the edit form inside of the loop.

Then I added the creation form inside of the loop template as shown here - hidden link

Then I created this query on the view - hidden link

I tested it, but nothing seems to be showing up when I log in as a test user regardless of whether they have filled out the form or not.

What am I doing wrong?

Thanks!

Ryan

#2168225

Well, you won't need to wrap the form shortcode inside the wpml-string shortcode. Use only the form shortcode. If you use WPML the form will be translated in a different way. hidden link

And the query filter needs to be the posts where the author is the same as the current user, not the author of the page where the view is shown. hidden link

If you are still encountering any issues, allow me temporary access to your website to check this closely. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **