Skip to:
Content

bbPress.org


Ignore:
Timestamp:
06/16/2017 07:45:05 PM (7 years ago)
Author:
johnjamesjacoby
Message:

Capabilities: Logic improvements to help with per-forum moderation.

  • Introduce moderate_forum capability check, used to check if a user has the ability to moderate a specific forum
  • Limit number of direct keep_gate checks, and use bbp_is_user_keymaster() where possible
  • Make bbp_is_user_forum_moderator() check the new moderate_forum mapped capability
  • Have the moderate mapped capability check moderate_forum if the $args[0] can be bubbled up to being a forum ID
  • Map admin post-type areas to their appropriate edit_ capabilities – they are now properly handled via other mapped conditions

This change (along with r6567 & r6569) allows private & hidden forums to appear in forums queries for users who can moderate them.

File:
1 edited

Legend:

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

    r6438 r6571  
    4343 * @uses get_post_type_object() To get the post type object
    4444 * @uses bbp_get_public_status_id() To get the public status id
    45  * @uses bbp_is_user_forum_moderator() To check if the user is a forum moderator
    46  * @uses bbp_get_reply_forum_id() To get the repliy forum id
     45 * @uses bbp_get_reply_forum_id() To get the reply forum id
    4746 * @uses apply_filters() Filter mapped results
    4847 *
     
    181180                // Moderators can always edit forum content
    182181                } elseif ( user_can( $user_id, 'moderate', $_post->ID ) ) {
    183                      $caps = array( 'spectate' );
     182                    $caps = array( 'spectate' );
    184183
    185184                // Unknown so map to delete_others_posts
     
    205204
    206205        case 'bbp_replies_admin' :
    207             $caps = array( 'moderate' );
     206            $caps = array( 'edit_replies' );
    208207            break;
    209208    }
Note: See TracChangeset for help on using the changeset viewer.