Index: bp-members/bp-members-adminbar.php
===================================================================
--- bp-members/bp-members-adminbar.php	(revision 4564)
+++ bp-members/bp-members-adminbar.php	(working copy)
@@ -123,4 +123,259 @@ function bp_members_admin_bar_my_account_logout() {
 if ( defined( 'BP_USE_WP_ADMIN_BAR' ) )
 	add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_my_account_logout', 9999 );
 
+function bp_members_admin_bar_user_admin_menu() {
+	global $wpdb, $bp, $wp_admin_bar;
+
+	// Only show if viewing a user
+	if ( !bp_is_user() )
+		return false;
+
+	// Don't show this menu to non site admins or if you're viewing your own profile
+	if ( !current_user_can( 'edit_users' ) || bp_is_my_profile() )
+		return false;
+		
+	$avatar = bp_get_displayed_user_avatar( array( 'type' => 'thumb', 'width' => '10',			'height' => '10' ) );
+	$parent_id = $avatar ? 'user-admin-with-avatar' : 'user-admin';
+	
+	$wp_admin_bar->add_menu( array( 'id' => $parent_id, 'title' => /* $avatar . */ __( 'User Admin' ), 'href' => bp_displayed_user_domain() ) );
+ 
+	// Account Status
+	$wp_admin_bar->add_menu( array( 
+		'parent' => $parent_id, 
+		'id' 	 => 'account-status', 
+		'title'  => __( 'Account Status', 'buddypress' ), 
+		'href'   => bp_displayed_user_domain() 
+	) );
+	
+	// Account Status > Spam/unspam this user
+	if ( !bp_core_is_user_spammer( bp_displayed_user_id() ) ) {
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'account-status', 
+			'id' 	 => 'spam', 
+			'title'  => sprintf( __( 'Mark %s as Spam', 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+			'href' 	 => wp_nonce_url( bp_displayed_user_domain() . 'admin/mark-spammer/', 'mark-unmark-spammer' ),
+			'meta' 	 => array( 'onclick' => 'confirm(" ' . __( 'Are you sure you want to mark this user as a spammer?', 'buddypress' ) . '");' )
+		) );
+	} else {
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'account-status', 
+			'id' 	 => 'unspam', 
+			'title'  => __( 'Not a Spammer', 'buddypress' ), 
+			'href' 	 => wp_nonce_url( bp_displayed_user_domain() . 'admin/unmark-spammer/', 'mark-unmark-spammer' ),
+			'meta' 	 => array( 'onclick' => 'confirm(" ' . __( 'Are you sure you want to unmark this user as a spammer?', 'buddypress' ) . '");' )
+		) );
+	}
+	
+	// Account Status > Delete this account
+	$wp_admin_bar->add_menu( array( 
+		'parent' => 'account-status', 
+		'id' 	 => 'delete-account', 
+		'title'  => sprintf( __( "Delete %s's Account", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+		'href' 	 => wp_nonce_url( bp_displayed_user_domain() . 'admin/delete-user/', 'delete-user' ),
+		'meta' 	 => array( 'onclick' => 'confirm(" ' . __( 'Are you sure you want to mark this user as a spammer?', 'buddypress' ) . '");' )
+	) );
+	
+	if ( bp_is_active( 'activity' ) ) {
+		// Activity
+		$wp_admin_bar->add_menu( array(  
+			'parent' => $parent_id,
+			'id' 	 => 'activity', 
+			'title'  => __( "Activity", 'buddypress' ), 
+			'href' 	 => bp_get_members_component_link( 'activity' )
+		) );
+		
+		// Activity > Delete user's activity
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'activity', 
+			'id' 	 => 'delete-activity', 
+			'title'  => sprintf( __( "Delete %s's Activity", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+			'href' 	 => bp_get_members_component_link( 'activity', 'admin', array( 'clear' => 'all' ), true ),
+			'meta' 	 => array( 'onclick' => 'confirm(" ' . __( "Are you sure you want to delete this user's activity?", 'buddypress' ) . '");' )
+		) );
+	}
+	
+	if ( bp_is_active( 'xprofile' ) ) {
+		// Profile
+		$wp_admin_bar->add_menu( array(  
+			'parent' => $parent_id,
+			'id' 	 => 'profile', 
+			'title'  => __( "Profile", 'buddypress' ), 
+			'href' 	 => bp_get_members_component_link( 'profile' )
+		) );
+		
+		// Profile > Edit this user's profile
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'profile', 
+			'id' 	 => 'edit-profile', 
+			'title'  => sprintf( __( "Edit %s's Profile", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+			'href' 	 => bp_get_members_component_link( 'profile', 'edit' )
+		) );
+		
+		// Profile > Edit this user's avatar
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'profile', 
+			'id' 	 => 'edit-avatar', 
+			'title'  => sprintf( __( "Edit %s's Avatar", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+			'href' 	 => bp_get_members_component_link( 'profile', 'change-avatar' )
+		) );
+	}
+	
+	if ( bp_is_active( 'messages' ) ) {
+		// Messages
+		$wp_admin_bar->add_menu( array(  
+			'parent' => $parent_id,
+			'id' 	 => 'messages', 
+			'title'  => __( "Messages", 'buddypress' ), 
+			'href' 	 => bp_get_members_component_link( 'messages' )
+		) );
+		
+		// Messages > Empty this user's inbox
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'messages', 
+			'id' 	 => 'empty-inbox', 
+			'title'  => sprintf( __( "Empty %s's Inbox", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+			'href' 	 => bp_get_members_component_link( 'messages', 'admin', array( 'clear' => 'inbox' ), true ),
+			'meta' 	 => array( 'onclick' => 'confirm(" ' . __( "Are you sure you want to empty this user's inbox?", 'buddypress' ) . '");' )
+		) );
+			
+		// Messages > Empty this user's sentbox
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'messages', 
+			'id' 	 => 'empty-sentbox', 
+			'title'  => sprintf( __( "Empty %s's Sent Box", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+			'href' 	 => bp_get_members_component_link( 'messages', 'admin', array( 'clear' => 'sentbox' ), true ),
+			'meta' 	 => array( 'onclick' => 'confirm(" ' . __( "Are you sure you want to empty this user's Sent box?", 'buddypress' ) . '");' )
+		) );
+		
+		// Messages > Empty all of this user's messages
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'messages', 
+			'id' 	 => 'empty-all', 
+			'title'  => sprintf( __( "Empty All %s's Messages", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+			'href' 	 => bp_get_members_component_link( 'messages', 'admin', array( 'clear' => 'all' ), true ),
+			'meta' 	 => array( 'onclick' => 'confirm(" ' . __( "Are you sure you want to empty this user's messages?", 'buddypress' ) . '");' )
+		) );
+	}
+	
+	if ( bp_is_active( 'friends' ) ) {
+		// Friends
+		$wp_admin_bar->add_menu( array(  
+			'parent' => $parent_id,
+			'id' 	 => 'friends', 
+			'title'  => __( "Friends", 'buddypress' ), 
+			'href' 	 => bp_get_members_component_link( 'friends' )
+		) );
+		
+		// Friends > Remove this user's friendships
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'friends', 
+			'id' 	 => 'remove-friendships', 
+			'title'  => sprintf( __( "Remove %s's Friendships", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+			'href' 	 => bp_get_members_component_link( 'friends', 'admin', array( 'clear' => 'friendships' ), true ),
+			'meta' 	 => array( 'onclick' => 'confirm(" ' . __( "Are you sure you want to remove this user's friendships?", 'buddypress' ) . '");' )
+		) );
+			
+		// Friends > Clear this user's friend requests
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'friends', 
+			'id' 	 => 'clear-friendship-requests', 
+			'title'  => sprintf( __( "Clear %s's Friendship Requests", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+			'href' 	 => bp_get_members_component_link( 'friends', 'admin', array( 'clear' => 'invites' ), true ),
+			'meta' 	 => array( 'onclick' => 'confirm(" ' . __( "Are you sure you want to clear this user's friendship requests?", 'buddypress' ) . '");' )
+		) );
+	}
+	
+	if ( bp_is_active( 'groups' ) ) {
+		// Groups
+		$wp_admin_bar->add_menu( array(  
+			'parent' => $parent_id,
+			'id' 	 => 'groups', 
+			'title'  => __( "Groups", 'buddypress' ), 
+			'href' 	 => bp_get_members_component_link( 'groups' )
+		) );
+		
+		// Groups > Remove this user from all groups
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'groups', 
+			'id' 	 => 'remove-groups', 
+			'title'  => sprintf( __( "Remove %s From All Groups", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+			'href' 	 => bp_get_members_component_link( 'groups', 'admin', array( 'clear' => 'memberships' ), true ),
+			'meta' 	 => array( 'onclick' => 'confirm(" ' . __( "Are you sure you want to remove this user from all groups?", 'buddypress' ) . '");' )
+		) );
+			
+		// Groups > Clear this user's group invites
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'groups', 
+			'id' 	 => 'clear-group-invites', 
+			'title'  => sprintf( __( "Clear %s's Group Invitations", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+			'href' 	 => bp_get_members_component_link( 'groups', 'admin', array( 'clear' => 'invites' ), true ),
+			'meta' 	 => array( 'onclick' => 'confirm(" ' . __( "Are you sure you want to clear this user's group invitations?", 'buddypress' ) . '");' )
+		) );
+	}
+	
+	if ( bp_is_active( 'forums' ) ) {
+		// Forums
+		$wp_admin_bar->add_menu( array(  
+			'parent' => $parent_id,
+			'id' 	 => 'forums', 
+			'title'  => __( "Forums", 'buddypress' ), 
+			'href' 	 => bp_get_members_component_link( 'forums' )
+		) );
+		
+		// Forums > Delete this user's topics
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'forums', 
+			'id' 	 => 'delete-topics', 
+			'title'  => sprintf( __( "Delete %s's Topics", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+			'href' 	 => bp_get_members_component_link( 'forums', 'admin', array( 'clear' => 'topics' ), true ),
+			'meta' 	 => array( 'onclick' => 'confirm(" ' . __( "Are you sure you want to delete this user's forum topics?", 'buddypress' ) . '");' )
+		) );
+			
+		// Forums > Delete this user's forum replies
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'forums', 
+			'id' 	 => 'delete-replies', 
+			'title'  => sprintf( __( "Delete %s's Replies", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+			'href' 	 => bp_get_members_component_link( 'forums', 'admin', array( 'clear' => 'replies' ), true ),
+			'meta' 	 => array( 'onclick' => 'confirm(" ' . __( "Are you sure you want to delete this user's forum replies?", 'buddypress' ) . '");' )
+		) );
+		
+		// Forums > Delete all of this user's forum posts
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'forums', 
+			'id' 	 => 'delete-posts', 
+			'title'  => sprintf( __( "Delete All %s's Posts", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+			'href' 	 => bp_get_members_component_link( 'forums', 'admin', array( 'clear' => 'all' ), true ),
+			'meta' 	 => array( 'onclick' => 'confirm(" ' . __( "Are you sure you want to delete all of this user's forum posts?", 'buddypress' ) . '");' )
+		) );
+	}
+
+	if ( bp_is_active( 'settings' ) ) {
+		// Settings
+		$wp_admin_bar->add_menu( array(  
+			'parent' => $parent_id,
+			'id' 	 => 'settings', 
+			'title'  => __( "Settings", 'buddypress' ), 
+			'href' 	 => bp_get_members_component_link( 'settings' )
+		) );
+		
+		// Settings > Edit this user's general settings
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'settings', 
+			'id' 	 => 'edit-general-settings', 
+			'title'  => sprintf( __( "Edit %s's General Settings", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+			'href' 	 => bp_get_members_component_link( 'settings', 'general' )
+		) );
+			
+		// Settings > Edit this user's notification settings
+		$wp_admin_bar->add_menu( array( 
+			'parent' => 'settings', 
+			'id' 	 => 'edit-notifications-settings', 
+			'title'  => sprintf( __( "Edit %s's Notification Settings", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ), 
+			'href' 	 => bp_get_members_component_link( 'settings', 'notifications' )
+		) );
+	}
+}
+add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_user_admin_menu', 75 );
+
 ?>
\ No newline at end of file
