@@ 253-272 (lines=20) @@ | ||
250 | remove_filter( 'comments_clauses', array( self::$instance, 'hide_comments_pre_wp_41' ), 10 ); |
|
251 | ||
252 | switch ( $comment_type ) { |
|
253 | case 'payment': |
|
254 | $comment_args['meta_query'] = ! empty( $comment_args['meta_query'] ) |
|
255 | ? $comment_args['meta_query'] |
|
256 | : array( |
|
257 | array( |
|
258 | 'key' => '_give_donor_id', |
|
259 | 'compare' => 'NOT EXISTS' |
|
260 | ) |
|
261 | ); |
|
262 | ||
263 | $comments = get_comments( wp_parse_args( |
|
264 | $comment_args, |
|
265 | array( |
|
266 | 'post_id' => $id, |
|
267 | 'order' => 'ASC', |
|
268 | 'search' => $search, |
|
269 | 'type' => 'give_payment_note' |
|
270 | ) |
|
271 | ) ); |
|
272 | break; |
|
273 | ||
274 | case 'donor': |
|
275 | $comment_args['meta_query'] = ! empty( $comment_args['meta_query'] ) |
|
@@ 274-292 (lines=19) @@ | ||
271 | ) ); |
|
272 | break; |
|
273 | ||
274 | case 'donor': |
|
275 | $comment_args['meta_query'] = ! empty( $comment_args['meta_query'] ) |
|
276 | ? $comment_args['meta_query'] |
|
277 | : array( |
|
278 | array( |
|
279 | 'key' => "_give_{$comment_type}_id", |
|
280 | 'value' => $id |
|
281 | ) |
|
282 | ); |
|
283 | ||
284 | $comments = get_comments( wp_parse_args( |
|
285 | $comment_args, |
|
286 | array( |
|
287 | 'order' => 'ASC', |
|
288 | 'search' => $search, |
|
289 | 'type' => 'give_donor_note' |
|
290 | ) |
|
291 | ) ); |
|
292 | break; |
|
293 | } |
|
294 | ||
295 | add_action( 'pre_get_comments', array( self::$instance, 'hide_comments' ), 10, 1 ); |