Skip to:
Content

BuddyPress.org

Changeset 11703


Ignore:
Timestamp:
09/27/2017 09:08:35 AM (7 years ago)
Author:
djpaul
Message:

Core: when checking for bp_moderate capability, use bp_current_user_can().

Fixes #7598

Props meitar for initial patch.

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-admin.php

    r11447 r11703  
    9595    // @todo: Check if user is allowed to create new activity items
    9696    // if ( ! current_user_can( 'bp_new_activity' ) )
    97     if ( ! current_user_can( 'bp_moderate' ) )
     97    if ( ! bp_current_user_can( 'bp_moderate' ) )
    9898        die( '-1' );
    9999
  • trunk/src/bp-groups/bp-groups-admin.php

    r11556 r11703  
    509509function bp_groups_admin_edit() {
    510510
    511     if ( ! current_user_can( 'bp_moderate' ) )
     511    if ( ! bp_current_user_can( 'bp_moderate' ) )
    512512        die( '-1' );
    513513
     
    10971097
    10981098    // Permission check.
    1099     if ( ! current_user_can( 'bp_moderate' ) ) {
     1099    if ( ! bp_current_user_can( 'bp_moderate' ) ) {
    11001100        return;
    11011101    }
     
    12121212
    12131213    // Bail if user user shouldn't be here, or is a large network.
    1214     if ( ! current_user_can( 'bp_moderate' ) || ( is_multisite() && wp_is_large_network( 'users' ) ) ) {
     1214    if ( ! bp_current_user_can( 'bp_moderate' ) || ( is_multisite() && wp_is_large_network( 'users' ) ) ) {
    12151215        wp_die( -1 );
    12161216    }
  • trunk/src/bp-groups/bp-groups-filters.php

    r11299 r11703  
    310310function bp_groups_disable_at_mention_notification_for_non_public_groups( $send, $usernames, $user_id, BP_Activity_Activity $activity ) {
    311311    // Skip the check for administrators, who can get notifications from non-public groups.
    312     if ( user_can( $user_id, 'bp_moderate' ) ) {
     312    if ( bp_user_can( $user_id, 'bp_moderate' ) ) {
    313313        return $send;
    314314    }
  • trunk/src/bp-groups/bp-groups-template.php

    r11661 r11703  
    23592359    if ( $user_id ) {
    23602360        // Users with the 'bp_moderate' cap can always send invitations.
    2361         if ( user_can( $user_id, 'bp_moderate' ) ) {
     2361        if ( bp_user_can( $user_id, 'bp_moderate' ) ) {
    23622362            $can_send_invites = true;
    23632363        } else {
  • trunk/src/bp-groups/classes/class-bp-group-extension.php

    r11554 r11703  
    809809
    810810        // Always allow moderators to see nav items, even if explicitly 'noone'
    811         if ( ( 'noone' !== $this->params['show_tab'] ) && current_user_can( 'bp_moderate' ) ) {
     811        if ( ( 'noone' !== $this->params['show_tab'] ) && bp_current_user_can( 'bp_moderate' ) ) {
    812812            return true;
    813813        }
     
    830830
    831831        // Always allow moderators to visit a tab, even if explicitly 'noone'
    832         if ( ( 'noone' !== $this->params['access'] ) && current_user_can( 'bp_moderate' ) ) {
     832        if ( ( 'noone' !== $this->params['access'] ) && bp_current_user_can( 'bp_moderate' ) ) {
    833833            return true;
    834834        }
  • trunk/src/bp-groups/classes/class-bp-groups-group.php

    r11604 r11703  
    17661766     *
    17671767     * Will include hidden groups in the count only if
    1768      * current_user_can( 'bp_moderate' ).
     1768     * bp_current_user_can( 'bp_moderate' ).
    17691769     *
    17701770     * @since 1.6.0
  • trunk/src/bp-members/classes/class-bp-members-admin.php

    r11447 r11703  
    11981198
    11991199        // Permission check.
    1200         if ( ! current_user_can( 'bp_moderate' ) && $user_id != bp_loggedin_user_id() ) {
     1200        if ( ! bp_current_user_can( 'bp_moderate' ) && $user_id != bp_loggedin_user_id() ) {
    12011201            return;
    12021202        }
Note: See TracChangeset for help on using the changeset viewer.