Skip to:
Content

bbPress.org


Ignore:
Timestamp:
09/11/2026 09:03:14 PM (4 weeks ago)
Author:
johnjamesjacoby
Message:

Forums: Restrict forum structure and attributes.

Require global forum authority to change hierarchy, order, moderator assignments, and access attributes across theme, admin, REST, and XML-RPC edits. Introduce an object-level capability so BuddyPress Group Admins can manage attributes for their own Group Forums without granting structural access to Group Moderators.

In trunk, for 2.7.

Props hieunx91.

File:
1 edited

Legend:

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

    r7386 r7489  
    231231         */
    232232        public function attributes_metabox() {
     233
     234                // Bail if the current user cannot edit forum structure
     235                if ( ! current_user_can( 'assign_moderators' ) ) {
     236                        return;
     237                }
     238
    233239                add_meta_box(
    234240                        'bbp_forum_attributes',
    … …  
    341347                }
    342348
     349                // Bail if current user cannot edit forum structure
     350                if ( ! current_user_can( 'assign_moderators' ) ) {
     351                        return $forum_id;
     352                }
     353
    343354                // Parent ID
    344355                $parent_id = ( ! empty( $_POST['parent_id'] ) && is_numeric( $_POST['parent_id'] ) )
    … …  
    386397
    387398                // What is the user doing here?
    388                 if ( ! current_user_can( 'edit_forum', $forum_id ) ) {
     399                if ( ! current_user_can( 'manage_forum_attributes', $forum_id ) ) {
    389400                        wp_die( esc_html__( 'You do not have permission to do that.', 'bbpress' ) );
    390401                }
Note: See TracChangeset for help on using the changeset viewer.