Anonymous User 15030067
(@anonymized-15030067)
Hello,
Are you trying to create a custom user role? I’d recommend using User Role Editor: https://ww.wp.xz.cn/plugins/user-role-editor/
Kind regards,
ClicksFix
No, the role is already existing
Anonymous User 15030067
(@anonymized-15030067)
Okay, then you can do this within the WordPress admin dashboard. As an admin, try the following:
1. Go to WordPress admin dashboard > Users > All users
2. Find user you want to change role of and check the box next to their username (like this)
3. Find “Change role to…” in the table navigation at the top of the table (it will look like this)
4. Find the role that you’d like to change the user(s) too, select it, and then confirm the change by clicking “Change”
Doing that will update the role of any user that you have selected. Does that work for you?
Kind regards,
ClicksFix
Yes that works, but the whole point is to do it by a script so I don’t have to do it manually.
Anonymous User 15030067
(@anonymized-15030067)
For what purpose exactly? Are you wanting new users to have that role when they sign up? Or do you have a lot of users that you want their role switched? Knowing this will help me understand what you are trying to accomplish.
-
This reply was modified 8 years, 9 months ago by
Anonymous User 15030067.
I have a website where I manage my users. Now I created a wiki like website for my users to use. Depending on their role they are able to see different content. But I got way to many users to type them all in by hand and more importantly keep it all up to date and in sync. So now I’m trying to write a script where when I change the users rank on my website it will be change the users role in WP.
Anonymous User 15030067
(@anonymized-15030067)
Thank you, that helps me understand what you are trying to do. Can you share a Gist of the code in question so I can take a look? More that I can see the better (having it in proper formatting helps). Also, what are you using to control the users rank?
Anonymous User 15030067
(@anonymized-15030067)
It appears you’re not using correct PHP control structures so your logic isn’t working correctly. Take a look at this here and fix your statements.