Export wordpress users to csv using amr users plugin

The “amr users” plugin allows one to create a wide variety of user lists accessing as little or as much of the user data as you like. One can then export these views for further analysis and manipulation.

There are several ways to export users to csv using amr-users

  • Public csv export by stored file on server
  • Non public real time csv export, or
  • Non public real time  csv as .txt export (for excel users, to force the excel text import wizard to appear)
  • Filtered CSV export if using amr-users-plus, by filtering by some fields and then click the ‘CSV filter’ button near the apply filter and clear filter buttons.

The overview screen where user lists can be managed

‘Public’ lists csv export

  • will generate an actual file that can be downloaded
  • a export icon will appear at the bottom of the list (both front pages and admin pages)
  • the list has been ‘ticked’ as public in the overview screen
  • you may or may not have it available on a front page in a shortcode (just because it is ticked public, does not mean that the general public can access it – it must also be in a shortcode in a page
  • the csv file location is obfuscated (hidden, but accessible)
  • you should use good sense in deciding what data should be made available on that list

Non Public Lists

Admin (non public) csv or txt export users options

  • In  order to protect the user data, non public lists are only written to csv at request time.
  • The ‘file’ is sent generated and sent direct to your browser.  No file is stored on the server.
  • This non-stored file option may have implications for people who have magic quotes enabled on their server.

Non Public csv export as .txt file

  • For people who use excel and have troubles with double quotes in csv.
  • Will export the csv list as a .txt file to force excel to use the text import wizard to allow control over the import options


amr users css, html and styling

How to change the look of your user list:

(see screenshots further down)


  • Plugin comes with a default css file used mainly for the public lists
  • Default css tries to let your theme do most of the styling for consistent appearance and just add essential extras
  • Default css can be switched off completely
  • Default css can be activated for certain pages only
  • If you need custom css – maybe because you’ve created a very wide list or your data has forced the table to be wide, see adding custom css to a wordpress website


  • In version 3.4 onwards, the admin or backend lists all use table html as these lists are also used to administer the users
  • Tables can be good and tables can be tricky.  Since YOU are determining the columns, the field values in them and the size of the table, the plugin should not attempt to impose any fixed sizing.   This means if you have a wide list, you may need to add some css to make it behave the way you want.
  • For ‘public’ lists, a ‘public html type‘ can be set to use simple html which allows more flexible styling of the lists.  The same “classes” will be used so much css can be shared for consistency of appearance.
  • so public html type can be:
    • table – yes a normal html table
    • simple – a html5 non table format


  • csv export image link and refresh link icons or text can be totally customised (general settings)
  • default avatar type (used if user does not have their own avatar) will be set by your wordpress settings (settings > Discussion > scroll down to set default avatar )
  • avatar size can be set as a default for all lists (general settings) and/or customised per list (configure list or overview)

CSS and image settings screen:

Css settings for ALL lists – in the General settings

Setting the public html type:

Set the public html type for a list in the overview settings

Multiple column user list in wordpress

How to create a multiple column member directory in wordpress, using the free amr-users plugin.

Member directory with custom avatar and no table html

Member directory with custom avatar and no table html

Key aspects:

  • non table html
  • css to set the width for each user div and to ‘float’ the divs next to each other


  1. activate plugin , start with one of the sample lists
  2. make the list “public”  ( the backend admin lists all use table html )
  3. make the list use the “simple” (ie: non table html )
  4. create a page, enter short code [userlist list=n]  where ‘n’ is the number of your public list.
  5. view the page.  This should use the default css.  If your page width is wide enough, the users should float up next to each other.   If not, you will need to adjust the css.

 amr users “configure the list” settings

Public Html Settings

Public Html Settings – set the tyep to “simple” and make the list “public”

Using firebug to inspect the css:

Default css to set the width and float the user records up next to each other

Default css to set the width and float the user records up next to each other


Getting started with amr-users

On activation

When you activate the plugin:

  • there will be some sample reports using the standard wordpress fields
  • cache tables will be created

What to do next: Summary

Create sample users that have data

  1. Create sample users with sample data.
    1. create wordpress users and if using any other plugins, do whatever actions you need to create sample data (eg: login/out, download something, create a post as that user etc)
  2. There must be at least one entry for each field you want to see.  Just designing a field in whatever plugin you are using is not enough. There must be at least one user with data for that field!

Find the fields

  1. Execute “find the fields” to detect the data you have created.Find fields created by other plugins
  2. Rename anything that has an ‘ugly’ name (optional)Rename fields

Configure the lists

  1. Inspect the overview so you get a general understandingOverview  of lists and general settings
  2. Configure the lists

    Configure each individual list, add fields

    1. Add fields by entering a number for a display order – any number
    2. To select data by a field value (and exclude users who do not have that value), enter the selection values in the ‘include’ fields (comma separate multiple values).
    3. To exclude data by a field value, enter the exclusion values in the ‘exclude’ fields.  Users who have those values will NOT be listed.  Note the sanple lists usually exclude admin users and user id = 1  as example.
    4. Click Update field settings
  3. Rebuild the cache
  4. View the list

Cache Settings

Large or Live Sites:- Set your cache settings carefully

Do you have frequent user updates ?

Do NOT recache on every user update.  User updates include usermeta updates and could happen more often than you think (eg: got a login logger ?)

User meta data NOT stored in wpuser meta table

(eg: Cimy plugin and some others).  User updates may NOT trigger the wp user action.  Must heva batched re cacheing then.

Cache settings
If you make any changes to your system such as:

  • Add user plugins ?
  • Add fields ?
  • Add data ? : 

then Cache must be updated for changes to show. (duh!)


  • have you worked through the steps above?
  • do you understand cron and cacheing
  • Look at ‘test your db’
  • do a search on this site with various keywords
  • look at other posts in this category
  • try the wordpress forum and this forum


Possible user extra field or user meta plugins

Looking for the best wordpress plugin to add extra fields to your user registration and profile?  If you are using a membership plugin, first see what you can achieve with that – most have ability to add user meta.

If you intend reporting or listing user data, please look at how the  plugins store the user data.  If they are not storing the data as simple wordpress user meta, this will complicate search, extract, filtering and impact ability to have dynamic users lists with reasonable performance.

A quick look at what’s available…it’s not good news, getting better.  No one plugin that I feel I can recommend completely without reservations – although advanced custom fields is looking pretty good.



  • a reasonable good newish option
  • there was one field type I would have setup differently, but otherwise pretty good

 cimy extra fields

  • works, but doesn’t use user meta as intended -I have an addon to make the data accessible

user-meta (free version)

  • does not  have front end registration in free version
  • i’m also not a fan of heavy ajax use – I  like things to work without it

s2member (has pro version too)

  • very rich functionality (too complex?)
  • really doesn’t use wordpress as intended – data buried deep in one usermeta record, hard to extract usefully without performance and display issues.
  • see also this problem


  • adds to user profile but not automatically to standard wordpress registration page, seems to need a custom page (what happens to existing? ), fields didn’t work as expected
  • also tons of ‘notices’ in my dev system which to me is not a good sign


tribulants wordpress-custom-fields-plugin

  • I haven’t tried it myself, but looks good

user-meta pro

  • need pro for the front end registration
  • not tested myself

and various membership plugins of course – but then they have aLOT more functionality.

 Sound useful but….

Old, removed

  • register plus and register plus redux appear to have been deleted from the wordpress repository – possibly due to lack of maintenance and vulnerabilities – pity they useful at one stage.

Filters and actions (for developers)

amr-users version 3.2 upwards has wordpress style filters to allow adding in data from other sources.  I use  these myself for the add-on plugins

amr_get_fields  – ($keys)

  • is passed a set of keys or fields that the plugin already knows about from wordpress user or usermet tables or other add-ons
  • your filtering function must return add to t he array of fields to be used when configuring reports and return the augmented array.
  • additional keys or fields will be visible in the nice names list when ‘find fields’ is run

amr_get_users  – ($users)

  • passes the filtering function an array of users with basic user data
  • your filtering function must  return an array of users
  • this is useful if you need to add users that are NOT in wordpress user table. EG: subscribe2 newsletter subscribers.

amr_get_users_with_meta – ($users)

  • passes the filtering function an array of users with basic user data,plus meta data. as required for that report
  • your filtering function must  return an array of users with all the necessary data
  • this is useful for adding in data for users  that is not stored in the wordpress user tables.  Example: cimy plugin data
  • also could be used in the data is stored weirdly.  It gives an opportunity to look at the meta data and work with it (result will be in csv output).  Please also consider using a formatting function as an alternative (result will not be in csv output, but may be more efficient as will only execute for displayed users.)

amr_users_format_value – ( $text, $fieldname, $originalvalue, $user)

  • passes the filtering function :
    • formatted text
    • internal fieldname (see nice names settings page)
    • original value unformatted as found in the database
    • the current user array
  • must return either the origonal text or your special formatting (do  not echo it)
  • working example is amr users plus 2member (free)
  • NB: there is also the option for a special formatting function for your fields.

 amr-users-linktypes – ($linktypes array)

  • passes array of linktypes – name and description for dropdown selection function.. $linktypes[‘name’] = __(‘description’);
  • filtering function must  return an array of  linktypes
  • is passed
    • the chosen linktype when formatting a field (the linktype may be the one you setup above)
    • the user array in case your url is user dependent
    • the field on which the link is to be displayed, in case your url is field depenedent
  • must return a url

amr_users_headings – ($cols,$icols,$ulist)

  • passes the filtering function
    • array of current headings
    • array of ‘technical’ column names
    • the list number
  • filtering function must  return an array of  headings

amr-users-export-csv -( ‘list_users’, $ulist)

  • change the capability required to export to csv

amr_users_csv_line – ( $line[‘csvcontent’])

  • modify the csv line before export

amr_users_apply_filter_html ($apply_filter_html)

  • change the ‘apply filter’ html


  •     $lables = apply_filters (‘amr_filter_lables’, $lables, $col, $selected, $type);


  •     $values = apply_filters (‘amr_filter_values’, $values, $col, $selected, $type);



  • runs before the list is executed or cache fetched
  • for example: allows one to force criteria into the request field  (eg: show only logged in user)
  • receives the list number

Example Applications


This add on adds users from an external table:

  • ‘amr_get_fields’ to add the Subscribe2 subscriber table ip address field
  • ‘amr_get_users_with_meta’ to add the Subscribe2 subscribers to the user list.  It maps the subscribe2 data where possible to existing fields:
    • email => user_email
    • user_registered => date
    • user_status => ‘confirmed’ or ‘unconfirmed’
  • and adds the ip address field in for those subscribers


This add on adds additional data from an external table for existing users. i IE: makes the external data look like user meta data.

  • ‘amr_get_fields’ to add whatever fields have been defined in the cimy fields table
  • ‘amr_get_users_with_meta’ to add the cimy data to the existing users, linking the users by the user id


Simple column filtering in amr users lists

In version 3.0 upwards, various real time filtering has been enabled.  IE: rather than defining a report that only shows rows with a ‘included’ value in a certain column.  You can show all, or several and then offer the ability to filter at display time.

Sophisticated Filtering

For complex filtering needs, you may wish to get access to amr users plus.

It enables the choice of default filtering and  some complex partial column (field level) filtering per column in your custom user list.

or do your own filtering with some html that integrates as follows:

Simple Filtering

If you have some very simple filtering needs, you could code your own little form html to sit on the same page. The html should pass the following parameters back to the user list page.

Yes – this can also be done as links from  other pages.

Query string parameters:

filter=hide or show

  • activate filtering request. plugin will then look for column names
  • hide says “hide  that column” – as all rows will have the same value
  • show = “show the column”


  • pass the technical column name (see the ‘nice names’ list in the settings) and the value to be selected


Adding a link to user list field

There are a number of link types, some predefined

  • in amr-users (free)
  • in amr-users-plus
  • in various other add-ons (eg: buddypress)
  • and then one can add one’s own with  a pluggable function.
some linktypes

some linktypes

Configuring links for fields in the user reporting

Predefined link types:


  • normal html email link if email address exists


  • if a user url has been entered in the profile

edit users

  • requires capability to edit users, will only show if current user has that capability
  • links to the edit user page in wordpress admin


  • to view, the viewer must be logged in , ie requires capability to list posts,
  • links to the admin page for listing posts.
  • “intelligent” link – if attached to a field for a post type (post, page, custom post type etc) post count, will filter for those post types only

authorarchive (aka front end user profile with archive)

Author archive in wordpress 2011 theme

  • links to the author profile / archive page in the front end
  • what you get depends on what your theme or other plugins do with the author archive

detail page using list 2

linktype using list 2

detail page link type

  • this requires the amr-users-plus add-on (v2.11 or higher) and that both list 1 and list 2 public.
  • Probably list2 should be a html5 style for aesthetic reasons
  • choose the ‘detail list using list 2’ linktype from the dropdoewns on the field you want the link from
  • and place a shortcode   [ userlist ] in a page – voila!


 Pluggable functions

A custom formatting function with whatever link you want, can be written by for any  column.   See the linked post for details and the pluggables file for examples.  Do NOT edit the pluggables file.

But I just want a link to view user profile

A general access user profile view is determined by your theme and possibly by whatever plugins add stuff to the author template.

The current default theme will only show a profile for users (authors) with posts.  It can however be modified (and perhaps your themes does this ?) to pickup the user id from the url line and show non-author user profiles too.

If you are not happy with your theme’s author/user template, you could use a site specific snippets plugin to override it with a template of your own using the template_redirect hook.

This post by Mihai Valentin may also be useful:  wordpress-tutorial-load-the-template-you-want-with-template_redirect.

If you do not have the skills for that you can request a custom service for a small fee:




Format any field any way you wish

Custom or Pluggable functions are available for the formatting of any field in a report, One can create one’s own function  if none exist. The plugin will check for one with the right name for the field and use it if it exists.


The file  auser-pluggable.php has many examples, as do some of the custom add-ons.


  1. Get the technical name of any field from the “nicenames” settings.
  2. Add “ausers_format_” to the front -this is your function name.
  3. Your function can receive the field value and a user object.
  4. Your function should return the html you want to have shown in the field.
  5. Save the function as a site specific plugin to avoid overwriting your function with an update. Copy a plugins plugin header, change the details so wp does not get confused.

Example: here “nice name” is given a link to the users url if it exists.

if (!function_exists('ausers_format_user_nicename')) {
 function ausers_format_user_nicename($v, $u) {
 if (!empty($u->user_url))
 return ('<a href="'.$u->user_url.'">'.$v.'</a>');
 else return ($v);