WordPress.org

Making WordPress.org

Ticket #2043: 2043.patch

File 2043.patch, 1.4 KB (added by denisco, 17 months ago)
  • wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-performance-optimizations.php

    From e15c6f52783d8f35eb9dcd625a63f5215f7e0e83 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..7af6b16 100644
    a b  
    3535
    3636                // REST API.
    3737                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 );
    3841        }
    3942
    4043        /**
     
    366369                }
    367370                return $bound_id;
    368371        }
     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 bbp_get_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        }
    369385}