Skip Navigation

[Resolved] How can I show a message OR rediect to new page in CRED based on user role?

This thread is resolved. Here is a description of the problem and solution.

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 support ticket is created 2 years, 9 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.

This topic contains 2 replies, has 2 voices.

Last updated by himanshuS 2 years, 9 months ago.

Assisted by: Christopher Amirian.

Author
Posts
#2284709

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?

#2285097

Christopher Amirian
Supporter

Languages: English (English )

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.

#2285351

My issue is resolved now. Thank you!