Skip to:
Content

bbPress.org

Changeset 7349


Ignore:
Timestamp:
08/13/2025 10:42:00 PM (7 months ago)
Author:
johnjamesjacoby
Message:

Topics - Template: Add missing output condition where voice count is 0 but last-activity exists.

This change fixes a bug where topics created by anonymous users would show the "This topic is empty" fallback text in the topic description, when the topic was obviously not empty.

In trunk, for 2.7.

Fixes #3652.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/topics/template.php

    r7347 r7349  
    33173317        // Topic has activity (could be from reply or topic author)
    33183318        $last_active = bbp_get_topic_last_active_id( $topic_id );
    3319         if ( ! empty( $vc_int ) && ! empty( $last_active ) ) {
    3320             $last_updated_by = bbp_get_author_link( array( 'post_id' => $last_active, 'size' => $r['size'] ) );
    3321             $retstr          = sprintf( esc_html__( 'This topic has %1$s, %2$s, and was last updated %3$s by %4$s.', 'bbpress' ), $reply_count, $voice_count, $time_since, $last_updated_by );
     3319        if ( ! empty( $last_active ) ) {
     3320
     3321            // Last-updated-by should always exist if last-active does
     3322            $last_updated_by = bbp_get_author_link( array(
     3323                'post_id' => $last_active,
     3324                'size'    => $r['size']
     3325            ) );
     3326
     3327            // Voice count is non-zero (registered users engaged)
     3328            if ( ! empty( $vc_int ) ) {
     3329                $retstr = sprintf( esc_html__( 'This topic has %1$s, %2$s, and was last updated %3$s by %4$s.', 'bbpress' ), $reply_count, $voice_count, $time_since, $last_updated_by );
     3330
     3331            // Voice count is zero (anonymous users only)
     3332            } else {
     3333                $retstr = sprintf( esc_html__( 'This topic was last updated %1$s by %2$s.', 'bbpress' ), $time_since, $last_updated_by );
     3334            }
    33223335
    33233336        // Topic has no replies
Note: See TracChangeset for help on using the changeset viewer.