Passer la navigation

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

Ce fil est résolu. Voici une description du problème et la solution proposée.

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 Il y a 3 années et 5 mois. 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.

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par himanshuS Il y a 3 années et 5 mois.

Assisté par: Christopher Amirian.

Auteur
Publications
#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

Les langues: Anglais (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!