All Topics
Filtering custom columns
Hello,
I have created a custom column with your toolkit (https://www.admincolumns.com/documentation/guides/creating-new-column-type/)
I’m trying to figure out how to filter a custom column that I created…
In my ac-column-my_niveau_adhesion.php
the code is very simple, it’s a SQL query that retrieve the value of membership level for a user.
public function get_raw_value( $user_id ) {
// put all the column logic here to retrieve the value you need
// For example: $value = get_user_meta( $user_id, '_my_custom_field_example', true );
global $wpdb;
$value = $wpdb->get_var( $wpdb->prepare("SELECT name FROM $wpdb->pmpro_membership_levels AS level INNER JOIN $wpdb->pmpro_memberships_users AS user ON level.id = user.membership_id WHERE user.user_id = %s ORDER BY user.id DESC LIMIT 1", $user_id ) );
return $value;
}
So it creates me a custom column with corrects values, and I can see it in the Admin Column Pro Settings.
However, the column is not ‘filterable’ as you can see…
And I don’t know how to manage this, in the ‘acp-column-my_niveau_adhesion.php’ both editing and sorting have an interface..but no filtering.
Thanks you
You must be logged in to reply to this topic.