• Hi all;

    I’m at a bit of a loss after searching hours on the internet all day today for a possible solution to what I thought would be an easy project.

    I have created custom user roles on a website and removed the default ones (except administrator). With how I’ve customized the site, only the admin and the new user roles were needed (ex: user_level_01, user_level_02, user_level_03, user_level_04, user_level_05, etc.).

    With this, I am aiming for a hierarchal search within the ‘wp-admin/users.php’ area based on user roles. I have been attempting to filter the search results to only populate users in certain roles (user_level_04, user_level_05). I don’t want the results to display higher-level roles (user_level_01, admin, etc.) – except obviously for the admin.

    In addition, the role-selection area just under the ‘Users / Add New’ title within the page ‘wp-admin/users.php’ has predefined default populated roles (‘all | Administrator | Contributor | Editor | Author | Subscriber). I’d like them to be replaced with my lower-level custom user roles (user_level_04, user_level_05). The issue with that is that using FireBug, I cannot find where this function is so that I can edit, and I could edit the CSS style ‘.subsubsub’ to ‘display: none’, but then again, I don’t know where else it may be used and don’t want to risk hiding other features later on.

    I’d prefer a functions.php solution vs. a plugin, but if the plugin doesn’t interfere with my current set-up, I can test it out and see if it works.

    Thanks in advance for any guidance.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You can alter the output of these views by editing the array passed to the ‘views_users’ filter. I’m afraid though something deeper is flawed in your approach because these views should reflect all roles actually defined in your installation. These views are not hard coded, they are generated dynamically from the global $wp_roles, a WP_Roles object.

    If you are seeing removed roles and not your added roles, I’m afraid you have not organized your roles properly. Adding and removing roles should directly affect this global object, thus making your roles available for the views output without need to filter the output.

Viewing 1 replies (of 1 total)

The topic ‘Help with custom search/filter in wp-admin/users.php’ is closed to new replies.