Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/07/2019 06:56:53 PM (4 years ago)
Author:
johnjamesjacoby
Message:

Moderation: make sure pending topics (for moderation reasons) are accessible to authors.

This commit updates the logic inside of the topic & reply map-meta-cap implementations, restricting edit-lock checks to actual "Edit" screens, and using the "edit_others_posts" capability in non-"Edit" screens, ensuring that both scenarios are covered.

It also adds an explicit condition for Pending Topics to both the Topic Description and Topic Notices, alerting users as to why they are seeing what they are seeing.

Fixes #3253 (again!) See also #3164 for other related discussion & details.

File:
1 edited

Legend:

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

    r6903 r6921  
    30823082        // Trashed notice
    30833083        case bbp_get_trash_status_id() :
    3084             $notice_text = esc_html__( 'This topic is in the trash.',   'bbpress' );
     3084            $notice_text = esc_html__( 'This topic is in the trash.', 'bbpress' );
     3085            break;
     3086
     3087        // Pending notice
     3088        case bbp_get_pending_status_id() :
     3089            $notice_text = esc_html__( 'This topic is pending moderation.', 'bbpress' );
    30853090            break;
    30863091
     
    33363341        // Topic has activity (could be from reply or topic author)
    33373342        $last_active = bbp_get_topic_last_active_id( $topic_id );
    3338         if ( ! empty( $last_active ) ) {
     3343        if ( ! empty( $vc_int ) && ! empty( $last_active ) ) {
    33393344            $last_updated_by = bbp_get_author_link( array( 'post_id' => $last_active, 'size' => $r['size'] ) );
    33403345            $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 );
    33413346
    33423347        // Topic has no replies
    3343         } elseif ( ! empty( $voice_count ) && ! empty( $reply_count ) ) {
     3348        } elseif ( ! empty( $vc_int ) && ! empty( $reply_count ) ) {
    33443349            $retstr = sprintf( esc_html__( 'This topic has %1$s and %2$s.', 'bbpress' ), $voice_count, $reply_count );
    33453350
    33463351        // Topic has no replies and no voices
    3347         } elseif ( empty( $voice_count ) && empty( $reply_count ) ) {
    3348             $retstr = sprintf( esc_html__( 'This topic has no replies.', 'bbpress' ), $voice_count, $reply_count );
     3352        } elseif ( empty( $vc_int ) && empty( $reply_count ) ) {
     3353            $retstr = esc_html__( 'This topic has no replies.', 'bbpress' );
     3354
     3355        // Topic is pending
     3356        } elseif ( bbp_get_topic_status( $topic_id ) === bbp_get_pending_status_id() ) {
     3357            $retstr = esc_html__( 'This topic is pending moderation.', 'bbpress' );
     3358
     3359        // Fallback
     3360        } else {
     3361            $retstr = esc_html__( 'This topic is empty.', 'bbpress' );
    33493362        }
    33503363
Note: See TracChangeset for help on using the changeset viewer.