BP Member Profile Links to Network Author Pages
I’ve been working on getting links in the buddypress member profile that jump over to author pages(author.php) for that user on other blogs on the network. The following hack job code I got to do just that but it doesn’t do it quite right. It only shows blogs that the user is currently a member of and has posts, not if users have posted in the past and for some reason were moved or deleted as users from the subsite.
<?php
$user_id = bp_displayed_user_id();
$user_name = bp_get_displayed_user_username();
$user_blogs = get_blogs_of_user( $user_id );
echo ''.$user_name.'\'s Author Page for this User:<ul>';
foreach ($user_blogs AS $user_blog) {
echo '<li><a href="'.$user_blog->siteurl.'/author/'.__($user_name).'">'.$user_blog->blogname.'</a></li>';
}
echo '</ul>';
<?php $user_id = bp_displayed_user_id();$user_name = bp_get_displayed_user_username();$user_blogs = get_blogs_of_user( $user_id );echo ''.$user_name.'\'s posts:<ul>';foreach ($user_blogs AS $user_blog) { echo '<li><a href="'.$user_blog->siteurl.'/author/'.__($user_name).'">'.$user_blog->blogname.'</a></li>';}echo '</ul>';
?>
So then I tried to force it by using this:
<?php $user_id = bp_displayed_user_id(); $blog_details = get_blog_details(24); $user_name = bp_get_displayed_user_username(); echo ''.$user_name.'\'s Author page on this Blog:<ul>'; echo '<li><a href="'.$blog_details->siteurl.'/author/'.__($user_name).'">'.$blog_details->blogname.'</a></li>'; echo '</ul>'; ?>
…only thing with that is that it forces a link on a member profile even if the member doesn’t have posts on the subsite.
Wondering how I could get the first code to recognize all published posts regardless of membership to the subsite. Any ideas welcome.

No comments yet.