add filters to notes datastore where clauses
This commit is contained in:
parent
dd9948aa1a
commit
b770ccb987
|
@ -315,13 +315,14 @@ class DataStore extends \WC_Data_Store_WP implements \WC_Object_Data_Store_Inter
|
||||||
public function get_notes_count( $type = array(), $status = array() ) {
|
public function get_notes_count( $type = array(), $status = array() ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$where_clauses = $this->get_notes_where_clauses(
|
$args = array(
|
||||||
array(
|
'type' => $type,
|
||||||
'type' => $type,
|
'status' => $status,
|
||||||
'status' => $status,
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$where_clauses = $this->get_notes_where_clauses( $args );
|
||||||
|
$where_clauses = apply_filters( 'wc_admin_notes_count_where_clauses', $where_clauses, $args );
|
||||||
|
|
||||||
if ( ! empty( $where_clauses ) ) {
|
if ( ! empty( $where_clauses ) ) {
|
||||||
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||||
return $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}wc_admin_notes WHERE 1=1{$where_clauses}" );
|
return $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}wc_admin_notes WHERE 1=1{$where_clauses}" );
|
||||||
|
@ -371,7 +372,7 @@ class DataStore extends \WC_Data_Store_WP implements \WC_Object_Data_Store_Inter
|
||||||
$where_clauses .= " AND status IN ($escaped_status_types)";
|
$where_clauses .= " AND status IN ($escaped_status_types)";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $where_clauses;
|
return apply_filters( 'wc_admin_notes_where_clauses', $where_clauses, $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue