Almost the same approach One Trick Pony has chosen, but I am using translated names and uasort()
(to preserve the keys):
add_filter( 'editable_roles', 't5_sort_editable_roles' );
/**
* Array of roles.
*
* @wp-hook editable_roles
* @param array $roles
* @return array
*/
function t5_sort_editable_roles( $roles )
{
uasort( $roles, 't5_uasort_editable_roles' );
return $roles;
}
/**
* Compare translated role names.
*
* @param array $a First role
* @param array $b Second role
* @return number
*/
function t5_uasort_editable_roles( $a, $b )
{
return strcasecmp(
translate_user_role( $a['name'] ),
translate_user_role( $b['name'] )
);
}
Related Posts:
- Set default page for user account in admin
- How do I modify the user role ‘subscriber’ to allow the user to delete posts
- Restrict Access to the User Profile
- If the current user is an administrator or editor
- Editor can create any new user except administrator
- How to allow an user role to create a new user under a role which lower than his level only?
- Remove Ability for Other Users to View Administrator in User List?
- Find out if logged in user is not subscriber
- Groups of capabilities: users with multiple roles?
- User-edit role setting distinct from wp_capabilities? [closed]
- Allowing users to edit only their page and nobody else’s
- Execute a function when admin changes the user role
- How to let contributors to create a new revision(draft) editing their published posts
- Disallowing Users of a Custom Role from Deleting or Adding Administrators?
- What the user_status column?
- Hide Admin Menu for Specific User ID who has administrator Role
- How to hide media uploads by other users in the Media menu?
- Show admin bar only for some USERS roles
- Grouping users under parent user
- How to update user role without logout
- How to order users alphabetically by their last name?
- How to check user role without using current_user_can()
- Do not allow users to create new posts and pages
- order users with drag’n’drop?
- \WP_User Object | What’s the Difference Between {caps} and {allcaps}?
- How to enable the theme editor cap for an editor role?
- How to assign capabilities to user NOT to User Role
- How to assign an additional/extra/second user-role to multiple users (of a specific user-role)
- How to stop a user from updating the post date
- BuddyPress | Check if user is in current group [closed]
- Return ID of authors who have at least one post
- Order users by custom user meta
- WordPress edit_user_profile_update update secondary role
- How do I properly format the user_role array?
- How-to Delay The Capability To Publish Posts?
- How to customize wp_signon()
- Is there a simple way to manage capabilities per user?
- Is it possible to get a user with just the password field?
- How to get the Role Name of the current user? (WordPress)
- Redirect after login based on user role (custom login page)
- set_role has no effect
- WP_User->add_role producing unexpected results
- How can I check if the admin bar is visible to the current user?
- Can I create users that have access to *some* other users posts instead of all other users posts?
- Users roles, make a page belonging to multiple users
- Tagging users in WordPress
- Redirect after users complete profile form
- How do I list in the backend all users that were assigned to a custom role?
- How to add local users to wordpress without email password?
- Hide everything on site for visitors except specific page IDs
- Get User Role by ID not working
- the_author_meta(‘user_url’, $author->ID) not working properly. how can I solve this?
- Getting users by specific capability, not role
- add_cap not working with Shop Manager role
- How do I customize the dashboard?
- Managing Users and Creating Groups [closed]
- How to disable a specific page for a specific user
- Are User Levels Still Currently Used?
- Error: How to allow the “contributor” to upload media in wordpress
- Allow user access to Dashboard only!
- Remove Capabilities from WP admin for specific user role
- Updating wp_user_level on user update
- wordpress user roles are not working
- Displaying different in-page content to cliente/admin
- Fix permissions for users role
- User capability for editing their own comments
- What are some best practices for user exit strategy?
- Is there a way to identify a user in a custom REST API method? [duplicate]
- Problem with automatic role change through cron job
- Allow Contributors to Upload Files
- How can I allow an User to publish only 5 posts per month?
- Is possible to allow user to login with different role?
- Add a role and give admin priviledges
- Where are $current_user->allcaps set?
- How change user type from contributor to author
- How do I let contributors edit their posts after being approved once?
- Does wordpress support natively the concept of logging-in users? (not admins, but users of the website)
- How can I prevent certain custom roles from seeing other custom roles on the user list page?
- How many people are allowed to use same wordpress account at the same time?
- Restrict access to non-wordpress section of site with user roles?
- Load user by specific role
- What’s the correct way to add capabilites to user roles?
- How to hide user profile fields based on the role of the viewed user?
- Fix ‘Add Role’ Option not there in wordpress 5.2.2
- User roles not displaying
- Allow admins to login as other users
- Allow Users to Modify Some Values of Assigned WordPress Pods [closed]
- Can I Create a Second Admin Level User Role?
- Does it matter if the very first user, usually Admin, does not have a user ID of 1?
- Customising “user ids” and add to ‘user’ panel in the admin area
- How to hide some users to unlogged users [closed]
- List all users and current week entries
- Groups and subgroups for permission
- Get usermeta info from sql query
- Given multiple admin accounts, how can I make it so that only admin with X username can edit posts
- Assigning multiple or additional capabilities to specific users or how to create additional roles like bbpress roles?
- Change User Role based on Point System Issue
- how do I add role and capability after I create a new user
- Get Authors Role
- Add number of members to “Right Now” dashboard widget