A Cozmoslabs Product
Documentation / Developer Knowledge Base / Add custom column to the Members List table

Add custom column to the Members List table

Using custom code, the Members List table from Paid Member Subscriptions can be extended to show extra columns with arbitrary data.

This can be achieved using some custom code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
add_filter( 'pms_members_list_table_columns', 'pmsc_modify_members_list_columns' );
function pmsc_modify_members_list_columns( $columns ){
    $columns['custom-column'] = 'Custom Column';
 
    return $columns;
}
 
add_filter( 'pms_members_list_table_entry_data', 'pmsc_modify_members_list_data', 20, 2 );
function pmsc_modify_members_list_data( $data, $member ) {
 
    $data['custom-column'] = get_user_meta( $member->user_id, 'your_custom_field', true );
 
    return $data;
 
}

The first function adds the column while the second one adds the data that will be displayed in it. This is just an example, so make sure you change the column and usermeta field slug.

In the first function, if you re-arrange the items from the $columns array, you can control in which order the columns are displayed.

The Ultimate Membership Bundle

Combine the power of Profile Builder with Paid Member Subscriptions to set up user registration, memberships, and recurring revenue.

Get 25% off with the bundle

Help & Support

We’re here to help you every step of the way.

Open a Support Ticket