Problem: I understand that a CRED form can be used to create posts. I understand that a different CRED form can be used to edit a post. Can you explain how to set up a CRED form to edit a post that does not exist yet?
Also, how can I restrict the number of posts a User can create with CRED?
Solution: CRED forms are not restricted to a particular post, so you can reuse the same CRED form for any post in a particular post type.
To limit the number of posts a User can create with CRED, you can use a View. Let's say you have a custom page with a CRED form that allows your Users to create an Ad. That Ad's author will be the current User, once it's created. You need to determine whether or not to display the CRED form, based on how many Ads have been created by the current User. You can filter a View by post author, and you can react differently based on the number of results.
Set up a View that shows all posts where the author is equal to the current User. A View's Loop Output contains two sections - results found and no results found. You can use these two sections to display different information based on whether or not there is already a post by the current User. Or, you can use other conditional code that tests the number of results found.
Relevant Documentation:
https://toolset.com/documentation/user-guides/creating-cred-forms/
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-found-count
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate
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.
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 2 replies, has 2 voices.
Last updated by 7 years, 1 month ago.
Assisted by: Christian Cox.