Skip Navigation

[Resolved] How to update user role in bulk

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

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 4 years, 10 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 2 replies, has 2 voices.

Last updated by Pat 4 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#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

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.