Change WordPress user roles and capabilities Forums How to or FAQ Export user names and emails list?

Tagged: ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #3413
    Southside
    Participant

    Hi, we use User Role Pro (and are very pleased with it!). We have 400 users and I would like to export a list with all user names and emails to check them easily, preferrably I want to open that list in Excell. Can I export such a list with User role?

    I can see an “Export” button in the admin. When I click I get a .dat-file? What is that and how can I open and read it? When opened in Notepad it is just one line of characters (file is 8 k). That can not be the user list?

    If this can not be done thru User role, can you recommend a plugin that does this (read about some plugin that created a whole lot of mess that I realy donĀ“t want).

    #3414
    Vladimir
    Keymaster

    Hi,

    User Role Editor exports just a user roles with capabilities. It’s a serialized PHP array additionally encoded.

    You can use PhpMyAdmin to export needed data. Use this command at SQL tab:

    
    SELECT user_login, user_email FROM wp_users
    

    replace ‘wp_’ with your own database prefix, if needed.
    Then click ‘Export’. Select an option “CSV for MS Excel” and that’s it. You will get a file with data formatted this way:

    
    "user1";"user1@nomail.my"
    "user2";"user2@nomail.my"
    
    #3418
    Southside
    Participant

    Thank you! We will try that.

    Sorry I forgot, is it possible to also get the date when the user was registrered?

    #3419
    Vladimir
    Keymaster

    Yes, it’s possible:

    
    SELECT user_login, user_email, user_registered FROM wp_users
    
    #3460
    Southside
    Participant

    Worked perfect! Thank you.

    #5144
    Vladimir
    Keymaster

    Query sample with first and last name for every user:

    
    SELECT users.user_login, users.user_email, users.user_registered, meta1.meta_value as first_name, meta2.meta_value as last_name 
    	FROM wp_users users
    	INNER JOIN wp_usermeta as meta1 on meta1.user_id=users.ID and meta1.meta_key='first_name'
            INNER JOIN wp_usermeta as meta2 on meta2.user_id=users.ID and meta2.meta_key='last_name'
    
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.