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
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.
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
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. **