I am currently using the ‘Recently registered’ plugin (https://wordpress.org/plugins/recently-registered/) which shows the date a customer has registered and allows me to order it.
I want to display a new phone number column but using my code now makes the Registered date column blank.
A FAQ states:
“Why is the field blank?
Because some other plugins are _doing_it_wrong(). When they created their column, they forgot to have the filter return the previous content, if it’s not their column, so it’s removing it. Since my plugin’s doing it right, I gave it a higher priority to stop that from happening in most cases.”
I am not sure how to return the previous content. My code is:
function new_contact_methods( $contactmethods ) {
$contactmethods['billing_phone'] = 'Phone Number';
return $contactmethods;
}
add_filter( 'user_contactmethods', 'new_contact_methods', 10, 1 );
function new_modify_user_table( $column ) {
$column['billing_phone'] = 'Phone';
return $column;
}
add_filter( 'manage_users_columns', 'new_modify_user_table' );
function new_modify_user_table_row( $val, $column_name, $user_id ) {
$user = get_userdata( $user_id );
switch ($column_name) {
case 'billing_phone' :
return get_the_author_meta( 'billing_phone', $user_id );
break;
default:
}
return $return;
}
add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 );
I would be very grateful if someone can help. I use [‘billing_phone’] as part of the registration process to get the phone number.
In the ‘Recently Registered’ plugin, there are filters:
add_filter( 'manage_users_columns', array('RRHE','registerdate'));
add_action( 'manage_users_custom_column', array('RRHE','registerdate_columns'), 10, 3);
add_filter( 'manage_users_sortable_columns', array('RRHE','registerdate_column_sortable') );
add_filter( 'request', array('RRHE','registerdate_column_orderby') );
I need to make sure all data is returned.
Thank you
This has now been resolved by editing the new_modify_user_table_row function, which has the default to return $return. The variable of $return isn’t set, so it’s returning a blank entry.
I have changed $return to $val instead and this has worked.