Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6747
    designserve
    Participant

    Hi Vladimir,

    This is not really about User Role Editor but I hope you might have an idea.

    In the Users list, I want to view the users who do not have a certain role. For example, I would like to see users who do not have the Role of Subscriber or I would like to see the users who do not have the Role of Participant.

    The reason for this is that I have 12,000 users and some of the numbers of each Role in the filters at the top of the All Users page in the back end do not make sense. If I could filter a list of users who do not have a role I could examine the reason why they don’t have the role so that I could decide if I should grant the role to them.

    Do you have an idea how I could do this? Please, don’t spend much time on it I just wondered if you have an idea because you’re an expert with roles and users!

    Kind regards,
    Mike

    #6748
    Vladimir
    Keymaster

    Hi Mike,

    It’s not possible with UI at wp-admin. You may use any SQL tool, like phpMyAdmin or MySQL WorkBench, and execute this command:

    
    SELECT DISTINCT wp_users.ID, wp_users.user_login, wp_usermeta.meta_value 
    	FROM wp_usermeta 
    		JOIN wp_users on wp_users.ID=wp_usermeta.user_id
    	WHERE wp_usermeta.meta_key='wp_capabilities' AND
    		wp_usermeta.meta_value NOT LIKE '%subscriber%'
    	ORDER BY wp_users.ID;
    

    Just replace ‘wp_’ at the database tables names with your DB prefix from wp-config.php.
    Make the same replacement for the meta_key ‘wp_capabilities’ value.
    Command above will show the list of all users without subscriber role.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.