WPFront
  • Home
  • Plugins
    • Notification Bar Plugin
      • Plugin Ideas
      • Plugin Settings
      • Plugin FAQ
    • Scroll Top Plugin
      • Plugin Settings
      • Plugin FAQ
    • User Role Editor Plugin
      • Plugin Documentation
      • Plugin Settings
      • Plugin FAQ
    • Paddle Gateway Plugin
  • Go Pro
  • Support
    • Documentation
    • FAQ
  • Affiliates
  • Contact
  • Login
  • Cart
  • This topic has 3 replies, 2 voices, and was last updated 3 years, 9 months ago by Syam Mohan.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • August 5, 2021 at 4:36 am #118464
    Jason Angel
    Spectator

    There is a bug in the Roles menu when editing a user. Instead of being alphabetical, it lists the role last edited at the top. This means that anytime a role is edited, it lists that one at the top. This makes the list of roles hard to read as they are in no order.

    August 5, 2021 at 10:11 pm #118498
    Syam Mohan
    Keymaster

    Hi Jason,

    The role dropdown in user profile is populated by WP core. This plugin doesn’t decide the sort order. You can test by deactivating this plugin. And you should still get the same sort order.

    I’ll add an item in my to do list, with a low priority, to see if this can be sorted.

    Thanks,
    Syam

    August 6, 2021 at 5:10 am #118537
    Jason Angel
    Spectator

    OK, thanks. I came up with the following that seems to work to resort them.

    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( $b, $a )
    {
    	return strcasecmp(
    		translate_user_role( $a['name'] ),
    		translate_user_role( $b['name'] )
    	);
    }
    August 7, 2021 at 9:53 am #118577
    Syam Mohan
    Keymaster

    Thanks for the tip!

    If this works for you, you can add this code to your functions.php to fix this problem.

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Log In
Log In
Lost Password

Search Topics

Documentation

FAQ
Roles List Add Role Edit Role Delete Role Restore Role Add or Remove Capability Assign/Migrate Users Posts/Pages Extended Permissions Custom Post Type Permissions Navigation Menu Permissions Widget Permissions Admin Menu Editor Media/Attachment File Permissions User Level Permissions Content Restriction Shortcodes Login Redirect Export Roles Import Roles Bulk Edit Settings Multisite Roles List Multisite Add New Role Multisite Edit Role Multisite Delete Role Multisite Restore Role Multisite Sync Roles Multisite Settings WordPress Capabilities Actions and Filters Installation Instructions