Skip to:
Content

bbPress.org

Changeset 6087


Ignore:
Timestamp:
09/01/2016 08:05:17 PM (8 years ago)
Author:
johnjamesjacoby
Message:

Moderation: Skip moderator query if per-forum moderation is not enabled.

Props jmdodd. Fixes #2988.

Location:
trunk/src/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/forums/capabilities.php

    r6056 r6087  
    258258    $user_id   = bbp_get_user_id( $user_id, false, ! empty( $user_id ) );
    259259    $forum_id  = bbp_get_forum_id( $forum_id );
    260 
    261     // Get forums the user can moderate.
    262     $forum_ids = bbp_get_moderator_forum_ids( $user_id );
    263 
    264     // Is this forum ID in the users array of forum IDs?
    265     if ( ! empty( $forum_ids ) ) {
    266         $retval = in_array( $forum_id, $forum_ids );
     260    $forum_ids = array();
     261
     262    // Only check if per-forum moderation is enabled
     263    if ( bbp_allow_forum_mods() ) {
     264
     265        // Get forums the user can moderate.
     266        $forum_ids = bbp_get_moderator_forum_ids( $user_id );
     267
     268        // Is this forum ID in the users array of forum IDs?
     269        if ( ! empty( $forum_ids ) ) {
     270            $retval = in_array( $forum_id, $forum_ids );
     271        }
    267272    }
    268273
  • trunk/src/includes/replies/capabilities.php

    r6056 r6087  
    135135
    136136                // User is a per-forum moderator, make sure they can spectate.
    137                 } elseif ( bbp_allow_forum_mods() && bbp_is_user_forum_moderator( $user_id, bbp_get_reply_forum_id( $_post->ID ) ) ) {
     137                } elseif ( bbp_is_user_forum_moderator( $user_id, bbp_get_reply_forum_id( $_post->ID ) ) ) {
    138138                    $caps = array( 'spectate' );
    139139
Note: See TracChangeset for help on using the changeset viewer.