Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/07/2019 06:56:53 PM (7 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/replies/capabilities.php

    r6783 r6921  
    154154                } elseif ( ! is_admin() && ( (int) $user_id === (int) $_post->post_author ) ) {
    155155
    156                     // Only allow if not past the edit-lock period
    157                     $caps = ! bbp_past_edit_lock( $_post->post_date_gmt )
    158                         ? array( $post_type->cap->edit_posts )
    159                         : array( 'do_not_allow' );
     156                    // If editing...
     157                    if ( bbp_is_reply_edit() ) {
     158
     159                        // Only allow if not past the edit-lock period
     160                        $caps = ! bbp_past_edit_lock( $_post->post_date_gmt )
     161                            ? array( $post_type->cap->edit_posts )
     162                            : array( 'do_not_allow' );
     163
     164                    // Otherwise...
     165                    } else {
     166                        $caps = array( $post_type->cap->edit_posts );
     167                    }
    160168
    161169                // Fallback to edit_others_posts.
Note: See TracChangeset for help on using the changeset viewer.