Skip to:
Content

bbPress.org

Ticket #3164: 3164.patch

File 3164.patch, 2.0 KB (added by SergeyBiryukov, 8 years ago)
  • src/includes/replies/capabilities.php

     
    136136                                if ( bbp_is_user_inactive( $user_id ) ) {
    137137                                        $caps = array( 'do_not_allow' );
    138138
    139                                 // User is author so allow edit if not in admin
     139                                // User is author so allow edit if not in admin, unless it's past edit lock time
    140140                                } elseif ( ! is_admin() && ( (int) $user_id === (int) $_post->post_author ) ) {
    141                                         $caps = array( $post_type->cap->edit_posts );
     141                                        if ( ! bbp_past_edit_lock( $_post->post_date_gmt ) ) {
     142                                                $caps = array( $post_type->cap->edit_posts );
     143                                        } elseif ( user_can( $user_id, 'moderate', $_post->ID ) ) {
     144                                                $caps = array( 'spectate' );
     145                                        } else {
     146                                                $caps = array( 'do_not_allow' );
     147                                        }
    142148
    143149                                // Moderators can always edit forum content
    144150                                } elseif ( user_can( $user_id, 'moderate', $_post->ID ) ) {
  • src/includes/topics/capabilities.php

     
    156156                                if ( bbp_is_user_inactive( $user_id ) ) {
    157157                                        $caps = array( 'do_not_allow' );
    158158
    159                                 // User is author so allow edit if not in admin
     159                                // User is author so allow edit if not in admin, unless it's past edit lock time
    160160                                } elseif ( ! is_admin() && ( (int) $user_id === (int) $_post->post_author ) ) {
    161                                         $caps = array( $post_type->cap->edit_posts );
     161                                        if ( ! bbp_past_edit_lock( $_post->post_date_gmt ) ) {
     162                                                $caps = array( $post_type->cap->edit_posts );
     163                                        } elseif ( user_can( $user_id, 'moderate', $_post->ID ) ) {
     164                                                $caps = array( 'spectate' );
     165                                        } else {
     166                                                $caps = array( 'do_not_allow' );
     167                                        }
    162168
    163169                                // Moderators can always edit forum content
    164170                                } elseif ( user_can( $user_id, 'moderate', $_post->ID ) ) {