Skip Navigation

[Resolved] Using conditional logic

This support ticket is created 6 years, 8 months 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.

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 6 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#623534

Tell us what you are trying to do?
I am trying to restrict or enable user base on their role.
- User need to update their company profile on a form to be able to use the company dashboard
- One of my require condition is if user role is "vendor" and user have updated form, then be able to access dashboard

Is there any documentation that you are following?
No

Is there a similar example that we can see?
Not sure

What is the link to your site?
Am working on a staging site but nothing much there yet

Kindly assist

#623570

Hello,

I assume the "company dashboard" is a wordpress page, you can try these:
1) Create a CRED user form for editing users, let your users to edit their own profile:
https://toolset.com/documentation/user-guides/cred-user-forms/

2) After user submit the Form, use CRED action hook "cred_save_data", to trigger a PHP function:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
in this PHP function, update user's role to "vendor", for example
https://wordpress.stackexchange.com/questions/4725/how-to-change-a-users-role
More help:
https://developer.wordpress.org/reference/classes/wp_user/add_role/

3) And use Access plugin to setup the limit access to the company dashboard page:
https://toolset.com/documentation/user-guides/limiting-read-access-specific-content/
https://toolset.com/documentation/user-guides/access-control-texts-inside-page-content/