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 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 Pat 1 year, 2 months ago.

Assigned support staff: 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

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

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