[buddypress-trac] [BuddyPress Trac] #7473: Extended Profile edit should honour WP's "edit_users" capability

buddypress-trac noreply at wordpress.org
Tue Mar 21 12:06:14 UTC 2017


#7473: Extended Profile edit should honour WP's "edit_users" capability
------------------------------+-----------------------------
 Reporter:  petervandoorn     |       Owner:
     Type:  enhancement       |      Status:  new
 Priority:  high              |   Milestone:  Future Release
Component:  Extended Profile  |     Version:
 Severity:  major             |  Resolution:
 Keywords:                    |
------------------------------+-----------------------------

Comment (by petervandoorn):

 I've fixed it with a little addition to my functions.php, based on the
 code from bp-core-caps.php

 {{{#!php
 function bgmc_enforce_bp_moderate_cap_for_admins( $caps = array(), $cap =
 '', $user_id = 0, $args = array() ) {
         if ( 'bp_moderate' !== $cap ) return $caps; // Bail if not
 checking the 'bp_moderate' cap.
         if ( bp_is_network_activated() ) return $caps; // Bail if
 BuddyPress is network activated.
         if ( bp_is_user_inactive( $user_id ) ) return $caps; // Never
 trust inactive users.
         return array( 'edit_users' ); // Only users that can 'edit_users'
 on this site can 'bp_moderate'.
 }
 remove_filter( 'map_meta_cap', '_bp_enforce_bp_moderate_cap_for_admins',
 10 );
 add_filter( 'map_meta_cap', 'bgmc_enforce_bp_moderate_cap_for_admins', 10,
 4 );
 }}}

 Haven't so far noticed any adverse effects.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7473#comment:3>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list