Home › Toolset Professional Support › [Resolved] How can I show a message OR rediect to new page in CRED based on user role?
Problem:
How to redirect to a page or show a message depending on the user role for a form.
Solution:
Try to add two separate forms for each 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.
This topic contains 2 replies, has 2 voices.
Last updated by himanshuS 2 years, 9 months ago.
Assisted by: Christopher Amirian.
I have a user edit form where a subscriber and a member can both share more information.
For the member, I want to show a message after form submission.
For the subscriber, I want to redirect them to a new page.
I have cred_redirect to direct users before but I am not sure if works in tandem with the show message setting in CRED.
Can someone please elaborate?
Hi there,
You either need to create separate edit forms for each user role and decide what to do with them, which is the recommended way, or, set the current form to redirect to a new page and then use the cred_success_redirect hook and use the native WordPress current_user_can hook to determine what user role it is and decide what to do with the redirection.
For more information about cred_success_redirect:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect
For more information about current_user_can
https://developer.wordpress.org/reference/functions/current_user_can/
I would stick with a separate User Edit Form for each user role method as it is cleaner and has no custom code need.
Thank you.
My issue is resolved now. Thank you!