Skip to:
Content

BuddyPress.org

Ticket #8355: 8355.2.patch

File 8355.2.patch, 1.9 KB (added by imath, 5 years ago)
  • src/bp-core/bp-core-caps.php

    diff --git src/bp-core/bp-core-caps.php src/bp-core/bp-core-caps.php
    index 7d1d00482..6f9f7984f 100644
    function bp_user_can( $user_id, $capability, $args = array() ) { 
    344344        return $retval;
    345345}
    346346
     347/**
     348 * Adds the `bp_moderate` cap to the Administrator role.
     349 *
     350 * @since 7.0.0
     351 *
     352 * @param WP_Roles $wp_roles The WordPress roles object.
     353 */
     354function _bp_roles_init( WP_Roles $wp_roles ) {
     355        $wp_roles->roles[ 'administrator' ]['capabilities']['bp_moderate']      = true;
     356        $wp_roles->role_objects[ 'administrator' ]->capabilities['bp_moderate'] = true;
     357}
     358add_action( 'wp_roles_init', '_bp_roles_init', 10, 1 );
     359
     360/** Deprecated ****************************************************************/
     361
    347362/**
    348363 * Temporary implementation of 'bp_moderate' cap.
    349364 *
    function bp_user_can( $user_id, $capability, $args = array() ) { 
    363378 * Plugin authors: Please do not use this function; thank you. :)
    364379 *
    365380 * @since 1.6.0
     381 * @deprecated 7.0.0
    366382 *
    367383 * @access private
    368384 *
    function bp_user_can( $user_id, $capability, $args = array() ) { 
    375391 * @return array $allcaps The user's cap list, with 'bp_moderate' appended, if relevant.
    376392 */
    377393function _bp_enforce_bp_moderate_cap_for_admins( $caps = array(), $cap = '', $user_id = 0, $args = array() ) {
     394        _deprecated_function( __FUNCTION__, '7.0.0' );
    378395
    379396        // Bail if not checking the 'bp_moderate' cap.
    380397        if ( 'bp_moderate' !== $cap ) {
    function _bp_enforce_bp_moderate_cap_for_admins( $caps = array(), $cap = '', $us 
    394411        // Only users that can 'manage_options' on this site can 'bp_moderate'.
    395412        return array( 'manage_options' );
    396413}
    397 add_filter( 'map_meta_cap', '_bp_enforce_bp_moderate_cap_for_admins', 10, 4 );
    398 
    399 /** Deprecated ****************************************************************/
    400414
    401415/**
    402416 * Adds BuddyPress-specific user roles.