From c34673079e22dedc1d06d35d4ed976de037f3d97 Mon Sep 17 00:00:00 2001
From: denis <denis@deniska>
Date: Feb 9, 2017 3:15:20 AM
Correct last reply position in "Last Post" column
diff --git a/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-performance-optimizations.php b/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-performance-optimizations.php
index 56eb051..8ced4eb 100644
|
a
|
b
|
|
| 35 | 35 | |
| 36 | 36 | // REST API. |
| 37 | 37 | add_filter( 'rest_endpoints', array( $this, 'disable_rest_api_users_endpoint' ) ); |
| | 38 | |
| | 39 | // Correct last reply position |
| | 40 | add_filter( 'bbp_get_reply_position', array( $this, 'correct_last_reply_position' ), 10, 3 ); |
| 38 | 41 | } |
| 39 | 42 | |
| 40 | 43 | /** |
| … |
… |
|
| 366 | 369 | } |
| 367 | 370 | return $bound_id; |
| 368 | 371 | } |
| | 372 | |
| | 373 | /** |
| | 374 | * Correct last reply position with considering hidden replies |
| | 375 | * with status Spam, Pending, Archived, etc. |
| | 376 | * |
| | 377 | * @link https://meta.trac.wordpress.org/ticket/2043 |
| | 378 | */ |
| | 379 | function correct_last_reply_position( $reply_position, $reply_id, $topic_id ) { |
| | 380 | $reply_count_hidden = bbp_get_topic_reply_count_hidden( $topic_id, true ); |
| | 381 | $reply_count = bbp_get_topic_reply_count( $topic_id, true ); |
| | 382 | |
| | 383 | return $reply_count - $reply_count_hidden; |
| | 384 | } |
| 369 | 385 | } |