Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Vladimir Garagulya

    (@shinephp)

    Hi,

    The related update was published with version 5.51.3:
    Update: Roles sorting inside WordPress roles dropdown lists is switched OFF by default. In order to switch WP roles dropdown lists sorting ON, return TRUE from ‘ure_sort_wp_roles_list’ filter, e.g.:

    
    add_filter( 'ure_sort_wp_roles_list', 'sort_wp_roles_list_aphabetically', 10, 1);
    function sort_wp_roles_list_aphabetically( $sort ) {
      $sort = true;
      return $sort;
    }
    

    Add this code to the active theme functions.php file or setup it as a “must use” plugin.

    Thread Starter Kitty

    (@k1t)

    Thank you! I have added this to my functions.php file. Have tested adding a new role, cleared all caches etc. and my new role is still at the bottom of the user role list – not alphabetical on Users page (/wp-admin/users.php). It doesn’t appear to have made any difference.

    Please let me know if you had any other suggestions I could try?

    Thanks for your help!

    Plugin Author Vladimir Garagulya

    (@shinephp)

    I re-tested successfully the exact copy of code above.

    Take into account that URE sorts roles by ID, not by display name. For example role with ID: z_tester and name: ‘A Tester’ will be shown at the end of roles list in spite of its name begins from ‘A’.

    Thread Starter Kitty

    (@k1t)

    Thank you for confirming ?? Yes, I understand that roles will be ordered by ID and my role IDs match the name, so the ordering should be as expected.

    Please see my example: https://ibb.co/PwmWycg

    This screenshot is actually from a list of user roles displayed by a plugin (eNewsletter), but it matches the same as the main Users screen which displays all the roles (/wp-admin/users.php). You can see my new custom roles are showing at the bottom. The IDs for these roles are te_aroha_paeroa_search_and_rescue, canyonsar

    The drop down of roles in the URE screen shows the order correctly:
    https://ibb.co/px5TLZd

    I’m at a loss as to how to fix this, as it used to work automatically. My client has a lot of roles, so it is important that they are in order.

    Thank you for your replies, much appreciated!

    Plugin Author Vladimir Garagulya

    (@shinephp)

    Do you use the latest version of URE 4.52?

    Thread Starter Kitty

    (@k1t)

    Yes version 4.52

    Plugin Author Vladimir Garagulya

    (@shinephp)

    When roles unsorted, new added roles are shown at the top at my tests.

    Try deactivate all plugins except URE. Will it change roles order?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Roles are not ordered alphbetically’ is closed to new replies.