Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: BuddyPress and Multi-Site issues

Updated bp_adminbar_authors_menu to hide authors on additional main sites

//HOOKS FOR TOP MENU - AUTHORS
remove_action( 'bp_adminbar_menus', 'bp_adminbar_authors_menu', 12 );
add_action( 'bp_adminbar_menus', 'my_bp_adminbar_authors_menu', 12 );
// **** "Blog Authors" Menu (visible when not logged in) ********
function my_bp_adminbar_authors_menu() {
global $current_blog,$wpdb;

$site_id = $wpdb->get_var( "SELECT COUNT(*) FROM wp_site WHERE id=".$current_blog->blog_id);

//$numrows = $wpdb->num_rows($site_id);
if ( $site_id!='1' ) {
$authors = get_users_of_blog();

if ( is_array( $authors ) ) {
/* This is a blog, render a menu with links to all authors */
echo '<li id="bp-adminbar-authors-menu" class="'.$site_id.'"><a href="/">';
_e('Blog Authors', 'buddypress');
echo '</a>';

echo '<ul class="author-list">';
foreach( $authors as $author ) {
$author = new BP_Core_User( $author->user_id );
echo '<li>';

echo '<a href="' . $author->user_url . '">';
echo $author->avatar_mini;
echo ' ' . $author->fullname;
echo '<span class="activity">' . $author->last_active . '</span>';
echo '</a>';
echo '<div class="admin-bar-clear"></div>';
echo '</li>';
}
echo '</ul>';
echo '</li>';
}
}
}

Skip to toolbar