Skip to:
Content
Pages
Categories
Search
Top
Bottom

global $bp->displayed_user not populated on users blogs

  • In the previous buddypress the $bp->displayed_user global was populated when viewing a users blog, however now this does not happen. Anyway way to get this functionality back?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Sorry should add a little more information. On a users blog I wanted to have the $bp->displayed_user superglobal populated, so during the bp_init I pull in the first user attached to the blog and populate that global. In 1.2 this worked fine, and I was able to build out things like the nav menu for the user, avatar, etc. However in 1.5 this throws a 404 for the page. Any ideas how I can fix this, or better ways to do this? Here is a snippet of my code:

    add_action("bp_init", "tmp_user_blog_bp_loaded", 7);
    
    function tmp_user_blog_bp_loaded() {
    global $bp, $blog_id, $bp_path;
    
    if  (bp_is_blog_page() && $blog_id != 1 && !$bp->displayed_user->id) {
    $blogusers = get_users_of_blog();
    $user = current($blogusers);
    
    $bp->displayed_user->id = $user->user_id;
    $bp->displayed_user->domain = get_site_url(1) . '/members/'.$user->user_login.'/';
    $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 );
    
    $bp_path = 'index';
    }
    
    }

    Boone Gorges
    Keymaster

    @boonebgorges

    I was pretty confused after your first post, because I knew that BP has never done this, but I see now in your second post that you were always doing it yourself with custom code :)

    What are you trying to do with $bp_path? BP doesn’t use this during its initialization routine anymore, so that could be part of your problem.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘global $bp->displayed_user not populated on users blogs’ is closed to new replies.
Skip to toolbar