Sauter la navigation

[Résolu] How to update user role in bulk

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

Problem:

Change the user role from Editor to Subscriber using Toolset form for editing users.

Solution:

It needs custom codes, for example:

https://toolset.com/forums/topic/how-to-update-user-role-in-bulk/#post-1252769

Relevant Documentation:

https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

This support ticket is created Il y a 5 années et 7 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.

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)

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

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

Assisté par: Luo Yang.

Auteur
Publications
#1252645

Pat

Hello,

I'm using Toolset access and have created specific roles.
Now, I would like to restore all non administrator and editor users to subscriber. Is it pssible to do this from the front end thanks to a hook for example?
Regards
Pat

#1252769

Dear Pat,

I assume you are going to change the user role from Editor to Subscriber using Toolset form for editing users.

If it is, it needs custom codes, for example, after user submit the edit user form, you can use action hook cred_save_data to trigger a PHP function, in this PHP function change the user's role to Subscriber .

More help:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

See the example codes here:
https://wordpress.stackexchange.com/questions/4725/how-to-change-a-users-role/4727#4727

#1256939

Pat

Hi Luo,

I agree with you and I was just trying to see if you could have a better idea in the meantime.
I have several sites where I need to make this kind of "re-initialisation" and that have been good to have a robust front end solution for that.

Thanks
Pat