Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: global $bp->displayed_user not populated on users blogs

@kloppster

Member

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';
}

}
Skip to toolbar