Skip to:
Content

BuddyPress.org

Ticket #7192: bp-user-can-args.diff

File bp-user-can-args.diff, 1.0 KB (added by dcavins, 3 years ago)

Avoid changing the $args variable.

  • src/bp-core/bp-core-caps.php

    diff --git a/src/bp-core/bp-core-caps.php b/src/bp-core/bp-core-caps.php
    index 2963f9f..6789838 100644
    a b function bp_current_user_can( $capability, $args = array() ) { 
    277277                $blog_id = bp_get_root_blog_id();
    278278        }
    279279
    280         $args   = array( $blog_id, $capability, $args );
    281         $retval = call_user_func_array( 'current_user_can_for_blog', $args );
     280        $retval = call_user_func_array( 'current_user_can_for_blog', array( $blog_id, $capability, $args ) );
    282281
    283282        /**
    284283         * Filters whether or not the current user has a given capability.
    function bp_user_can( $user_id, $capability, $args = array() ) { 
    319318        }
    320319
    321320        $switched = is_multisite() ? switch_to_blog( $site_id ) : false;
    322         $args     = array( $user_id, $capability, $args );
    323         $retval   = call_user_func_array( 'user_can', $args );
     321        $retval   = call_user_func_array( 'user_can', array( $user_id, $capability, $args ) );
    324322
    325323        /**
    326324         * Filters whether or not the specified user has a given capability on a given site.