add new column in user panel to identify if user is new or old user. If user is ‘New Customer’ then he or she place single order in system if user is ‘Old Customer’ then he or she place multiple order in system.
function modify_user_column( $column ) {
$column['customer_type'] = 'Customer Type';
return $column;
}
add_filter( 'manage_users_columns', 'modify_user_column' );
function modify_user_table_row( $val, $column_name, $user_id ) {
$user = get_userdata( $user_id );
$user_type_value = esc_attr( get_the_author_meta( '_order_count', $user->ID ));
if($user_type_value > 1){
$user_type_value_column = 'Old Customer';
}else{
$user_type_value_column = 'New Customer';
}
switch ($column_name) {
case 'customer_type' :
return $user_type_value_column;
break;
default:
}
}
add_filter( 'manage_users_custom_column', 'modify_user_table_row', 10, 3 );