Index: bp-themes/bp-default/functions.php
===================================================================
--- bp-themes/bp-default/functions.php	(revision 6357)
+++ bp-themes/bp-default/functions.php	(working copy)
@@ -112,34 +112,74 @@ function bp_dtheme_setup() {
 		add_theme_support( 'custom-header', $custom_header_args );
 	}
 
-	if ( !is_admin() ) {
-		// Register buttons for the relevant component templates
+	// Register buttons for the relevant component templates
+	// Friends button
+	if ( bp_is_active( 'friends' ) )
+		add_action( 'bp_member_header_actions',    'bp_add_friend_button',           5 );
+
+	// Activity button
+	if ( bp_is_active( 'activity' ) )
+		add_action( 'bp_member_header_actions',    'bp_send_public_message_button',  20 );
+
+	// Messages button
+	if ( bp_is_active( 'messages' ) )
+		add_action( 'bp_member_header_actions',    'bp_send_private_message_button', 20 );
+
+	// Group buttons
+	if ( bp_is_active( 'groups' ) ) {
+		add_action( 'bp_group_header_actions',     'bp_group_join_button',           5 );
+		add_action( 'bp_group_header_actions',     'bp_group_new_topic_button',      20 );
+		add_action( 'bp_directory_groups_actions', 'bp_group_join_button' );
+	}
+
+	// Blog button
+	if ( bp_is_active( 'blogs' ) )
+		add_action( 'bp_directory_blogs_actions',  'bp_blogs_visit_blog_button' );
+}
+add_action( 'after_setup_theme', 'bp_dtheme_setup' );
+endif;
+
+/**
+ * Backward compatibility for a backpat problem introduced in BP 1.6 when AJAX callbacks were hooked to admin-ajax.php.
+ * 
+ * While handling AJAX via admin-ajax.php, is_admin() and DOING_AJAX are both true. BP-Default's registered the button
+ * actions in a block with an !is_admin() check, so the add_actions were ignored when we returned templates with buttons.
+ * This function is hooked to after_setup_theme with priority 11, so that it happens after bp_dtheme_setup() is run, and
+ * re-adds the button actions if they are missing.
+ * 
+ * @see bp_dtheme_setup()
+ * @since BuddyPress (1.7)
+ */
+function bp_dtheme_fix_buttons() {
+	if ( is_admin() && defined( 'DOING_AJAX' ) && DOING_AJAX ) {
+
 		// Friends button
-		if ( bp_is_active( 'friends' ) )
-			add_action( 'bp_member_header_actions',    'bp_add_friend_button',           5 );
+		if ( bp_is_active( 'friends' ) && ! has_action( 'bp_member_header_actions', 'bp_add_friend_button' ) && ! has_action( 'bp_member_header_actions', 'bp_add_friend_button' ) )
+			add_action( 'bp_member_header_actions', 'bp_add_friend_button', 5 );
 
 		// Activity button
-		if ( bp_is_active( 'activity' ) )
-			add_action( 'bp_member_header_actions',    'bp_send_public_message_button',  20 );
+		if ( bp_is_active( 'activity' ) && ! has_action( 'bp_member_header_actions', 'bp_send_public_message_button' ) )
+			add_action( 'bp_member_header_actions', 'bp_send_public_message_button', 20 );
 
 		// Messages button
-		if ( bp_is_active( 'messages' ) )
-			add_action( 'bp_member_header_actions',    'bp_send_private_message_button', 20 );
+		if ( bp_is_active( 'messages' ) && ! has_action( 'bp_member_header_actions', 'bp_send_private_message_button' ) )
+			add_action( 'bp_member_header_actions', 'bp_send_private_message_button', 20 );
 
 		// Group buttons
 		if ( bp_is_active( 'groups' ) ) {
-			add_action( 'bp_group_header_actions',     'bp_group_join_button',           5 );
-			add_action( 'bp_group_header_actions',     'bp_group_new_topic_button',      20 );
-			add_action( 'bp_directory_groups_actions', 'bp_group_join_button' );
-		}
 
-		// Blog button
-		if ( bp_is_active( 'blogs' ) )
-			add_action( 'bp_directory_blogs_actions',  'bp_blogs_visit_blog_button' );
+			if ( ! has_action( 'bp_group_header_actions', 'bp_group_join_button' ) )
+				add_action( 'bp_group_header_actions', 'bp_group_join_button', 5 );
+
+			if ( ! has_action( 'bp_group_header_actions', 'bp_group_new_topic_button' ) )
+				add_action( 'bp_group_header_actions', 'bp_group_new_topic_button', 20 );
+
+			if ( ! has_action( 'bp_directory_groups_actions', 'bp_group_join_button' ) )
+				add_action( 'bp_directory_groups_actions', 'bp_group_join_button' );
+		}
 	}
 }
-add_action( 'after_setup_theme', 'bp_dtheme_setup' );
-endif;
+add_action( 'after_setup_theme', 'bp_dtheme_fix_buttons', 11 );
 
 if ( !function_exists( 'bp_dtheme_enqueue_scripts' ) ) :
 /**
