Hi, everybody!
A month ago I asked and I got the some answer...
https://toolset.com/forums/topic/limit-form-submissions-post-relatively-of-parent-post/
where I was sent to
https://toolset.com/forums/topic/limit-submissions-per-session-per-user-per-time-period/#post-424560
But this hook don't solves my issue.
I will try to get the answer once again.
My issue is:
1) we have many CPT 'event',
2) logged-in user can create CPT 'event-request' (something like booking),
3) CPT 'event-request' is child of CPT 'event',
4) user can not create more then one 'event-request' for 'event' with specific ID,
5) user can create all you want 'event-request' for all you want 'event', but the condition stated in point 4 must be satisfied.
What the function/hook I can set for the form "Create new event request"?
Who can help me?
Thanks to all for your time
Dear virageguitars,
For question:
4. user can not create more then one 'event-request' for 'event' with specific ID,
I suggest you try this:
1) Create a view to list child 'event-request' posts, and with two filters:
a) child 'event-request' posts of the specific parent "event" post:
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/
b) posts whose author is current user:
https://toolset.com/documentation/user-guides/filtering-views-query-by-author/
2) in section "Loop Output Editor", display the child 'event-request' posts, in the shortcode :
[wpv-no-items-found]
...
[/wpv-no-items-found]
Display a CRED form for creating the child 'event-request',
https://toolset.com/documentation/views-shortcodes/#wpv-no-items-found
3) put above view into the content of single "Event" post, then your user will be able see the CRED form when they do not have any child 'event-request' posts
For question:
5. user can create all you want 'event-request' for all you want 'event', but the condition stated in point 4 must be satisfied.
What is the all you want 'event'? is the "all you want" a custom field or custom taxonomy?
If it is, you can use Views shortcode [wpv-conditional] to check if the custom field or taxonomy's value is "all you want", then display a CRED form for creating all you want 'event-request' post:
https://toolset.com/documentation/views-shortcodes/#wpv-conditional
onditional shortcode to be used to display a specific block of meta HTML based on results of a boolean expression .
It looks somehow complicated...
More detailed explanation of process:
1) we have many CPT 'event',
2) logged-in user must to see a list of all events,
3) logged-in user should be able to choice any event from a list of all events,
4) logged-in user can create CPT 'event-request' (something like booking),
5) CPT 'event-request' is child of CPT 'event',
6) user create the 'event request' on the event page - [cred_child_link_form],
7) user can not create another 'event-request' for 'event' has already been booked in point 6,
8) user can create another 'event-request' for any 'event' from a list of all events, but the condition stated in point 7 must be satisfied.
Let me rephrase the question, something like that:
How to display the link "Create event request" ([cred_child_link_form]) on a page of event only if a user has not been booked this event?
Thanks again for your time 🙂
Q) How to display the link "Create event request" ([cred_child_link_form]) on a page of event only if a user has not been booked this event?
What is the a user has not been booked this event?
If it is this:
The current user does not have a child 'event-request' post of current "event" post
Then please try as I mentioned above:
https://toolset.com/forums/topic/limit-creation-one-cpt-with-specific-id-for-one-user/#post-437534
Please let me know if you need more assistance to setup it.