Skip Navigation

[Resolved] Limit Number of Cred Form Submission by User Role

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
- 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)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 1 year, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#2558383

Tell us what you are trying to do?

I have 4 post types, Companies, Services, Portfolios and Promo Codes. I have 4 subscription plans on my site and each subscription plan assigns a user role to the subscriber. As an example, if a subscriber subscribes to the free plan, he is assigned to the user role "start-up" and he can only post 1 company, 1 service, 1 portfolio etc.

So based on the link (provided below) this is a good starting point, however, if the subscriber doesn't has the required permission based on his user role, I want to redirect it to an upgrade URL where he can upgrade his account to be able to add more post.

Is there any documentation that you are following?

Yes, I saw this topic but I need more guidelines to achieve what I need to achieve https://toolset.com/forums/topic/limiting-cred-form-submission-to-one-post/#

Is there a similar example that we can see?

N/A

What is the link to your site?

hidden link

#2559195

Hello,

Yes, you can use filter hook "cred_form_validate" to limit thenumber of posts created by current user by his role, see the solution in the thread you mentioned above:
https://toolset.com/forums/topic/limiting-cred-form-submission-to-one-post/#

But "cred_form_validate" filter hook does not redirect user by default, I suggest you setup the error message with HTML link to the "URL where he can upgrade his account", for example:

$errors['wpcf-user-validation']='<a href="<em><u>hidden link</u></em>">Limitation reached, ppgrade your account here ...</a>';

After user submit the post form, he can see the message, and click the link to that URL.