diff --git src/bp-core/bp-core-caps.php src/bp-core/bp-core-caps.php
index 7d1d00482..0a9bf122d 100644
|
|
function bp_user_can( $user_id, $capability, $args = array() ) { |
344 | 344 | return $retval; |
345 | 345 | } |
346 | 346 | |
| 347 | /** |
| 348 | * Adds the `bp_moderate` cap to Administrators when BuddyPress is not active on the network. |
| 349 | * |
| 350 | * @since 7.0.0 |
| 351 | * |
| 352 | * @param WP_Roles $wp_roles The WordPress roles object. |
| 353 | */ |
| 354 | function _bp_roles_init( WP_Roles $wp_roles ) { |
| 355 | if ( isset( $wp_roles->roles[ 'administrator' ], $wp_roles->role_objects[ 'administrator' ] ) && ! bp_is_network_activated() ) { |
| 356 | $wp_roles->roles[ 'administrator' ]['capabilities']['bp_moderate'] = true; |
| 357 | $wp_roles->role_objects[ 'administrator' ]->capabilities['bp_moderate'] = true; |
| 358 | } |
| 359 | } |
| 360 | add_action( 'wp_roles_init', '_bp_roles_init', 10, 1 ); |
| 361 | |
| 362 | /** Deprecated ****************************************************************/ |
| 363 | |
347 | 364 | /** |
348 | 365 | * Temporary implementation of 'bp_moderate' cap. |
349 | 366 | * |
… |
… |
function bp_user_can( $user_id, $capability, $args = array() ) { |
363 | 380 | * Plugin authors: Please do not use this function; thank you. :) |
364 | 381 | * |
365 | 382 | * @since 1.6.0 |
| 383 | * @deprecated 7.0.0 |
366 | 384 | * |
367 | 385 | * @access private |
368 | 386 | * |
… |
… |
function bp_user_can( $user_id, $capability, $args = array() ) { |
375 | 393 | * @return array $allcaps The user's cap list, with 'bp_moderate' appended, if relevant. |
376 | 394 | */ |
377 | 395 | function _bp_enforce_bp_moderate_cap_for_admins( $caps = array(), $cap = '', $user_id = 0, $args = array() ) { |
| 396 | _deprecated_function( __FUNCTION__, '7.0.0' ); |
378 | 397 | |
379 | 398 | // Bail if not checking the 'bp_moderate' cap. |
380 | 399 | if ( 'bp_moderate' !== $cap ) { |
… |
… |
function _bp_enforce_bp_moderate_cap_for_admins( $caps = array(), $cap = '', $us |
394 | 413 | // Only users that can 'manage_options' on this site can 'bp_moderate'. |
395 | 414 | return array( 'manage_options' ); |
396 | 415 | } |
397 | | add_filter( 'map_meta_cap', '_bp_enforce_bp_moderate_cap_for_admins', 10, 4 ); |
398 | | |
399 | | /** Deprecated ****************************************************************/ |
400 | 416 | |
401 | 417 | /** |
402 | 418 | * Adds BuddyPress-specific user roles. |