Description
This filter hook allows you to filter the default fields that are displayed in the WP-Members Stats Dashboard table.
The array is key => title where:
- key is the database field in the wp_wpmem_userstats table
- title is the value you want to display as the title in the dashboard table
There is one exception to the above and that is the username/name of the user. The wp_wpmem_userstats table stores the user’s primary key ID. This is not a retrievable field as a key in the array. You can provide one of the following for how you would like the user’s name displayed in the table:
- display_name (default) will display the value that is stored in wp_users display_name (unless you are filtering this value at registration, the default in this field will be the username/user_login value anyway)
- user_login will display what is commonly referred to as “username”
Here is a list of fields, titles, and defaults:
- ‘date’ => ‘Date’ (default)
- ‘display_name’ => ‘Name’ (default)
- ‘title’ => ‘Title’ (default)
- ‘url’ => ‘URL’ (default)
- ‘referer’ => ‘Referrer’ (default)
- ‘ip’ => ‘IP’ (default)
- ‘user_agent’ => ‘User Agent’
- ‘user_login’ => ‘Username’
NOTES: you do not have display in any particular order and you can change the Title (the second value in each pair). While you can omit pairs, you CANNOT change the key names (the first value in each pair).
Usage
add_filter( 'wpmemstat_display_fields', 'my_stats_fields' ); function my_stats_fields( $fields ) { return array( 'date' => 'Date', 'user_login' => 'Username', 'title' => 'Title', 'url' => 'URL', 'referer' => 'Referrer', 'user_agent' => 'User Agent', 'ip' => 'IP' ); }