My site is very dependent on user post submissions, where a user can submit a child post for a parent on the parent page. I would like to restrict a user from submitting more than one child post, so rather than have the form be displayed for them to submit again, I would like to have a message be displayed saying something like "It looks like you've added submitted a "post", you can edit your post below" and have the edit post form be displayed.
I can easily achieve this step using views and creating a view for the child post in the relationship and filter it by current post author and within the view have the form to edit the post be there. That's no problem, the issue I'm having is that I don't want the form to be displayed for them to submit additional child posts.
Essentially I just want the add child post form to be displayed conditionally if the current user hasn't made any child posts for the parent that the form is displayed on.
Is there any documentation that you are following?
I've look through much of the documentation and I haven't found a solution
Is there a similar example that we can see?
I did see a similar case when searching through the forums but nothing that fits my needs entirely
What is the link to your site?
Hello. Thank you for contacting the Toolset support.
What you said:
can easily achieve this step using views and creating a view for the child post in the relationship and filter it by current post author and within the view have the form to edit the post be there.
==>
But what if you creating a view for the child post in the relationship and filter it by current post author and limit this view to 1 item and then you can setup the Loop Editor section as follows:
[wpv-layout-start]
[wpv-items-found]
Add whatever text you want to display when a child posts is found.
<!-- wpv-loop-start -->
<tbody class="wpv-loop js-wpv-loop">
<wpv-loop>
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
when there is no post found - you can add your form here
[/wpv-no-items-found]
[wpv-layout-end]
As you can see with the above Loop Editor code, you can add any text you want to display when post is found within the [wpv-items-found] section and you can add the form to [wpv-no-items-found] section when no post is found for that author.