Description
This filter allows you to pass arguments to the user list function wpmem_do_member_list to override default values that are used in the building process. The wpmem_do_member_list function uses the wp_parse_args function to merge arguments passed through this filter with the following defaults:
$defaults = array( // HTML wrappers. 'list_before' => '<div id="wpmem-ul-list">', 'list_after' => '</div>', 'heading_before' => '<h2>', 'heading_after' => '</h2>', 'user_even_before' => '<div class="wpmem-ul-user">', 'user_even_after' => '</div>', 'user_odd_before' => '<div class="wpmem-ul-user-odd">', 'user_odd_after' => '</div>', 'user_label_before' => '', 'user_label_after' => '', 'user_field_before' => '', 'user_field_after' => '', 'avatar_before' => '<div class="avatar">', 'avatar_after' => '</div>', 'field_tag' => 'div', 'empty_list_before' => '<div align="center" id="wpmem_msg"><p>', 'empty_list_after' => '</p></div>', // Other 'member_since_label' => __( 'Member since: ', 'wp-members-ul' ), 'member_since_format' => "F j, Y, g:i a", 'empty_list_text' => __( 'No members found', 'wp-members-ul' ), );
Parameters
$args
(array) (required) An array of arguments that are to override form $defaults.
$list_id
(string) (optional) Identifies which list instance is being displayed.
Usage
Like all of the “_args” filters, this filter merges the returned value with the defaults. No argument is actually passed to the filter, so it can only be used once. Subsequent uses of the same _args filter will override previous uses of the same filter. So keep all changes in one filter function.
Date format for “Member Since” field
The plugin default format is “F j, Y, g:i a”. This displays as “October 26, 2018, 2:27 pm”.
You can use PHP date formats for changing the format to whatever style you want for the list. See https://www.php.net/manual/en/function.date.php
For example, returning “d m Y” would render as “26 Oct 2018” or “F Y” would be October 2018″. Use “Y” to display just a 4 digit year. See the PHP documenation link above for more ideas.
Alternatively, if you would like to use your WP date format (Settings > General > Date Format), you can just return get_option( ‘date_format’ ).
This example uses the existing WP date format:
add_filter( 'wpmem_ul_list_args', function() { // Returns the date format set in Settings > General > Date Format $args['member_since_format'] = get_option( 'date_format' ); return $args; });
This example uses a PHP date format:
add_filter( 'wpmem_ul_list_args', function() { // Returns the PHP date format for "October 26, 2018" $args['member_since_format'] = "F j, Y"; return $args; });
Changelog
Introduced in version 1.2
$list_id parameter added in 1.9.0
Source
wpmem_ul_list_args is located in wp-members-user-list.php