Skip to:
Content

BuddyPress.org

Changeset 11107


Ignore:
Timestamp:
09/16/2016 08:47:12 PM (8 years ago)
Author:
r-a-y
Message:

Caps: In bp_current_user_can(), use get_current_user_id() instead of bp_loggedin_user_id().

We're switching to get_current_user_id() because bp_loggedin_user_id()
is initialized on the 'bp_setup_globals' hook, which fires too late in
certain instances. We also apply the 'bp_loggedin_user_id' filter for
devs that are using it.

Fixes #7192.

File:
1 edited

Legend:

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

    r11058 r11107  
    277277    }
    278278
     279    /** This filter is documented in /bp-core/bp-core-template.php */
     280    $current_user_id = apply_filters( 'bp_loggedin_user_id', get_current_user_id() );
     281
    279282    // Call bp_user_can().
    280     $retval = bp_user_can( bp_loggedin_user_id(), $capability, $args );
     283    $retval = bp_user_can( $current_user_id, $capability, $args );
    281284
    282285    /**
Note: See TracChangeset for help on using the changeset viewer.