Index: bp-friends.php
===================================================================
--- bp-friends.php	(revision 3295)
+++ bp-friends.php	(working copy)
@@ -102,27 +102,32 @@
 
 function friends_screen_notification_settings() {
 	global $current_user; ?>
-	<table class="notification-settings" id="friends-notification-settings">
-		<tr>
-			<th class="icon"></th>
-			<th class="title"><?php _e( 'Friends', 'buddypress' ) ?></th>
-			<th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
-			<th class="no"><?php _e( 'No', 'buddypress' )?></th>
-		</tr>
-		<tr>
-			<td></td>
-			<td><?php _e( 'A member sends you a friendship request', 'buddypress' ) ?></td>
-			<td class="yes"><input type="radio" name="notifications[notification_friends_friendship_request]" value="yes" <?php if ( !get_usermeta( $current_user->id,'notification_friends_friendship_request') || 'yes' == get_usermeta( $current_user->id,'notification_friends_friendship_request') ) { ?>checked="checked" <?php } ?>/></td>
-			<td class="no"><input type="radio" name="notifications[notification_friends_friendship_request]" value="no" <?php if ( get_usermeta( $current_user->id,'notification_friends_friendship_request') == 'no' ) { ?>checked="checked" <?php } ?>/></td>
-		</tr>
-		<tr>
-			<td></td>
-			<td><?php _e( 'A member accepts your friendship request', 'buddypress' ) ?></td>
-			<td class="yes"><input type="radio" name="notifications[notification_friends_friendship_accepted]" value="yes" <?php if ( !get_usermeta( $current_user->id,'notification_friends_friendship_accepted') || 'yes' == get_usermeta( $current_user->id,'notification_friends_friendship_accepted') ) { ?>checked="checked" <?php } ?>/></td>
-			<td class="no"><input type="radio" name="notifications[notification_friends_friendship_accepted]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id,'notification_friends_friendship_accepted') ) { ?>checked="checked" <?php } ?>/></td>
-		</tr>
+	<table class="notification-settings zebra" id="friends-notification-settings">
+		<thead>
+			<tr>
+				<th class="icon"></th>
+				<th class="title"><?php _e( 'Friends', 'buddypress' ) ?></th>
+				<th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
+				<th class="no"><?php _e( 'No', 'buddypress' )?></th>
+			</tr>
+		</thead>
 
-		<?php do_action( 'friends_screen_notification_settings' ); ?>
+		<tbody>
+			<tr>
+				<td></td>
+				<td><?php _e( 'A member sends you a friendship request', 'buddypress' ) ?></td>
+				<td class="yes"><input type="radio" name="notifications[notification_friends_friendship_request]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_friends_friendship_request', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_friends_friendship_request', true ) ) { ?>checked="checked" <?php } ?>/></td>
+				<td class="no"><input type="radio" name="notifications[notification_friends_friendship_request]" value="no" <?php if ( get_user_meta( $current_user->id, 'notification_friends_friendship_request', true ) == 'no' ) { ?>checked="checked" <?php } ?>/></td>
+			</tr>
+			<tr>
+				<td></td>
+				<td><?php _e( 'A member accepts your friendship request', 'buddypress' ) ?></td>
+				<td class="yes"><input type="radio" name="notifications[notification_friends_friendship_accepted]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_friends_friendship_accepted', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_friends_friendship_accepted', true ) ) { ?>checked="checked" <?php } ?>/></td>
+				<td class="no"><input type="radio" name="notifications[notification_friends_friendship_accepted]" value="no" <?php if ( 'no' == get_user_meta( $current_user->id, 'notification_friends_friendship_accepted', true ) ) { ?>checked="checked" <?php } ?>/></td>
+			</tr>
+
+			<?php do_action( 'friends_screen_notification_settings' ); ?>
+		</tbody>
 	</table>
 <?php
 }
@@ -236,7 +241,7 @@
 		'type' => false,
 		'item_id' => false,
 		'secondary_item_id' => false,
-		'recorded_time' => gmdate( "Y-m-d H:i:s" ),
+		'recorded_time' => bp_core_current_time(),
 		'hide_sitewide' => false
 	);
 
@@ -317,7 +322,7 @@
 	$friendship->friend_user_id = $friend_userid;
 	$friendship->is_confirmed = 0;
 	$friendship->is_limited = 0;
-	$friendship->date_created = time();
+	$friendship->date_created = bp_core_current_time();
 
 	if ( $force_accept )
 		$friendship->is_confirmed = 1;
@@ -371,33 +376,35 @@
 	if ( !$friendship->is_confirmed && BP_Friends_Friendship::accept( $friendship_id ) ) {
 		friends_update_friend_totals( $friendship->initiator_user_id, $friendship->friend_user_id );
 
-		/* Remove the friend request notice */
+		// Remove the friend request notice
 		bp_core_delete_notifications_for_user_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_request' );
 
-		/* Add a friend accepted notice for the initiating user */
+		// Add a friend accepted notice for the initiating user
 		bp_core_add_notification( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_accepted' );
 
 		$initiator_link = bp_core_get_userlink( $friendship->initiator_user_id );
 		$friend_link = bp_core_get_userlink( $friendship->friend_user_id );
 
-		/* Record in activity streams for the initiator */
+		// Record in activity streams for the initiator
 		friends_record_activity( array(
 			'user_id' => $friendship->initiator_user_id,
 			'type' => 'friendship_created',
 			'action' => apply_filters( 'friends_activity_friendship_accepted_action', sprintf( __( '%1$s and %2$s are now friends', 'buddypress' ), $initiator_link, $friend_link ), &$friendship ),
-			'item_id' => $friendship_id
+			'item_id' => $friendship_id,
+			'secondary_item_id' => $friendship->friend_user-id
 		) );
 
-		/* Record in activity streams for the friend */
+		// Record in activity streams for the friend
 		friends_record_activity( array(
 			'user_id' => $friendship->friend_user_id,
 			'type' => 'friendship_created',
 			'action' => apply_filters( 'friends_activity_friendship_accepted_action', sprintf( __( '%1$s and %2$s are now friends', 'buddypress' ), $friend_link, $initiator_link ), &$friendship ),
 			'item_id' => $friendship_id,
+			'secondary_item_id' => $friendship->initiator_user_id,
 			'hide_sitewide' => true /* We've already got the first entry site wide */
 		) );
 
-		/* Send the email notification */
+		// Send the email notification
 		require_once( BP_PLUGIN_DIR . '/bp-friends/bp-friends-notifications.php' );
 		friends_notification_accepted_request( $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id );
 
@@ -443,7 +450,7 @@
 		$user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
 
 	if ( !$count = wp_cache_get( 'bp_total_friend_count_' . $user_id, 'bp' ) ) {
-		$count = get_usermeta( $user_id, 'total_friend_count' );
+		$count = get_user_meta( $user_id, 'total_friend_count', true );
 		if ( empty( $count ) ) $count = 0;
 		wp_cache_set( 'bp_total_friend_count_' . $user_id, $count, 'bp' );
 	}
@@ -546,11 +553,11 @@
 
 function friends_update_friend_totals( $initiator_user_id, $friend_user_id, $status = 'add' ) {
 	if ( 'add' == $status ) {
-		update_usermeta( $initiator_user_id, 'total_friend_count', (int)get_usermeta( $initiator_user_id, 'total_friend_count' ) + 1 );
-		update_usermeta( $friend_user_id, 'total_friend_count', (int)get_usermeta( $friend_user_id, 'total_friend_count' ) + 1 );
+		update_user_meta( $initiator_user_id, 'total_friend_count', (int)get_user_meta( $initiator_user_id, 'total_friend_count', true ) + 1 );
+		update_user_meta( $friend_user_id, 'total_friend_count', (int)get_user_meta( $friend_user_id, 'total_friend_count', true ) + 1 );
 	} else {
-		update_usermeta( $initiator_user_id, 'total_friend_count', (int)get_usermeta( $initiator_user_id, 'total_friend_count' ) - 1 );
-		update_usermeta( $friend_user_id, 'total_friend_count', (int)get_usermeta( $friend_user_id, 'total_friend_count' ) - 1 );
+		update_user_meta( $initiator_user_id, 'total_friend_count', (int)get_user_meta( $initiator_user_id, 'total_friend_count', true ) - 1 );
+		update_user_meta( $friend_user_id, 'total_friend_count', (int)get_user_meta( $friend_user_id, 'total_friend_count', true ) - 1 );
 	}
 }
 
@@ -558,7 +565,7 @@
 	BP_Friends_Friendship::delete_all_for_user($user_id);
 
 	/* Remove usermeta */
-	delete_usermeta( $user_id, 'total_friend_count' );
+	delete_user_meta( $user_id, 'total_friend_count' );
 
 	/* Remove friendship requests FROM user */
 	bp_core_delete_notifications_from_user( $user_id, $bp->friends->id, 'friendship_request' );
Index: bp-activity.php
===================================================================
--- bp-activity.php	(revision 3295)
+++ bp-activity.php	(working copy)
@@ -4,12 +4,12 @@
 require ( BP_PLUGIN_DIR . '/bp-activity/bp-activity-filters.php' );
 
 function bp_activity_setup_globals() {
-	global $bp, $wpdb, $current_blog;
+	global $bp, $wpdb;
 
 	if ( !defined( 'BP_ACTIVITY_SLUG' ) )
 		define ( 'BP_ACTIVITY_SLUG', $bp->pages->activity->slug );
 
-	/* For internal identification */
+	// For internal identification
 	$bp->activity->id = 'activity';
 	$bp->activity->name = $bp->pages->activity->name;
 	$bp->activity->slug = BP_ACTIVITY_SLUG;
@@ -18,7 +18,7 @@
 	$bp->activity->table_name_meta = $wpdb->base_prefix . 'bp_activity_meta';
 	$bp->activity->format_notification_function = 'bp_activity_format_notifications';
 
-	/* Register this in the active components array */
+	// Register this in the active components array
 	$bp->active_components[$bp->activity->slug] = $bp->activity->id;
 
 	do_action( 'bp_activity_setup_globals' );
@@ -92,7 +92,7 @@
 	if ( !bp_is_active( 'friends' ) )
 		return false;
 
-	if ( !is_site_admin() )
+	if ( !is_super_admin() )
 		$bp->is_item_admin = false;
 
 	do_action( 'bp_activity_screen_friends' );
@@ -105,7 +105,7 @@
 	if ( !bp_is_active( 'groups' ) )
 		return false;
 
-	if ( !is_site_admin() )
+	if ( !is_super_admin() )
 		$bp->is_item_admin = false;
 
 	do_action( 'bp_activity_screen_groups' );
@@ -115,7 +115,7 @@
 function bp_activity_screen_favorites() {
 	global $bp;
 
-	if ( !is_site_admin() )
+	if ( !is_super_admin() )
 		$bp->is_item_admin = false;
 
 	do_action( 'bp_activity_screen_favorites' );
@@ -125,7 +125,7 @@
 function bp_activity_screen_mentions() {
 	global $bp;
 
-	if ( !is_site_admin() )
+	if ( !is_super_admin() )
 		$bp->is_item_admin = false;
 
 	do_action( 'bp_activity_screen_mentions' );
@@ -172,7 +172,7 @@
 		if ( is_user_logged_in() )
 			bp_core_redirect( $bp->loggedin_user->domain );
 		else
-			bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . clean_url( $bp->root_domain . '/' . $bp->activity->slug . '/p/' . $bp->current_action ) ) );
+			bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . esc_url( $bp->root_domain . '/' . $bp->activity->slug . '/p/' . $bp->current_action ) ) );
 	}
 
 	bp_core_load_template( apply_filters( 'bp_activity_template_profile_activity_permalink', 'members/single/activity/permalink' ) );
@@ -182,28 +182,32 @@
 
 function bp_activity_screen_notification_settings() {
 	global $bp; ?>
-	<table class="notification-settings" id="activity-notification-settings">
-		<tr>
-			<th class="icon"></th>
-			<th class="title"><?php _e( 'Activity', 'buddypress' ) ?></th>
-			<th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
-			<th class="no"><?php _e( 'No', 'buddypress' )?></th>
-		</tr>
+	<table class="notification-settings zebra" id="activity-notification-settings">
+		<thead>
+			<tr>
+				<th class="icon"></th>
+				<th class="title"><?php _e( 'Activity', 'buddypress' ) ?></th>
+				<th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
+				<th class="no"><?php _e( 'No', 'buddypress' )?></th>
+			</tr>
+		</thead>
 
-		<tr>
-			<td></td>
-			<td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( $bp->loggedin_user->id, $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login ) ) ?></td>
-			<td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php if ( !get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_mention' ) || 'yes' == get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_mention' ) ) { ?>checked="checked" <?php } ?>/></td>
-			<td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php if ( 'no' == get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_mention' ) ) { ?>checked="checked" <?php } ?>/></td>
-		</tr>
-		<tr>
-			<td></td>
-			<td><?php printf( __( "A member replies to an update or comment you've posted", 'buddypress' ), $current_user->user_login ) ?></td>
-			<td class="yes"><input type="radio" name="notifications[notification_activity_new_reply]" value="yes" <?php if ( !get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_reply' ) || 'yes' == get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_reply' ) ) { ?>checked="checked" <?php } ?>/></td>
-			<td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" value="no" <?php if ( 'no' == get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_reply' ) ) { ?>checked="checked" <?php } ?>/></td>
-		</tr>
+		<tbody>
+			<tr>
+				<td></td>
+				<td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( $bp->loggedin_user->id, $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login ) ) ?></td>
+				<td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php if ( !get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_mention', true ) || 'yes' == get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_mention', true ) ) { ?>checked="checked" <?php } ?>/></td>
+				<td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php if ( 'no' == get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_mention', true ) ) { ?>checked="checked" <?php } ?>/></td>
+			</tr>
+			<tr>
+				<td></td>
+				<td><?php printf( __( "A member replies to an update or comment you've posted", 'buddypress' ), $current_user->user_login ) ?></td>
+				<td class="yes"><input type="radio" name="notifications[notification_activity_new_reply]" value="yes" <?php if ( !get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_reply', true ) || 'yes' == get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_reply', true ) ) { ?>checked="checked" <?php } ?>/></td>
+				<td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" value="no" <?php if ( 'no' == get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_reply', true ) ) { ?>checked="checked" <?php } ?>/></td>
+			</tr>
 
-		<?php do_action( 'bp_activity_screen_notification_settings' ) ?>
+			<?php do_action( 'bp_activity_screen_notification_settings' ) ?>
+		</tbody>
 	</table>
 <?php
 }
@@ -270,7 +274,7 @@
 	$activity = new BP_Activity_Activity( $activity_id );
 
 	/* Check access */
-	if ( !is_site_admin() && $activity->user_id != $bp->loggedin_user->id )
+	if ( !is_super_admin() && $activity->user_id != $bp->loggedin_user->id )
 		return false;
 
 	/* Call the action before the delete so plugins can still fetch information about it */
@@ -540,23 +544,23 @@
 }
 
 function bp_activity_add( $args = '' ) {
-	global $bp, $wpdb;
+	global $bp;
 
 	$defaults = array(
-		'id' => false, // Pass an existing activity ID to update an existing entry.
+		'id'                => false, // Pass an existing activity ID to update an existing entry.
 
-		'action' => '', // The activity action - e.g. "Jon Doe posted an update"
-		'content' => '', // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!"
+		'action'            => '', // The activity action - e.g. "Jon Doe posted an update"
+		'content'           => '', // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!"
 
-		'component' => false, // The name/ID of the component e.g. groups, profile, mycomponent
-		'type' => false, // The activity type e.g. activity_update, profile_updated
-		'primary_link' => '', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)
+		'component'         => false, // The name/ID of the component e.g. groups, profile, mycomponent
+		'type'              => false, // The activity type e.g. activity_update, profile_updated
+		'primary_link'      => '', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)
 
-		'user_id' => $bp->loggedin_user->id, // Optional: The user to record the activity for, can be false if this activity is not for a user.
-		'item_id' => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id
+		'user_id'           => $bp->loggedin_user->id, // Optional: The user to record the activity for, can be false if this activity is not for a user.
+		'item_id'           => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id
 		'secondary_item_id' => false, // Optional: A second ID used to further filter e.g. a comment_id
-		'recorded_time' => gmdate( "Y-m-d H:i:s" ), // The GMT time that this activity was recorded
-		'hide_sitewide' => false // Should this be hidden on the sitewide activity stream?
+		'recorded_time'     => bp_core_current_time(), // The GMT time that this activity was recorded
+		'hide_sitewide'     => false // Should this be hidden on the sitewide activity stream?
 	);
 
 	$params = wp_parse_args( $args, $defaults );
@@ -627,7 +631,7 @@
 	) );
 
 	/* Add this update to the "latest update" usermeta so it can be fetched anywhere. */
-	update_usermeta( $bp->loggedin_user->id, 'bp_latest_update', array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) );
+	update_user_meta( $bp->loggedin_user->id, 'bp_latest_update', array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) );
 
  	/* Require the notifications code so email notifications can be set on the 'bp_activity_posted_update' action. */
 	require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-notifications.php' );
@@ -754,10 +758,10 @@
 	else
 		$user_id = $args['user_id'];
 
-	$latest_update = get_usermeta( $user_id, 'bp_latest_update' );
+	$latest_update = get_user_meta( $user_id, 'bp_latest_update', true );
 	if ( !empty( $latest_update ) ) {
 		if ( in_array( (int)$latest_update['id'], (array)$activity_ids_deleted ) )
-			delete_usermeta( $user_id, 'bp_latest_update' );
+			delete_user_meta( $user_id, 'bp_latest_update' );
 	}
 
 	do_action( 'bp_activity_delete', $args );
@@ -908,14 +912,14 @@
 }
 
 function bp_activity_get_user_favorites( $user_id ) {
-	$my_favs = maybe_unserialize( get_usermeta( $user_id, 'bp_favorite_activities' ) );
+	$my_favs = maybe_unserialize( get_user_meta( $user_id, 'bp_favorite_activities', true ) );
 	$existing_favs = bp_activity_get_specific( array( 'activity_ids' => $my_favs ) );
 
 	foreach( (array)$existing_favs['activities'] as $fav )
 		$new_favs[] = $fav->id;
 
 	$new_favs = array_unique( (array)$new_favs );
-	update_usermeta( $user_id, 'bp_favorite_activities', $new_favs );
+	update_user_meta( $user_id, 'bp_favorite_activities', $new_favs );
 
 	return apply_filters( 'bp_activity_get_user_favorites', $new_favs );
 }
@@ -927,7 +931,7 @@
 		$user_id = $bp->loggedin_user->id;
 
 	/* Update the user's personal favorites */
-	$my_favs = maybe_unserialize( get_usermeta( $bp->loggedin_user->id, 'bp_favorite_activities' ) );
+	$my_favs = maybe_unserialize( get_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', true ) );
 	$my_favs[] = $activity_id;
 
 	/* Update the total number of users who have favorited this activity */
@@ -938,7 +942,7 @@
 	else
 		$fav_count = 1;
 
-	update_usermeta( $bp->loggedin_user->id, 'bp_favorite_activities', $my_favs );
+	update_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', $my_favs );
 	bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count );
 
 	do_action( 'bp_activity_add_user_favorite', $activity_id, $user_id );
@@ -953,7 +957,7 @@
 		$user_id = $bp->loggedin_user->id;
 
 	/* Remove the fav from the user's favs */
-	$my_favs = maybe_unserialize( get_usermeta( $user_id, 'bp_favorite_activities' ) );
+	$my_favs = maybe_unserialize( get_user_meta( $user_id, 'bp_favorite_activities', true ) );
 	$my_favs = array_flip( (array) $my_favs );
 	unset( $my_favs[$activity_id] );
 	$my_favs = array_unique( array_flip( $my_favs ) );
@@ -966,7 +970,7 @@
 		bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count );
 	}
 
-	update_usermeta( $user_id, 'bp_favorite_activities', $my_favs );
+	update_user_meta( $user_id, 'bp_favorite_activities', $my_favs );
 
 	do_action( 'bp_activity_remove_user_favorite', $activity_id, $user_id );
 
@@ -1088,8 +1092,8 @@
 	bp_activity_delete( array( 'user_id' => $user_id ) );
 
 	// Remove any usermeta
-	delete_usermeta( $user_id, 'bp_latest_update' );
-	delete_usermeta( $user_id, 'bp_favorite_activities' );
+	delete_user_meta( $user_id, 'bp_latest_update' );
+	delete_user_meta( $user_id, 'bp_favorite_activities' );
 
 	do_action( 'bp_activity_remove_data', $user_id );
 }
@@ -1097,7 +1101,22 @@
 add_action( 'delete_user', 'bp_activity_remove_data' );
 add_action( 'make_spam_user', 'bp_activity_remove_data' );
 
+/**
+ * updates_register_activity_actions()
+ * 
+ * Register the activity stream actions for updates
+ * 
+ * @global array $bp
+ */
+function updates_register_activity_actions() {
+	global $bp;
 
+	bp_activity_set_action( $bp->activity->id, 'activity_update', __( 'Posted an update', 'buddypress' ) );
+
+	do_action( 'updates_register_activity_actions' );
+}
+add_action( 'bp_register_activity_actions', 'updates_register_activity_actions' );
+
 /********************************************************************************
  * Custom Actions
  *
@@ -1109,7 +1128,7 @@
 function bp_register_activity_actions() {
 	do_action( 'bp_register_activity_actions' );
 }
-add_action( 'plugins_loaded', 'bp_register_activity_actions' );
+add_action( 'bp_loaded', 'bp_register_activity_actions', 8 );
 
 
 ?>
\ No newline at end of file
Index: bp-themes/bp-default/groups/single/activity.php
===================================================================
--- bp-themes/bp-default/groups/single/activity.php	(revision 3295)
+++ bp-themes/bp-default/groups/single/activity.php	(working copy)
@@ -1,6 +1,6 @@
 <div class="item-list-tabs no-ajax" id="subnav">
 	<ul>
-		<li class="feed"><a href="<?php bp_group_activity_feed_link() ?>" title="RSS Feed"><?php _e( 'RSS', 'buddypress' ) ?></a></li>
+		<li class="feed"><a href="<?php bp_group_activity_feed_link() ?>" title="<?php _e( 'RSS Feed', 'buddypress' ); ?>"><?php _e( 'RSS', 'buddypress' ) ?></a></li>
 
 		<?php do_action( 'bp_group_activity_syndication_options' ) ?>
 
Index: bp-themes/bp-default/groups/single/request-membership.php
===================================================================
--- bp-themes/bp-default/groups/single/request-membership.php	(revision 3295)
+++ bp-themes/bp-default/groups/single/request-membership.php	(working copy)
@@ -1,7 +1,7 @@
 <?php do_action( 'bp_before_group_request_membership_content' ) ?>
 
 <?php if ( !bp_group_has_requested_membership() ) : ?>
-	<p><?php printf( __( "You are requesting to become a member of the group '%s'.", "buddypress" ), bp_group_name( false, false ) ); ?></p>
+	<p><?php printf( __( "You are requesting to become a member of the group '%s'.", "buddypress" ), bp_get_group_name( false ) ); ?></p>
 
 	<form action="<?php bp_group_form_action('request-membership') ?>" method="post" name="request-membership-form" id="request-membership-form" class="standard-form">
 		<label for="group-request-membership-comments"><?php _e( 'Comments (optional)', 'buddypress' ); ?></label>
Index: bp-themes/bp-default/groups/single/forum/topic.php
===================================================================
--- bp-themes/bp-default/groups/single/forum/topic.php	(revision 3295)
+++ bp-themes/bp-default/groups/single/forum/topic.php	(working copy)
@@ -18,9 +18,13 @@
 			<h3><?php bp_the_topic_title() ?> (<?php bp_the_topic_total_post_count() ?>)</h3>
 			<a class="button" href="<?php bp_forum_permalink() ?>/">&larr; <?php _e( 'Group Forum', 'buddypress' ) ?></a> &nbsp; <a class="button" href="<?php bp_forum_directory_permalink() ?>/"><?php _e( 'Group Forum Directory', 'buddypress') ?></a></span>
 
-			<?php if ( bp_group_is_admin() || bp_group_is_mod() || bp_get_the_topic_is_mine() ) : ?>
-				<div class="admin-links"><?php bp_the_topic_admin_links() ?></div>
-			<?php endif; ?>
+			<div class="admin-links">
+				<?php if ( bp_group_is_admin() || bp_group_is_mod() || bp_get_the_topic_is_mine() ) : ?>
+					<?php bp_the_topic_admin_links() ?>
+				<?php endif; ?>
+
+				<?php do_action( 'bp_group_forum_topic_meta' ); ?>
+			</div>
 		</div>
 
 		<ul id="topic-post-list" class="item-list">
@@ -42,6 +46,9 @@
 						<?php if ( bp_group_is_admin() || bp_group_is_mod() || bp_get_the_topic_post_is_mine() ) : ?>
 							<?php bp_the_topic_post_admin_links() ?>
 						<?php endif; ?>
+
+						<?php do_action( 'bp_group_forum_post_meta' ); ?>
+
 						<a href="#post-<?php bp_the_topic_post_id() ?>" title="<?php _e( 'Permanent link to this post', 'buddypress' ) ?>">#</a>
 					</div>
 				</li>
@@ -70,7 +77,7 @@
 					<div id="post-topic-reply">
 						<p id="post-reply"></p>
 
-						<?php if ( !bp_group_is_member() ) : ?>
+						<?php if ( bp_groups_auto_join() && !bp_group_is_member() ) : ?>
 							<p><?php _e( 'You will auto join this group when you reply to this topic.', 'buddypress' ) ?></p>
 						<?php endif; ?>
 
Index: bp-themes/bp-default/groups/single/group-header.php
===================================================================
--- bp-themes/bp-default/groups/single/group-header.php	(revision 3295)
+++ bp-themes/bp-default/groups/single/group-header.php	(working copy)
@@ -35,6 +35,12 @@
 	<div id="item-meta">
 		<?php bp_group_description() ?>
 
+		<?php if ( bp_is_group_forum() && is_user_logged_in() && !bp_is_group_forum_topic() ) : ?>
+			<div class="generic-button group-button">
+				<a href="#post-new" class=""><?php _e( 'New Topic', 'buddypress' ) ?></a>
+			</div>
+		<?php endif; ?>
+
 		<?php bp_group_join_button() ?>
 
 		<?php do_action( 'bp_group_header_meta' ) ?>
Index: bp-themes/bp-default/groups/single/admin.php
===================================================================
--- bp-themes/bp-default/groups/single/admin.php	(revision 3295)
+++ bp-themes/bp-default/groups/single/admin.php	(working copy)
@@ -194,24 +194,36 @@
 			<ul id="members-list" class="item-list single-line">
 				<?php while ( bp_group_members() ) : bp_group_the_member(); ?>
 
-					<?php if ( bp_get_group_member_is_banned() ) : ?>
+					<li class="<?php bp_group_member_css_class(); ?>">
+						<?php bp_group_member_avatar_mini() ?>
 
-						<li class="banned-user">
-							<?php bp_group_member_avatar_mini() ?>
+						<h5>
+							<?php bp_group_member_link() ?>
+							
+							<?php if ( bp_get_group_member_is_banned() ) _e( '(banned)', 'buddypress'); ?>
 
-							<h5><?php bp_group_member_link() ?> <?php _e( '(banned)', 'buddypress') ?> <span class="small"> - <a href="<?php bp_group_member_unban_link() ?>" class="confirm" title="<?php _e( 'Kick and ban this member', 'buddypress' ) ?>"><?php _e( 'Remove Ban', 'buddypress' ); ?></a> </h5>
+							<span class="small"> - 
+							
+							<?php if ( bp_get_group_member_is_banned() ) : ?>
+								
+								<a href="<?php bp_group_member_unban_link() ?>" class="confirm" title="<?php _e( 'Unban this member', 'buddypress' ) ?>"><?php _e( 'Remove Ban', 'buddypress' ); ?></a>
 
-					<?php else : ?>
+							<?php else : ?>
 
-						<li>
-							<?php bp_group_member_avatar_mini() ?>
-							<h5><?php bp_group_member_link() ?>  <span class="small"> - <a href="<?php bp_group_member_ban_link() ?>" class="confirm" title="<?php _e( 'Kick and ban this member', 'buddypress' ); ?>"><?php _e( 'Kick &amp; Ban', 'buddypress' ); ?></a> | <a href="<?php bp_group_member_promote_mod_link() ?>" class="confirm" title="<?php _e( 'Promote to Mod', 'buddypress' ); ?>"><?php _e( 'Promote to Mod', 'buddypress' ); ?></a> | <a href="<?php bp_group_member_promote_admin_link() ?>" class="confirm" title="<?php _e( 'Promote to Admin', 'buddypress' ); ?>"><?php _e( 'Promote to Admin', 'buddypress' ); ?></a></span></h5>
+								<a href="<?php bp_group_member_ban_link() ?>" class="confirm" title="<?php _e( 'Kick and ban this member', 'buddypress' ); ?>"><?php _e( 'Kick &amp; Ban', 'buddypress' ); ?></a>
+								| <a href="<?php bp_group_member_promote_mod_link() ?>" class="confirm" title="<?php _e( 'Promote to Mod', 'buddypress' ); ?>"><?php _e( 'Promote to Mod', 'buddypress' ); ?></a>
+								| <a href="<?php bp_group_member_promote_admin_link() ?>" class="confirm" title="<?php _e( 'Promote to Admin', 'buddypress' ); ?>"><?php _e( 'Promote to Admin', 'buddypress' ); ?></a>
 
-					<?php endif; ?>
+							<?php endif; ?>
 
-							<?php do_action( 'bp_group_manage_members_admin_item' ); ?>
-						</li>
+								| <a href="<?php bp_group_member_remove_link() ?>" class="confirm" title="<?php _e( 'Remove this member', 'buddypress' ); ?>"><?php _e( 'Remove from group', 'buddypress' ); ?></a>
 
+								<?php do_action( 'bp_group_manage_members_admin_item' ); ?>
+
+							</span>
+						</h5>
+					</li>
+
 				<?php endwhile; ?>
 			</ul>
 
Index: bp-themes/bp-default/groups/single/forum.php
===================================================================
--- bp-themes/bp-default/groups/single/forum.php	(revision 3295)
+++ bp-themes/bp-default/groups/single/forum.php	(working copy)
@@ -21,7 +21,7 @@
 
 				<?php do_action( 'bp_before_group_forum_post_new' ) ?>
 
-				<?php if ( !bp_group_is_member() ) : ?>
+				<?php if ( bp_groups_auto_join() && !bp_group_is_member() ) : ?>
 					<p><?php _e( 'You will auto join this group when you start a new topic.', 'buddypress' ) ?></p>
 				<?php endif; ?>
 
Index: bp-themes/bp-default/groups/create.php
===================================================================
--- bp-themes/bp-default/groups/create.php	(revision 3295)
+++ bp-themes/bp-default/groups/create.php	(working copy)
@@ -52,7 +52,7 @@
 								<label><input type="checkbox" name="group-show-forum" id="group-show-forum" value="1"<?php if ( bp_get_new_group_enable_forum() ) { ?> checked="checked"<?php } ?> /> <?php _e('Enable discussion forum', 'buddypress') ?></label>
 							</div>
 						<?php else : ?>
-							<?php if ( is_site_admin() ) : ?>
+							<?php if ( is_super_admin() ) : ?>
 								<div class="checkbox">
 									<label><input type="checkbox" disabled="disabled" name="disabled" id="disabled" value="0" /> <?php printf( __('<strong>Attention Site Admin:</strong> Group forums require the <a href="%s">correct setup and configuration</a> of a bbPress installation.', 'buddypress' ), bp_get_root_domain() . '/wp-admin/admin.php?page=bb-forums-setup' ) ?></label>
 								</div>
Index: bp-themes/bp-default/groups/groups-loop.php
===================================================================
--- bp-themes/bp-default/groups/groups-loop.php	(revision 3295)
+++ bp-themes/bp-default/groups/groups-loop.php	(working copy)
@@ -4,18 +4,20 @@
 
 <?php if ( bp_has_groups( bp_ajax_querystring( 'groups' ) ) ) : ?>
 
-	<div class="pagination">
+	<div id="pag-top" class="pagination">
 
-		<div class="pag-count" id="group-dir-count">
+		<div class="pag-count" id="group-dir-count-top">
 			<?php bp_groups_pagination_count() ?>
 		</div>
 
-		<div class="pagination-links" id="group-dir-pag">
+		<div class="pagination-links" id="group-dir-pag-top">
 			<?php bp_groups_pagination_links() ?>
 		</div>
 
 	</div>
 
+	<?php do_action( 'bp_before_directory_groups_list' ) ?>
+
 	<ul id="groups-list" class="item-list">
 	<?php while ( bp_groups() ) : bp_the_group(); ?>
 
@@ -52,8 +54,20 @@
 	<?php endwhile; ?>
 	</ul>
 
-	<?php do_action( 'bp_after_groups_loop' ) ?>
-
+ 	<?php do_action( 'bp_after_directory_groups_list' ) ?>
+  
+ 	<div id="pag-bottom" class="pagination">
+ 
+ 		<div class="pag-count" id="group-dir-count-bottom">
+ 			<?php bp_groups_pagination_count() ?>
+ 		</div>
+ 
+ 		<div class="pagination-links" id="group-dir-pag-bottom">
+ 			<?php bp_groups_pagination_links() ?>
+ 		</div>
+ 
+ 	</div>
+ 
 <?php else: ?>
 
 	<div id="message" class="info">
Index: bp-themes/bp-default/footer.php
===================================================================
--- bp-themes/bp-default/footer.php	(revision 3295)
+++ bp-themes/bp-default/footer.php	(working copy)
@@ -4,7 +4,7 @@
 		<?php do_action( 'bp_before_footer' ) ?>
 
 		<div id="footer">
-	    	<p><?php printf( __( '%s is proudly powered by <a href="http://wordpress.org">WordPress</a> and <a href="http://buddypress.org">BuddyPress</a>', 'buddypress' ), bloginfo('name') ); ?></p>
+	    	<p><?php printf( __( '%s is proudly powered by <a href="http://wordpress.org">WordPress</a> and <a href="http://buddypress.org">BuddyPress</a>', 'buddypress' ), get_bloginfo( 'name' ) ); ?></p>
 
 			<?php do_action( 'bp_footer' ) ?>
 		</div><!-- #footer -->
Index: bp-themes/bp-default/members/single/profile/profile-loop.php
===================================================================
--- bp-themes/bp-default/members/single/profile/profile-loop.php	(revision 3295)
+++ bp-themes/bp-default/members/single/profile/profile-loop.php	(working copy)
@@ -15,7 +15,7 @@
 						<h4><?php bp_the_profile_group_name() ?></h4>
 					<?php endif; ?>
 
-					<table class="profile-fields">
+					<table class="profile-fields zebra">
 						<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
 
 							<?php if ( bp_field_has_data() ) : ?>
Index: bp-themes/bp-default/members/single/groups.php
===================================================================
--- bp-themes/bp-default/members/single/groups.php	(revision 3295)
+++ bp-themes/bp-default/members/single/groups.php	(working copy)
@@ -8,7 +8,7 @@
 		<li id="groups-order-select" class="last filter">
 
 			<?php _e( 'Order By:', 'buddypress' ) ?>
-			<select id="groups-all">
+			<select id="groups-sort-by">
 				<option value="active"><?php _e( 'Last Active', 'buddypress' ) ?></option>
 				<option value="popular"><?php _e( 'Most Members', 'buddypress' ) ?></option>
 				<option value="newest"><?php _e( 'Newly Created', 'buddypress' ) ?></option>
Index: bp-themes/bp-default/members/single/messages/notices-loop.php
===================================================================
--- bp-themes/bp-default/members/single/messages/notices-loop.php	(revision 3295)
+++ bp-themes/bp-default/members/single/messages/notices-loop.php	(working copy)
@@ -17,7 +17,7 @@
 	<?php do_action( 'bp_after_notices_pagination' ) ?>
 	<?php do_action( 'bp_before_notices' ) ?>
 
-	<table id="message-threads">
+	<table id="message-threads" class="zebra">
 		<?php while ( bp_message_threads() ) : bp_message_thread(); ?>
 			<tr>
 				<td width="1%">
Index: bp-themes/bp-default/members/single/messages/messages-loop.php
===================================================================
--- bp-themes/bp-default/members/single/messages/messages-loop.php	(revision 3295)
+++ bp-themes/bp-default/members/single/messages/messages-loop.php	(working copy)
@@ -17,7 +17,7 @@
 	<?php do_action( 'bp_after_member_messages_pagination' ) ?>
 	<?php do_action( 'bp_before_member_messages_threads' ) ?>
 
-	<table id="message-threads">
+	<table id="message-threads" class="zebra">
 		<?php while ( bp_message_threads() ) : bp_message_thread(); ?>
 
 			<tr id="m-<?php bp_message_thread_id() ?>"<?php if ( bp_message_thread_has_unread() ) : ?> class="unread"<?php else: ?> class="read"<?php endif; ?>>
Index: bp-themes/bp-default/members/single/messages/compose.php
===================================================================
--- bp-themes/bp-default/members/single/messages/compose.php	(revision 3295)
+++ bp-themes/bp-default/members/single/messages/compose.php	(working copy)
@@ -10,7 +10,7 @@
 		</li>
 	</ul>
 
-	<?php if ( is_site_admin() ) : ?>
+	<?php if ( is_super_admin() ) : ?>
 		<input type="checkbox" id="send-notice" name="send-notice" value="1" /> <?php _e( "This is a notice to all users.", "buddypress" ) ?>
 	<?php endif; ?>
 
Index: bp-themes/bp-default/members/members-loop.php
===================================================================
--- bp-themes/bp-default/members/members-loop.php	(revision 3295)
+++ bp-themes/bp-default/members/members-loop.php	(working copy)
@@ -4,13 +4,13 @@
 
 <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>
 
-	<div class="pagination">
+	<div id="pag-top" class="pagination">
 
-		<div class="pag-count" id="member-dir-count">
+		<div class="pag-count" id="member-dir-count-top">
 			<?php bp_members_pagination_count() ?>
 		</div>
 
-		<div class="pagination-links" id="member-dir-pag">
+		<div class="pagination-links" id="member-dir-pag-top">
 			<?php bp_members_pagination_links() ?>
 		</div>
 
@@ -69,6 +69,18 @@
 
 	<?php bp_member_hidden_fields() ?>
 
+	<div id="pag-bottom" class="pagination">
+
+		<div class="pag-count" id="member-dir-count-bottom">
+			<?php bp_members_pagination_count() ?>
+		</div>
+
+		<div class="pagination-links" id="member-dir-pag-bottom">
+			<?php bp_members_pagination_links() ?>
+		</div>
+
+	</div>
+
 <?php else: ?>
 
 	<div id="message" class="info">
Index: bp-themes/bp-default/search.php
===================================================================
--- bp-themes/bp-default/search.php	(revision 3295)
+++ bp-themes/bp-default/search.php	(working copy)
@@ -32,7 +32,7 @@
 						<div class="post-content">
 							<h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'buddypress' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
 
-							<p class="date"><?php the_time('F j, Y') ?> <em><?php _e( 'in', 'buddypress' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></em></p>
+							<p class="date"><?php the_time() ?> <em><?php _e( 'in', 'buddypress' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></em></p>
 
 							<div class="entry">
 								<?php the_content( __( 'Read the rest of this entry &rarr;', 'buddypress' ) ); ?>
Index: bp-themes/bp-default/activity/index.php
===================================================================
--- bp-themes/bp-default/activity/index.php	(revision 3295)
+++ bp-themes/bp-default/activity/index.php	(working copy)
@@ -57,7 +57,7 @@
 
 			<div class="item-list-tabs no-ajax" id="subnav">
 				<ul>
-					<li class="feed"><a href="<?php bp_sitewide_activity_feed_link() ?>" title="RSS Feed"><?php _e( 'RSS', 'buddypress' ) ?></a></li>
+					<li class="feed"><a href="<?php bp_sitewide_activity_feed_link() ?>" title="<?php _e( 'RSS Feed', 'buddypress' ); ?>"><?php _e( 'RSS', 'buddypress' ) ?></a></li>
 
 					<?php do_action( 'bp_activity_syndication_options' ) ?>
 
Index: bp-themes/bp-default/index.php
===================================================================
--- bp-themes/bp-default/index.php	(revision 3295)
+++ bp-themes/bp-default/index.php	(working copy)
@@ -23,7 +23,7 @@
 						<div class="post-content">
 							<h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'buddypress' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
 
-							<p class="date"><?php the_time('F j, Y') ?> <em><?php _e( 'in', 'buddypress' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></em></p>
+							<p class="date"><?php the_time() ?> <em><?php _e( 'in', 'buddypress' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></em></p>
 
 							<div class="entry">
 								<?php the_content( __( 'Read the rest of this entry &rarr;', 'buddypress' ) ); ?>
Index: bp-themes/bp-default/functions.php
===================================================================
--- bp-themes/bp-default/functions.php	(revision 3295)
+++ bp-themes/bp-default/functions.php	(working copy)
@@ -1,33 +1,60 @@
 <?php
 
-/* Stop the theme from killing WordPress if BuddyPress is not enabled. */
+// Stop the theme from killing WordPress if BuddyPress is not enabled.
 if ( !class_exists( 'BP_Core_User' ) )
 	return false;
 
-/* Register the widget columns */
+// Register the widget columns
 register_sidebars( 1,
 	array(
-		'name' => 'Sidebar',
+		'name'          => 'Sidebar',
 		'before_widget' => '<div id="%1$s" class="widget %2$s">',
-		'after_widget' => '</div>',
-		'before_title' => '<h3 class="widgettitle">',
-		'after_title' => '</h3>'
+		'after_widget'  => '</div>',
+		'before_title'  => '<h3 class="widgettitle">',
+		'after_title'   => '</h3>'
 	)
 );
 
-/* Load the AJAX functions for the theme */
+// Load the AJAX functions for the theme
 require_once( TEMPLATEPATH . '/_inc/ajax.php' );
 
-/* Load the javascript for the theme */
+// Load the javascript for the theme
 wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) );
 
-/* Add the JS needed for blog comment replies */
+// Add words that we need to use in JS to the end of the page so they can be translated and still used.
+$params = array(
+	'my_favs'           => __( 'My Favorites', 'buddypress' ),
+	'accepted'          => __( 'Accepted', 'buddypress' ),
+	'rejected'          => __( 'Rejected', 'buddypress' ),
+	'show_all_comments' => __( 'Show all comments for this thread', 'buddypress' ),
+	'show_all'          => __( 'Show all', 'buddypress' ),
+	'comments'          => __( 'comments', 'buddypress' ),
+	'close'             => __( 'Close', 'buddypress' ),
+	'mention_explain'   => sprintf( __( "%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", 'buddypress' ), '@' . bp_get_displayed_user_username(), bp_get_user_firstname( bp_get_displayed_user_fullname() ), bp_get_user_firstname( bp_get_displayed_user_fullname() ) )
+);
+wp_localize_script( 'dtheme-ajax-js', 'BP_DTheme', $params );
+
+/**
+ * Add the JS needed for blog comment replies
+ *
+ * @package BuddyPress Theme
+ * @since 1.2
+ */
 function bp_dtheme_add_blog_comments_js() {
 	if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
 }
 add_action( 'template_redirect', 'bp_dtheme_add_blog_comments_js' );
 
-/* HTML for outputting blog comments as defined by the WP comment API */
+/**
+ * HTML for outputting blog comments as defined by the WP comment API
+ *
+ * @param mixed $comment Comment record from database
+ * @param array $args Arguments from wp_list_comments() call
+ * @param int $depth Comment nesting level
+ * @see wp_list_comments()
+ * @package BuddyPress Theme
+ * @since 1.2
+ */
 function bp_dtheme_blog_comments( $comment, $args, $depth ) {
 	$GLOBALS['comment'] = $comment; ?>
 
@@ -65,11 +92,18 @@
 			</div>
 
 		</div>
-	</li>
 <?php
 }
 
-/* Filter the dropdown for selecting the page to show on front to include "Activity Stream" */
+/**
+ * Filter the dropdown for selecting the page to show on front to include "Activity Stream"
+ *
+ * @param string $page_html A list of pages as a dropdown (select list)
+ * @see wp_dropdown_pages()
+ * @return string
+ * @package BuddyPress Theme
+ * @since 1.2
+ */
 function bp_dtheme_wp_pages_filter( $page_html ) {
 	if ( 'page_on_front' != substr( $page_html, 14, 13 ) )
 		return $page_html;
@@ -85,9 +119,17 @@
 }
 add_filter( 'wp_dropdown_pages', 'bp_dtheme_wp_pages_filter' );
 
-/* Hijack the saving of page on front setting to save the activity stream setting */
+/**
+ * Hijack the saving of page on front setting to save the activity stream setting
+ *
+ * @param $string $oldvalue Previous value of get_option( 'page_on_front' )
+ * @param $string $oldvalue New value of get_option( 'page_on_front' )
+ * @return string
+ * @package BuddyPress Theme
+ * @since 1.2
+ */
 function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) {
-	if ( !is_admin() || !is_site_admin() )
+	if ( !is_admin() || !is_super_admin() )
 		return false;
 
 	if ( 'activity' == $_POST['page_on_front'] )
@@ -97,7 +139,15 @@
 }
 add_action( 'pre_update_option_page_on_front', 'bp_dtheme_page_on_front_update', 10, 2 );
 
-/* Load the activity stream template if settings allow */
+/**
+ * Load the activity stream template if settings allow
+ *
+ * @param string $template Absolute path to the page template 
+ * @return string
+ * @global WP_Query $wp_query WordPress query object
+ * @package BuddyPress Theme
+ * @since 1.2
+ */
 function bp_dtheme_page_on_front_template( $template ) {
 	global $wp_query;
 
@@ -108,7 +158,13 @@
 }
 add_filter( 'page_template', 'bp_dtheme_page_on_front_template' );
 
-/* Return the ID of a page set as the home page. */
+/**
+ * Return the ID of a page set as the home page.
+ *
+ * @return false|int ID of page set as the home page
+ * @package BuddyPress Theme
+ * @since 1.2
+ */
 function bp_dtheme_page_on_front() {
 	if ( 'page' != get_option( 'show_on_front' ) )
 		return false;
@@ -116,7 +172,13 @@
 	return apply_filters( 'bp_dtheme_page_on_front', get_option( 'page_on_front' ) );
 }
 
-/* Force the page ID as a string to stop the get_posts query from kicking up a fuss. */
+/**
+ * Force the page ID as a string to stop the get_posts query from kicking up a fuss.
+ *
+ * @global WP_Query $wp_query WordPress query object
+ * @package BuddyPress Theme
+ * @since 1.2
+ */
 function bp_dtheme_fix_get_posts_on_activity_front() {
 	global $wp_query;
 
@@ -125,12 +187,62 @@
 }
 add_action( 'pre_get_posts', 'bp_dtheme_fix_get_posts_on_activity_front' );
 
-/****
+/**
+ * WP 3.0 requires there to be a non-null post in the posts array
+ *
+ * @param array $posts Posts as retrieved by WP_Query
+ * @global WP_Query $wp_query WordPress query object
+ * @return array
+ * @package BuddyPress Theme
+ * @since 1.2.5
+ */
+function bp_dtheme_fix_the_posts_on_activity_front( $posts ) {
+	global $wp_query;
+
+	// NOTE: the double quotes around '"activity"' are thanks to our previous function bp_dtheme_fix_get_posts_on_activity_front()
+	if ( empty( $posts ) && !empty( $wp_query->query_vars['page_id'] ) && '"activity"' == $wp_query->query_vars['page_id'] )
+		$posts = array( (object) array( 'ID' => 'activity' ) );
+
+	return $posts;
+}
+add_filter( 'the_posts', 'bp_dtheme_fix_the_posts_on_activity_front' );
+
+/**
+ * Add secondary avatar image to this activity stream's record, if supported
+ *
+ * @param string $action The text of this activity
+ * @param BP_Activity_Activity $activity Activity object
+ * @return string
+ * @package BuddyPress Theme
+ * @since 1.2.6
+ */
+function bp_dtheme_activity_secondary_avatars( $action, $activity ) {
+	switch ( $activity->component ) {
+		case 'groups' :
+		case 'blogs' :
+		case 'friends' :
+			// Only insert avatar if one exists
+			if ( $secondary_avatar = bp_get_activity_secondary_avatar() ) {
+				$reverse_content = strrev( $action );
+				$position        = strpos( $reverse_content, 'a<' );
+				$action          = substr_replace( $action, $secondary_avatar, -$position - 2, 0 );
+			}
+			break;
+	}
+
+	return $action;
+}
+add_filter( 'bp_get_activity_action_pre_meta', 'bp_dtheme_activity_secondary_avatars', 10, 2 );
+
+/**
  * Custom header image support. You can remove this entirely in a child theme by adding this line
  * to your functions.php: define( 'BP_DTHEME_DISABLE_CUSTOM_HEADER', true );
+ *
+ * @package BuddyPress Theme
+ * @since 1.2
  */
 function bp_dtheme_add_custom_header_support() {
-	/* Set the defaults for the custom header image (http://ryan.boren.me/2007/01/07/custom-image-header-api/) */
+	// Set the defaults for the custom header image (http://ryan.boren.me/2007/01/07/custom-image-header-api/)
 	define( 'HEADER_TEXTCOLOR', 'FFFFFF' );
 	define( 'HEADER_IMAGE', '%s/_inc/images/default_header.jpg' ); // %s is theme dir uri
 	define( 'HEADER_IMAGE_WIDTH', 1250 );
@@ -202,7 +314,12 @@
 if ( !defined( 'BP_DTHEME_DISABLE_CUSTOM_HEADER' ) )
 	add_action( 'init', 'bp_dtheme_add_custom_header_support' );
 
-/* Show a notice when the theme is activated - workaround by Ozh (http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html) */
+/**
+ * Show a notice when the theme is activated - workaround by Ozh (http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html)
+ *
+ * @package BuddyPress Theme
+ * @since 1.2
+ */
 function bp_dtheme_show_notice() { ?>
 	<div id="message" class="updated fade">
 		<p><?php printf( __( 'Theme activated! This theme contains <a href="%s">custom header image</a> support and <a href="%s">sidebar widgets</a>.', 'buddypress' ), admin_url( 'themes.php?page=custom-header' ), admin_url( 'widgets.php' ) ) ?></p>
@@ -214,22 +331,6 @@
 if ( is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" )
 	add_action( 'admin_notices', 'bp_dtheme_show_notice' );
 
-/* Add words that we need to use in JS to the end of the page so they can be translated and still used. */
-function bp_dtheme_js_terms() { ?>
-<script type="text/javascript">
-	var bp_terms_my_favs = '<?php _e( "My Favorites", "buddypress" ) ?>';
-	var bp_terms_accepted = '<?php _e( "Accepted", "buddypress" ) ?>';
-	var bp_terms_rejected = '<?php _e( "Rejected", "buddypress" ) ?>';
-	var bp_terms_show_all_comments = '<?php _e( "Show all comments for this thread", "buddypress" ) ?>';
-	var bp_terms_show_all = '<?php _e( "Show all", "buddypress" ) ?>';
-	var bp_terms_comments = '<?php _e( "comments", "buddypress" ) ?>';
-	var bp_terms_close = '<?php _e( "Close", "buddypress" ) ?>';
-	var bp_terms_mention_explain = '<?php printf( __( "%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", "buddypress" ), '@' . bp_get_displayed_user_username(), bp_get_user_firstname(bp_get_displayed_user_fullname()), bp_get_user_firstname(bp_get_displayed_user_fullname()) ); ?>';
-	</script>
-<?php
-}
-add_action( 'wp_footer', 'bp_dtheme_js_terms' );
-
 // Member Buttons
 add_action( 'bp_member_header_actions',    'bp_add_friend_button' );
 add_action( 'bp_member_header_actions',    'bp_send_public_message_button' );
Index: bp-themes/bp-default/sidebar.php
===================================================================
--- bp-themes/bp-default/sidebar.php	(revision 3295)
+++ bp-themes/bp-default/sidebar.php	(working copy)
@@ -14,7 +14,7 @@
 				<?php bp_loggedin_user_avatar( 'type=thumb&width=40&height=40' ) ?>
 			</a>
 
-			<h4><?php bp_loggedinuser_link() ?></h4>
+			<h4><?php echo bp_core_get_userlink( bp_loggedin_user_id() ); ?></h4>
 			<a class="button logout" href="<?php echo wp_logout_url( bp_get_root_domain() ) ?>"><?php _e( 'Log Out', 'buddypress' ) ?></a>
 
 			<?php do_action( 'bp_sidebar_me' ) ?>
@@ -39,7 +39,7 @@
 
 		<form name="login-form" id="sidebar-login-form" class="standard-form" action="<?php echo site_url( 'wp-login.php', 'login' ) ?>" method="post">
 			<label><?php _e( 'Username', 'buddypress' ) ?><br />
-			<input type="text" name="log" id="sidebar-user-login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" /></label>
+			<input type="text" name="log" id="sidebar-user-login" class="input" value="<?php echo esc_attr(stripslashes($user_login)); ?>" /></label>
 
 			<label><?php _e( 'Password', 'buddypress' ) ?><br />
 			<input type="password" name="pwd" id="sidebar-user-pass" class="input" value="" /></label>
Index: bp-themes/bp-default/blogs/blogs-loop.php
===================================================================
--- bp-themes/bp-default/blogs/blogs-loop.php	(revision 3295)
+++ bp-themes/bp-default/blogs/blogs-loop.php	(working copy)
@@ -4,18 +4,20 @@
 
 <?php if ( bp_has_blogs( bp_ajax_querystring( 'blogs' ) ) ) : ?>
 
-	<div class="pagination">
+	<div id="pag-top" class="pagination">
 
-		<div class="pag-count" id="blog-dir-count">
+		<div class="pag-count" id="blog-dir-count-top">
 			<?php bp_blogs_pagination_count() ?>
 		</div>
 
-		<div class="pagination-links" id="blog-dir-pag">
+		<div class="pagination-links" id="blog-dir-pag-top">
 			<?php bp_blogs_pagination_links() ?>
 		</div>
 
 	</div>
 
+	<?php do_action( 'bp_before_directory_blogs_list' ) ?>
+
 	<ul id="blogs-list" class="item-list">
 	<?php while ( bp_blogs() ) : bp_the_blog(); ?>
 
@@ -51,6 +53,18 @@
 
 	<?php bp_blog_hidden_fields() ?>
 
+	<div id="pag-bottom" class="pagination">
+
+		<div class="pag-count" id="blog-dir-count-bottom">
+			<?php bp_blogs_pagination_count() ?>
+		</div>
+
+		<div class="pagination-links" id="blog-dir-pag-bottom">
+			<?php bp_blogs_pagination_links() ?>
+		</div>
+
+	</div>
+
 <?php else: ?>
 
 	<div id="message" class="info">
Index: bp-themes/bp-default/archive.php
===================================================================
--- bp-themes/bp-default/archive.php	(revision 3295)
+++ bp-themes/bp-default/archive.php	(working copy)
@@ -32,7 +32,7 @@
 						<div class="post-content">
 							<h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'buddypress' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
 
-							<p class="date"><?php the_time('F j, Y') ?> <em><?php _e( 'in', 'buddypress' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></em></p>
+							<p class="date"><?php the_time() ?> <em><?php _e( 'in', 'buddypress' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></em></p>
 
 							<div class="entry">
 								<?php the_content( __( 'Read the rest of this entry &rarr;', 'buddypress' ) ); ?>
Index: bp-themes/bp-default/single.php
===================================================================
--- bp-themes/bp-default/single.php	(revision 3295)
+++ bp-themes/bp-default/single.php	(working copy)
@@ -26,7 +26,7 @@
 					<div class="post-content">
 						<h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'buddypress' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
 
-						<p class="date"><?php the_time('F j, Y') ?> <em><?php _e( 'in', 'buddypress' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></em></p>
+						<p class="date"><?php the_time() ?> <em><?php _e( 'in', 'buddypress' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></em> <?php edit_post_link( __( 'Edit this entry', 'buddypress' ), '<em class="edit-link">', '</em>' ); ?></p>
 
 						<div class="entry">
 							<?php the_content( __( 'Read the rest of this entry &rarr;', 'buddypress' ) ); ?>
Index: bp-themes/bp-default/_inc/css/default.css
===================================================================
--- bp-themes/bp-default/_inc/css/default.css	(revision 3295)
+++ bp-themes/bp-default/_inc/css/default.css	(working copy)
@@ -35,7 +35,7 @@
 a:hover, a:active { color: #888; }
 a:focus { outline: 1px dotted #ccc; }
 
-.padder { padding: 20px; }
+.padder { padding: 19px; }
 .clear { clear: left; }
 
 p {	margin-bottom: 15px; }
@@ -179,7 +179,7 @@
 	width: 224px;
 	margin-left: -226px;
 	margin-top: 1px;
-	border-left: 1px solid #e4e4e4;
+	border-left: 1px solid #ddd;
 	-moz-border-radius-topright: 3px;
 	-webkit-border-top-right-radius: 3px;
 	background: url( ../images/sidebar_back.gif ) top left repeat-x;
@@ -273,7 +273,7 @@
 
 div#content .padder {
 	margin-right: 225px;
-	border-right: 1px solid #e4e4e4;
+	border-right: 1px solid #ddd;
 	-moz-border-radius-topleft: 6px;
 	-webkit-border-top-left-radius: 6px;
 	-moz-border-radius-bottomleft: 6px;
@@ -399,7 +399,6 @@
 		border-bottom: 1px solid #eaeaea;
 	}
 		ul.single-line li { border: none; }
-		body.activity-permalink ul.item-list li { padding-top: 0; }
 
 		ul.item-list li img.avatar {
 			float: left;
@@ -448,7 +447,7 @@
 div.item-list-tabs {
 	clear: left;
 	overflow: hidden;
-	margin: 25px -20px 20px -20px;
+	margin: 25px -19px 20px -19px;
 	background: #eaeaea;
 }
 	div.item-list-tabs ul li a {
@@ -524,7 +523,7 @@
 
 	div.item-list-tabs#subnav {
 		background: #fff;
-		margin: -15px -20px 15px -20px;
+		margin: -15px -19px 15px -19px;
 		border-bottom: 1px solid #eaeaea;
 		min-height: 35px;
 		overflow: hidden;
@@ -574,7 +573,7 @@
 -------------------------------------------------------------- */
 
 div.pagination {
-	margin: -15px -20px 9px -20px;
+	margin: -20px -20px 9px -20px;
 	border-bottom: 1px solid #eaeaea;
 	padding: 10px 20px 10px 20px;
 	color: #888;
@@ -604,6 +603,10 @@
 				font-weight: bold;
 			}
 
+div#pag-bottom {
+	margin-top: 0;
+}
+
 /* > Error / Success Messages
 -------------------------------------------------------------- */
 
@@ -644,7 +647,7 @@
 /* > Buttons
 -------------------------------------------------------------- */
 
-a.button, input[type=submit], input[type=button],
+a.button, input[type=submit], input[type=button], input[type=reset],
 ul.button-nav li a, div.generic-button a {
 	background: url( ../images/white-grad.png ) top left repeat-x;
 	border: 1px solid #ddd;
@@ -659,7 +662,7 @@
 	vertical-align: bottom;
 	cursor: pointer;
 }
-	a.button:hover, a.button:focus, input[type=submit]:hover, input[type=button]:hover,
+	a.button:hover, a.button:focus, input[type=submit]:hover, input[type=button]:hover, input[type=reset]:hover,
 	ul.button-nav li a:hover, ul.button-nav li.current a,
 	div.generic-button a:hover {
 		border-color: #aaa;
@@ -840,6 +843,10 @@
 table {
 	width: 100%;
 }
+	table thead tr {
+		background: #eaeaea;
+	}
+
 	table#message-threads {
 		margin: 0 -20px;
 		width: auto;
@@ -888,10 +895,6 @@
 	margin: -9px -20px 20px -20px;
 	width: auto;
 }
-	table.forum tr:first-child {
-		background: #fafafa;
-	}
-
 	table.forum tr.sticky td {
 		background: #FFF9DB;
 		border-top: 1px solid #FFE8C4;
@@ -1145,6 +1148,11 @@
 		color: #888;
 		line-height: 220%;
 	}
+	
+	.activity-list .activity-content .activity-header img.avatar {
+		float: none !important;
+		margin: 0 5px -8px 0 !important;
+	}
 
 	.activity-list .activity-header a:first-child, span.highlight {
 		background: #EBF7FF;
@@ -1275,6 +1283,7 @@
 	background: #f5f5f5;
 	-moz-border-radius: 4px;
 	-webkit-border-radius: 4px;
+	padding: 0 10px 0;
 }
 div.activity-comments ul, div.activity-comments ul li {
 	border: none;
@@ -1287,16 +1296,15 @@
 
 	div.activity-comments ul li {
 		border-top: 2px solid #fff;
-		padding: 10px 15px 10px 0;
-		margin-left: 15px;
+		padding: 10px 0 0;
 	}
 		body.activity-permalink div.activity-comments ul li {
 			border-width: 1px;
-			padding: 15px 0 15px 0;
+			padding: 10px 0 0;
 		}
 
 		div.activity-comments ul li p:last-child {
-			margin-bottom: 0;
+			margin-bottom: 10px;
 		}
 
 		div.activity-comments > ul > li:first-child {
@@ -1308,8 +1316,8 @@
 		}
 
 	div.activity-comments ul li > ul {
-		margin-top: 5px;
-		margin-left: 25px;
+		margin-top: 0;
+		margin-left: 20px;
 	}
 		body.activity-permalink div.activity-comments ul li > ul {
 			margin-top: 15px;
@@ -1342,9 +1350,8 @@
 	div.activity-comments form.ac-form {
 		display: none;
 		margin: 10px 0 10px 33px;
-		background: #eee;
-		border-bottom: 1px solid #ddd;
-		border-right: 1px solid #ddd;
+		background: #fafafa;
+		border: 1px solid #ddd;
 		-moz-border-radius: 4px;
 		-webkit-border-radius: 4px;
 		border-radius: 4px;
@@ -1747,4 +1754,4 @@
 }
 	#footer a {
 		color: #bbb;
-	}
\ No newline at end of file
+	}
Index: bp-themes/bp-default/_inc/ajax.php
===================================================================
--- bp-themes/bp-default/_inc/ajax.php	(revision 3295)
+++ bp-themes/bp-default/_inc/ajax.php	(working copy)
@@ -187,8 +187,8 @@
 				</div>
 
 				<div class="acomment-meta">
-					<?php echo bp_core_get_userlink( bp_get_activity_user_id() ) ?> &middot; <?php printf( __( '%s ago', 'buddypress' ), bp_core_time_since( gmdate( "Y-m-d H:i:s" ) ) ) ?> &middot;
-					<a class="acomment-reply" href="#acomment-<?php bp_activity_id() ?>" id="acomment-reply-<?php echo attribute_escape( $_POST['form_id'] ) ?>"><?php _e( 'Reply', 'buddypress' ) ?></a>
+					<?php echo bp_core_get_userlink( bp_get_activity_user_id() ) ?> &middot; <?php printf( __( '%s ago', 'buddypress' ), bp_core_time_since( bp_core_current_time() ) ) ?> &middot;
+					<a class="acomment-reply" href="#acomment-<?php bp_activity_id() ?>" id="acomment-reply-<?php echo esc_attr( $_POST['form_id'] ) ?>"><?php _e( 'Reply', 'buddypress' ) ?></a>
 					 &middot; <a href="<?php echo wp_nonce_url( $bp->root_domain . '/' . $bp->activity->slug . '/delete/' . bp_get_activity_id() . '?cid=' . $comment_id, 'bp_activity_delete_link' ) ?>" class="delete acomment-delete confirm"><?php _e( 'Delete', 'buddypress' ) ?></a>
 				</div>
 
@@ -216,7 +216,7 @@
 	$activity = new BP_Activity_Activity( $_POST['id'] );
 
 	/* Check access */
-	if ( !is_site_admin() && $activity->user_id != $bp->loggedin_user->id )
+	if ( !is_super_admin() && $activity->user_id != $bp->loggedin_user->id )
 		return false;
 
 	if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) )
@@ -249,7 +249,7 @@
 	$comment = new BP_Activity_Activity( $_POST['id'] );
 
 	/* Check access */
-	if ( !is_site_admin() && $comment->user_id != $bp->loggedin_user->id )
+	if ( !is_super_admin() && $comment->user_id != $bp->loggedin_user->id )
 		return false;
 
 	if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) )
@@ -312,7 +312,7 @@
 		echo '<h4>' . $user->user_link . '</h4>';
 		echo '<span class="activity">' . esc_attr( $user->last_active ) . '</span>';
 		echo '<div class="action">
-				<a class="remove" href="' . wp_nonce_url( $bp->loggedin_user->domain . $bp->groups->slug . '/' . $_POST['group_id'] . '/invites/remove/' . $user->id, 'groups_invite_uninvite_user' ) . '" id="uid-' . attribute_escape( $user->id ) . '">' . __( 'Remove Invite', 'buddypress' ) . '</a>
+				<a class="remove" href="' . wp_nonce_url( $bp->loggedin_user->domain . $bp->groups->slug . '/' . $_POST['group_id'] . '/invites/remove/' . $user->id, 'groups_invite_uninvite_user' ) . '" id="uid-' . esc_attr( $user->id ) . '">' . __( 'Remove Invite', 'buddypress' ) . '</a>
 			  </div>';
 		echo '</li>';
 
@@ -404,7 +404,7 @@
 			if ( !groups_join_group( $group->id ) ) {
 				_e( 'Error joining group', 'buddypress' );
 			} else {
-				echo '<a id="group-' . attribute_escape( $group->id ) . '" class="leave-group" rel="leave" title="' . __( 'Leave Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>';
+				echo '<a id="group-' . esc_attr( $group->id ) . '" class="leave-group" rel="leave" title="' . __( 'Leave Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>';
 			}
 
 		} else if ( 'private' == $group->status ) {
@@ -414,7 +414,7 @@
 			if ( !groups_send_membership_request( $bp->loggedin_user->id, $group->id ) ) {
 				_e( 'Error requesting membership', 'buddypress' );
 			} else {
-				echo '<a id="group-' . attribute_escape( $group->id ) . '" class="membership-requested" rel="membership-requested" title="' . __( 'Membership Requested', 'buddypress' ) . '" href="' . bp_get_group_permalink( $group ) . '">' . __( 'Membership Requested', 'buddypress' ) . '</a>';
+				echo '<a id="group-' . esc_attr( $group->id ) . '" class="membership-requested" rel="membership-requested" title="' . __( 'Membership Requested', 'buddypress' ) . '" href="' . bp_get_group_permalink( $group ) . '">' . __( 'Membership Requested', 'buddypress' ) . '</a>';
 			}
 		}
 
@@ -426,9 +426,9 @@
 			_e( 'Error leaving group', 'buddypress' );
 		} else {
 			if ( 'public' == $group->status ) {
-				echo '<a id="group-' . attribute_escape( $group->id ) . '" class="join-group" rel="join" title="' . __( 'Join Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'join', 'groups_join_group' ) . '">' . __( 'Join Group', 'buddypress' ) . '</a>';
+				echo '<a id="group-' . esc_attr( $group->id ) . '" class="join-group" rel="join" title="' . __( 'Join Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'join', 'groups_join_group' ) . '">' . __( 'Join Group', 'buddypress' ) . '</a>';
 			} else if ( 'private' == $group->status ) {
-				echo '<a id="group-' . attribute_escape( $group->id ) . '" class="request-membership" rel="join" title="' . __( 'Request Membership', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'request-membership', 'groups_send_membership_request' ) . '">' . __( 'Request Membership', 'buddypress' ) . '</a>';
+				echo '<a id="group-' . esc_attr( $group->id ) . '" class="request-membership" rel="join" title="' . __( 'Request Membership', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'request-membership', 'groups_send_membership_request' ) . '">' . __( 'Request Membership', 'buddypress' ) . '</a>';
 			}
 		}
 	}
@@ -442,11 +442,11 @@
 	if ( !isset( $_POST['notice_id'] ) ) {
 		echo "-1<div id='message' class='error'><p>" . __('There was a problem closing the notice.', 'buddypress') . '</p></div>';
 	} else {
-		$notice_ids = get_usermeta( $userdata->ID, 'closed_notices' );
+		$notice_ids = get_user_meta( $userdata->ID, 'closed_notices', true );
 
 		$notice_ids[] = (int) $_POST['notice_id'];
 
-		update_usermeta( $userdata->ID, 'closed_notices', $notice_ids );
+		update_user_meta( $userdata->ID, 'closed_notices', $notice_ids );
 	}
 }
 add_action( 'wp_ajax_messages_close_notice', 'bp_dtheme_ajax_close_notice' );
@@ -465,7 +465,7 @@
 				<?php do_action( 'bp_before_message_meta' ) ?>
 				<?php echo bp_loggedin_user_avatar( 'type=thumb&width=30&height=30' ); ?>
 
-				<strong><a href="<?php echo $bp->loggedin_user->domain ?>"><?php echo $bp->loggedin_user->fullname ?></a> <span class="activity"><?php printf( __( 'Sent %s ago', 'buddypress' ), bp_core_time_since( time() ) ) ?></span></strong>
+				<strong><a href="<?php echo $bp->loggedin_user->domain ?>"><?php echo $bp->loggedin_user->fullname ?></a> <span class="activity"><?php printf( __( 'Sent %s ago', 'buddypress' ), bp_core_time_since( bp_core_current_time() ) ) ?></span></strong>
 
 				<?php do_action( 'bp_after_message_meta' ) ?>
 			</div>
Index: bp-themes/bp-default/registration/register.php
===================================================================
--- bp-themes/bp-default/registration/register.php	(revision 3295)
+++ bp-themes/bp-default/registration/register.php	(working copy)
@@ -179,7 +179,7 @@
 							<label for="signup_blog_url"><?php _e( 'Blog URL', 'buddypress' ) ?> <?php _e( '(required)', 'buddypress' ) ?></label>
 							<?php do_action( 'bp_signup_blog_url_errors' ) ?>
 
-							<?php if ( 'yes' == VHOST ) : ?>
+							<?php if ( is_subdomain_install() ) : ?>
 								http:// <input type="text" name="signup_blog_url" id="signup_blog_url" value="<?php bp_signup_blog_url_value() ?>" /> .<?php echo str_replace( 'http://', '', site_url() ) ?>
 							<?php else : ?>
 								<?php echo site_url() ?>/ <input type="text" name="signup_blog_url" id="signup_blog_url" value="<?php bp_signup_blog_url_value() ?>" />
@@ -206,7 +206,7 @@
 				<?php do_action( 'bp_before_registration_submit_buttons' ) ?>
 
 				<div class="submit">
-					<input type="submit"name="signup_submit" id="signup_submit" value="<?php _e( 'Complete Sign Up', 'buddypress' ) ?> &rarr;" />
+					<input type="submit" name="signup_submit" id="signup_submit" value="<?php _e( 'Complete Sign Up', 'buddypress' ) ?> &rarr;" />
 				</div>
 
 				<?php do_action( 'bp_after_registration_submit_buttons' ) ?>
Index: bp-themes/bp-default/forums/index.php
===================================================================
--- bp-themes/bp-default/forums/index.php	(revision 3295)
+++ bp-themes/bp-default/forums/index.php	(working copy)
@@ -36,6 +36,7 @@
 
 							<label><?php _e( 'Post In Group Forum:', 'buddypress' ) ?></label>
 							<select id="topic_group_id" name="topic_group_id">
+								<option value="">----</option>
 								<?php while ( bp_groups() ) : bp_the_group(); ?>
 									<?php if ( 'public' == bp_get_group_status() ) : ?>
 										<option value="<?php bp_group_id() ?>"><?php bp_group_name() ?></option>
Index: bp-themes/bp-default/header.php
===================================================================
--- bp-themes/bp-default/header.php	(revision 3295)
+++ bp-themes/bp-default/header.php	(working copy)
@@ -56,14 +56,18 @@
 			<div id="search-bar">
 				<div class="padder">
 
-				<form action="<?php echo bp_search_form_action() ?>" method="post" id="search-form">
-					<input type="text" id="search-terms" name="search-terms" value="" />
-					<?php echo bp_search_form_type_select() ?>
+				<?php if ( bp_search_form_enabled() ) : ?>
 
-					<input type="submit" name="search-submit" id="search-submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
-					<?php wp_nonce_field( 'bp_search_form' ) ?>
-				</form><!-- #search-form -->
+					<form action="<?php echo bp_search_form_action() ?>" method="post" id="search-form">
+						<input type="text" id="search-terms" name="search-terms" value="" />
+						<?php echo bp_search_form_type_select() ?>
 
+						<input type="submit" name="search-submit" id="search-submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
+						<?php wp_nonce_field( 'bp_search_form' ) ?>
+					</form><!-- #search-form -->
+
+				<?php endif; ?>
+
 				<?php do_action( 'bp_search_login_bar' ) ?>
 
 				</div><!-- .padder -->
Index: bp-xprofile/bp-xprofile-admin.php
===================================================================
--- bp-xprofile/bp-xprofile-admin.php	(revision 3295)
+++ bp-xprofile/bp-xprofile-admin.php	(working copy)
@@ -58,7 +58,7 @@
 				$type = ( $type == 'error' ) ? 'error' : 'updated'; ?>
 
 				<div id="message" class="<?php echo $type; ?> fade">
-					<p><?php echo wp_specialchars( attribute_escape( $message ) ); ?></p>
+					<p><?php echo wp_specialchars( esc_attr( $message ) ); ?></p>
 				</div>
 <?php		endif; ?>
 
Index: bp-xprofile/bp-xprofile-templatetags.php
===================================================================
--- bp-xprofile/bp-xprofile-templatetags.php	(revision 3295)
+++ bp-xprofile/bp-xprofile-templatetags.php	(working copy)
@@ -176,7 +176,7 @@
 		$css_classes = array();
 
 		if ( $class )
-			$css_classes[] = sanitize_title( attribute_escape( $class ) );
+			$css_classes[] = sanitize_title( esc_attr( $class ) );
 
 		/* Set a class with the field ID */
 		$css_classes[] = 'field_' . $profile_template->field->id;
@@ -184,7 +184,7 @@
 		/* Set a class with the field name (sanitized) */
 		$css_classes[] = 'field_' . sanitize_title( $profile_template->field->name );
 
-		if ( $profile_template->current_field % 2 )
+		if ( $profile_template->current_field % 2 == 1 )
 			$css_classes[] = 'alt';
 
 		$css_classes = apply_filters( 'bp_field_css_classes', &$css_classes );
@@ -383,7 +383,7 @@
 					else
 						$selected = '';
 
-					$html .= apply_filters( 'bp_get_the_profile_field_options_select', '<option' . $selected . ' value="' . attribute_escape( stripslashes( $options[$k]->name ) ) . '">' . attribute_escape( stripslashes( $options[$k]->name ) ) . '</option>', $options[$k] );
+					$html .= apply_filters( 'bp_get_the_profile_field_options_select', '<option' . $selected . ' value="' . esc_attr( stripslashes( $options[$k]->name ) ) . '">' . esc_attr( stripslashes( $options[$k]->name ) ) . '</option>', $options[$k] );
 				}
 				break;
 
@@ -404,7 +404,7 @@
 					else
 						$selected = '';
 
-					$html .= apply_filters( 'bp_get_the_profile_field_options_radio', '<label><input' . $selected . ' type="radio" name="field_' . $field->id . '" id="option_' . $options[$k]->id . '" value="' . attribute_escape( $options[$k]->name ) . '"> ' . attribute_escape( $options[$k]->name ) . '</label>', $options[$k] );
+					$html .= apply_filters( 'bp_get_the_profile_field_options_radio', '<label><input' . $selected . ' type="radio" name="field_' . $field->id . '" id="option_' . $options[$k]->id . '" value="' . esc_attr( $options[$k]->name ) . '"> ' . esc_attr( $options[$k]->name ) . '</label>', $options[$k] );
 				}
 
 				$html .= '</div>';
@@ -429,7 +429,7 @@
 						}
 					}
 
-					$html .= apply_filters( 'bp_get_the_profile_field_options_checkbox', '<label><input' . $selected . ' type="checkbox" name="field_' . $field->id . '[]" id="field_' . $options[$k]->id . '_' . $k . '" value="' . attribute_escape( $options[$k]->name ) . '"> ' . attribute_escape( $options[$k]->name ) . '</label>', $options[$k] );
+					$html .= apply_filters( 'bp_get_the_profile_field_options_checkbox', '<label><input' . $selected . ' type="checkbox" name="field_' . $field->id . '[]" id="field_' . $options[$k]->id . '_' . $k . '" value="' . esc_attr( $options[$k]->name ) . '"> ' . esc_attr( $options[$k]->name ) . '</label>', $options[$k] );
 					$selected = '';
 				}
 				break;
@@ -461,7 +461,7 @@
 
 				switch ( $type ) {
 					case 'day':
-						$html .= '<option value=""' . attribute_escape( $default_select ) . '>--</option>';
+						$html .= '<option value=""' . esc_attr( $default_select ) . '>--</option>';
 
 						for ( $i = 1; $i < 32; $i++ ) {
 							if ( $day == $i )
@@ -482,7 +482,7 @@
 								 __( 'October', 'buddypress' ), __( 'November', 'buddypress' ), __( 'December', 'buddypress' )
 								);
 
-						$html .= '<option value=""' . attribute_escape( $default_select ) . '>------</option>';
+						$html .= '<option value=""' . esc_attr( $default_select ) . '>------</option>';
 
 						for ( $i = 0; $i < 12; $i++ ) {
 							if ( $month == $eng_months[$i] )
@@ -495,7 +495,7 @@
 						break;
 
 					case 'year':
-						$html .= '<option value=""' . attribute_escape( $default_select ) . '>----</option>';
+						$html .= '<option value=""' . esc_attr( $default_select ) . '>----</option>';
 
 						for ( $i = date( 'Y', time() ); $i > 1899; $i-- ) {
 							if ( $year == $i )
@@ -568,7 +568,7 @@
 			$selected = '';
 
 		if ( $groups[$i]->fields )
-			echo '<li' . $selected . '><a href="' . $bp->displayed_user->domain . $bp->profile->slug . '/edit/group/' . $groups[$i]->id . '">' . attribute_escape( $groups[$i]->name ) . '</a></li>';
+			echo '<li' . $selected . '><a href="' . $bp->displayed_user->domain . $bp->profile->slug . '/edit/group/' . $groups[$i]->id . '">' . esc_attr( $groups[$i]->name ) . '</a></li>';
 	}
 
 	do_action( 'xprofile_profile_group_tabs' );
@@ -630,7 +630,7 @@
 	function bp_get_profile_last_updated() {
 		global $bp;
 
-		$last_updated = get_usermeta( $bp->displayed_user->id, 'profile_last_updated' );
+		$last_updated = get_user_meta( $bp->displayed_user->id, 'profile_last_updated', true );
 
 		if ( $last_updated )
 			return apply_filters( 'bp_get_profile_last_updated', sprintf( __('Profile updated %s ago', 'buddypress'), bp_core_time_since( strtotime( $last_updated ) ) ) );
Index: bp-xprofile/bp-xprofile-classes.php
===================================================================
--- bp-xprofile/bp-xprofile-classes.php	(revision 3295)
+++ bp-xprofile/bp-xprofile-classes.php	(working copy)
@@ -201,11 +201,11 @@
 				</div>
 <?php endif; ?>
 			<div id="poststuff">
-				<form action="<?php echo attribute_escape( $action ); ?>" method="post">
+				<form action="<?php echo esc_attr( $action ); ?>" method="post">
 					<div id="titlediv">
 						<h3><label for="group_name"><?php _e( "Field Group Title", 'buddypress') ?> *</label></h3>
 						<div id="titlewrap">
-							<input type="text" name="group_name" id="title" value="<?php echo attribute_escape( $this->name ); ?>" style="width:50%" />
+							<input type="text" name="group_name" id="title" value="<?php echo esc_attr( $this->name ); ?>" style="width:50%" />
 						</div>
 					</div>
 
@@ -219,8 +219,8 @@
 <?php endif; ?>
 
 					<p class="submit">
-						<input type="hidden" name="group_order" id="group_order" value="<?php echo attribute_escape( $this->group_order ); ?>" />
-						<input type="submit" name="save_group" value="<?php echo attribute_escape( $button ); ?>" class="button-primary"/>
+						<input type="hidden" name="group_order" id="group_order" value="<?php echo esc_attr( $this->group_order ); ?>" />
+						<input type="submit" name="save_group" value="<?php echo esc_attr( $button ); ?>" class="button-primary"/>
 						<?php _e( 'or', 'buddypress' ); ?> <a href="admin.php?page=bp-profile-setup" class="deletion"><?php _e( 'Cancel', 'buddypress' ); ?></a>
 					</p>
 				</form>
@@ -320,7 +320,7 @@
 		if ( $this->id != null )
 			$sql = $wpdb->prepare( "UPDATE {$bp->profile->table_name_fields} SET group_id = %d, parent_id = 0, type = %s, name = %s, description = %s, is_required = %d, order_by = %s, field_order = %d WHERE id = %d", $this->group_id, $this->type, $this->name, $this->description, $this->is_required, $this->order_by, $this->field_order, $this->id );
 		else
-			$sql = $wpdb->prepare( "INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, order_by, field_order ) VALUES (%d, 0, %s, %s, %s, %d, %s, %d )", $this->group_id, $this->type, $this->name, $this->description, $this->is_required, $this->order_by, $this->field_order );
+			$sql = $wpdb->prepare( "INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, order_by, field_order ) VALUES (%d, %d, %s, %s, %s, %d, %s, %d )", $this->group_id, $this->parent_id, $this->type, $this->name, $this->description, $this->is_required, $this->order_by, $this->field_order );
 
 		/*
 		 * Check for null so field options can be changed without changing any other part of the field.
@@ -546,7 +546,7 @@
 							$default_name = '[' . $j . ']';
 ?>
 						<p><?php _e('Option', 'buddypress'); ?> <?php echo $j; ?>:
-						   <input type="text" name="<?php echo $type; ?>_option[<?php echo $j; ?>]" id="<?php echo $type; ?>_option<?php echo $j; ?>" value="<?php echo attribute_escape( $options[$i]->name ); ?>" />
+						   <input type="text" name="<?php echo $type; ?>_option[<?php echo $j; ?>]" id="<?php echo $type; ?>_option<?php echo $j; ?>" value="<?php echo esc_attr( $options[$i]->name ); ?>" />
 						   <input type="<?php echo $default_input; ?>" name="isDefault_<?php echo $type; ?>_option<?php echo $default_name; ?>" <?php if ( (int) $options[$i]->is_default_option ) {?> checked="checked"<?php } ?> " value="<?php echo $j; ?>" /> <?php _e( 'Default Value', 'buddypress' ); ?>
 <?php
 					if ( $j != 1 && $options[$i]->id != -1 ) : ?>
@@ -609,7 +609,7 @@
 				<div id="titlediv">
 					<h3><label for="title"><?php _e( 'Field Title', 'buddypress' ); ?> *</label></h3>
 					<div id="titlewrap">
-						<input type="text" name="title" id="title" value="<?php echo attribute_escape( $this->name ); ?>" style="width:50%" />
+						<input type="text" name="title" id="title" value="<?php echo esc_attr( $this->name ); ?>" style="width:50%" />
 					</div>
 				</div>
 <?php
@@ -649,7 +649,7 @@
 				<input type="hidden" name="fieldtype" id="fieldtype" value="textbox" />
 <?php	} ?>
 				<p class="submit">
-					<input type="hidden" name="field_order" id="field_order" value="<?php echo attribute_escape( $this->field_order ); ?>" />
+					<input type="hidden" name="field_order" id="field_order" value="<?php echo esc_attr( $this->field_order ); ?>" />
 					<input type="submit" value="<?php _e( 'Save', 'buddypress' ); ?>" name="saveField" id="saveField" style="font-weight: bold" class="button-primary" />
 					<?php _e( 'or', 'buddypress' ); ?> <a href="admin.php?page=bp-profile-setup" class="deletion"><?php _e( 'Cancel', 'buddypress' ); ?></a>
 				</p>
Index: bp-core/bp-core-widgets.php
===================================================================
--- bp-core/bp-core-widgets.php	(revision 3295)
+++ bp-core/bp-core-widgets.php	(working copy)
@@ -58,7 +58,7 @@
 				<?php endwhile; ?>
 			</ul>
 			<?php wp_nonce_field( 'bp_core_widget_members', '_wpnonce-members' ); ?>
-			<input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php echo attribute_escape( $instance['max_members'] ); ?>" />
+			<input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php echo esc_attr( $instance['max_members'] ); ?>" />
 
 		<?php else: ?>
 
@@ -84,7 +84,7 @@
 		$max_members = strip_tags( $instance['max_members'] );
 		?>
 
-		<p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo attribute_escape( $max_members ); ?>" style="width: 30%" /></label></p>
+		<p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo esc_attr( $max_members ); ?>" style="width: 30%" /></label></p>
 	<?php
 	}
 }
@@ -138,7 +138,7 @@
 		$max_members = strip_tags( $instance['max_members'] );
 		?>
 
-		<p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo attribute_escape( $max_members ); ?>" style="width: 30%" /></label></p>
+		<p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo esc_attr( $max_members ); ?>" style="width: 30%" /></label></p>
 	<?php
 	}
 }
@@ -192,7 +192,7 @@
 		$max_members = strip_tags( $instance['max_members'] );
 		?>
 
-		<p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo attribute_escape( $max_members ); ?>" style="width: 30%" /></label></p>
+		<p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo esc_attr( $max_members ); ?>" style="width: 30%" /></label></p>
 	<?php
 	}
 }
Index: bp-core/bp-core-filters.php
===================================================================
--- bp-core/bp-core-filters.php	(revision 3295)
+++ bp-core/bp-core-filters.php	(working copy)
@@ -32,7 +32,7 @@
  * @return The blog name for the root blog
  */
 function bp_core_email_from_name_filter() {
- 	return apply_filters( 'bp_core_email_from_name_filter', get_blog_option( BP_ROOT_BLOG, 'blogname' ) );
+ 	return apply_filters( 'bp_core_email_from_name_filter', wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES ) );
 }
 add_filter( 'wp_mail_from_name', 'bp_core_email_from_name_filter' );
 
@@ -65,7 +65,7 @@
 function bp_core_allow_default_theme( $themes ) {
 	global $bp, $current_blog;
 
-	if ( !is_site_admin() )
+	if ( !is_super_admin() )
 		return $themes;
 
 	if ( $current_blog->ID == $bp->root_blog ) {
@@ -174,7 +174,7 @@
 
 	// Send email with activation link.
 	$activate_url = bp_get_activation_page() ."?key=$key";
-	$activate_url = clean_url($activate_url);
+	$activate_url = esc_url($activate_url);
 
 	$admin_email = get_site_option( "admin_email" );
 
@@ -203,7 +203,7 @@
 	global $current_site;
 
 	$activate_url = bp_get_activation_page() ."?key=$key";
-	$activate_url = clean_url($activate_url);
+	$activate_url = esc_url($activate_url);
 	$admin_email = get_site_option( "admin_email" );
 
 	if ( empty( $admin_email ) )
@@ -215,7 +215,7 @@
 
 	$from_name = ( '' == get_site_option( "site_name" ) ) ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) );
 	$message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
-	$message = sprintf( __( "Thanks for registering! To complete the activation of your account please click the following link:\n\n%s\n\n", 'buddypress' ), $activate_url . $email, clean_url("http://{$domain}{$path}" ) );
+	$message = sprintf( __( "Thanks for registering! To complete the activation of your account please click the following link:\n\n%s\n\n", 'buddypress' ), $activate_url . $email, esc_url( "http://{$domain}{$path}" ) );
 	$subject = '[' . $from_name . '] ' . __( 'Activate Your Account', 'buddypress' );
 
 	/* Send the message */
Index: bp-core/bp-core-notifications.php
===================================================================
--- bp-core/bp-core-notifications.php	(revision 3295)
+++ bp-core/bp-core-notifications.php	(working copy)
@@ -4,7 +4,7 @@
 	global $bp;
 
 	if ( !$date_notified )
-		$date_notified = time();
+		$date_notified = bp_core_current_time();
 
 	$notification = new BP_Core_Notification;
 	$notification->item_id = $item_id;
Index: bp-core/bp-core-adminbar.php
===================================================================
--- bp-core/bp-core-adminbar.php	(revision 3295)
+++ bp-core/bp-core-adminbar.php	(working copy)
@@ -108,7 +108,7 @@
 		wp_cache_set( 'bp_blogs_of_user_' . $bp->loggedin_user->id . '_inc_hidden', $blogs, 'bp' );
 	}
 
-	echo '<li id="bp-adminbar-blogs-menu"><a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/my-blogs">';
+	echo '<li id="bp-adminbar-blogs-menu"><a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/">';
 
 	_e( 'My Blogs', 'buddypress' );
 
Index: bp-core/bp-core-wpabstraction.php
===================================================================
--- bp-core/bp-core-wpabstraction.php	(revision 3295)
+++ bp-core/bp-core-wpabstraction.php	(working copy)
@@ -24,6 +24,29 @@
 	return true;
 }
 
+/**
+ * bp_core_is_main_site
+ *
+ * Checks if current blog is root blog of site
+ *
+ * @since 1.2.6
+ * @package BuddyPress
+ *
+ * @param int $blog_id optional blog id to test (default current blog)
+ * @return bool True if not multisite or $blog_id is main site
+ */
+function bp_core_is_main_site( $blog_id = '' ) {
+	global $current_site, $current_blog;
+
+	if ( !bp_core_is_multisite() )
+		return true;
+
+	if ( empty( $blog_id ) )
+		$blog_id = $current_blog->blog_id;
+
+	return $blog_id == $current_site->blog_id;
+}
+
 function bp_core_get_status_sql( $prefix = false ) {
 	if ( !bp_core_is_multisite() )
 		return "{$prefix}user_status = 0";
Index: bp-core/bp-core-cssjs.php
===================================================================
--- bp-core/bp-core-cssjs.php	(revision 3295)
+++ bp-core/bp-core-cssjs.php	(working copy)
@@ -38,7 +38,7 @@
 
 	<style type="text/css">
 		ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a { background-image: url( <?php echo BP_PLUGIN_URL . '/bp-core/images/admin_menu_icon.png' ?> ) !important; background-position: -1px -32px; }
-		ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image a { background-position: -1px 0; }
+		ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image a, ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image a { background-position: -1px 0; }
 		ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a img { display: none; }
 	</style>
 
Index: bp-core/bp-core-templatetags.php
===================================================================
--- bp-core/bp-core-templatetags.php	(revision 3295)
+++ bp-core/bp-core-templatetags.php	(working copy)
@@ -125,12 +125,12 @@
 	$page = 1;
 	$search_terms = false;
 
-	/* User filtering */
+	// User filtering
 	if ( !empty( $bp->displayed_user->id ) )
 		$user_id = $bp->displayed_user->id;
 
-	/* Pass a filter if ?s= is set. */
-	if ( $_REQUEST['s'] )
+	// Pass a filter if ?s= is set.
+	if ( isset( $_REQUEST['s'] ) && !empty( $_REQUEST['s'] ) )
 		$search_terms = $_REQUEST['s'];
 
 	// type: active ( default ) | random | newest | popular | online | alphabetical
@@ -156,7 +156,7 @@
 			$per_page = $max;
 	}
 
-	/* Make sure we return no members if we looking at friendship requests and there are none. */
+	// Make sure we return no members if we looking at friendship requests and there are none.
 	if ( empty( $include ) && $bp->friends->slug == $bp->current_component && 'requests' == $bp->current_action )
 		return false;
 
@@ -328,7 +328,7 @@
 	function bp_get_member_registered() {
 		global $members_template;
 
-		$registered = attribute_escape( bp_core_get_last_activity( $members_template->member->user_registered, __( 'registered %s ago', 'buddypress' ) ) );
+		$registered = esc_attr( bp_core_get_last_activity( $members_template->member->user_registered, __( 'registered %s ago', 'buddypress' ) ) );
 
 		return apply_filters( 'bp_member_last_active', $registered );
 	}
@@ -345,15 +345,15 @@
 
 function bp_member_hidden_fields() {
 	if ( isset( $_REQUEST['s'] ) ) {
-		echo '<input type="hidden" id="search_terms" value="' . attribute_escape( $_REQUEST['s'] ) . '" name="search_terms" />';
+		echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['s'] ) . '" name="search_terms" />';
 	}
 
 	if ( isset( $_REQUEST['letter'] ) ) {
-		echo '<input type="hidden" id="selected_letter" value="' . attribute_escape( $_REQUEST['letter'] ) . '" name="selected_letter" />';
+		echo '<input type="hidden" id="selected_letter" value="' . esc_attr( $_REQUEST['letter'] ) . '" name="selected_letter" />';
 	}
 
 	if ( isset( $_REQUEST['members_search'] ) ) {
-		echo '<input type="hidden" id="search_terms" value="' . attribute_escape( $_REQUEST['members_search'] ) . '" name="search_terms" />';
+		echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['members_search'] ) . '" name="search_terms" />';
 	}
 }
 
@@ -366,7 +366,7 @@
 
 	?>
 	<form action="" method="get" id="search-members-form">
-		<label><input type="text" name="s" id="members_search" value="<?php echo attribute_escape( $search_value ) ?>"  onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>
+		<label><input type="text" name="s" id="members_search" value="<?php echo esc_attr( $search_value ) ?>"  onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>
 		<input type="submit" id="members_search_submit" name="members_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
 	</form>
 <?php
@@ -516,7 +516,7 @@
 	if ( empty( $bp->bp_options_title ) )
 		$bp->bp_options_title = __( 'Options', 'buddypress' );
 
-	echo apply_filters( 'bp_get_options_title', attribute_escape( $bp->bp_options_title ) );
+	echo apply_filters( 'bp_get_options_title', esc_attr( $bp->bp_options_title ) );
 }
 
 
@@ -574,15 +574,16 @@
 		global $bp;
 
 		$defaults = array(
-			'type' => 'thumb',
-			'width' => false,
-			'height' => false
+			'type'		=> 'thumb',
+			'width'		=> false,
+			'height'	=> false,
+			'html'		=> true
 		);
 
 		$r = wp_parse_args( $args, $defaults );
 		extract( $r, EXTR_SKIP );
 
-		return apply_filters( 'bp_get_loggedin_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'type' => $type, 'width' => $width, 'height' => $height ) ) );
+		return apply_filters( 'bp_get_loggedin_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'type' => $type, 'width' => $width, 'height' => $height, 'html' => $html ) ) );
 	}
 
 function bp_displayed_user_avatar( $args = '' ) {
@@ -592,15 +593,16 @@
 		global $bp;
 
 		$defaults = array(
-			'type' => 'thumb',
-			'width' => false,
-			'height' => false
+			'type'		=> 'thumb',
+			'width'		=> false,
+			'height'	=> false,
+			'html'		=> true
 		);
 
 		$r = wp_parse_args( $args, $defaults );
 		extract( $r, EXTR_SKIP );
 
-		return apply_filters( 'bp_get_displayed_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => $type, 'width' => $width, 'height' => $height ) ) );
+		return apply_filters( 'bp_get_displayed_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => $type, 'width' => $width, 'height' => $height, 'html' => $html ) ) );
 	}
 
 function bp_avatar_admin_step() {
@@ -668,7 +670,7 @@
 	if ( !$user_id )
 		$user_id = $bp->displayed_user->id;
 
-	$last_activity = bp_core_get_last_activity( get_usermeta( $user_id, 'last_activity' ), __('active %s ago', 'buddypress') );
+	$last_activity = bp_core_get_last_activity( get_user+meta( $user_id, 'last_activity', true ), __('active %s ago', 'buddypress') );
 
 	if ( $echo )
 		echo apply_filters( 'bp_last_activity', $last_activity );
@@ -681,8 +683,13 @@
 }
 	function bp_get_user_firstname( $name = false ) {
 		global $bp;
+	
+		// Try to get displayed user
+		if ( empty( $name ) )
+			$name = $bp->displayed_user->fullname;
 
-		if ( !$name )
+		// Fall back on logged in user
+		if ( empty( $name ) )
 			$name = $bp->loggedin_user->fullname;
 
 		$fullname = (array)explode( ' ', $name );
@@ -705,7 +712,7 @@
 <div class="bp-widget wp-profile">
 	<h4><?php _e( 'My Profile' ) ?></h4>
 
-	<table class="wp-profile-fields">
+	<table class="wp-profile-fields zebra">
 		<?php if ( $ud->display_name ) { ?>
 		<tr id="wp_displayname">
 			<td class="label">
@@ -783,10 +790,25 @@
 }
 
 function bp_format_time( $time, $just_date = false ) {
-	$date = date( get_option('date_format'), $time );
+	if ( !$time )
+		return false;
 
+	// Get GMT offset from root blog
+	$root_blog_offset = get_blog_option( BP_ROOT_BLOG, 'gmt_offset' );
+
+	// Calculate offset time
+	$time_offest = $time + ( $root_blog_offset * 3600 );
+
+	// Current date (January 1, 2010)
+	$date = date( 'F j, Y ', $time_offest );
+
+	// Should we show the time also?
 	if ( !$just_date ) {
-		$date .= ' ' . __( 'at', 'buddypress' ) . date( ' ' . get_option('time_format'), $time );
+		// Current time (9:50pm)
+		$time = date( ' g:ia', $time_offest );
+
+		// Return string formatted with date and time
+		$date = sprintf( __( '%1$s at %2$s', 'buddypress' ), $date, $time );
 	}
 
 	return apply_filters( 'bp_format_time', $date );
@@ -863,7 +885,7 @@
 function bp_get_page_title() {
 	global $bp, $post, $wp_query, $current_blog;
 
-	if ( is_front_page() || !bp_current_component() || ( is_home() && bp_is_page( 'home' ) ) ) {
+	if ( is_front_page() || ( is_home() && bp_is_page( 'home' ) ) ) {
 		$title = __( 'Home', 'buddypress' );
 
 	} else if ( bp_is_blog_page() ) {
@@ -951,6 +973,32 @@
 		return apply_filters( 'bp_get_activation_page', $page );
 	}
 
+/**
+ * bp_search_form_available()
+ *
+ * Only show the search form if there are available objects to search for.
+ *
+ * @global array $bp
+ * @uses function_exists
+ * @uses bp_core_is_multisite()
+ * @return bool Filterable result
+ */
+function bp_search_form_enabled() {
+	global $bp;
+
+	if ( function_exists( 'xprofile_install' )
+		 || function_exists( 'groups_install' )
+		 || ( function_exists( 'bp_blogs_install' ) && bp_core_is_multisite() )
+		 || ( function_exists( 'bp_forums_setup' ) && !(int)$bp->site_options['bp-disable-forum-directory'] )
+		) {
+		$search_enabled = true;
+	} else {
+		$search_enabled = false;
+	}
+
+	return apply_filters( 'bp_search_form_enabled', $search_enabled );
+}
+
 function bp_search_form_action() {
 	global $bp;
 
@@ -1364,7 +1412,14 @@
 }
 
 function bp_is_activity_front_page() {
-	return ( 'page' == get_option('show_on_front') && 'activity' == get_option('page_on_front') && $_SERVER['REQUEST_URI'] == bp_core_get_site_path() );
+	global $current_blog;
+
+	if ( bp_core_is_main_site() )
+		$path = bp_core_get_site_path();
+	else
+		$path = $current_blog->path;
+
+	return ( 'page' == get_option('show_on_front') && 'activity' == get_option('page_on_front') && $_SERVER['REQUEST_URI'] == $path );
 }
 
 function bp_is_page($page) {
Index: bp-core/bp-core-classes.php
===================================================================
--- bp-core/bp-core-classes.php	(revision 3295)
+++ bp-core/bp-core-classes.php	(working copy)
@@ -50,7 +50,7 @@
 	 * @uses bp_core_get_userurl() Returns the URL with no HTML markup for a user based on their user id
 	 * @uses bp_core_get_userlink() Returns a HTML formatted link for a user with the user's full name as the link text
 	 * @uses bp_core_get_user_email() Returns the email address for the user based on user ID
-	 * @uses get_usermeta() WordPress function returns the value of passed usermeta name from usermeta table
+	 * @uses get_user_meta() WordPress function returns the value of passed usermeta name from usermeta table
 	 * @uses bp_core_fetch_avatar() Returns HTML formatted avatar for a user
 	 * @uses bp_profile_last_updated_date() Returns the last updated date for a user.
 	 */
@@ -60,14 +60,14 @@
 
 		if ( $this->profile_data ) {
 			$this->user_url = bp_core_get_user_domain( $this->id, $this->profile_data['user_nicename'], $this->profile_data['user_login'] );
-			$this->fullname = attribute_escape( $this->profile_data[BP_XPROFILE_FULLNAME_FIELD_NAME]['field_data'] );
+			$this->fullname = esc_attr( $this->profile_data[BP_XPROFILE_FULLNAME_FIELD_NAME]['field_data'] );
 			$this->user_link = "<a href='{$this->user_url}' title='{$this->fullname}'>{$this->fullname}</a>";
-			$this->email = attribute_escape( $this->profile_data['user_email'] );
+			$this->email = esc_attr( $this->profile_data['user_email'] );
 		} else {
 			$this->user_url = bp_core_get_user_domain( $this->id );
 			$this->user_link = bp_core_get_userlink( $this->id );
-			$this->fullname = attribute_escape( bp_core_get_user_displayname( $this->id ) );
-			$this->email = attribute_escape( bp_core_get_user_email( $this->id ) );
+			$this->fullname = esc_attr( bp_core_get_user_displayname( $this->id ) );
+			$this->email = esc_attr( bp_core_get_user_email( $this->id ) );
 		}
 
 		/* Cache a few things that are fetched often */
@@ -79,7 +79,7 @@
 		$this->avatar_thumb = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb' ) );
 		$this->avatar_mini = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb', 'width' => 30, 'height' => 30 ) );
 
-		$this->last_active = bp_core_get_last_activity( get_usermeta( $this->id, 'last_activity' ), __( 'active %s ago', 'buddypress' ) );
+		$this->last_active = bp_core_get_last_activity( get_user_meta( $this->id, 'last_activity', true ), __( 'active %s ago', 'buddypress' ) );
 	}
 
 	function populate_extras() {
@@ -177,7 +177,8 @@
 			$sql['pagination'] = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
 
 		/* Get paginated results */
-		$paged_users = $wpdb->get_results( join( ' ', (array)$sql ) );
+		$paged_users_sql = apply_filters( 'bp_core_get_paged_users_sql', join( ' ', (array)$sql ), $sql );
+		$paged_users     = $wpdb->get_results( $paged_users_sql );
 
 		/* Re-jig the SQL so we can get the total user count */
 		unset( $sql['select_main'] );
@@ -197,7 +198,8 @@
 		array_unshift( $sql, "SELECT COUNT(DISTINCT u.ID)" );
 
 		/* Get total user results */
-		$total_users = $wpdb->get_var( join( ' ', (array)$sql ) );
+		$total_users_sql = apply_filters( 'bp_core_get_total_users_sql', join( ' ', (array)$sql ), $sql );
+		$total_users     = $wpdb->get_var( $total_users_sql );
 
 		/***
 		 * Lets fetch some other useful data in a separate queries, this will be faster than querying the data for every user in a list.
@@ -222,8 +224,16 @@
 		if ( $limit && $page )
 			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
 
-		if ( strlen($letter) > 1 || is_numeric($letter) || !$letter )
-			return false;
+		// Multibyte compliance
+		if ( function_exists( 'mb_strlen' ) ) {
+			if ( mb_strlen( $letter, 'UTF-8' ) > 1 || is_numeric( $letter ) || !$letter ) {
+				return false;
+			}
+		} else {
+			if ( strlen( $letter ) > 1 || is_numeric( $letter ) || !$letter ) {
+				return false;
+			}
+		}
 
 		$letter = like_escape( $wpdb->escape( $letter ) );
 		$status_sql = bp_core_get_status_sql( 'u.' );
@@ -435,10 +445,10 @@
 
 		if ( $this->id ) {
 			// Update
-			$sql = $wpdb->prepare( "UPDATE {$bp->core->table_name_notifications} SET item_id = %d, secondary_item_id = %d, user_id = %d, component_name = %s, component_action = %d, date_notified = FROM_UNIXTIME(%d), is_new = %d ) WHERE id = %d", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new, $this->id );
+			$sql = $wpdb->prepare( "UPDATE {$bp->core->table_name_notifications} SET item_id = %d, secondary_item_id = %d, user_id = %d, component_name = %s, component_action = %d, date_notified = %s, is_new = %d ) WHERE id = %d", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new, $this->id );
 		} else {
 			// Save
-			$sql = $wpdb->prepare( "INSERT INTO {$bp->core->table_name_notifications} ( item_id, secondary_item_id, user_id, component_name, component_action, date_notified, is_new ) VALUES ( %d, %d, %d, %s, %s, FROM_UNIXTIME(%d), %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new );
+			$sql = $wpdb->prepare( "INSERT INTO {$bp->core->table_name_notifications} ( item_id, secondary_item_id, user_id, component_name, component_action, date_notified, is_new ) VALUES ( %d, %d, %d, %s, %s, %s, %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new );
 		}
 
 		if ( !$result = $wpdb->query( $sql ) )
Index: bp-core/bp-core-settings.php
===================================================================
--- bp-core/bp-core-settings.php	(revision 3295)
+++ bp-core/bp-core-settings.php	(working copy)
@@ -21,11 +21,10 @@
 	bp_core_new_subnav_item( array( 'name' => __( 'General', 'buddypress' ), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $bp->settings->slug, 'screen_function' => 'bp_core_screen_general_settings', 'position' => 10, 'user_has_access' => bp_is_my_profile() ) );
 	bp_core_new_subnav_item( array( 'name' => __( 'Notifications', 'buddypress' ), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $bp->settings->slug, 'screen_function' => 'bp_core_screen_notification_settings', 'position' => 20, 'user_has_access' => bp_is_my_profile() ) );
 
-	if ( !is_site_admin() && !(int) $bp->site_options['bp-disable-account-deletion'] )
+	if ( !is_super_admin() && !(int) $bp->site_options['bp-disable-account-deletion'] )
 		bp_core_new_subnav_item( array( 'name' => __( 'Delete Account', 'buddypress' ), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $bp->settings->slug, 'screen_function' => 'bp_core_screen_delete_account', 'position' => 90, 'user_has_access' => bp_is_my_profile() ) );
 }
-add_action( 'wp', 'bp_core_add_settings_nav', 2 );
-add_action( 'admin_menu', 'bp_core_add_settings_nav', 2 );
+add_action( 'bp_setup_nav', 'bp_core_add_settings_nav' );
 
 /**** GENERAL SETTINGS ****/
 
@@ -87,7 +86,7 @@
 
 	<form action="<?php echo $bp->loggedin_user->domain . BP_SETTINGS_SLUG . '/general' ?>" method="post" class="standard-form" id="settings-form">
 		<label for="email"><?php _e( 'Account Email', 'buddypress' ) ?></label>
-		<input type="text" name="email" id="email" value="<?php echo attribute_escape( $current_user->user_email ); ?>" class="settings-input" />
+		<input type="text" name="email" id="email" value="<?php echo esc_attr( $current_user->user_email ); ?>" class="settings-input" />
 
 		<label for="pass1"><?php _e( 'Change Password <span>(leave blank for no change)</span>', 'buddypress' ) ?></label>
 		<input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small" /> &nbsp;<?php _e( 'New Password', 'buddypress' ) ?><br />
@@ -114,7 +113,7 @@
 
 		if ( $_POST['notifications'] ) {
 			foreach ( (array)$_POST['notifications'] as $key => $value ) {
-				update_usermeta( (int)$current_user->id, $key, $value );
+				update_user_meta( (int)$current_user->id, $key, $value );
 			}
 		}
 
Index: bp-core/bp-core-catchuri.php
===================================================================
--- bp-core/bp-core-catchuri.php	(revision 3295)
+++ bp-core/bp-core-catchuri.php	(working copy)
@@ -42,44 +42,58 @@
 			return false;
 	}
 
+	// Ajax or not?
 	if ( strpos( $_SERVER['REQUEST_URI'], 'wp-load.php' ) )
 		$path = bp_core_referrer();
 	else
-		$path = clean_url( $_SERVER['REQUEST_URI'] );
+		$path = esc_url( $_SERVER['REQUEST_URI'] );
 
 	$path = apply_filters( 'bp_uri', $path );
 
-	// Firstly, take GET variables off the URL to avoid problems,
-	// they are still registered in the global $_GET variable */
+	// Take GET variables off the URL to avoid problems,
+	// they are still registered in the global $_GET variable
 	$noget = substr( $path, 0, strpos( $path, '?' ) );
-	if ( $noget != '' ) $path = $noget;
+	if ( $noget != '' )
+		$path = $noget;
 
-	/* Fetch the current URI and explode each part separated by '/' into an array */
+	// Fetch the current URI and explode each part separated by '/' into an array
 	$bp_uri = explode( "/", $path );
 
-	/* Loop and remove empties */
+	// Loop and remove empties
 	foreach ( (array)$bp_uri as $key => $uri_chunk )
 		if ( empty( $bp_uri[$key] ) ) unset( $bp_uri[$key] );
 
-	if ( defined( 'BP_ENABLE_MULTIBLOG' ) || 1 != BP_ROOT_BLOG ) {
-		/* If we are running BuddyPress on any blog, not just a root blog, we need to first
-		   shift off the blog name if we are running a subdirectory install of WPMU. */
-		if ( $current_blog->path != '/' )
-			array_shift( $bp_uri );
-	}
+ 	// Running off blog other than root
+  	if ( defined( 'BP_ENABLE_MULTIBLOG' ) || 1 != BP_ROOT_BLOG ) {
+ 
+ 		// Any subdirectory names must be removed from $bp_uri.
+ 		// This includes two cases: (1) when WP is installed in a subdirectory,
+ 		// and (2) when BP is running on secondary blog of a subdirectory
+ 		// multisite installation. Phew!
+ 		if ( $chunks = explode( '/', $current_blog->path ) ) {
+ 			foreach( $chunks as $key => $chunk ) {
+ 				$bkey = array_search( $chunk, $bp_uri );
+ 
+ 				if ( $bkey !== false )
+ 					unset( $bp_uri[$bkey] );
+ 
+ 				$bp_uri = array_values( $bp_uri );
+ 			}
+ 		}
+  	}
 
-	/* Set the indexes, these are incresed by one if we are not on a VHOST install */
-	$component_index = 0;
-	$action_index = $component_index + 1;
+	// Set the indexes, these are incresed by one if we are not on a VHOST install
+	$component_index 	= 0;
+	$action_index 		= $component_index + 1;
 
-	/* Get site path items */
+	// Get site path items
 	$paths = explode( '/', bp_core_get_site_path() );
 
-	/* Take empties off the end of path */
+	// Take empties off the end of path
 	if ( empty( $paths[count($paths) - 1] ) )
 		array_pop( $paths );
 
-	/* Take empties off the start of path */
+	// Take empties off the start of path
 	if ( empty( $paths[0] ) )
 		array_shift( $paths );
 
@@ -89,14 +103,14 @@
 		}
 	}
 
-	/* Reset the keys by merging with an empty array */
-	$bp_uri = array_merge( array(), $bp_uri );
-	$bp_unfiltered_uri = $bp_uri;
+	// Reset the keys by merging with an empty array
+	$bp_uri		 		= array_merge( array(), $bp_uri );
+	$bp_unfiltered_uri 	= $bp_uri;
 
-	/* Find a match within registered BuddyPress controlled WP pages (check members first) */
+	// Find a match within registered BuddyPress controlled WP pages (check members first)
 	foreach ( (array)$bp_pages as $page_key => $bp_page ) {
 		if ( in_array( $bp_page->name, (array)$bp_uri ) ) {
-			/* Match found, now match the slug to make sure. */
+			// Match found, now match the slug to make sure.
 			$uri_chunks = explode( '/', $bp_page->slug );
 
 			foreach ( (array)$uri_chunks as $key => $uri_chunk ) {
@@ -119,11 +133,11 @@
 		unset( $uri_chunks );
 	}
 
-	/* This is not a BuddyPress page, so just return. */
+	// This is not a BuddyPress page, so just return.
 	if ( in_array( 0, (array) $matches ) )
 		return false;
 
-	/* Find the offset */
+	// Find the offset
 	$uri_offset = 0;
 	$slug = explode( '/', $match->slug );
 
@@ -132,10 +146,10 @@
 		$uri_offset = count( $slug );
 	}
 
-	/* Global the unfiltered offset to use in bp_core_load_template() */
+	// Global the unfiltered offset to use in bp_core_load_template()
 	$bp_unfiltered_uri_offset = $uri_offset;
 
-	/* This is a members page so lets check if we have a displayed member */
+	// This is a members page so lets check if we have a displayed member
 	if ( 'members' == $match->key ) {
 		if ( !empty( $bp_uri[$uri_offset + 1] ) ) {
 			if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
@@ -145,7 +159,7 @@
 
 			$uri_offset = $uri_offset + 2;
 
-			/* Remove everything from the URI up to the offset and take it from there. */
+			// Remove everything from the URI up to the offset and take it from there.
 			for ( $i = 0; $i < $uri_offset; $i++ )
 				unset( $bp_uri[$i] );
 
@@ -153,10 +167,10 @@
 		}
 	}
 
-	/* Reset the keys by merging with an empty array */
+	// Reset the keys by merging with an empty array
 	$bp_uri = array_merge( array(), $bp_uri );
 
-	/* Set the current component */
+	// Set the current component
 	if ( empty( $current_component ) ) {
 		for ( $i = 0; $i <= $uri_offset; $i++ ) {
 			if ( !empty( $bp_uri[$i] ) ) {
@@ -169,21 +183,21 @@
 	} else
 		$i = 1;
 
-	/* Set the current action */
+	// Set the current action
 	$current_action = $bp_uri[$i];
 
-	/* Unset the current_component and action from action_variables */
+	// Unset the current_component and action from action_variables
 	for ( $j = 0; $j <= $i; $j++ )
 		unset( $bp_uri[$j] );
 
-	/* Set the entire URI as the action variables, we will unset the current_component and action in a second */
+	// Set the entire URI as the action variables, we will unset the current_component and action in a second
 	$action_variables = $bp_uri;
 
-	/* Remove the username from action variables if this is not a VHOST install */
+	// Remove the username from action variables if this is not a VHOST install
 	if ( 'no' == VHOST && !$is_root_component )
 		array_shift($bp_uri);
 
-	/* Reset the keys by merging with an empty array */
+	// Reset the keys by merging with an empty array
 	$action_variables = array_merge( array(), $action_variables );
 
 	//var_dump($current_component, $current_action, $bp_uri);
Index: bp-friends/bp-friends-notifications.php
===================================================================
--- bp-friends/bp-friends-notifications.php	(revision 3295)
+++ bp-friends/bp-friends-notifications.php	(working copy)
@@ -5,7 +5,7 @@
 
 	$initiator_name = bp_core_get_user_displayname( $initiator_id );
 
-	if ( 'no' == get_usermeta( (int)$friend_id, 'notification_friends_friendship_request' ) )
+	if ( 'no' == get_user_meta( (int)$friend_id, 'notification_friends_friendship_request', true ) )
 		return false;
 
 	$ud = get_userdata( $friend_id );
@@ -17,8 +17,9 @@
 	$initiator_link = bp_core_get_user_domain( $initiator_id );
 
 	// Set up and send the message
-	$to = $ud->user_email;
-	$subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'New friendship request from %s', 'buddypress' ), $initiator_name );
+	$to       = $ud->user_email;
+	$sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
+	$subject  = '[' . $sitename . '] ' . sprintf( __( 'New friendship request from %s', 'buddypress' ), $initiator_name );
 
 	$message = sprintf( __(
 "%1$s wants to add you as a friend.
@@ -47,7 +48,7 @@
 
 	$friend_name = bp_core_get_user_displayname( $friend_id );
 
-	if ( 'no' == get_usermeta( (int)$initiator_id, 'notification_friends_friendship_accepted' ) )
+	if ( 'no' == get_user_meta( (int)$initiator_id, 'notification_friends_friendship_accepted', true ) )
 		return false;
 
 	$ud = get_userdata( $initiator_id );
@@ -56,8 +57,9 @@
 	$settings_link = bp_core_get_user_domain( $initiator_id ) .  BP_SETTINGS_SLUG . '/notifications';
 
 	// Set up and send the message
-	$to = $ud->user_email;
-	$subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( '%s accepted your friendship request', 'buddypress' ), $friend_name );
+	$to       = $ud->user_email;
+	$sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
+	$subject  = '[' . $sitename . '] ' . sprintf( __( '%s accepted your friendship request', 'buddypress' ), $friend_name );
 
 	$message = sprintf( __(
 '%1$s accepted your friend request.
Index: bp-friends/bp-friends-templatetags.php
===================================================================
--- bp-friends/bp-friends-templatetags.php	(revision 3295)
+++ bp-friends/bp-friends-templatetags.php	(working copy)
@@ -108,7 +108,7 @@
 		<input type="search" name="friend-search-box" id="friend-search-box" value="<?php echo $value ?>"<?php echo $disabled ?> />
 
 		<?php wp_nonce_field( 'friends_search', '_wpnonce_friend_search' ) ?>
-		<input type="hidden" name="initiator" id="initiator" value="<?php echo attribute_escape( $bp->displayed_user->id ) ?>" />
+		<input type="hidden" name="initiator" id="initiator" value="<?php echo esc_attr( $bp->displayed_user->id ) ?>" />
 
 		</form>
 	<?php
Index: bp-friends/bp-friends-classes.php
===================================================================
--- bp-friends/bp-friends-classes.php	(revision 3295)
+++ bp-friends/bp-friends-classes.php	(working copy)
@@ -60,10 +60,10 @@
 
 		if ( $this->id ) {
 			// Update
-			$result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = FROM_UNIXTIME(%d) ) WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) );
+			$result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = %s ) WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) );
 		} else {
 			// Save
-			$result = $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->friends->table_name} ( initiator_user_id, friend_user_id, is_confirmed, is_limited, date_created ) VALUES ( %d, %d, %d, %d, FROM_UNIXTIME(%d) )", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created ) );
+			$result = $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->friends->table_name} ( initiator_user_id, friend_user_id, is_confirmed, is_limited, date_created ) VALUES ( %d, %d, %d, %d, %s )", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created ) );
 			$this->id = $wpdb->insert_id;
 		}
 
@@ -126,10 +126,10 @@
 
 		$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d OR friend_user_id = %d) AND is_confirmed = 1", $user_id, $user_id ) );
 
-		if ( !$count )
-			return 0;
+		if ( !$count && !get_usermeta( $user_id, 'total_friend_count' ) )
+  			return 0;
 
-		update_usermeta( $user_id, 'total_friend_count', $count );
+		update_user_meta( $user_id, 'total_friend_count', $count );
 		return $count;
 	}
 
@@ -201,7 +201,7 @@
 	function accept($friendship_id) {
 		global $wpdb, $bp;
 
-	 	return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET is_confirmed = 1, date_created = FROM_UNIXTIME(%d) WHERE id = %d AND friend_user_id = %d", time(), $friendship_id, $bp->loggedin_user->id ) );
+	 	return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET is_confirmed = 1, date_created = %s WHERE id = %d AND friend_user_id = %d", bp_core_current_time(), $friendship_id, $bp->loggedin_user->id ) );
 	}
 
 	function reject($friendship_id) {
@@ -313,11 +313,19 @@
 
 	function delete_all_for_user( $user_id ) {
 		global $wpdb, $bp;
+		
+		// Get friends of $user_id
+		$friend_ids = BP_Friends_Friendship::get_friend_user_ids( $user_id );
 
 		$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE friend_user_id = %d OR initiator_user_id = %d", $user_id, $user_id ) );
 
 		// Delete friend request notifications for members who have a notification from this user.
 		$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE component_name = 'friends' AND ( component_action = 'friendship_request' OR component_action = 'friendship_accepted' ) AND item_id = %d", $user_id ) );
+		
+		// Loop through friend_ids and update their counts
+		foreach ( (array)$friend_ids as $friend_id ) {
+			BP_Friends_Friendship::total_friend_count( $friend_id );
+		}
 	}
 }
 
Index: bp-activity/feeds/bp-activity-favorites-feed.php
===================================================================
--- bp-activity/feeds/bp-activity-favorites-feed.php	(revision 3295)
+++ bp-activity/feeds/bp-activity-favorites-feed.php	(working copy)
@@ -14,7 +14,7 @@
 	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
 	xmlns:dc="http://purl.org/dc/elements/1.1/"
 	xmlns:atom="http://www.w3.org/2005/Atom"
-	<?php do_action('bp_activity_mentions_feed'); ?>
+	<?php do_action('bp_activity_favorites_feed'); ?>
 >
 
 <channel>
Index: bp-activity/bp-activity-notifications.php
===================================================================
--- bp-activity/bp-activity-notifications.php	(revision 3295)
+++ bp-activity/bp-activity-notifications.php	(working copy)
@@ -4,7 +4,7 @@
 	global $bp;
 
 	/* Scan for @username strings in an activity update. Notify each user. */
-	$pattern = '/[@]+([A-Za-z0-9-_]+)/';
+	$pattern = '/[@]+([A-Za-z0-9-_\.]+)/';
 	preg_match_all( $pattern, $content, $usernames );
 
 	/* Make sure there's only one instance of each username */
@@ -16,7 +16,7 @@
 			continue;
 
 		// Now email the user with the contents of the message (if they have enabled email notifications)
-		if ( 'no' != get_usermeta( $receiver_user_id, 'notification_activity_new_mention' ) ) {
+		if ( 'no' != get_user_meta( $receiver_user_id, 'notification_activity_new_mention', true ) ) {
 			$poster_name = bp_core_get_user_displayname( $poster_user_id );
 
 			$message_link = bp_activity_get_permalink( $activity_id );
@@ -26,9 +26,10 @@
 			$content = bp_activity_filter_kses( stripslashes($content) );
 
 			// Set up and send the message
-			$ud = bp_core_get_core_userdata( $receiver_user_id );
-			$to = $ud->user_email;
-			$subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( '%s mentioned you in an update', 'buddypress' ), $poster_name );
+			$ud       = bp_core_get_core_userdata( $receiver_user_id );
+			$to       = $ud->user_email;
+			$sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
+			$subject  = '[' . $sitename . '] ' . sprintf( __( '%s mentioned you in an update', 'buddypress' ), $poster_name );
 
 $message = sprintf( __(
 '%1$s mentioned you in an update:
@@ -60,7 +61,7 @@
 
 	$original_activity = new BP_Activity_Activity( $activity_id );
 
-	if ( $original_activity->user_id != $commenter_id && 'no' != get_usermeta( $original_activity->user_id, 'notification_activity_new_reply' ) ) {
+	if ( $original_activity->user_id != $commenter_id && 'no' != get_user_meta( $original_activity->user_id, 'notification_activity_new_reply', true ) ) {
 		$poster_name = bp_core_get_user_displayname( $commenter_id );
 		$thread_link = bp_activity_get_permalink( $activity_id );
 		$settings_link = bp_core_get_user_domain( $original_activity->user_id ) .  BP_SETTINGS_SLUG . '/notifications/';
@@ -69,9 +70,10 @@
 		$content = bp_activity_filter_kses( stripslashes($content) );
 
 		// Set up and send the message
-		$ud = bp_core_get_core_userdata( $original_activity->user_id );
-		$to = $ud->user_email;
-		$subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( '%s replied to one of your updates', 'buddypress' ), $poster_name );
+		$ud       = bp_core_get_core_userdata( $original_activity->user_id );
+		$to       = $ud->user_email;
+		$sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
+		$subject = '[' . $sitename . '] ' . sprintf( __( '%s replied to one of your updates', 'buddypress' ), $poster_name );
 
 $message = sprintf( __(
 '%1$s replied to one of your updates:
@@ -102,15 +104,16 @@
 
 	$parent_comment = new BP_Activity_Activity( $parent_id );
 
-	if ( $parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id && 'no' != get_usermeta( $parent_comment->user_id, 'notification_activity_new_reply' ) ) {
+	if ( $parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id && 'no' != get_user_meta( $parent_comment->user_id, 'notification_activity_new_reply', true ) ) {
 		$poster_name = bp_core_get_user_displayname( $commenter_id );
 		$thread_link = bp_activity_get_permalink( $activity_id );
 		$settings_link = bp_core_get_user_domain( $parent_comment->user_id ) .  BP_SETTINGS_SLUG . '/notifications/';
 
 		// Set up and send the message
-		$ud = bp_core_get_core_userdata( $parent_comment->user_id );
-		$to = $ud->user_email;
-		$subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( '%s replied to one of your comments', 'buddypress' ), $poster_name );
+		$ud       = bp_core_get_core_userdata( $parent_comment->user_id );
+		$to       = $ud->user_email;
+		$sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
+		$subject = '[' . $sitename . '] ' . sprintf( __( '%s replied to one of your comments', 'buddypress' ), $poster_name );
 
 		$poster_name = stripslashes( $poster_name );
 		$content = bp_activity_filter_kses( stripslashes( $content ) );
@@ -136,4 +139,4 @@
 	}
 }
 
-?>
\ No newline at end of file
+?>
Index: bp-activity/bp-activity-templatetags.php
===================================================================
--- bp-activity/bp-activity-templatetags.php	(revision 3295)
+++ bp-activity/bp-activity-templatetags.php	(working copy)
@@ -25,7 +25,7 @@
 		$this->disable_blogforum_replies = $bp->site_options['bp-disable-blogforum-comments'];
 
 		// Get an array of the logged in user's favorite activities
-		$this->my_favs = maybe_unserialize( get_usermeta( $bp->loggedin_user->id, 'bp_favorite_activities' ) );
+		$this->my_favs = maybe_unserialize( get_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', true ) );
 
 		// Fetch specific activity items based on ID's
 		if ( !empty( $include ) )
@@ -154,7 +154,7 @@
 		$object = $bp->groups->id;
 		$primary_id = $bp->groups->current_group->id;
 
-		if ( 'public' != $bp->groups->current_group->status && groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
+		if ( 'public' != $bp->groups->current_group->status && ( groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) || $bp->loggedin_user->is_super_admin ) )
 			$show_hidden = true;
 	}
 
@@ -402,45 +402,119 @@
 		return apply_filters( 'bp_get_activity_user_link', $link );
 	}
 
+/**
+ * bp_activity_avatar( $args )
+ *
+ * Output the avatar of the user that performed the action
+ *
+ * @param array $args
+ */
 function bp_activity_avatar( $args = '' ) {
 	echo bp_get_activity_avatar( $args );
 }
+	/**
+	 * bp_get_activity_avatar( $args )
+	 *
+	 * Return the avatar of the user that performed the action
+	 *
+	 * @global array $bp
+	 * @global object $activities_template
+	 * @param array $args optional
+	 * @return string
+	 */
 	function bp_get_activity_avatar( $args = '' ) {
 		global $bp, $activities_template;
 
 		$defaults = array(
-			'type' => 'thumb',
-			'width' => 20,
+			'type'   => 'thumb',
+			'width'  => 20,
 			'height' => 20,
-			'class' => 'avatar',
-			'alt' => __( 'Avatar', 'buddypress' ),
-			'email' => false
+			'class'  => 'avatar',
+			'alt'    => __( 'Avatar', 'buddypress' ),
+			'email'  => false
 		);
 
 		$r = wp_parse_args( $args, $defaults );
 		extract( $r, EXTR_SKIP );
 
-		$item_id = false;
-		if ( (int)$activities_template->activity->user_id )
-			$item_id = $activities_template->activity->user_id;
-		else if ( $activities_template->activity->item_id )
-			$item_id = $activities_template->activity->item_id;
+		// Primary activity avatar is always a user, but can be modified via a filter
+		$object  = apply_filters( 'bp_get_activity_avatar_object_' . $activities_template->activity->component, 'user' );
+		$item_id = apply_filters( 'bp_get_activity_avatar_item_id', $activities_template->activity->user_id );
 
-		$object = 'user';
-		if ( $bp->groups->id == $activities_template->activity->component && !(int) $activities_template->activity->user_id )
-			$object = 'group';
-		if ( $bp->blogs->id == $activities_template->activity->component && !(int) $activities_template->activity->user_id )
-			$object = 'blog';
-
-		$object = apply_filters( 'bp_get_activity_avatar_object_' . $activities_template->activity->component, $object );
-
-		/* If this is a user object pass the users' email address for Gravatar so we don't have to refetch it. */
-		if ( 'user' == $object && empty($email) )
+		// If this is a user object pass the users' email address for Gravatar so we don't have to refetch it.
+		if ( 'user' == $object && empty( $email ) )
 			$email = $activities_template->activity->user_email;
 
 		return apply_filters( 'bp_get_activity_avatar', bp_core_fetch_avatar( array( 'item_id' => $item_id, 'object' => $object, 'type' => $type, 'alt' => $alt, 'class' => $class, 'width' => $width, 'height' => $height, 'email' => $email ) ) );
 	}
 
+/**
+ * bp_activity_secondary_avatar( $args )
+ *
+ * Output the avatar of the object that action was performed on
+ *
+ * @param array $args optional
+ */
+function bp_activity_secondary_avatar( $args = '' ) {
+	echo bp_get_activity_secondary_avatar( $args );
+}
+	/**
+	 * bp_get_activity_secondary_avatar( $args )
+	 *
+	 * Return the avatar of the object that action was performed on
+	 *
+	 * @global array $bp
+	 * @global object $activities_template
+	 * @param array $args optional
+	 * @return string
+	 */
+	function bp_get_activity_secondary_avatar( $args = '' ) {
+		global $bp, $activities_template;
+
+		$defaults = array(
+			'type'   => 'thumb',
+			'width'  => 20,
+			'height' => 20,
+			'class'  => 'avatar',
+			'alt'    => __( 'Avatar', 'buddypress' ),
+			'email'  => false
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		// Set item_id and object (default to user)
+		switch ( $activities_template->activity->component ) {
+			case 'groups' :
+				$object = 'group';
+				$item_id = $activities_template->activity->item_id;
+				break;
+			case 'blogs' :
+				$object = 'blog';
+				$item_id = $activities_template->activity->item_id;
+				break;
+			case 'friends' :
+				$object  = 'user';
+				$item_id = $activities_template->activity->secondary_item_id;
+				break;
+			default :
+				$object  = 'user';
+				$item_id = $activities_template->activity->user_id;
+				$email = $activities_template->activity->user_email;
+				break;
+		}
+
+		// Allow object and item_id to be filtered
+		$object  = apply_filters( 'bp_get_activity_secondary_avatar_object_' . $activities_template->activity->component, $object );
+		$item_id = apply_filters( 'bp_get_activity_secondary_avatar_item_id', $item_id );
+
+		// If we have no item_id or object, there is no avatar to display
+		if ( empty( $item_id ) || empty( $object ) )
+			return false;
+
+		return apply_filters( 'bp_get_activity_secondary_avatar', bp_core_fetch_avatar( array( 'item_id' => $item_id, 'object' => $object, 'type' => $type, 'alt' => $alt, 'class' => $class, 'width' => $width, 'height' => $height, 'email' => $email ) ) );
+	}
+
 function bp_activity_action() {
 	echo bp_get_activity_action();
 }
@@ -449,6 +523,8 @@
 
 		$action = $activities_template->activity->action;
 
+		$action = apply_filters( 'bp_get_activity_action_pre_meta', $action, &$activities_template->activity );
+
 		if ( !empty( $action ) )
 			$action = bp_insert_activity_meta( $action );
 
@@ -506,7 +582,7 @@
 		$meta .= apply_filters( 'bp_activity_permalink', ' &middot; <a href="' . bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ) . '" class="view" title="' . __( 'View Thread / Permalink', 'buddypress' ) . '">' . __( 'View', 'buddypress' ) . '</a>', &$activities_template->activity );
 
 		/* Add the delete link if the user has permission on this item */
-		if ( ( is_user_logged_in() && $activities_template->activity->user_id == $bp->loggedin_user->id ) || $bp->is_item_admin || $bp->loggedin_user->is_site_admin )
+		if ( ( is_user_logged_in() && $activities_template->activity->user_id == $bp->loggedin_user->id ) || $bp->is_item_admin || $bp->loggedin_user->is_super_admin )
 			 $meta .= apply_filters( 'bp_activity_delete_link', ' &middot; ' . bp_get_activity_delete_link(), &$activities_template->activity );
 
 		$meta .= '</span>';
@@ -585,14 +661,14 @@
 
 				$content .= '<li id="acomment-' . $comment->id . '">';
 				$content .= '<div class="acomment-avatar"><a href="' . bp_core_get_user_domain( $comment->user_id, $comment->user_nicename, $comment->user_login ) . '">' . bp_core_fetch_avatar( array( 'item_id' => $comment->user_id, 'width' => 25, 'height' => 25, 'email' => $comment->user_email ) ) . '</a></div>';
-				$content .= '<div class="acomment-meta"><a href="' . bp_core_get_user_domain( $comment->user_id, $comment->user_nicename, $comment->user_login ) . '">' . apply_filters( 'bp_get_member_name', $comment->user_fullname ) . '</a> &middot; ' . sprintf( __( '%s ago', 'buddypress' ), bp_core_time_since( strtotime( $comment->date_recorded ) ) );
+				$content .= '<div class="acomment-meta"><a href="' . bp_core_get_user_domain( $comment->user_id, $comment->user_nicename, $comment->user_login ) . '">' . apply_filters( 'bp_get_member_name', $comment->user_fullname ) . '</a> &middot; ' . sprintf( __( '%s ago', 'buddypress' ), bp_core_time_since( $comment->date_recorded ) );
 
 				/* Reply link - the span is so that threaded reply links can be hidden when JS is off. */
 				if ( is_user_logged_in() )
 					$content .= '<span class="acomment-replylink"> &middot; <a href="#acomment-' . $comment->id . '" class="acomment-reply" id="acomment-reply-' . $activities_template->activity->id . '">' . __( 'Reply', 'buddypress' ) . '</a></span>';
 
 				/* Delete link */
-				if ( $bp->loggedin_user->is_site_admin || $bp->loggedin_user->id == $comment->user_id )
+				if ( $bp->loggedin_user->is_super_admin || $bp->loggedin_user->id == $comment->user_id )
 					$content .= ' &middot; <a href="' . wp_nonce_url( $bp->root_domain . '/' . $bp->activity->slug . '/delete/?cid=' . $comment->id, 'bp_activity_delete_link' ) . '" class="delete acomment-delete">' . __( 'Delete', 'buddypress' ) . '</a>';
 
 				$content .= '</div>';
@@ -738,10 +814,10 @@
 		if ( !$user_id )
 			$user_id = $bp->displayed_user->id;
 
-		if ( !$update = get_usermeta( $user_id, 'bp_latest_update' ) )
+		if ( !$update = get_user_meta( $user_id, 'bp_latest_update', true ) )
 			return false;
 
-		$latest_update = '&quot;' . trim( strip_tags( bp_create_excerpt( $update['content'], 40 ) ) ) . '&quot;';
+		$latest_update = '&quot;' . apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 40 ) ) ) ) . '&quot;';
 		$latest_update .= ' &middot; <a href="' . $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $update['id'] . '/"> ' . __( 'View', 'buddypress' ) . '</a>';
 
 		return apply_filters( 'bp_get_activity_latest_update', $latest_update  );
@@ -776,7 +852,7 @@
 			else
 				unset($selected);
 
-			$component = attribute_escape( $component );
+			$component = esc_attr( $component );
 
 			switch ( $style ) {
 				case 'list':
@@ -804,13 +880,13 @@
 			/* Make sure all core internal component names are translatable */
 			$translatable_components = array( __( 'profile', 'buddypress'), __( 'friends', 'buddypress' ), __( 'groups', 'buddypress' ), __( 'status', 'buddypress' ), __( 'blogs', 'buddypress' ) );
 
-			$component_links[] = $before . '<a href="' . attribute_escape( $link ) . '">' . ucwords( __( $component, 'buddypress' ) ) . '</a>' . $after;
+			$component_links[] = $before . '<a href="' . esc_attr( $link ) . '">' . ucwords( __( $component, 'buddypress' ) ) . '</a>' . $after;
 		}
 
 		$link = remove_query_arg( 'afilter' , $link );
 
 		if ( isset( $_GET['afilter'] ) )
-			$component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' . attribute_escape( $link ) . '"">' . __( 'Clear Filter', 'buddypress' ) . '</a></' . $tag . '>';
+			$component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' . esc_attr( $link ) . '"">' . __( 'Clear Filter', 'buddypress' ) . '</a></' . $tag . '>';
 
  		return apply_filters( 'bp_get_activity_filter_links', implode( "\n", $component_links ) );
 	}
@@ -840,7 +916,7 @@
 	echo bp_get_total_favorite_count_for_user( $user_id );
 }
 	function bp_get_total_mention_count_for_user( $user_id = false ) {
-		return apply_filters( 'bp_get_total_mention_count_for_user', get_usermeta( $user_id, 'bp_new_mention_count' ) );
+		return apply_filters( 'bp_get_total_mention_count_for_user', get_user_meta( $user_id, 'bp_new_mention_count', true ) );
 	}
 
 function bp_send_public_message_link() {
Index: bp-activity/bp-activity-classes.php
===================================================================
--- bp-activity/bp-activity-classes.php	(revision 3295)
+++ bp-activity/bp-activity-classes.php	(working copy)
@@ -531,13 +531,13 @@
 	function get_last_updated() {
 		global $bp, $wpdb;
 
-		return $wpdb->get_var( $wpdb->prepare( "SELECT date_recorded FROM {$bp->activity->table_name} ORDER BY date_recorded ASC LIMIT 1" ) );
+		return $wpdb->get_var( $wpdb->prepare( "SELECT date_recorded FROM {$bp->activity->table_name} ORDER BY date_recorded DESC LIMIT 1" ) );
 	}
 
 	function total_favorite_count( $user_id ) {
 		global $bp;
 
-		if ( !$favorite_activity_entries = get_usermeta( $user_id, 'bp_favorite_activities' ) )
+		if ( !$favorite_activity_entries = get_user_meta( $user_id, 'bp_favorite_activities', true ) )
 			return 0;
 
 		return count( maybe_unserialize( $favorite_activity_entries ) );
Index: bp-loader.php
===================================================================
--- bp-loader.php	(revision 3295)
+++ bp-loader.php	(working copy)
@@ -6,6 +6,7 @@
 Author: The BuddyPress Community
 Version: 1.3-bleeding
 Author URI: http://buddypress.org/community/members/
+Network: true
 */
 
 define( 'BP_VERSION', '1.3-bleeding' );
Index: bp-blogs.php
===================================================================
--- bp-blogs.php	(revision 3295)
+++ bp-blogs.php	(working copy)
@@ -163,7 +163,7 @@
 		'type' => false,
 		'item_id' => false,
 		'secondary_item_id' => false,
-		'recorded_time' => gmdate( "Y-m-d H:i:s" ),
+		'recorded_time' => bp_core_current_time(),
 		'hide_sitewide' => false
 	);
 
@@ -178,7 +178,7 @@
 		$action = apply_filters( 'bp_blogs_record_activity_action', $action );
 
 	if ( !empty( $content ) )
-		$content = apply_filters( 'bp_blogs_record_activity_content', bp_create_excerpt( $content ) );
+		$content = apply_filters( 'bp_blogs_record_activity_content', bp_create_excerpt( $content ), $content );
 
 	/* Check for an existing entry and update if one exists. */
 	$id = bp_activity_get_activity_id( array(
@@ -291,12 +291,12 @@
 	bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'description', $description );
 	bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
 
-	/* Only record this activity if the blog is public */
+	// Only record this activity if the blog is public
 	if ( (int)$_POST['blog_public'] && !$no_activity ) {
-		/* Record this in activity streams */
+		// Record this in activity streams
 		bp_blogs_record_activity( array(
 			'user_id' => $recorded_blog->user_id,
-			'action' => apply_filters( 'bp_blogs_activity_created_blog_action', sprintf( __( '%1$s created the blog %2$s', 'buddypress'), bp_core_get_userlink( $recorded_blog->user_id ), '<a href="' . get_blog_option( $recorded_blog->blog_id, 'siteurl' ) . '">' . attribute_escape( $name ) . '</a>' ), &$recorded_blog, $name, $description ),
+			'action' => apply_filters( 'bp_blogs_activity_created_blog_action', sprintf( __( '%1$s created the blog %2$s', 'buddypress'), bp_core_get_userlink( $recorded_blog->user_id ), '<a href="' . get_blog_option( $recorded_blog->blog_id, 'siteurl' ) . '">' . esc_attr( $name ) . '</a>' ), &$recorded_blog, $name, $description ),
 			'primary_link' => apply_filters( 'bp_blogs_activity_created_blog_primary_link', get_blog_option( $recorded_blog->blog_id, 'siteurl' ), $recorded_blog->blog_id ),
 			'type' => 'new_blog',
 			'item_id' => $recorded_blog->blog_id
@@ -307,6 +307,36 @@
 }
 add_action( 'wpmu_new_blog', 'bp_blogs_record_blog', 10, 2 );
 
+/**
+ * bp_blogs_update_option_blogname()
+ *
+ * Updates blogname in BuddyPress blogmeta table
+ *
+ * @global object $wpdb DB Layer
+ * @param string $oldvalue Value before save (not used)
+ * @param string $newvalue Value to change meta to
+ */
+function bp_blogs_update_option_blogname( $oldvalue, $newvalue ) {
+	global $wpdb;
+	bp_blogs_update_blogmeta( $wpdb->blogid, 'name', $newvalue );
+}
+add_action( 'update_option_blogname', 'bp_blogs_update_option_blogname', 10, 2 );
+
+/**
+ * bp_blogs_update_option_blogdescription()
+ *
+ * Updates blogdescription in BuddyPress blogmeta table
+ *
+ * @global object $wpdb DB Layer
+ * @param string $oldvalue Value before save (not used)
+ * @param string $newvalue Value to change meta to
+ */
+function bp_blogs_update_option_blogdescription( $oldvalue, $newvalue ) {
+	global $wpdb;
+	bp_blogs_update_blogmeta( $wpdb->blogid, 'description', $newvalue );
+}
+add_action( 'update_option_blogdescription', 'bp_blogs_update_option_blogdescription', 10, 2 );
+
 function bp_blogs_record_post( $post_id, $post, $user_id = false ) {
 	global $bp, $wpdb;
 
Index: bp-messages.php
===================================================================
--- bp-messages.php	(revision 3295)
+++ bp-messages.php	(working copy)
@@ -5,7 +5,7 @@
 require ( BP_PLUGIN_DIR . '/bp-messages/bp-messages-filters.php' );
 
 function messages_setup_globals() {
-	global $bp, $wpdb;
+	global $bp;
 
 	if ( !defined( 'BP_MESSAGES_SLUG' ) )
 		define ( 'BP_MESSAGES_SLUG', 'messages' );
@@ -13,9 +13,9 @@
 	/* For internal identification */
 	$bp->messages->id = 'messages';
 
-	$bp->messages->table_name_messages = $wpdb->base_prefix . 'bp_messages_messages';
-	$bp->messages->table_name_recipients = $wpdb->base_prefix . 'bp_messages_recipients';
-	$bp->messages->table_name_notices = $wpdb->base_prefix . 'bp_messages_notices';
+	$bp->messages->table_name_messages 		= $bp->base_prefix . 'bp_messages_messages';
+	$bp->messages->table_name_recipients 	= $bp->base_prefix . 'bp_messages_recipients';
+	$bp->messages->table_name_notices 		= $bp->base_prefix . 'bp_messages_notices';
 	$bp->messages->format_notification_function = 'messages_format_notifications';
 	$bp->messages->slug = BP_MESSAGES_SLUG;
 
@@ -44,8 +44,8 @@
 	bp_core_new_subnav_item( array( 'name' => __( 'Sent Messages', 'buddypress' ), 'slug' => 'sentbox', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_sentbox', 'position' => 20, 'user_has_access' => bp_is_my_profile() ) );
 	bp_core_new_subnav_item( array( 'name' => __( 'Compose', 'buddypress' ), 'slug' => 'compose', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_compose', 'position' => 30, 'user_has_access' => bp_is_my_profile() ) );
 
-	if ( is_site_admin() )
-		bp_core_new_subnav_item( array( 'name' => __( 'Notices', 'buddypress' ), 'slug' => 'notices', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_notices', 'position' => 90, 'user_has_access' => is_site_admin() ) );
+	if ( is_super_admin() )
+		bp_core_new_subnav_item( array( 'name' => __( 'Notices', 'buddypress' ), 'slug' => 'notices', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_notices', 'position' => 90, 'user_has_access' => is_super_admin() ) );
 
 	if ( $bp->current_component == $bp->messages->slug ) {
 		if ( bp_is_my_profile() ) {
@@ -84,17 +84,17 @@
 	// Remove any saved message data from a previous session.
 	messages_remove_callback_values();
 
-	/* Check if the message form has been submitted */
+	// Check if the message form has been submitted
 	if ( isset( $_POST['send'] ) ) {
 
-		/* Check the nonce */
+		// Check the nonce
 		check_admin_referer( 'messages_send_message' );
 
-		/* Check we have what we need */
+		// Check we have what we need
 		if ( empty( $_POST['subject'] ) || empty( $_POST['content'] ) ) {
 			bp_core_add_message( __( 'There was an error sending that message, please try again', 'buddypress' ), 'error' );
 		} else {
-			/* If this is a notice, send it */
+			// If this is a notice, send it
 			if ( isset( $_POST['send-notice'] ) ) {
 				if ( messages_send_notice( $_POST['subject'], $_POST['content'] ) ) {
 					bp_core_add_message( __( 'Notice sent successfully!', 'buddypress' ) );
@@ -103,12 +103,13 @@
 					bp_core_add_message( __( 'There was an error sending that notice, please try again', 'buddypress' ), 'error' );
 				}
 			} else {
-				/* Filter recipients into the format we need - array( 'username/userid', 'username/userid' ) */
+				// Filter recipients into the format we need - array( 'username/userid', 'username/userid' )
 				$autocomplete_recipients = explode( ',', $_POST['send-to-input'] );
-				$typed_recipients = explode( ' ', $_POST['send_to_usernames'] );
-				$recipients = array_merge( (array) $autocomplete_recipients, (array) $typed_recipients );
+				$typed_recipients        = explode( ' ', $_POST['send_to_usernames'] );
+				$recipients              = array_merge( (array) $autocomplete_recipients, (array) $typed_recipients );
+				$recipients              = apply_filters( 'bp_messages_recipients', $recipients );
 
-				/* Send the message */
+				// Send the message
 				if ( $thread_id = messages_new_message( array( 'recipients' => $recipients, 'subject' => $_POST['subject'], 'content' => $_POST['content'] ) ) ) {
 					bp_core_add_message( __( 'Message sent successfully!', 'buddypress' ) );
 					bp_core_redirect( $bp->loggedin_user->domain . $bp->messages->slug . '/view/' . $thread_id . '/' );
@@ -117,7 +118,6 @@
 				}
 			}
 		}
-
 	}
 
 	do_action( 'messages_screen_compose' );
@@ -128,7 +128,7 @@
 function messages_screen_notices() {
 	global $bp, $notice_id;
 
-	if ( !is_site_admin() )
+	if ( !is_super_admin() )
 		return false;
 
 	$notice_id = $bp->action_variables[1];
@@ -165,27 +165,32 @@
 
 function messages_screen_notification_settings() {
 	global $current_user; ?>
-	<table class="notification-settings" id="messages-notification-settings">
-		<tr>
-			<th class="icon"></th>
-			<th class="title"><?php _e( 'Messages', 'buddypress' ) ?></th>
-			<th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
-			<th class="no"><?php _e( 'No', 'buddypress' )?></th>
-		</tr>
-		<tr>
-			<td></td>
-			<td><?php _e( 'A member sends you a new message', 'buddypress' ) ?></td>
-			<td class="yes"><input type="radio" name="notifications[notification_messages_new_message]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_messages_new_message' ) || 'yes' == get_usermeta( $current_user->id, 'notification_messages_new_message' ) ) { ?>checked="checked" <?php } ?>/></td>
-			<td class="no"><input type="radio" name="notifications[notification_messages_new_message]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_messages_new_message' ) ) { ?>checked="checked" <?php } ?>/></td>
-		</tr>
-		<tr>
-			<td></td>
-			<td><?php _e( 'A new site notice is posted', 'buddypress' ) ?></td>
-			<td class="yes"><input type="radio" name="notifications[notification_messages_new_notice]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_messages_new_notice' ) || 'yes' == get_usermeta( $current_user->id, 'notification_messages_new_notice' ) ) { ?>checked="checked" <?php } ?>/></td>
-			<td class="no"><input type="radio" name="notifications[notification_messages_new_notice]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_messages_new_notice' ) ) { ?>checked="checked" <?php } ?>/></td>
-		</tr>
+	<table class="notification-settings zebra" id="messages-notification-settings">
+		<thead>
+			<tr>
+				<th class="icon"></th>
+				<th class="title"><?php _e( 'Messages', 'buddypress' ) ?></th>
+				<th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
+				<th class="no"><?php _e( 'No', 'buddypress' )?></th>
+			</tr>
+		</thead>
 
-		<?php do_action( 'messages_screen_notification_settings' ) ?>
+		<tbody>
+			<tr>
+				<td></td>
+				<td><?php _e( 'A member sends you a new message', 'buddypress' ) ?></td>
+				<td class="yes"><input type="radio" name="notifications[notification_messages_new_message]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_messages_new_message', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_messages_new_message', true ) ) { ?>checked="checked" <?php } ?>/></td>
+				<td class="no"><input type="radio" name="notifications[notification_messages_new_message]" value="no" <?php if ( 'no' == get_user_meta( $current_user->id, 'notification_messages_new_message', true ) ) { ?>checked="checked" <?php } ?>/></td>
+			</tr>
+			<tr>
+				<td></td>
+				<td><?php _e( 'A new site notice is posted', 'buddypress' ) ?></td>
+				<td class="yes"><input type="radio" name="notifications[notification_messages_new_notice]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_messages_new_notice', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_messages_new_notice', true ) ) { ?>checked="checked" <?php } ?>/></td>
+				<td class="no"><input type="radio" name="notifications[notification_messages_new_notice]" value="no" <?php if ( 'no' == get_user_meta( $current_user->id, 'notification_messages_new_notice', true ) ) { ?>checked="checked" <?php } ?>/></td>
+			</tr>
+
+			<?php do_action( 'messages_screen_notification_settings' ) ?>
+		</tbody>
 	</table>
 <?php
 }
@@ -208,7 +213,7 @@
 
 	$thread_id = $bp->action_variables[0];
 
-	if ( !$thread_id || !messages_is_valid_thread( $thread_id ) || ( !messages_check_thread_access($thread_id) && !is_site_admin() ) )
+	if ( !$thread_id || !messages_is_valid_thread( $thread_id ) || ( !messages_check_thread_access($thread_id) && !is_super_admin() ) )
 		bp_core_redirect( $bp->displayed_user->domain . $bp->current_component );
 
 	/* Check if a new reply has been submitted */
@@ -327,7 +332,7 @@
 		'recipients' => false, // Can be an array of usernames, user_ids or mixed.
 		'subject' => false,
 		'content' => false,
-		'date_sent' => time()
+		'date_sent' => bp_core_current_time()
 	);
 
 	$r = wp_parse_args( $args, $defaults );
@@ -344,14 +349,19 @@
 	$message->message = $content;
 	$message->date_sent = $date_sent;
 
-	/* If we have a thread ID, use the existing recipients, otherwise use the recipients passed */
+	// If we have a thread ID, use the existing recipients, otherwise use the recipients passed
 	if ( $thread_id ) {
 		$thread = new BP_Messages_Thread( $thread_id );
 		$message->recipients = $thread->get_recipients();
 
+		// Strip the sender from the recipient list if they exist
+		if ( isset( $message->recipients[$sender_id] ) )
+			unset( $message->recipients[$sender_id] );
+
 		if ( empty( $message->subject ) )
 			$message->subject = sprintf( __( 'Re: %s', 'buddypress' ), $thread->messages[0]->subject );
 
+	// No thread ID, so make some adjustments
 	} else {
 		if ( empty( $recipients ) )
 			return false;
@@ -405,14 +415,14 @@
 
 
 function messages_send_notice( $subject, $message ) {
-	if ( !is_site_admin() || empty( $subject ) || empty( $message ) ) {
+	if ( !is_super_admin() || empty( $subject ) || empty( $message ) ) {
 		return false;
 	} else {
 		// Has access to send notices, lets do it.
 		$notice = new BP_Messages_Notice;
 		$notice->subject = $subject;
 		$notice->message = $message;
-		$notice->date_sent = time();
+		$notice->date_sent = bp_core_current_time();
 		$notice->is_active = 1;
 		$notice->save(); // send it.
 
Index: bp-forums.php
===================================================================
--- bp-forums.php	(revision 3295)
+++ bp-forums.php	(working copy)
@@ -62,7 +62,7 @@
 
 			if ( $bp->groups->current_group = groups_get_group( array( 'group_id' => $_POST['topic_group_id'] ) ) ) {
 				/* Auto join this user if they are not yet a member of this group */
-				if ( !is_site_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
+				if ( !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
 					groups_join_group( $bp->groups->current_group->id, $bp->groups->current_group->id );
 
 				if ( $forum_id = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' ) ) {
@@ -72,6 +72,8 @@
 						bp_core_add_message( __( 'The topic was created successfully', 'buddypress') );
 
 					bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . '/forum/topic/' . $topic->topic_slug . '/' );
+				} else {
+					bp_core_add_message( __( 'Please pick the group forum where you would like to post this topic.', 'buddypress' ), 'error' );
 				}
 			}
 		}
@@ -86,7 +88,7 @@
 function bp_forums_add_admin_menu() {
 	global $bp;
 
-	if ( !is_site_admin() )
+	if ( !is_super_admin() )
 		return false;
 
 	require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-admin.php' );
@@ -120,6 +122,25 @@
 	return bb_new_forum( array( 'forum_name' => stripslashes( $forum_name ), 'forum_desc' => stripslashes( $forum_desc ), 'forum_parent' => $forum_parent_id, 'forum_order' => $forum_order, 'forum_is_category' => $forum_is_category ) );
 }
 
+function bp_forums_update_forum( $args = '' ) {
+	do_action( 'bbpress_init' );
+
+	$defaults = array(
+		'forum_id'			=> '',
+		'forum_name'		=> '',
+		'forum_desc'		=> '',
+		'forum_slug'		=> '',
+		'forum_parent_id'	=> BP_FORUMS_PARENT_FORUM_ID,
+		'forum_order'		=> false,
+		'forum_is_category'	=> 0
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	return bb_update_forum( array( 'forum_id' => (int)$forum_id, 'forum_name' => stripslashes( $forum_name ), 'forum_desc' => stripslashes( $forum_desc ), 'forum_slug' => stripslashes( $forum_slug ), 'forum_parent' => $forum_parent_id, 'forum_order' => $forum_order, 'forum_is_category' => $forum_is_category ) );
+}
+
 /* Topic Functions */
 
 function bp_forums_get_forum_topics( $args = '' ) {
@@ -500,7 +521,7 @@
 function bp_forums_filter_caps( $allcaps ) {
 	global $bp, $wp_roles, $bb_table_prefix;
 
-	$bb_cap = get_usermeta( $bp->loggedin_user->id, $bb_table_prefix . 'capabilities' );
+	$bb_cap = get_user_meta( $bp->loggedin_user->id, $bb_table_prefix . 'capabilities', true );
 
 	if ( empty( $bb_cap ) )
 		return $allcaps;
Index: bp-groups.php
===================================================================
--- bp-groups.php	(revision 3295)
+++ bp-groups.php	(working copy)
@@ -15,9 +15,9 @@
 	$bp->groups->name = $bp->pages->groups->name;
 	$bp->groups->slug = BP_GROUPS_SLUG;
 
-	$bp->groups->table_name = $wpdb->base_prefix . 'bp_groups';
-	$bp->groups->table_name_members = $wpdb->base_prefix . 'bp_groups_members';
-	$bp->groups->table_name_groupmeta = $wpdb->base_prefix . 'bp_groups_groupmeta';
+	$bp->groups->table_name = $bp->base_prefix . 'bp_groups';
+	$bp->groups->table_name_members = $bp->base_prefix . 'bp_groups_members';
+	$bp->groups->table_name_groupmeta = $bp->base_prefix . 'bp_groups_groupmeta';
 	$bp->groups->format_notification_function = 'groups_format_notifications';
 
 	/* Register this in the active components array */
@@ -36,6 +36,9 @@
 
 	$bp->groups->valid_status = apply_filters( 'groups_valid_status', array( 'public', 'private', 'hidden' ) );
 
+	// Auto join group when non group member performs group activity
+	$bp->groups->auto_join = defined( 'BP_DISABLE_AUTO_GROUP_JOIN' ) ? false : true;
+
 	do_action( 'groups_setup_globals' );
 }
 add_action( 'bp_setup_globals', 'groups_setup_globals' );
@@ -50,7 +53,7 @@
 		$bp->groups->current_group = new BP_Groups_Group( $group_id );
 
 		/* Using "item" not "group" for generic support in other components. */
-		if ( is_site_admin() )
+		if ( is_super_admin() )
 			$bp->is_item_admin = 1;
 		else
 			$bp->is_item_admin = groups_is_user_admin( $bp->loggedin_user->id, $bp->groups->current_group->id );
@@ -99,13 +102,13 @@
 			$bp->bp_options_title = $bp->groups->current_group->name;
 
 			if ( !$bp->bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->groups->current_group->id, 'object' => 'group', 'type' => 'thumb', 'avatar_dir' => 'group-avatars', 'alt' => __( 'Group Avatar', 'buddypress' ) ) ) )
-				$bp->bp_options_avatar = '<img src="' . attribute_escape( $group->avatar_full ) . '" class="avatar" alt="' . attribute_escape( $group->name ) . '" />';
+				$bp->bp_options_avatar = '<img src="' . esc_attr( $group->avatar_full ) . '" class="avatar" alt="' . esc_attr( $group->name ) . '" />';
 
 			$group_link = $bp->root_domain . '/' . $bp->groups->slug . '/' . $bp->groups->current_group->slug . '/';
 
 			// If this is a private or hidden group, does the user have access?
 			if ( 'private' == $bp->groups->current_group->status || 'hidden' == $bp->groups->current_group->status ) {
-				if ( $bp->groups->current_group->is_user_member && is_user_logged_in() || is_site_admin() )
+				if ( $bp->groups->current_group->is_user_member && is_user_logged_in() || is_super_admin() )
 					$bp->groups->current_group->user_has_access = true;
 				else
 					$bp->groups->current_group->user_has_access = false;
@@ -127,7 +130,7 @@
 				bp_core_new_subnav_item( array( 'name' => __( 'Admin', 'buddypress' ), 'slug' => 'admin', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_admin', 'position' => 20, 'user_has_access' => ( $bp->is_item_admin + (int)$bp->is_item_mod ), 'item_css_id' => 'admin' ) );
 
 			// If this is a private group, and the user is not a member, show a "Request Membership" nav item.
-			if ( !is_site_admin() && is_user_logged_in() && !$bp->groups->current_group->is_user_member && !groups_check_for_membership_request( $bp->loggedin_user->id, $bp->groups->current_group->id ) && $bp->groups->current_group->status == 'private' )
+			if ( !is_super_admin() && is_user_logged_in() && !$bp->groups->current_group->is_user_member && !groups_check_for_membership_request( $bp->loggedin_user->id, $bp->groups->current_group->id ) && $bp->groups->current_group->status == 'private' )
 				bp_core_new_subnav_item( array( 'name' => __( 'Request Membership', 'buddypress' ), 'slug' => 'request-membership', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_request_membership', 'position' => 30 ) );
 
 			if ( $bp->groups->current_group->enable_forum && function_exists('bp_forums_setup') )
@@ -165,7 +168,7 @@
 		return false;
 
 	/* Don't show this menu to non site admins or if you're viewing your own profile */
-	if ( !is_site_admin() )
+	if ( !is_super_admin() )
 		return false;
 	?>
 	<li id="bp-adminbar-adminoptions-menu">
@@ -225,7 +228,7 @@
 			$group = new BP_Groups_Group( $group_id );
 
 			groups_record_activity( array(
-				'action' => apply_filters( 'groups_activity_accepted_invite_action', sprintf( __( '%1$s joined the group %2$s', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . attribute_escape( $group->name ) . '</a>' ), $bp->loggedin_user->id, &$group ),
+				'action' => apply_filters( 'groups_activity_accepted_invite_action', sprintf( __( '%1$s joined the group %2$s', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . esc_attr( $group->name ) . '</a>' ), $bp->loggedin_user->id, &$group ),
 				'type' => 'joined_group',
 				'item_id' => $group->id
 			) );
@@ -291,7 +294,7 @@
 				check_admin_referer( 'bp_forums_new_reply' );
 
 				/* Auto join this user if they are not yet a member of this group */
-				if ( !is_site_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
+				if ( $bp->groups->auto_join && !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
 					groups_join_group( $bp->groups->current_group->id, $bp->loggedin_user->id );
 
 				if ( !$post_id = groups_new_group_forum_post( $_POST['reply_text'], $topic_id, $_GET['topic_page'] ) )
@@ -469,7 +472,7 @@
 				check_admin_referer( 'bp_forums_new_topic' );
 
 				/* Auto join this user if they are not yet a member of this group */
-				if ( !is_site_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
+				if ( $bp->groups->auto_join && !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
 					groups_join_group( $bp->groups->current_group->id, $bp->loggedin_user->id );
 
 				if ( !$topic = groups_new_group_forum_topic( $_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id ) )
@@ -710,16 +713,15 @@
 			$user_id = $bp->action_variables[3];
 			$status = $bp->action_variables[2];
 
-			/* Check the nonce first. */
+			// Check the nonce first.
 			if ( !check_admin_referer( 'groups_promote_member' ) )
 				return false;
 
 			// Promote a user.
-			if ( !groups_promote_member( $user_id, $bp->groups->current_group->id, $status ) ) {
+			if ( !groups_promote_member( $user_id, $bp->groups->current_group->id, $status ) )
 				bp_core_add_message( __( 'There was an error when promoting that user, please try again', 'buddypress' ), 'error' );
-			} else {
+			else
 				bp_core_add_message( __( 'User promoted successfully', 'buddypress' ) );
-			}
 
 			do_action( 'groups_promoted_member', $user_id, $bp->groups->current_group->id );
 
@@ -729,16 +731,15 @@
 		if ( 'demote' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
 			$user_id = $bp->action_variables[2];
 
-			/* Check the nonce first. */
+			// Check the nonce first.
 			if ( !check_admin_referer( 'groups_demote_member' ) )
 				return false;
 
 			// Demote a user.
-			if ( !groups_demote_member( $user_id, $bp->groups->current_group->id ) ) {
+			if ( !groups_demote_member( $user_id, $bp->groups->current_group->id ) )
 				bp_core_add_message( __( 'There was an error when demoting that user, please try again', 'buddypress' ), 'error' );
-			} else {
+			else
 				bp_core_add_message( __( 'User demoted successfully', 'buddypress' ) );
-			}
 
 			do_action( 'groups_demoted_member', $user_id, $bp->groups->current_group->id );
 
@@ -748,16 +749,15 @@
 		if ( 'ban' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
 			$user_id = $bp->action_variables[2];
 
-			/* Check the nonce first. */
+			// Check the nonce first.
 			if ( !check_admin_referer( 'groups_ban_member' ) )
 				return false;
 
 			// Ban a user.
-			if ( !groups_ban_member( $user_id, $bp->groups->current_group->id ) ) {
+			if ( !groups_ban_member( $user_id, $bp->groups->current_group->id ) )
 				bp_core_add_message( __( 'There was an error when banning that user, please try again', 'buddypress' ), 'error' );
-			} else {
+			else
 				bp_core_add_message( __( 'User banned successfully', 'buddypress' ) );
-			}
 
 			do_action( 'groups_banned_member', $user_id, $bp->groups->current_group->id );
 
@@ -767,22 +767,39 @@
 		if ( 'unban' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
 			$user_id = $bp->action_variables[2];
 
-			/* Check the nonce first. */
+			// Check the nonce first.
 			if ( !check_admin_referer( 'groups_unban_member' ) )
 				return false;
 
 			// Remove a ban for user.
-			if ( !groups_unban_member( $user_id, $bp->groups->current_group->id ) ) {
+			if ( !groups_unban_member( $user_id, $bp->groups->current_group->id ) )
 				bp_core_add_message( __( 'There was an error when unbanning that user, please try again', 'buddypress' ), 'error' );
-			} else {
+			else
 				bp_core_add_message( __( 'User ban removed successfully', 'buddypress' ) );
-			}
 
 			do_action( 'groups_unbanned_member', $user_id, $bp->groups->current_group->id );
 
 			bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
 		}
 
+		if ( 'remove' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
+			$user_id = $bp->action_variables[2];
+
+			// Check the nonce first.
+			if ( !check_admin_referer( 'groups_remove_member' ) )
+				return false;
+
+			// Remove a user.
+			if ( !groups_remove_member( $bp->groups->current_group->id, $user_id ) )
+				bp_core_add_message( __( 'There was an error removing that user from the group, please try again', 'buddypress' ), 'error' );
+			else
+				bp_core_add_message( __( 'User removed successfully', 'buddypress' ) );
+
+			do_action( 'groups_removed_member', $user_id, $bp->groups->current_group->id );
+
+			bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
+		}
+
 		do_action( 'groups_screen_group_admin_manage_members', $bp->groups->current_group->id );
 
 		bp_core_load_template( apply_filters( 'groups_template_group_admin_manage_members', 'groups/single/home' ) );
@@ -849,7 +866,7 @@
 
 	if ( $bp->current_component == $bp->groups->slug && 'delete-group' == $bp->action_variables[0] ) {
 
-		if ( !$bp->is_item_admin && !is_site_admin() )
+		if ( !$bp->is_item_admin && !is_super_admin() )
 			return false;
 
 		if ( isset( $_REQUEST['delete-group-button'] ) && isset( $_REQUEST['delete-group-understand'] ) ) {
@@ -880,39 +897,44 @@
 
 function groups_screen_notification_settings() {
 	global $current_user; ?>
-	<table class="notification-settings" id="groups-notification-settings">
-		<tr>
-			<th class="icon"></th>
-			<th class="title"><?php _e( 'Groups', 'buddypress' ) ?></th>
-			<th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
-			<th class="no"><?php _e( 'No', 'buddypress' )?></th>
-		</tr>
-		<tr>
-			<td></td>
-			<td><?php _e( 'A member invites you to join a group', 'buddypress' ) ?></td>
-			<td class="yes"><input type="radio" name="notifications[notification_groups_invite]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_invite') || 'yes' == get_usermeta( $current_user->id, 'notification_groups_invite') ) { ?>checked="checked" <?php } ?>/></td>
-			<td class="no"><input type="radio" name="notifications[notification_groups_invite]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_groups_invite') ) { ?>checked="checked" <?php } ?>/></td>
-		</tr>
-		<tr>
-			<td></td>
-			<td><?php _e( 'Group information is updated', 'buddypress' ) ?></td>
-			<td class="yes"><input type="radio" name="notifications[notification_groups_group_updated]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_group_updated') || 'yes' == get_usermeta( $current_user->id, 'notification_groups_group_updated') ) { ?>checked="checked" <?php } ?>/></td>
-			<td class="no"><input type="radio" name="notifications[notification_groups_group_updated]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_groups_group_updated') ) { ?>checked="checked" <?php } ?>/></td>
-		</tr>
-		<tr>
-			<td></td>
-			<td><?php _e( 'You are promoted to a group administrator or moderator', 'buddypress' ) ?></td>
-			<td class="yes"><input type="radio" name="notifications[notification_groups_admin_promotion]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_admin_promotion') || 'yes' == get_usermeta( $current_user->id, 'notification_groups_admin_promotion') ) { ?>checked="checked" <?php } ?>/></td>
-			<td class="no"><input type="radio" name="notifications[notification_groups_admin_promotion]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_groups_admin_promotion') ) { ?>checked="checked" <?php } ?>/></td>
-		</tr>
-		<tr>
-			<td></td>
-			<td><?php _e( 'A member requests to join a private group for which you are an admin', 'buddypress' ) ?></td>
-			<td class="yes"><input type="radio" name="notifications[notification_groups_membership_request]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_membership_request') || 'yes' == get_usermeta( $current_user->id, 'notification_groups_membership_request') ) { ?>checked="checked" <?php } ?>/></td>
-			<td class="no"><input type="radio" name="notifications[notification_groups_membership_request]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_groups_membership_request') ) { ?>checked="checked" <?php } ?>/></td>
-		</tr>
+	<table class="notification-settings zebra" id="groups-notification-settings">
+		<thead>
+			<tr>
+				<th class="icon"></th>
+				<th class="title"><?php _e( 'Groups', 'buddypress' ) ?></th>
+				<th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
+				<th class="no"><?php _e( 'No', 'buddypress' )?></th>
+			</tr>
+		</thead>
 
-		<?php do_action( 'groups_screen_notification_settings' ); ?>
+		<tbody>
+			<tr>
+				<td></td>
+				<td><?php _e( 'A member invites you to join a group', 'buddypress' ) ?></td>
+				<td class="yes"><input type="radio" name="notifications[notification_groups_invite]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_groups_invite', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_groups_invite', true ) ) { ?>checked="checked" <?php } ?>/></td>
+				<td class="no"><input type="radio" name="notifications[notification_groups_invite]" value="no" <?php if ( 'no' == get_user_meta( $current_user->id, 'notification_groups_invite', true ) ) { ?>checked="checked" <?php } ?>/></td>
+			</tr>
+			<tr>
+				<td></td>
+				<td><?php _e( 'Group information is updated', 'buddypress' ) ?></td>
+				<td class="yes"><input type="radio" name="notifications[notification_groups_group_updated]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_groups_group_updated', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_groups_group_updated', true ) ) { ?>checked="checked" <?php } ?>/></td>
+				<td class="no"><input type="radio" name="notifications[notification_groups_group_updated]" value="no" <?php if ( 'no' == get_user_meta( $current_user->id, 'notification_groups_group_updated', true ) ) { ?>checked="checked" <?php } ?>/></td>
+			</tr>
+			<tr>
+				<td></td>
+				<td><?php _e( 'You are promoted to a group administrator or moderator', 'buddypress' ) ?></td>
+				<td class="yes"><input type="radio" name="notifications[notification_groups_admin_promotion]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_groups_admin_promotion', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_groups_admin_promotion', true ) ) { ?>checked="checked" <?php } ?>/></td>
+				<td class="no"><input type="radio" name="notifications[notification_groups_admin_promotion]" value="no" <?php if ( 'no' == get_user_meta( $current_user->id, 'notification_groups_admin_promotion', true ) ) { ?>checked="checked" <?php } ?>/></td>
+			</tr>
+			<tr>
+				<td></td>
+				<td><?php _e( 'A member requests to join a private group for which you are an admin', 'buddypress' ) ?></td>
+				<td class="yes"><input type="radio" name="notifications[notification_groups_membership_request]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_groups_membership_request', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_groups_membership_request', true ) ) { ?>checked="checked" <?php } ?>/></td>
+				<td class="no"><input type="radio" name="notifications[notification_groups_membership_request]" value="no" <?php if ( 'no' == get_user_meta( $current_user->id, 'notification_groups_membership_request', true ) ) { ?>checked="checked" <?php } ?>/></td>
+			</tr>
+
+			<?php do_action( 'groups_screen_notification_settings' ); ?>
+		</tbody>
 	</table>
 <?php
 }
@@ -1040,7 +1062,7 @@
 
 			/* Once we compelete all steps, record the group creation in the activity stream. */
 			groups_record_activity( array(
-				'action' => apply_filters( 'groups_activity_created_group_action', sprintf( __( '%1$s created the group %2$s', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' ) ),
+				'action' => apply_filters( 'groups_activity_created_group_action', sprintf( __( '%1$s created the group %2$s', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' ) ),
 				'type' => 'created_group',
 				'item_id' => $bp->groups->new_group_id
 			) );
@@ -1217,7 +1239,7 @@
 		'type' => false,
 		'item_id' => false,
 		'secondary_item_id' => false,
-		'recorded_time' => gmdate( "Y-m-d H:i:s" ),
+		'recorded_time' => bp_core_current_time(),
 		'hide_sitewide' => $hide_sitewide
 	);
 
@@ -1480,6 +1502,13 @@
 	return true;
 }
 
+/**
+ * Delete a group and all of its associated meta
+ *
+ * @global object $bp BuddyPress global settings
+ * @param int $group_id
+ * @since 1.0
+ */
 function groups_delete_group( $group_id ) {
 	global $bp;
 
@@ -1489,14 +1518,12 @@
 
 	// Get the group object
 	$group = new BP_Groups_Group( $group_id );
-
 	if ( !$group->delete() )
 		return false;
 
-	/* Delete all group activity from activity streams */
-	if ( function_exists( 'bp_activity_delete_by_item_id' ) ) {
+	// Delete all group activity from activity streams
+	if ( bp_is_active( 'activity' ) )
 		bp_activity_delete_by_item_id( array( 'item_id' => $group_id, 'component' => $bp->groups->id ) );
-	}
 
 	// Remove all outstanding invites for this group
 	groups_delete_all_group_invites( $group_id );
@@ -1504,8 +1531,14 @@
 	// Remove all notifications for any user belonging to this group
 	bp_core_delete_all_notifications_by_type( $group_id, $bp->groups->slug );
 
-	do_action( 'groups_delete_group', $group_id );
+	// Remove forum if component is active and current group has one
+	if ( function_exists( 'bp_forums_setup' ) && $group->enable_forum ) {
+		do_action( 'bbpress_init' );
+		bb_delete_forum( groups_get_groupmeta( $group_id, 'forum_id' ) );
+	}
 
+	do_action( 'groups_delete_group', $group_id);
+
 	return true;
 }
 
@@ -1566,7 +1599,7 @@
 	groups_update_groupmeta( $group_id, 'total_member_count', (int) groups_get_groupmeta( $group_id, 'total_member_count') - 1 );
 
 	/* Modify user's group memberhip count */
-	update_usermeta( $user_id, 'total_group_count', (int) get_usermeta( $user_id, 'total_group_count') - 1 );
+	update_user_meta( $user_id, 'total_group_count', (int) get_user_meta( $user_id, 'total_group_count', true ) - 1 );
 
 	/* If the user joined this group less than five minutes ago, remove the joined_group activity so
 	 * users cannot flood the activity stream by joining/leaving the group in quick succession.
@@ -1616,7 +1649,7 @@
 
 	/* Record this in activity streams */
 	groups_record_activity( array(
-		'action' => apply_filters( 'groups_activity_joined_group', sprintf( __( '%1$s joined the group %2$s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' ) ),
+		'action' => apply_filters( 'groups_activity_joined_group', sprintf( __( '%1$s joined the group %2$s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' ) ),
 		'type' => 'joined_group',
 		'item_id' => $group_id
 	) );
@@ -1743,6 +1776,18 @@
 	return BP_Groups_Member::check_is_banned( $user_id, $group_id );
 }
 
+/**
+ * Is the specified user the creator of the group?
+ *
+ * @param int $user_id
+ * @param int $group_id
+ * @since 1.2.6
+ * @uses BP_Groups_Member
+ */
+function groups_is_user_creator( $user_id, $group_id ) {
+	return BP_Groups_Member::check_is_creator( $user_id, $group_id );
+}
+
 /*** Group Activity Posting **************************************************/
 
 function groups_post_update( $args = '' ) {
@@ -1763,11 +1808,11 @@
 	$bp->groups->current_group = new BP_Groups_Group( $group_id );
 
 	/* Be sure the user is a member of the group before posting. */
-	if ( !is_site_admin() && !groups_is_user_member( $user_id, $group_id ) )
+	if ( !is_super_admin() && !groups_is_user_member( $user_id, $group_id ) )
 		return false;
 
 	/* Record this in activity streams */
-	$activity_action = sprintf( __( '%1$s posted an update in the group %2$s:', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' );
+	$activity_action = sprintf( __( '%1$s posted an update in the group %2$s:', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' );
 	$activity_content = $content;
 
 	$activity_id = groups_record_activity( array(
@@ -1808,6 +1853,24 @@
 	do_action( 'groups_new_group_forum', $forum, $group_id );
 }
 
+function groups_update_group_forum( $group_id ) {
+
+	$group = new BP_Groups_Group( $group_id );
+
+	if ( !$group->enable_forum || !function_exists( 'bp_forums_setup' ) )
+		return false;
+
+	$args = array(
+		'forum_id'      => groups_get_groupmeta( $group_id, 'forum_id' ),
+		'forum_name'    => $group->name,
+		'forum_desc'    => $group->desc,
+		'forum_slug'    => $group->slug
+	);
+
+	bp_forums_update_forum( apply_filters( 'groups_update_group_forum', $args ) );
+}
+add_action( 'groups_details_updated', 'groups_update_group_forum' );
+
 function groups_new_group_forum_post( $post_text, $topic_id, $page = false ) {
 	global $bp;
 
@@ -1820,7 +1883,7 @@
 	if ( $post_id = bp_forums_insert_post( array( 'post_text' => $post_text, 'topic_id' => $topic_id ) ) ) {
 		$topic = bp_forums_get_topic_details( $topic_id );
 
-		$activity_action = sprintf( __( '%1$s posted on the forum topic %2$s in the group %3$s:', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . attribute_escape( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' );
+		$activity_action = sprintf( __( '%1$s posted on the forum topic %2$s in the group %3$s:', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . esc_attr( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' );
 		$activity_content = bp_create_excerpt( $post_text );
 		$primary_link = bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/';
 
@@ -1859,7 +1922,7 @@
 	if ( $topic_id = bp_forums_new_topic( array( 'topic_title' => $topic_title, 'topic_text' => $topic_text, 'topic_tags' => $topic_tags, 'forum_id' => $forum_id ) ) ) {
 		$topic = bp_forums_get_topic_details( $topic_id );
 
-		$activity_action = sprintf( __( '%1$s started the forum topic %2$s in the group %3$s:', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . attribute_escape( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' );
+		$activity_action = sprintf( __( '%1$s started the forum topic %2$s in the group %3$s:', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . esc_attr( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' );
 		$activity_content = bp_create_excerpt( $topic_text );
 
 		/* Record this in activity streams */
@@ -1891,7 +1954,7 @@
 		if ( function_exists( 'bp_activity_delete_by_item_id' ) )
 			bp_activity_delete_by_item_id( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $topic_id, 'component' => $bp->groups->id, 'type' => 'new_forum_topic' ) );
 
-		$activity_action = sprintf( __( '%1$s started the forum topic %2$s in the group %3$s:', 'buddypress'), bp_core_get_userlink( $topic->topic_poster ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . attribute_escape( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' );
+		$activity_action = sprintf( __( '%1$s started the forum topic %2$s in the group %3$s:', 'buddypress'), bp_core_get_userlink( $topic->topic_poster ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . esc_attr( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' );
 		$activity_content = bp_create_excerpt( $topic_text );
 
 		/* Record this in activity streams */
@@ -1925,7 +1988,7 @@
 	if ( $post_id = bp_forums_insert_post( array( 'post_id' => $post_id, 'post_text' => $post_text, 'post_time' => $post->post_time, 'topic_id' => $topic_id, 'poster_id' => $post->poster_id ) ) ) {
 		$topic = bp_forums_get_topic_details( $topic_id );
 
-		$activity_action = sprintf( __( '%1$s posted on the forum topic %2$s in the group %3$s:', 'buddypress'), bp_core_get_userlink( $post->poster_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'">' . attribute_escape( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' );
+		$activity_action = sprintf( __( '%1$s posted on the forum topic %2$s in the group %3$s:', 'buddypress'), bp_core_get_userlink( $post->poster_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'">' . esc_attr( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' );
 		$activity_content = bp_create_excerpt( $post_text );
 		$primary_link = bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/';
 
@@ -2166,10 +2229,7 @@
 
 	do_action( 'groups_ban_member', $group_id, $user_id );
 
-	if ( !$member->ban() )
-		return false;
-
-	update_usermeta( $user_id, 'total_group_count', (int)$total_count - 1 );
+	return $member->ban();
 }
 
 function groups_unban_member( $user_id, $group_id ) {
@@ -2185,6 +2245,22 @@
 	return $member->unban();
 }
 
+/*** Group Removal *******************************************************/
+
+function groups_remove_member( $user_id, $group_id ) {
+	global $bp;
+
+	if ( !$bp->is_item_admin )
+		return false;
+
+	$member = new BP_Groups_Member( $user_id, $group_id );
+
+	do_action( 'groups_remove_member', $group_id, $user_id );
+
+	if ( !$member->remove( $user_id, $group_id ) )
+		return false;
+}
+
 /*** Group Membership ****************************************************/
 
 function groups_send_membership_request( $requesting_user_id, $group_id ) {
@@ -2246,7 +2322,7 @@
 	$group = new BP_Groups_Group( $group_id );
 
 	groups_record_activity( array(
-		'action' => apply_filters( 'groups_activity_membership_accepted_action', sprintf( __( '%1$s joined the group %2$s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . attribute_escape( $group->name ) . '</a>' ), $user_id, &$group ),
+		'action' => apply_filters( 'groups_activity_membership_accepted_action', sprintf( __( '%1$s joined the group %2$s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . esc_attr( $group->name ) . '</a>' ), $user_id, &$group ),
 		'type' => 'joined_group',
 		'item_id' => $group->id,
 		'user_id' => $user_id
@@ -2463,4 +2539,4 @@
 add_action( 'groups_created_group', 'bp_core_clear_cache' );
 add_action( 'groups_group_avatar_updated', 'bp_core_clear_cache' );
 
-?>
\ No newline at end of file
+?>
Index: bp-blogs/bp-blogs-widgets.php
===================================================================
--- bp-blogs/bp-blogs-widgets.php	(revision 3295)
+++ bp-blogs/bp-blogs-widgets.php	(working copy)
@@ -21,14 +21,11 @@
 	function widget($args, $instance) {
 		global $bp;
 
-	    extract( $args );
+		extract( $args );
 
 		echo $before_widget;
-		echo $before_title
-		   . $widget_name
-		   . $after_title; ?>
+		echo $before_title . $widget_name . $after_title;
 
-		<?php
 		if ( empty( $instance['max_posts'] ) || !$instance['max_posts'] )
 			$instance['max_posts'] = 10; ?>
 
@@ -80,7 +77,7 @@
 		$max_posts = strip_tags( $instance['max_posts'] );
 		?>
 
-		<p><label for="bp-blogs-widget-posts-max"><?php _e('Max posts to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_posts' ); ?>" name="<?php echo $this->get_field_name( 'max_posts' ); ?>" type="text" value="<?php echo attribute_escape( $max_posts ); ?>" style="width: 30%" /></label></p>
+		<p><label for="bp-blogs-widget-posts-max"><?php _e('Max posts to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_posts' ); ?>" name="<?php echo $this->get_field_name( 'max_posts' ); ?>" type="text" value="<?php echo esc_attr( $max_posts ); ?>" style="width: 30%" /></label></p>
 	<?php
 	}
 }
Index: bp-blogs/bp-blogs-templatetags.php
===================================================================
--- bp-blogs/bp-blogs-templatetags.php	(revision 3295)
+++ bp-blogs/bp-blogs-templatetags.php	(working copy)
@@ -269,15 +269,15 @@
 
 function bp_blog_hidden_fields() {
 	if ( isset( $_REQUEST['s'] ) ) {
-		echo '<input type="hidden" id="search_terms" value="' . attribute_escape( $_REQUEST['s'] ). '" name="search_terms" />';
+		echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['s'] ). '" name="search_terms" />';
 	}
 
 	if ( isset( $_REQUEST['letter'] ) ) {
-		echo '<input type="hidden" id="selected_letter" value="' . attribute_escape( $_REQUEST['letter'] ) . '" name="selected_letter" />';
+		echo '<input type="hidden" id="selected_letter" value="' . esc_attr( $_REQUEST['letter'] ) . '" name="selected_letter" />';
 	}
 
 	if ( isset( $_REQUEST['blogs_search'] ) ) {
-		echo '<input type="hidden" id="search_terms" value="' . attribute_escape( $_REQUEST['blogs_search'] ) . '" name="search_terms" />';
+		echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['blogs_search'] ) . '" name="search_terms" />';
 	}
 }
 
@@ -346,7 +346,7 @@
 		<form class="standard-form" id="setupform" method="post" action="">
 
 			<input type="hidden" name="stage" value="gimmeanotherblog" />
-			<?php do_action( "signup_hidden_fields" ); ?>
+			<?php do_action( 'signup_hidden_fields' ); ?>
 
 			<?php bp_blogs_signup_blog($blogname, $blog_title, $errors); ?>
 			<p>
@@ -363,7 +363,7 @@
 	global $current_site;
 
 	// Blog name
-	if( 'no' == constant( "VHOST" ) )
+	if( !is_subdomain_install() )
 		echo '<label for="blogname">' . __('Blog Name:', 'buddypress') . '</label>';
 	else
 		echo '<label for="blogname">' . __('Blog Domain:', 'buddypress') . '</label>';
@@ -372,18 +372,20 @@
 		<p class="error"><?php echo $errmsg ?></p>
 	<?php }
 
-	if( 'no' == constant( "VHOST" ) ) {
+	if ( !is_subdomain_install() )
 		echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span> <input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="50" /><br />';
-	} else {
+	else
 		echo '<input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="50" /> <span class="suffix_address">.' . $current_site->domain . $current_site->path . '</span><br />';
-	}
+
 	if ( !is_user_logged_in() ) {
 		print '(<strong>' . __( 'Your address will be ' , 'buddypress');
-		if( 'no' == constant( "VHOST" ) ) {
+
+		if ( !is_subdomain_install() ) {
 			print $current_site->domain . $current_site->path . __( 'blogname' , 'buddypress');
 		} else {
 			print __( 'domain.' , 'buddypress') . $current_site->domain . $current_site->path;
 		}
+
 		echo '.</strong> ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed so choose carefully!)' , 'buddypress') . '</p>';
 	}
 
Index: bp-blogs/bp-blogs-classes.php
===================================================================
--- bp-blogs/bp-blogs-classes.php	(revision 3295)
+++ bp-blogs/bp-blogs-classes.php	(working copy)
@@ -75,7 +75,7 @@
 		if ( !$bp->blogs )
 			bp_blogs_setup_globals();
 
-		if ( !is_user_logged_in() || ( !is_site_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
+		if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
 			$hidden_sql = "AND wb.public = 1";
 
 		if ( $limit && $page )
@@ -208,7 +208,7 @@
 			$user_id = $bp->displayed_user->id;
 
 		// If the user is logged in return the blog count including their hidden blogs.
-		if ( ( is_user_logged_in() && $user_id == $bp->loggedin_user->id ) || is_site_admin() )
+		if ( ( is_user_logged_in() && $user_id == $bp->loggedin_user->id ) || is_super_admin() )
 			return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND user_id = %d", $user_id) );
 		else
 			return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.public = 1 AND wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND user_id = %d", $user_id) );
@@ -222,7 +222,7 @@
 
 		$filter = like_escape( $wpdb->escape( $filter ) );
 
-		if ( !is_site_admin() )
+		if ( !is_super_admin() )
 			$hidden_sql = "AND wb.public = 1";
 
 		if ( $limit && $page )
@@ -240,7 +240,7 @@
 		if ( !$bp->blogs )
 			bp_blogs_setup_globals();
 
-		if ( !is_site_admin() )
+		if ( !is_super_admin() )
 			$hidden_sql = "AND wb.public = 1";
 
 		if ( $limit && $page )
@@ -260,7 +260,7 @@
 
 		$letter = like_escape( $wpdb->escape( $letter ) );
 
-		if ( !is_site_admin() )
+		if ( !is_super_admin() )
 			$hidden_sql = "AND wb.public = 1";
 
 		if ( $limit && $page )
Index: bp-languages/buddypress.pot
===================================================================
--- bp-languages/buddypress.pot	(revision 3295)
+++ bp-languages/buddypress.pot	(working copy)
@@ -164,28 +164,28 @@
 "---------------------\n"
 msgstr ""
 
-#: bp-activity/bp-activity-notifications.php:43
-#: bp-activity/bp-activity-notifications.php:86
-#: bp-activity/bp-activity-notifications.php:128
-#: bp-friends/bp-friends-notifications.php:33
-#: bp-friends/bp-friends-notifications.php:70
-#: bp-groups/bp-groups-notifications.php:29
-#: bp-groups/bp-groups-notifications.php:77
-#: bp-groups/bp-groups-notifications.php:130
-#: bp-groups/bp-groups-notifications.php:176
-#: bp-groups/bp-groups-notifications.php:228
-#: bp-groups/bp-groups-notifications.php:285
-#: bp-messages/bp-messages-notifications.php:36
+#: bp-activity/bp-activity-notifications.php:44
+#: bp-activity/bp-activity-notifications.php:88
+#: bp-activity/bp-activity-notifications.php:131
+#: bp-friends/bp-friends-notifications.php:34
+#: bp-friends/bp-friends-notifications.php:72
+#: bp-groups/bp-groups-notifications.php:30
+#: bp-groups/bp-groups-notifications.php:79
+#: bp-groups/bp-groups-notifications.php:133
+#: bp-groups/bp-groups-notifications.php:179
+#: bp-groups/bp-groups-notifications.php:231
+#: bp-groups/bp-groups-notifications.php:289
+#: bp-messages/bp-messages-notifications.php:37
 #, php-format
 msgid "To disable these notifications please log in and go to: %s"
 msgstr ""
 
-#: bp-activity/bp-activity-notifications.php:74
+#: bp-activity/bp-activity-notifications.php:76
 #, php-format
 msgid "%s replied to one of your updates"
 msgstr ""
 
-#: bp-activity/bp-activity-notifications.php:77
+#: bp-activity/bp-activity-notifications.php:79
 #, php-format
 msgid ""
 "%1$s replied to one of your updates:\n"
@@ -197,12 +197,12 @@
 "---------------------\n"
 msgstr ""
 
-#: bp-activity/bp-activity-notifications.php:113
+#: bp-activity/bp-activity-notifications.php:116
 #, php-format
 msgid "%s replied to one of your comments"
 msgstr ""
 
-#: bp-activity/bp-activity-notifications.php:119
+#: bp-activity/bp-activity-notifications.php:122
 #, php-format
 msgid ""
 "%1$s replied to one of your comments:\n"
@@ -1465,29 +1465,29 @@
 msgid "Save Changes"
 msgstr ""
 
-#: bp-core/bp-core-settings.php:131
+#: bp-core/bp-core-settings.php:130
 msgid "Notification Settings"
 msgstr ""
 
-#: bp-core/bp-core-settings.php:144
+#: bp-core/bp-core-settings.php:143
 msgid "Email Notifications"
 msgstr ""
 
-#: bp-core/bp-core-settings.php:145
+#: bp-core/bp-core-settings.php:144
 msgid "Send a notification by email when:"
 msgstr ""
 
-#: bp-core/bp-core-settings.php:186
+#: bp-core/bp-core-settings.php:185
 msgid ""
 "WARNING: Deleting your account will completely remove ALL content associated "
 "with it. There is no way back, please be careful with this option."
 msgstr ""
 
-#: bp-core/bp-core-settings.php:189
+#: bp-core/bp-core-settings.php:188
 msgid "I understand the consequences of deleting my account."
 msgstr ""
 
-#: bp-core/bp-core-settings.php:192
+#: bp-core/bp-core-settings.php:191
 msgid "Delete My Account"
 msgstr ""
 
@@ -2004,7 +2004,7 @@
 msgid "New friendship request from %s"
 msgstr ""
 
-#: bp-friends/bp-friends-notifications.php:63
+#: bp-friends/bp-friends-notifications.php:65
 #, php-format
 msgid ""
 "%1$s accepted your friend request.\n"
@@ -2510,12 +2510,12 @@
 "---------------------\n"
 msgstr ""
 
-#: bp-groups/bp-groups-notifications.php:62
+#: bp-groups/bp-groups-notifications.php:64
 #, php-format
 msgid "Membership request for group: %s"
 msgstr ""
 
-#: bp-groups/bp-groups-notifications.php:65
+#: bp-groups/bp-groups-notifications.php:67
 #, php-format
 msgid ""
 "%1$s wants to join the group \"%2$s\".\n"
@@ -2531,12 +2531,12 @@
 "---------------------\n"
 msgstr ""
 
-#: bp-groups/bp-groups-notifications.php:110
+#: bp-groups/bp-groups-notifications.php:113
 #, php-format
 msgid "Membership request for group \"%s\" accepted"
 msgstr ""
 
-#: bp-groups/bp-groups-notifications.php:112
+#: bp-groups/bp-groups-notifications.php:115
 #, php-format
 msgid ""
 "Your membership request for the group \"%1$s\" has been accepted.\n"
@@ -2546,12 +2546,12 @@
 "---------------------\n"
 msgstr ""
 
-#: bp-groups/bp-groups-notifications.php:120
+#: bp-groups/bp-groups-notifications.php:123
 #, php-format
 msgid "Membership request for group \"%s\" rejected"
 msgstr ""
 
-#: bp-groups/bp-groups-notifications.php:122
+#: bp-groups/bp-groups-notifications.php:125
 #, php-format
 msgid ""
 "Your membership request for the group \"%1$s\" has been rejected.\n"
@@ -2561,20 +2561,20 @@
 "---------------------\n"
 msgstr ""
 
-#: bp-groups/bp-groups-notifications.php:144
+#: bp-groups/bp-groups-notifications.php:147
 msgid "an administrator"
 msgstr ""
 
-#: bp-groups/bp-groups-notifications.php:147
+#: bp-groups/bp-groups-notifications.php:150
 msgid "a moderator"
 msgstr ""
 
-#: bp-groups/bp-groups-notifications.php:166
+#: bp-groups/bp-groups-notifications.php:169
 #, php-format
 msgid "You have been promoted in the group: \"%s\""
 msgstr ""
 
-#: bp-groups/bp-groups-notifications.php:169
+#: bp-groups/bp-groups-notifications.php:172
 #, php-format
 msgid ""
 "You have been promoted to %1$s for the group: \"%2$s\".\n"
@@ -2584,12 +2584,12 @@
 "---------------------\n"
 msgstr ""
 
-#: bp-groups/bp-groups-notifications.php:214
+#: bp-groups/bp-groups-notifications.php:217
 #, php-format
 msgid "You have an invitation to the group: \"%s\""
 msgstr ""
 
-#: bp-groups/bp-groups-notifications.php:217
+#: bp-groups/bp-groups-notifications.php:220
 #, php-format
 msgid ""
 "One of your friends %1$s has invited you to the group: \"%2$s\".\n"
@@ -2957,12 +2957,12 @@
 msgid " Recipients"
 msgstr ""
 
-#: bp-messages/bp-messages-notifications.php:22
+#: bp-messages/bp-messages-notifications.php:23
 #, php-format
 msgid "New message from %s"
 msgstr ""
 
-#: bp-messages/bp-messages-notifications.php:25
+#: bp-messages/bp-messages-notifications.php:26
 #, php-format
 msgid ""
 "%1$s sent you a new message:\n"
@@ -3218,6 +3218,11 @@
 
 #: bp-themes/bp-default/activity/index.php:60
 #: bp-themes/bp-default/groups/single/activity.php:3
+msgid "RSS Feed"
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:60
+#: bp-themes/bp-default/groups/single/activity.php:3
 msgid "RSS"
 msgstr ""
 
@@ -3668,6 +3673,25 @@
 msgid "Create a Group"
 msgstr ""
 
+#: bp-themes/bp-default/functions.php:79
+msgid "said:"
+msgstr ""
+
+#: bp-themes/bp-default/functions.php:80
+msgid "On"
+msgstr ""
+
+#: bp-themes/bp-default/functions.php:84
+msgid "Your comment is awaiting moderation."
+msgstr ""
+
+#: bp-themes/bp-default/functions.php:328
+#, php-format
+msgid ""
+"Theme activated! This theme contains <a href=\"%s\">custom header image</a> "
+"support and <a href=\"%s\">sidebar widgets</a>."
+msgstr ""
+
 #: bp-themes/bp-default/groups/create.php:7
 #: bp-themes/bp-default/groups/index.php:7
 msgid "Groups Directory"
Index: bp-messages/bp-messages-filters.php
===================================================================
--- bp-messages/bp-messages-filters.php	(revision 3295)
+++ bp-messages/bp-messages-filters.php	(working copy)
@@ -44,9 +44,7 @@
 add_filter( 'bp_get_message_thread_excerpt', 'make_clickable' );
 add_filter( 'bp_get_the_thread_message_content', 'make_clickable' );
 
-add_filter( 'bp_get_message_notice_subject', 'wpautop' );
 add_filter( 'bp_get_message_notice_text', 'wpautop' );
-add_filter( 'bp_get_message_thread_subject', 'wpautop' );
 add_filter( 'bp_get_the_thread_message_content', 'wpautop' );
 
 add_filter( 'bp_get_message_notice_subject', 'stripslashes_deep' );
Index: bp-messages/bp-messages-notifications.php
===================================================================
--- bp-messages/bp-messages-notifications.php	(revision 3295)
+++ bp-messages/bp-messages-notifications.php	(working copy)
@@ -7,7 +7,7 @@
 	$sender_name = bp_core_get_user_displayname( $sender_id );
 
 	foreach( $recipients as $recipient ) {
-		if ( $sender_id == $recipient->user_id || 'no' == get_usermeta( $recipient->user_id, 'notification_messages_new_message' ) ) continue;
+		if ( $sender_id == $recipient->user_id || 'no' == get_user_meta( $recipient->user_id, 'notification_messages_new_message', true ) ) continue;
 
 		$ud = get_userdata( $recipient->user_id );
 		$message_link = bp_core_get_user_domain( $recipient->user_id ) . BP_MESSAGES_SLUG .'/';
@@ -18,8 +18,9 @@
 		$content = stripslashes( wp_filter_kses( $content ) );
 
 		// Set up and send the message
-		$email_to = $ud->user_email;
-		$email_subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'New message from %s', 'buddypress' ), $sender_name );
+		$email_to      = $ud->user_email;
+		$sitename      = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
+		$email_subject = '[' . $sitename . '] ' . sprintf( __( 'New message from %s', 'buddypress' ), $sender_name );
 
 		$email_content = sprintf( __(
 '%1$s sent you a new message:
Index: bp-messages/bp-messages-templatetags.php
===================================================================
--- bp-messages/bp-messages-templatetags.php	(revision 3295)
+++ bp-messages/bp-messages-templatetags.php	(working copy)
@@ -161,7 +161,7 @@
 	$r = wp_parse_args( $args, $defaults );
 	extract( $r, EXTR_SKIP );
 
-	if ( 'notices' == $bp->current_action && !is_site_admin() ) {
+	if ( 'notices' == $bp->current_action && !is_super_admin() ) {
 		wp_redirect( $bp->displayed_user->id );
 	} else {
 		if ( 'inbox' == $bp->current_action )
@@ -249,6 +249,21 @@
 		return apply_filters( 'bp_get_message_thread_delete_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->messages->slug . '/' . $bp->current_action . '/delete/' . $messages_template->thread->thread_id, 'messages_delete_thread' ) );
 	}
 
+function bp_message_css_class() {
+	echo bp_get_message_css_class();
+}
+
+	function bp_get_message_css_class() {
+		global $messages_template;
+
+		$class = false;
+
+		if ( $messages_template->current_thread % 2 == 1 )
+			$class .= 'alt';
+
+		return apply_filters( 'bp_get_message_css_class', trim( $class ) );
+	}
+
 function bp_message_thread_has_unread() {
 	global $messages_template;
 
@@ -276,7 +291,7 @@
 	function bp_get_message_thread_last_post_date() {
 		global $messages_template;
 
-		return apply_filters( 'bp_get_message_thread_last_post_date', bp_format_time( strtotime( $messages_template->thread->last_message_date ) ) );
+		return apply_filters( 'bp_get_message_thread_last_post_date', bp_format_time( get_date_from_gmt( $messages_template->thread->last_message_date, 'U' ) ) );
 	}
 
 function bp_message_thread_avatar() {
@@ -326,7 +341,7 @@
 	function bp_get_messages_form_action() {
 		global $bp;
 
-		return apply_filters( 'bp_get_messages_form_action', $bp->loggedin_user->domain . $bp->messages->slug . '/' . $bp->current_action . '/' . $bp->action_variables[0] . '/' );
+		return apply_filters( 'bp_get_messages_form_action', trailingslashit( $bp->loggedin_user->domain . $bp->messages->slug . '/' . $bp->current_action . '/' . $bp->action_variables[0] . '/' ) );
 	}
 
 function bp_messages_username_value() {
@@ -459,7 +474,7 @@
 	if ( empty( $notice ) )
 		return false;
 
-	$closed_notices = get_usermeta( $userdata->ID, 'closed_notices' );
+	$closed_notices = get_user_meta( $userdata->ID, 'closed_notices', true );
 
 	if ( !$closed_notices )
 		$closed_notices = array();
Index: bp-messages/bp-messages-classes.php
===================================================================
--- bp-messages/bp-messages-classes.php	(revision 3295)
+++ bp-messages/bp-messages-classes.php	(working copy)
@@ -243,7 +243,7 @@
 	function bp_messages_message( $id = null ) {
 		global $bp;
 
-		$this->date_sent = time();
+		$this->date_sent = bp_core_current_time();
 		$this->sender_id = $bp->loggedin_user->id;
 
 		if ( $id ) {
@@ -288,7 +288,7 @@
 		}
 
 		// First insert the message into the messages table
-		if ( !$wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_messages} ( thread_id, sender_id, subject, message, date_sent ) VALUES ( %d, %d, %s, %s, FROM_UNIXTIME(%d) )", $this->thread_id, $this->sender_id, $this->subject, $this->message, $this->date_sent ) ) )
+		if ( !$wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_messages} ( thread_id, sender_id, subject, message, date_sent ) VALUES ( %d, %d, %s, %s, %s )", $this->thread_id, $this->sender_id, $this->subject, $this->message, $this->date_sent ) ) )
 			return false;
 
 		if ( $new_thread ) {
@@ -387,7 +387,7 @@
 		do_action( 'messages_notice_before_save', $this );
 
 		if ( !$this->id ) {
-			$sql = $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_notices} (subject, message, date_sent, is_active) VALUES (%s, %s, FROM_UNIXTIME(%d), %d)", $this->subject, $this->message, $this->date_sent, $this->is_active );
+			$sql = $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_notices} (subject, message, date_sent, is_active) VALUES (%s, %s, %s, %d)", $this->subject, $this->message, $this->date_sent, $this->is_active );
 		} else {
 			$sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET subject = %s, message = %s, is_active = %d WHERE id = %d", $this->subject, $this->message, $this->is_active, $this->id );
 		}
@@ -401,7 +401,7 @@
 		// Now deactivate all notices apart from the new one.
 		$wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET is_active = 0 WHERE id != %d", $id ) );
 
-		update_usermeta( $bp->loggedin_user->id, 'last_activity', date( 'Y-m-d H:i:s' ) );
+		update_user_meta( $bp->loggedin_user->id, 'last_activity', date( 'Y-m-d H:i:s' ) );
 
 		do_action( 'messages_notice_after_save', $this );
 
Index: bp-messages/css/autocomplete/jquery.autocompletefb.css
===================================================================
--- bp-messages/css/autocomplete/jquery.autocompletefb.css	(revision 3295)
+++ bp-messages/css/autocomplete/jquery.autocompletefb.css	(working copy)
@@ -35,7 +35,7 @@
 		}
 
 .ac_loading {
-	background : url('../../images/ajax-loader.gif') right center no-repeat;
+	background : url('../../../bp-themes/bp-default/_inc/images/ajax-loader.gif') right center no-repeat;
 }
 
 .ac_odd {
Index: bp-forums/bp-forums-admin.php
===================================================================
--- bp-forums/bp-forums-admin.php	(revision 3295)
+++ bp-forums/bp-forums-admin.php	(working copy)
@@ -121,7 +121,7 @@
 }
 
 function bp_forums_bbpress_install() {
-	global $wpdb, $bbdb;
+	global $wpdb, $bbdb, $bp;
 
 	check_admin_referer( 'bp_forums_new_install_init' );
 
@@ -140,7 +140,7 @@
 			"define( 'BB_SECURE_A"  		=> array( "'put your unique phrase here'",  "'" . addslashes( SECURE_AUTH_KEY ) . "'" ),
 			"define( 'BB_LOGGED_I"  		=> array( "'put your unique phrase here'",  "'" . addslashes( LOGGED_IN_KEY ) . "'" ),
 			"define( 'BB_NONCE_KE"  		=> array( "'put your unique phrase here'",  "'" . addslashes( NONCE_KEY ) . "'" ),
-			"\$bb_table_prefix = '" 		=> array( "'bb_'",                          "'" . $wpdb->base_prefix . "bb_'" ),
+			"\$bb_table_prefix = '" 		=> array( "'bb_'",                          "'" . $bp->table_prefix . "bb_'" ),
 			"define( 'BB_LANG', '" 			=> array( "''",                          	"'" . WPLANG . "'" )
 		)
 	);
@@ -153,22 +153,22 @@
 	}
 
 	$file = substr( $file, 0, -2 );
-	$file .= "\n" .   '$bb->custom_user_table = "' . $wpdb->users . '";';
-	$file .= "\n" .   '$bb->custom_user_meta_table = "' . $wpdb->usermeta . '";';
-	$file .= "\n\n" . '$bb->uri = "' . BP_PLUGIN_URL . '/bp-forums/bbpress/";';
-	$file .= "\n" .   '$bb->name = "' . get_blog_option( BP_ROOT_BLOG, 'name' ) . ' ' . __( 'Forums', 'buddypress' ) . '";';
+	$file .= "\n" .   '$bb->custom_user_table = \'' . $wpdb->users . '\';';
+	$file .= "\n" .   '$bb->custom_user_meta_table = \'' . $wpdb->usermeta . '\';';
+	$file .= "\n\n" . '$bb->uri = \'' . BP_PLUGIN_URL . '/bp-forums/bbpress/\';';
+	$file .= "\n" .   '$bb->name = \'' . get_blog_option( BP_ROOT_BLOG, 'name' ) . ' ' . __( 'Forums', 'buddypress' ) . '\';';
 
 	if ( bp_core_is_multisite() )
 		$file .= "\n" .   '$bb->wordpress_mu_primary_blog_id = ' . BP_ROOT_BLOG . ';';
 
 	if ( defined( 'AUTH_SALT' ) )
-		$file .= "\n\n" . 'define(\'BB_AUTH_SALT\', "' . addslashes( AUTH_SALT ) . '");';
+		$file .= "\n\n" . 'define(\'BB_AUTH_SALT\', \'' . addslashes( AUTH_SALT ) . '\');';
 
 	if ( defined( 'LOGGED_IN_SALT' ) )
-		$file .= "\n" .   'define(\'BB_LOGGED_IN_SALT\', "' . addslashes( LOGGED_IN_SALT ) . '");';
+		$file .= "\n" .   'define(\'BB_LOGGED_IN_SALT\', \'' . addslashes( LOGGED_IN_SALT ) . '\');';
 
 	if ( defined( 'SECURE_AUTH_SALT' ) )
-		$file .= "\n" .   'define(\'BB_SECURE_AUTH_SALT\', "' . addslashes( SECURE_AUTH_SALT ) . '");';
+		$file .= "\n" .   'define(\'BB_SECURE_AUTH_SALT\', \'' . addslashes( SECURE_AUTH_SALT ) . '\');';
 
 	$file .= "\n\n" . 'define(\'WP_AUTH_COOKIE_VERSION\', 2);';
 	$file .= "\n\n" . '?>';
Index: bp-forums/bp-forums-filters.php
===================================================================
--- bp-forums/bp-forums-filters.php	(revision 3295)
+++ bp-forums/bp-forums-filters.php	(working copy)
@@ -2,7 +2,7 @@
 
 /* Apply WordPress defined filters */
 add_filter( 'bp_forums_bbconfig_location', 'wp_filter_kses', 1 );
-add_filter( 'bp_forums_bbconfig_location', 'attribute_escape', 1 );
+add_filter( 'bp_forums_bbconfig_location', 'esc_attr', 1 );
 
 add_filter( 'bp_get_the_topic_title', 'wp_filter_kses', 1 );
 add_filter( 'bp_get_the_topic_latest_post_excerpt', 'bp_forums_filter_kses', 1 );
@@ -30,6 +30,7 @@
 add_filter( 'bp_get_the_topic_latest_post_excerpt', 'stripslashes_deep' );
 add_filter( 'bp_get_the_topic_poster_name', 'stripslashes_deep' );
 add_filter( 'bp_get_the_topic_last_poster_name', 'stripslashes_deep' );
+add_filter( 'bp_get_the_topic_object_name', 'stripslashes_deep' );
 
 add_filter( 'bp_get_the_topic_post_content', 'make_clickable' );
 
@@ -83,4 +84,26 @@
 		return "<a $text rel=\"nofollow\">";
 	}
 
-?>
\ No newline at end of file
+/**
+ * bp_forums_add_forum_topic_to_page_title( $title )
+ *
+ * Append forum topic to page title
+ *
+ * @global object $bp
+ * @param string $title
+ * @return string
+ */
+function bp_forums_add_forum_topic_to_page_title( $title ) {
+	global $bp;
+
+	if ( $bp->current_action == 'forum' && $bp->action_variables[0] == 'topic' ) {
+		if ( bp_has_forum_topic_posts() ) {
+			$title .= ' &#124; ' . bp_get_the_topic_title();
+		}
+	}
+
+	return $title;
+}
+add_filter( 'bp_page_title', 'bp_forums_add_forum_topic_to_page_title' );
+
+?>
Index: bp-forums/bp-forums-templatetags.php
===================================================================
--- bp-forums/bp-forums-templatetags.php	(revision 3295)
+++ bp-forums/bp-forums-templatetags.php	(working copy)
@@ -258,7 +258,7 @@
 		global $forum_template;
 
 		$post = bb_get_first_post( (int)$forum_template->topic->topic_id, false );
-		return apply_filters( 'bp_get_the_topic_text', attribute_escape( $post->post_text ) );
+		return apply_filters( 'bp_get_the_topic_text', esc_attr( $post->post_text ) );
 	}
 
 function bp_the_topic_poster_id() {
@@ -556,7 +556,7 @@
 
 		$links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'edit', 'bp_forums_edit_topic' ) . '">' . __( 'Edit Topic', 'buddypress' ) . '</a>';
 
-		if ( $bp->is_item_admin || $bp->is_item_mod || is_site_admin() ) {
+		if ( $bp->is_item_admin || $bp->is_item_mod || is_super_admin() ) {
 			if ( 0 == (int)$forum_template->topic->topic_sticky )
 				$links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'stick', 'bp_forums_stick_topic' ) . '">' . __( 'Sticky Topic', 'buddypress' ) . '</a>';
 			else
@@ -711,7 +711,7 @@
 	var $sort_by;
 	var $order;
 
-	function BP_Forums_Template_Topic( $topic_id, $per_page, $max ) {
+	function BP_Forums_Template_Topic( $topic_id, $per_page, $max, $order ) {
 		global $bp, $current_user, $forum_template;
 
 		$this->pag_page        = isset( $_REQUEST['topic_page'] ) ? intval( $_REQUEST['topic_page'] ) : 1;
@@ -813,7 +813,8 @@
 	$defaults = array(
 		'topic_id' => false,
 		'per_page' => 15,
-		'max' => false
+		'max'      => false,
+		'order'    => 'ASC'
 	);
 
 	$r = wp_parse_args( $args, $defaults );
@@ -823,7 +824,7 @@
 		$topic_id = bp_forums_get_topic_id_from_slug( $bp->action_variables[1] );
 
 	if ( is_numeric( $topic_id ) )
-		$topic_template = new BP_Forums_Template_Topic( $topic_id, $per_page, $max );
+		$topic_template = new BP_Forums_Template_Topic( $topic_id, $per_page, $max, $order );
 	else
 		return false;
 
@@ -935,7 +936,7 @@
 		if ( $_SERVER['QUERY_STRING'] )
 			$query_vars = '?' . $_SERVER['QUERY_STRING'];
 
-		$links  = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . $topic_template->post->id . 'edit/post/' . $topic_template->post->post_id . '/' . $query_vars, 'bp_forums_edit_post' ) . '">' . __( 'Edit', 'buddypress' ) . '</a> ' . $seperator . ' ';
+		$links  = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'edit/post/' . $topic_template->post->post_id . '/' . $query_vars, 'bp_forums_edit_post' ) . '">' . __( 'Edit', 'buddypress' ) . '</a> ' . $seperator . ' ';
 		$links .= '<a class="confirm" id="post-delete-link" href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'delete/post/' . $topic_template->post->post_id, 'bp_forums_delete_post' ) . '">' . __( 'Delete', 'buddypress' ) . '</a> | ';
 
 		return $links;
@@ -948,7 +949,7 @@
 		global $bp;
 
 		$post = bp_forums_get_post( $bp->action_variables[4] );
-		return apply_filters( 'bp_get_the_topic_post_edit_text', attribute_escape( $post->post_text ) );
+		return apply_filters( 'bp_get_the_topic_post_edit_text', esc_attr( $post->post_text ) );
 	}
 
 function bp_the_topic_pagination() {
@@ -990,7 +991,7 @@
 
 ?>
 	<form action="" method="get" id="search-forums-form">
-		<label><input type="text" name="s" id="forums_search" value="<?php echo attribute_escape($search_value) ?>"  onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>
+		<label><input type="text" name="s" id="forums_search" value="<?php echo esc_attr($search_value) ?>"  onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>
 		<input type="submit" id="forums_search_submit" name="forums_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
 	</form>
 <?php
@@ -1038,7 +1039,7 @@
 	function bp_get_forum_action() {
 		global $topic_template;
 
-		return apply_filters( 'bp_get_forum_action', $bp->root_domain . attribute_escape( $_SERVER['REQUEST_URI'] ) );
+		return apply_filters( 'bp_get_forum_action', $bp->root_domain . esc_attr( $_SERVER['REQUEST_URI'] ) );
 	}
 
 function bp_forum_topic_action() {
@@ -1047,7 +1048,7 @@
 	function bp_get_forum_topic_action() {
 		global $bp;
 
-		return apply_filters( 'bp_get_forum_topic_action', $bp->root_domain . attribute_escape( $_SERVER['REQUEST_URI'] ) );
+		return apply_filters( 'bp_get_forum_topic_action', $bp->root_domain . esc_attr( $_SERVER['REQUEST_URI'] ) );
 	}
 
 function bp_forum_topic_count_for_user( $user_id = false ) {
Index: bp-forums/bp-forums-bbpress.php
===================================================================
--- bp-forums/bp-forums-bbpress.php	(revision 3295)
+++ bp-forums/bp-forums-bbpress.php	(working copy)
@@ -65,7 +65,7 @@
 
 	/* This must be loaded before functionss.bb-admin.php otherwise we get a function conflict. */
 	if ( !$tables_installed = (boolean) $bbdb->get_results( 'DESCRIBE `' . $bbdb->forums . '`;', ARRAY_A ) )
-		require_once( ABSPATH . 'wp-admin/upgrade-functions.php' );
+		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
 
 	require_once( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );
 
@@ -103,7 +103,7 @@
 		/* Set the site admins as the keymasters */
 		$site_admins = get_site_option( 'site_admins', array('admin') );
 		foreach ( (array)$site_admins as $site_admin )
-			update_usermeta( bp_core_get_userid( $site_admin ), $bb_table_prefix . 'capabilities', array( 'keymaster' => true ) );
+			update_user_meta( bp_core_get_userid( $site_admin ), $bb_table_prefix . 'capabilities', array( 'keymaster' => true ) );
 
 		// Create the first forum.
 		bb_new_forum( array( 'forum_name' => 'Default Forum' ) );
@@ -130,7 +130,7 @@
 		$args = wp_parse_args( $args, $defaults );
 		extract( $args, EXTR_SKIP );
 
-		return update_usermeta( $id, $meta_key, $meta_value );
+		return update_user_meta( $id, $meta_key, $meta_value );
 	}
 }
 
Index: bp-core.php
===================================================================
--- bp-core.php	(revision 3295)
+++ bp-core.php	(working copy)
@@ -70,6 +70,9 @@
 	global $action_variables;
 
 	$current_user = wp_get_current_user();
+	
+	// Get the base database prefix
+	$bp->table_prefix = bp_core_get_table_prefix();
 
 	/* The domain for the root of the site where the main blog resides */
 	$bp->root_domain = bp_core_get_root_domain();
@@ -94,8 +97,9 @@
 	/* The core userdata of the user who is currently logged in. */
 	$bp->loggedin_user->userdata = bp_core_get_core_userdata( $bp->loggedin_user->id );
 
-	/* is_site_admin() hits the DB on single WP installs, so we need to get this separately so we can call it in a loop. */
-	$bp->loggedin_user->is_site_admin = is_site_admin();
+	/* is_super_admin() hits the DB on single WP installs, so we need to get this separately so we can call it in a loop. */
+	$bp->loggedin_user->is_super_admin = is_super_admin();
+	$bp->loggedin_user->is_super_admin  = $bp->loggedin_user->is_super_admin; // deprecated 1.2.6
 
 	/* The user id of the user currently being viewed, set in /bp-core/bp-core-catchuri.php */
 	$bp->displayed_user->id = $displayed_user_id;
@@ -141,12 +145,12 @@
 	$bp->bp_options_nav = array();
 
 	/* Fetches the default Gravatar image to use if the user/group/blog has no avatar or gravatar */
-	$bp->grav_default->user = apply_filters( 'bp_user_gravatar_default', $bp->site_options['user-avatar-default'] );
+	$bp->grav_default->user  = apply_filters( 'bp_user_gravatar_default', $bp->site_options['user-avatar-default'] );
 	$bp->grav_default->group = apply_filters( 'bp_group_gravatar_default', 'identicon' );
-	$bp->grav_default->blog = apply_filters( 'bp_blog_gravatar_default', 'identicon' );
+	$bp->grav_default->blog  = apply_filters( 'bp_blog_gravatar_default', 'identicon' );
 
 	/* Fetch the full name for the logged in and current user */
-	$bp->loggedin_user->fullname = bp_core_get_user_displayname( $bp->loggedin_user->id );
+	$bp->loggedin_user->fullname  = bp_core_get_user_displayname( $bp->loggedin_user->id );
 	$bp->displayed_user->fullname = bp_core_get_user_displayname( $bp->displayed_user->id );
 
 	/* Used to determine if user has admin rights on current content. If the logged in user is viewing
@@ -158,7 +162,7 @@
 	/* Used to determine if the logged in user is a moderator for the current content. */
 	$bp->is_item_mod = false;
 
-	$bp->core->table_name_notifications = $wpdb->base_prefix . 'bp_notifications';
+	$bp->core->table_name_notifications = $bp->table_prefix . 'bp_notifications';
 
 	if ( !$bp->current_component && $bp->displayed_user->id )
 		$bp->current_component = $bp->default_component;
@@ -168,6 +172,20 @@
 add_action( 'bp_setup_globals', 'bp_core_setup_globals' );
 
 /**
+ * bp_core_get_table_prefix()
+ *
+ * Allow filtering of database prefix. Intended for use in multinetwork installations.
+ *
+ * @global object $wpdb WordPress database object
+ * @return string Filtered database prefix
+ */
+function bp_core_get_table_prefix() {
+	global $wpdb;
+
+	return apply_filters( 'bp_core_get_table_prefix', $wpdb->base_prefix );
+}
+
+/**
  * bp_core_define_slugs()
  *
  * Define the slugs used for BuddyPress pages, based on the slugs of the WP pages used.
@@ -237,10 +255,10 @@
  * Initializes the wp-admin area "BuddyPress" menus and sub menus.
  *
  * @package BuddyPress Core
- * @uses is_site_admin() returns true if the current user is a site admin, false if not
+ * @uses is_super_admin() returns true if the current user is a site admin, false if not
  */
 function bp_core_admin_menu_init() {
-	if ( !is_site_admin() )
+	if ( !is_super_admin() )
 		return false;
 
 	require ( BP_PLUGIN_DIR . '/bp-core/admin/bp-core-admin.php' );
@@ -254,12 +272,11 @@
  *
  * @package BuddyPress Core
  * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
- * @global $wpdb WordPress DB access object.
- * @uses is_site_admin() returns true if the current user is a site admin, false if not
+ * @uses is_super_admin() returns true if the current user is a site admin, false if not
  * @uses add_submenu_page() WP function to add a submenu item
  */
 function bp_core_add_admin_menu() {
-	if ( !is_site_admin() )
+	if ( !is_super_admin() )
 		return false;
 
 	/* Add the administration tab under the "Site Admin" tab for site administrators */
@@ -381,7 +398,7 @@
 function bp_core_action_set_spammer_status() {
 	global $bp, $wpdb;
 
-	if ( !is_site_admin() || bp_is_my_profile() || !$bp->displayed_user->id )
+	if ( !is_super_admin() || bp_is_my_profile() || !$bp->displayed_user->id )
 		return false;
 
 	if ( 'admin' == $bp->current_component && ( 'mark-spammer' == $bp->current_action || 'unmark-spammer' == $bp->current_action ) ) {
@@ -445,7 +462,7 @@
 function bp_core_action_delete_user() {
 	global $bp;
 
-	if ( !is_site_admin() || bp_is_my_profile() || !$bp->displayed_user->id )
+	if ( !is_super_admin() || bp_is_my_profile() || !$bp->displayed_user->id )
 		return false;
 
 	if ( 'admin' == $bp->current_component && 'delete-user' == $bp->current_action ) {
@@ -515,7 +532,7 @@
  * @package BuddyPress Core
  * @global $current_user WordPress global variable containing current logged in user information
  * @param user_id The ID of the user.
- * @uses get_usermeta() WordPress function to get the usermeta for a user.
+ * @uses get_user_meta() WordPress function to get the usermeta for a user.
  */
 function bp_core_get_user_domain( $user_id, $user_nicename = false, $user_login = false ) {
 	global $bp;
@@ -625,7 +642,7 @@
 		return false;
 
 	/* If this is for site admins only and the user is not one, don't create the subnav item */
-	if ( $site_admin_only && !is_site_admin() )
+	if ( $site_admin_only && !is_super_admin() )
 		return false;
 
 	if ( empty( $item_css_id ) )
@@ -772,7 +789,7 @@
 		return false;
 
 	/* If this is for site admins only and the user is not one, don't create the subnav item */
-	if ( $site_admin_only && !is_site_admin() )
+	if ( $site_admin_only && !is_super_admin() )
 		return false;
 
 	if ( empty( $item_css_id ) )
@@ -902,12 +919,11 @@
  *
  * @package BuddyPress Core
  * @param $username str Username to check.
- * @global $wpdb WordPress DB access object.
  * @return false on no match
  * @return int the user ID of the matched user.
  */
 function bp_core_get_random_member() {
-	global $bp, $wpdb;
+	global $bp;
 
 	if ( isset( $_GET['random-member'] ) ) {
 		$user = bp_core_get_users( array( 'type' => 'random', 'per_page' => 1 ) );
@@ -1214,19 +1230,18 @@
 }
 
 /**
- * bp_core_format_time()
+ * bp_core_current_time()
+ *
+ * Get the current GMT time to save into the DB
+ *
+ * @package BuddyPress Core
+ * @since 1.2.6
  */
-function bp_core_format_time( $time, $just_date = false ) {
-	if ( !$time )
-		return false;
+function bp_core_current_time( $gmt = true ) {
+	// Get current time in MYSQL format
+	$current_time = current_time( 'mysql', $gmt );
 
-	$date = date( "F j, Y ", $time );
-
-	if ( !$just_date ) {
-		$date .= __('at', 'buddypress') . date( ' g:iA', $time );
-	}
-
-	return $date;
+	return apply_filters( 'bp_core_current_time', $current_time );
 }
 
 /**
@@ -1301,7 +1316,7 @@
 		$type = ( 'success' == $bp->template_message_type ) ? 'updated' : 'error';
 	?>
 		<div id="message" class="<?php echo $type; ?>">
-			<p><?php echo stripslashes( attribute_escape( $bp->template_message ) ); ?></p>
+			<p><?php echo stripslashes( esc_attr( $bp->template_message ) ); ?></p>
 		</div>
 	<?php
 		do_action( 'bp_core_render_message' );
@@ -1345,7 +1360,7 @@
 
 	/* $newer_date will equal false if we want to know the time elapsed between a date and the current time */
 	/* $newer_date will have a value if we want to work out time elapsed between two known dates */
-	$newer_date = ( !$newer_date ) ? gmmktime( gmdate( 'H' ), gmdate( 'i' ), gmdate( 's' ), gmdate( 'n' ), gmdate( 'j' ), gmdate( 'Y' ) ) : $newer_date;
+	$newer_date = ( !$newer_date ) ? strtotime( bp_core_current_time() ) : $newer_date;
 
 	/* Difference in seconds */
 	$since = $newer_date - $older_date;
@@ -1380,7 +1395,7 @@
 
 		if ( ( $count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 ) ) != 0 ) {
 			/* Add to output var */
-			$output .= ( 1 == $count2 ) ? _c( ',|Separator in time since', 'buddypress' ) . ' 1 '. $chunks[$i + 1][1] : _c( ',|Separator in time since', 'buddypress' ) . ' ' . $count2 . ' ' . $chunks[$i + 1][2];
+			$output .= ( 1 == $count2 ) ? _x( ',', 'Separator in time since', 'buddypress' ) . ' 1 '. $chunks[$i + 1][1] : _x( ',', 'Separator in time since', 'buddypress' ) . ' ' . $count2 . ' ' . $chunks[$i + 1][2];
 		}
 	}
 
@@ -1400,7 +1415,7 @@
  *
  * @package BuddyPress Core
  * @global $userdata WordPress user data for the current logged in user.
- * @uses update_usermeta() WordPress function to update user metadata in the usermeta table.
+ * @uses update_user_meta() WordPress function to update user metadata in the usermeta table.
  */
 function bp_core_record_activity() {
 	global $bp;
@@ -1408,13 +1423,16 @@
 	if ( !is_user_logged_in() )
 		return false;
 
-	$activity = get_usermeta( $bp->loggedin_user->id, 'last_activity' );
+	$activity = get_user_meta( $bp->loggedin_user->id, 'last_activity', true );
 
 	if ( !is_numeric( $activity ) )
 		$activity = strtotime( $activity );
 
-	if ( '' == $activity || strtotime( gmdate( "Y-m-d H:i:s" ) ) >= strtotime( '+5 minutes', $activity ) )
-		update_usermeta( $bp->loggedin_user->id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
+	// Get current time
+	$current_time = bp_core_current_time();
+
+	if ( '' == $activity || strtotime( $current_time ) >= strtotime( '+5 minutes', $activity ) )
+		update_user_meta( $bp->loggedin_user->id, 'last_activity', $current_time );
 }
 add_action( 'wp_head', 'bp_core_record_activity' );
 
@@ -1473,8 +1491,10 @@
  * Get the path of of the current site.
  *
  * @package BuddyPress Core
- * @global $comment WordPress comment global for the current comment.
- * @uses bp_core_get_userlink_by_email() Fetches a userlink via email address.
+ *
+ * @global $bp $bp
+ * @global object $current_site
+ * @return string
  */
 function bp_core_get_site_path() {
 	global $bp, $current_site;
@@ -1562,7 +1582,7 @@
 	global $bp_no_status_set;
 
 	// Make sure we don't call status_header() in bp_core_do_catch_uri()
-    // as this conflicts with wp_redirect()
+	// as this conflicts with wp_redirect()
 	$bp_no_status_set = true;
 
 	wp_redirect( $location, $status );
@@ -1652,7 +1672,7 @@
  *
  * @package BuddyPress Core
  * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
- * @uses is_site_admin() Checks to see if the user is a site administrator.
+ * @uses is_super_admin() Checks to see if the user is a site administrator.
  * @uses wpmu_delete_user() Deletes a user from the system on multisite installs.
  * @uses wp_delete_user() Deletes a user from the system on singlesite installs.
  * @uses get_site_option Checks if account deletion is allowed
@@ -1743,8 +1763,8 @@
  */
 function bp_core_ucfirst( $str ) {
 	if ( function_exists( 'mb_strtoupper' ) && function_exists( 'mb_substr' ) ) {
-	    $fc = mb_strtoupper( mb_substr( $str, 0, 1 ) );
-	    return $fc.mb_substr( $str, 1 );
+		$fc = mb_strtoupper( mb_substr( $str, 0, 1 ) );
+		return $fc.mb_substr( $str, 1 );
 	} else {
 		return ucfirst( $str );
 	}
@@ -1791,8 +1811,7 @@
  * @package BuddyPress Core
  */
 function bp_core_print_generation_time() {
-	global $wpdb;
-	?>
+?>
 
 <!-- Generated in <?php timer_stop(1); ?> seconds. (<?php echo get_num_queries(); ?> q) -->
 
@@ -1879,11 +1898,11 @@
  *
  * @package BuddyPress Core
  * @param $user_id The user id for the user to delete usermeta for
- * @uses delete_usermeta() deletes a row from the wp_usermeta table based on meta_key
+ * @uses delete_user_meta() deletes a row from the wp_usermeta table based on meta_key
  */
 function bp_core_remove_data( $user_id ) {
 	/* Remove usermeta */
-	delete_usermeta( $user_id, 'last_activity' );
+	delete_user_meta( $user_id, 'last_activity' );
 
 	/* Flush the cache to remove the user from all cached objects */
 	wp_cache_flush();
@@ -1906,7 +1925,7 @@
 	if ( file_exists( $mofile ) )
 		load_textdomain( 'buddypress', $mofile );
 }
-add_action ( 'plugins_loaded', 'bp_core_load_buddypress_textdomain', 5 );
+add_action ( 'bp_loaded', 'bp_core_load_buddypress_textdomain', 2 );
 
 function bp_core_add_ajax_hook() {
 	/* Theme only, we already have the wp_ajax_ hook firing in wp-admin */
@@ -1957,7 +1976,7 @@
 function bp_core_allow_default_theme( $themes ) {
 	global $bp, $current_blog;
 
-	if ( !is_site_admin() )
+	if ( !is_super_admin() )
 		return $themes;
 
 	if ( $current_blog->ID == $bp->root_blog ) {
@@ -1984,7 +2003,7 @@
 	if ( isset( $_POST['permalink_structure'] ) )
 		return false;
 
-	if ( !is_site_admin() )
+	if ( !is_super_admin() )
 		return false;
 
 	if ( !empty( $current_blog ) ) {
@@ -2079,32 +2098,68 @@
  * Functions to set up custom BuddyPress actions that all other components can
  * hook in to.
  */
-
-/* Allow core components and dependent plugins to set globals */
-function bp_setup_globals() {
-	do_action( 'bp_setup_globals' );
+ 
+/**
+ * bp_include()
+ *
+ * Allow plugins to include their files ahead of core filters
+ */
+function bp_include() {
+	do_action( 'bp_include' );
 }
-add_action( 'plugins_loaded', 'bp_setup_globals', 5 );
+add_action( 'bp_loaded', 'bp_include', 2 );
 
-/* Allow core components and dependent plugins to set root components */
+/**
+ * bp_setup_root_components()
+ *
+ * Allow core components and dependent plugins to set root components
+ */
 function bp_setup_root_components() {
 	do_action( 'bp_setup_root_components' );
 }
-add_action( 'plugins_loaded', 'bp_setup_root_components', 2 );
+add_action( 'bp_loaded', 'bp_setup_root_components', 2 );
 
-/* Allow core components and dependent plugins to set their nav */
+/**
+ * bp_setup_globals()
+ *
+ * Allow core components and dependent plugins to set globals
+ */
+function bp_setup_globals() {
+	do_action( 'bp_setup_globals' );
+}
+add_action( 'bp_loaded', 'bp_setup_globals', 6 );
+
+/**
+ * bp_setup_nav()
+ *
+ * Allow core components and dependent plugins to set their nav
+ */
 function bp_setup_nav() {
 	do_action( 'bp_setup_nav' );
 }
 add_action( 'bp_loaded', 'bp_setup_nav', 8 );
 
-/* Allow core components and dependent plugins to register widgets */
+/**
+ * bp_setup_widgets()
+ *
+ * Allow core components and dependent plugins to register widgets
+ */
 function bp_setup_widgets() {
 	do_action( 'bp_register_widgets' );
 }
-add_action( 'plugins_loaded', 'bp_setup_widgets' );
+add_action( 'bp_loaded', 'bp_setup_widgets', 8 );
 
+/**
+ * bp_init()
+ *
+ * Allow components to initialize themselves cleanly
+ */
+function bp_init() {
+	do_action( 'bp_init' );
+}
+add_action( 'bp_loaded', 'bp_init' );
 
+
 /********************************************************************************
  * Caching
  *
@@ -2113,6 +2168,21 @@
  */
 
 /**
+ * bp_core_add_global_group()
+ *
+ * Add's 'bp' to global group of network wide cachable objects
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_add_global_group() {
+	wp_cache_init();
+
+	if ( function_exists( 'wp_cache_add_global_groups' ) )
+		wp_cache_add_global_groups( array( 'bp' ) );
+}
+add_action( 'init', 'bp_core_add_global_group' );
+
+/**
  * bp_core_clear_user_object_cache()
  *
  * Clears all cached objects for a user, or a user is part of.
Index: bp-xprofile.php
===================================================================
--- bp-xprofile.php	(revision 3295)
+++ bp-xprofile.php	(working copy)
@@ -29,12 +29,13 @@
 	/* For internal identification */
 	$bp->profile->id = 'profile';
 
-	$bp->profile->table_name_groups = $wpdb->base_prefix . 'bp_xprofile_groups';
-	$bp->profile->table_name_fields = $wpdb->base_prefix . 'bp_xprofile_fields';
-	$bp->profile->table_name_data = $wpdb->base_prefix . 'bp_xprofile_data';
+	$bp->profile->slug = BP_XPROFILE_SLUG;
 
+	$bp->profile->table_name_data   = $bp->table_prefix . 'bp_xprofile_data';
+	$bp->profile->table_name_groups = $bp->table_prefix . 'bp_xprofile_groups';
+	$bp->profile->table_name_fields = $bp->table_prefix . 'bp_xprofile_fields';
+
 	$bp->profile->format_notification_function = 'xprofile_format_notifications';
-	$bp->profile->slug = BP_XPROFILE_SLUG;
 
 	/* Register this in the active components array */
 	$bp->active_components[$bp->profile->slug] = $bp->profile->id;
@@ -55,7 +56,7 @@
  * @package BuddyPress XProfile
  * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
  * @global $wpdb WordPress DB access object.
- * @uses is_site_admin() returns true if the current user is a site admin, false if not
+ * @uses is_super_admin() returns true if the current user is a site admin, false if not
  * @uses bp_xprofile_install() runs the installation of DB tables for the xprofile component
  * @uses wp_enqueue_script() Adds a JS file to the JS queue ready for output
  * @uses add_submenu_page() Adds a submenu tab to a top level tab in the admin area
@@ -65,7 +66,7 @@
 function xprofile_add_admin_menu() {
 	global $wpdb, $bp;
 
-	if ( !is_site_admin() )
+	if ( !is_super_admin() )
 		return false;
 
 	/* Add the administration tab under the "Site Admin" tab for site administrators */
@@ -126,15 +127,15 @@
 		return false;
 
 	/* Don't show this menu to non site admins or if you're viewing your own profile */
-	if ( !is_site_admin() || bp_is_my_profile() )
+	if ( !is_super_admin() || bp_is_my_profile() )
 		return false; ?>
 
 	<li id="bp-adminbar-adminoptions-menu">
 		<a href=""><?php _e( 'Admin Options', 'buddypress' ) ?></a>
 
 		<ul>
-			<li><a href="<?php echo $bp->displayed_user->domain . $bp->profile->slug ?>/edit/"><?php printf( __( "Edit %s's Profile", 'buddypress' ), attribute_escape( $bp->displayed_user->fullname ) ) ?></a></li>
-			<li><a href="<?php echo $bp->displayed_user->domain . $bp->profile->slug ?>/change-avatar/"><?php printf( __( "Edit %s's Avatar", 'buddypress' ), attribute_escape( $bp->displayed_user->fullname ) ) ?></a></li>
+			<li><a href="<?php echo $bp->displayed_user->domain . $bp->profile->slug ?>/edit/"><?php printf( __( "Edit %s's Profile", 'buddypress' ), esc_attr( $bp->displayed_user->fullname ) ) ?></a></li>
+			<li><a href="<?php echo $bp->displayed_user->domain . $bp->profile->slug ?>/change-avatar/"><?php printf( __( "Edit %s's Avatar", 'buddypress' ), esc_attr( $bp->displayed_user->fullname ) ) ?></a></li>
 <?php if ( !bp_core_is_user_spammer( $bp->displayed_user->id ) ) : ?>
 			<li><a href="<?php echo wp_nonce_url( $bp->displayed_user->domain . 'admin/mark-spammer/', 'mark-unmark-spammer' ) ?>" class="confirm"><?php _e( "Mark as Spammer", 'buddypress' ) ?></a></li>
 <?php else : ?>
@@ -142,7 +143,7 @@
 			<li><a href="<?php echo wp_nonce_url( $bp->displayed_user->domain . 'admin/unmark-spammer/', 'mark-unmark-spammer' ) ?>" class="confirm"><?php _e( "Not a Spammer", 'buddypress' ) ?></a></li>
 <?php endif; ?>
 
-			<li><a href="<?php echo wp_nonce_url( $bp->displayed_user->domain . 'admin/delete-user/', 'delete-user' ) ?>" class="confirm"><?php printf( __( "Delete %s", 'buddypress' ), attribute_escape( $bp->displayed_user->fullname ) ) ?></a></li>
+			<li><a href="<?php echo wp_nonce_url( $bp->displayed_user->domain . 'admin/delete-user/', 'delete-user' ) ?>" class="confirm"><?php printf( __( "Delete %s", 'buddypress' ), esc_attr( $bp->displayed_user->fullname ) ) ?></a></li>
 <?php do_action( 'xprofile_adminbar_menu_items' ) ?>
 
 		</ul>
@@ -187,7 +188,7 @@
 function xprofile_screen_edit_profile() {
 	global $bp;
 
-	if ( !bp_is_my_profile() && !is_site_admin() )
+	if ( !bp_is_my_profile() && !is_super_admin() )
 		return false;
 
 	/* Make sure a group is set. */
@@ -277,7 +278,7 @@
 function xprofile_screen_change_avatar() {
 	global $bp;
 
-	if ( !bp_is_my_profile() && !is_site_admin() )
+	if ( !bp_is_my_profile() && !is_super_admin() )
 		return false;
 
 	$bp->avatar_admin->step = 'upload-image';
@@ -346,7 +347,7 @@
 	/* Check the nonce */
 	check_admin_referer( 'bp_delete_avatar_link' );
 
-	if ( !bp_is_my_profile() && !is_site_admin() )
+	if ( !bp_is_my_profile() && !is_super_admin() )
 		return false;
 
 	if ( bp_core_delete_existing_avatar( array( 'item_id' => $bp->displayed_user->id ) ) )
@@ -405,7 +406,7 @@
 		'type' => false,
 		'item_id' => false,
 		'secondary_item_id' => false,
-		'recorded_time' => gmdate( "Y-m-d H:i:s" ),
+		'recorded_time' => bp_core_current_time(),
 		'hide_sitewide' => false
 	);
 
@@ -832,9 +833,9 @@
 		$lastname = trim( substr( $fullname, $space, strlen($fullname) ) );
 	}
 
-	update_usermeta( $user_id, 'nickname', $fullname );
-	update_usermeta( $user_id, 'first_name', $firstname );
-	update_usermeta( $user_id, 'last_name', $lastname );
+	update_user_meta( $user_id, 'nickname', $fullname );
+	update_user_meta( $user_id, 'first_name', $firstname );
+	update_user_meta( $user_id, 'last_name', $lastname );
 
 	$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET display_name = %s WHERE ID = %d", $fullname, $user_id ) );
 	$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_url = %s WHERE ID = %d", bp_core_get_user_domain( $user_id ), $user_id ) );
Index: bp-groups/bp-groups-classes.php
===================================================================
--- bp-groups/bp-groups-classes.php	(revision 3295)
+++ bp-groups/bp-groups-classes.php	(working copy)
@@ -204,7 +204,7 @@
 			$order_sql = "ORDER BY $sort_by $order";
 		}
 
-		if ( !is_site_admin() )
+		if ( !is_super_admin() )
 			$hidden_sql = "AND status != 'hidden'";
 
 		$paged_groups = $wpdb->get_results( "SELECT id as group_id FROM {$bp->groups->table_name} WHERE ( name LIKE '%%$filter%%' OR description LIKE '%%$filter%%' ) {$hidden_sql} {$order_sql} {$pag_sql}" );
@@ -273,7 +273,7 @@
 
 		$sql['where'] = " g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count'";
 
-		if ( !is_user_logged_in() || ( !is_site_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
+		if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
 			$sql['hidden'] = " AND g.status != 'hidden'";
 
 		if ( $search_terms ) {
@@ -357,7 +357,7 @@
 			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
 		}
 
-		if ( !is_user_logged_in() || ( !is_site_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
+		if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
 			$hidden_sql = " AND g.status != 'hidden'";
 
 		if ( $search_terms ) {
@@ -393,7 +393,7 @@
 			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
 		}
 
-		if ( !is_user_logged_in() || ( !is_site_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
+		if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
 			$hidden_sql = " AND g.status != 'hidden'";
 
 		if ( $search_terms ) {
@@ -422,10 +422,18 @@
 	function get_by_letter( $letter, $limit = null, $page = null, $populate_extras = true ) {
 		global $wpdb, $bp;
 
-		if ( strlen($letter) > 1 || is_numeric($letter) || !$letter )
-			return false;
+		// Multibyte compliance
+		if ( function_exists( 'mb_strlen' ) ) {
+			if ( mb_strlen( $letter, 'UTF-8' ) > 1 || is_numeric( $letter ) || !$letter ) {
+				return false;
+			}
+		} else {
+			if ( strlen( $letter ) > 1 || is_numeric( $letter ) || !$letter ) {
+				return false;
+			}
+		}
 
-		if ( !is_site_admin() )
+		if ( !is_super_admin() )
 			$hidden_sql = $wpdb->prepare( " AND status != 'hidden'");
 
 		$letter = like_escape( $wpdb->escape( $letter ) );
@@ -481,7 +489,7 @@
 	function get_total_group_count() {
 		global $wpdb, $bp;
 
-		if ( !is_site_admin() )
+		if ( !is_super_admin() )
 			$hidden_sql = "WHERE status != 'hidden'";
 
 		return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name} {$hidden_sql}" ) );
Index: bp-groups/bp-groups-widgets.php
===================================================================
--- bp-groups/bp-groups-widgets.php	(revision 3295)
+++ bp-groups/bp-groups-widgets.php	(working copy)
@@ -50,7 +50,7 @@
 				<?php endwhile; ?>
 			</ul>
 			<?php wp_nonce_field( 'groups_widget_groups_list', '_wpnonce-groups' ); ?>
-			<input type="hidden" name="groups_widget_max" id="groups_widget_max" value="<?php echo attribute_escape( $instance['max_groups'] ); ?>" />
+			<input type="hidden" name="groups_widget_max" id="groups_widget_max" value="<?php echo esc_attr( $instance['max_groups'] ); ?>" />
 
 		<?php else: ?>
 
@@ -76,7 +76,7 @@
 		$max_groups = strip_tags( $instance['max_groups'] );
 		?>
 
-		<p><label for="bp-groups-widget-groups-max"><?php _e('Max groups to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_groups' ); ?>" name="<?php echo $this->get_field_name( 'max_groups' ); ?>" type="text" value="<?php echo attribute_escape( $max_groups ); ?>" style="width: 30%" /></label></p>
+		<p><label for="bp-groups-widget-groups-max"><?php _e('Max groups to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_groups' ); ?>" name="<?php echo $this->get_field_name( 'max_groups' ); ?>" type="text" value="<?php echo esc_attr( $max_groups ); ?>" style="width: 30%" /></label></p>
 	<?php
 	}
 }
@@ -129,7 +129,7 @@
 			<?php endwhile; ?>
 		</ul>
 		<?php wp_nonce_field( 'groups_widget_groups_list', '_wpnonce-groups' ); ?>
-		<input type="hidden" name="groups_widget_max" id="groups_widget_max" value="<?php echo attribute_escape( $_POST['max_groups'] ); ?>" />
+		<input type="hidden" name="groups_widget_max" id="groups_widget_max" value="<?php echo esc_attr( $_POST['max_groups'] ); ?>" />
 
 	<?php else: ?>
 
Index: bp-groups/bp-groups-filters.php
===================================================================
--- bp-groups/bp-groups-filters.php	(revision 3295)
+++ bp-groups/bp-groups-filters.php	(working copy)
@@ -92,7 +92,7 @@
 function groups_filter_bbpress_caps( $value, $cap, $args ) {
 	global $bp;
 
-	if ( is_site_admin() )
+	if ( is_super_admin() )
 		return true;
 
 	if ( 'add_tag_to' == $cap )
Index: bp-groups/bp-groups-notifications.php
===================================================================
--- bp-groups/bp-groups-notifications.php	(revision 3295)
+++ bp-groups/bp-groups-notifications.php	(working copy)
@@ -3,12 +3,13 @@
 function groups_notification_group_updated( $group_id ) {
 	global $bp;
 
-	$group = new BP_Groups_Group( $group_id );
-	$subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . __( 'Group Details Updated', 'buddypress' );
+	$group    = new BP_Groups_Group( $group_id );
+	$sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
+	$subject  = '[' . $sitename . '] ' . __( 'Group Details Updated', 'buddypress' );
 
 	$user_ids = BP_Groups_Member::get_group_member_ids( $group->id );
 	foreach ( (array)$user_ids as $user_id ) {
-		if ( 'no' == get_usermeta( $user_id, 'notification_groups_group_updated' ) ) continue;
+		if ( 'no' == get_user_meta( $user_id, 'notification_groups_group_updated', true ) ) continue;
 
 		$ud = bp_core_get_core_userdata( $user_id );
 
@@ -44,7 +45,7 @@
 
 	bp_core_add_notification( $requesting_user_id, $admin_id, 'groups', 'new_membership_request', $group_id );
 
-	if ( 'no' == get_usermeta( $admin_id, 'notification_groups_membership_request' ) )
+	if ( 'no' == get_user_meta( $admin_id, 'notification_groups_membership_request', true ) )
 		return false;
 
 	$requesting_user_name = bp_core_get_user_displayname( $requesting_user_id );
@@ -58,8 +59,9 @@
 	$settings_link = bp_core_get_user_domain( $requesting_user_id ) .  BP_SETTINGS_SLUG . '/notifications/';
 
 	// Set up and send the message
-	$to = $ud->user_email;
-	$subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'Membership request for group: %s', 'buddypress' ), $group->name );
+	$to       = $ud->user_email;
+	$sitename = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
+	$subject  = '[' . $sitename . '] ' . sprintf( __( 'Membership request for group: %s', 'buddypress' ), $group->name );
 
 $message = sprintf( __(
 '%1$s wants to join the group "%2$s".
@@ -93,7 +95,7 @@
 	else
 		bp_core_add_notification( $group_id, $requesting_user_id, 'groups', 'membership_request_rejected' );
 
-	if ( 'no' == get_usermeta( $requesting_user_id, 'notification_membership_request_completed' ) )
+	if ( 'no' == get_user_meta( $requesting_user_id, 'notification_membership_request_completed', true ) )
 		return false;
 
 	$group = new BP_Groups_Group( $group_id );
@@ -117,7 +119,7 @@
 ', 'buddypress' ), $group->name, $group_link );
 
 	} else {
-		$subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'Membership request for group "%s" rejected', 'buddypress' ), $group->name );
+		$subject = '[' . $sitename . '] ' . sprintf( __( 'Membership request for group "%s" rejected', 'buddypress' ), $group->name );
 		$message = sprintf( __(
 'Your membership request for the group "%1$s" has been rejected.
 
@@ -151,7 +153,7 @@
 	// Post a screen notification first.
 	bp_core_add_notification( $group_id, $user_id, 'groups', $type );
 
-	if ( 'no' == get_usermeta( $user_id, 'notification_groups_admin_promotion' ) )
+	if ( 'no' == get_user_meta( $user_id, 'notification_groups_admin_promotion', true ) )
 		return false;
 
 	$group = new BP_Groups_Group( $group_id );
@@ -161,10 +163,10 @@
 	$settings_link = bp_core_get_user_domain( $user_id ) .  BP_SETTINGS_SLUG . '/notifications/';
 
 	// Set up and send the message
-	$to = $ud->user_email;
+	$to       = $ud->user_email;
+	$sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
+	$subject  = '[' . $sitename . '] ' . sprintf( __( 'You have been promoted in the group: "%s"', 'buddypress' ), $group->name );
 
-	$subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'You have been promoted in the group: "%s"', 'buddypress' ), $group->name );
-
 	$message = sprintf( __(
 'You have been promoted to %1$s for the group: "%2$s".
 
@@ -199,7 +201,7 @@
 		// Post a screen notification first.
 		bp_core_add_notification( $group->id, $invited_user_id, 'groups', 'group_invite' );
 
-		if ( 'no' == get_usermeta( $invited_user_id, 'notification_groups_invite' ) )
+		if ( 'no' == get_user_meta( $invited_user_id, 'notification_groups_invite', true ) )
 			return false;
 
 		$invited_ud = bp_core_get_core_userdata($invited_user_id);
@@ -209,10 +211,10 @@
 		$invites_link = $invited_link . $bp->groups->slug . '/invites';
 
 		// Set up and send the message
-		$to = $invited_ud->user_email;
+		$to       = $invited_ud->user_email;
+		$sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
+		$subject  = '[' . $sitename . '] ' . sprintf( __( 'You have an invitation to the group: "%s"', 'buddypress' ), $group->name );
 
-		$subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'You have an invitation to the group: "%s"', 'buddypress' ), $group->name );
-
 		$message = sprintf( __(
 'One of your friends %1$s has invited you to the group: "%2$s".
 
@@ -240,7 +242,7 @@
 	global $bp;
 
 	/* Scan for @username strings in an activity update. Notify each user. */
-	$pattern = '/[@]+([A-Za-z0-9-_]+)/';
+	$pattern = '/[@]+([A-Za-z0-9-_\.]+)/';
 	preg_match_all( $pattern, $content, $usernames );
 
 	/* Make sure there's only one instance of each username */
@@ -258,7 +260,7 @@
 			continue;
 
 		// Now email the user with the contents of the message (if they have enabled email notifications)
-		if ( 'no' != get_usermeta( $user_id, 'notification_activity_new_mention' ) ) {
+		if ( 'no' != get_user_meta( $user_id, 'notification_activity_new_mention', true ) ) {
 			$poster_name = bp_core_get_user_displayname( $poster_user_id );
 
 			$message_link = bp_activity_get_permalink( $activity_id );
@@ -296,4 +298,4 @@
 add_action( 'bp_groups_posted_update', 'groups_at_message_notification', 10, 4 );
 
 
-?>
\ No newline at end of file
+?>
Index: bp-groups/bp-groups-templatetags.php
===================================================================
--- bp-groups/bp-groups-templatetags.php	(revision 3295)
+++ bp-groups/bp-groups-templatetags.php	(working copy)
@@ -196,7 +196,7 @@
 function bp_group_is_visible( $group = false ) {
 	global $bp, $groups_template;
 
-	if ( $bp->loggedin_user->is_site_admin )
+	if ( $bp->loggedin_user->is_super_admin )
 		return true;
 
 	if ( !$group )
@@ -291,7 +291,7 @@
 
 		/* Fetch the avatar from the folder, if not provide backwards compat. */
 		if ( !$avatar = bp_core_fetch_avatar( array( 'item_id' => $groups_template->group->id, 'object' => 'group', 'type' => $type, 'avatar_dir' => 'group-avatars', 'alt' => $alt, 'css_id' => $id, 'class' => $class, 'width' => $width, 'height' => $height ) ) )
-			$avatar = '<img src="' . attribute_escape( $groups_template->group->avatar_thumb ) . '" class="avatar" alt="' . attribute_escape( $groups_template->group->name ) . '" />';
+			$avatar = '<img src="' . esc_attr( $groups_template->group->avatar_thumb ) . '" class="avatar" alt="' . esc_attr( $groups_template->group->name ) . '" />';
 
 		return apply_filters( 'bp_get_group_avatar', $avatar );
 	}
@@ -565,6 +565,12 @@
 		return apply_filters( 'bp_get_groups_pagination_count', sprintf( __( 'Viewing group %1$s to %2$s (of %3$s groups)', 'buddypress' ), $from_num, $to_num, $total ) );
 	}
 
+function bp_groups_auto_join() {
+	global $bp;
+
+	return apply_filters( 'bp_groups_auto_join', (bool)$bp->groups->auto_join );
+}
+
 function bp_group_total_members() {
 	echo bp_get_group_total_members();
 }
@@ -874,7 +880,7 @@
 	echo bp_get_group_member_unban_link( $user_id );
 }
 	function bp_get_group_member_unban_link( $user_id = false, $group = false ) {
-		global $members_template;
+		global $members_template, $groups_template;
 
 		if ( !$user_id )
 			$user_id = $members_template->member->user_id;
@@ -885,6 +891,24 @@
 		return apply_filters( 'bp_get_group_member_unban_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/unban/' . $user_id, 'groups_unban_member' ) );
 	}
 
+
+function bp_group_member_remove_link( $user_id = false ) {
+	global $members_template;
+
+	if ( !$user_id )
+		$user_id = $members_template->member->user_id;
+
+	echo bp_get_group_member_remove_link( $user_id );
+}
+	function bp_get_group_member_remove_link( $user_id = false, $group = false ) {
+		global $members_template, $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_member_remove_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/remove/' . $user_id, 'groups_remove_member' ) );
+	}
+
 function bp_group_admin_tabs( $group = false ) {
 	global $bp, $groups_template;
 
@@ -961,19 +985,37 @@
 	return false;
 }
 
+/**
+ * bp_group_is_member()
+ *
+ * Checks if current user is member of a group.
+ *
+ * @uses is_super_admin Check if current user is super admin
+ * @uses apply_filters Creates bp_group_is_member filter and passes $is_member
+ * @usedby groups/activity.php, groups/single/forum/edit.php, groups/single/forum/topic.php to determine template part visibility
+ * @global array $bp BuddyPress Master global
+ * @global object $groups_template Current Group (usually in template loop)
+ * @param object $group Group to check is_member
+ * @return bool If user is member of group or not
+ */
 function bp_group_is_member( $group = false ) {
 	global $bp, $groups_template;
 
-	if ( is_site_admin() )
+	// Site admins always have access
+	if ( is_super_admin() )
 		return true;
 
+	// Load group if none passed
 	if ( !$group )
 		$group =& $groups_template->group;
 
 	if ( null == $group->is_member )
-		return false;
-
-	return true;
+		$is_member = false;
+	else
+		$is_member = true;
+		
+	// Return
+	return apply_filters( 'bp_group_is_member', $is_member );
 }
 
 function bp_group_accept_invite_link() {
@@ -1189,15 +1231,15 @@
 
 function bp_group_hidden_fields() {
 	if ( isset( $_REQUEST['s'] ) ) {
-		echo '<input type="hidden" id="search_terms" value="' . attribute_escape( $_REQUEST['s'] ) . '" name="search_terms" />';
+		echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['s'] ) . '" name="search_terms" />';
 	}
 
 	if ( isset( $_REQUEST['letter'] ) ) {
-		echo '<input type="hidden" id="selected_letter" value="' . attribute_escape( $_REQUEST['letter'] ) . '" name="selected_letter" />';
+		echo '<input type="hidden" id="selected_letter" value="' . esc_attr( $_REQUEST['letter'] ) . '" name="selected_letter" />';
 	}
 
 	if ( isset( $_REQUEST['groups_search'] ) ) {
-		echo '<input type="hidden" id="search_terms" value="' . attribute_escape( $_REQUEST['groups_search'] ) . '" name="search_terms" />';
+		echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['groups_search'] ) . '" name="search_terms" />';
 	}
 }
 
@@ -1429,6 +1471,13 @@
 		return apply_filters( 'bp_get_group_member_is_banned', $members_template->member->is_banned );
 	}
 
+function bp_group_member_css_class() {
+	global $members_template;
+
+	if ( $members_template->member->is_banned )
+		echo apply_filters( 'bp_group_member_css_class', 'banned-user' );
+}
+
 function bp_group_member_joined_since() {
 	echo bp_get_group_member_joined_since();
 }
@@ -1744,7 +1793,7 @@
 					}
 				}
 
-				$items[] = '<' . $separator . '><input' . $checked . ' type="checkbox" name="friends[]" id="f-' . $friends[$i]['id'] . '" value="' . attribute_escape( $friends[$i]['id'] ) . '" /> ' . $friends[$i]['full_name'] . '</' . $separator . '>';
+				$items[] = '<' . $separator . '><input' . $checked . ' type="checkbox" name="friends[]" id="f-' . $friends[$i]['id'] . '" value="' . esc_attr( $friends[$i]['id'] ) . '" /> ' . $friends[$i]['full_name'] . '</' . $separator . '>';
 			}
 		}
 
@@ -1760,7 +1809,7 @@
 
 ?>
 	<form action="" method="get" id="search-groups-form">
-		<label><input type="text" name="s" id="groups_search" value="<?php echo attribute_escape($search_value) ?>"  onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>
+		<label><input type="text" name="s" id="groups_search" value="<?php echo esc_attr($search_value) ?>"  onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>
 		<input type="submit" id="groups_search_submit" name="groups_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
 	</form>
 <?php
@@ -1827,7 +1876,7 @@
 	global $bp;
 
 	if ( $bp->groups->current_group->avatar_full ) { ?>
-		<img src="<?php echo attribute_escape( $bp->groups->current_group->avatar_full ) ?>" alt="<?php _e( 'Group Avatar', 'buddypress' ) ?>" class="avatar" />
+		<img src="<?php echo esc_attr( $bp->groups->current_group->avatar_full ) ?>" alt="<?php _e( 'Group Avatar', 'buddypress' ) ?>" class="avatar" />
 	<?php } else { ?>
 		<img src="<?php echo $bp->groups->image_base . '/none.gif' ?>" alt="<?php _e( 'No Group Avatar', 'buddypress' ) ?>" class="avatar" />
 	<?php }
