Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/25/2015 07:23:55 PM (4 years ago)
Author:
r-a-y
Message:

Caps: Fix issue with passing an empty array as an argument in bp_current_user_can().

Changes to bp_current_user_can() in #6501 broke older capability checks
relying on an empty argument to be passed in order to use a fallback value.

Most notably, bp_current_user_can('bp_xprofile_change_field_visibility' )
checks now passed by default. This resulted in the "Change" link to
always be visible when editing a profile field even if an admin has enabled
"Enforce field visibility" for that particular field.

This commit fixes this issue by passing a null value if there are no
extra arguments to pass in bp_current_user_can(). Commit also includes
a unit test.

See #6730 (2.4-branch).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.4/src/bp-core/bp-core-caps.php

    r10108 r10376  
    292292    }
    293293
     294    // Backward compatibility for older bp_current_user_can() checks
     295    if ( empty( $args ) ) {
     296        $args = null;
     297    }
     298
    294299    // Use root blog if no ID passed
    295300    if ( empty( $blog_id ) ) {
Note: See TracChangeset for help on using the changeset viewer.