Skip Navigation

[Resolved] Conditional shortcode for user who made a relation

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to show a Form that allows Users to create a child post for the current post. If the User has already created a child for the current post, I would like to hide the Form.

Solution: Use a View of posts, filtered by post author and by post relationship set by the current post. In the "no results found" section, insert the Form shortcode. Leave the loop tags empty.

Relevant Documentation:
https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/#how-do-i-prevent-users-from-creating-more-than-one-contractor-post;
https://toolset.com/documentation/post-relationships/

This support ticket is created 5 years, 11 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by SteffenM1628 5 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1165669

I am trying to:

I form should hide when the current users email is equal to child field email which a user has done!

[types field='email-bewerbung-get'][/types] this is the types field of the child. but i didn´t get it running.
or can i check if the user has done a relation to parent?

hope you can help!

#1165693

So Christian, i will explain my site setup:

i have jobs (parent) and applications (child) in a one to many relationship.
The child form is on the parents site. when a user submits an application to a job the form should be hidden to that user.
But not hidden on all jobs - only hidden to that specific job the users has done the application.

This means a user can have a lot of applications. this is why your solution was not working:
https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/#how-do-i-prevent-users-from-creating-more-than-one-contractor-post

the form was on every job hidden to the user because he had already applications built.

So the task is, hide the form only to that jobs the current users has already made a child.

hope this is not to crazy explained 😉

#1165753

It's not too crazy, thanks for the additional information. The solution I proposed will work if you add a Post Relationship Query Filter to the View of Applications. Choose the Jobs - Applications post relationship in the filter settings, and choose the parent post is set by the current post or page.

#1165756

Hey Christian, thats it works great with nor problems!!!!!!

My issue is resolved now. Thank you!