Blog Author Drop Down Fix
-
When visiting a blog, there is a drop down from admin bar that show all the authors of that particular blog. However, not only does it show all authors, it also shows all subscribers as well. Is that the desired functionality? For my site there will be potentially hundreds (I hope!) joining as subscribers of blogs, so this doesn’t make sense.
I’ve hacked it with following (Im new to wordpress and wpmu programming) so there could be easier way to do this), so that it only shows members of this blog who have edit_post permisions (i.e. contributors and up) as well as it does not show any site_admins. Let me know if there is an easier way.
This would replace the author section in the bp-core-adminbar.php file:
// **** “Blog Authors” Menu (visible when not logged in) ********
if ( $current_blog->blog_id > 1 ) {
$authors = get_users_of_blog();
$addfield = true;
if ( is_array( $authors ) ) {
/* This is a blog, render a menu with links to all authors */
foreach( $authors as $author ) {
$curruser = new WP_User($author->user_id);
if ( !is_site_admin( $author->user_login ) && $curruser->has_cap('edit_posts') ) {
if ( $addfield ) {
echo '<li><a href="/">';
_e('Authors', 'buddypress');
echo '</a>';
echo '<ul class="author-list">';
$addfield = false;
}
$author = new BP_Core_User( $author->user_id );
echo '</li>
<li>';
echo '<a>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>
';
}
}
if ( !$addfield ) {
echo '';
echo '';
}
}
}
- The topic ‘Blog Author Drop Down Fix’ is closed to new replies.