Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/08/2012 05:13:00 PM (12 years ago)
Author:
boonebgorges
Message:

Moves bp_displayed_user_id() and bp_loggedin_user_id() to Core component

The function bp_displayed_user_id() and bp_loggedin_user_id() are referenced
throughout BuddyPress's Core component when doing things like checking page
type. In certain circumstances, these checks might happen after the Core
component is loaded, but before the Members component is loaded. For this
reason, it's important that the functions live in Core rather than Members,
to avoid fatal errors.

Fixes #4403

Props steve7777

File:
1 edited

Legend:

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

    r6152 r6249  
    863863    }
    864864    function bp_user_link() { bp_displayed_user_domain(); } // Deprecated.
    865 
    866 function bp_displayed_user_id() {
    867 
    868     static $id = 0;
    869 
    870     if ( empty( $id ) ) {
    871         global $bp;
    872         $id = !empty( $bp->displayed_user->id ) ? $bp->displayed_user->id : 0;
    873     }
    874 
    875     return apply_filters( 'bp_displayed_user_id', $id );
    876 }
    877 
    878 function bp_loggedin_user_id() {
    879 
    880     static $id = 0;
    881 
    882     if ( empty( $id ) ) {
    883         global $bp;
    884         $id = !empty( $bp->loggedin_user->id ) ? $bp->loggedin_user->id : 0;
    885     }
    886 
    887     return apply_filters( 'bp_loggedin_user_id', $id );
    888 }
    889865
    890866function bp_current_user_id() { return bp_displayed_user_id(); }
Note: See TracChangeset for help on using the changeset viewer.