Skip to:
Content
Pages
Categories
Search
Top
Bottom

Set Displayed User

  • @djanym

    Participant

    Hello.
    How can I set displayed user not on the profile page?
    Example:
    I have a page “Home” (it’s different form profile page) and the url is something like: http://mysite.com/
    I want to manually set displayed user.
    Something like this: bp_set_dsplayed_user( $user_id )

    I know that I can use logged user var, but it’s not suitable for my task.

Viewing 1 replies (of 1 total)
  • @djanym

    Participant

    I’ve made such way:
    Added a function in functions.php and call it in beginning of the page.

    function set_displayed_user( $user_id ) {
    global $bp;
    
    $bp->displayed_user->id = $user_id;
    $bp->displayed_user->domain = bp_core_get_user_domain( $bp->displayed_user->id );
    $bp->displayed_user->userdata = bp_core_get_core_userdata( $bp->displayed_user->id );
    $bp->displayed_user->fullname = bp_core_get_user_displayname( $bp->displayed_user->id );
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Set Displayed User’ is closed to new replies.
Skip to toolbar