Skip Navigation

[Gelöst] Conditional shortcode for user who made a relation

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

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 vor 5 Jahren, 11 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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)

Dieses Thema enthält 3 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von SteffenM1628 vor 5 Jahren, 11 Monaten.

Assistiert von: Christian Cox.

Author
Artikel
#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!