Paid Memberships Pro: Extra Column on the Members List
Adds a column to Memberships > Members showing a value from the member's profile, such as their company or phone number.
Opens WPIDE on
Code
if ( ! function_exists( 'pmpro_hasMembershipLevel' ) ) {
return;
}
$wpide_pmpro_col_meta = 'company';
$wpide_pmpro_col_label = 'Company';
add_filter( 'pmpro_manage_memberslist_columns', function ( $columns ) use ( $wpide_pmpro_col_label ) {
$columns['wpide_extra'] = $wpide_pmpro_col_label;
return $columns;
} );
add_action( 'pmpro_manage_memberslist_custom_column', function ( $column, $user_id ) use ( $wpide_pmpro_col_meta ) {
if ( 'wpide_extra' === $column ) {
$value = get_user_meta( (int) $user_id, $wpide_pmpro_col_meta, true );
echo esc_html( is_scalar( $value ) ? (string) $value : '' );
}
}, 10, 2 );
Notes
Set $wpide_pmpro_col_meta to the user meta key to show. Uses the members list hooks from PMPro 3.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.