Skip to:
Content

bbPress.org

Ticket #3429: 3429.patch

File 3429.patch, 1.4 KB (added by naxoc, 3 years ago)
  • src/includes/users/functions.php

     
    699699
    700700        // Check meta for count, or query directly if not found
    701701        $count = bbp_get_user_topic_count( $user_id, true );
    702         if ( empty( $count ) ) {
    703                 $count = bbp_get_user_topic_count_raw( $user_id );
    704         }
     702    if ( empty( $count ) ) {
     703        $count = bbp_get_user_topic_count_raw( $user_id );
     704        // The raw count holds the truth (it's been updated already at this point).
     705        // Don't bump the true value, so set difference to 0.
     706        $difference = 0;
     707    }
    705708
    706709        $difference       = (int) $difference;
    707710        $user_topic_count = (int) ( $count + $difference );
     
    735738
    736739        // Check meta for count, or query directly if not found
    737740        $count = bbp_get_user_reply_count( $user_id, true );
    738         if ( empty( $count ) ) {
    739                 $count = bbp_get_user_reply_count_raw( $user_id );
    740         }
     741    if ( empty( $count ) ) {
     742        $count = bbp_get_user_reply_count_raw( $user_id );
     743        // The raw count holds the truth (it's been updated already at this point).
     744        // Don't bump the true value, so set difference to 0.
     745        $difference = 0;
     746    }
    741747
    742748        $difference       = (int) $difference;
    743749        $user_reply_count = (int) ( $count + $difference );