Skip Navigation

[Resolved] Limit creation one CPT with specific ID for one user

This support ticket is created 8 years 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Author
Posts
#437393

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

#437534

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 .

#437555

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 🙂

#437831

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.

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.