bp_adminbar_authors_menu

Add the Blog Authors menu to the BuddyBar (visible when not logged in).

Description

bp_adminbar_authors_menu(); 

Usage

  1. if ( !function_exists( 'bp_adminbar_authors_menu' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/deprecated/2.1.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_adminbar_authors_menu(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-core/deprecated/2.1.php  
  1. function bp_adminbar_authors_menu() { 
  2. global $wpdb; 
  3.  
  4. // Only for multisite 
  5. if ( ! is_multisite() ) { 
  6. return false; 
  7.  
  8. // Hide on root blog 
  9. if ( bp_is_root_blog( $wpdb->blogid ) || ! bp_is_active( 'blogs' ) ) { 
  10. return false; 
  11.  
  12. $blog_prefix = $wpdb->get_blog_prefix( $wpdb->blogid ); 
  13. $authors = $wpdb->get_results( "SELECT user_id, user_login, user_nicename, display_name, user_email, meta_value as caps FROM $wpdb->users u, $wpdb->usermeta um WHERE u.ID = um.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY um.user_id" ); 
  14.  
  15. if ( !empty( $authors ) ) { 
  16. // This is a blog, render a menu with links to all authors 
  17. echo '<li id="bp-adminbar-authors-menu"><a href="/">'; 
  18. _e('Blog Authors', buddypress); 
  19. echo '</a>'; 
  20.  
  21. echo '<ul class="author-list">'; 
  22. foreach( (array) $authors as $author ) { 
  23. $caps = maybe_unserialize( $author->caps ); 
  24. if ( isset( $caps['subscriber'] ) || isset( $caps['contributor'] ) ) { 
  25. continue; 
  26.  
  27. echo '<li>'; 
  28. echo '<a href="' . bp_core_get_user_domain( $author->user_id, $author->user_nicename, $author->user_login ) . '">'; 
  29. echo bp_core_fetch_avatar( array( 
  30. 'item_id' => $author->user_id,  
  31. 'email' => $author->user_email,  
  32. 'width' => 15,  
  33. 'height' => 15,  
  34. 'alt' => sprintf( __( 'Profile picture of %s', buddypress ), $author->display_name ) 
  35. ) ); 
  36. echo ' ' . $author->display_name . '</a>'; 
  37. echo '<div class="admin-bar-clear"></div>'; 
  38. echo '</li>'; 
  39. echo '</ul>'; 
  40. echo '</li>';