Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/31/2012 02:20:16 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Remove static speed-ups in bp_displayed_user_id() and bp_loggedin_user_id(). Causing issues with unit tests by not being clearable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-template.php

    r6641 r6697  
    770770 */
    771771function bp_displayed_user_id() {
    772 
    773     static $id = 0;
    774 
    775     if ( empty( $id ) ) {
    776         global $bp;
    777         $id = !empty( $bp->displayed_user->id ) ? $bp->displayed_user->id : 0;
    778     }
    779 
    780     return apply_filters( 'bp_displayed_user_id', $id );
     772    $bp = buddypress();
     773    $id = !empty( $bp->displayed_user->id ) ? $bp->displayed_user->id : 0;
     774
     775    return (int) apply_filters( 'bp_displayed_user_id', $id );
    781776}
    782777
     
    788783 */
    789784function bp_loggedin_user_id() {
    790 
    791     static $id = 0;
    792 
    793     if ( empty( $id ) ) {
    794         global $bp;
    795         $id = !empty( $bp->loggedin_user->id ) ? $bp->loggedin_user->id : 0;
    796     }
    797 
    798     return apply_filters( 'bp_loggedin_user_id', $id );
     785    $bp = buddypress();
     786    $id = !empty( $bp->loggedin_user->id ) ? $bp->loggedin_user->id : 0;
     787
     788    return (int) apply_filters( 'bp_loggedin_user_id', $id );
    799789}
    800790
Note: See TracChangeset for help on using the changeset viewer.