diff --git a/wp-content/plugins/buddypress/bp-activity.php b/wp-content/plugins/buddypress/bp-activity.php
new file mode 100644
index 0000000000000000000000000000000000000000..937ca7d1e962650a4c77c3c3cda6158f45d2abcc
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-activity.php
@@ -0,0 +1,1215 @@
+<?php
+
+define ( 'BP_ACTIVITY_DB_VERSION', '2100' );
+
+/* Define the slug for the component */
+if ( !defined( 'BP_ACTIVITY_SLUG' ) )
+	define ( 'BP_ACTIVITY_SLUG', 'activity' );
+
+require ( BP_PLUGIN_DIR . '/bp-activity/bp-activity-classes.php' );
+require ( BP_PLUGIN_DIR . '/bp-activity/bp-activity-templatetags.php' );
+require ( BP_PLUGIN_DIR . '/bp-activity/bp-activity-filters.php' );
+
+function bp_activity_install() {
+	global $wpdb, $bp;
+
+	if ( !empty($wpdb->charset) )
+		$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
+
+	/* Rename the old user activity cached table if needed. */
+	if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$wpdb->base_prefix}bp_activity_user_activity_cached%'" ) )
+		$wpdb->query( "RENAME TABLE {$wpdb->base_prefix}bp_activity_user_activity_cached TO {$bp->activity->table_name}" );
+
+	/* Rename fields from pre BP 1.2 */
+	if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$bp->activity->table_name}%'" ) ) {
+		if ( $wpdb->get_var( "SHOW COLUMNS FROM {$bp->activity->table_name} LIKE 'component_action'" ) )
+			$wpdb->query( "ALTER TABLE {$bp->activity->table_name} CHANGE component_action type varchar(75) NOT NULL" );
+
+		if ( $wpdb->get_var( "SHOW COLUMNS FROM {$bp->activity->table_name} LIKE 'component_name'" ) )
+			$wpdb->query( "ALTER TABLE {$bp->activity->table_name} CHANGE component_name component varchar(75) NOT NULL" );
+	}
+
+	/**
+	 * Build the tables
+	 */
+	$sql[] = "CREATE TABLE {$bp->activity->table_name} (
+		  		id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+				user_id bigint(20) NOT NULL,
+				component varchar(75) NOT NULL,
+				type varchar(75) NOT NULL,
+				action text NOT NULL,
+				content longtext NOT NULL,
+				primary_link varchar(150) NOT NULL,
+				item_id varchar(75) NOT NULL,
+				secondary_item_id varchar(75) DEFAULT NULL,
+				date_recorded datetime NOT NULL,
+				hide_sitewide bool DEFAULT 0,
+				mptt_left int(11) NOT NULL DEFAULT 0,
+				mptt_right int(11) NOT NULL DEFAULT 0,
+				KEY date_recorded (date_recorded),
+				KEY user_id (user_id),
+				KEY item_id (item_id),
+				KEY secondary_item_id (secondary_item_id),
+				KEY component (component),
+				KEY type (type),
+				KEY mptt_left (mptt_left),
+				KEY mptt_right (mptt_right),
+				KEY hide_sitewide (hide_sitewide)
+		 	   ) {$charset_collate};";
+
+	$sql[] = "CREATE TABLE {$bp->activity->table_name_meta} (
+				id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+				activity_id bigint(20) NOT NULL,
+				meta_key varchar(255) DEFAULT NULL,
+				meta_value longtext DEFAULT NULL,
+				KEY activity_id (activity_id),
+				KEY meta_key (meta_key)
+		   	   ) {$charset_collate};";
+
+	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
+	dbDelta($sql);
+
+	update_site_option( 'bp-activity-db-version', BP_ACTIVITY_DB_VERSION );
+}
+
+function bp_activity_setup_globals() {
+	global $bp, $current_blog;
+
+	/* Internal identifier */
+	$bp->activity->id = 'activity';
+
+	$bp->activity->slug = BP_ACTIVITY_SLUG;
+
+	$bp->activity->table_name      = $bp->table_prefix . 'bp_activity';
+	$bp->activity->table_name_meta = $bp->table_prefix . 'bp_activity_meta';
+
+	$bp->activity->format_notification_function = 'bp_activity_format_notifications';
+
+	/* Register this in the active components array */
+	$bp->active_components[$bp->activity->slug] = $bp->activity->id;
+
+	do_action( 'bp_activity_setup_globals' );
+}
+add_action( 'bp_setup_globals', 'bp_activity_setup_globals' );
+
+function bp_activity_check_installed() {
+	global $bp;
+
+	if ( get_site_option( 'bp-activity-db-version' ) < BP_ACTIVITY_DB_VERSION )
+		bp_activity_install();
+}
+add_action( 'admin_menu', 'bp_activity_check_installed' );
+
+function bp_activity_setup_root_component() {
+	/* Register 'activity' as a root component (for RSS feed use) */
+	bp_core_add_root_component( BP_ACTIVITY_SLUG );
+}
+add_action( 'bp_setup_root_components', 'bp_activity_setup_root_component' );
+
+function bp_activity_setup_nav() {
+	global $bp;
+
+	/* Add 'Activity' to the main navigation */
+	bp_core_new_nav_item( array( 'name' => __( 'Activity', 'buddypress' ), 'slug' => $bp->activity->slug, 'position' => 10, 'screen_function' => 'bp_activity_screen_my_activity', 'default_subnav_slug' => 'just-me', 'item_css_id' => $bp->activity->id ) );
+
+	$user_domain = ( !empty( $bp->displayed_user->domain ) ) ? $bp->displayed_user->domain : $bp->loggedin_user->domain;
+	$user_login = ( !empty( $bp->displayed_user->userdata->user_login ) ) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login;
+	$activity_link = $user_domain . $bp->activity->slug . '/';
+
+	/* Add the subnav items to the activity nav item if we are using a theme that supports this */
+	bp_core_new_subnav_item( array( 'name' => __( 'Personal', 'buddypress' ), 'slug' => 'just-me', 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->slug, 'screen_function' => 'bp_activity_screen_my_activity', 'position' => 10 ) );
+
+	if ( bp_is_active( 'friends' ) )
+		bp_core_new_subnav_item( array( 'name' => __( 'Friends', 'buddypress' ), 'slug' => BP_FRIENDS_SLUG, 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->slug, 'screen_function' => 'bp_activity_screen_friends', 'position' => 20, 'item_css_id' => 'activity-friends' ) );
+
+	if ( bp_is_active( 'groups' ) )
+		bp_core_new_subnav_item( array( 'name' => __( 'Groups', 'buddypress' ), 'slug' => BP_GROUPS_SLUG, 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->slug, 'screen_function' => 'bp_activity_screen_groups', 'position' => 30, 'item_css_id' => 'activity-groups' ) );
+
+	bp_core_new_subnav_item( array( 'name' => __( 'Favorites', 'buddypress' ), 'slug' => 'favorites', 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->slug, 'screen_function' => 'bp_activity_screen_favorites', 'position' => 40, 'item_css_id' => 'activity-favs' ) );
+	bp_core_new_subnav_item( array( 'name' => sprintf( __( '@%s Mentions', 'buddypress' ), $user_login ), 'slug' => 'mentions', 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->slug, 'screen_function' => 'bp_activity_screen_mentions', 'position' => 50, 'item_css_id' => 'activity-mentions' ) );
+
+	if ( $bp->current_component == $bp->activity->slug ) {
+		if ( bp_is_my_profile() ) {
+			$bp->bp_options_title = __( 'My Activity', 'buddypress' );
+		} else {
+			$bp->bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => 'thumb' ) );
+			$bp->bp_options_title = $bp->displayed_user->fullname;
+		}
+	}
+
+	do_action( 'bp_activity_setup_nav' );
+}
+add_action( 'bp_setup_nav', 'bp_activity_setup_nav' );
+
+function bp_activity_directory_activity_setup() {
+	global $bp;
+
+	if ( $bp->current_component == $bp->activity->slug && empty( $bp->current_action ) ) {
+		$bp->is_directory = true;
+
+		do_action( 'bp_activity_directory_activity_setup' );
+		bp_core_load_template( apply_filters( 'bp_activity_directory_activity_setup', 'activity/index' ) );
+	}
+}
+add_action( 'wp', 'bp_activity_directory_activity_setup', 2 );
+
+
+/********************************************************************************
+ * Screen Functions
+ *
+ * Screen functions are the controllers of BuddyPress. They will execute when their
+ * specific URL is caught. They will first save or manipulate data using business
+ * functions, then pass on the user to a template file.
+ */
+
+function bp_activity_screen_my_activity() {
+	do_action( 'bp_activity_screen_my_activity' );
+	bp_core_load_template( apply_filters( 'bp_activity_template_my_activity', 'members/single/home' ) );
+}
+
+function bp_activity_screen_friends() {
+	global $bp;
+
+	if ( !bp_is_active( 'friends' ) )
+		return false;
+
+	if ( !is_super_admin() )
+		$bp->is_item_admin = false;
+
+	do_action( 'bp_activity_screen_friends' );
+	bp_core_load_template( apply_filters( 'bp_activity_template_friends_activity', 'members/single/home' ) );
+}
+
+function bp_activity_screen_groups() {
+	global $bp;
+
+	if ( !bp_is_active( 'groups' ) )
+		return false;
+
+	if ( !is_super_admin() )
+		$bp->is_item_admin = false;
+
+	do_action( 'bp_activity_screen_groups' );
+	bp_core_load_template( apply_filters( 'bp_activity_template_groups_activity', 'members/single/home' ) );
+}
+
+function bp_activity_screen_favorites() {
+	global $bp;
+
+	if ( !is_super_admin() )
+		$bp->is_item_admin = false;
+
+	do_action( 'bp_activity_screen_favorites' );
+	bp_core_load_template( apply_filters( 'bp_activity_template_favorite_activity', 'members/single/home' ) );
+}
+
+function bp_activity_screen_mentions() {
+	global $bp;
+
+	if ( !is_super_admin() )
+		$bp->is_item_admin = false;
+
+	do_action( 'bp_activity_screen_mentions' );
+	bp_core_load_template( apply_filters( 'bp_activity_template_mention_activity', 'members/single/home' ) );
+}
+
+function bp_activity_screen_single_activity_permalink() {
+	global $bp;
+
+	if ( !$bp->displayed_user->id || $bp->current_component != $bp->activity->slug )
+		return false;
+
+	if ( empty( $bp->current_action ) || !is_numeric( $bp->current_action ) )
+		return false;
+
+	/* Get the activity details */
+	$activity = bp_activity_get_specific( array( 'activity_ids' => $bp->current_action ) );
+
+	if ( !$activity = $activity['activities'][0] )
+		bp_core_redirect( $bp->root_domain );
+
+	$has_access = true;
+	/* Redirect based on the type of activity */
+	if ( $activity->component == $bp->groups->id ) {
+		if ( !function_exists( 'groups_get_group' ) )
+			bp_core_redirect( $bp->root_domain );
+
+		if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) {
+			/* Check to see if the group is not public, if so, check the user has access to see this activity */
+			if ( 'public' != $group->status ) {
+				if ( !groups_is_user_member( $bp->loggedin_user->id, $group->id ) )
+					$has_access = false;
+			}
+		}
+	}
+
+	$has_access = apply_filters( 'bp_activity_permalink_access', $has_access, &$activity );
+
+	do_action( 'bp_activity_screen_single_activity_permalink', $activity, $has_access );
+
+	if ( !$has_access ) {
+		bp_core_add_message( __( 'You do not have access to this activity.', 'buddypress' ), 'error' );
+
+		if ( is_user_logged_in() )
+			bp_core_redirect( $bp->loggedin_user->domain );
+		else
+			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' ) );
+}
+/* This screen is not attached to a nav item, so we need to add an action for it. */
+add_action( 'wp', 'bp_activity_screen_single_activity_permalink', 3 );
+
+function bp_activity_screen_notification_settings() {
+	global $bp; ?>
+	<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>
+
+		<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' ) ?>
+		</tbody>
+	</table>
+<?php
+}
+add_action( 'bp_notification_settings', 'bp_activity_screen_notification_settings', 1 );
+
+/********************************************************************************
+ * Action Functions
+ *
+ * Action functions are exactly the same as screen functions, however they do not
+ * have a template screen associated with them. Usually they will send the user
+ * back to the default screen after execution.
+ */
+
+function bp_activity_action_permalink_router() {
+	global $bp;
+
+	if ( $bp->current_component != $bp->activity->slug || $bp->current_action != 'p' )
+		return false;
+
+	if ( empty( $bp->action_variables[0] ) || !is_numeric( $bp->action_variables[0] ) )
+		return false;
+
+	/* Get the activity details */
+	$activity = bp_activity_get_specific( array( 'activity_ids' => $bp->action_variables[0] ) );
+
+	if ( !$activity = $activity['activities'][0] )
+		bp_core_redirect( $bp->root_domain );
+
+	$redirect = false;
+	/* Redirect based on the type of activity */
+	if ( $activity->component == $bp->groups->id ) {
+		if ( $activity->user_id )
+			$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->slug . '/' . $activity->id . '/';
+		else {
+			if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) )
+				$redirect = bp_get_group_permalink( $group ) . $bp->activity->slug . '/' . $activity->id . '/';
+		}
+	} else
+		$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->slug . '/' . $activity->id;
+
+	$redirect = apply_filters( 'bp_activity_permalink_redirect_url', $redirect, &$activity );
+
+	if ( !$redirect )
+		bp_core_redirect( $bp->root_domain );
+
+	/* Redirect to the actual activity permalink page */
+	bp_core_redirect( $redirect );
+}
+add_action( 'wp', 'bp_activity_action_permalink_router', 3 );
+
+function bp_activity_action_delete_activity() {
+	global $bp;
+
+	if ( $bp->current_component != $bp->activity->slug || $bp->current_action != 'delete' )
+		return false;
+
+	if ( empty( $bp->action_variables[0] ) || !is_numeric( $bp->action_variables[0] ) )
+		return false;
+
+	/* Check the nonce */
+	check_admin_referer( 'bp_activity_delete_link' );
+
+	$activity_id = $bp->action_variables[0];
+	$activity = new BP_Activity_Activity( $activity_id );
+
+	/* Check access */
+	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 */
+	do_action( 'bp_activity_action_delete_activity', $activity_id, $activity->user_id );
+
+	/* Now delete the activity item */
+	if ( bp_activity_delete( array( 'id' => $activity_id, 'user_id' => $activity->user_id ) ) )
+		bp_core_add_message( __( 'Activity deleted', 'buddypress' ) );
+	else
+		bp_core_add_message( __( 'There was an error when deleting that activity', 'buddypress' ), 'error' );
+
+	bp_core_redirect( wp_get_referer() );
+}
+add_action( 'wp', 'bp_activity_action_delete_activity', 3 );
+
+function bp_activity_action_post_update() {
+	global $bp;
+
+	if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'post' )
+		return false;
+
+	/* Check the nonce */
+	check_admin_referer( 'post_update', '_wpnonce_post_update' );
+
+	$content = apply_filters( 'bp_activity_post_update_content', $_POST['whats-new'] );
+	$object = apply_filters( 'bp_activity_post_update_object', $_POST['whats-new-post-object'] );
+	$item_id = apply_filters( 'bp_activity_post_update_item_id', $_POST['whats-new-post-in'] );
+
+	if ( empty( $content ) ) {
+		bp_core_add_message( __( 'Please enter some content to post.', 'buddypress' ), 'error' );
+		bp_core_redirect( wp_get_referer() );
+	}
+
+	if ( !(int)$item_id ) {
+		$activity_id = bp_activity_post_update( array( 'content' => $content ) );
+
+	} else if ( 'groups' == $object && function_exists( 'groups_post_update' ) ) {
+		if ( (int)$item_id ) {
+			$activity_id = groups_post_update( array( 'content' => $content, 'group_id' => $item_id ) );
+		}
+	} else
+		$activity_id = apply_filters( 'bp_activity_custom_update', $object, $item_id, $content );
+
+	if ( !empty( $activity_id ) )
+		bp_core_add_message( __( 'Update Posted!', 'buddypress' ) );
+	else
+		bp_core_add_message( __( 'There was an error when posting your update, please try again.', 'buddypress' ), 'error' );
+
+	bp_core_redirect( wp_get_referer() );
+}
+add_action( 'wp', 'bp_activity_action_post_update', 3 );
+
+function bp_activity_action_post_comment() {
+	global $bp;
+
+	if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'reply' )
+		return false;
+
+	/* Check the nonce */
+	check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' );
+
+	$activity_id = apply_filters( 'bp_activity_post_comment_activity_id', $_POST['comment_form_id'] );
+	$content = apply_filters( 'bp_activity_post_comment_content', $_POST['ac_input_' . $activity_id] );
+
+	if ( empty( $content ) ) {
+		bp_core_add_message( __( 'Please do not leave the comment area blank.', 'buddypress' ), 'error' );
+		bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id );
+	}
+
+	$comment_id = bp_activity_new_comment( array(
+		'content' => $content,
+		'activity_id' => $activity_id,
+		'parent_id' => $parent_id
+	));
+
+	if ( !empty( $comment_id ) )
+		bp_core_add_message( __( 'Reply Posted!', 'buddypress' ) );
+	else
+		bp_core_add_message( __( 'There was an error posting that reply, please try again.', 'buddypress' ), 'error' );
+
+	bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id );
+}
+add_action( 'wp', 'bp_activity_action_post_comment', 3 );
+
+function bp_activity_action_mark_favorite() {
+	global $bp;
+
+	if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'favorite' )
+		return false;
+
+	/* Check the nonce */
+	check_admin_referer( 'mark_favorite' );
+
+	if ( bp_activity_add_user_favorite( $bp->action_variables[0] ) )
+		bp_core_add_message( __( 'Activity marked as favorite.', 'buddypress' ) );
+	else
+		bp_core_add_message( __( 'There was an error marking that activity as a favorite, please try again.', 'buddypress' ), 'error' );
+
+	bp_core_redirect( wp_get_referer() . '#activity-' . $bp->action_variables[0] );
+}
+add_action( 'wp', 'bp_activity_action_mark_favorite', 3 );
+
+function bp_activity_action_remove_favorite() {
+	global $bp;
+
+	if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'unfavorite' )
+		return false;
+
+	/* Check the nonce */
+	check_admin_referer( 'unmark_favorite' );
+
+	if ( bp_activity_remove_user_favorite( $bp->action_variables[0] ) )
+		bp_core_add_message( __( 'Activity removed as favorite.', 'buddypress' ) );
+	else
+		bp_core_add_message( __( 'There was an error removing that activity as a favorite, please try again.', 'buddypress' ), 'error' );
+
+	bp_core_redirect( wp_get_referer() . '#activity-' . $bp->action_variables[0] );
+}
+add_action( 'wp', 'bp_activity_action_remove_favorite', 3 );
+
+function bp_activity_action_sitewide_feed() {
+	global $bp, $wp_query;
+
+	if ( $bp->current_component != $bp->activity->slug || $bp->current_action != 'feed' || $bp->displayed_user->id || $bp->groups->current_group )
+		return false;
+
+	$wp_query->is_404 = false;
+	status_header( 200 );
+
+	include_once( 'bp-activity/feeds/bp-activity-sitewide-feed.php' );
+	die;
+}
+add_action( 'wp', 'bp_activity_action_sitewide_feed', 3 );
+
+function bp_activity_action_personal_feed() {
+	global $bp, $wp_query;
+
+	if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'feed' )
+		return false;
+
+	$wp_query->is_404 = false;
+	status_header( 200 );
+
+	include_once( 'bp-activity/feeds/bp-activity-personal-feed.php' );
+	die;
+}
+add_action( 'wp', 'bp_activity_action_personal_feed', 3 );
+
+function bp_activity_action_friends_feed() {
+	global $bp, $wp_query;
+
+	if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'friends' || $bp->action_variables[0] != 'feed' )
+		return false;
+
+	$wp_query->is_404 = false;
+	status_header( 200 );
+
+	include_once( 'bp-activity/feeds/bp-activity-friends-feed.php' );
+	die;
+}
+add_action( 'wp', 'bp_activity_action_friends_feed', 3 );
+
+function bp_activity_action_my_groups_feed() {
+	global $bp, $wp_query;
+
+	if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'groups' || $bp->action_variables[0] != 'feed' )
+		return false;
+
+	$wp_query->is_404 = false;
+	status_header( 200 );
+
+	include_once( 'bp-activity/feeds/bp-activity-mygroups-feed.php' );
+	die;
+}
+add_action( 'wp', 'bp_activity_action_my_groups_feed', 3 );
+
+function bp_activity_action_mentions_feed() {
+	global $bp, $wp_query;
+
+	if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'mentions' || $bp->action_variables[0] != 'feed' )
+		return false;
+
+	$wp_query->is_404 = false;
+	status_header( 200 );
+
+	include_once( 'bp-activity/feeds/bp-activity-mentions-feed.php' );
+	die;
+}
+add_action( 'wp', 'bp_activity_action_mentions_feed', 3 );
+
+function bp_activity_action_favorites_feed() {
+	global $bp, $wp_query;
+
+	if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'favorites' || $bp->action_variables[0] != 'feed' )
+		return false;
+
+	$wp_query->is_404 = false;
+	status_header( 200 );
+
+	include_once( 'bp-activity/feeds/bp-activity-favorites-feed.php' );
+	die;
+}
+add_action( 'wp', 'bp_activity_action_favorites_feed', 3 );
+
+/********************************************************************************
+ * Business Functions
+ *
+ * Business functions are where all the magic happens in BuddyPress. They will
+ * handle the actual saving or manipulation of information. Usually they will
+ * hand off to a database class for data access, then return
+ * true or false on success or failure.
+ */
+
+function bp_activity_get( $args = '' ) {
+	$defaults = array(
+		'max' => false, // Maximum number of results to return
+		'page' => 1, // page 1 without a per_page will result in no pagination.
+		'per_page' => false, // results per page
+		'sort' => 'DESC', // sort ASC or DESC
+		'display_comments' => false, // false for no comments. 'stream' for within stream display, 'threaded' for below each activity item
+
+		'search_terms' => false, // Pass search terms as a string
+		'show_hidden' => false, // Show activity items that are hidden site-wide?
+
+		/**
+		 * Pass filters as an array -- all filter items can be multiple values comma separated:
+		 * array(
+		 * 	'user_id' => false, // user_id to filter on
+		 *	'object' => false, // object to filter on e.g. groups, profile, status, friends
+		 *	'action' => false, // action to filter on e.g. activity_update, profile_updated
+		 *	'primary_id' => false, // object ID to filter on e.g. a group_id or forum_id or blog_id etc.
+		 *	'secondary_id' => false, // secondary object ID to filter on e.g. a post_id
+		 * );
+		 */
+		'filter' => array()
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	/* Attempt to return a cached copy of the first page of sitewide activity. */
+	if ( 1 == (int)$page && empty( $max ) && empty( $search_terms ) && empty( $filter ) && 'DESC' == $sort ) {
+		if ( !$activity = wp_cache_get( 'bp_activity_sitewide_front', 'bp' ) ) {
+			$activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden );
+			wp_cache_set( 'bp_activity_sitewide_front', $activity, 'bp' );
+		}
+	} else
+		$activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden );
+
+	return apply_filters( 'bp_activity_get', $activity, &$r );
+}
+
+function bp_activity_get_specific( $args = '' ) {
+	$defaults = array(
+		'activity_ids' => false, // A single activity_id or array of IDs.
+		'page' => 1, // page 1 without a per_page will result in no pagination.
+		'per_page' => false, // results per page
+		'max' => false, // Maximum number of results to return
+		'sort' => 'DESC', // sort ASC or DESC
+		'display_comments' => false // true or false to display threaded comments for these specific activity items
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	return apply_filters( 'bp_activity_get_specific', BP_Activity_Activity::get_specific( $activity_ids, $max, $page, $per_page, $sort, $display_comments ) );
+}
+
+function bp_activity_add( $args = '' ) {
+	global $bp;
+
+	$defaults = array(
+		'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!"
+
+		'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
+		'secondary_item_id' => false, // Optional: A second ID used to further filter e.g. a comment_id
+		'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 );
+	extract( $params, EXTR_SKIP );
+
+	/* Make sure we are backwards compatible */
+	if ( empty( $component ) && !empty( $component_name ) )
+		$component = $component_name;
+
+	if ( empty( $type ) && !empty( $component_action ) )
+		$type = $component_action;
+
+	$activity = new BP_Activity_Activity( $id );
+
+	$activity->user_id = $user_id;
+	$activity->component = $component;
+	$activity->type = $type;
+	$activity->action = $action;
+	$activity->content = $content;
+	$activity->primary_link = $primary_link;
+	$activity->item_id = $item_id;
+	$activity->secondary_item_id = $secondary_item_id;
+	$activity->date_recorded = $recorded_time;
+	$activity->hide_sitewide = $hide_sitewide;
+
+	if ( !$activity->save() )
+		return false;
+
+	/* If this is an activity comment, rebuild the tree */
+	if ( 'activity_comment' == $activity->type )
+		BP_Activity_Activity::rebuild_activity_comment_tree( $activity->item_id );
+
+	wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
+	do_action( 'bp_activity_add', $params );
+
+	return $activity->id;
+}
+
+function bp_activity_post_update( $args = '' ) {
+	global $bp;
+
+	$defaults = array(
+		'content' => false,
+		'user_id' => $bp->loggedin_user->id
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	if ( empty( $content ) || !strlen( trim( $content ) ) )
+		return false;
+
+	/* Record this on the user's profile */
+	$from_user_link = bp_core_get_userlink( $user_id );
+	$activity_action = sprintf( __( '%s posted an update:', 'buddypress' ), $from_user_link );
+	$activity_content = $content;
+
+	$primary_link = bp_core_get_userlink( $user_id, false, true );
+
+	/* Now write the values */
+	$activity_id = bp_activity_add( array(
+		'user_id' => $user_id,
+		'action' => apply_filters( 'bp_activity_new_update_action', $activity_action ),
+		'content' => apply_filters( 'bp_activity_new_update_content', $activity_content ),
+		'primary_link' => apply_filters( 'bp_activity_new_update_primary_link', $primary_link ),
+		'component' => $bp->activity->id,
+		'type' => 'activity_update'
+	) );
+
+	/* Add this update to the "latest update" usermeta so it can be fetched anywhere. */
+	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' );
+
+	do_action( 'bp_activity_posted_update', $content, $user_id, $activity_id );
+
+	return $activity_id;
+}
+
+function bp_activity_new_comment( $args = '' ) {
+	global $bp;
+
+	$defaults = array(
+		'id' => false,
+		'content' => false,
+		'user_id' => $bp->loggedin_user->id,
+		'activity_id' => false, // ID of the root activity item
+		'parent_id' => false // ID of a parent comment (optional)
+	);
+
+	$params = wp_parse_args( $args, $defaults );
+	extract( $params, EXTR_SKIP );
+
+	if ( empty($content) || empty($user_id) || empty($activity_id) )
+		return false;
+
+	if ( empty($parent_id) )
+		$parent_id = $activity_id;
+
+	/* Check to see if the parent activity is hidden, and if so, hide this comment publically. */
+	$activity = new BP_Activity_Activity( $activity_id );
+	$is_hidden = ( (int)$activity->hide_sitewide ) ? 1 : 0;
+
+	/* Insert the activity comment */
+	$comment_id = bp_activity_add( array(
+		'id' => $id,
+		'action' => apply_filters( 'bp_activity_comment_action', sprintf( __( '%s posted a new activity comment:', 'buddypress' ), bp_core_get_userlink( $user_id ) ) ),
+		'content' => apply_filters( 'bp_activity_comment_content', $content ),
+		'component' => $bp->activity->id,
+		'type' => 'activity_comment',
+		'user_id' => $user_id,
+		'item_id' => $activity_id,
+		'secondary_item_id' => $parent_id,
+		'hide_sitewide' => $is_hidden
+	) );
+
+	/* Send an email notification if settings allow */
+	require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-notifications.php' );
+	bp_activity_new_comment_notification( $comment_id, $user_id, $params );
+
+	/* Clear the comment cache for this activity */
+	wp_cache_delete( 'bp_activity_comments_' . $parent_id );
+
+	do_action( 'bp_activity_comment_posted', $comment_id, $params );
+
+	return $comment_id;
+}
+
+/**
+ * bp_activity_get_activity_id()
+ *
+ * Fetch the activity_id for an existing activity entry in the DB.
+ *
+ * @package BuddyPress Activity
+ */
+function bp_activity_get_activity_id( $args = '' ) {
+	$defaults = array(
+		'user_id' => false,
+		'component' => false,
+		'type' => false,
+		'item_id' => false,
+		'secondary_item_id' => false,
+		'action' => false,
+		'content' => false,
+		'date_recorded' => false,
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+ 	return apply_filters( 'bp_activity_get_activity_id', BP_Activity_Activity::get_id( $user_id, $component, $type, $item_id, $secondary_item_id, $action, $content, $date_recorded ) );
+}
+
+/***
+ * Deleting Activity
+ *
+ * If you're looking to hook into one action that provides the ID(s) of
+ * the activity/activities deleted, then use:
+ *
+ * add_action( 'bp_activity_deleted_activities', 'my_function' );
+ *
+ * The action passes one parameter that is a single activity ID or an
+ * array of activity IDs depending on the number deleted.
+ *
+ * If you are deleting an activity comment please use bp_activity_delete_comment();
+*/
+
+function bp_activity_delete( $args = '' ) {
+	global $bp;
+
+	/* Pass one or more the of following variables to delete by those variables */
+	$defaults = array(
+		'id' => false,
+		'action' => false,
+		'content' => false,
+		'component' => false,
+		'type' => false,
+		'primary_link' => false,
+		'user_id' => false,
+		'item_id' => false,
+		'secondary_item_id' => false,
+		'date_recorded' => false,
+		'hide_sitewide' => false
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+
+	if ( !$activity_ids_deleted = BP_Activity_Activity::delete( $args ) )
+		return false;
+
+	/* Check if the user's latest update has been deleted */
+	if ( empty( $args['user_id'] ) )
+		$user_id = $bp->loggedin_user->id;
+	else
+		$user_id = $args['user_id'];
+
+	$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_user_meta( $user_id, 'bp_latest_update' );
+	}
+
+	do_action( 'bp_activity_delete', $args );
+	do_action( 'bp_activity_deleted_activities', $activity_ids_deleted );
+
+	wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
+
+	return true;
+}
+	/* The following functions have been deprecated in place of bp_activity_delete() */
+	function bp_activity_delete_by_item_id( $args = '' ) {
+		global $bp;
+
+		$defaults = array( 'item_id' => false, 'component' => false, 'type' => false, 'user_id' => false, 'secondary_item_id' => false );
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		return bp_activity_delete( array( 'item_id' => $item_id, 'component' => $component, 'type' => $type, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) );
+	}
+
+	function bp_activity_delete_by_activity_id( $activity_id ) {
+		return bp_activity_delete( array( 'id' => $activity_id ) );
+	}
+
+	function bp_activity_delete_by_content( $user_id, $content, $component, $type ) {
+		return bp_activity_delete( array( 'user_id' => $user_id, 'content' => $content, 'component' => $component, 'type' => $type ) );
+	}
+
+	function bp_activity_delete_for_user_by_component( $user_id, $component ) {
+		return bp_activity_delete( array( 'user_id' => $user_id, 'component' => $component ) );
+	}
+	/* End deprecation */
+
+function bp_activity_delete_comment( $activity_id, $comment_id ) {
+	/***
+	 * You may want to hook into this filter if you want to override this function and
+	 * handle the deletion of child comments differently. Make sure you return false.
+	 */
+	if ( !apply_filters( 'bp_activity_delete_comment_pre', true, $activity_id, $comment_id ) )
+		return false;
+
+	/* Delete any children of this comment. */
+	bp_activity_delete_children( $activity_id, $comment_id );
+
+	/* Delete the actual comment */
+	if ( !bp_activity_delete( array( 'id' => $comment_id, 'type' => 'activity_comment' ) ) )
+		return false;
+
+	/* Recalculate the comment tree */
+	BP_Activity_Activity::rebuild_activity_comment_tree( $activity_id );
+
+	do_action( 'bp_activity_delete_comment', $activity_id, $comment_id );
+
+	return true;
+}
+	function bp_activity_delete_children( $activity_id, $comment_id) {
+		/* Recursively delete all children of this comment. */
+		if ( $children = BP_Activity_Activity::get_child_comments( $comment_id ) ) {
+			foreach( (array)$children as $child )
+				bp_activity_delete_children( $activity_id, $child->id );
+		}
+		bp_activity_delete( array( 'secondary_item_id' => $comment_id, 'type' => 'activity_comment', 'item_id' => $activity_id ) );
+	}
+
+function bp_activity_get_permalink( $activity_id, $activity_obj = false ) {
+	global $bp;
+
+	if ( !$activity_obj )
+		$activity_obj = new BP_Activity_Activity( $activity_id );
+
+	if ( 'new_blog_post' == $activity_obj->type || 'new_blog_comment' == $activity_obj->type || 'new_forum_topic' == $activity_obj->type || 'new_forum_post' == $activity_obj->type )
+		$link = $activity_obj->primary_link;
+	else {
+		if ( 'activity_comment' == $activity_obj->type )
+			$link = $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activity_obj->item_id . '/';
+		else
+			$link = $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activity_obj->id . '/';
+	}
+
+	return apply_filters( 'bp_activity_get_permalink', $link );
+}
+
+function bp_activity_hide_user_activity( $user_id ) {
+	return BP_Activity_Activity::hide_all_for_user( $user_id );
+}
+
+/**
+ * bp_activity_thumbnail_content_images()
+ *
+ * Take content, remove all images and replace them with one thumbnail image.
+ *
+ * @package BuddyPress Activity
+ * @param $content str - The content to work with
+ * @return $content str - The content with images stripped and replaced with a single thumb.
+ */
+function bp_activity_thumbnail_content_images( $content ) {
+	preg_match_all( '/<img[^>]*>/Ui', $content, $matches );
+	$content = preg_replace('/<img[^>]*>/Ui', '', $content );
+
+	if ( !empty( $matches ) ) {
+		/* Get the SRC value */
+		preg_match( '/<img.*?(src\=[\'|"]{0,1}.*?[\'|"]{0,1})[\s|>]{1}/i', $matches[0][0], $src );
+
+		/* Get the width and height */
+		preg_match( '/<img.*?(height\=[\'|"]{0,1}.*?[\'|"]{0,1})[\s|>]{1}/i', $matches[0][0], $height );
+		preg_match( '/<img.*?(width\=[\'|"]{0,1}.*?[\'|"]{0,1})[\s|>]{1}/i', $matches[0][0], $width );
+
+		if ( !empty( $src ) ) {
+			$src = substr( substr( str_replace( 'src=', '', $src[1] ), 0, -1 ), 1 );
+			$height = substr( substr( str_replace( 'height=', '', $height[1] ), 0, -1 ), 1 );
+			$width = substr( substr( str_replace( 'width=', '', $width[1] ), 0, -1 ), 1 );
+
+			if ( empty( $width ) || empty( $height ) ) {
+				$width = 100;
+				$height = 100;
+			}
+
+			$ratio = (int)$width / (int)$height;
+			$new_height = 100;
+			$new_width = $new_height * $ratio;
+
+			$content = '<img src="' . esc_attr( $src) . '" width="' . $new_width . '" height="' . $new_height . '" alt="' . __( 'Thumbnail', 'buddypress' ) . '" class="align-left thumbnail" />' . $content;
+		}
+	}
+
+	return apply_filters( 'bp_activity_thumbnail_content_images', $content, $matches );
+}
+
+function bp_activity_set_action( $component_id, $key, $value ) {
+	global $bp;
+
+	if ( empty( $component_id ) || empty( $key ) || empty( $value ) )
+		return false;
+
+	$bp->activity->actions->{$component_id}->{$key} = apply_filters( 'bp_activity_set_action', array(
+		'key' => $key,
+		'value' => $value
+	), $component_id, $key, $value );
+}
+
+function bp_activity_get_action( $component_id, $key ) {
+	global $bp;
+
+	if ( empty( $component_id ) || empty( $key ) )
+		return false;
+
+	return apply_filters( 'bp_activity_get_action', $bp->activity->actions->{$component_id}->{$key}, $component_id, $key );
+}
+
+function bp_activity_get_user_favorites( $user_id ) {
+	$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_user_meta( $user_id, 'bp_favorite_activities', $new_favs );
+
+	return apply_filters( 'bp_activity_get_user_favorites', $new_favs );
+}
+
+function bp_activity_add_user_favorite( $activity_id, $user_id = false ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = $bp->loggedin_user->id;
+
+	/* Update the user's personal favorites */
+	$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 */
+	$fav_count = bp_activity_get_meta( $activity_id, 'favorite_count' );
+
+	if ( !empty( $fav_count ) )
+		$fav_count = (int)$fav_count + 1;
+	else
+		$fav_count = 1;
+
+	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 );
+
+	return true;
+}
+
+function bp_activity_remove_user_favorite( $activity_id, $user_id = false ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = $bp->loggedin_user->id;
+
+	/* Remove the fav from the user's favs */
+	$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 ) );
+
+	/* Update the total number of users who have favorited this activity */
+	$fav_count = bp_activity_get_meta( $activity_id, 'favorite_count' );
+
+	if ( !empty( $fav_count ) ) {
+		$fav_count = (int)$fav_count - 1;
+		bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count );
+	}
+
+	update_user_meta( $user_id, 'bp_favorite_activities', $my_favs );
+
+	do_action( 'bp_activity_remove_user_favorite', $activity_id, $user_id );
+
+	return true;
+}
+
+function bp_activity_check_exists_by_content( $content ) {
+	return apply_filters( 'bp_activity_check_exists_by_content', BP_Activity_Activity::check_exists_by_content( $content ) );
+}
+
+function bp_activity_get_last_updated() {
+	return apply_filters( 'bp_activity_get_last_updated', BP_Activity_Activity::get_last_updated() );
+}
+
+function bp_activity_total_favorites_for_user( $user_id = false ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
+
+	return BP_Activity_Activity::total_favorite_count( $user_id );
+}
+
+/********************************************************************************
+ * Activity Meta Functions
+ *
+ * Meta functions allow you to store extra data for a particular item.
+ */
+
+function bp_activity_delete_meta( $activity_id, $meta_key = false, $meta_value = false ) {
+	global $wpdb, $bp;
+
+	if ( !is_numeric( $activity_id ) )
+		return false;
+
+	$meta_key = preg_replace( '|[^a-z0-9_]|i', '', $meta_key );
+
+	if ( is_array( $meta_value ) || is_object( $meta_value ) )
+		$meta_value = serialize( $meta_value );
+
+	$meta_value = trim( $meta_value );
+
+	if ( !$meta_key ) {
+		$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id = %d", $activity_id ) );
+	} else if ( $meta_value ) {
+		$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id = %d AND meta_key = %s AND meta_value = %s", $activity_id, $meta_key, $meta_value ) );
+	} else {
+		$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id = %d AND meta_key = %s", $activity_id, $meta_key ) );
+	}
+
+	wp_cache_delete( 'bp_activity_meta_' . $meta_key . '_' . $activity_id, 'bp' );
+
+	return true;
+}
+
+function bp_activity_get_meta( $activity_id, $meta_key = '' ) {
+	global $wpdb, $bp;
+
+	$activity_id = (int)$activity_id;
+
+	if ( !$activity_id )
+		return false;
+
+	if ( !empty($meta_key) ) {
+		$meta_key = preg_replace( '|[^a-z0-9_]|i', '', $meta_key );
+
+		if ( !$metas = wp_cache_get( 'bp_activity_meta_' . $meta_key . '_' . $activity_id, 'bp' ) ) {
+			$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM {$bp->activity->table_name_meta} WHERE activity_id = %d AND meta_key = %s", $activity_id, $meta_key ) );
+			wp_cache_set( 'bp_activity_meta_' . $meta_key . '_' . $activity_id, $metas, 'bp' );
+		}
+	} else
+		$metas = $wpdb->get_col( $wpdb->prepare( "SELECT meta_value FROM {$bp->activity->table_name_meta} WHERE activity_id = %d", $activity_id ) );
+
+	if ( empty($metas) )
+		return false;
+
+	$metas = array_map( 'maybe_unserialize', (array)$metas );
+
+	if ( 1 == count($metas) )
+		return $metas[0];
+	else
+		return $metas;
+}
+
+function bp_activity_update_meta( $activity_id, $meta_key, $meta_value ) {
+	global $wpdb, $bp;
+
+	if ( !is_numeric( $activity_id ) )
+		return false;
+
+	$meta_key = preg_replace( '|[^a-z0-9_]|i', '', $meta_key );
+
+	if ( is_string( $meta_value ) )
+		$meta_value = stripslashes( $wpdb->escape( $meta_value ) );
+
+	$meta_value = maybe_serialize( $meta_value );
+
+	if ( empty( $meta_value ) ) {
+		return bp_activity_delete_meta( $activity_id, $meta_key );
+	}
+
+	$cur = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name_meta} WHERE activity_id = %d AND meta_key = %s", $activity_id, $meta_key ) );
+
+	if ( !$cur ) {
+		$wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->activity->table_name_meta} ( activity_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", $activity_id, $meta_key, $meta_value ) );
+	} else if ( $cur->meta_value != $meta_value ) {
+		$wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name_meta} SET meta_value = %s WHERE activity_id = %d AND meta_key = %s", $meta_value, $activity_id, $meta_key ) );
+	} else {
+		return false;
+	}
+
+	wp_cache_set( 'bp_activity_meta_' . $meta_key . '_' . $activity_id, $meta_value, 'bp' );
+
+	return true;
+}
+
+function bp_activity_remove_data( $user_id ) {
+	// Clear the user's activity from the sitewide stream and clear their activity tables
+	bp_activity_delete( array( 'user_id' => $user_id ) );
+
+	// Remove any usermeta
+	delete_user_meta( $user_id, 'bp_latest_update' );
+	delete_user_meta( $user_id, 'bp_favorite_activities' );
+
+	do_action( 'bp_activity_remove_data', $user_id );
+}
+add_action( 'wpmu_delete_user', 'bp_activity_remove_data' );
+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
+ *
+ * Functions to set up custom BuddyPress actions that all other components can
+ * hook in to.
+ */
+
+/* Allow core components and dependent plugins to register activity actions */
+function bp_register_activity_actions() {
+	do_action( 'bp_register_activity_actions' );
+}
+add_action( 'bp_loaded', 'bp_register_activity_actions', 8 );
+
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-activity/bp-activity-classes.php b/wp-content/plugins/buddypress/bp-activity/bp-activity-classes.php
new file mode 100644
index 0000000000000000000000000000000000000000..f8d3175f6e1b002980c6ad73669e46ac6cb543dd
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-activity/bp-activity-classes.php
@@ -0,0 +1,553 @@
+<?php
+
+Class BP_Activity_Activity {
+	var $id;
+	var $item_id;
+	var $secondary_item_id;
+	var $user_id;
+	var $primary_link;
+	var $component;
+	var $type;
+	var $action;
+	var $content;
+	var $date_recorded;
+	var $hide_sitewide = false;
+
+	function bp_activity_activity( $id = false ) {
+		global $bp;
+
+		if ( $id ) {
+			$this->id = $id;
+			$this->populate();
+		}
+	}
+
+	function populate() {
+		global $wpdb, $bp;
+
+		$row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE id = %d", $this->id ) );
+		if ( $row ) {
+			$this->id = $row->id;
+			$this->item_id = $row->item_id;
+			$this->secondary_item_id = $row->secondary_item_id;
+			$this->user_id = $row->user_id;
+			$this->primary_link = $row->primary_link;
+			$this->component = $row->component;
+			$this->type = $row->type;
+			$this->action = $row->action;
+			$this->content = $row->content;
+			$this->date_recorded = $row->date_recorded;
+			$this->hide_sitewide = $row->hide_sitewide;
+			$this->mptt_left = $row->mptt_left;
+			$this->mptt_right = $row->mptt_right;
+		}
+	}
+
+	function save() {
+		global $wpdb, $bp, $current_user;
+
+		do_action( 'bp_activity_before_save', &$this );
+
+		$this->id = apply_filters( 'bp_activity_id_before_save', $this->id, &$this );
+		$this->item_id = apply_filters( 'bp_activity_item_id_before_save', $this->item_id, &$this );
+		$this->secondary_item_id = apply_filters( 'bp_activity_secondary_item_id_before_save', $this->secondary_item_id, &$this );
+		$this->user_id = apply_filters( 'bp_activity_user_id_before_save', $this->user_id, &$this );
+		$this->primary_link = apply_filters( 'bp_activity_primary_link_before_save', $this->primary_link, &$this );
+		$this->component = apply_filters( 'bp_activity_component_before_save', $this->component, &$this );
+		$this->type = apply_filters( 'bp_activity_type_before_save', $this->type, &$this );
+		$this->action = apply_filters( 'bp_activity_action_before_save', $this->action, &$this );
+		$this->content = apply_filters( 'bp_activity_content_before_save', $this->content, &$this );
+		$this->date_recorded = apply_filters( 'bp_activity_date_recorded_before_save', $this->date_recorded, &$this );
+		$this->hide_sitewide = apply_filters( 'bp_activity_hide_sitewide_before_save', $this->hide_sitewide, &$this );
+		$this->mptt_left = apply_filters( 'bp_activity_mptt_left_before_save', $this->mptt_left, &$this );
+		$this->mptt_right = apply_filters( 'bp_activity_mptt_right_before_save', $this->mptt_right, &$this );
+
+		if ( !$this->component || !$this->type )
+			return false;
+
+		if ( !$this->primary_link )
+			$this->primary_link = $bp->loggedin_user->domain;
+
+		/* If we have an existing ID, update the activity item, otherwise insert it. */
+		if ( $this->id )
+			$q = $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET user_id = %d, component = %s, type = %s, action = %s, content = %s, primary_link = %s, date_recorded = %s, item_id = %s, secondary_item_id = %s, hide_sitewide = %d WHERE id = %d", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->id );
+		else
+			$q = $wpdb->prepare( "INSERT INTO {$bp->activity->table_name} ( user_id, component, type, action, content, primary_link, date_recorded, item_id, secondary_item_id, hide_sitewide ) VALUES ( %d, %s, %s, %s, %s, %s, %s, %s, %s, %d )", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide );
+
+		if ( !$wpdb->query( $q ) )
+			return false;
+
+		if ( empty( $this->id ) )
+			$this->id = $wpdb->insert_id;
+
+		do_action( 'bp_activity_after_save', &$this );
+		return true;
+	}
+
+	/* Static Functions */
+
+	function get( $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $search_terms = false, $filter = false, $display_comments = false, $show_hidden = false ) {
+		global $wpdb, $bp;
+
+		/* Select conditions */
+		$select_sql = "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name";
+
+		$from_sql = " FROM {$bp->activity->table_name} a LEFT JOIN {$wpdb->users} u ON a.user_id = u.ID";
+
+		/* Where conditions */
+		$where_conditions = array();
+
+		/* Searching */
+		if ( $search_terms ) {
+			$search_terms = $wpdb->escape( $search_terms );
+			$where_conditions['search_sql'] = "a.content LIKE '%%" . like_escape( $search_terms ) . "%%'";
+		}
+
+		/* Filtering */
+		if ( $filter && $filter_sql = BP_Activity_Activity::get_filter_sql( $filter ) )
+			$where_conditions['filter_sql'] = $filter_sql;
+
+		/* Sorting */
+		if ( $sort != 'ASC' && $sort != 'DESC' )
+			$sort = 'DESC';
+
+		/* Hide Hidden Items? */
+		if ( !$show_hidden )
+			$where_conditions['hidden_sql'] = "a.hide_sitewide = 0";
+
+		/* Alter the query based on whether we want to show activity item comments in the stream like normal comments or threaded below the activity */
+		if ( !$display_comments || 'threaded' == $display_comments ) {
+			$where_conditions[] = "a.type != 'activity_comment'";
+		}
+
+		$where_sql = 'WHERE ' . join( ' AND ', $where_conditions );
+
+		if ( $per_page && $page ) {
+			$pag_sql = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $per_page ), intval( $per_page ) );
+			$activities = $wpdb->get_results( $wpdb->prepare( "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}" ) );
+		} else
+			$activities = $wpdb->get_results( $wpdb->prepare( "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}" ) );
+
+		$total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(a.id) FROM {$bp->activity->table_name} a {$where_sql} ORDER BY a.date_recorded {$sort}" ) );
+
+		/* Get the fullnames of users so we don't have to query in the loop */
+		if ( function_exists( 'xprofile_install' ) && $activities ) {
+			foreach ( (array)$activities as $activity ) {
+				if ( (int)$activity->user_id )
+					$activity_user_ids[] = $activity->user_id;
+			}
+
+			$activity_user_ids = implode( ',', array_unique( (array)$activity_user_ids ) );
+			if ( !empty( $activity_user_ids ) ) {
+				if ( $names = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, value AS user_fullname FROM {$bp->profile->table_name_data} WHERE field_id = 1 AND user_id IN ({$activity_user_ids})" ) ) ) {
+					foreach ( (array)$names as $name )
+						$tmp_names[$name->user_id] = $name->user_fullname;
+
+					foreach ( (array)$activities as $i => $activity ) {
+						if ( !empty( $tmp_names[$activity->user_id] ) )
+							$activities[$i]->user_fullname = $tmp_names[$activity->user_id];
+					}
+
+					unset( $names );
+					unset( $tmp_names );
+				}
+			}
+		}
+
+		if ( $activities && $display_comments )
+			$activities = BP_Activity_Activity::append_comments( &$activities );
+
+		/* If $max is set, only return up to the max results */
+		if ( !empty( $max ) ) {
+			if ( (int)$total_activities > (int)$max )
+				$total_activities = $max;
+		}
+
+		return array( 'activities' => $activities, 'total' => (int)$total_activities );
+	}
+
+	function get_specific( $activity_ids, $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $display_comments = false ) {
+		global $wpdb, $bp;
+
+		if ( is_array( $activity_ids ) )
+			$activity_ids = implode( ',', $activity_ids );
+
+		$activity_ids = $wpdb->escape( $activity_ids );
+
+		if ( empty( $activity_ids ) )
+			return false;
+
+		if ( $per_page && $page )
+			$pag_sql = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $per_page ), intval( $per_page ) );
+
+		if ( $sort != 'ASC' && $sort != 'DESC' )
+			$sort = 'DESC';
+
+		$activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE id IN ({$activity_ids}) ORDER BY date_recorded {$sort} $pag_sql" ) );
+		$total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->activity->table_name} WHERE id IN ({$activity_ids})" ) );
+
+		if ( $display_comments )
+			$activities = BP_Activity_Activity::append_comments( $activities );
+
+		/* If $max is set, only return up to the max results */
+		if ( !empty( $max ) ) {
+			if ( (int)$total_activities > (int)$max )
+				$total_activities = $max;
+		}
+
+		return array( 'activities' => $activities, 'total' => (int)$total_activities );
+	}
+
+	function get_id( $user_id, $component, $type, $item_id, $secondary_item_id, $action, $content, $date_recorded ) {
+		global $bp, $wpdb;
+
+		$where_args = false;
+
+		if ( !empty( $user_id ) )
+			$where_args[] = $wpdb->prepare( "user_id = %d", $user_id );
+
+		if ( !empty( $component ) )
+			$where_args[] = $wpdb->prepare( "component = %s", $component );
+
+		if ( !empty( $type ) )
+			$where_args[] = $wpdb->prepare( "type = %s", $type );
+
+		if ( !empty( $item_id ) )
+			$where_args[] = $wpdb->prepare( "item_id = %s", $item_id );
+
+		if ( !empty( $secondary_item_id ) )
+			$where_args[] = $wpdb->prepare( "secondary_item_id = %s", $secondary_item_id );
+
+		if ( !empty( $action ) )
+			$where_args[] = $wpdb->prepare( "action = %s", $action );
+
+		if ( !empty( $content ) )
+			$where_args[] = $wpdb->prepare( "content = %s", $content );
+
+		if ( !empty( $date_recorded ) )
+			$where_args[] = $wpdb->prepare( "date_recorded = %s", $date_recorded );
+
+		if ( !empty( $where_args ) )
+			$where_sql = 'WHERE ' . join( ' AND ', $where_args );
+		else
+			return false;
+
+		return $wpdb->get_var( "SELECT id FROM {$bp->activity->table_name} {$where_sql}" );
+	}
+
+	function delete( $args ) {
+		global $wpdb, $bp;
+
+		extract( $args );
+
+		$defaults = array(
+			'id' => false,
+			'action' => false,
+			'content' => false,
+			'component' => false,
+			'type' => false,
+			'primary_link' => false,
+			'user_id' => false,
+			'item_id' => false,
+			'secondary_item_id' => false,
+			'date_recorded' => false,
+			'hide_sitewide' => false
+		);
+
+		$where_args = false;
+
+		if ( !empty( $id ) )
+			$where_args[] = $wpdb->prepare( "id = %d", $id );
+
+		if ( !empty( $user_id ) )
+			$where_args[] = $wpdb->prepare( "user_id = %d", $user_id );
+
+		if ( !empty( $action ) )
+			$where_args[] = $wpdb->prepare( "action = %s", $action );
+
+		if ( !empty( $content ) )
+			$where_args[] = $wpdb->prepare( "content = %s", $content );
+
+		if ( !empty( $component ) )
+			$where_args[] = $wpdb->prepare( "component = %s", $component );
+
+		if ( !empty( $type ) )
+			$where_args[] = $wpdb->prepare( "type = %s", $type );
+
+		if ( !empty( $primary_link ) )
+			$where_args[] = $wpdb->prepare( "primary_link = %s", $primary_link );
+
+		if ( !empty( $item_id ) )
+			$where_args[] = $wpdb->prepare( "item_id = %s", $item_id );
+
+		if ( !empty( $secondary_item_id ) )
+			$where_args[] = $wpdb->prepare( "secondary_item_id = %s", $secondary_item_id );
+
+		if ( !empty( $date_recorded ) )
+			$where_args[] = $wpdb->prepare( "date_recorded = %s", $date_recorded );
+
+		if ( !empty( $hide_sitewide ) )
+			$where_args[] = $wpdb->prepare( "hide_sitewide = %d", $hide_sitewide );
+
+		if ( !empty( $where_args ) )
+			$where_sql = 'WHERE ' . join( ' AND ', $where_args );
+		else
+			return false;
+
+		/* Fetch the activity IDs so we can delete any comments for this activity item */
+		$activity_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} {$where_sql}" ) );
+
+		if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} {$where_sql}" ) ) )
+			return false;
+
+		if ( $activity_ids ) {
+			BP_Activity_Activity::delete_activity_item_comments( $activity_ids );
+			BP_Activity_Activity::delete_activity_meta_entries( $activity_ids );
+
+			return $activity_ids;
+		}
+
+		return $activity_ids;
+	}
+
+	function delete_activity_item_comments( $activity_ids ) {
+		global $bp, $wpdb;
+
+		if ( is_array($activity_ids) )
+			$activity_ids = implode( ',', $activity_ids );
+
+		$activity_ids = $wpdb->escape( $activity_ids );
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND item_id IN ({$activity_ids})" ) );
+	}
+
+	function delete_activity_meta_entries( $activity_ids ) {
+		global $bp, $wpdb;
+
+		if ( is_array($activity_ids) )
+			$activity_ids = implode( ',', $activity_ids );
+
+		$activity_ids = $wpdb->escape( $activity_ids );
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id IN ({$activity_ids})" ) );
+	}
+
+	function append_comments( $activities ) {
+		global $bp, $wpdb;
+
+		/* Now fetch the activity comments and parse them into the correct position in the activities array. */
+		foreach( (array)$activities as $activity ) {
+			if ( 'activity_comment' != $activity->type && $activity->mptt_left && $activity->mptt_right )
+				$activity_comments[$activity->id] = BP_Activity_Activity::get_activity_comments( $activity->id, $activity->mptt_left, $activity->mptt_right );
+		}
+
+		/* Merge the comments with the activity items */
+		foreach( (array)$activities as $key => $activity )
+			$activities[$key]->children = $activity_comments[$activity->id];
+
+		return $activities;
+	}
+
+	function get_activity_comments( $activity_id, $left, $right ) {
+		global $wpdb, $bp;
+
+		if ( !$comments = wp_cache_get( 'bp_activity_comments_' . $activity_id ) ) {
+			/* Select the user's fullname with the query so we don't have to fetch it for each comment */
+			if ( function_exists( 'xprofile_install' ) ) {
+				$fullname_select = ", pd.value as user_fullname";
+				$fullname_from = ", {$bp->profile->table_name_data} pd ";
+				$fullname_where = "AND pd.user_id = a.user_id AND pd.field_id = 1";
+			}
+
+			/* Retrieve all descendants of the $root node */
+			$descendants = $wpdb->get_results( $wpdb->prepare( "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name{$fullname_select} FROM {$bp->activity->table_name} a, {$wpdb->users} u{$fullname_from} WHERE u.ID = a.user_id {$fullname_where} AND a.type = 'activity_comment' AND a.item_id = %d AND a.mptt_left BETWEEN %d AND %d ORDER BY a.date_recorded ASC", $activity_id, $left, $right ) );
+
+			/* Loop descendants and build an assoc array */
+			foreach ( (array)$descendants as $d ) {
+			    $d->children = array();
+
+				/* If we have a reference on the parent */
+			    if ( isset( $ref[ $d->secondary_item_id ] ) ) {
+			        $ref[ $d->secondary_item_id ]->children[ $d->id ] = $d;
+			        $ref[ $d->id ] =& $ref[ $d->secondary_item_id ]->children[ $d->id ];
+
+				/* If we don't have a reference on the parent, put in the root level */
+			    } else {
+			        $comments[ $d->id ] = $d;
+			        $ref[ $d->id ] =& $comments[ $d->id ];
+			    }
+			}
+			wp_cache_set( 'bp_activity_comments_' . $activity_id, $comments, 'bp' );
+		}
+
+		return $comments;
+	}
+
+	function rebuild_activity_comment_tree( $parent_id, $left = 1 ) {
+		global $wpdb, $bp;
+
+		/* The right value of this node is the left value + 1 */
+		$right = $left + 1;
+
+		/* Get all descendants of this node */
+		$descendants = BP_Activity_Activity::get_child_comments( $parent_id );
+
+		/* Loop the descendants and recalculate the left and right values */
+		foreach ( (array)$descendants as $descendant )
+			$right = BP_Activity_Activity::rebuild_activity_comment_tree( $descendant->id, $right );
+
+		/* We've got the left value, and now that we've processed the children of this node we also know the right value */
+		if ( 1 == $left )
+			$wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET mptt_left = %d, mptt_right = %d WHERE id = %d", $left, $right, $parent_id ) );
+		else
+			$wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET mptt_left = %d, mptt_right = %d WHERE type = 'activity_comment' AND id = %d", $left, $right, $parent_id ) );
+
+		/* Return the right value of this node + 1 */
+		return $right + 1;
+	}
+
+	function get_child_comments( $parent_id ) {
+		global $bp, $wpdb;
+
+		return $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND secondary_item_id = %d", $parent_id ) );
+	}
+
+	function get_recorded_components() {
+		global $wpdb, $bp;
+
+		return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC" ) );
+	}
+
+	function get_sitewide_items_for_feed( $limit = 35 ) {
+		global $wpdb, $bp;
+
+		$activities = bp_activity_get_sitewide( array( 'max' => $limit ) );
+
+		for ( $i = 0; $i < count($activities); $i++ ) {
+				$title = explode( '<span', $activities[$i]['content'] );
+
+				$activity_feed[$i]['title'] = trim( strip_tags( $title[0] ) );
+				$activity_feed[$i]['link'] = $activities[$i]['primary_link'];
+				$activity_feed[$i]['description'] = @sprintf( $activities[$i]['content'], '' );
+				$activity_feed[$i]['pubdate'] = $activities[$i]['date_recorded'];
+		}
+
+		return $activity_feed;
+	}
+
+	function get_filter_sql( $filter_array ) {
+		global $wpdb;
+
+		if ( !empty( $filter_array['user_id'] ) ) {
+			$user_filter = explode( ',', $filter_array['user_id'] );
+			$user_sql = ' ( a.user_id IN ( ' . $filter_array['user_id'] . ' ) )';
+			$filter_sql[] = $user_sql;
+		}
+
+		if ( !empty( $filter_array['object'] ) ) {
+			$object_filter = explode( ',', $filter_array['object'] );
+			$object_sql = ' ( ';
+
+			$counter = 1;
+			foreach( (array) $object_filter as $object ) {
+				$object_sql .= $wpdb->prepare( "a.component = %s", trim( $object ) );
+
+				if ( $counter != count( $object_filter ) )
+					$object_sql .= ' || ';
+
+				$counter++;
+			}
+
+			$object_sql .= ' )';
+			$filter_sql[] = $object_sql;
+		}
+
+		if ( !empty( $filter_array['action'] ) ) {
+			$action_filter = explode( ',', $filter_array['action'] );
+			$action_sql = ' ( ';
+
+			$counter = 1;
+			foreach( (array) $action_filter as $action ) {
+				$action_sql .= $wpdb->prepare( "a.type = %s", trim( $action ) );
+
+				if ( $counter != count( $action_filter ) )
+					$action_sql .= ' || ';
+
+				$counter++;
+			}
+
+			$action_sql .= ' )';
+			$filter_sql[] = $action_sql;
+		}
+
+		if ( !empty( $filter_array['primary_id'] ) ) {
+			$pid_filter = explode( ',', $filter_array['primary_id'] );
+			$pid_sql = ' ( ';
+
+			$counter = 1;
+			foreach( (array) $pid_filter as $pid ) {
+				$pid_sql .= $wpdb->prepare( "a.item_id = %s", trim( $pid ) );
+
+				if ( $counter != count( $pid_filter ) )
+					$pid_sql .= ' || ';
+
+				$counter++;
+			}
+
+			$pid_sql .= ' )';
+			$filter_sql[] = $pid_sql;
+		}
+
+		if ( !empty( $filter_array['secondary_id'] ) ) {
+			$sid_filter = explode( ',', $filter_array['secondary_id'] );
+			$sid_sql = ' ( ';
+
+			$counter = 1;
+			foreach( (array) $sid_filter as $sid ) {
+				$sid_sql .= $wpdb->prepare( "a.secondary_item_id = %s", trim( $sid ) );
+
+				if ( $counter != count( $sid_filter ) )
+					$sid_sql .= ' || ';
+
+				$counter++;
+			}
+
+			$sid_sql .= ' )';
+			$filter_sql[] = $sid_sql;
+		}
+
+		if ( empty($filter_sql) )
+			return false;
+
+		return join( ' AND ', $filter_sql );
+	}
+
+	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 DESC LIMIT 1" ) );
+	}
+
+	function total_favorite_count( $user_id ) {
+		global $bp;
+
+		if ( !$favorite_activity_entries = get_user_meta( $user_id, 'bp_favorite_activities', true ) )
+			return 0;
+
+		return count( maybe_unserialize( $favorite_activity_entries ) );
+	}
+
+	function check_exists_by_content( $content ) {
+		global $wpdb, $bp;
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE content = %s", $content ) );
+	}
+
+	function hide_all_for_user( $user_id ) {
+		global $wpdb, $bp;
+
+		return $wpdb->get_var( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET hide_sitewide = 1 WHERE user_id = %d", $user_id ) );
+	}
+}
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-activity/bp-activity-filters.php b/wp-content/plugins/buddypress/bp-activity/bp-activity-filters.php
new file mode 100644
index 0000000000000000000000000000000000000000..aa9d1a03de08ab168fc1210f0cc211af8674afbe
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-activity/bp-activity-filters.php
@@ -0,0 +1,144 @@
+<?php
+
+/* Apply WordPress defined filters */
+add_filter( 'bp_get_activity_action',                'bp_activity_filter_kses', 1 );
+add_filter( 'bp_get_activity_content_body',          'bp_activity_filter_kses', 1 );
+add_filter( 'bp_get_activity_content',               'bp_activity_filter_kses', 1 );
+add_filter( 'bp_get_activity_parent_content',        'bp_activity_filter_kses', 1 );
+add_filter( 'bp_get_activity_latest_update',         'bp_activity_filter_kses', 1 );
+add_filter( 'bp_get_activity_latest_update_excerpt', 'bp_activity_filter_kses', 1 );
+add_filter( 'bp_get_activity_feed_item_description', 'bp_activity_filter_kses', 1 );
+add_filter( 'bp_activity_content_before_save',       'bp_activity_filter_kses', 1 );
+add_filter( 'bp_activity_action_before_save',        'bp_activity_filter_kses', 1 );
+
+add_filter( 'bp_get_activity_action',                'force_balance_tags' );
+add_filter( 'bp_get_activity_content_body',          'force_balance_tags' );
+add_filter( 'bp_get_activity_content',               'force_balance_tags' );
+add_filter( 'bp_get_activity_latest_update',         'force_balance_tags' );
+add_filter( 'bp_get_activity_latest_update_excerpt', 'force_balance_tags' );
+add_filter( 'bp_get_activity_feed_item_description', 'force_balance_tags' );
+add_filter( 'bp_activity_content_before_save',       'force_balance_tags' );
+add_filter( 'bp_activity_action_before_save',        'force_balance_tags' );
+
+add_filter( 'bp_get_activity_action',                'wptexturize' );
+add_filter( 'bp_get_activity_content_body',          'wptexturize' );
+add_filter( 'bp_get_activity_content',               'wptexturize' );
+add_filter( 'bp_get_activity_parent_content',        'wptexturize' );
+add_filter( 'bp_get_activity_latest_update',         'wptexturize' );
+add_filter( 'bp_get_activity_latest_update_excerpt', 'wptexturize' );
+
+add_filter( 'bp_get_activity_action',                'convert_smilies' );
+add_filter( 'bp_get_activity_content_body',          'convert_smilies' );
+add_filter( 'bp_get_activity_content',               'convert_smilies' );
+add_filter( 'bp_get_activity_parent_content',        'convert_smilies' );
+add_filter( 'bp_get_activity_latest_update',         'convert_smilies' );
+add_filter( 'bp_get_activity_latest_update_excerpt', 'convert_smilies' );
+
+add_filter( 'bp_get_activity_action',                'convert_chars' );
+add_filter( 'bp_get_activity_content_body',          'convert_chars' );
+add_filter( 'bp_get_activity_content',               'convert_chars' );
+add_filter( 'bp_get_activity_parent_content',        'convert_chars' );
+add_filter( 'bp_get_activity_latest_update',         'convert_chars' );
+add_filter( 'bp_get_activity_latest_update_excerpt', 'convert_chars' );
+
+add_filter( 'bp_get_activity_action',                'wpautop' );
+add_filter( 'bp_get_activity_content_body',          'wpautop' );
+add_filter( 'bp_get_activity_content',               'wpautop' );
+add_filter( 'bp_get_activity_feed_item_description', 'wpautop' );
+
+add_filter( 'bp_get_activity_action',                'make_clickable' );
+add_filter( 'bp_get_activity_content_body',          'make_clickable' );
+add_filter( 'bp_get_activity_content',               'make_clickable' );
+add_filter( 'bp_get_activity_parent_content',        'make_clickable' );
+add_filter( 'bp_get_activity_latest_update',         'make_clickable' );
+add_filter( 'bp_get_activity_latest_update_excerpt', 'make_clickable' );
+add_filter( 'bp_get_activity_feed_item_description', 'make_clickable' );
+
+add_filter( 'bp_acomment_name',                      'stripslashes_deep' );
+add_filter( 'bp_get_activity_action',                'stripslashes_deep' );
+add_filter( 'bp_get_activity_content',               'stripslashes_deep' );
+add_filter( 'bp_get_activity_content_body',          'stripslashes_deep' );
+add_filter( 'bp_get_activity_parent_content',        'stripslashes_deep' );
+add_filter( 'bp_get_activity_latest_update',         'stripslashes_deep' );
+add_filter( 'bp_get_activity_latest_update_excerpt', 'stripslashes_deep' );
+add_filter( 'bp_get_activity_feed_item_description', 'stripslashes_deep' );
+
+/* Apply BuddyPress defined filters */
+add_filter( 'bp_get_activity_content',               'bp_activity_make_nofollow_filter' );
+add_filter( 'bp_get_activity_content_body',          'bp_activity_make_nofollow_filter' );
+add_filter( 'bp_get_activity_parent_content',        'bp_activity_make_nofollow_filter' );
+add_filter( 'bp_get_activity_latest_update',         'bp_activity_make_nofollow_filter' );
+add_filter( 'bp_get_activity_latest_update_excerpt', 'bp_activity_make_nofollow_filter' );
+add_filter( 'bp_get_activity_feed_item_description', 'bp_activity_make_nofollow_filter' );
+
+add_filter( 'bp_get_activity_parent_content', 'bp_create_excerpt' );
+
+/* Allow shortcodes in activity posts */
+add_filter( 'bp_get_activity_content', 'do_shortcode' );
+add_filter( 'bp_get_activity_content_body', 'do_shortcode' );
+
+function bp_activity_filter_kses( $content ) {
+	global $allowedtags;
+
+	$activity_allowedtags = $allowedtags;
+	$activity_allowedtags['span']          = array();
+	$activity_allowedtags['span']['class'] = array();
+	$activity_allowedtags['div']           = array();
+	$activity_allowedtags['div']['class']  = array();
+	$activity_allowedtags['div']['id']     = array();
+	$activity_allowedtags['a']['class']    = array();
+	$activity_allowedtags['img']           = array();
+	$activity_allowedtags['img']['src']    = array();
+	$activity_allowedtags['img']['alt']    = array();
+	$activity_allowedtags['img']['class']  = array();
+	$activity_allowedtags['img']['width']  = array();
+	$activity_allowedtags['img']['height'] = array();
+	$activity_allowedtags['img']['class']  = array();
+	$activity_allowedtags['img']['id']     = array();
+	$activity_allowedtags['img']['title']  = array();
+	$activity_allowedtags['code']          = array();
+
+	$activity_allowedtags = apply_filters( 'bp_activity_allowed_tags', $activity_allowedtags );
+	return wp_kses( $content, $activity_allowedtags );
+}
+
+function bp_activity_at_name_filter( $content ) {
+	include_once( ABSPATH . WPINC . '/registration.php' );
+
+	$pattern = '/[@]+([A-Za-z0-9-_\.]+)/';
+	preg_match_all( $pattern, $content, $usernames );
+
+	// Make sure there's only one instance of each username
+	if ( !$usernames = array_unique( $usernames[1] ) )
+		return $content;
+
+	foreach( (array)$usernames as $username ) {
+		if ( !$user_id = username_exists( $username ) )
+			continue;
+
+		// Increase the number of new @ mentions for the user
+		$new_mention_count = (int)get_user_meta( $user_id, 'bp_new_mention_count', true );
+		update_user_meta( $user_id, 'bp_new_mention_count', $new_mention_count + 1 );
+
+		$content = str_replace( "@$username", "<a href='" . bp_core_get_user_domain( bp_core_get_userid( $username ) ) . "' rel='nofollow'>@$username</a>", $content );
+	}
+
+	return $content;
+}
+add_filter( 'bp_activity_new_update_content',     'bp_activity_at_name_filter' );
+add_filter( 'groups_activity_new_update_content', 'bp_activity_at_name_filter' );
+add_filter( 'pre_comment_content',                'bp_activity_at_name_filter' );
+add_filter( 'group_forum_topic_text_before_save', 'bp_activity_at_name_filter' );
+add_filter( 'group_forum_post_text_before_save',  'bp_activity_at_name_filter' );
+add_filter( 'bp_activity_comment_content',        'bp_activity_at_name_filter' );
+
+function bp_activity_make_nofollow_filter( $text ) {
+	return preg_replace_callback( '|<a (.+?)>|i', 'bp_activity_make_nofollow_filter_callback', $text );
+}
+	function bp_activity_make_nofollow_filter_callback( $matches ) {
+		$text = $matches[1];
+		$text = str_replace( array( ' rel="nofollow"', " rel='nofollow'"), '', $text );
+		return "<a $text rel=\"nofollow\">";
+	}
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-activity/bp-activity-notifications.php b/wp-content/plugins/buddypress/bp-activity/bp-activity-notifications.php
new file mode 100644
index 0000000000000000000000000000000000000000..c6ec252e53ba25c23b74f3b40099b4c074842a58
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-activity/bp-activity-notifications.php
@@ -0,0 +1,142 @@
+<?php
+
+function bp_activity_at_message_notification( $content, $poster_user_id, $activity_id ) {
+	global $bp;
+
+	/* Scan for @username strings in an activity update. Notify each user. */
+	$pattern = '/[@]+([A-Za-z0-9-_\.]+)/';
+	preg_match_all( $pattern, $content, $usernames );
+
+	/* Make sure there's only one instance of each username */
+	if ( !$usernames = array_unique( $usernames[1] ) )
+		return false;
+
+	foreach( (array)$usernames as $username ) {
+		if ( !$receiver_user_id = bp_core_get_userid( $username ) )
+			continue;
+
+		// Now email the user with the contents of the message (if they have enabled email notifications)
+		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 );
+			$settings_link = bp_core_get_user_domain( $receiver_user_id ) .  BP_SETTINGS_SLUG . '/notifications/';
+
+			$poster_name = stripslashes( $poster_name );
+			$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;
+			$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( __(
+'%s mentioned you in an update:
+
+"%s"
+
+To view and respond to the message, log in and visit: %s
+
+---------------------
+', 'buddypress' ), $poster_name, $content, $message_link );
+
+			$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
+
+			/* Send the message */
+			$to = apply_filters( 'bp_activity_at_message_notification_to', $to );
+			$subject = apply_filters( 'bp_activity_at_message_notification_subject', $subject, $poster_name );
+			$message = apply_filters( 'bp_activity_at_message_notification_message', $message, $poster_name, $content, $message_link );
+
+			wp_mail( $to, $subject, $message );
+		}
+	}
+}
+add_action( 'bp_activity_posted_update', 'bp_activity_at_message_notification', 10, 3 );
+
+function bp_activity_new_comment_notification( $comment_id, $commenter_id, $params ) {
+	global $bp;
+
+	extract( $params );
+
+	$original_activity = new BP_Activity_Activity( $activity_id );
+
+	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/';
+
+		$poster_name = stripslashes( $poster_name );
+		$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;
+		$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( __(
+'%s replied to one of your updates:
+
+"%s"
+
+To view your original update and all comments, log in and visit: %s
+
+---------------------
+', 'buddypress' ), $poster_name, $content, $thread_link );
+
+		$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
+
+		/* Send the message */
+		$to = apply_filters( 'bp_activity_new_comment_notification_to', $to );
+		$subject = apply_filters( 'bp_activity_new_comment_notification_subject', $subject, $poster_name );
+		$message = apply_filters( 'bp_activity_new_comment_notification_message', $message, $poster_name, $content, $thread_link );
+
+		wp_mail( $to, $subject, $message );
+	}
+
+	/***
+	 * If this is a reply to another comment, send an email notification to the
+	 * author of the immediate parent comment.
+	 */
+	if ( $activity_id == $parent_id )
+		return false;
+
+	$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_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;
+		$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 ) );
+
+$message = sprintf( __(
+'%s replied to one of your comments:
+
+"%s"
+
+To view the original activity, your comment and all replies, log in and visit: %s
+
+---------------------
+', 'buddypress' ), $poster_name, $content, $thread_link );
+
+		$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
+
+		/* Send the message */
+		$to = apply_filters( 'bp_activity_new_comment_notification_comment_author_to', $to );
+		$subject = apply_filters( 'bp_activity_new_comment_notification_comment_author_subject', $subject, $poster_name );
+		$message = apply_filters( 'bp_activity_new_comment_notification_comment_author_message', $message, $poster_name, $content );
+
+		wp_mail( $to, $subject, $message );
+	}
+}
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-activity/bp-activity-templatetags.php b/wp-content/plugins/buddypress/bp-activity/bp-activity-templatetags.php
new file mode 100644
index 0000000000000000000000000000000000000000..c7e1f15ebb33ce315faf024a0e9e8eed28761210
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-activity/bp-activity-templatetags.php
@@ -0,0 +1,1074 @@
+<?php
+
+class BP_Activity_Template {
+	var $current_activity = -1;
+	var $activity_count;
+	var $total_activity_count;
+	var $activities;
+	var $activity;
+
+	var $in_the_loop;
+
+	var $pag_page;
+	var $pag_num;
+	var $pag_links;
+
+	var $full_name;
+
+	function bp_activity_template( $page, $per_page, $max, $include, $sort, $filter, $search_terms, $display_comments, $show_hidden ) {
+		global $bp;
+
+		$this->pag_page = isset( $_REQUEST['acpage'] ) ? intval( $_REQUEST['acpage'] ) : $page;
+		$this->pag_num  = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
+
+		// Check if blog/forum replies are disabled
+		$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_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', true ) );
+
+		// Fetch specific activity items based on ID's
+		if ( !empty( $include ) )
+			$this->activities = bp_activity_get_specific( array( 'activity_ids' => explode( ',', $include ), 'max' => $max, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'sort' => $sort, 'display_comments' => $display_comments ) );
+		// Fetch all activity items
+		else
+			$this->activities = bp_activity_get( array( 'display_comments' => $display_comments, 'max' => $max, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'sort' => $sort, 'search_terms' => $search_terms, 'filter' => $filter, 'show_hidden' => $show_hidden ) );
+
+		if ( !$max || $max >= (int)$this->activities['total'] )
+			$this->total_activity_count = (int)$this->activities['total'];
+		else
+			$this->total_activity_count = (int)$max;
+
+		$this->activities = $this->activities['activities'];
+
+		if ( $max ) {
+			if ( $max >= count($this->activities) ) {
+				$this->activity_count = count( $this->activities );
+			} else {
+				$this->activity_count = (int)$max;
+			}
+		} else {
+			$this->activity_count = count( $this->activities );
+		}
+
+		$this->full_name = $bp->displayed_user->fullname;
+
+		// Fetch parent content for activity comments so we do not have to query in the loop
+		foreach ( (array)$this->activities as $activity ) {
+			if ( 'activity_comment' != $activity->type )
+				continue;
+
+			$parent_ids[] = $activity->item_id;
+		}
+
+		if ( !empty( $parent_ids ) )
+			$activity_parents = bp_activity_get_specific( array( 'activity_ids' => $parent_ids ) );
+
+		if ( !empty( $activity_parents['activities'] ) ) {
+			foreach( $activity_parents['activities'] as $parent )
+				$this->activity_parents[$parent->id] = $parent;
+
+			unset( $activity_parents );
+		}
+
+		if ( (int)$this->total_activity_count && (int)$this->pag_num ) {
+			$this->pag_links = paginate_links( array(
+				'base'      => add_query_arg( 'acpage', '%#%' ),
+				'format'    => '',
+				'total'     => ceil( (int)$this->total_activity_count / (int)$this->pag_num ),
+				'current'   => (int)$this->pag_page,
+				'prev_text' => '&larr;',
+				'next_text' => '&rarr;',
+				'mid_size'  => 1
+			) );
+		}
+	}
+
+	function has_activities() {
+		if ( $this->activity_count )
+			return true;
+
+		return false;
+	}
+
+	function next_activity() {
+		$this->current_activity++;
+		$this->activity = $this->activities[$this->current_activity];
+
+		return $this->activity;
+	}
+
+	function rewind_activities() {
+		$this->current_activity = -1;
+		if ( $this->activity_count > 0 ) {
+			$this->activity = $this->activities[0];
+		}
+	}
+
+	function user_activities() {
+		if ( $this->current_activity + 1 < $this->activity_count ) {
+			return true;
+		} elseif ( $this->current_activity + 1 == $this->activity_count ) {
+			do_action('activity_loop_end');
+			// Do some cleaning up after the loop
+			$this->rewind_activities();
+		}
+
+		$this->in_the_loop = false;
+		return false;
+	}
+
+	function the_activity() {
+		global $activity;
+
+		$this->in_the_loop = true;
+		$this->activity = $this->next_activity();
+
+		if ( is_array( $this->activity ) )
+			$this->activity = (object) $this->activity;
+
+		if ( $this->current_activity == 0 ) // loop has just started
+			do_action('activity_loop_start');
+	}
+}
+
+function bp_has_activities( $args = '' ) {
+	global $bp, $activities_template;
+
+	/***
+	 * Set the defaults based on the current page. Any of these will be overridden
+	 * if arguments are directly passed into the loop. Custom plugins should always
+	 * pass their parameters directly to the loop.
+	 */
+	$user_id = false;
+	$include = false;
+	$show_hidden = false;
+	$object = false;
+	$primary_id = false;
+
+	/* User filtering */
+	if ( !empty( $bp->displayed_user->id ) )
+		$user_id = $bp->displayed_user->id;
+
+	/* Group filtering */
+	if ( !empty( $bp->groups->current_group ) ) {
+		$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 ) || $bp->loggedin_user->is_super_admin ) )
+			$show_hidden = true;
+	}
+
+	/* Support for permalinks on single item pages: /groups/my-group/activity/124/ */
+	if ( $bp->current_action == $bp->activity->slug )
+		$include = $bp->action_variables[0];
+
+	/* Note: any params used for filtering can be a single value, or multiple values comma separated. */
+	$defaults = array(
+		'display_comments' => 'threaded', // false for none, stream/threaded - show comments in the stream or threaded under items
+		'include' => $include, // pass an activity_id or string of ID's comma separated
+		'sort' => 'DESC', // sort DESC or ASC
+		'page' => 1, // which page to load
+		'per_page' => 20, // number of items per page
+		'max' => false, // max number to return
+		'show_hidden' => $show_hidden, // Show activity items that are hidden site-wide?
+
+		/* Scope - pre-built activity filters for a user (friends/groups/favorites/mentions) */
+		'scope' => $bp->current_action,
+
+		/* Filtering */
+		'user_id' => $user_id, // user_id to filter on
+		'object' => $object, // object to filter on e.g. groups, profile, status, friends
+		'action' => false, // action to filter on e.g. activity_update, new_forum_post, profile_updated
+		'primary_id' => $primary_id, // object ID to filter on e.g. a group_id or forum_id or blog_id etc.
+		'secondary_id' => false, // secondary object ID to filter on e.g. a post_id
+
+		/* Searching */
+		'search_terms' => false // specify terms to search on
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r );
+
+	/* If you have passed a "scope" then this will override any filters you have passed. */
+	if ( 'just-me' == $scope || 'friends' == $scope || 'groups' == $scope || 'favorites' == $scope || 'mentions' == $scope ) {
+		if ( 'just-me' == $scope )
+			$display_comments = 'stream';
+
+		if ( $user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id ) {
+			$show_hidden = ( $user_id == $bp->loggedin_user->id && $scope != 'friends' ) ? 1 : 0;
+
+			switch ( $scope ) {
+				case 'friends':
+					if ( function_exists( 'friends_get_friend_user_ids' ) )
+						$friends = friends_get_friend_user_ids( $user_id );
+						if ( empty( $friends ) )
+							return false;
+
+						$user_id = implode( ',', (array)$friends );
+					break;
+				case 'groups':
+					if ( function_exists( 'groups_get_user_groups' ) ) {
+						$groups = groups_get_user_groups( $user_id );
+						if ( empty( $groups['groups'] ) )
+							return false;
+
+						$object = $bp->groups->id;
+						$primary_id = implode( ',', (array)$groups['groups'] );
+
+						$user_id = false;
+					}
+					break;
+				case 'favorites':
+					$favs = bp_activity_get_user_favorites( $user_id );
+					if ( empty( $favs ) )
+						return false;
+
+					$include = implode( ',', (array)$favs );
+					break;
+				case 'mentions':
+					$user_nicename = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_nicename : $bp->loggedin_user->userdata->user_nicename;
+					$user_login = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login;
+					$search_terms = '@' . bp_core_get_username( $user_id, $user_nicename, $user_login ) . '<'; // Start search at @ symbol and stop search at closing tag delimiter.
+					$display_comments = 'stream';
+					$user_id = false;
+					break;
+			}
+		}
+	}
+
+	if ( $max ) {
+		if ( $per_page > $max )
+			$per_page = $max;
+	}
+
+	/* Support for basic filters in earlier BP versions. */
+	$filter = false;
+	if ( isset( $_GET['afilter'] ) )
+		$filter = array( 'object' => $_GET['afilter'] );
+	else if ( !empty( $user_id ) || !empty( $object ) || !empty( $action ) || !empty( $primary_id ) || !empty( $secondary_id ) )
+		$filter = array( 'user_id' => $user_id, 'object' => $object, 'action' => $action, 'primary_id' => $primary_id, 'secondary_id' => $secondary_id );
+
+	$activities_template = new BP_Activity_Template( $page, $per_page, $max, $include, $sort, $filter, $search_terms, $display_comments, $show_hidden );
+
+	return apply_filters( 'bp_has_activities', $activities_template->has_activities(), &$activities_template );
+}
+
+function bp_activities() {
+	global $activities_template;
+	return $activities_template->user_activities();
+}
+
+function bp_the_activity() {
+	global $activities_template;
+	return $activities_template->the_activity();
+}
+
+function bp_activity_pagination_count() {
+	echo bp_get_activity_pagination_count();
+}
+	function bp_get_activity_pagination_count() {
+		global $bp, $activities_template;
+
+		$start_num = intval( ( $activities_template->pag_page - 1 ) * $activities_template->pag_num ) + 1;
+		$from_num = bp_core_number_format( $start_num );
+		$to_num = bp_core_number_format( ( $start_num + ( $activities_template->pag_num - 1 ) > $activities_template->total_activity_count ) ? $activities_template->total_activity_count : $start_num + ( $activities_template->pag_num - 1 ) );
+		$total = bp_core_number_format( $activities_template->total_activity_count );
+
+		return sprintf( __( 'Viewing item %1$s to %2$s (of %3$s items)', 'buddypress' ), $from_num, $to_num, $total ) . ' &nbsp; <span class="ajax-loader"></span>';
+	}
+
+function bp_activity_pagination_links() {
+	echo bp_get_activity_pagination_links();
+}
+	function bp_get_activity_pagination_links() {
+		global $activities_template;
+
+		return apply_filters( 'bp_get_activity_pagination_links', $activities_template->pag_links );
+	}
+
+function bp_activity_count() {
+	echo bp_get_activity_count();
+}
+	function bp_get_activity_count() {
+		global $activities_template;
+
+		return apply_filters( 'bp_get_activity_count', (int)$activities_template->activity_count );
+	}
+
+function bp_activity_per_page() {
+	echo bp_get_activity_per_page();
+}
+	function bp_get_activity_per_page() {
+		global $activities_template;
+
+		return apply_filters( 'bp_get_activity_per_page', (int)$activities_template->pag_num );
+	}
+
+function bp_activities_title() {
+	global $bp_activity_title;
+
+	echo bp_get_activities_title();
+}
+	function bp_get_activities_title() {
+		global $bp_activity_title;
+
+		return apply_filters( 'bp_get_activities_title', $bp_activity_title );
+	}
+
+function bp_activities_no_activity() {
+	global $bp_activity_no_activity;
+
+	echo bp_get_activities_no_activity();
+}
+	function bp_get_activities_no_activity() {
+		global $bp_activity_no_activity;
+
+		return apply_filters( 'bp_get_activities_no_activity', $bp_activity_no_activity );
+	}
+
+function bp_activity_id() {
+	echo bp_get_activity_id();
+}
+	function bp_get_activity_id() {
+		global $activities_template;
+		return apply_filters( 'bp_get_activity_id', $activities_template->activity->id );
+	}
+
+function bp_activity_item_id() {
+	echo bp_get_activity_item_id();
+}
+	function bp_get_activity_item_id() {
+		global $activities_template;
+		return apply_filters( 'bp_get_activity_item_id', $activities_template->activity->item_id );
+	}
+
+function bp_activity_secondary_item_id() {
+	echo bp_get_activity_secondary_item_id();
+}
+	function bp_get_activity_secondary_item_id() {
+		global $activities_template;
+		return apply_filters( 'bp_get_activity_secondary_item_id', $activities_template->activity->secondary_item_id );
+	}
+
+function bp_activity_date_recorded() {
+	echo bp_get_activity_date_recorded();
+}
+	function bp_get_activity_date_recorded() {
+		global $activities_template;
+		return apply_filters( 'bp_get_activity_date_recorded', $activities_template->activity->date_recorded );
+	}
+
+function bp_activity_object_name() {
+	echo bp_get_activity_object_name();
+}
+	function bp_get_activity_object_name() {
+		global $activities_template;
+		return apply_filters( 'bp_get_activity_object_name', $activities_template->activity->component );
+	}
+
+function bp_activity_type() {
+	echo bp_get_activity_type();
+}
+	function bp_get_activity_type() {
+		global $activities_template;
+		return apply_filters( 'bp_get_activity_type', $activities_template->activity->type );
+	}
+	function bp_activity_action_name() { echo bp_activity_type(); }
+	function bp_get_activity_action_name() { return bp_get_activity_type(); }
+
+function bp_activity_user_id() {
+	echo bp_get_activity_user_id();
+}
+	function bp_get_activity_user_id() {
+		global $activities_template;
+		return apply_filters( 'bp_get_activity_user_id', $activities_template->activity->user_id );
+	}
+
+function bp_activity_user_link() {
+	echo bp_get_activity_user_link();
+}
+	function bp_get_activity_user_link() {
+		global $activities_template;
+
+		if ( empty( $activities_template->activity->user_id ) )
+			$link = $activities_template->activity->primary_link;
+		else
+			$link = bp_core_get_user_domain( $activities_template->activity->user_id, $activities_template->activity->user_nicename, $activities_template->activity->user_login );
+
+		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,
+			'height' => 20,
+			'class'  => 'avatar',
+			'alt'    => __( 'Avatar', 'buddypress' ),
+			'email'  => false
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		// 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 );
+
+		// 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();
+}
+	function bp_get_activity_action() {
+		global $activities_template;
+
+		$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 );
+
+		return apply_filters( 'bp_get_activity_action', $action, &$activities_template->activity );
+	}
+
+function bp_activity_content_body() {
+	echo bp_get_activity_content_body();
+}
+	function bp_get_activity_content_body() {
+		global $activities_template;
+
+		/* Backwards compatibility if action is not being used */
+		if ( empty( $activities_template->activity->action ) && !empty( $activities_template->activity->content ) )
+			$activities_template->activity->content = bp_insert_activity_meta( $activities_template->activity->content );
+
+		return apply_filters( 'bp_get_activity_content_body', $activities_template->activity->content, &$activities_template->activity );
+	}
+
+	function bp_activity_has_content() {
+		global $activities_template;
+
+		if ( !empty( $activities_template->activity->content ) )
+			return true;
+
+		return false;
+	}
+
+function bp_activity_content() {
+	echo bp_get_activity_content();
+}
+	function bp_get_activity_content() {
+		global $activities_template;
+
+		/***
+		 * If you want to filter activity update content, please use
+		 * the filter 'bp_get_activity_content_body'
+		 *
+		 * This function is mainly for backwards comptibility.
+		 */
+
+		$content = bp_get_activity_action() . ' ' . bp_get_activity_content_body();
+		return apply_filters( 'bp_get_activity_content', $content );
+	}
+
+	function bp_insert_activity_meta( $content ) {
+		global $activities_template, $bp;
+
+		/* Strip any legacy time since placeholders -- TODO: Remove this in 1.3 */
+		$content = str_replace( '<span class="time-since">%s</span>', '', $content );
+
+		/* Insert the time since. */
+		$content .= ' ' . apply_filters( 'bp_activity_time_since', '<span class="time-since">' . sprintf( __( '&nbsp; %s ago', 'buddypress' ), bp_core_time_since( $activities_template->activity->date_recorded ) ) . '</span>', &$activities_template->activity );
+
+		/* Insert the permalink */
+		$content .= 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_super_admin )
+			 $content .= apply_filters( 'bp_activity_delete_link', ' &middot; ' . bp_get_activity_delete_link(), &$activities_template->activity );
+
+		return apply_filters( 'bp_insert_activity_meta', $content );
+	}
+
+function bp_activity_parent_content( $args = '' ) {
+	echo bp_get_activity_parent_content($args);
+}
+	function bp_get_activity_parent_content( $args = '' ) {
+		global $bp, $activities_template;
+
+		$defaults = array(
+			'hide_user' => false
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		/* Get the ID of the parent activity content */
+		if ( !$parent_id = $activities_template->activity->item_id )
+			return false;
+
+		/* Get the content of the parent */
+		if ( empty( $activities_template->activity_parents[$parent_id] ) )
+			return false;
+
+		if ( empty( $activities_template->activity_parents[$parent_id]->content ) )
+			$content = $activities_template->activity_parents[$parent_id]->action;
+		else
+			$content = $activities_template->activity_parents[$parent_id]->action . ' ' . $activities_template->activity_parents[$parent_id]->content;
+
+		/* Remove the time since content for backwards compatibility */
+		$content = str_replace( '<span class="time-since">%s</span>', '', $content );
+
+		/* Remove images */
+		$content = preg_replace( '/<img[^>]*>/Ui', '', $content );
+
+		return apply_filters( 'bp_get_activity_parent_content', $content );
+	}
+
+function bp_activity_is_favorite() {
+	echo bp_get_activity_is_favorite();
+}
+	function bp_get_activity_is_favorite() {
+		global $bp, $activities_template;
+
+ 		return apply_filters( 'bp_get_activity_is_favorite', in_array( $activities_template->activity->id, (array)$activities_template->my_favs ) );
+	}
+
+function bp_activity_comments( $args = '' ) {
+	echo bp_activity_get_comments( $args );
+}
+	function bp_activity_get_comments( $args = '' ) {
+		global $activities_template, $bp;
+
+		if ( !$activities_template->activity->children )
+			return false;
+
+		$comments_html = bp_activity_recurse_comments( $activities_template->activity );
+
+		return apply_filters( 'bp_activity_get_comments', $comments_html );
+	}
+		/* TODO: The HTML in this function is temporary and will be moved to the template in a future version. */
+		function bp_activity_recurse_comments( $comment ) {
+			global $activities_template, $bp;
+
+			if ( !$comment->children )
+				return false;
+
+			$content .= '<ul>';
+			foreach ( (array)$comment->children as $comment ) {
+				if ( !$comment->user_fullname )
+					$comment->user_fullname = $comment->display_name;
+
+				$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' => 20, 'height' => 20, '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_acomment_name', $comment->user_fullname, $comment ) . '</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_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>';
+				$content .= '<div class="acomment-content">' . apply_filters( 'bp_get_activity_content', $comment->content ) . '</div>';
+
+				$content .= bp_activity_recurse_comments( $comment );
+				$content .= '</li>';
+			}
+			$content .= '</ul>';
+
+			return apply_filters( 'bp_activity_recurse_comments', $content );
+		}
+
+function bp_activity_comment_count() {
+	echo bp_activity_get_comment_count();
+}
+	function bp_activity_get_comment_count( $args = '' ) {
+		global $activities_template, $bp;
+
+		if ( !$activities_template->activity->children )
+			return 0;
+
+		$count = bp_activity_recurse_comment_count( $activities_template->activity );
+
+		return apply_filters( 'bp_activity_get_comment_count', (int)$count );
+	}
+		function bp_activity_recurse_comment_count( $comment, $count = 0 ) {
+			global $activities_template, $bp;
+
+			if ( !$comment->children )
+				return $count;
+
+			foreach ( (array)$comment->children as $comment ) {
+				$count++;
+				$count = bp_activity_recurse_comment_count( $comment, $count );
+			}
+
+			return $count;
+		}
+
+function bp_activity_comment_link() {
+	echo bp_get_activity_comment_link();
+}
+	function bp_get_activity_comment_link() {
+		global $activities_template;
+		return apply_filters( 'bp_get_activity_comment_link', '?ac=' . $activities_template->activity->id . '/#ac-form-' . $activities_template->activity->id );
+	}
+
+function bp_activity_comment_form_nojs_display() {
+	echo bp_get_activity_comment_form_nojs_display();
+}
+	function bp_get_activity_comment_form_nojs_display() {
+		global $activities_template;
+		if ( $_GET['ac'] == $activities_template->activity->id . '/' )
+			return 'style="display: block"';
+
+		return false;
+	}
+
+function bp_activity_comment_form_action() {
+	echo bp_get_activity_comment_form_action();
+}
+	function bp_get_activity_comment_form_action() {
+		return apply_filters( 'bp_get_activity_comment_form_action', site_url( BP_ACTIVITY_SLUG . '/reply/' ) );
+	}
+
+function bp_activity_permalink_id() {
+	echo bp_get_activity_permalink_id();
+}
+	function bp_get_activity_permalink_id() {
+		global $bp;
+
+		return apply_filters( 'bp_get_activity_permalink_id', $bp->current_action );
+	}
+
+function bp_activity_thread_permalink() {
+	echo bp_get_activity_thread_permalink();
+}
+	function bp_get_activity_thread_permalink() {
+		global $bp, $activities_template;
+
+		$link = bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity );
+
+	 	return apply_filters( 'bp_get_activity_thread_permalink', $link );
+	}
+
+function bp_activity_favorite_link() {
+	echo bp_get_activity_favorite_link();
+}
+	function bp_get_activity_favorite_link() {
+		global $activities_template;
+		return apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( site_url( BP_ACTIVITY_SLUG . '/favorite/' . $activities_template->activity->id . '/' ), 'mark_favorite' ) );
+	}
+
+function bp_activity_unfavorite_link() {
+	echo bp_get_activity_unfavorite_link();
+}
+	function bp_get_activity_unfavorite_link() {
+		global $activities_template;
+		return apply_filters( 'bp_get_activity_unfavorite_link', wp_nonce_url( site_url( BP_ACTIVITY_SLUG . '/unfavorite/' . $activities_template->activity->id . '/' ), 'unmark_favorite' ) );
+	}
+
+function bp_activity_css_class() {
+	echo bp_get_activity_css_class();
+}
+	function bp_get_activity_css_class() {
+		global $activities_template;
+
+		$mini_activity_actions = apply_filters( 'bp_activity_mini_activity_types', array(
+			'friendship_accepted',
+			'friendship_created',
+			'new_blog',
+			'joined_group',
+			'created_group',
+			'new_member'
+		) );
+
+		$class = '';
+		if ( in_array( $activities_template->activity->type, (array)$mini_activity_actions ) || empty( $activities_template->activity->content ) )
+			$class = ' mini';
+
+		if ( bp_activity_get_comment_count() && bp_activity_can_comment() )
+			$class .= ' has-comments';
+
+		return apply_filters( 'bp_get_activity_css_class', $activities_template->activity->component . ' ' . $activities_template->activity->type . $class );
+	}
+
+function bp_activity_delete_link() {
+	echo bp_get_activity_delete_link();
+}
+	function bp_get_activity_delete_link() {
+		global $activities_template, $bp;
+
+		return apply_filters( 'bp_get_activity_delete_link', '<a href="' . wp_nonce_url( $bp->root_domain . '/' . $bp->activity->slug . '/delete/' . $activities_template->activity->id, 'bp_activity_delete_link' ) . '" class="item-button delete-activity confirm">' . __( 'Delete', 'buddypress' ) . '</a>' );
+	}
+
+function bp_activity_latest_update( $user_id = false ) {
+	echo bp_get_activity_latest_update( $user_id );
+}
+	function bp_get_activity_latest_update( $user_id = false ) {
+		global $bp;
+
+		if ( !$user_id )
+			$user_id = $bp->displayed_user->id;
+
+		if ( !$update = get_user_meta( $user_id, 'bp_latest_update', true ) )
+			return false;
+
+		$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  );
+	}
+
+function bp_activity_filter_links( $args = false ) {
+	echo bp_get_activity_filter_links( $args );
+}
+	function bp_get_activity_filter_links( $args = false ) {
+		global $activities_template, $bp;
+
+		$defaults = array(
+			'style' => 'list'
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		/* Fetch the names of components that have activity recorded in the DB */
+		$components = BP_Activity_Activity::get_recorded_components();
+
+		if ( !$components )
+			return false;
+
+		foreach ( (array) $components as $component ) {
+			/* Skip the activity comment filter */
+			if ( 'activity' == $component )
+				continue;
+
+			if ( isset( $_GET['afilter'] ) && $component == $_GET['afilter'] )
+				$selected = ' class="selected"';
+			else
+				unset($selected);
+
+			$component = esc_attr( $component );
+
+			switch ( $style ) {
+				case 'list':
+					$tag = 'li';
+					$before = '<li id="afilter-' . $component . '"' . $selected . '>';
+					$after = '</li>';
+				break;
+				case 'paragraph':
+					$tag = 'p';
+					$before = '<p id="afilter-' . $component . '"' . $selected . '>';
+					$after = '</p>';
+				break;
+				case 'span':
+					$tag = 'span';
+					$before = '<span id="afilter-' . $component . '"' . $selected . '>';
+					$after = '</span>';
+				break;
+			}
+
+			$link = add_query_arg( 'afilter', $component );
+			$link = remove_query_arg( 'acpage' , $link );
+
+			$link = apply_filters( 'bp_get_activity_filter_link_href', $link, $component );
+
+			/* 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="' . 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="' . esc_attr( $link ) . '"">' . __( 'Clear Filter', 'buddypress' ) . '</a></' . $tag . '>';
+
+ 		return apply_filters( 'bp_get_activity_filter_links', implode( "\n", $component_links ) );
+	}
+
+function bp_activity_can_comment() {
+	global $activities_template, $bp;
+
+	if ( false === $activities_template->disable_blogforum_replies || (int)$activities_template->disable_blogforum_replies ) {
+		if ( 'new_blog_post' == bp_get_activity_action_name() || 'new_blog_comment' == bp_get_activity_action_name() || 'new_forum_topic' == bp_get_activity_action_name() || 'new_forum_post' == bp_get_activity_action_name() )
+			return false;
+	}
+
+	if ( 'activity_comment' == bp_get_activity_action_name() )
+		return false;
+
+	return true;
+}
+
+function bp_total_favorite_count_for_user( $user_id = false ) {
+	echo bp_get_total_favorite_count_for_user( $user_id );
+}
+	function bp_get_total_favorite_count_for_user( $user_id = false ) {
+		return apply_filters( 'bp_get_total_favorite_count_for_user', bp_activity_total_favorites_for_user( $user_id ) );
+	}
+
+function bp_total_mention_count_for_user( $user_id = false ) {
+	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_user_meta( $user_id, 'bp_new_mention_count', true ) );
+	}
+
+function bp_send_public_message_link() {
+	echo bp_get_send_public_message_link();
+}
+	function bp_get_send_public_message_link() {
+		global $bp;
+
+		if ( bp_is_my_profile() || !is_user_logged_in() )
+			return false;
+
+		return apply_filters( 'bp_get_send_public_message_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->activity->slug . '/?r=' . bp_core_get_username( $bp->displayed_user->user_id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) ) );
+	}
+
+/**
+ * bp_send_public_message_button( $args )
+ *
+ * Output button for sending a public message
+ *
+ * @param array $args
+ */
+function bp_send_public_message_button( $args = '' ) {
+	echo bp_get_send_public_message_button( $args );
+}
+	/**
+	 * bp_get_send_public_message_button( $args )
+	 *
+	 * Return button for sending a public message
+	 *
+	 * @param array $args
+	 * @return string
+	 */
+	function bp_get_send_public_message_button( $args = '' ) {
+		$defaults = array(
+			'id'                => 'public_message',
+			'component'         => 'activity',
+			'must_be_logged_in' => true,
+			'block_self'        => true,
+			'wrapper_id'        => 'post-mention',
+			'link_href'         => bp_get_send_public_message_link(),
+			'link_title'        => __( 'Mention this user in a new public message, this will send the user a notification to get their attention.', 'buddypress' ),
+			'link_text'         => __( 'Mention this User', 'buddypress' )
+		);
+
+		$button = wp_parse_args( $args, $defaults );
+
+		// Filter and return the HTML button
+		return bp_get_button( apply_filters( 'bp_get_send_public_message_button', $button ) );
+	}
+
+function bp_activity_post_form_action() {
+	echo bp_get_activity_post_form_action();
+}
+	function bp_get_activity_post_form_action() {
+		return apply_filters( 'bp_get_activity_post_form_action', site_url( BP_ACTIVITY_SLUG . '/post/' ) );
+	}
+
+/* RSS Feed Template Tags ***************************/
+
+function bp_sitewide_activity_feed_link() {
+	echo bp_get_sitewide_activity_feed_link();
+}
+	function bp_get_sitewide_activity_feed_link() {
+		global $bp;
+
+		return apply_filters( 'bp_get_sitewide_activity_feed_link', site_url( $bp->activity->slug . '/feed/' ) );
+	}
+
+function bp_member_activity_feed_link() {
+	echo bp_get_member_activity_feed_link();
+}
+function bp_activities_member_rss_link() { echo bp_get_member_activity_feed_link(); }
+
+	function bp_get_member_activity_feed_link() {
+		global $bp;
+
+		if ( $bp->current_component == $bp->profile->slug || 'just-me' == $bp->current_action )
+			$link = $bp->displayed_user->domain . $bp->activity->slug . '/feed/';
+		else if ( 'friends' == $bp->current_action )
+			$link = $bp->displayed_user->domain . $bp->activity->slug . '/friends/feed/';
+		else if ( 'groups' == $bp->current_action )
+			$link = $bp->displayed_user->domain . $bp->activity->slug . '/groups/feed/';
+		else if ( 'favorites' == $bp->current_action )
+			$link = $bp->displayed_user->domain . $bp->activity->slug . '/favorites/feed/';
+		else if ( 'mentions' == $bp->current_action )
+			$link = $bp->displayed_user->domain . $bp->activity->slug . '/mentions/feed/';
+
+		return apply_filters( 'bp_get_activities_member_rss_link', $link );
+	}
+	function bp_get_activities_member_rss_link() { return bp_get_member_activity_feed_link(); }
+
+
+/* Template tags for RSS feed output */
+
+function bp_activity_feed_item_guid() {
+	echo bp_get_activity_feed_item_guid();
+}
+	function bp_get_activity_feed_item_guid() {
+		global $activities_template;
+
+		return apply_filters( 'bp_get_activity_feed_item_guid', md5( $activities_template->activity->date_recorded . '-' . $activities_template->activity->content ) );
+	}
+
+function bp_activity_feed_item_title() {
+	echo bp_get_activity_feed_item_title();
+}
+	function bp_get_activity_feed_item_title() {
+		global $activities_template;
+
+		if ( !empty( $activities_template->activity->action ) )
+			$content = $activities_template->activity->action;
+		else
+			$content = $activities_template->activity->content;
+
+		$content = explode( '<span', $content );
+		$title = trim( strip_tags( html_entity_decode( utf8_encode( $content[0] ) ) ) );
+
+		if ( ':' == substr( $title, -1 ) )
+			$title = substr( $title, 0, -1 );
+
+		if ( 'activity_update' == $activities_template->activity->type )
+			$title .= ': ' . strip_tags( bp_create_excerpt( $activities_template->activity->content, 15 ) );
+
+		return apply_filters( 'bp_get_activity_feed_item_title', $title );
+	}
+
+function bp_activity_feed_item_link() {
+	echo bp_get_activity_feed_item_link();
+}
+	function bp_get_activity_feed_item_link() {
+		global $activities_template;
+
+		return apply_filters( 'bp_get_activity_feed_item_link', $activities_template->activity->primary_link );
+	}
+
+function bp_activity_feed_item_date() {
+	echo bp_get_activity_feed_item_date();
+}
+	function bp_get_activity_feed_item_date() {
+		global $activities_template;
+
+		return apply_filters( 'bp_get_activity_feed_item_date', $activities_template->activity->date_recorded );
+	}
+
+function bp_activity_feed_item_description() {
+	echo bp_get_activity_feed_item_description();
+}
+	function bp_get_activity_feed_item_description() {
+		global $activities_template;
+
+		if ( empty( $activities_template->activity->action ) )
+			$content = $activities_template->activity->content;
+		else
+			$content = $activities_template->activity->action . ' ' . $activities_template->activity->content;
+
+		return apply_filters( 'bp_get_activity_feed_item_description', html_entity_decode( str_replace( '%s', '', $content ) ) );
+	}
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-favorites-feed.php b/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-favorites-feed.php
new file mode 100644
index 0000000000000000000000000000000000000000..3fade9c3d6109da7b18c7ca2626e44d02f072b9b
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-favorites-feed.php
@@ -0,0 +1,63 @@
+<?php
+/**
+ * RSS2 Feed Template for displaying a member's favorite activity
+ *
+ * @package BuddyPress
+ */
+header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
+header('Status: 200 OK');
+?>
+<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+
+<rss version="2.0"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	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_favorites_feed'); ?>
+>
+
+<channel>
+	<title><?php echo bp_site_name() ?> | <?php echo $bp->displayed_user->fullname; ?> | <?php _e( 'Favorite Activity', 'buddypress' ) ?></title>
+	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
+	<link><?php echo site_url( BP_ACTIVITY_SLUG . '/#my-favorites/' ) ?></link>
+	<description><?php echo $bp->displayed_user->fullname; ?> - <?php _e( 'Favorite Activity', 'buddypress' ) ?></description>
+	<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
+	<generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
+	<language><?php echo get_option('rss_language'); ?></language>
+	<?php do_action('bp_activity_favorites_feed_head'); ?>
+
+	<?php
+		$favs = bp_activity_get_user_favorites( $bp->displayed_user->id );
+		$fav_ids = implode( ',', (array)$favs );
+	?>
+
+	<?php if ( bp_has_activities( 'include=' . $fav_ids . '&max=50&display_comments=stream' ) ) : ?>
+		<?php while ( bp_activities() ) : bp_the_activity(); ?>
+			<item>
+				<guid><?php bp_activity_thread_permalink() ?></guid>
+				<title><![CDATA[<?php bp_activity_feed_item_title() ?>]]></title>
+				<link><?php echo bp_activity_thread_permalink() ?></link>
+				<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
+
+				<description>
+					<![CDATA[
+					<?php bp_activity_feed_item_description() ?>
+
+					<?php if ( bp_activity_can_comment() ) : ?>
+						<p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
+					<?php endif; ?>
+
+					<?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
+						<br /><strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
+						<?php bp_activity_parent_content() ?>
+					<?php endif; ?>
+					]]>
+				</description>
+				<?php do_action('bp_activity_favorites_feed_item'); ?>
+			</item>
+		<?php endwhile; ?>
+
+	<?php endif; ?>
+</channel>
+</rss>
diff --git a/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-friends-feed.php b/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-friends-feed.php
new file mode 100644
index 0000000000000000000000000000000000000000..f0e62a5b4a47a41cf277620c407e8cd2e96cfba4
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-friends-feed.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * RSS2 Feed Template for displaying a member's friends activity stream.
+ *
+ * @package BuddyPress
+ */
+header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
+header('Status: 200 OK');
+?>
+<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+
+<rss version="2.0"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	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_friends_feed'); ?>
+>
+
+<channel>
+	<title><?php echo bp_site_name() ?> | <?php echo $bp->displayed_user->fullname; ?> | <?php _e( 'Friends Activity', 'buddypress' ) ?></title>
+	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
+	<link><?php echo $bp->displayed_user->domain . $bp->activity->slug . '/my-friends/feed' ?></link>
+	<description><?php printf( __( '%s - Friends Activity Feed', 'buddypress' ), $bp->displayed_user->fullname ) ?></description>
+	<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
+	<generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
+	<language><?php echo get_option('rss_language'); ?></language>
+	<?php do_action('bp_activity_friends_feed_head'); ?>
+
+	<?php $friend_ids = implode( ',', friends_get_friend_user_ids( $bp->displayed_user->id ) ); ?>
+	<?php if ( bp_has_activities( 'user_id=' . $friend_ids . '&max=50&display_comments=stream' ) ) : ?>
+		<?php while ( bp_activities() ) : bp_the_activity(); ?>
+			<item>
+				<guid><?php bp_activity_thread_permalink() ?></guid>
+				<title><![CDATA[<?php bp_activity_feed_item_title() ?>]]></title>
+				<link><?php echo bp_activity_thread_permalink() ?></link>
+				<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
+
+				<description>
+					<![CDATA[
+					<?php bp_activity_feed_item_description() ?>
+
+					<?php if ( bp_activity_can_comment() ) : ?>
+						<p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
+					<?php endif; ?>
+
+					<?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
+						<br /><strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
+						<?php bp_activity_parent_content() ?>
+					<?php endif; ?>
+					]]>
+				</description>
+				<?php do_action('bp_activity_personal_feed_item'); ?>
+			</item>
+		<?php endwhile; ?>
+
+	<?php endif; ?>
+</channel>
+</rss>
diff --git a/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-group-feed.php b/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-group-feed.php
new file mode 100644
index 0000000000000000000000000000000000000000..8748b60a24c916f0d185296f572438b35ffab4c0
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-group-feed.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * RSS2 Feed Template for displaying a group activity stream
+ *
+ * @package BuddyPress
+ */
+header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
+header('Status: 200 OK');
+?>
+<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+
+<rss version="2.0"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	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_group_feed'); ?>
+>
+
+<channel>
+	<title><?php echo bp_site_name() ?> | <?php echo $bp->groups->current_group->name ?> | <?php _e( 'Group Activity', 'buddypress' ) ?></title>
+	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
+	<link><?php echo bp_get_group_permalink( $bp->groups->current_group ) . $bp->activity->slug . '/feed' ?></link>
+	<description><?php printf( __( '%s - Group Activity Feed', 'buddypress' ), $bp->groups->current_group->name  ) ?></description>
+	<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
+	<generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
+	<language><?php echo get_option('rss_language'); ?></language>
+	<?php do_action('bp_activity_group_feed_head'); ?>
+
+	<?php if ( bp_has_activities( 'object=' . $bp->groups->id . '&primary_id=' . $bp->groups->current_group->id . '&max=50&display_comments=threaded' ) ) : ?>
+		<?php while ( bp_activities() ) : bp_the_activity(); ?>
+			<item>
+				<guid><?php bp_activity_thread_permalink() ?></guid>
+				<title><![CDATA[<?php bp_activity_feed_item_title() ?>]]></title>
+				<link><?php echo bp_activity_thread_permalink() ?></link>
+				<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
+
+				<description>
+					<![CDATA[
+						<?php bp_activity_feed_item_description() ?>
+
+						<?php if ( bp_activity_can_comment() ) : ?>
+							<p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
+						<?php endif; ?>
+					]]>
+				</description>
+				<?php do_action('bp_activity_group_feed_item'); ?>
+			</item>
+		<?php endwhile; ?>
+
+	<?php endif; ?>
+</channel>
+</rss>
diff --git a/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-mentions-feed.php b/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-mentions-feed.php
new file mode 100644
index 0000000000000000000000000000000000000000..8a0b868121d802bed0994ac1adcaf10daee41c02
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-mentions-feed.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * RSS2 Feed Template for displaying a member's group's activity
+ *
+ * @package BuddyPress
+ */
+header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
+header('Status: 200 OK');
+?>
+<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+
+<rss version="2.0"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	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'); ?>
+>
+
+<channel>
+	<title><?php echo bp_site_name() ?> | <?php echo $bp->displayed_user->fullname; ?> | <?php _e( 'Mentions', 'buddypress' ) ?></title>
+	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
+	<link><?php echo site_url( BP_ACTIVITY_SLUG . '/#mentions/' ) ?></link>
+	<description><?php echo $bp->displayed_user->fullname; ?> - <?php _e( 'Mentions', 'buddypress' ) ?></description>
+	<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
+	<generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
+	<language><?php echo get_option('rss_language'); ?></language>
+	<?php do_action('bp_activity_mentions_feed_head'); ?>
+
+	<?php if ( bp_has_activities( 'max=50&display_comments=stream&search_terms=@' . bp_core_get_username( $bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) ) ) : ?>
+		<?php while ( bp_activities() ) : bp_the_activity(); ?>
+			<item>
+				<guid><?php bp_activity_thread_permalink() ?></guid>
+				<title><![CDATA[<?php bp_activity_feed_item_title() ?>]]></title>
+				<link><?php echo bp_activity_thread_permalink() ?></link>
+				<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
+
+				<description>
+					<![CDATA[
+					<?php bp_activity_feed_item_description() ?>
+
+					<?php if ( bp_activity_can_comment() ) : ?>
+						<p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
+					<?php endif; ?>
+
+					<?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
+						<br /><strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
+						<?php bp_activity_parent_content() ?>
+					<?php endif; ?>
+					]]>
+				</description>
+				<?php do_action('bp_activity_mentions_feed_item'); ?>
+			</item>
+		<?php endwhile; ?>
+
+	<?php endif; ?>
+</channel>
+</rss>
diff --git a/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-mygroups-feed.php b/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-mygroups-feed.php
new file mode 100644
index 0000000000000000000000000000000000000000..01d3e46023d99be133edb9fc07a5818f0ffa62ac
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-mygroups-feed.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * RSS2 Feed Template for displaying a member's group's activity
+ *
+ * @package BuddyPress
+ */
+header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
+header('Status: 200 OK');
+?>
+<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+
+<rss version="2.0"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	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_mygroups_feed'); ?>
+>
+
+<channel>
+	<title><?php echo bp_site_name() ?> | <?php echo $bp->displayed_user->fullname; ?> | <?php _e( 'My Groups - Public Activity', 'buddypress' ) ?></title>
+	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
+	<link><?php echo site_url( BP_ACTIVITY_SLUG . '/#my-groups/' ) ?></link>
+	<description><?php echo $bp->displayed_user->fullname; ?> - <?php _e( 'My Groups - Public Activity', 'buddypress' ) ?></description>
+	<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
+	<generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
+	<language><?php echo get_option('rss_language'); ?></language>
+	<?php do_action('bp_activity_mygroups_feed_head'); ?>
+
+	<?php
+		$groups = groups_get_user_groups( $bp->loggedin_user->id );
+		$group_ids = implode( ',', $groups['groups'] );
+	?>
+
+	<?php if ( bp_has_activities( 'object=' . $bp->groups->id . '&primary_id=' . $group_ids . '&max=50&display_comments=threaded' ) ) : ?>
+		<?php while ( bp_activities() ) : bp_the_activity(); ?>
+			<item>
+				<guid><?php bp_activity_thread_permalink() ?></guid>
+				<title><![CDATA[<?php bp_activity_feed_item_title() ?>]]></title>
+				<link><?php echo bp_activity_thread_permalink() ?></link>
+				<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
+
+				<description>
+					<![CDATA[
+						<?php bp_activity_feed_item_description() ?>
+
+						<?php if ( bp_activity_can_comment() ) : ?>
+							<p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
+						<?php endif; ?>
+					]]>
+				</description>
+				<?php do_action('bp_activity_mygroups_feed_item'); ?>
+			</item>
+		<?php endwhile; ?>
+
+	<?php endif; ?>
+</channel>
+</rss>
diff --git a/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-personal-feed.php b/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-personal-feed.php
new file mode 100644
index 0000000000000000000000000000000000000000..1a9d37f961164e15bf5e7b26b97374924b3290e6
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-personal-feed.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * RSS2 Feed Template for displaying a member's activity stream.
+ *
+ * @package BuddyPress
+ */
+header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
+header('Status: 200 OK');
+?>
+<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+
+<rss version="2.0"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	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_personal_feed'); ?>
+>
+
+<channel>
+	<title><?php echo bp_site_name() ?> | <?php echo $bp->displayed_user->fullname; ?> | <?php _e( 'Activity', 'buddypress' ) ?></title>
+	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
+	<link><?php echo $bp->displayed_user->domain . $bp->activity->slug . '/feed' ?></link>
+	<description><?php printf( __( '%s - Activity Feed', 'buddypress' ), $bp->displayed_user->fullname ) ?></description>
+	<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
+	<generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
+	<language><?php echo get_option('rss_language'); ?></language>
+	<?php do_action('bp_activity_personal_feed_head'); ?>
+
+	<?php if ( bp_has_activities( 'user_id=' . $bp->displayed_user->id . '&max=50&display_comments=stream' ) ) : ?>
+		<?php while ( bp_activities() ) : bp_the_activity(); ?>
+			<item>
+				<guid><?php bp_activity_thread_permalink() ?></guid>
+				<title><![CDATA[<?php bp_activity_feed_item_title() ?>]]></title>
+				<link><?php echo bp_activity_thread_permalink() ?></link>
+				<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
+
+				<description>
+					<![CDATA[
+					<?php bp_activity_feed_item_description() ?>
+
+					<?php if ( bp_activity_can_comment() ) : ?>
+						<p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
+					<?php endif; ?>
+
+					<?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
+						<br /><strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
+						<?php bp_activity_parent_content() ?>
+					<?php endif; ?>
+					]]>
+				</description>
+				<?php do_action('bp_activity_personal_feed_item'); ?>
+			</item>
+		<?php endwhile; ?>
+
+	<?php endif; ?>
+</channel>
+</rss>
diff --git a/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-sitewide-feed.php b/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-sitewide-feed.php
new file mode 100644
index 0000000000000000000000000000000000000000..eae02b1b79dac411422d4960f04622c18336e5cb
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-sitewide-feed.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * RSS2 Feed Template for displaying the site wide activity stream.
+ *
+ * @package BuddyPress
+ */
+
+header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
+header('Status: 200 OK');
+?>
+<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+
+<rss version="2.0"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	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_sitewide_feed'); ?>
+>
+
+<channel>
+	<title><?php echo bp_site_name() ?> | <?php _e( 'Site Wide Activity', 'buddypress' ) ?></title>
+	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
+	<link><?php echo site_url() . '/' . $bp->activity->slug . '/feed' ?></link>
+	<description><?php _e( 'Site Wide Activity Feed', 'buddypress' ) ?></description>
+	<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
+	<generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
+	<language><?php echo get_option('rss_language'); ?></language>
+	<?php do_action('bp_activity_sitewide_feed_head'); ?>
+
+	<?php if ( bp_has_activities( 'type=sitewide&max=50&display_comments=threaded' ) ) : ?>
+		<?php while ( bp_activities() ) : bp_the_activity(); ?>
+			<item>
+				<guid><?php bp_activity_thread_permalink() ?></guid>
+				<title><![CDATA[<?php bp_activity_feed_item_title() ?>]]></title>
+				<link><?php bp_activity_thread_permalink() ?></link>
+				<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
+
+				<description>
+					<![CDATA[
+					<?php bp_activity_feed_item_description() ?>
+
+					<?php if ( bp_activity_can_comment() ) : ?>
+						<p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
+					<?php endif; ?>
+					]]>
+				</description>
+			<?php do_action('bp_activity_personal_feed_item'); ?>
+			</item>
+		<?php endwhile; ?>
+
+	<?php endif; ?>
+</channel>
+</rss>
diff --git a/wp-content/plugins/buddypress/bp-blogs.php b/wp-content/plugins/buddypress/bp-blogs.php
new file mode 100644
index 0000000000000000000000000000000000000000..71ddf1e3b8f2cfb4c6173d23a29cac27ee85ae4a
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-blogs.php
@@ -0,0 +1,820 @@
+<?php
+
+define ( 'BP_BLOGS_DB_VERSION', '2015' );
+
+/* Define the slug for the component */
+if ( !defined( 'BP_BLOGS_SLUG' ) )
+	define ( 'BP_BLOGS_SLUG', 'blogs' );
+
+require ( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-classes.php' );
+require ( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-templatetags.php' );
+
+/* Include the sitewide blog posts widget if this is a multisite installation */
+if ( bp_core_is_multisite() )
+	require ( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-widgets.php' );
+
+function bp_blogs_install() {
+	global $wpdb, $bp;
+
+	if ( !empty($wpdb->charset) )
+		$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
+
+	$sql[] = "CREATE TABLE {$bp->blogs->table_name} (
+		  		id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+				user_id bigint(20) NOT NULL,
+				blog_id bigint(20) NOT NULL,
+				KEY user_id (user_id),
+				KEY blog_id (blog_id)
+			 ) {$charset_collate};";
+
+	$sql[] = "CREATE TABLE {$bp->blogs->table_name_blogmeta} (
+				id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+				blog_id bigint(20) NOT NULL,
+				meta_key varchar(255) DEFAULT NULL,
+				meta_value longtext DEFAULT NULL,
+				KEY blog_id (blog_id),
+				KEY meta_key (meta_key)
+		     ) {$charset_collate};";
+
+
+	require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
+
+	dbDelta($sql);
+
+	// On first installation - record all existing blogs in the system.
+	if ( !(int)get_site_option('bp-blogs-first-install') && bp_core_is_multisite() ) {
+		bp_blogs_record_existing_blogs();
+		add_site_option( 'bp-blogs-first-install', 1 );
+	}
+
+	update_site_option( 'bp-blogs-db-version', BP_BLOGS_DB_VERSION );
+}
+
+function bp_blogs_check_installed() {
+	global $wpdb, $bp, $userdata;
+
+	/* Only create the bp-blogs tables if this is a multisite install */
+	if ( is_super_admin() && bp_core_is_multisite() ) {
+		/* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
+		if ( get_site_option( 'bp-blogs-db-version' ) < BP_BLOGS_DB_VERSION )
+			bp_blogs_install();
+	}
+}
+add_action( 'admin_menu', 'bp_blogs_check_installed' );
+
+function bp_blogs_setup_globals() {
+	global $bp, $wpdb;
+
+	/* For internal identification */
+	$bp->blogs->id = 'blogs';
+
+	$bp->blogs->slug = BP_BLOGS_SLUG;
+
+	$bp->blogs->table_name          = $bp->table_prefix . 'bp_user_blogs';
+	$bp->blogs->table_name_blogmeta = $bp->table_prefix . 'bp_user_blogs_blogmeta';
+
+	$bp->blogs->format_notification_function = 'bp_blogs_format_notifications';
+
+	/* Register this in the active components array */
+	$bp->active_components[$bp->blogs->slug] = $bp->blogs->id;
+
+	do_action( 'bp_blogs_setup_globals' );
+}
+add_action( 'bp_setup_globals', 'bp_blogs_setup_globals' );
+
+function bp_blogs_setup_root_component() {
+	/* Register 'blogs' as a root component */
+	bp_core_add_root_component( BP_BLOGS_SLUG );
+}
+add_action( 'bp_setup_root_components', 'bp_blogs_setup_root_component' );
+
+/**
+ * bp_blogs_setup_nav()
+ *
+ * Adds "Blog" to the navigation arrays for the current and logged in user.
+ *
+ * @package BuddyPress Blogs
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @uses bp_is_my_profile() Checks to see if the current user being viewed is the logged in user
+ */
+function bp_blogs_setup_nav() {
+	global $bp;
+
+	/* Blog/post/comment menus should not appear on single WordPress setups. Although comments
+	   and posts made by users will still show on their activity stream .*/
+	if ( !bp_core_is_multisite() )
+		return false;
+
+	/* Add 'Blogs' to the main navigation */
+	bp_core_new_nav_item( array( 'name' => sprintf( __( 'Blogs <span>(%d)</span>', 'buddypress' ), bp_blogs_total_blogs_for_user() ), 'slug' => $bp->blogs->slug, 'position' => 30, 'screen_function' => 'bp_blogs_screen_my_blogs', 'default_subnav_slug' => 'my-blogs', 'item_css_id' => $bp->blogs->id ) );
+
+	$blogs_link = $bp->loggedin_user->domain . $bp->blogs->slug . '/';
+
+	/* Set up the component options navigation for Blog */
+	if ( 'blogs' == $bp->current_component ) {
+		if ( bp_is_my_profile() ) {
+			if ( function_exists('xprofile_setup_nav') ) {
+				$bp->bp_options_title = __('My Blogs', 'buddypress');
+			}
+		} else {
+			/* If we are not viewing the logged in user, set up the current users avatar and name */
+			$bp->bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => 'thumb' ) );
+			$bp->bp_options_title = $bp->displayed_user->fullname;
+		}
+	}
+
+	do_action( 'bp_blogs_setup_nav' );
+}
+add_action( 'bp_setup_nav', 'bp_blogs_setup_nav' );
+
+function bp_blogs_directory_blogs_setup() {
+	global $bp;
+
+	if ( bp_core_is_multisite() && $bp->current_component == $bp->blogs->slug && empty( $bp->current_action ) ) {
+		$bp->is_directory = true;
+
+		do_action( 'bp_blogs_directory_blogs_setup' );
+		bp_core_load_template( apply_filters( 'bp_blogs_template_directory_blogs_setup', 'blogs/index' ) );
+	}
+}
+add_action( 'wp', 'bp_blogs_directory_blogs_setup', 2 );
+
+
+/********************************************************************************
+ * Screen Functions
+ *
+ * Screen functions are the controllers of BuddyPress. They will execute when their
+ * specific URL is caught. They will first save or manipulate data using business
+ * functions, then pass on the user to a template file.
+ */
+
+function bp_blogs_screen_my_blogs() {
+	global $bp;
+
+	if ( !bp_core_is_multisite() )
+		return false;
+
+	do_action( 'bp_blogs_screen_my_blogs' );
+	bp_core_load_template( apply_filters( 'bp_blogs_template_my_blogs', 'members/single/home' ) );
+}
+
+function bp_blogs_screen_create_a_blog() {
+	global $bp;
+
+	if ( !bp_core_is_multisite() || $bp->current_component != $bp->blogs->slug || 'create' != $bp->current_action )
+		return false;
+
+	if ( !is_user_logged_in() || !bp_blog_signup_enabled() )
+		return false;
+
+	do_action( 'bp_blogs_screen_create_a_blog' );
+	bp_core_load_template( apply_filters( 'bp_blogs_template_create_a_blog', 'blogs/create' ) );
+}
+/* The create screen is not attached to a nav item, so we need to attach it to an action */
+add_action( 'wp', 'bp_blogs_screen_create_a_blog', 3 );
+
+
+/********************************************************************************
+ * Activity & Notification Functions
+ *
+ * These functions handle the recording, deleting and formatting of activity and
+ * notifications for the user and for this specific component.
+ */
+
+function bp_blogs_register_activity_actions() {
+	global $bp;
+
+	if ( !function_exists( 'bp_activity_set_action' ) )
+		return false;
+
+	bp_activity_set_action( $bp->blogs->id, 'new_blog', __( 'New blog created', 'buddypress' ) );
+	bp_activity_set_action( $bp->blogs->id, 'new_blog_post', __( 'New blog post published', 'buddypress' ) );
+	bp_activity_set_action( $bp->blogs->id, 'new_blog_comment', __( 'New blog post comment posted', 'buddypress' ) );
+
+	do_action( 'bp_blogs_register_activity_actions' );
+}
+add_action( 'bp_register_activity_actions', 'bp_blogs_register_activity_actions' );
+
+function bp_blogs_record_activity( $args = '' ) {
+	global $bp;
+
+	if ( !function_exists( 'bp_activity_add' ) )
+		return false;
+
+	/* Because blog, comment, and blog post code execution happens before anything else
+	   we may need to manually instantiate the activity component globals */
+	if ( !$bp->activity && function_exists('bp_activity_setup_globals') )
+		bp_activity_setup_globals();
+
+	$defaults = array(
+		'user_id' => $bp->loggedin_user->id,
+		'action' => '',
+		'content' => '',
+		'primary_link' => '',
+		'component' => $bp->blogs->id,
+		'type' => false,
+		'item_id' => false,
+		'secondary_item_id' => false,
+		'recorded_time' => bp_core_current_time(),
+		'hide_sitewide' => false
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	/* Remove large images and replace them with just one image thumbnail */
+ 	if ( function_exists( 'bp_activity_thumbnail_content_images' ) && !empty( $content ) )
+		$content = bp_activity_thumbnail_content_images( $content );
+
+	if ( !empty( $action ) )
+		$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 );
+
+	/* Check for an existing entry and update if one exists. */
+	$id = bp_activity_get_activity_id( array(
+		'user_id' => $user_id,
+		'component' => $component,
+		'type' => $type,
+		'item_id' => $item_id,
+		'secondary_item_id' => $secondary_item_id
+	) );
+
+	return bp_activity_add( array( 'id' => $id, 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
+}
+
+function bp_blogs_delete_activity( $args = true ) {
+	global $bp;
+
+	if ( function_exists('bp_activity_delete_by_item_id') ) {
+		$defaults = array(
+			'item_id' => false,
+			'component' => $bp->blogs->id,
+			'type' => false,
+			'user_id' => false,
+			'secondary_item_id' => false
+		);
+
+		$params = wp_parse_args( $args, $defaults );
+		extract( $params, EXTR_SKIP );
+
+		bp_activity_delete_by_item_id( array(
+			'item_id' => $item_id,
+			'component' => $component,
+			'type' => $type,
+			'user_id' => $user_id,
+			'secondary_item_id' => $secondary_item_id
+		) );
+	}
+}
+
+/********************************************************************************
+ * Business Functions
+ *
+ * Business functions are where all the magic happens in BuddyPress. They will
+ * handle the actual saving or manipulation of information. Usually they will
+ * hand off to a database class for data access, then return
+ * true or false on success or failure.
+ */
+
+function bp_blogs_get_blogs( $args = '' ) {
+	global $bp;
+
+	$defaults = array(
+		'type' => 'active', // active, alphabetical, newest, or random.
+		'user_id' => false, // Pass a user_id to limit to only blogs that this user has privilages higher than subscriber on.
+		'search_terms' => false, // Limit to blogs that match these search terms
+
+		'per_page' => 20, // The number of results to return per page
+		'page' => 1, // The page to return if limiting per page
+	);
+
+	$params = wp_parse_args( $args, $defaults );
+	extract( $params, EXTR_SKIP );
+
+	return apply_filters( 'bp_blogs_get_blogs', BP_Blogs_Blog::get( $type, $per_page, $page, $user_id, $search_terms ), &$params );
+}
+
+function bp_blogs_record_existing_blogs() {
+	global $bp, $wpdb;
+
+	/* Truncate user blogs table and re-record. */
+	$wpdb->query( "TRUNCATE TABLE {$bp->blogs->table_name}" );
+
+	$blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0" ) );
+
+	if ( $blog_ids ) {
+		foreach( (array)$blog_ids as $blog_id ) {
+			$users = get_users_of_blog( $blog_id );
+
+			if ( $users ) {
+				foreach ( (array)$users as $user ) {
+					$role = unserialize( $user->meta_value );
+
+					if ( !isset( $role['subscriber'] ) )
+						bp_blogs_record_blog( $blog_id, $user->user_id, true );
+				}
+			}
+		}
+	}
+}
+
+/**
+ * Makes BuddyPress aware of a new site so that it can track its activity.
+ *
+ * @global object $bp BuddyPress global settings
+ * @param int $blog_id
+ * @param int $user_id
+ * @param $bool $no_activity ; optional.
+ * @since 1.0
+ * @uses BP_Blogs_Blog
+ */
+function bp_blogs_record_blog( $blog_id, $user_id, $no_activity = false ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = $bp->loggedin_user->id;
+
+	$name = get_blog_option( $blog_id, 'blogname' );
+	$description = get_blog_option( $blog_id, 'blogdescription' );
+
+	if ( empty( $name ) )
+		return false;
+
+	$recorded_blog = new BP_Blogs_Blog;
+	$recorded_blog->user_id = $user_id;
+	$recorded_blog->blog_id = $blog_id;
+
+	$recorded_blog_id = $recorded_blog->save();
+
+	bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'name', $name );
+	bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'description', $description );
+	bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'last_activity', bp_core_current_time() );
+
+	// Only record this activity if the blog is public
+	if ( (int)$_POST['blog_public'] && !$no_activity ) {
+		// 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( __( '%s created the blog %s', 'buddypress'), bp_core_get_userlink( $recorded_blog->user_id ), '<a href="' . get_site_url( $recorded_blog->blog_id ) . '">' . esc_attr( $name ) . '</a>' ), &$recorded_blog, $name, $description ),
+			'primary_link' => apply_filters( 'bp_blogs_activity_created_blog_primary_link', get_site_url( $recorded_blog->blog_id ), $recorded_blog->blog_id ),
+			'type'         => 'new_blog',
+			'item_id'      => $recorded_blog->blog_id
+		) );
+	}
+
+	do_action( 'bp_blogs_new_blog', &$recorded_blog, $is_private, $is_recorded );
+}
+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;
+
+	$post_id = (int)$post_id;
+	$blog_id = (int)$wpdb->blogid;
+
+	if ( !$user_id )
+		$user_id = (int)$post->post_author;
+
+	/* This is to stop infinite loops with Donncha's sitewide tags plugin */
+	if ( (int)$bp->site_options['tags_blog_id'] == (int)$blog_id )
+		return false;
+
+	/* Don't record this if it's not a post */
+	if ( $post->post_type != 'post' )
+		return false;
+
+	if ( 'publish' == $post->post_status && '' == $post->post_password ) {
+		if ( (int)get_blog_option( $blog_id, 'blog_public' ) || !bp_core_is_multisite() ) {
+			/* Record this in activity streams */
+			$post_permalink = get_permalink( $post_id );
+
+			$activity_action = sprintf( __( '%s wrote a new blog post: %s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' );
+			$activity_content = $post->post_content;
+
+			bp_blogs_record_activity( array(
+				'user_id' => (int)$post->post_author,
+				'action' => apply_filters( 'bp_blogs_activity_new_post_action', $activity_action, &$post, $post_permalink ),
+				'content' => apply_filters( 'bp_blogs_activity_new_post_content', $activity_content, &$post, $post_permalink ),
+				'primary_link' => apply_filters( 'bp_blogs_activity_new_post_primary_link', $post_permalink, $post_id ),
+				'type' => 'new_blog_post',
+				'item_id' => $blog_id,
+				'secondary_item_id' => $post_id,
+				'recorded_time' => $post->post_date_gmt
+			));
+		}
+	} else
+		bp_blogs_remove_post( $post_id, $blog_id );
+
+	bp_blogs_update_blogmeta( $blog_id, 'last_activity', bp_core_current_time() );
+
+	do_action( 'bp_blogs_new_blog_post', $post_id, $post, $user_id );
+}
+add_action( 'save_post', 'bp_blogs_record_post', 10, 2 );
+
+/**
+ * bp_blogs_record_comment()
+ *
+ * Record blog comment activity. Checks if blog is public and post is not
+ * password protected.
+ *
+ * @global object $wpdb
+ * @global $bp $bp
+ * @param int $comment_id
+ * @param bool $is_approved
+ * @return mixed
+ */
+
+function bp_blogs_record_comment( $comment_id, $is_approved = true ) {
+	global $wpdb, $bp;
+
+	// Get the users comment
+	$recorded_comment = get_comment( $comment_id );
+
+	// Don't record activity if the comment hasn't been approved
+	if ( !$is_approved || !$recorded_comment->comment_approved )
+		return false;
+
+	// Don't record activity if no email address has been included
+	if ( empty( $recorded_comment->comment_author_email ) )
+		return false;
+	
+	// Get the user_id from the comment author email.
+	$user = get_user_by_email( $recorded_comment->comment_author_email );
+	$user_id = (int)$user->ID;
+
+	// If there's no registered user id, don't record activity
+	if ( empty( $user_id ) )
+		return false;
+
+	// Get blog and post data
+	$blog_id = (int)$wpdb->blogid;
+	$recorded_comment->post = get_post( $recorded_comment->comment_post_ID );
+
+	// If this is a password protected post, don't record the comment
+	if ( !empty( $recorded_comment->post->post_password ) )
+		return false;
+
+	// If blog is public allow activity to be posted
+	if ( get_blog_option( $blog_id, 'blog_public' ) ) {
+
+		// Get activity related links
+		$post_permalink = get_permalink( $recorded_comment->comment_post_ID );
+		$comment_link   = htmlspecialchars( get_comment_link( $recorded_comment->comment_ID ) );
+
+		// Prepare to record in activity streams
+		$activity_action	= sprintf( __( '%s commented on the blog post %s', 'buddypress' ), bp_core_get_userlink( $user_id ), '<a href="' . $post_permalink . '">' . apply_filters( 'the_title', $recorded_comment->post->post_title ) . '</a>' );
+		$activity_content	= $recorded_comment->comment_content;
+
+		// Record in activity streams
+		bp_blogs_record_activity( array(
+			'user_id'           => $user_id,
+			'action'            => apply_filters( 'bp_blogs_activity_new_comment_action', $activity_action, &$recorded_comment, $comment_link ),
+			'content'           => apply_filters( 'bp_blogs_activity_new_comment_content', $activity_content, &$recorded_comment, $comment_link ),
+			'primary_link'      => apply_filters( 'bp_blogs_activity_new_comment_primary_link', $comment_link, &$recorded_comment ),
+			'type'              => 'new_blog_comment',
+			'item_id'           => $blog_id,
+			'secondary_item_id' => $comment_id,
+			'recorded_time'     => $recorded_comment->comment_date_gmt
+		) );
+
+		// Update the blogs last active date
+		bp_blogs_update_blogmeta( $blog_id, 'last_activity', bp_core_current_time() );
+	}
+
+	return $recorded_comment;
+}
+add_action( 'comment_post', 'bp_blogs_record_comment', 10, 2 );
+add_action( 'edit_comment', 'bp_blogs_record_comment', 10 );
+
+function bp_blogs_manage_comment( $comment_id, $comment_status ) {
+	if ( 'spam' == $comment_status || 'hold' == $comment_status || 'delete' == $comment_status || 'trash' == $comment_status )
+		return bp_blogs_remove_comment( $comment_id );
+
+	return bp_blogs_record_comment( $comment_id, true );
+}
+add_action( 'wp_set_comment_status', 'bp_blogs_manage_comment', 10, 2 );
+
+function bp_blogs_add_user_to_blog( $user_id, $role, $blog_id = false ) {
+	global $current_blog;
+
+	if ( empty( $blog_id ) )
+		$blog_id = $current_blog->blog_id;
+
+	if ( $role != 'subscriber' )
+		bp_blogs_record_blog( $blog_id, $user_id, true );
+}
+add_action( 'add_user_to_blog', 'bp_blogs_add_user_to_blog', 10, 3 );
+
+function bp_blogs_remove_user_from_blog( $user_id, $blog_id = false ) {
+	global $current_blog;
+
+	if ( empty( $blog_id ) )
+		$blog_id = $current_blog->blog_id;
+
+	bp_blogs_remove_blog_for_user( $user_id, $blog_id );
+}
+add_action( 'remove_user_from_blog', 'bp_blogs_remove_user_from_blog', 10, 2 );
+
+function bp_blogs_remove_blog( $blog_id ) {
+	global $bp;
+
+	$blog_id = (int)$blog_id;
+
+	BP_Blogs_Blog::delete_blog_for_all( $blog_id );
+
+	// Delete activity stream item
+	bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->slug, 'type' => 'new_blog' ) );
+
+	do_action( 'bp_blogs_remove_blog', $blog_id );
+}
+add_action( 'delete_blog', 'bp_blogs_remove_blog' );
+
+function bp_blogs_remove_blog_for_user( $user_id, $blog_id ) {
+	global $current_user;
+
+	$blog_id = (int)$blog_id;
+	$user_id = (int)$user_id;
+
+	BP_Blogs_Blog::delete_blog_for_user( $blog_id, $user_id );
+
+	// Delete activity stream item
+	bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->slug, 'type' => 'new_blog' ) );
+
+	do_action( 'bp_blogs_remove_blog_for_user', $blog_id, $user_id );
+}
+add_action( 'remove_user_from_blog', 'bp_blogs_remove_blog_for_user', 10, 2 );
+
+function bp_blogs_remove_post( $post_id, $blog_id = false ) {
+	global $current_blog, $bp;
+
+	$post_id = (int)$post_id;
+
+	if ( !$blog_id )
+		$blog_id = (int)$current_blog->blog_id;
+
+	// Delete activity stream item
+	bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'secondary_item_id' => $post_id, 'component' => $bp->blogs->slug, 'type' => 'new_blog_post' ) );
+
+	do_action( 'bp_blogs_remove_post', $blog_id, $post_id, $post->user_id );
+}
+add_action( 'delete_post', 'bp_blogs_remove_post' );
+
+function bp_blogs_remove_comment( $comment_id ) {
+	global $wpdb, $bp;
+
+	// Delete activity stream item
+	bp_blogs_delete_activity( array( 'item_id' => $wpdb->blogid , 'secondary_item_id' => $comment_id, 'type' => 'new_blog_comment' ) );
+
+	do_action( 'bp_blogs_remove_comment', $blog_id, $comment_id, $bp->loggedin_user->id );
+}
+add_action( 'delete_comment', 'bp_blogs_remove_comment' );
+
+function bp_blogs_total_blogs() {
+	if ( !$count = wp_cache_get( 'bp_total_blogs', 'bp' ) ) {
+		$blogs = BP_Blogs_Blog::get_all();
+		$count = $blogs['total'];
+		wp_cache_set( 'bp_total_blogs', $count, 'bp' );
+	}
+	return $count;
+}
+
+function bp_blogs_total_blogs_for_user( $user_id = false ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
+
+	if ( !$count = wp_cache_get( 'bp_total_blogs_for_user_' . $user_id, 'bp' ) ) {
+		$count = BP_Blogs_Blog::total_blog_count_for_user( $user_id );
+		wp_cache_set( 'bp_total_blogs_for_user_' . $user_id, $count, 'bp' );
+	}
+
+	return $count;
+}
+
+function bp_blogs_remove_data_for_blog( $blog_id ) {
+	global $bp;
+
+	/* If this is regular blog, delete all data for that blog. */
+	BP_Blogs_Blog::delete_blog_for_all( $blog_id );
+
+	// Delete activity stream item
+	bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->slug, 'type' => false ) );
+
+	do_action( 'bp_blogs_remove_data_for_blog', $blog_id );
+}
+add_action( 'delete_blog', 'bp_blogs_remove_data_for_blog', 1 );
+
+function bp_blogs_get_blogs_for_user( $user_id, $show_hidden = false ) {
+	return BP_Blogs_Blog::get_blogs_for_user( $user_id, $show_hidden );
+}
+
+function bp_blogs_get_all_blogs( $limit = null, $page = null ) {
+	return BP_Blogs_Blog::get_all( $limit, $page );
+}
+
+function bp_blogs_get_random_blogs( $limit = null, $page = null ) {
+	return BP_Blogs_Blog::get( 'random', $limit, $page );
+}
+
+function bp_blogs_is_blog_hidden( $blog_id ) {
+	return BP_Blogs_Blog::is_hidden( $blog_id );
+}
+
+function bp_blogs_redirect_to_random_blog() {
+	global $bp, $wpdb;
+
+	if ( $bp->current_component == $bp->blogs->slug && isset( $_GET['random-blog'] ) ) {
+		$blog = bp_blogs_get_random_blogs( 1, 1 );
+
+		bp_core_redirect( get_site_url( $blog['blogs'][0]->blog_id ) );
+	}
+}
+add_action( 'wp', 'bp_blogs_redirect_to_random_blog', 6 );
+
+
+//
+// Blog meta functions
+// These functions are used to store specific blogmeta in one global table, rather than in each
+// blog's options table. Significantly speeds up global blog queries.
+// By default each blog's name, description and last updated time are stored and synced here.
+//
+
+function bp_blogs_delete_blogmeta( $blog_id, $meta_key = false, $meta_value = false ) {
+	global $wpdb, $bp;
+
+	if ( !is_numeric( $blog_id ) || !bp_core_is_multisite() )
+		return false;
+
+	$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
+
+	if ( is_array($meta_value) || is_object($meta_value) )
+		$meta_value = serialize($meta_value);
+
+	$meta_value = trim( $meta_value );
+
+	if ( !$meta_key ) {
+		$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d", $blog_id ) );
+	} else if ( $meta_value ) {
+		$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d AND meta_key = %s AND meta_value = %s", $blog_id, $meta_key, $meta_value ) );
+	} else {
+		$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d AND meta_key = %s", $blog_id, $meta_key ) );
+	}
+
+	wp_cache_delete( 'bp_blogs_blogmeta_' . $blog_id . '_' . $meta_key, 'bp' );
+
+	return true;
+}
+
+function bp_blogs_get_blogmeta( $blog_id, $meta_key = '') {
+	global $wpdb, $bp;
+
+	$blog_id = (int) $blog_id;
+
+	if ( !$blog_id || !bp_core_is_multisite() )
+		return false;
+
+	if ( !empty($meta_key) ) {
+		$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
+
+		if ( !$metas = wp_cache_get( 'bp_blogs_blogmeta_' . $blog_id . '_' . $meta_key, 'bp' ) ) {
+			$metas = $wpdb->get_col( $wpdb->prepare( "SELECT meta_value FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d AND meta_key = %s", $blog_id, $meta_key ) );
+			wp_cache_set( 'bp_blogs_blogmeta_' . $blog_id . '_' . $meta_key, $metas, 'bp' );
+		}
+	} else {
+		$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d", $blog_id) );
+	}
+
+	if ( empty($metas) ) {
+		if ( empty($meta_key) )
+			return array();
+		else
+			return '';
+	}
+
+	$metas = array_map('maybe_unserialize', (array)$metas);
+
+	if ( 1 == count($metas) )
+		return $metas[0];
+	else
+		return $metas;
+}
+
+function bp_blogs_update_blogmeta( $blog_id, $meta_key, $meta_value ) {
+	global $wpdb, $bp;
+
+	if ( !is_numeric( $blog_id ) || !bp_core_is_multisite() )
+		return false;
+
+	$meta_key = preg_replace( '|[^a-z0-9_]|i', '', $meta_key );
+
+	if ( is_string($meta_value) )
+		$meta_value = stripslashes($wpdb->escape($meta_value));
+
+	$meta_value = maybe_serialize($meta_value);
+
+	if (empty($meta_value)) {
+		return bp_blogs_delete_blogmeta( $blog_id, $meta_key );
+	}
+
+	$cur = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d AND meta_key = %s", $blog_id, $meta_key ) );
+
+	if ( !$cur ) {
+		$wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->blogs->table_name_blogmeta} ( blog_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", $blog_id, $meta_key, $meta_value ) );
+	} else if ( $cur->meta_value != $meta_value ) {
+		$wpdb->query( $wpdb->prepare( "UPDATE {$bp->blogs->table_name_blogmeta} SET meta_value = %s WHERE blog_id = %d AND meta_key = %s", $meta_value, $blog_id, $meta_key ) );
+	} else {
+		return false;
+	}
+
+	wp_cache_set( 'bp_blogs_blogmeta_' . $blog_id . '_' . $meta_key, $metas, 'bp' );
+
+	return true;
+}
+
+function bp_blogs_remove_data( $user_id ) {
+	if ( !bp_core_is_multisite() )
+		return false;
+
+	/* If this is regular blog, delete all data for that blog. */
+	BP_Blogs_Blog::delete_blogs_for_user( $user_id );
+
+	do_action( 'bp_blogs_remove_data', $user_id );
+}
+add_action( 'wpmu_delete_user', 'bp_blogs_remove_data' );
+add_action( 'delete_user', 'bp_blogs_remove_data' );
+add_action( 'make_spam_user', 'bp_blogs_remove_data' );
+
+
+/********************************************************************************
+ * Caching
+ *
+ * Caching functions handle the clearing of cached objects and pages on specific
+ * actions throughout BuddyPress.
+ */
+
+function bp_blogs_clear_blog_object_cache( $blog_id, $user_id ) {
+	wp_cache_delete( 'bp_blogs_of_user_' . $user_id, 'bp' );
+	wp_cache_delete( 'bp_blogs_for_user_' . $user_id, 'bp' );
+	wp_cache_delete( 'bp_total_blogs_for_user_' . $user_id, 'bp' );
+
+	/* Clear the sitewide activity cache */
+	wp_cache_delete( 'sitewide_activity', 'bp' );
+}
+
+function bp_blogs_format_clear_blog_cache( $recorded_blog_obj ) {
+	bp_blogs_clear_blog_object_cache( false, $recorded_blog_obj->user_id );
+
+	/* Clear the sitewide activity cache */
+	wp_cache_delete( 'sitewide_activity', 'bp' );
+	wp_cache_delete( 'bp_total_blogs', 'bp' );
+}
+
+// List actions to clear object caches on
+add_action( 'bp_blogs_remove_blog_for_user', 'bp_blogs_clear_blog_object_cache', 10, 2 );
+add_action( 'bp_blogs_new_blog', 'bp_blogs_format_clear_blog_cache', 10, 2 );
+
+// List actions to clear super cached pages on, if super cache is installed
+add_action( 'bp_blogs_remove_data_for_blog', 'bp_core_clear_cache' );
+add_action( 'bp_blogs_remove_comment', 'bp_core_clear_cache' );
+add_action( 'bp_blogs_remove_post', 'bp_core_clear_cache' );
+add_action( 'bp_blogs_remove_blog_for_user', 'bp_core_clear_cache' );
+add_action( 'bp_blogs_remove_blog', 'bp_core_clear_cache' );
+add_action( 'bp_blogs_new_blog_comment', 'bp_core_clear_cache' );
+add_action( 'bp_blogs_new_blog_post', 'bp_core_clear_cache' );
+add_action( 'bp_blogs_new_blog', 'bp_core_clear_cache' );
+add_action( 'bp_blogs_remove_data', 'bp_core_clear_cache' );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-blogs/bp-blogs-classes.php b/wp-content/plugins/buddypress/bp-blogs/bp-blogs-classes.php
new file mode 100644
index 0000000000000000000000000000000000000000..dd6a86343b28040d0b0112406c350ebd73d29c60
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-blogs/bp-blogs-classes.php
@@ -0,0 +1,313 @@
+<?php
+
+Class BP_Blogs_Blog {
+	var $id;
+	var $user_id;
+	var $blog_id;
+
+	function bp_blogs_blog( $id = null ) {
+		global $bp, $wpdb;
+
+		if ( !$user_id )
+			$user_id = $bp->displayed_user->id;
+
+		if ( $id ) {
+			$this->id = $id;
+			$this->populate();
+		}
+	}
+
+	function populate() {
+		global $wpdb, $bp;
+
+		$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->blogs->table_name} WHERE id = %d", $this->id ) );
+
+		$this->user_id = $blog->user_id;
+		$this->blog_id = $blog->blog_id;
+	}
+
+	function save() {
+		global $wpdb, $bp;
+
+		$this->user_id = apply_filters( 'bp_blogs_blog_user_id_before_save', $this->user_id, $this->id );
+		$this->blog_id = apply_filters( 'bp_blogs_blog_id_before_save', $this->blog_id, $this->id );
+
+		do_action( 'bp_blogs_blog_before_save', $this );
+
+		// Don't try and save if there is no user ID or blog ID set.
+		if ( !$this->user_id || !$this->blog_id )
+			return false;
+
+		// Don't save if this blog has already been recorded for the user.
+		if ( !$this->id && $this->exists() )
+			return false;
+
+		if ( $this->id ) {
+			// Update
+			$sql = $wpdb->prepare( "UPDATE {$bp->blogs->table_name} SET user_id = %d, blog_id = %d WHERE id = %d", $this->user_id, $this->blog_id, $this->id );
+		} else {
+			// Save
+			$sql = $wpdb->prepare( "INSERT INTO {$bp->blogs->table_name} ( user_id, blog_id ) VALUES ( %d, %d )", $this->user_id, $this->blog_id );
+		}
+
+		if ( !$wpdb->query($sql) )
+			return false;
+
+		do_action( 'bp_blogs_blog_after_save', $this );
+
+		if ( $this->id )
+			return $this->id;
+		else
+			return $wpdb->insert_id;
+	}
+
+	function exists() {
+		global $bp, $wpdb;
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->blogs->table_name} WHERE user_id = %d AND blog_id = %d", $this->user_id, $this->blog_id ) );
+	}
+
+	/* Static Functions */
+
+	function get( $type, $limit = false, $page = false, $user_id = false, $search_terms = false ) {
+		global $bp, $wpdb;
+
+		if ( !$bp->blogs )
+			bp_blogs_setup_globals();
+
+		if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
+			$hidden_sql = "AND wb.public = 1";
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		if ( $user_id )
+			$user_sql = $wpdb->prepare( " AND b.user_id = %d", $user_id );
+
+		switch ( $type ) {
+			case 'active': default:
+				$order_sql = "ORDER BY bm.meta_value DESC";
+				break;
+			case 'alphabetical':
+				$order_sql = "ORDER BY bm2.meta_value ASC";
+				break;
+			case 'newest':
+				$order_sql = "ORDER BY wb.registered DESC";
+				break;
+			case 'random':
+				$order_sql = "ORDER BY RAND()";
+				break;
+		}
+
+		if ( !empty( $search_terms ) ) {
+			$filter = like_escape( $wpdb->escape( $search_terms ) );
+			$paged_blogs = $wpdb->get_results( "SELECT b.blog_id, b.user_id as admin_user_id, u.user_email as admin_user_email, wb.domain, wb.path, bm.meta_value as last_activity, bm2.meta_value as name FROM {$bp->blogs->table_name} b, {$bp->blogs->table_name_blogmeta} bm, {$bp->blogs->table_name_blogmeta} bm2, {$wpdb->base_prefix}blogs wb, {$wpdb->users} u WHERE b.blog_id = wb.blog_id AND b.user_id = u.ID AND b.blog_id = bm.blog_id AND b.blog_id = bm2.blog_id AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql} AND bm.meta_key = 'last_activity' AND bm2.meta_key = 'name' AND bm2.meta_value LIKE '%%$filter%%' {$user_sql} GROUP BY b.blog_id {$order_sql} {$pag_sql}" );
+			$total_blogs = $wpdb->get_var( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b, {$wpdb->base_prefix}blogs wb, {$bp->blogs->table_name_blogmeta} bm, {$bp->blogs->table_name_blogmeta} bm2 WHERE b.blog_id = wb.blog_id AND bm.blog_id = b.blog_id AND bm2.blog_id = b.blog_id AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql} AND bm.meta_key = 'name' AND bm2.meta_key = 'description' AND ( bm.meta_value LIKE '%%$filter%%' || bm2.meta_value LIKE '%%$filter%%' ) {$user_sql}" );
+		} else {
+			$paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT b.blog_id, b.user_id as admin_user_id, u.user_email as admin_user_email, wb.domain, wb.path, bm.meta_value as last_activity, bm2.meta_value as name FROM {$bp->blogs->table_name} b, {$bp->blogs->table_name_blogmeta} bm, {$bp->blogs->table_name_blogmeta} bm2, {$wpdb->base_prefix}blogs wb, {$wpdb->users} u WHERE b.blog_id = wb.blog_id AND b.user_id = u.ID AND b.blog_id = bm.blog_id AND b.blog_id = bm2.blog_id {$user_sql} AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql} AND bm.meta_key = 'last_activity' AND bm2.meta_key = 'name' GROUP BY b.blog_id {$order_sql} {$pag_sql}" ) );
+			$total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b, {$wpdb->base_prefix}blogs wb WHERE b.blog_id = wb.blog_id {$user_sql} AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql}" ) );
+		}
+
+		foreach ( (array)$paged_blogs as $blog ) $blog_ids[] = $blog->blog_id;
+		$blog_ids = $wpdb->escape( join( ',', (array)$blog_ids ) );
+		$paged_blogs = BP_Blogs_Blog::get_blog_extras( &$paged_blogs, $blog_ids, $type );
+
+		return array( 'blogs' => $paged_blogs, 'total' => $total_blogs );
+	}
+
+	function delete_blog_for_all( $blog_id ) {
+		global $wpdb, $bp;
+
+		if ( !$bp->blogs )
+			bp_blogs_setup_globals();
+
+		bp_blogs_delete_blogmeta( $blog_id );
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->blogs->table_name} WHERE blog_id = %d", $blog_id ) );
+	}
+
+	function delete_blog_for_user( $blog_id, $user_id = null ) {
+		global $wpdb, $bp;
+
+		if ( !$bp->blogs )
+			bp_blogs_setup_globals();
+
+		if ( !$user_id )
+			$user_id = $bp->loggedin_user->id;
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->blogs->table_name} WHERE user_id = %d AND blog_id = %d", $user_id, $blog_id ) );
+	}
+
+	function delete_blogs_for_user( $user_id = null ) {
+		global $wpdb, $bp;
+
+		if ( !$bp->blogs )
+			bp_blogs_setup_globals();
+
+		if ( !$user_id )
+			$user_id = $bp->loggedin_user->id;
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->blogs->table_name} WHERE user_id = %d", $user_id ) );
+	}
+
+	function get_blogs_for_user( $user_id = false, $show_hidden = false ) {
+		global $bp, $wpdb;
+
+		if ( !$bp->blogs )
+			bp_blogs_setup_globals();
+
+		if ( !$user_id )
+			$user_id = $bp->displayed_user->id;
+
+		// Show logged in users their hidden blogs.
+		if ( !bp_is_my_profile() && !$show_hidden )
+			$blogs = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT b.blog_id, b.id, bm1.meta_value as name, wb.domain, wb.path FROM {$bp->blogs->table_name} b, {$wpdb->base_prefix}blogs wb, {$bp->blogs->table_name_blogmeta} bm1 WHERE b.blog_id = wb.blog_id AND b.blog_id = bm1.blog_id AND bm1.meta_key = 'name' AND wb.public = 1 AND wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND b.user_id = %d ORDER BY b.blog_id", $user_id ) );
+		else
+			$blogs = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT b.blog_id, b.id, bm1.meta_value as name, wb.domain, wb.path FROM {$bp->blogs->table_name} b, {$wpdb->base_prefix}blogs wb, {$bp->blogs->table_name_blogmeta} bm1 WHERE b.blog_id = wb.blog_id AND b.blog_id = bm1.blog_id AND bm1.meta_key = 'name' AND wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND b.user_id = %d ORDER BY b.blog_id", $user_id ) );
+
+		$total_blog_count = BP_Blogs_Blog::total_blog_count_for_user( $user_id );
+
+		foreach ( (array)$blogs as $blog ) {
+			$user_blogs[$blog->blog_id] = new stdClass;
+			$user_blogs[$blog->blog_id]->id = $blog->id;
+			$user_blogs[$blog->blog_id]->blog_id = $blog->blog_id;
+			$user_blogs[$blog->blog_id]->siteurl = ( is_ssl() ) ? 'https://' . $blog->domain . $blog->path : 'http://' . $blog->domain . $blog->path;
+			$user_blogs[$blog->blog_id]->name = $blog->name;
+		}
+
+		return array( 'blogs' => $user_blogs, 'count' => $total_blog_count );
+	}
+
+	function get_blog_ids_for_user( $user_id = false ) {
+		global $bp, $wpdb;
+
+		if ( !$bp->blogs )
+			bp_blogs_setup_globals();
+
+		if ( !$user_id )
+			$user_id = $bp->displayed_user->id;
+
+		return $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$bp->blogs->table_name} WHERE user_id = %d", $user_id ) );
+	}
+
+	function is_recorded( $blog_id ) {
+		global $bp, $wpdb;
+
+		if ( !$bp->blogs )
+			bp_blogs_setup_globals();
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->blogs->table_name} WHERE blog_id = %d", $blog_id ) );
+	}
+
+	function total_blog_count_for_user( $user_id = null ) {
+		global $bp, $wpdb;
+
+		if ( !$bp->blogs )
+			bp_blogs_setup_globals();
+
+		if ( !$user_id )
+			$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_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) );
+	}
+
+	function search_blogs( $filter, $limit = null, $page = null ) {
+		global $wpdb, $bp;
+
+		if ( !$bp->blogs )
+			bp_blogs_setup_globals();
+
+		$filter = like_escape( $wpdb->escape( $filter ) );
+
+		if ( !is_super_admin() )
+			$hidden_sql = "AND wb.public = 1";
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		$paged_blogs = $wpdb->get_results( "SELECT DISTINCT bm.blog_id FROM {$bp->blogs->table_name_blogmeta} bm LEFT JOIN {$wpdb->base_prefix}blogs wb ON bm.blog_id = wb.blog_id WHERE ( ( bm.meta_key = 'name' OR bm.meta_key = 'description' ) AND bm.meta_value LIKE '%%$filter%%' ) {$hidden_sql} AND wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 ORDER BY meta_value ASC{$pag_sql}" );
+		$total_blogs = $wpdb->get_var( "SELECT COUNT(DISTINCT bm.blog_id) FROM {$bp->blogs->table_name_blogmeta} bm LEFT JOIN {$wpdb->base_prefix}blogs wb ON bm.blog_id = wb.blog_id WHERE ( ( bm.meta_key = 'name' OR bm.meta_key = 'description' ) AND bm.meta_value LIKE '%%$filter%%' ) {$hidden_sql} AND wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 ORDER BY meta_value ASC" );
+
+		return array( 'blogs' => $paged_blogs, 'total' => $total_blogs );
+	}
+
+	function get_all( $limit = null, $page = null ) {
+		global $bp, $wpdb;
+
+		if ( !$bp->blogs )
+			bp_blogs_setup_globals();
+
+		if ( !is_super_admin() )
+			$hidden_sql = "AND wb.public = 1";
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		$paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT 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.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 {$hidden_sql} {$pag_sql}" ) );
+		$total_blogs = $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.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 {$hidden_sql}" ) );
+
+		return array( 'blogs' => $paged_blogs, 'total' => $total_blogs );
+	}
+
+	function get_by_letter( $letter, $limit = null, $page = null ) {
+		global $bp, $wpdb;
+
+		if ( !$bp->blogs )
+			bp_blogs_setup_globals();
+
+		$letter = like_escape( $wpdb->escape( $letter ) );
+
+		if ( !is_super_admin() )
+			$hidden_sql = "AND wb.public = 1";
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		$paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT bm.blog_id FROM {$bp->blogs->table_name_blogmeta} bm LEFT JOIN {$wpdb->base_prefix}blogs wb ON bm.blog_id = wb.blog_id WHERE bm.meta_key = 'name' AND bm.meta_value LIKE '$letter%%' {$hidden_sql} AND wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 ORDER BY bm.meta_value ASC{$pag_sql}" ) );
+		$total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT bm.blog_id) FROM {$bp->blogs->table_name_blogmeta} bm LEFT JOIN {$wpdb->base_prefix}blogs wb ON bm.blog_id = wb.blog_id WHERE bm.meta_key = 'name' AND bm.meta_value LIKE '$letter%%' {$hidden_sql} AND wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 ORDER BY bm.meta_value ASC" ) );
+
+		return array( 'blogs' => $paged_blogs, 'total' => $total_blogs );
+	}
+
+	function get_blog_extras( $paged_blogs, $blog_ids, $type = false ) {
+		global $bp, $wpdb;
+
+		if ( empty( $blog_ids ) )
+			return $paged_blogs;
+
+		for ( $i = 0; $i < count( $paged_blogs ); $i++ ) {
+			$blog_prefix = $wpdb->get_blog_prefix( $paged_blogs[$i]->blog_id );
+			$paged_blogs[$i]->latest_post = $wpdb->get_row( "SELECT post_title, guid FROM {$blog_prefix}posts WHERE post_status = 'publish' AND post_type = 'post' AND id != 1 ORDER BY id DESC LIMIT 1" );
+		}
+
+		/* Fetch the blog description for each blog (as it may be empty we can't fetch it in the main query). */
+		$blog_descs = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, meta_value as description FROM {$bp->blogs->table_name_blogmeta} WHERE meta_key = 'description' AND blog_id IN ( {$blog_ids} )" ) );
+
+		for ( $i = 0; $i < count( $paged_blogs ); $i++ ) {
+			foreach ( (array)$blog_descs as $desc ) {
+				if ( $desc->blog_id == $paged_blogs[$i]->blog_id )
+					$paged_blogs[$i]->description = $desc->description;
+			}
+		}
+
+		return $paged_blogs;
+	}
+
+	function is_hidden( $blog_id ) {
+		global $wpdb;
+
+		if ( !$bp->blogs )
+			bp_blogs_setup_globals();
+
+		if ( !(int)$wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT public FROM {$wpdb->base_prefix}blogs WHERE blog_id = %d", $blog_id ) ) )
+			return true;
+
+		return false;
+	}
+}
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-blogs/bp-blogs-templatetags.php b/wp-content/plugins/buddypress/bp-blogs/bp-blogs-templatetags.php
new file mode 100644
index 0000000000000000000000000000000000000000..6964ee61d3cb01de053f0cd807436318ed2baf30
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-blogs/bp-blogs-templatetags.php
@@ -0,0 +1,544 @@
+<?php
+
+/**********************************************************************
+ * Blog listing template class.
+ */
+
+class BP_Blogs_Template {
+	var $current_blog = -1;
+	var $blog_count;
+	var $blogs;
+	var $blog;
+
+	var $in_the_loop;
+
+	var $pag_page;
+	var $pag_num;
+	var $pag_links;
+	var $total_blog_count;
+
+	function bp_blogs_template( $type, $page, $per_page, $max, $user_id, $search_terms ) {
+		global $bp;
+
+		$this->pag_page = isset( $_REQUEST['bpage'] ) ? intval( $_REQUEST['bpage'] ) : $page;
+		$this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
+
+		if ( isset( $_REQUEST['letter'] ) && '' != $_REQUEST['letter'] )
+			$this->blogs = BP_Blogs_Blog::get_by_letter( $_REQUEST['letter'], $this->pag_num, $this->pag_page );
+		else
+			$this->blogs = bp_blogs_get_blogs( array( 'type' => $type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'search_terms' => $search_terms ) );
+
+		if ( !$max || $max >= (int)$this->blogs['total'] )
+			$this->total_blog_count = (int)$this->blogs['total'];
+		else
+			$this->total_blog_count = (int)$max;
+
+		$this->blogs = $this->blogs['blogs'];
+
+		if ( $max ) {
+			if ( $max >= count($this->blogs) ) {
+				$this->blog_count = count( $this->blogs );
+			} else {
+				$this->blog_count = (int)$max;
+			}
+		} else {
+			$this->blog_count = count( $this->blogs );
+		}
+
+		if ( (int)$this->total_blog_count && (int)$this->pag_num ) {
+			$this->pag_links = paginate_links( array(
+				'base'      => add_query_arg( 'bpage', '%#%' ),
+				'format'    => '',
+				'total'     => ceil( (int)$this->total_blog_count / (int)$this->pag_num ),
+				'current'   => (int)$this->pag_page,
+				'prev_text' => '&larr;',
+				'next_text' => '&rarr;',
+				'mid_size'  => 1
+			) );
+		}
+	}
+
+	function has_blogs() {
+		if ( $this->blog_count )
+			return true;
+
+		return false;
+	}
+
+	function next_blog() {
+		$this->current_blog++;
+		$this->blog = $this->blogs[$this->current_blog];
+
+		return $this->blog;
+	}
+
+	function rewind_blogs() {
+		$this->current_blog = -1;
+		if ( $this->blog_count > 0 ) {
+			$this->blog = $this->blogs[0];
+		}
+	}
+
+	function blogs() {
+		if ( $this->current_blog + 1 < $this->blog_count ) {
+			return true;
+		} elseif ( $this->current_blog + 1 == $this->blog_count ) {
+			do_action('loop_end');
+			// Do some cleaning up after the loop
+			$this->rewind_blogs();
+		}
+
+		$this->in_the_loop = false;
+		return false;
+	}
+
+	function the_blog() {
+		global $blog;
+
+		$this->in_the_loop = true;
+		$this->blog = $this->next_blog();
+
+		if ( 0 == $this->current_blog ) // loop has just started
+			do_action('loop_start');
+	}
+}
+
+function bp_rewind_blogs() {
+	global $blogs_template;
+
+	$blogs_template->rewind_blogs();
+}
+
+function bp_has_blogs( $args = '' ) {
+	global $bp, $blogs_template;
+
+	/***
+	 * Set the defaults based on the current page. Any of these will be overridden
+	 * if arguments are directly passed into the loop. Custom plugins should always
+	 * pass their parameters directly to the loop.
+	 */
+	$type = 'active';
+	$user_id = false;
+	$search_terms = false;
+
+	/* User filtering */
+	if ( !empty( $bp->displayed_user->id ) )
+		$user_id = $bp->displayed_user->id;
+
+	if ( !empty( $_REQUEST['s'] ) )
+		$search_terms = $_REQUEST['s'];
+
+	$defaults = array(
+		'type' => $type,
+		'page' => 1,
+		'per_page' => 20,
+		'max' => false,
+
+		'user_id' => $user_id, // Pass a user_id to limit to only blogs this user has higher than subscriber access to
+		'search_terms' => $search_terms // Pass search terms to filter on the blog title or description.
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r );
+
+	if ( $max ) {
+		if ( $per_page > $max )
+			$per_page = $max;
+	}
+
+	$blogs_template = new BP_Blogs_Template( $type, $page, $per_page, $max, $user_id, $search_terms );
+	return apply_filters( 'bp_has_blogs', $blogs_template->has_blogs(), &$blogs_template );
+}
+
+function bp_blogs() {
+	global $blogs_template;
+
+	return $blogs_template->blogs();
+}
+
+function bp_the_blog() {
+	global $blogs_template;
+
+	return $blogs_template->the_blog();
+}
+
+function bp_blogs_pagination_count() {
+	global $bp, $blogs_template;
+
+	$start_num = intval( ( $blogs_template->pag_page - 1 ) * $blogs_template->pag_num ) + 1;
+	$from_num = bp_core_number_format( $start_num );
+	$to_num = bp_core_number_format( ( $start_num + ( $blogs_template->pag_num - 1 ) > $blogs_template->total_blog_count ) ? $blogs_template->total_blog_count : $start_num + ( $blogs_template->pag_num - 1 ) );
+	$total = bp_core_number_format( $blogs_template->total_blog_count );
+
+	echo sprintf( __( 'Viewing blog %1$s to %2$s (of %3$s blogs)', 'buddypress' ), $from_num, $to_num, $total ); ?> &nbsp;
+	<span class="ajax-loader"></span><?php
+}
+
+function bp_blogs_pagination_links() {
+	echo bp_get_blogs_pagination_links();
+}
+	function bp_get_blogs_pagination_links() {
+		global $blogs_template;
+
+		return apply_filters( 'bp_get_blogs_pagination_links', $blogs_template->pag_links );
+	}
+
+function bp_blog_avatar( $args = '' ) {
+	echo bp_get_blog_avatar( $args );
+}
+	function bp_get_blog_avatar( $args = '' ) {
+		global $blogs_template, $bp;
+
+		$defaults = array(
+			'type' => 'full',
+			'width' => false,
+			'height' => false,
+			'class' => 'avatar',
+			'id' => false,
+			'alt' => __( 'Blog avatar', 'buddypress' ),
+			'no_grav' => true
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		/***
+		 * In future BuddyPress versions you will be able to set the avatar for a blog.
+		 * Right now you can use a filter with the ID of the blog to change it if you wish.
+		 * By default it will return the avatar for the primary blog admin.
+		 */
+		return apply_filters( 'bp_get_blog_avatar_' . $blogs_template->blog->blog_id, bp_core_fetch_avatar( array( 'item_id' => $blogs_template->blog->admin_user_id, 'type' => $type, 'alt' => $alt, 'width' => $width, 'height' => $height, 'class' => $class, 'email' => $blogs_template->blog->admin_user_email ) ) );
+	}
+
+function bp_blog_permalink() {
+	echo bp_get_blog_permalink();
+}
+	function bp_get_blog_permalink() {
+		global $blogs_template;
+
+		if ( empty( $blogs_template->blog->domain ) )
+			$permalink = $bp->root_domain . $blogs_template->blog->path;
+		else {
+			$protocol = 'http://';
+			if ( is_ssl() )
+				$protocol = 'https://';
+
+			$permalink = $protocol . $blogs_template->blog->domain . $blogs_template->blog->path;
+		}
+
+		return apply_filters( 'bp_get_blog_permalink', $permalink );
+	}
+
+function bp_blog_name() {
+	echo bp_get_blog_name();
+}
+	function bp_get_blog_name() {
+		global $blogs_template;
+
+		return apply_filters( 'bp_get_blog_name', $blogs_template->blog->name );
+	}
+
+function bp_blog_description() {
+	echo apply_filters( 'bp_blog_description', bp_get_blog_description() );
+}
+	function bp_get_blog_description() {
+		global $blogs_template;
+
+		return apply_filters( 'bp_get_blog_description', $blogs_template->blog->description );
+	}
+
+function bp_blog_last_active() {
+	echo bp_get_blog_last_active();
+}
+	function bp_get_blog_last_active() {
+		global $blogs_template;
+
+		return apply_filters( 'bp_blog_last_active', bp_core_get_last_activity( $blogs_template->blog->last_activity, __( 'active %s ago', 'buddypress' ) ) );
+	}
+
+function bp_blog_latest_post() {
+	echo bp_get_blog_latest_post();
+}
+	function bp_get_blog_latest_post() {
+		global $blogs_template;
+
+		if ( null == $blogs_template->blog->latest_post )
+			return false;
+
+		return apply_filters( 'bp_get_blog_latest_post', sprintf( __( 'Latest Post: %s', 'buddypress' ), '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $blogs_template->blog->latest_post->post_title ) . '</a>' ) );
+	}
+
+function bp_blog_hidden_fields() {
+	if ( isset( $_REQUEST['s'] ) ) {
+		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="' . esc_attr( $_REQUEST['letter'] ) . '" name="selected_letter" />';
+	}
+
+	if ( isset( $_REQUEST['blogs_search'] ) ) {
+		echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['blogs_search'] ) . '" name="search_terms" />';
+	}
+}
+
+function bp_total_blog_count() {
+	echo bp_get_total_blog_count();
+}
+	function bp_get_total_blog_count() {
+		return apply_filters( 'bp_get_total_blog_count', bp_blogs_total_blogs() );
+	}
+	add_filter( 'bp_get_total_blog_count', 'bp_core_number_format' );
+
+function bp_total_blog_count_for_user( $user_id = false ) {
+	echo bp_get_total_blog_count_for_user( $user_id );
+}
+	function bp_get_total_blog_count_for_user( $user_id = false ) {
+		return apply_filters( 'bp_get_total_blog_count_for_user', bp_blogs_total_blogs_for_user( $user_id ) );
+	}
+	add_filter( 'bp_get_total_blog_count_for_user', 'bp_core_number_format' );
+
+
+/* Blog registration template tags */
+
+function bp_blog_signup_enabled() {
+	global $bp;
+
+	$active_signup = $bp->site_options['registration'];
+
+	if ( !$active_signup )
+		$active_signup = 'all';
+
+	$active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user"
+
+	if ( 'none' == $active_signup || 'user' == $active_signup )
+		return false;
+
+	return true;
+}
+
+function bp_show_blog_signup_form($blogname = '', $blog_title = '', $errors = '') {
+	global $current_user, $current_site;
+	global $bp;
+
+	require_once( ABSPATH . WPINC . '/registration.php' );
+
+	if ( isset($_POST['submit']) ) {
+		bp_blogs_validate_blog_signup();
+	} else {
+		if ( ! is_wp_error($errors) ) {
+			$errors = new WP_Error();
+		}
+
+		// allow definition of default variables
+		$filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ));
+		$blogname = $filtered_results['blogname'];
+		$blog_title = $filtered_results['blog_title'];
+		$errors = $filtered_results['errors'];
+
+		if ( $errors->get_error_code() ) {
+			echo "<p>" . __('There was a problem, please correct the form below and try again.', 'buddypress') . "</p>";
+		}
+		?>
+		<p><?php printf(__("By filling out the form below, you can <strong>add a blog to your account</strong>. There is no limit to the number of blogs you can have, so create to your heart's content, but blog responsibly.", 'buddypress'), $current_user->display_name) ?></p>
+
+		<p><?php _e("If you&#8217;re not going to use a great blog domain, leave it for a new user. Now have at it!", 'buddypress') ?></p>
+
+		<form class="standard-form" id="setupform" method="post" action="">
+
+			<input type="hidden" name="stage" value="gimmeanotherblog" />
+			<?php do_action( 'signup_hidden_fields' ); ?>
+
+			<?php bp_blogs_signup_blog($blogname, $blog_title, $errors); ?>
+			<p>
+				<input id="submit" type="submit" name="submit" class="submit" value="<?php _e('Create Blog &rarr;', 'buddypress') ?>" />
+			</p>
+
+			<?php wp_nonce_field( 'bp_blog_signup_form' ) ?>
+		</form>
+		<?php
+	}
+}
+
+function bp_blogs_signup_blog( $blogname = '', $blog_title = '', $errors = '' ) {
+	global $current_site;
+
+	// Blog name
+	if( !is_subdomain_install() )
+		echo '<label for="blogname">' . __('Blog Name:', 'buddypress') . '</label>';
+	else
+		echo '<label for="blogname">' . __('Blog Domain:', 'buddypress') . '</label>';
+
+	if ( $errmsg = $errors->get_error_message('blogname') ) { ?>
+		<p class="error"><?php echo $errmsg ?></p>
+	<?php }
+
+	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
+		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 ( !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>';
+	}
+
+	// Blog Title
+	?>
+	<label for="blog_title"><?php _e('Blog Title:', 'buddypress') ?></label>
+	<?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?>
+		<p class="error"><?php echo $errmsg ?></p>
+	<?php }
+	echo '<input name="blog_title" type="text" id="blog_title" value="'.wp_specialchars($blog_title, 1).'" /></p>';
+	?>
+
+	<p>
+		<label for="blog_public_on"><?php _e('Privacy:', 'buddypress') ?></label>
+		<?php _e('I would like my blog to appear in search engines like Google and Technorati, and in public listings around this site.', 'buddypress'); ?>
+
+
+		<label class="checkbox" for="blog_public_on">
+			<input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if( !isset( $_POST['blog_public'] ) || '1' == $_POST['blog_public'] ) { ?>checked="checked"<?php } ?> />
+			<strong><?php _e( 'Yes' , 'buddypress'); ?></strong>
+		</label>
+		<label class="checkbox" for="blog_public_off">
+			<input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if( isset( $_POST['blog_public'] ) && '0' == $_POST['blog_public'] ) { ?>checked="checked"<?php } ?> />
+			<strong><?php _e( 'No' , 'buddypress'); ?></strong>
+		</label>
+	</p>
+
+	<?php
+	do_action('signup_blogform', $errors);
+}
+
+function bp_blogs_validate_blog_signup() {
+	global $wpdb, $current_user, $blogname, $blog_title, $errors, $domain, $path;
+
+	if ( !check_admin_referer( 'bp_blog_signup_form' ) )
+		return false;
+
+	$current_user = wp_get_current_user();
+
+	if( !is_user_logged_in() )
+		die();
+
+	$result = bp_blogs_validate_blog_form();
+	extract($result);
+
+	if ( $errors->get_error_code() ) {
+		unset($_POST['submit']);
+		bp_show_blog_signup_form( $blogname, $blog_title, $errors );
+		return false;
+	}
+
+	$public = (int) $_POST['blog_public'];
+
+	$meta = apply_filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) ); // depreciated
+	$meta = apply_filters( 'add_signup_meta', $meta );
+
+	/* If this is a VHOST install, remove the username from the domain as we are setting this blog
+	   up inside a user domain, not the root domain. */
+
+	wpmu_create_blog( $domain, $path, $blog_title, $current_user->id, $meta, $wpdb->siteid );
+	bp_blogs_confirm_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta);
+	return true;
+}
+
+function bp_blogs_validate_blog_form() {
+	$user = '';
+	if ( is_user_logged_in() )
+		$user = wp_get_current_user();
+
+	return wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user);
+}
+
+function bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = '' ) {
+	?>
+	<p><?php _e('Congratulations! You have successfully registered a new blog.', 'buddypress') ?></p>
+	<p>
+		<?php printf(__('<a href="http://%1$s">http://%2$s</a> is your new blog.  <a href="%3$s">Login</a> as "%4$s" using your existing password.', 'buddypress'), $domain.$path, $domain.$path, "http://" . $domain.$path . "wp-login.php", $user_name) ?>
+	</p>
+	<?php
+	do_action('signup_finished');
+}
+
+function bp_create_blog_link() {
+	global $bp;
+
+	if ( bp_is_my_profile() )	{
+		echo apply_filters( 'bp_create_blog_link', '<a href="' . $bp->root_domain . '/' . $bp->blogs->slug . '/create">' . __('Create a Blog', 'buddypress') . '</a>' );
+	}
+}
+
+function bp_blogs_blog_tabs() {
+	global $bp, $groups_template;
+
+	// Don't show these tabs on a user's own profile
+	if ( bp_is_my_profile() )
+		return false;
+
+	$current_tab = $bp->current_action
+?>
+	<ul class="content-header-nav">
+		<li<?php if ( 'my-blogs' == $current_tab || empty( $current_tab ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->blogs->slug ?>/my-blogs"><?php printf( __( "%s's Blogs", 'buddypress' ), $bp->displayed_user->fullname )  ?></a></li>
+		<li<?php if ( 'recent-posts' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->blogs->slug ?>/recent-posts"><?php printf( __( "%s's Recent Posts", 'buddypress' ), $bp->displayed_user->fullname )  ?></a></li>
+		<li<?php if ( 'recent-comments' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->blogs->slug ?>/recent-comments"><?php printf( __( "%s's Recent Comments", 'buddypress' ), $bp->displayed_user->fullname )  ?></a></li>
+	</ul>
+<?php
+	do_action( 'bp_blogs_blog_tabs', $current_tab );
+}
+
+function bp_directory_blogs_search_form() {
+	global $bp; ?>
+	<form action="" method="get" id="search-blogs-form">
+		<label><input type="text" name="s" id="blogs_search" value="<?php if ( isset( $_GET['s'] ) ) { echo $_GET['s']; } else { _e( 'Search anything...', 'buddypress' ); } ?>"  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="blogs_search_submit" name="blogs_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
+	</form>
+<?php
+}
+
+/**
+ * bp_blogs_visit_blog_button()
+ *
+ * Output button for visiting a blog in a loop
+ *
+ * @param array $args Custom button properties
+ */
+function bp_blogs_visit_blog_button( $args = '' ) {
+	echo bp_get_blogs_visit_blog_button( $args );
+}
+	/**
+	 * bp_get_blogs_visit_blog_button()
+	 *
+	 * Return button for visiting a blog in a loop
+	 *
+	 * @param array $args Custom button properties
+	 * @return string
+	 */
+	function bp_get_blogs_visit_blog_button( $args = '' ) {
+		$defaults = array(
+			'id'                => 'visit_blog',
+			'component'         => 'blogs',
+			'must_be_logged_in' => false,
+			'block_self'        => false,
+			'wrapper_class'     => 'blog-button visit',
+			'link_href'         => bp_get_blog_permalink(),
+			'link_class'        => 'visit',
+			'link_text'         => __( 'Visit Blog', 'buddypress' ),
+			'link_title'        => __( 'Visit Blog', 'buddypress' ),
+		);
+
+		$button = wp_parse_args( $args, $defaults );
+
+		// Filter and return the HTML button
+		return bp_get_button( apply_filters( 'bp_get_blogs_visit_blog_button', $button ) );
+	}
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-blogs/bp-blogs-widgets.php b/wp-content/plugins/buddypress/bp-blogs/bp-blogs-widgets.php
new file mode 100644
index 0000000000000000000000000000000000000000..8f4309407d8b3cf00529b027b858bde1d19469e3
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-blogs/bp-blogs-widgets.php
@@ -0,0 +1,84 @@
+<?php
+
+/***
+ * The recent blogs widget is actually just the activity feed filtered on "new_blog_post".
+ * Why not make some of your own widgets using a filtered activity stream?
+ */
+
+function bp_blogs_register_widgets() {
+	global $current_blog, $bp;
+
+	if ( bp_is_active( 'activity' ) && (int)$current_blog->blog_id == BP_ROOT_BLOG )
+		add_action('widgets_init', create_function('', 'return register_widget("BP_Blogs_Recent_Posts_Widget");') );
+}
+add_action( 'bp_register_widgets', 'bp_blogs_register_widgets' );
+
+class BP_Blogs_Recent_Posts_Widget extends WP_Widget {
+	function bp_blogs_recent_posts_widget() {
+		parent::WP_Widget( false, $name = __( 'Recent Site Wide Posts', 'buddypress' ) );
+	}
+
+	function widget($args, $instance) {
+		global $bp;
+
+		extract( $args );
+
+		echo $before_widget;
+		echo $before_title . $widget_name . $after_title;
+
+		if ( empty( $instance['max_posts'] ) || !$instance['max_posts'] )
+			$instance['max_posts'] = 10; ?>
+
+		<?php if ( bp_has_activities( 'action=new_blog_post&max=' . $instance['max_posts'] . '&per_page=' . $instance['max_posts'] ) ) : ?>
+
+			<ul id="blog-post-list" class="activity-list item-list">
+
+				<?php while ( bp_activities() ) : bp_the_activity(); ?>
+
+					<li>
+						<div class="activity-content" style="margin: 0">
+
+							<div class="activity-header">
+								<?php bp_activity_action() ?>
+							</div>
+
+							<?php if ( bp_get_activity_content_body() ) : ?>
+								<div class="activity-inner">
+									<?php bp_activity_content_body() ?>
+								</div>
+							<?php endif; ?>
+
+						</div>
+					</li>
+
+				<?php endwhile; ?>
+
+			</ul>
+
+		<?php else : ?>
+			<div id="message" class="info">
+				<p><?php _e( 'Sorry, there were no blog posts found. Why not write one?', 'buddypress' ) ?></p>
+			</div>
+		<?php endif; ?>
+
+		<?php echo $after_widget; ?>
+	<?php
+	}
+
+	function update( $new_instance, $old_instance ) {
+		$instance = $old_instance;
+		$instance['max_posts'] = strip_tags( $new_instance['max_posts'] );
+
+		return $instance;
+	}
+
+	function form( $instance ) {
+		$instance = wp_parse_args( (array) $instance, array( 'max_posts' => 10 ) );
+		$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 esc_attr( $max_posts ); ?>" style="width: 30%" /></label></p>
+	<?php
+	}
+}
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-core.php b/wp-content/plugins/buddypress/bp-core.php
new file mode 100644
index 0000000000000000000000000000000000000000..3a120ee52e30bd4513b5fcf50b03d46bd40fe35b
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-core.php
@@ -0,0 +1,2175 @@
+<?php
+
+/* Define the current version number for checking if DB tables are up to date. */
+define( 'BP_CORE_DB_VERSION', '1800' );
+
+/***
+ * Define the path and url of the BuddyPress plugins directory.
+ * It is important to use plugins_url() core function to obtain
+ * the correct scheme used (http or https).
+ */
+define( 'BP_PLUGIN_DIR', WP_PLUGIN_DIR . '/buddypress' );
+define( 'BP_PLUGIN_URL', plugins_url( $path = '/buddypress' ) );
+
+/* Load the WP abstraction file so BuddyPress can run on all WordPress setups. */
+require ( BP_PLUGIN_DIR . '/bp-core/bp-core-wpabstraction.php' );
+
+/* Place your custom code (actions/filters) in a file called /plugins/bp-custom.php and it will be loaded before anything else. */
+if ( file_exists( WP_PLUGIN_DIR . '/bp-custom.php' ) )
+	require( WP_PLUGIN_DIR . '/bp-custom.php' );
+
+/* Define on which blog ID BuddyPress should run */
+if ( !defined( 'BP_ROOT_BLOG' ) )
+	define( 'BP_ROOT_BLOG', 1 );
+
+/* Define the user and usermeta table names, useful if you are using custom or shared tables. */
+if ( !defined( 'CUSTOM_USER_TABLE' ) )
+	define( 'CUSTOM_USER_TABLE', $wpdb->base_prefix . 'users' );
+
+if ( !defined( 'CUSTOM_USER_META_TABLE' ) )
+	define( 'CUSTOM_USER_META_TABLE', $wpdb->base_prefix . 'usermeta' );
+
+/* Load the files containing functions that we globally will need. */
+require ( BP_PLUGIN_DIR . '/bp-core/bp-core-catchuri.php' );
+require ( BP_PLUGIN_DIR . '/bp-core/bp-core-classes.php' );
+require ( BP_PLUGIN_DIR . '/bp-core/bp-core-filters.php' );
+require ( BP_PLUGIN_DIR . '/bp-core/bp-core-cssjs.php' );
+require ( BP_PLUGIN_DIR . '/bp-core/bp-core-avatars.php' );
+require ( BP_PLUGIN_DIR . '/bp-core/bp-core-templatetags.php' );
+require ( BP_PLUGIN_DIR . '/bp-core/bp-core-settings.php' );
+require ( BP_PLUGIN_DIR . '/bp-core/bp-core-widgets.php' );
+require ( BP_PLUGIN_DIR . '/bp-core/bp-core-notifications.php' );
+require ( BP_PLUGIN_DIR . '/bp-core/bp-core-signup.php' );
+
+/* If BP_DISABLE_ADMIN_BAR is defined, do not load the global admin bar. */
+if ( !defined( 'BP_DISABLE_ADMIN_BAR' ) )
+	require ( BP_PLUGIN_DIR . '/bp-core/bp-core-adminbar.php' );
+
+/* Define the slug for member pages and the members directory (e.g. domain.com/[members] ) */
+if ( !defined( 'BP_MEMBERS_SLUG' ) )
+	define( 'BP_MEMBERS_SLUG', 'members' );
+
+/* Define the slug for the register/signup page */
+if ( !defined( 'BP_REGISTER_SLUG' ) )
+	define( 'BP_REGISTER_SLUG', 'register' );
+
+/* Define the slug for the activation page */
+if ( !defined( 'BP_ACTIVATION_SLUG' ) )
+	define( 'BP_ACTIVATION_SLUG', 'activate' );
+
+/* Define the slug for the search page */
+if ( !defined( 'BP_SEARCH_SLUG' ) )
+	define( 'BP_SEARCH_SLUG', 'search' );
+
+/* Register BuddyPress themes contained within the bp-theme folder */
+if ( function_exists( 'register_theme_directory') )
+	register_theme_directory( WP_PLUGIN_DIR . '/buddypress/bp-themes' );
+
+
+/* "And now for something completely different" .... */
+
+
+/**
+ * bp_core_setup_globals()
+ *
+ * Sets up default global BuddyPress configuration settings and stores
+ * them in a $bp variable.
+ *
+ * @package BuddyPress Core Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @global $current_user A WordPress global containing current user information
+ * @global $current_component Which is set up in /bp-core/bp-core-catch-uri.php
+ * @global $current_action Which is set up in /bp-core/bp-core-catch-uri.php
+ * @global $action_variables Which is set up in /bp-core/bp-core-catch-uri.php
+ * @uses bp_core_get_user_domain() Returns the domain for a user
+ */
+function bp_core_setup_globals() {
+	global $bp;
+	global $current_user, $current_component, $current_action, $current_blog;
+	global $displayed_user_id;
+	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();
+
+	/* The user ID of the user who is currently logged in. */
+	$bp->loggedin_user->id = $current_user->ID;
+
+	/* The domain for the user currently logged in. eg: http://domain.com/members/andy */
+	$bp->loggedin_user->domain = bp_core_get_user_domain( $bp->loggedin_user->id );
+
+	/* 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_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_site_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;
+
+	/* The domain for the user currently being displayed */
+	$bp->displayed_user->domain = bp_core_get_user_domain( $bp->displayed_user->id );
+
+	/* The core userdata of the user who is currently being displayed */
+	$bp->displayed_user->userdata = bp_core_get_core_userdata( $bp->displayed_user->id );
+
+	/* The component being used eg: http://domain.com/members/andy/ [profile] */
+	$bp->current_component = $current_component; // type: string
+
+	/* The current action for the component eg: http://domain.com/members/andy/profile/ [edit] */
+	$bp->current_action = $current_action; // type: string
+
+	/* The action variables for the current action eg: http://domain.com/members/andy/profile/edit/ [group] / [6] */
+	$bp->action_variables = $action_variables; // type: array
+
+	/* Only used where a component has a sub item, e.g. groups: http://domain.com/members/andy/groups/ [my-group] / home - manipulated in the actual component not in catch uri code.*/
+	$bp->current_item = ''; // type: string
+
+	/* Used for overriding the 2nd level navigation menu so it can be used to display custom navigation for an item (for example a group) */
+	$bp->is_single_item = false;
+
+	/* The default component to use if none are set and someone visits: http://domain.com/members/andy */
+	if ( !defined( 'BP_DEFAULT_COMPONENT' ) ) {
+		if ( defined( 'BP_ACTIVITY_SLUG' ) )
+			$bp->default_component = BP_ACTIVITY_SLUG;
+		else
+			$bp->default_component = 'profile';
+	} else {
+		$bp->default_component = BP_DEFAULT_COMPONENT;
+	}
+
+	/* Fetches all of the core database based BuddyPress settings in one foul swoop */
+	$bp->site_options = bp_core_get_site_options();
+
+	/* Sets up the array container for the component navigation rendered by bp_get_nav() */
+	$bp->bp_nav = array();
+
+	/* Sets up the array container for the component options navigation rendered by bp_get_options_nav() */
+	$bp->bp_options_nav = array();
+
+	/* Contains an array of all the active components. The key is the slug, value the internal ID of the component */
+	$bp->active_components = 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->group = apply_filters( 'bp_group_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->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
+	   their own profile and wants to delete something, is_item_admin is used. This is a
+	   generic variable so it can be used by other components. It can also be modified, so when viewing a group
+	   'is_item_admin' would be 1 if they are a group admin, 0 if they are not. */
+	$bp->is_item_admin = bp_user_has_access();
+
+	/* 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 = $bp->table_prefix . 'bp_notifications';
+
+	if ( !$bp->current_component && $bp->displayed_user->id )
+		$bp->current_component = $bp->default_component;
+
+	do_action( 'bp_core_setup_globals' );
+}
+add_action( 'bp_setup_globals', 'bp_core_setup_globals' );
+
+/**
+ * bp_core_setup_root_uris()
+ *
+ * Adds the core URIs that should run in the root of the installation.
+ *
+ * For example: http://example.org/search/ or http://example.org/members/
+ *
+ * @package BuddyPress Core
+ * @uses bp_core_add_root_component() Adds a slug to the root components global variable.
+ */
+function bp_core_setup_root_uris() {
+	// Add core root components
+	bp_core_add_root_component( BP_MEMBERS_SLUG );
+	bp_core_add_root_component( BP_REGISTER_SLUG );
+	bp_core_add_root_component( BP_ACTIVATION_SLUG );
+	bp_core_add_root_component( BP_SEARCH_SLUG );
+}
+add_action( 'bp_setup_root_components', 'bp_core_setup_root_uris' );
+
+/**
+ * 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_install()
+ *
+ * Installs the core DB tables for BuddyPress.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @global $wpdb WordPress DB access object.
+ * @uses dbDelta() Performs a table creation, or upgrade based on what already exists in the DB.
+ * @uses bp_core_add_illegal_names() Adds illegal blog names to the WP settings
+ */
+function bp_core_install() {
+	global $wpdb, $bp;
+
+	if ( !empty($wpdb->charset) )
+		$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
+
+	$sql[] = "CREATE TABLE {$bp->core->table_name_notifications} (
+		  		id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+				user_id bigint(20) NOT NULL,
+				item_id bigint(20) NOT NULL,
+				secondary_item_id bigint(20),
+		  		component_name varchar(75) NOT NULL,
+				component_action varchar(75) NOT NULL,
+		  		date_notified datetime NOT NULL,
+				is_new bool NOT NULL DEFAULT 0,
+			    KEY item_id (item_id),
+				KEY secondary_item_id (secondary_item_id),
+				KEY user_id (user_id),
+				KEY is_new (is_new),
+				KEY component_name (component_name),
+		 	   	KEY component_action (component_action),
+				KEY useritem (user_id,is_new)
+			   ) {$charset_collate};";
+
+	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
+	dbDelta( $sql );
+
+	/* Add names of root components to the banned blog list to avoid conflicts */
+	if ( bp_core_is_multisite() )
+		bp_core_add_illegal_names();
+
+	update_site_option( 'bp-core-db-version', BP_CORE_DB_VERSION );
+}
+
+/**
+ * bp_core_check_installed()
+ *
+ * Checks to make sure the database tables are set up for the core component.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @global $current_user WordPress global variable containing current logged in user information
+ * @uses is_super_admin() returns true if the current user is a site admin, false if not
+ * @uses get_site_option() fetches the value for a meta_key in the wp_sitemeta table
+ * @uses bp_core_install() runs the installation of DB tables for the core component
+ */
+function bp_core_check_installed() {
+	global $bp;
+
+	if ( !is_super_admin() )
+		return false;
+
+	require ( BP_PLUGIN_DIR . '/bp-core/bp-core-admin.php' );
+
+	/* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
+	if ( get_site_option( 'bp-core-db-version' ) < BP_CORE_DB_VERSION )
+		bp_core_install();
+}
+add_action( 'admin_menu', 'bp_core_check_installed' );
+
+/**
+ * bp_core_add_admin_menu()
+ *
+ * Adds the "BuddyPress" admin submenu item to the Site Admin tab.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @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_super_admin() )
+		return false;
+
+	/* Add the administration tab under the "Site Admin" tab for site administrators */
+	bp_core_add_admin_menu_page( array(
+		'menu_title' => __( 'BuddyPress', 'buddypress' ),
+		'page_title' => __( 'BuddyPress', 'buddypress' ),
+		'access_level' => 10, 'file' => 'bp-general-settings',
+		'function' => 'bp_core_admin_settings',
+		'position' => 2
+	) );
+
+	add_submenu_page( 'bp-general-settings', __( 'General Settings', 'buddypress'), __( 'General Settings', 'buddypress' ), 'manage_options', 'bp-general-settings', 'bp_core_admin_settings' );
+	add_submenu_page( 'bp-general-settings', __( 'Component Setup', 'buddypress'), __( 'Component Setup', 'buddypress' ), 'manage_options', 'bp-component-setup', 'bp_core_admin_component_setup' );
+}
+add_action( 'admin_menu', 'bp_core_add_admin_menu' );
+
+/**
+ * bp_core_is_root_component()
+ *
+ * Checks to see if a component's URL should be in the root, not under a member page:
+ * eg: http://domain.com/groups/the-group NOT http://domain.com/members/andy/groups/the-group
+ *
+ * @package BuddyPress Core
+ * @return true if root component, else false.
+ */
+function bp_core_is_root_component( $component_name ) {
+	global $bp;
+
+	return in_array( $component_name, $bp->root_components );
+}
+
+/**
+ * bp_core_setup_nav()
+ *
+ * Sets up the profile navigation item if the Xprofile component is not installed.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @uses bp_core_new_nav_item() Adds a navigation item to the top level buddypress navigation
+ * @uses bp_core_new_subnav_item() Adds a sub navigation item to a nav item
+ * @uses bp_is_my_profile() Returns true if the current user being viewed is equal the logged in user
+ * @uses bp_core_fetch_avatar() Returns the either the thumb or full avatar URL for the user_id passed
+ */
+function bp_core_setup_nav() {
+	global $bp;
+
+	/***
+	 * If the extended profiles component is disabled, we need to revert to using the
+	 * built in WordPress profile information
+	 */
+	if ( !function_exists( 'xprofile_install' ) ) {
+		/* Fallback values if xprofile is disabled */
+		$bp->core->profile->slug = 'profile';
+		$bp->active_components[$bp->core->profile->slug] = $bp->core->profile->slug;
+
+		/* Add 'Profile' to the main navigation */
+		bp_core_new_nav_item( array(
+			'name' => __('Profile', 'buddypress'),
+			'slug' => $bp->core->profile->slug,
+			'position' => 20,
+			'screen_function' => 'bp_core_catch_profile_uri',
+			'default_subnav_slug' => 'public'
+		) );
+
+		$profile_link = $bp->loggedin_user->domain . '/profile/';
+
+		/* Add the subnav items to the profile */
+		bp_core_new_subnav_item( array(
+			'name' => __( 'Public', 'buddypress' ),
+			'slug' => 'public',
+			'parent_url' => $profile_link,
+			'parent_slug' => $bp->core->profile->slug,
+			'screen_function' => 'bp_core_catch_profile_uri'
+		) );
+
+
+		if ( 'profile' == $bp->current_component ) {
+			if ( bp_is_my_profile() ) {
+				$bp->bp_options_title = __('My Profile', 'buddypress');
+			} else {
+				$bp->bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => 'thumb' ) );
+				$bp->bp_options_title = $bp->displayed_user->fullname;
+			}
+		}
+	}
+}
+add_action( 'bp_setup_nav', 'bp_core_setup_nav' );
+
+/********************************************************************************
+ * Action Functions
+ *
+ * Action functions are exactly the same as screen functions, however they do not
+ * have a template screen associated with them. Usually they will send the user
+ * back to the default screen after execution.
+ */
+
+/**
+ * bp_core_action_directory_members()
+ *
+ * Listens to the $bp component and action variables to determine if the user is viewing the members
+ * directory page. If they are, it will set up the directory and load the members directory template.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @uses wp_enqueue_script() Loads a JS script into the header of the page.
+ * @uses bp_core_load_template() Loads a specific template file.
+ */
+function bp_core_action_directory_members() {
+	global $bp;
+
+	if ( is_null( $bp->displayed_user->id ) && $bp->current_component == BP_MEMBERS_SLUG ) {
+		$bp->is_directory = true;
+
+		do_action( 'bp_core_action_directory_members' );
+		bp_core_load_template( apply_filters( 'bp_core_template_directory_members', 'members/index' ) );
+	}
+}
+add_action( 'wp', 'bp_core_action_directory_members', 2 );
+
+/**
+ * bp_core_action_set_spammer_status()
+ *
+ * When a site admin selects "Mark as Spammer/Not Spammer" from the admin menu
+ * this action will fire and mark or unmark the user and their blogs as spam.
+ * Must be a site admin for this function to run.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ */
+function bp_core_action_set_spammer_status() {
+	global $bp, $wpdb, $wp_version;
+
+	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 ) ) {
+		/* Check the nonce */
+		check_admin_referer( 'mark-unmark-spammer' );
+
+		/* Get the functions file */
+		if ( bp_core_is_multisite() ) {
+			if ( $wp_version >= '3.0' )
+				require_once( ABSPATH . '/wp-admin/includes/ms.php' );
+			else
+				require_once( ABSPATH . '/wp-admin/includes/mu.php' );
+		}
+
+		if ( 'mark-spammer' == $bp->current_action )
+			$is_spam = 1;
+		else
+			$is_spam = 0;
+
+		/* Get the blogs for the user */
+		$blogs = get_blogs_of_user( $bp->displayed_user->id, true );
+
+		foreach ( (array) $blogs as $key => $details ) {
+			/* Do not mark the main or current root blog as spam */
+			if ( 1 == $details->userblog_id || BP_ROOT_BLOG == $details->userblog_id )
+				continue;
+
+			/* Update the blog status */
+			update_blog_status( $details->userblog_id, 'spam', $is_spam );
+
+			/* Fire the standard WPMU hook */
+			do_action( 'make_spam_blog', $details->userblog_id );
+		}
+
+		/* Finally, mark this user as a spammer */
+		if ( bp_core_is_multisite() )
+			$wpdb->update( $wpdb->users, array( 'spam' => $is_spam ), array( 'ID' => $bp->displayed_user->id ) );
+
+		$wpdb->update( $wpdb->users, array( 'user_status' => $is_spam ), array( 'ID' => $bp->displayed_user->id ) );
+
+		if ( $is_spam )
+			bp_core_add_message( __( 'User marked as spammer. Spam users are visible only to site admins.', 'buddypress' ) );
+		else
+			bp_core_add_message( __( 'User removed as spammer.', 'buddypress' ) );
+
+		/* Hide this user's activity */
+		if ( $is_spam && function_exists( 'bp_activity_hide_user_activity' ) )
+			bp_activity_hide_user_activity( $bp->displayed_user->id );
+
+		do_action( 'bp_core_action_set_spammer_status', $bp->displayed_user->id, $is_spam );
+
+		bp_core_redirect( wp_get_referer() );
+	}
+}
+add_action( 'wp', 'bp_core_action_set_spammer_status', 3 );
+
+/**
+ * bp_core_action_delete_user()
+ *
+ * Allows a site admin to delete a user from the adminbar menu.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ */
+function bp_core_action_delete_user() {
+	global $bp;
+
+	if ( !is_super_admin() || bp_is_my_profile() || !$bp->displayed_user->id )
+		return false;
+
+	if ( 'admin' == $bp->current_component && 'delete-user' == $bp->current_action ) {
+		/* Check the nonce */
+		check_admin_referer( 'delete-user' );
+
+		$errors = false;
+
+		if ( bp_core_delete_account( $bp->displayed_user->id ) ) {
+			bp_core_add_message( sprintf( __( '%s has been deleted from the system.', 'buddypress' ), $bp->displayed_user->fullname ) );
+		} else {
+			bp_core_add_message( sprintf( __( 'There was an error deleting %s from the system. Please try again.', 'buddypress' ), $bp->displayed_user->fullname ), 'error' );
+			$errors = true;
+		}
+
+		do_action( 'bp_core_action_delete_user', $errors );
+
+		if ( $errors )
+			bp_core_redirect( $bp->displayed_user->domain );
+		else
+			bp_core_redirect( $bp->loggedin_user->domain );
+	}
+}
+add_action( 'wp', 'bp_core_action_delete_user', 3 );
+
+
+/********************************************************************************
+ * Business Functions
+ *
+ * Business functions are where all the magic happens in BuddyPress. They will
+ * handle the actual saving or manipulation of information. Usually they will
+ * hand off to a database class for data access, then return
+ * true or false on success or failure.
+ */
+
+/**
+ * bp_core_get_users()
+ *
+ * Return an array of users IDs based on the parameters passed.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_get_users( $args = '' ) {
+	global $bp;
+
+	$defaults = array(
+		'type' => 'active', // active, newest, alphabetical, random or popular
+		'user_id' => false, // Pass a user_id to limit to only friend connections for this user
+		'search_terms' => false, // Limit to users that match these search terms
+
+		'include' => false, // Pass comma separated list of user_ids to limit to only these users
+		'per_page' => 20, // The number of results to return per page
+		'page' => 1, // The page to return if limiting per page
+		'populate_extras' => true, // Fetch the last active, where the user is a friend, total friend count, latest update
+	);
+
+	$params = wp_parse_args( $args, $defaults );
+	extract( $params, EXTR_SKIP );
+
+	return apply_filters( 'bp_core_get_users', BP_Core_User::get_users( $type, $per_page, $page, $user_id, $include, $search_terms, $populate_extras ), &$params );
+}
+
+/**
+ * bp_core_get_user_domain()
+ *
+ * Returns the domain for the passed user:
+ * e.g. http://domain.com/members/andy/
+ *
+ * @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_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;
+
+	if ( !$user_id ) return;
+
+	if ( !$domain = wp_cache_get( 'bp_user_domain_' . $user_id, 'bp' ) ) {
+		$username = bp_core_get_username( $user_id, $user_nicename, $user_login );
+
+		/* If we are using a members slug, include it. */
+		if ( !defined( 'BP_ENABLE_ROOT_PROFILES' ) )
+			$domain = $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/' . $username . '/';
+		else
+			$domain = $bp->root_domain . '/' . $username . '/';
+
+		/* Cache the link */
+		if ( !empty( $domain ) )
+			wp_cache_set( 'bp_user_domain_' . $user_id, $domain, 'bp' );
+	}
+
+	return apply_filters( 'bp_core_get_user_domain', $domain );
+}
+
+/**
+ * bp_core_get_core_userdata()
+ *
+ * Fetch everything in the wp_users table for a user, without any usermeta.
+ *
+ * @package BuddyPress Core
+ * @param user_id The ID of the user.
+ * @uses BP_Core_User::get_core_userdata() Performs the query.
+ */
+function bp_core_get_core_userdata( $user_id ) {
+	if ( empty( $user_id ) )
+		return false;
+
+	if ( !$userdata = wp_cache_get( 'bp_core_userdata_' . $user_id, 'bp' ) ) {
+		$userdata = BP_Core_User::get_core_userdata( $user_id );
+		wp_cache_set( 'bp_core_userdata_' . $user_id, $userdata, 'bp' );
+	}
+	return apply_filters( 'bp_core_get_core_userdata', $userdata );
+}
+
+/**
+ * bp_core_get_root_domain()
+ *
+ * Returns the domain for the root blog.
+ * eg: http://domain.com/ OR https://domain.com
+ *
+ * @package BuddyPress Core
+ * @uses get_blog_option() WordPress function to fetch blog meta.
+ * @return $domain The domain URL for the blog.
+ */
+function bp_core_get_root_domain() {
+	global $current_blog;
+
+	if ( defined( 'BP_ENABLE_MULTIBLOG' ) )
+		$domain = get_blog_option( $current_blog->blog_id, 'home' );
+	else
+		$domain = get_blog_option( BP_ROOT_BLOG, 'home' );
+
+	return apply_filters( 'bp_core_get_root_domain', $domain );
+}
+
+/**
+ * bp_core_get_displayed_userid()
+ *
+ * Returns the user id for the user that is currently being displayed.
+ * eg: http://andy.domain.com/ or http://domain.com/andy/
+ *
+ * @package BuddyPress Core
+ * @global $current_blog WordPress global containing information and settings for the current blog being viewed.
+ * @uses bp_core_get_userid_from_user_login() Returns the user id for the username passed
+ * @return The user id for the user that is currently being displayed, return zero if this is not a user home and just a normal blog.
+ */
+function bp_core_get_displayed_userid( $user_login ) {
+	return apply_filters( 'bp_core_get_displayed_userid', bp_core_get_userid( $user_login ) );
+}
+
+/**
+ * bp_core_new_nav_item()
+ *
+ * Adds a navigation item to the main navigation array used in BuddyPress themes.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ */
+function bp_core_new_nav_item( $args = '' ) {
+	global $bp;
+
+	$defaults = array(
+		'name' => false, // Display name for the nav item
+		'slug' => false, // URL slug for the nav item
+		'item_css_id' => false, // The CSS ID to apply to the HTML of the nav item
+		'show_for_displayed_user' => true, // When viewing another user does this nav item show up?
+		'site_admin_only' => false, // Can only site admins see this nav item?
+		'position' => 99, // Index of where this nav item should be positioned
+		'screen_function' => false, // The name of the function to run when clicked
+		'default_subnav_slug' => false // The slug of the default subnav item to select when clicked
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	/* If we don't have the required info we need, don't create this subnav item */
+	if ( empty($name) || empty($slug) )
+		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_super_admin() )
+		return false;
+
+	if ( empty( $item_css_id ) )
+		$item_css_id = $slug;
+
+	$bp->bp_nav[$slug] = array(
+		'name' => $name,
+		'slug' => $slug,
+		'link' => $bp->loggedin_user->domain . $slug . '/',
+		'css_id' => $item_css_id,
+		'show_for_displayed_user' => $show_for_displayed_user,
+		'position' => $position
+	);
+
+ 	/***
+	 * If this nav item is hidden for the displayed user, and
+	 * the logged in user is not the displayed user
+	 * looking at their own profile, don't create the nav item.
+	 */
+	if ( !$show_for_displayed_user && !bp_user_has_access() )
+		return false;
+
+	/***
+ 	 * If we are not viewing a user, and this is a root component, don't attach the
+ 	 * default subnav function so we can display a directory or something else.
+ 	 */
+	if ( bp_core_is_root_component( $slug ) && !$bp->displayed_user->id )
+		return;
+
+	if ( $bp->current_component == $slug && !$bp->current_action ) {
+		if ( !is_object( $screen_function[0] ) )
+			add_action( 'wp', $screen_function, 3 );
+		else
+			add_action( 'wp', array( &$screen_function[0], $screen_function[1] ), 3 );
+
+		if ( $default_subnav_slug )
+			$bp->current_action = $default_subnav_slug;
+	}
+}
+
+/**
+ * bp_core_new_nav_default()
+ *
+ * Modify the default subnav item to load when a top level nav item is clicked.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ */
+function bp_core_new_nav_default( $args = '' ) {
+	global $bp;
+
+	$defaults = array(
+		'parent_slug' => false, // Slug of the parent
+		'screen_function' => false, // The name of the function to run when clicked
+		'subnav_slug' => false // The slug of the subnav item to select when clicked
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	if ( $bp->current_component == $parent_slug && !$bp->current_action ) {
+		if ( !is_object( $screen_function[0] ) )
+			add_action( 'wp', $screen_function, 3 );
+		else
+			add_action( 'wp', array( &$screen_function[0], $screen_function[1] ), 3 );
+
+		if ( $subnav_slug )
+			$bp->current_action = $subnav_slug;
+	}
+}
+
+/**
+ * bp_core_sort_nav_items()
+ *
+ * We can only sort nav items by their position integer at a later point in time, once all
+ * plugins have registered their navigation items.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ */
+function bp_core_sort_nav_items() {
+	global $bp;
+
+	if ( empty( $bp->bp_nav ) || !is_array( $bp->bp_nav ) )
+		return false;
+
+	foreach ( (array)$bp->bp_nav as $slug => $nav_item ) {
+		if ( empty( $temp[$nav_item['position']]) )
+			$temp[$nav_item['position']] = $nav_item;
+		else {
+			// increase numbers here to fit new items in.
+			do {
+				$nav_item['position']++;
+			} while ( !empty( $temp[$nav_item['position']] ) );
+
+			$temp[$nav_item['position']] = $nav_item;
+		}
+	}
+
+	ksort( $temp );
+	$bp->bp_nav = &$temp;
+}
+add_action( 'wp_head', 'bp_core_sort_nav_items' );
+add_action( 'admin_head', 'bp_core_sort_nav_items' );
+
+/**
+ * bp_core_new_subnav_item()
+ *
+ * Adds a navigation item to the sub navigation array used in BuddyPress themes.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ */
+function bp_core_new_subnav_item( $args = '' ) {
+	global $bp;
+
+	$defaults = array(
+		'name' => false, // Display name for the nav item
+		'slug' => false, // URL slug for the nav item
+		'parent_slug' => false, // URL slug of the parent nav item
+		'parent_url' => false, // URL of the parent item
+		'item_css_id' => false, // The CSS ID to apply to the HTML of the nav item
+		'user_has_access' => true, // Can the logged in user see this nav item?
+		'site_admin_only' => false, // Can only site admins see this nav item?
+		'position' => 90, // Index of where this nav item should be positioned
+		'screen_function' => false // The name of the function to run when clicked
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	/* If we don't have the required info we need, don't create this subnav item */
+	if ( empty($name) || empty($slug) || empty($parent_slug) || empty($parent_url) || empty($screen_function) )
+		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_super_admin() )
+		return false;
+
+	if ( empty( $item_css_id ) )
+		$item_css_id = $slug;
+
+	$bp->bp_options_nav[$parent_slug][$slug] = array(
+		'name' => $name,
+		'link' => $parent_url . $slug . '/',
+		'slug' => $slug,
+		'css_id' => $item_css_id,
+		'position' => $position,
+		'user_has_access' => $user_has_access,
+		'screen_function' => $screen_function
+	);
+
+	if ( ( $bp->current_action == $slug && $bp->current_component == $parent_slug ) && $user_has_access ) {
+		if ( !is_object( $screen_function[0] ) )
+			add_action( 'wp', $screen_function, 3 );
+		else
+			add_action( 'wp', array( &$screen_function[0], $screen_function[1] ), 3 );
+	}
+}
+
+function bp_core_sort_subnav_items() {
+	global $bp;
+
+	if ( empty( $bp->bp_options_nav ) || !is_array( $bp->bp_options_nav ) )
+		return false;
+
+	foreach ( (array)$bp->bp_options_nav as $parent_slug => $subnav_items ) {
+		if ( !is_array( $subnav_items ) )
+			continue;
+
+		foreach ( (array)$subnav_items as $subnav_item ) {
+			if ( empty( $temp[$subnav_item['position']]) )
+				$temp[$subnav_item['position']] = $subnav_item;
+			else {
+				// increase numbers here to fit new items in.
+				do {
+					$subnav_item['position']++;
+				} while ( !empty( $temp[$subnav_item['position']] ) );
+
+				$temp[$subnav_item['position']] = $subnav_item;
+			}
+		}
+		ksort( $temp );
+		$bp->bp_options_nav[$parent_slug] = &$temp;
+		unset($temp);
+	}
+}
+add_action( 'wp_head', 'bp_core_sort_subnav_items' );
+add_action( 'admin_head', 'bp_core_sort_subnav_items' );
+
+/**
+ * bp_core_remove_nav_item()
+ *
+ * Removes a navigation item from the sub navigation array used in BuddyPress themes.
+ *
+ * @package BuddyPress Core
+ * @param $parent_id The id of the parent navigation item.
+ * @param $slug The slug of the sub navigation item.
+ */
+function bp_core_remove_nav_item( $parent_id ) {
+	global $bp;
+
+	/* Unset subnav items for this nav item */
+	if ( is_array( $bp->bp_options_nav[$parent_id] ) ) {
+		foreach( (array)$bp->bp_options_nav[$parent_id] as $subnav_item ) {
+			bp_core_remove_subnav_item( $parent_id, $subnav_item['slug'] );
+		}
+	}
+
+	unset( $bp->bp_nav[$parent_id] );
+}
+
+/**
+ * bp_core_remove_subnav_item()
+ *
+ * Removes a navigation item from the sub navigation array used in BuddyPress themes.
+ *
+ * @package BuddyPress Core
+ * @param $parent_id The id of the parent navigation item.
+ * @param $slug The slug of the sub navigation item.
+ */
+function bp_core_remove_subnav_item( $parent_id, $slug ) {
+	global $bp;
+
+	$screen_function = $bp->bp_options_nav[$parent_id][$slug]['screen_function'];
+
+	if ( $screen_function ) {
+		if ( !is_object( $screen_function[0] ) )
+			remove_action( 'wp', $screen_function, 3 );
+		else
+			remove_action( 'wp', array( &$screen_function[0], $screen_function[1] ), 3 );
+	}
+
+	unset( $bp->bp_options_nav[$parent_id][$slug] );
+
+	if ( !count( $bp->bp_options_nav[$parent_id] ) )
+		unset($bp->bp_options_nav[$parent_id]);
+}
+
+/**
+ * bp_core_reset_subnav_items()
+ *
+ * Clear the subnav items for a specific nav item.
+ *
+ * @package BuddyPress Core
+ * @param $parent_id The id of the parent navigation item.
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ */
+function bp_core_reset_subnav_items($parent_slug) {
+	global $bp;
+
+	unset($bp->bp_options_nav[$parent_slug]);
+}
+
+/**
+ * bp_core_load_template()
+ *
+ * Uses the bp_catch_uri function to load a specific template file with fallback support.
+ *
+ * Example:
+ *   bp_core_load_template( 'profile/edit-profile' );
+ * Loads:
+ *   wp-content/themes/[activated_theme]/profile/edit-profile.php
+ *
+ * @package BuddyPress Core
+ * @param $username str Username to check.
+ * @return false on no match
+ * @return int the user ID of the matched user.
+ */
+function bp_core_load_template( $template, $skip_blog_check = false ) {
+	return bp_catch_uri( $template, $skip_blog_check );
+}
+
+/**
+ * bp_core_add_root_component()
+ *
+ * Adds a component to the $bp->root_components global.
+ * Any component that runs in the "root" of an install should be added.
+ * The "root" as in, it can or always runs outside of the /members/username/ path.
+ *
+ * Example of a root component:
+ *  Groups: http://domain.com/groups/group-name
+ *          http://community.domain.com/groups/group-name
+ *          http://domain.com/wpmu/groups/group-name
+ *
+ * Example of a component that is NOT a root component:
+ *  Friends: http://domain.com/members/andy/friends
+ *           http://community.domain.com/members/andy/friends
+ *           http://domain.com/wpmu/members/andy/friends
+ *
+ * @package BuddyPress Core
+ * @param $slug str The slug of the component
+ * @global $bp BuddyPress global settings
+ */
+function bp_core_add_root_component( $slug ) {
+	global $bp;
+
+	$bp->root_components[] = $slug;
+}
+
+/**
+ * bp_core_get_random_member()
+ *
+ * Returns the user_id for a user based on their username.
+ *
+ * @package BuddyPress Core
+ * @param $username str Username to check.
+ * @return false on no match
+ * @return int the user ID of the matched user.
+ */
+function bp_core_get_random_member() {
+	global $bp;
+
+	if ( isset( $_GET['random-member'] ) ) {
+		$user = bp_core_get_users( array( 'type' => 'random', 'per_page' => 1 ) );
+		bp_core_redirect( bp_core_get_user_domain( $user['users'][0]->id ) );
+	}
+}
+add_action( 'wp', 'bp_core_get_random_member' );
+
+/**
+ * bp_core_get_userid()
+ *
+ * Returns the user_id for a user based on their username.
+ *
+ * @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_userid( $username ) {
+	global $wpdb;
+
+	if ( empty( $username ) )
+		return false;
+
+	return apply_filters( 'bp_core_get_userid', $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_login = %s", $username ) ) );
+}
+
+/**
+ * bp_core_get_userid_from_nicename()
+ *
+ * Returns the user_id for a user based on their user_nicename.
+ *
+ * @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_userid_from_nicename( $user_nicename ) {
+	global $wpdb;
+
+	if ( empty( $user_nicename ) )
+		return false;
+
+	return apply_filters( 'bp_core_get_userid_from_nicename', $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_nicename = %s", $user_nicename ) ) );
+}
+
+/**
+ * bp_core_get_username()
+ *
+ * Returns the username for a user based on their user id.
+ *
+ * @package BuddyPress Core
+ * @param $uid int User ID to check.
+ * @global $userdata WordPress user data for the current logged in user.
+ * @uses get_userdata() WordPress function to fetch the userdata for a user ID
+ * @return false on no match
+ * @return str the username of the matched user.
+ */
+function bp_core_get_username( $user_id, $user_nicename = false, $user_login = false ) {
+	global $bp;
+
+	if ( !$username = wp_cache_get( 'bp_user_username_' . $user_id, 'bp' ) ) {
+		if ( empty( $user_nicename ) && empty( $user_login ) ) {
+			$ud = false;
+
+			if ( $bp->loggedin_user->id == $user_id )
+				$ud = &$bp->loggedin_user->userdata;
+
+			if ( $bp->displayed_user->id == $user_id )
+				$ud = &$bp->displayed_user->userdata;
+
+			if ( empty( $ud ) ) {
+				if ( !$ud = bp_core_get_core_userdata( $user_id ) )
+					return false;
+			}
+
+			$user_nicename = $ud->user_nicename;
+			$user_login = $ud->user_login;
+		}
+
+		if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
+			$username = $user_login;
+		else
+			$username = $user_nicename;
+	}
+
+	/* Add this to cache */
+	if ( !empty( $username ) )
+		wp_cache_set( 'bp_user_username_' . $user_id, $username, 'bp' );
+
+	return apply_filters( 'bp_core_get_username', $username );
+}
+
+/**
+ * bp_core_get_user_email()
+ *
+ * Returns the email address for the user based on user ID
+ *
+ * @package BuddyPress Core
+ * @param $uid int User ID to check.
+ * @uses get_userdata() WordPress function to fetch the userdata for a user ID
+ * @return false on no match
+ * @return str The email for the matched user.
+ */
+function bp_core_get_user_email( $uid ) {
+	if ( !$email = wp_cache_get( 'bp_user_email_' . $uid, 'bp' ) ) {
+		$ud = bp_core_get_core_userdata($uid);
+		$email = $ud->user_email;
+		wp_cache_set( 'bp_user_email_' . $uid, $email, 'bp' );
+	}
+
+	return apply_filters( 'bp_core_get_user_email', $email );
+}
+
+/**
+ * bp_core_get_userlink()
+ *
+ * Returns a HTML formatted link for a user with the user's full name as the link text.
+ * eg: <a href="http://andy.domain.com/">Andy Peatling</a>
+ * Optional parameters will return just the name, or just the URL, or disable "You" text when
+ * user matches the logged in user.
+ *
+ * [NOTES: This function needs to be cleaned up or split into separate functions]
+ *
+ * @package BuddyPress Core
+ * @param $uid int User ID to check.
+ * @param $no_anchor bool Disable URL and HTML and just return full name. Default false.
+ * @param $just_link bool Disable full name and HTML and just return the URL text. Default false.
+ * @param $no_you bool Disable replacing full name with "You" when logged in user is equal to the current user. Default false.
+ * @global $userdata WordPress user data for the current logged in user.
+ * @uses get_userdata() WordPress function to fetch the userdata for a user ID
+ * @uses bp_fetch_user_fullname() Returns the full name for a user based on user ID.
+ * @uses bp_core_get_userurl() Returns the URL for the user with no anchor tag based on user ID
+ * @return false on no match
+ * @return str The link text based on passed parameters.
+ */
+function bp_core_get_userlink( $user_id, $no_anchor = false, $just_link = false ) {
+	$display_name = bp_core_get_user_displayname( $user_id );
+
+	if ( empty( $display_name ) )
+		return false;
+
+	if ( $no_anchor )
+		return $display_name;
+
+	if ( !$url = bp_core_get_user_domain($user_id) )
+		return false;
+
+	if ( $just_link )
+		return $url;
+
+	return apply_filters( 'bp_core_get_userlink', '<a href="' . $url . '" title="' . $display_name . '">' . $display_name . '</a>', $user_id );
+}
+
+
+/**
+ * bp_core_get_user_displayname()
+ *
+ * Fetch the display name for a user. This will use the "Name" field in xprofile if it is installed.
+ * Otherwise, it will fall back to the normal WP display_name, or user_nicename, depending on what has been set.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @uses wp_cache_get() Will try and fetch the value from the cache, rather than querying the DB again.
+ * @uses get_userdata() Fetches the WP userdata for a specific user.
+ * @uses xprofile_set_field_data() Will update the field data for a user based on field name and user id.
+ * @uses wp_cache_set() Adds a value to the cache.
+ * @return str The display name for the user in question.
+ */
+function bp_core_get_user_displayname( $user_id_or_username ) {
+	global $bp;
+
+	if ( !$user_id_or_username )
+		return false;
+
+	if ( !is_numeric( $user_id_or_username ) )
+		$user_id = bp_core_get_userid( $user_id_or_username );
+	else
+		$user_id = $user_id_or_username;
+
+	if ( !$user_id )
+		return false;
+
+	if ( !$fullname = wp_cache_get( 'bp_user_fullname_' . $user_id, 'bp' ) ) {
+		if ( function_exists('xprofile_install') ) {
+			$fullname = xprofile_get_field_data( 1, $user_id );
+
+			if ( empty($fullname) ) {
+				$ud = bp_core_get_core_userdata( $user_id );
+
+				if ( !empty( $ud->display_name ) )
+					$fullname = $ud->display_name;
+				else
+					$fullname = $ud->user_nicename;
+
+				xprofile_set_field_data( 1, $user_id, $fullname );
+			}
+		} else {
+			$ud = bp_core_get_core_userdata($user_id);
+
+			if ( !empty( $ud->display_name ) )
+				$fullname = $ud->display_name;
+			else
+				$fullname = $ud->user_nicename;
+		}
+
+		if ( !empty( $fullname ) )
+			wp_cache_set( 'bp_user_fullname_' . $user_id, $fullname, 'bp' );
+	}
+
+	return apply_filters( 'bp_core_get_user_displayname', $fullname, $user_id );
+}
+add_filter( 'bp_core_get_user_displayname', 'strip_tags', 1 );
+add_filter( 'bp_core_get_user_displayname', 'trim' );
+add_filter( 'bp_core_get_user_displayname', 'stripslashes' );
+
+
+/**
+ * bp_core_get_userlink_by_email()
+ *
+ * Returns the user link for the user based on user email address
+ *
+ * @package BuddyPress Core
+ * @param $email str The email address for the user.
+ * @uses bp_core_get_userlink() BuddyPress function to get a userlink by user ID.
+ * @uses get_user_by_email() WordPress function to get userdata via an email address
+ * @return str The link to the users home base. False on no match.
+ */
+function bp_core_get_userlink_by_email( $email ) {
+	$user = get_user_by_email( $email );
+	return apply_filters( 'bp_core_get_userlink_by_email', bp_core_get_userlink( $user->ID, false, false, true ) );
+}
+
+/**
+ * bp_core_get_userlink_by_username()
+ *
+ * Returns the user link for the user based on user's username
+ *
+ * @package BuddyPress Core
+ * @param $username str The username for the user.
+ * @uses bp_core_get_userlink() BuddyPress function to get a userlink by user ID.
+ * @return str The link to the users home base. False on no match.
+ */
+function bp_core_get_userlink_by_username( $username ) {
+	global $wpdb;
+
+	$user_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_login = %s", $username ) );
+	return apply_filters( 'bp_core_get_userlink_by_username', bp_core_get_userlink( $user_id, false, false, true ) );
+}
+
+/**
+ * bp_core_get_total_member_count()
+ *
+ * Returns the total number of members for the installation.
+ *
+ * @package BuddyPress Core
+ * @return int The total number of members.
+ */
+function bp_core_get_total_member_count() {
+	global $wpdb, $bp;
+
+	if ( !$count = wp_cache_get( 'bp_total_member_count', 'bp' ) ) {
+		$status_sql = bp_core_get_status_sql();
+		$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM " . CUSTOM_USER_TABLE . " WHERE {$status_sql}" ) );
+		wp_cache_set( 'bp_total_member_count', $count, 'bp' );
+	}
+
+	return apply_filters( 'bp_core_get_total_member_count', $count );
+}
+
+/**
+ * bp_core_is_user_spammer()
+ *
+ * Checks if the user has been marked as a spammer.
+ *
+ * @package BuddyPress Core
+ * @param $user_id int The id for the user.
+ * @return int 1 if spammer, 0 if not.
+ */
+function bp_core_is_user_spammer( $user_id ) {
+	global $wpdb;
+
+	if ( bp_core_is_multisite() )
+		$is_spammer = (int) $wpdb->get_var( $wpdb->prepare( "SELECT spam FROM " . CUSTOM_USER_TABLE . " WHERE ID = %d", $user_id ) );
+	else
+		$is_spammer = (int) $wpdb->get_var( $wpdb->prepare( "SELECT user_status FROM " . CUSTOM_USER_TABLE . " WHERE ID = %d", $user_id ) );
+
+	return apply_filters( 'bp_core_is_user_spammer', $is_spammer );
+}
+
+/**
+ * bp_core_is_user_deleted()
+ *
+ * Checks if the user has been marked as deleted.
+ *
+ * @package BuddyPress Core
+ * @param $user_id int The id for the user.
+ * @return int 1 if deleted, 0 if not.
+ */
+function bp_core_is_user_deleted( $user_id ) {
+	global $wpdb;
+
+	return apply_filters( 'bp_core_is_user_spammer', (int) $wpdb->get_var( $wpdb->prepare( "SELECT deleted FROM " . CUSTOM_USER_TABLE . " WHERE ID = %d", $user_id ) ) );
+}
+
+/**
+ * bp_core_current_time()
+ *
+ * Get the current GMT time to save into the DB
+ *
+ * @package BuddyPress Core
+ * @since 1.2.6
+ */
+function bp_core_current_time( $gmt = true ) {
+	// Get current time in MYSQL format
+	$current_time = current_time( 'mysql', $gmt );
+
+	return apply_filters( 'bp_core_current_time', $current_time );
+}
+
+/**
+ * bp_core_add_message()
+ *
+ * Adds a feedback (error/success) message to the WP cookie so it can be displayed after the page reloads.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_add_message( $message, $type = false ) {
+	global $bp;
+
+	if ( !$type )
+		$type = 'success';
+
+	/* Send the values to the cookie for page reload display */
+	@setcookie( 'bp-message', $message, time()+60*60*24, COOKIEPATH );
+	@setcookie( 'bp-message-type', $type, time()+60*60*24, COOKIEPATH );
+
+	/***
+	 * Send the values to the $bp global so we can still output messages
+	 * without a page reload
+	 */
+	$bp->template_message = $message;
+	$bp->template_message_type = $type;
+}
+
+/**
+ * bp_core_setup_message()
+ *
+ * Checks if there is a feedback message in the WP cookie, if so, adds a "template_notices" action
+ * so that the message can be parsed into the template and displayed to the user.
+ *
+ * After the message is displayed, it removes the message vars from the cookie so that the message
+ * is not shown to the user multiple times.
+ *
+ * @package BuddyPress Core
+ * @global $bp_message The message text
+ * @global $bp_message_type The type of message (error/success)
+ * @uses setcookie() Sets a cookie value for the user.
+ */
+function bp_core_setup_message() {
+	global $bp;
+
+	if ( empty( $bp->template_message ) )
+		$bp->template_message = $_COOKIE['bp-message'];
+
+	if ( empty( $bp->template_message_type ) )
+		$bp->template_message_type = $_COOKIE['bp-message-type'];
+
+	add_action( 'template_notices', 'bp_core_render_message' );
+
+	@setcookie( 'bp-message', false, time() - 1000, COOKIEPATH );
+	@setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH );
+}
+add_action( 'wp', 'bp_core_setup_message', 2 );
+
+/**
+ * bp_core_render_message()
+ *
+ * Renders a feedback message (either error or success message) to the theme template.
+ * The hook action 'template_notices' is used to call this function, it is not called directly.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ */
+function bp_core_render_message() {
+	global $bp;
+
+	if ( $bp->template_message ) {
+		$type = ( 'success' == $bp->template_message_type ) ? 'updated' : 'error';
+	?>
+		<div id="message" class="<?php echo $type; ?>">
+			<p><?php echo stripslashes( esc_attr( $bp->template_message ) ); ?></p>
+		</div>
+	<?php
+		do_action( 'bp_core_render_message' );
+	}
+}
+
+/**
+ * bp_core_time_since()
+ *
+ * Based on function created by Dunstan Orchard - http://1976design.com
+ *
+ * This function will return an English representation of the time elapsed
+ * since a given date.
+ * eg: 2 hours and 50 minutes
+ * eg: 4 days
+ * eg: 4 weeks and 6 days
+ *
+ * @package BuddyPress Core
+ * @param $older_date int Unix timestamp of date you want to calculate the time since for
+ * @param $newer_date int Unix timestamp of date to compare older date to. Default false (current time).
+ * @return str The time since.
+ */
+function bp_core_time_since( $older_date, $newer_date = false ) {
+
+	// array of time period chunks
+	$chunks = array(
+		array( 60 * 60 * 24 * 365 , __( 'year', 'buddypress' ), __( 'years', 'buddypress' ) ),
+		array( 60 * 60 * 24 * 30 , __( 'month', 'buddypress' ), __( 'months', 'buddypress' ) ),
+		array( 60 * 60 * 24 * 7, __( 'week', 'buddypress' ), __( 'weeks', 'buddypress' ) ),
+		array( 60 * 60 * 24 , __( 'day', 'buddypress' ), __( 'days', 'buddypress' ) ),
+		array( 60 * 60 , __( 'hour', 'buddypress' ), __( 'hours', 'buddypress' ) ),
+		array( 60 , __( 'minute', 'buddypress' ), __( 'minutes', 'buddypress' ) ),
+		array( 1, __( 'second', 'buddypress' ), __( 'seconds', 'buddypress' ) )
+	);
+
+	if ( !is_numeric( $older_date ) ) {
+		$time_chunks = explode( ':', str_replace( ' ', ':', $older_date ) );
+		$date_chunks = explode( '-', str_replace( ' ', '-', $older_date ) );
+
+		$older_date = gmmktime( (int)$time_chunks[1], (int)$time_chunks[2], (int)$time_chunks[3], (int)$date_chunks[1], (int)$date_chunks[2], (int)$date_chunks[0] );
+	}
+
+	/* $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 ) ? strtotime( bp_core_current_time() ) : $newer_date;
+
+	/* Difference in seconds */
+	$since = $newer_date - $older_date;
+
+	/* Something went wrong with date calculation and we ended up with a negative date. */
+	if ( 0 > $since )
+		return __( 'sometime', 'buddypress' );
+
+	/**
+	 * We only want to output two chunks of time here, eg:
+	 * x years, xx months
+	 * x days, xx hours
+	 * so there's only two bits of calculation below:
+	 */
+
+	/* Step one: the first chunk */
+	for ( $i = 0, $j = count($chunks); $i < $j; $i++) {
+		$seconds = $chunks[$i][0];
+
+		/* Finding the biggest chunk (if the chunk fits, break) */
+		if ( ( $count = floor($since / $seconds) ) != 0 )
+			break;
+	}
+
+	/* Set output var */
+	$output = ( 1 == $count ) ? '1 '. $chunks[$i][1] : $count . ' ' . $chunks[$i][2];
+
+	/* Step two: the second chunk */
+	if ( $i + 2 < $j ) {
+		$seconds2 = $chunks[$i + 1][0];
+		$name2 = $chunks[$i + 1][1];
+
+		if ( ( $count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 ) ) != 0 ) {
+			/* Add to output var */
+			$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];
+		}
+	}
+
+	if ( !(int)trim($output) )
+		$output = '0 ' . __( 'seconds', 'buddypress' );
+
+	return $output;
+}
+
+
+/**
+ * bp_core_record_activity()
+ *
+ * Record user activity to the database. Many functions use a "last active" feature to
+ * show the length of time since the user was last active.
+ * This function will update that time as a usermeta setting for the user every 5 minutes.
+ *
+ * @package BuddyPress Core
+ * @global $userdata WordPress user data for the current logged in user.
+ * @uses update_user_meta() WordPress function to update user metadata in the usermeta table.
+ */
+function bp_core_record_activity() {
+	global $bp;
+
+	if ( !is_user_logged_in() )
+		return false;
+
+	$activity = get_user_meta( $bp->loggedin_user->id, 'last_activity', true );
+
+	if ( !is_numeric( $activity ) )
+		$activity = strtotime( $activity );
+
+	// 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' );
+
+
+/**
+ * bp_core_get_last_activity()
+ *
+ * Formats last activity based on time since date given.
+ *
+ * @package BuddyPress Core
+ * @param last_activity_date The date of last activity.
+ * @param $before The text to prepend to the activity time since figure.
+ * @param $after The text to append to the activity time since figure.
+ * @uses bp_core_time_since() This function will return an English representation of the time elapsed.
+ */
+function bp_core_get_last_activity( $last_activity_date, $string ) {
+	if ( !$last_activity_date || empty( $last_activity_date ) ) {
+		$last_active = __( 'not recently active', 'buddypress' );
+	} else {
+		$last_active = sprintf( $string, bp_core_time_since( $last_activity_date ) );
+	}
+
+	return apply_filters( 'bp_core_get_last_activity', $last_active, $last_activity_date, $string );
+}
+
+function bp_core_number_format( $number, $decimals = false ) {
+	/* Check we actually have a number first. */
+	if ( empty( $number ) )
+		return $number;
+
+	return apply_filters( 'bp_core_number_format', number_format( $number, $decimals ), $number, $decimals );
+}
+
+/**
+ * bp_core_get_all_posts_for_user()
+ *
+ * Fetch every post that is authored by the given user for the current blog.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @global $wpdb WordPress user data for the current logged in user.
+ * @return array of post ids.
+ */
+function bp_core_get_all_posts_for_user( $user_id = null ) {
+	global $bp, $wpdb;
+
+	if ( !$user_id )
+		$user_id = $bp->displayed_user->id;
+
+	return apply_filters( 'bp_core_get_all_posts_for_user', $wpdb->get_col( $wpdb->prepare( "SELECT post_id FROM $wpdb->posts WHERE post_author = %d AND post_status = 'publish' AND post_type = 'post'", $user_id ) ) );
+}
+
+/**
+ * bp_core_get_site_path()
+ *
+ * Get the path of of the current site.
+ *
+ * @package BuddyPress Core
+ *
+ * @global $bp $bp
+ * @global object $current_site
+ * @return string
+ */
+function bp_core_get_site_path() {
+	global $bp, $current_site;
+
+	if ( bp_core_is_multisite() )
+		$site_path = $current_site->path;
+	else {
+		$site_path = (array) explode( '/', site_url() );
+
+		if ( count( $site_path ) < 2 )
+			$site_path = '/';
+		else {
+			/* Unset the first three segments (http(s)://domain.com part) */
+			unset( $site_path[0] );
+			unset( $site_path[1] );
+			unset( $site_path[2] );
+
+			if ( !count( $site_path ) )
+				$site_path = '/';
+			else
+				$site_path = '/' . implode( '/', $site_path ) . '/';
+		}
+	}
+
+	return apply_filters( 'bp_core_get_site_path', $site_path );
+}
+/**
+ * bp_core_get_site_options()
+ *
+ * BuddyPress uses site options to store configuration settings. Many of these settings are needed
+ * at run time. Instead of fetching them all and adding many initial queries to each page load, let's fetch
+ * them all in one go.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_get_site_options() {
+	global $bp, $wpdb;
+
+	$options = apply_filters( 'bp_core_site_options', array(
+		'bp-deactivated-components',
+		'bp-blogs-first-install',
+		'bp-disable-blog-forum-comments',
+		'bp-xprofile-base-group-name',
+		'bp-xprofile-fullname-field-name',
+		'bp-disable-profile-sync',
+		'bp-disable-avatar-uploads',
+		'bp-disable-account-deletion',
+		'bp-disable-forum-directory',
+		'bp-disable-blogforum-comments',
+		'bb-config-location',
+		'hide-loggedout-adminbar',
+
+		/* Useful WordPress settings used often */
+		'user-avatar-default',
+		'tags_blog_id',
+		'registration',
+		'fileupload_maxk'
+	) );
+
+	$meta_keys = "'" . implode( "','", (array)$options ) ."'";
+
+	if ( bp_core_is_multisite() )
+		$meta = $wpdb->get_results( "SELECT meta_key AS name, meta_value AS value FROM {$wpdb->sitemeta} WHERE meta_key IN ({$meta_keys}) AND site_id = {$wpdb->siteid}" );
+	else
+		$meta = $wpdb->get_results( "SELECT option_name AS name, option_value AS value FROM {$wpdb->options} WHERE option_name IN ({$meta_keys})" );
+
+	$site_options = array();
+	if ( !empty( $meta ) ) {
+		foreach( (array)$meta as $meta_item )
+			$site_options[$meta_item->name] = $meta_item->value;
+	}
+
+	return apply_filters( 'bp_core_get_site_options', $site_options );
+}
+
+/**
+ * bp_core_redirect()
+ *
+ * Performs a status safe wp_redirect() that is compatible with bp_catch_uri()
+ *
+ * @package BuddyPress Core
+ * @global $bp_no_status_set Makes sure that there are no conflicts with status_header() called in bp_core_do_catch_uri()
+ * @uses get_themes()
+ * @return An array containing all of the themes.
+ */
+function bp_core_redirect( $location, $status = 302 ) {
+	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()
+	$bp_no_status_set = true;
+
+	wp_redirect( $location, $status );
+	die;
+}
+
+/**
+ * bp_core_referrer()
+ *
+ * Returns the referrer URL without the http(s)://
+ *
+ * @package BuddyPress Core
+ * @return The referrer URL
+ */
+function bp_core_referrer() {
+	$referer = explode( '/', wp_get_referer() );
+	unset( $referer[0], $referer[1], $referer[2] );
+	return implode( '/', $referer );
+}
+
+/**
+ * bp_core_add_illegal_names()
+ *
+ * Adds illegal names to WP so that root components will not conflict with
+ * blog names on a subdirectory installation.
+ *
+ * For example, it would stop someone creating a blog with the slug "groups".
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ */
+function bp_core_add_illegal_names() {
+	global $bp;
+
+	$current = maybe_unserialize( get_site_option( 'illegal_names' ) );
+	$bp_illegal_names = $bp->root_components;
+
+	if ( is_array( $current ) ) {
+		foreach( (array)$bp_illegal_names as $bp_illegal_name ) {
+			if ( !in_array( $bp_illegal_name, $current ) )
+				$current[] = $bp_illegal_name;
+		}
+		$new = $current;
+	} else {
+		$bp_illegal_names[] = $current;
+		$new = $bp_illegal_names;
+	}
+
+	update_site_option( 'illegal_names', $new );
+}
+
+/**
+ * bp_core_delete_account()
+ *
+ * Allows a user to completely remove their account from the system
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @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
+ */
+function bp_core_delete_account( $user_id = false ) {
+	global $bp, $wp_version;
+
+	if ( !$user_id )
+		$user_id = $bp->loggedin_user->id;
+
+	/* Make sure account deletion is not disabled */
+	if ( (int)get_site_option( 'bp-disable-account-deletion' ) )
+		return false;
+
+	/* Site admins cannot be deleted */
+	if ( is_super_admin( bp_core_get_username( $user_id ) ) )
+		return false;
+
+	/* Specifically handle multi-site environment */
+	if ( bp_core_is_multisite() ) {
+		if ( $wp_version >= '3.0' )
+			require_once( ABSPATH . '/wp-admin/includes/ms.php' );
+		else
+			require_once( ABSPATH . '/wp-admin/includes/mu.php' );
+
+		require_once( ABSPATH . '/wp-admin/includes/user.php' );
+
+		return wpmu_delete_user( $user_id );
+
+	/* Single site user deletion */
+	} else {
+		require_once( ABSPATH . '/wp-admin/includes/user.php' );
+		return wp_delete_user( $user_id );
+	}
+}
+
+
+/**
+ * bp_core_search_site()
+ *
+ * A javascript free implementation of the search functions in BuddyPress
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @param $slug The slug to redirect to for searching.
+ */
+function bp_core_action_search_site( $slug = false ) {
+	global $bp;
+
+	if ( $bp->current_component == BP_SEARCH_SLUG ) {
+		$search_terms = $_POST['search-terms'];
+		$search_which = $_POST['search-which'];
+
+		if ( !$slug || empty( $slug ) ) {
+			switch ( $search_which ) {
+				case 'members': default:
+					$slug = BP_MEMBERS_SLUG;
+					$var = '/?s=';
+					break;
+				case 'groups':
+					$slug = BP_GROUPS_SLUG;
+					$var = '/?s=';
+					break;
+				case 'forums':
+					$slug = BP_FORUMS_SLUG;
+					$var = '/?fs=';
+					break;
+				case 'blogs':
+					$slug = BP_BLOGS_SLUG;
+					$var = '/?s=';
+					break;
+			}
+		}
+
+		$search_url = apply_filters( 'bp_core_search_site', site_url( $slug . $var . urlencode($search_terms) ), $search_terms );
+
+		bp_core_redirect( $search_url );
+	}
+}
+add_action( 'init', 'bp_core_action_search_site', 5 );
+
+
+/**
+ * bp_core_ucfirst()
+ *
+ * Localization safe ucfirst() support.
+ *
+ * @package BuddyPress Core
+ */
+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 );
+	} else {
+		return ucfirst( $str );
+	}
+}
+
+
+/**
+ * bp_core_strip_username_spaces()
+ *
+ * Strips spaces from usernames that are created using add_user() and wp_insert_user()
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_strip_username_spaces( $username ) {
+	return str_replace( ' ', '-', $username );
+}
+add_action( 'pre_user_login', 'bp_core_strip_username_spaces' );
+
+
+/**
+ * bp_core_clear_cache()
+ * REQUIRES WP-SUPER-CACHE
+ *
+ * When wp-super-cache is installed this function will clear cached pages
+ * so that success/error messages are not cached, or time sensitive content.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_clear_cache() {
+	global $cache_path, $cache_filename;
+
+	if ( function_exists( 'prune_super_cache' ) ) {
+		do_action( 'bp_core_clear_cache' );
+
+		return prune_super_cache( $cache_path, true );
+	}
+}
+
+/**
+ * bp_core_print_generation_time()
+ *
+ * Prints the generation time in the footer of the site.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_print_generation_time() {
+?>
+
+<!-- Generated in <?php timer_stop(1); ?> seconds. -->
+
+	<?php
+}
+add_action( 'wp_footer', 'bp_core_print_generation_time' );
+
+/**
+ * bp_core_add_admin_menu_page()
+ *
+ * A better version of add_admin_menu_page() that allows positioning of menus.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_add_admin_menu_page( $args = '' ) {
+	global $menu, $admin_page_hooks, $_registered_pages;
+
+	$defaults = array(
+		'page_title' => '',
+		'menu_title' => '',
+		'access_level' => 2,
+		'file' => false,
+		'function' => false,
+		'icon_url' => false,
+		'position' => 100
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	$file = plugin_basename( $file );
+
+	$admin_page_hooks[$file] = sanitize_title( $menu_title );
+
+	$hookname = get_plugin_page_hookname( $file, '' );
+	if (!empty ( $function ) && !empty ( $hookname ))
+		add_action( $hookname, $function );
+
+	if ( empty($icon_url) )
+		$icon_url = 'images/generic.png';
+	elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') )
+		$icon_url = 'https://' . substr($icon_url, 7);
+
+	do {
+		$position++;
+	} while ( !empty( $menu[$position] ) );
+
+	$menu[$position] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );
+
+	$_registered_pages[$hookname] = true;
+
+	return $hookname;
+}
+
+/**
+ * bp_core_boot_spammer()
+ *
+ * When a user logs in, check if they have been marked as a spammer. If yes then simply
+ * redirect them to the home page and stop them from logging in.
+ *
+ * @package BuddyPress Core
+ * @param $auth_obj The WP authorization object
+ * @param $username The username of the user logging in.
+ * @uses get_userdatabylogin() Get the userdata object for a user based on their username
+ * @uses bp_core_redirect() Safe redirect to a page
+ * @return $auth_obj If the user is not a spammer, return the authorization object
+ */
+function bp_core_boot_spammer( $auth_obj, $username ) {
+	global $bp;
+
+	$user = get_userdatabylogin( $username );
+
+	if ( ( bp_core_is_multisite() && (int)$user->spam ) || 1 == (int)$user->user_status )
+		bp_core_redirect( $bp->root_domain );
+	else
+		return $auth_obj;
+}
+add_filter( 'authenticate', 'bp_core_boot_spammer', 11, 2 );
+
+/**
+ * bp_core_remove_data()
+ *
+ * Deletes usermeta for the user when the user is deleted.
+ *
+ * @package BuddyPress Core
+ * @param $user_id The user id for the user to delete usermeta for
+ * @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_user_meta( $user_id, 'last_activity' );
+
+	/* Flush the cache to remove the user from all cached objects */
+	wp_cache_flush();
+}
+add_action( 'wpmu_delete_user', 'bp_core_remove_data' );
+add_action( 'delete_user', 'bp_core_remove_data' );
+add_action( 'make_spam_user', 'bp_core_remove_data' );
+
+/**
+ * bp_load_buddypress_textdomain()
+ *
+ * Load the buddypress translation file for current language
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_load_buddypress_textdomain() {
+	$locale = apply_filters( 'buddypress_locale', get_locale() );
+	$mofile = BP_PLUGIN_DIR . "/bp-languages/buddypress-$locale.mo";
+
+	if ( file_exists( $mofile ) )
+		load_textdomain( 'buddypress', $mofile );
+}
+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 */
+	if ( !defined( 'WP_ADMIN' ) )
+		do_action( 'wp_ajax_' . $_REQUEST['action'] );
+}
+add_action( 'init', 'bp_core_add_ajax_hook' );
+
+/**
+ * bp_core_update_message()
+ *
+ * Add an extra update message to the update plugin notification.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_update_message() {
+	echo '<p style="color: red; margin: 3px 0 0 0; border-top: 1px solid #ddd; padding-top: 3px">' . __( 'IMPORTANT: <a href="http://codex.buddypress.org/getting-started/upgrading-from-10x/">Read this before attempting to update BuddyPress</a>', 'buddypress' ) . '</p>';
+}
+add_action( 'in_plugin_update_message-buddypress/bp-loader.php', 'bp_core_update_message' );
+
+/**
+ * bp_core_activation_notice()
+ *
+ * When BuddyPress is activated we must make sure that mod_rewrite is enabled.
+ * We must also make sure a BuddyPress compatible theme is enabled. This function
+ * will show helpful messages to the administrator.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_activation_notice() {
+	global $wp_rewrite, $current_blog, $bp;
+
+	if ( isset( $_POST['permalink_structure'] ) )
+		return false;
+
+	if ( !is_super_admin() )
+		return false;
+
+	if ( !empty( $current_blog ) ) {
+		if ( $current_blog->blog_id != BP_ROOT_BLOG )
+			return false;
+	}
+
+	if ( empty( $wp_rewrite->permalink_structure ) ) { ?>
+		<div id="message" class="updated fade">
+			<p><?php printf( __( '<strong>BuddyPress is almost ready</strong>. You must <a href="%s">update your permalink structure</a> to something other than the default for it to work.', 'buddypress' ), admin_url( 'options-permalink.php' ) ) ?></p>
+		</div><?php
+	} else {
+		/* Get current theme info */
+		$ct = current_theme_info();
+
+		/* The best way to remove this notice is to add a "buddypress" tag to your active theme's CSS header. */
+		if ( !defined( 'BP_SILENCE_THEME_NOTICE' ) && !in_array( 'buddypress', (array)$ct->tags ) ) { ?>
+			<div id="message" class="updated fade">
+				<p style="line-height: 150%"><?php printf( __( "<strong>BuddyPress is ready</strong>. You'll need to <a href='%s'>activate a BuddyPress compatible theme</a> to take advantage of all of the features. We've bundled a default theme, but you can always <a href='%s'>install some other compatible themes</a> or <a href='%s'>upgrade your existing WordPress theme</a>.", 'buddypress' ), admin_url( 'themes.php' ), admin_url( 'theme-install.php?type=tag&s=buddypress&tab=search' ), admin_url( 'plugin-install.php?type=term&tab=search&s=bp-template-pack' ) ) ?></p>
+			</div><?php
+		}
+	}
+}
+add_action( 'admin_notices', 'bp_core_activation_notice' );
+
+/**
+ * bp_core_activate_site_options()
+ *
+ * When switching from single to multisite we need to copy blog options to
+ * site options.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_activate_site_options( $keys = array() ) {
+	global $bp;
+
+	if ( !empty( $keys ) && is_array( $keys ) ) {
+		$errors = false;
+
+		foreach ( $keys as $key => $default ) {
+			if ( empty( $bp->site_options[ $key ] ) ) {
+				$bp->site_options[ $key ] = get_blog_option( BP_ROOT_BLOG, $key, $default );
+
+				if ( !update_site_option( $key, $bp->site_options[ $key ] ) )
+					$errors = true;
+			}
+		}
+
+		if ( empty( $errors ) )
+			return true;
+	}
+
+	return false;
+}
+
+/********************************************************************************
+ * Custom Actions
+ *
+ * Functions to set up custom BuddyPress actions that all other components can
+ * hook in to.
+ */
+ 
+/**
+ * bp_include()
+ *
+ * Allow plugins to include their files ahead of core filters
+ */
+function bp_include() {
+	do_action( 'bp_include' );
+}
+add_action( 'bp_loaded', 'bp_include', 2 );
+
+/**
+ * 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( 'bp_loaded', 'bp_setup_root_components', 2 );
+
+/**
+ * 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 );
+
+/**
+ * bp_setup_widgets()
+ *
+ * Allow core components and dependent plugins to register widgets
+ */
+function bp_setup_widgets() {
+	do_action( 'bp_register_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
+ *
+ * Caching functions handle the clearing of cached objects and pages on specific
+ * actions throughout BuddyPress.
+ */
+
+/**
+ * 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.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_clear_user_object_cache( $user_id ) {
+	wp_cache_delete( 'bp_user_' . $user_id, 'bp' );
+	wp_cache_delete( 'bp_core_avatar_v1_u' . $user_id, 'bp' );
+	wp_cache_delete( 'bp_core_avatar_v2_u' . $user_id, 'bp' );
+	wp_cache_delete( 'online_users' );
+	wp_cache_delete( 'newest_users' );
+}
+
+// List actions to clear super cached pages on, if super cache is installed
+add_action( 'wp_login', 'bp_core_clear_cache' );
+add_action( 'bp_core_render_notice', 'bp_core_clear_cache' );
+
+// Remove the catch non existent blogs hook so WPMU doesn't think BuddyPress pages are non existing blogs
+remove_action( 'plugins_loaded', 'catch_nonexistant_blogs' );
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-admin.php b/wp-content/plugins/buddypress/bp-core/bp-core-admin.php
new file mode 100644
index 0000000000000000000000000000000000000000..3693473d31f4970076634f6374d8ad9299bc75ea
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-core/bp-core-admin.php
@@ -0,0 +1,251 @@
+<?php
+
+function bp_core_admin_settings() {
+	global $wpdb, $bp, $current_blog;
+?>
+
+	<?php
+	if ( isset( $_POST['bp-admin-submit'] ) && isset( $_POST['bp-admin'] ) ) {
+		if ( !check_admin_referer('bp-admin') )
+			return false;
+
+		// Settings form submitted, now save the settings.
+		foreach ( (array)$_POST['bp-admin'] as $key => $value ) {
+
+			if ( function_exists( 'xprofile_install' ) ) {
+				if ( 'bp-xprofile-base-group-name' == $key ) {
+					$wpdb->query( $wpdb->prepare( "UPDATE {$bp->profile->table_name_groups} SET name = %s WHERE id = 1", $value ) );
+				}
+
+				if ( 'bp-xprofile-fullname-field-name' == $key ) {
+					$wpdb->query( $wpdb->prepare( "UPDATE {$bp->profile->table_name_fields} SET name = %s WHERE group_id = 1 AND id = 1", $value ) );
+				}
+			}
+
+			update_site_option( $key, $value );
+		}
+	}
+	?>
+
+	<div class="wrap">
+
+		<h2><?php _e( 'BuddyPress Settings', 'buddypress' ) ?></h2>
+
+		<?php if ( isset( $_POST['bp-admin'] ) ) : ?>
+			<div id="message" class="updated fade">
+				<p><?php _e( 'Settings Saved', 'buddypress' ) ?></p>
+			</div>
+		<?php endif; ?>
+
+		<form action="" method="post" id="bp-admin-form">
+
+			<table class="form-table">
+			<tbody>
+				<?php if ( function_exists( 'xprofile_install' ) ) :?>
+				<tr>
+					<th scope="row"><?php _e( 'Base profile group name', 'buddypress' ) ?>:</th>
+					<td>
+						<input name="bp-admin[bp-xprofile-base-group-name]" id="bp-xprofile-base-group-name" value="<?php echo get_site_option('bp-xprofile-base-group-name') ?>" />
+					</td>
+				</tr>
+				<tr>
+					<th scope="row"><?php _e( 'Full Name field name', 'buddypress' ) ?>:</th>
+					<td>
+						<input name="bp-admin[bp-xprofile-fullname-field-name]" id="bp-xprofile-fullname-field-name" value="<?php echo get_site_option('bp-xprofile-fullname-field-name') ?>" />
+					</td>
+				</tr>
+				<tr>
+					<th scope="row"><?php _e( 'Disable BuddyPress to WordPress profile syncing?', 'buddypress' ) ?>:</th>
+					<td>
+						<input type="radio" name="bp-admin[bp-disable-profile-sync]"<?php if ( (int)get_site_option( 'bp-disable-profile-sync' ) ) : ?> checked="checked"<?php endif; ?> id="bp-disable-profile-sync" value="1" /> <?php _e( 'Yes', 'buddypress' ) ?> &nbsp;
+						<input type="radio" name="bp-admin[bp-disable-profile-sync]"<?php if ( !(int)get_site_option( 'bp-disable-profile-sync' ) || '' == get_site_option( 'bp-disable-profile-sync' ) ) : ?> checked="checked"<?php endif; ?> id="bp-disable-profile-sync" value="0" /> <?php _e( 'No', 'buddypress' ) ?>
+					</td>
+				</tr>
+				<?php endif; ?>
+				<tr>
+					<th scope="row"><?php _e( 'Hide admin bar for logged out users?', 'buddypress' ) ?>:</th>
+					<td>
+						<input type="radio" name="bp-admin[hide-loggedout-adminbar]"<?php if ( (int)get_site_option( 'hide-loggedout-adminbar' ) ) : ?> checked="checked"<?php endif; ?> id="bp-admin-hide-loggedout-adminbar-yes" value="1" /> <?php _e( 'Yes', 'buddypress' ) ?> &nbsp;
+						<input type="radio" name="bp-admin[hide-loggedout-adminbar]"<?php if ( !(int)get_site_option( 'hide-loggedout-adminbar' ) ) : ?> checked="checked"<?php endif; ?> id="bp-admin-hide-loggedout-adminbar-no" value="0" /> <?php _e( 'No', 'buddypress' ) ?>
+					</td>
+				</tr>
+				<tr>
+					<th scope="row"><?php _e( 'Disable avatar uploads? (Gravatars will still work)', 'buddypress' ) ?>:</th>
+					<td>
+						<input type="radio" name="bp-admin[bp-disable-avatar-uploads]"<?php if ( (int)get_site_option( 'bp-disable-avatar-uploads' ) ) : ?> checked="checked"<?php endif; ?> id="bp-admin-disable-avatar-uploads-yes" value="1" /> <?php _e( 'Yes', 'buddypress' ) ?> &nbsp;
+						<input type="radio" name="bp-admin[bp-disable-avatar-uploads]"<?php if ( !(int)get_site_option( 'bp-disable-avatar-uploads' ) ) : ?> checked="checked"<?php endif; ?> id="bp-admin-disable-avatar-uploads-no" value="0" /> <?php _e( 'No', 'buddypress' ) ?>
+					</td>
+				</tr>
+				<tr>
+					<th scope="row"><?php _e( 'Disable user account deletion?', 'buddypress' ) ?>:</th>
+					<td>
+						<input type="radio" name="bp-admin[bp-disable-account-deletion]"<?php if ( (int)get_site_option( 'bp-disable-account-deletion' ) ) : ?> checked="checked"<?php endif; ?> id="bp-disable-account-deletion" value="1" /> <?php _e( 'Yes', 'buddypress' ) ?> &nbsp;
+						<input type="radio" name="bp-admin[bp-disable-account-deletion]"<?php if ( !(int)get_site_option( 'bp-disable-account-deletion' ) ) : ?> checked="checked"<?php endif; ?> id="bp-disable-account-deletion" value="0" /> <?php _e( 'No', 'buddypress' ) ?>
+					</td>
+				</tr>
+				<?php if ( function_exists( 'bp_forums_setup') ) : ?>
+				<tr>
+					<th scope="row"><?php _e( 'Disable global forum directory?', 'buddypress' ) ?>:</th>
+					<td>
+						<input type="radio" name="bp-admin[bp-disable-forum-directory]"<?php if ( (int)get_site_option( 'bp-disable-forum-directory' ) ) : ?> checked="checked"<?php endif; ?> id="bp-disable-forum-directory" value="1" /> <?php _e( 'Yes', 'buddypress' ) ?> &nbsp;
+						<input type="radio" name="bp-admin[bp-disable-forum-directory]"<?php if ( !(int)get_site_option( 'bp-disable-forum-directory' ) ) : ?> checked="checked"<?php endif; ?> id="bp-disable-forum-directory" value="0" /> <?php _e( 'No', 'buddypress' ) ?>
+					</td>
+				</tr>
+				<?php endif; ?>
+				<?php if ( function_exists( 'bp_activity_install') ) : ?>
+				<tr>
+					<th scope="row"><?php _e( 'Disable activity stream commenting on blog and forum posts?', 'buddypress' ) ?>:</th>
+					<td>
+						<input type="radio" name="bp-admin[bp-disable-blogforum-comments]"<?php if ( (int)get_site_option( 'bp-disable-blogforum-comments' ) || false === get_site_option( 'bp-disable-blogforum-comments' ) ) : ?> checked="checked"<?php endif; ?> id="bp-disable-blogforum-comments" value="1" /> <?php _e( 'Yes', 'buddypress' ) ?> &nbsp;
+						<input type="radio" name="bp-admin[bp-disable-blogforum-comments]"<?php if ( !(int)get_site_option( 'bp-disable-blogforum-comments' ) ) : ?> checked="checked"<?php endif; ?> id="bp-disable-blogforum-comments" value="0" /> <?php _e( 'No', 'buddypress' ) ?>
+					</td>
+				</tr>
+				<?php endif; ?>
+
+				<tr>
+					<th scope="row"><?php _e( 'Default User Avatar', 'buddypress' ) ?></th>
+					<td>
+						<p><?php _e( 'For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their email address', 'buddypress' ) ?></p>
+
+						<label><input name="bp-admin[user-avatar-default]" id="avatar_mystery" value="mystery" type="radio" <?php if ( get_site_option( 'user-avatar-default' ) == 'mystery' ) : ?> checked="checked"<?php endif; ?> /> &nbsp;<img alt="" src="http://www.gravatar.com/avatar/<?php md5( strtolower( $ud->user_email ) ) ?>&amp;?s=32&amp;d=<?php echo BP_PLUGIN_URL . '/bp-core/images/mystery-man.jpg' ?>&amp;r=PG&amp;forcedefault=1" class="avatar avatar-32" height="32" width="32"> &nbsp;<?php _e( 'Mystery Man', 'buddypress' ) ?></label><br>
+						<label><input name="bp-admin[user-avatar-default]" id="avatar_identicon" value="identicon" type="radio" <?php if ( get_site_option( 'user-avatar-default' ) == 'identicon' ) : ?> checked="checked"<?php endif; ?> /> &nbsp;<img alt="" src="http://www.gravatar.com/avatar/<?php md5( strtolower( $ud->user_email ) ) ?>?s=32&amp;d=identicon&amp;r=PG&amp;forcedefault=1" class="avatar avatar-32" height="32" width="32"> &nbsp;<?php _e( 'Identicon (Generated)', 'buddypress' ) ?></label><br>
+						<label><input name="bp-admin[user-avatar-default]" id="avatar_wavatar" value="wavatar" type="radio" <?php if ( get_site_option( 'user-avatar-default' ) == 'wavatar' ) : ?> checked="checked"<?php endif; ?> /> &nbsp;<img alt="" src="http://www.gravatar.com/avatar/<?php md5( strtolower( $ud->user_email ) ) ?>?s=32&amp;d=wavatar&amp;r=PG&amp;forcedefault=1" class="avatar avatar-32" height="32" width="32"> &nbsp;<?php _e( 'Wavatar (Generated)', 'buddypress' ) ?> </label><br>
+						<label><input name="bp-admin[user-avatar-default]" id="avatar_monsterid" value="monsterid" type="radio" <?php if ( get_site_option( 'user-avatar-default' ) == 'monsterid' ) : ?> checked="checked"<?php endif; ?> /> &nbsp;<img alt="" src="http://www.gravatar.com/avatar/<?php md5( strtolower( $ud->user_email ) ) ?>?s=32&amp;d=monsterid&amp;r=PG&amp;forcedefault=1" class="avatar avatar-32" height="32" width="32"> &nbsp;<?php _e( 'MonsterID (Generated)', 'buddypress' ) ?></label>
+					</td>
+				</tr>
+
+				<?php do_action( 'bp_core_admin_screen_fields' ) ?>
+			</tbody>
+			</table>
+
+			<?php do_action( 'bp_core_admin_screen' ) ?>
+
+			<p class="submit">
+				<input class="button-primary" type="submit" name="bp-admin-submit" id="bp-admin-submit" value="<?php _e( 'Save Settings', 'buddypress' ) ?>"/>
+			</p>
+
+			<?php wp_nonce_field( 'bp-admin' ) ?>
+
+		</form>
+
+	</div>
+
+<?php
+}
+
+function bp_core_admin_component_setup() {
+	global $wpdb, $bp;
+?>
+
+	<?php
+	if ( isset( $_POST['bp-admin-component-submit'] ) && isset( $_POST['bp_components'] ) ) {
+		if ( !check_admin_referer('bp-admin-component-setup') )
+			return false;
+
+		// Settings form submitted, now save the settings.
+		foreach ( (array)$_POST['bp_components'] as $key => $value ) {
+			if ( !(int) $value )
+				$disabled[$key] = 1;
+		}
+		update_site_option( 'bp-deactivated-components', $disabled );
+	}
+	?>
+
+	<div class="wrap">
+
+		<h2><?php _e( 'BuddyPress Component Setup', 'buddypress' ) ?></h2>
+
+		<?php if ( isset( $_POST['bp-admin-component-submit'] ) ) : ?>
+			<div id="message" class="updated fade">
+				<p><?php _e( 'Settings Saved', 'buddypress' ) ?></p>
+			</div>
+		<?php endif; ?>
+
+		<form action="" method="post" id="bp-admin-component-form">
+
+			<p><?php _e('By default, all BuddyPress components are enabled. You can selectively disable any of the components by using the form below. Your BuddyPress installation will continue to function, however the features of the disabled components will no longer be accessible to anyone using the site.', 'buddypress' ) ?></p>
+
+			<?php $disabled_components = get_site_option( 'bp-deactivated-components' ); ?>
+
+			<table class="form-table" style="width: 80%">
+			<tbody>
+				<?php if ( file_exists( BP_PLUGIN_DIR . '/bp-activity.php') ) : ?>
+				<tr>
+					<td><h3><?php _e( 'Activity Streams', 'buddypress' ) ?></h3><p><?php _e( 'Allow users to post activity updates and track all activity across the entire site.', 'buddypress' ) ?></p></td>
+					<td>
+						<input type="radio" name="bp_components[bp-activity.php]" value="1"<?php if ( !isset( $disabled_components['bp-activity.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?> &nbsp;
+						<input type="radio" name="bp_components[bp-activity.php]" value="0"<?php if ( isset( $disabled_components['bp-activity.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
+					</td>
+				</tr>
+				<?php endif; ?>
+				<?php if ( file_exists( BP_PLUGIN_DIR . '/bp-blogs.php') && bp_core_is_multisite() ) : ?>
+				<tr>
+					<td><h3><?php _e( 'Blog Tracking', 'buddypress' ) ?></h3><p><?php _e( 'Tracks blogs, blog posts and blogs comments for a user across a WPMU installation.', 'buddypress' ) ?></p></td>
+					<td>
+						<input type="radio" name="bp_components[bp-blogs.php]" value="1"<?php if ( !isset( $disabled_components['bp-blogs.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?>  &nbsp;
+						<input type="radio" name="bp_components[bp-blogs.php]" value="0"<?php if ( isset( $disabled_components['bp-blogs.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
+					</td>
+				</tr>
+				<?php endif; ?>
+				<?php if ( file_exists( BP_PLUGIN_DIR . '/bp-forums.php') ) : ?>
+				<tr>
+					<td><h3><?php _e( 'bbPress Forums', 'buddypress' ) ?></h3><p><?php _e( 'Activates bbPress forum support within BuddyPress groups or any other custom component.', 'buddypress' ) ?></p></td>
+					<td>
+						<input type="radio" name="bp_components[bp-forums.php]" value="1"<?php if ( !isset( $disabled_components['bp-forums.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?>  &nbsp;
+						<input type="radio" name="bp_components[bp-forums.php]" value="0"<?php if ( isset( $disabled_components['bp-forums.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
+					</td>
+				</tr>
+				<?php endif; ?>
+				<?php if ( file_exists( BP_PLUGIN_DIR . '/bp-friends.php') ) : ?>
+				<tr>
+					<td><h3><?php _e( 'Friends', 'buddypress' ) ?></h3><p><?php _e( 'Allows the creation of friend connections between users.', 'buddypress' ) ?></p></td>
+					<td>
+						<input type="radio" name="bp_components[bp-friends.php]" value="1"<?php if ( !isset( $disabled_components['bp-friends.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?>  &nbsp;
+						<input type="radio" name="bp_components[bp-friends.php]" value="0"<?php if ( isset( $disabled_components['bp-friends.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
+					</td>
+				</tr>
+				<?php endif; ?>
+				<?php if ( file_exists( BP_PLUGIN_DIR . '/bp-groups.php') ) : ?>
+				<tr>
+					<td><h3><?php _e( 'Groups', 'buddypress' ) ?></h3><p><?php _e( 'Let users create, join and participate in groups.', 'buddypress' ) ?></p></td>
+					<td>
+						<input type="radio" name="bp_components[bp-groups.php]" value="1"<?php if ( !isset( $disabled_components['bp-groups.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?>  &nbsp;
+						<input type="radio" name="bp_components[bp-groups.php]" value="0"<?php if ( isset( $disabled_components['bp-groups.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
+					</td>
+				</tr>
+				<?php endif; ?>
+				<?php if ( file_exists( BP_PLUGIN_DIR . '/bp-messages.php') ) : ?>
+				<tr>
+					<td><h3><?php _e( 'Private Messaging', 'buddypress' ) ?></h3><p><?php _e( 'Let users send private messages to one another. Site admins can also send site-wide notices.', 'buddypress' ) ?></p></td>
+					<td>
+						<input type="radio" name="bp_components[bp-messages.php]" value="1"<?php if ( !isset( $disabled_components['bp-messages.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?>  &nbsp;
+						<input type="radio" name="bp_components[bp-messages.php]" value="0"<?php if ( isset( $disabled_components['bp-messages.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
+					</td>
+				</tr>
+				<?php endif; ?>
+				<?php if ( file_exists( BP_PLUGIN_DIR . '/bp-xprofile.php') ) : ?>
+				<tr>
+					<td><h3><?php _e( 'Extended Profiles', 'buddypress' ) ?></h3><p><?php _e( 'Activates customizable profiles and avatars for site users.', 'buddypress' ) ?></p></td>
+					<td width="45%">
+						<input type="radio" name="bp_components[bp-xprofile.php]" value="1"<?php if ( !isset( $disabled_components['bp-xprofile.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?>  &nbsp;
+						<input type="radio" name="bp_components[bp-xprofile.php]" value="0"<?php if ( isset( $disabled_components['bp-xprofile.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
+					</td>
+				</tr>
+				<?php endif; ?>
+			</tbody>
+			</table>
+
+			<p class="submit">
+				<input class="button-primary" type="submit" name="bp-admin-component-submit" id="bp-admin-component-submit" value="<?php _e( 'Save Settings', 'buddypress' ) ?>"/>
+			</p>
+
+			<?php wp_nonce_field( 'bp-admin-component-setup' ) ?>
+
+		</form>
+
+	</div>
+
+<?php
+}
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-adminbar.php b/wp-content/plugins/buddypress/bp-core/bp-core-adminbar.php
new file mode 100644
index 0000000000000000000000000000000000000000..f7ec5335a799368338790abb2c855306ba5162ac
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-core/bp-core-adminbar.php
@@ -0,0 +1,258 @@
+<?php
+
+function bp_core_admin_bar() {
+	global $bp, $wpdb, $current_blog;
+
+	if ( defined( 'BP_DISABLE_ADMIN_BAR' ) )
+		return false;
+
+	if ( (int)get_site_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() )
+		return false;
+
+	$bp->doing_admin_bar = true;
+
+	echo '<div id="wp-admin-bar"><div class="padder">';
+
+	// **** Do bp-adminbar-logo Actions ********
+	do_action( 'bp_adminbar_logo' );
+
+	echo '<ul class="main-nav">';
+
+	// **** Do bp-adminbar-menus Actions ********
+	do_action( 'bp_adminbar_menus' );
+
+	echo '</ul>';
+	echo "</div></div><!-- #wp-admin-bar -->\n\n";
+
+	$bp->doing_admin_bar = false;
+}
+
+// **** Default BuddyPress admin bar logo ********
+function bp_adminbar_logo() {
+	global $bp;
+
+	echo '<a href="' . $bp->root_domain . '" id="admin-bar-logo">' . get_blog_option( BP_ROOT_BLOG, 'blogname') . '</a>';
+}
+
+// **** "Log In" and "Sign Up" links (Visible when not logged in) ********
+function bp_adminbar_login_menu() {
+	global $bp;
+
+	if ( is_user_logged_in() )
+		return false;
+
+	echo '<li class="bp-login no-arrow"><a href="' . $bp->root_domain . '/wp-login.php?redirect_to=' . urlencode( $bp->root_domain ) . '">' . __( 'Log In', 'buddypress' ) . '</a></li>';
+
+	// Show "Sign Up" link if user registrations are allowed
+	if ( bp_get_signup_allowed() ) {
+		echo '<li class="bp-signup no-arrow"><a href="' . bp_get_signup_page(false) . '">' . __( 'Sign Up', 'buddypress' ) . '</a></li>';
+	}
+}
+
+
+// **** "My Account" Menu ******
+function bp_adminbar_account_menu() {
+	global $bp;
+
+	if ( !$bp->bp_nav || !is_user_logged_in() )
+		return false;
+
+	echo '<li id="bp-adminbar-account-menu"><a href="' . bp_loggedin_user_domain() . '">';
+
+	echo __( 'My Account', 'buddypress' ) . '</a>';
+	echo '<ul>';
+
+	/* Loop through each navigation item */
+	$counter = 0;
+	foreach( (array)$bp->bp_nav as $nav_item ) {
+		$alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
+
+		echo '<li' . $alt . '>';
+		echo '<a id="bp-admin-' . $nav_item['css_id'] . '" href="' . $nav_item['link'] . '">' . $nav_item['name'] . '</a>';
+
+		if ( is_array( $bp->bp_options_nav[$nav_item['slug']] ) ) {
+			echo '<ul>';
+			$sub_counter = 0;
+
+			foreach( (array)$bp->bp_options_nav[$nav_item['slug']] as $subnav_item ) {
+				$link = str_replace( $bp->displayed_user->domain, $bp->loggedin_user->domain, $subnav_item['link'] );
+				$name = str_replace( $bp->displayed_user->userdata->user_login, $bp->loggedin_user->userdata->user_login, $subnav_item['name'] );
+				$alt = ( 0 == $sub_counter % 2 ) ? ' class="alt"' : '';
+				echo '<li' . $alt . '><a id="bp-admin-' . $subnav_item['css_id'] . '" href="' . $link . '">' . $name . '</a></li>';
+				$sub_counter++;
+			}
+			echo '</ul>';
+		}
+
+		echo '</li>';
+
+		$counter++;
+	}
+
+	$alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
+
+	echo '<li' . $alt . '><a id="bp-admin-logout" class="logout" href="' . wp_logout_url( site_url() ) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';
+	echo '</ul>';
+	echo '</li>';
+}
+
+// *** "My Blogs" Menu ********
+function bp_adminbar_blogs_menu() {
+	global $bp;
+
+	if ( !is_user_logged_in() || !function_exists('bp_blogs_install') )
+		return false;
+
+	if ( !$blogs = wp_cache_get( 'bp_blogs_of_user_' . $bp->loggedin_user->id . '_inc_hidden', 'bp' ) ) {
+		$blogs = bp_blogs_get_blogs_for_user( $bp->loggedin_user->id, true );
+		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 . '/">';
+
+	_e( 'My Blogs', 'buddypress' );
+
+	echo '</a>';
+	echo '<ul>';
+
+	if ( is_array( $blogs['blogs'] ) && (int)$blogs['count'] ) {
+		$counter = 0;
+		foreach ( (array)$blogs['blogs'] as $blog ) {
+			$alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
+			$site_url = esc_attr( $blog->siteurl );
+
+			echo '<li' . $alt . '>';
+			echo '<a href="' . $site_url . '">' . esc_html( $blog->name ) . '</a>';
+
+			echo '<ul>';
+			echo '<li class="alt"><a href="' . $site_url . 'wp-admin/">' . __( 'Dashboard', 'buddypress' ) . '</a></li>';
+			echo '<li><a href="' . $site_url . 'wp-admin/post-new.php">' . __( 'New Post', 'buddypress' ) . '</a></li>';
+			echo '<li class="alt"><a href="' . $site_url . 'wp-admin/edit.php">' . __( 'Manage Posts', 'buddypress' ) . '</a></li>';
+			echo '<li><a href="' . $site_url . 'wp-admin/edit-comments.php">' . __( 'Manage Comments', 'buddypress' ) . '</a></li>';
+			echo '</ul>';
+
+			echo '</li>';
+			$counter++;
+		}
+	}
+
+	$alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
+
+	if ( bp_blog_signup_enabled() ) {
+		echo '<li' . $alt . '>';
+		echo '<a href="' . $bp->root_domain . '/' . $bp->blogs->slug . '/create/">' . __( 'Create a Blog!', 'buddypress' ) . '</a>';
+		echo '</li>';
+	}
+
+	echo '</ul>';
+	echo '</li>';
+}
+
+// **** "Notifications" Menu *********
+function bp_adminbar_notifications_menu() {
+	global $bp;
+
+	if ( !is_user_logged_in() )
+		return false;
+
+	echo '<li id="bp-adminbar-notifications-menu"><a href="' . $bp->loggedin_user->domain . '">';
+	_e( 'Notifications', 'buddypress' );
+
+	if ( $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?>
+		<span><?php echo count($notifications) ?></span>
+	<?php
+	}
+
+	echo '</a>';
+	echo '<ul>';
+
+	if ( $notifications ) { ?>
+		<?php $counter = 0; ?>
+		<?php for ( $i = 0; $i < count($notifications); $i++ ) { ?>
+			<?php $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>
+			<li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>
+			<?php $counter++; ?>
+		<?php } ?>
+	<?php } else { ?>
+		<li><a href="<?php echo $bp->loggedin_user->domain ?>"><?php _e( 'No new notifications.', 'buddypress' ); ?></a></li>
+	<?php
+	}
+
+	echo '</ul>';
+	echo '</li>';
+}
+
+// **** "Blog Authors" Menu (visible when not logged in) ********
+function bp_adminbar_authors_menu() {
+	global $bp, $current_blog, $wpdb;
+
+	if ( $current_blog->blog_id == BP_ROOT_BLOG || !function_exists( 'bp_blogs_install' ) )
+		return false;
+
+	$blog_prefix = $wpdb->get_blog_prefix( $current_blog->id );
+	$authors = $wpdb->get_results( "SELECT user_id, user_login, user_nicename, display_name, user_email, meta_value as caps FROM $wpdb->users u, $wpdb->usermeta um WHERE u.ID = um.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY um.user_id" );
+
+	if ( !empty( $authors ) ) {
+		/* This is a blog, render a menu with links to all authors */
+		echo '<li id="bp-adminbar-authors-menu"><a href="/">';
+		_e('Blog Authors', 'buddypress');
+		echo '</a>';
+
+		echo '<ul class="author-list">';
+		foreach( (array)$authors as $author ) {
+			$caps = maybe_unserialize( $author->caps );
+			if ( isset( $caps['subscriber'] ) || isset( $caps['contributor'] ) ) continue;
+
+			echo '<li>';
+			echo '<a href="' . bp_core_get_user_domain( $author->user_id, $author->user_nicename, $author->user_login ) . '">';
+			echo bp_core_fetch_avatar( array( 'item_id' => $author->user_id, 'email' => $author->user_email, 'width' => 15, 'height' => 15 ) ) ;
+ 			echo ' ' . $author->display_name . '</a>';
+			echo '<div class="admin-bar-clear"></div>';
+			echo '</li>';
+		}
+		echo '</ul>';
+		echo '</li>';
+	}
+}
+
+// **** "Random" Menu (visible when not logged in) ********
+function bp_adminbar_random_menu() {
+	global $bp; ?>
+	<li class="align-right" id="bp-adminbar-visitrandom-menu">
+		<a href="#"><?php _e( 'Visit', 'buddypress' ) ?></a>
+		<ul class="random-list">
+			<li><a href="<?php echo $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/?random-member' ?>"><?php _e( 'Random Member', 'buddypress' ) ?></a></li>
+
+			<?php if ( function_exists('groups_install') ) : ?>
+			<li class="alt"><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug . '/?random-group' ?>"><?php _e( 'Random Group', 'buddypress' ) ?></a></li>
+			<?php endif; ?>
+
+			<?php if ( function_exists('bp_blogs_install') && bp_core_is_multisite() ) : ?>
+			<li><a href="<?php echo $bp->root_domain . '/' . $bp->blogs->slug . '/?random-blog' ?>"><?php _e( 'Random Blog', 'buddypress' ) ?></a></li>
+
+			<?php endif; ?>
+
+			<?php do_action( 'bp_adminbar_random_menu' ) ?>
+		</ul>
+	</li>
+	<?php
+}
+
+add_action( 'bp_adminbar_logo', 'bp_adminbar_logo' );
+add_action( 'bp_adminbar_menus', 'bp_adminbar_login_menu', 2 );
+add_action( 'bp_adminbar_menus', 'bp_adminbar_account_menu', 4 );
+
+if ( bp_core_is_multisite() )
+	add_action( 'bp_adminbar_menus', 'bp_adminbar_blogs_menu', 6 );
+
+add_action( 'bp_adminbar_menus', 'bp_adminbar_notifications_menu', 8 );
+
+if ( bp_core_is_multisite() )
+	add_action( 'bp_adminbar_menus', 'bp_adminbar_authors_menu', 12 );
+
+add_action( 'bp_adminbar_menus', 'bp_adminbar_random_menu', 100 );
+
+add_action( 'wp_footer', 'bp_core_admin_bar', 8 );
+add_action( 'admin_footer', 'bp_core_admin_bar' );
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-avatars.php b/wp-content/plugins/buddypress/bp-core/bp-core-avatars.php
new file mode 100644
index 0000000000000000000000000000000000000000..32acfd4b04f7e2a592d8ff2ee35a8e472f647259
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-core/bp-core-avatars.php
@@ -0,0 +1,575 @@
+<?php
+/*
+ Based on contributions from: Beau Lebens - http://www.dentedreality.com.au/
+ Modified for BuddyPress by: Andy Peatling - http://apeatling.wordpress.com/
+*/
+
+/***
+ * Set up the constants we need for avatar support
+ */
+function bp_core_set_avatar_constants() {
+	global $bp;
+
+	if ( !defined( 'BP_AVATAR_UPLOAD_PATH' ) )
+		define( 'BP_AVATAR_UPLOAD_PATH', bp_core_avatar_upload_path() );
+
+	if ( !defined( 'BP_AVATAR_URL' ) )
+		define( 'BP_AVATAR_URL', bp_core_avatar_url() );
+
+	if ( !defined( 'BP_AVATAR_THUMB_WIDTH' ) )
+		define( 'BP_AVATAR_THUMB_WIDTH', 50 );
+
+	if ( !defined( 'BP_AVATAR_THUMB_HEIGHT' ) )
+		define( 'BP_AVATAR_THUMB_HEIGHT', 50 );
+
+	if ( !defined( 'BP_AVATAR_FULL_WIDTH' ) )
+		define( 'BP_AVATAR_FULL_WIDTH', 150 );
+
+	if ( !defined( 'BP_AVATAR_FULL_HEIGHT' ) )
+		define( 'BP_AVATAR_FULL_HEIGHT', 150 );
+
+	if ( !defined( 'BP_AVATAR_ORIGINAL_MAX_WIDTH' ) )
+		define( 'BP_AVATAR_ORIGINAL_MAX_WIDTH', 450 );
+
+	if ( !defined( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE' ) ) {
+		if ( !$bp->site_options['fileupload_maxk'] )
+			define( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', 5120000 ); /* 5mb */
+		else
+			define( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', $bp->site_options['fileupload_maxk'] * 1024 );
+	}
+
+	if ( !defined( 'BP_AVATAR_DEFAULT' ) )
+		define( 'BP_AVATAR_DEFAULT', BP_PLUGIN_URL . '/bp-core/images/mystery-man.jpg' );
+
+	if ( !defined( 'BP_AVATAR_DEFAULT_THUMB' ) )
+		define( 'BP_AVATAR_DEFAULT_THUMB', BP_PLUGIN_URL . '/bp-core/images/mystery-man-50.jpg' );
+}
+add_action( 'bp_loaded', 'bp_core_set_avatar_constants', 8 );
+
+/**
+ * bp_core_fetch_avatar()
+ *
+ * Fetches an avatar from a BuddyPress object. Supports user/group/blog as
+ * default, but can be extended to include your own custom components too.
+ *
+ * @global object $bp
+ * @global object $current_blog
+ * @param array $args Determine the output of this function
+ * @return string Formatted HTML <img> element, or raw avatar URL based on $html arg
+ */
+function bp_core_fetch_avatar( $args = '' ) {
+	global $bp, $current_blog;
+
+	// Set a few default variables
+	$def_object		= 'user';
+	$def_type		= 'thumb';
+	$def_class		= 'avatar';
+	$def_alt		= __( 'Avatar Image', 'buddypress' );
+
+	// Set the default variables array
+	$defaults = array(
+		'item_id'		=> false,
+		'object'		=> $def_object,	// user/group/blog/custom type (if you use filters)
+		'type'			=> $def_type,	// thumb or full
+		'avatar_dir'	=> false,		// Specify a custom avatar directory for your object
+		'width'			=> false,		// Custom width (int)
+		'height'		=> false,		// Custom height (int)
+		'class'			=> $def_class,	// Custom <img> class (string)
+		'css_id'		=> false,		// Custom <img> ID (string)
+		'alt'			=> $def_alt,	// Custom <img> alt (string)
+		'email'			=> false,		// Pass the user email (for gravatar) to prevent querying the DB for it
+		'no_grav'		=> false,		// If there is no avatar found, return false instead of a grav?
+		'html'			=> true			// Wrap the return img URL in <img />
+	);
+
+	// Compare defaults to passed and extract
+	$params = wp_parse_args( $args, $defaults );
+	extract( $params, EXTR_SKIP );
+
+	// Set item_id if not passed
+	if ( !$item_id ) {
+		if ( 'user' == $object )
+			$item_id = $bp->displayed_user->id;
+		else if ( 'group' == $object )
+			$item_id = $bp->groups->current_group->id;
+		else if ( 'blog' == $object )
+			$item_id = $current_blog->id;
+
+		$item_id = apply_filters( 'bp_core_avatar_item_id', $item_id, $object );
+
+		if ( !$item_id ) return false;
+	}
+
+	// Set avatar_dir if not passed (uses $object)
+	if ( !$avatar_dir ) {
+		if ( 'user' == $object )
+			$avatar_dir = 'avatars';
+		else if ( 'group' == $object )
+			$avatar_dir = 'group-avatars';
+		else if ( 'blog' == $object )
+			$avatar_dir = 'blog-avatars';
+
+		$avatar_dir = apply_filters( 'bp_core_avatar_dir', $avatar_dir, $object );
+
+		if ( !$avatar_dir ) return false;
+	}
+
+	// Add an identifying class to each item
+	$class .= ' ' . $object . '-' . $item_id . '-avatar';
+
+	// Set CSS ID if passed
+	if ( !empty( $css_id ) )
+		$css_id = " id='{$css_id}'";
+
+	// Set avatar width
+	if ( $width )
+		$html_width = " width='{$width}'";
+	else
+		$html_width = ( 'thumb' == $type ) ? ' width="' . BP_AVATAR_THUMB_WIDTH . '"' : ' width="' . BP_AVATAR_FULL_WIDTH . '"';
+
+	// Set avatar height
+	if ( $height )
+		$html_height = " height='{$height}'";
+	else
+		$html_height = ( 'thumb' == $type ) ? ' height="' . BP_AVATAR_THUMB_HEIGHT . '"' : ' height="' . BP_AVATAR_FULL_HEIGHT . '"';
+
+	// Set avatar URL and DIR based on prepopulated constants
+	$avatar_folder_url = apply_filters( 'bp_core_avatar_folder_url', BP_AVATAR_URL . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );
+	$avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', BP_AVATAR_UPLOAD_PATH . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );
+
+	/****
+	 * Look for uploaded avatar first. Use it if it exists.
+	 * Set the file names to search for, to select the full size
+	 * or thumbnail image.
+	 */
+	$avatar_size = ( 'full' == $type ) ? '-bpfull' : '-bpthumb';
+	$legacy_user_avatar_name = ( 'full' == $type ) ? '-avatar2' : '-avatar1';
+	$legacy_group_avatar_name = ( 'full' == $type ) ? '-groupavatar-full' : '-groupavatar-thumb';
+
+	// Check for directory
+	if ( file_exists( $avatar_folder_dir ) ) {
+
+		// Open directory
+		if ( $av_dir = opendir( $avatar_folder_dir ) ) {
+
+			// Stash files in an array once to check for one that matches
+			$avatar_files = array();
+			while ( false !== ( $avatar_file = readdir($av_dir) ) ) {
+				// Only add files to the array (skip directories)
+				if ( 2 < strlen( $avatar_file ) )
+					$avatar_files[] = $avatar_file;
+			}
+
+			// Check for array
+			if ( 0 < count( $avatar_files ) ) {
+
+				// Check for current avatar
+				foreach( $avatar_files as $key => $value ) {
+					if ( strpos ( $value, $avatar_size )!== false )
+						$avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
+				}
+
+				// Legacy avatar check
+				if ( !isset( $avatar_url ) ) {
+					foreach( $avatar_files as $key => $value ) {
+						if ( strpos ( $value, $legacy_user_avatar_name )!== false )
+							$avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
+					}
+
+					// Legacy group avatar check
+					if ( !isset( $avatar_url ) ) {
+						foreach( $avatar_files as $key => $value ) {
+							if ( strpos ( $value, $legacy_group_avatar_name )!== false )
+								$avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
+						}
+					}
+				}
+			}
+		}
+
+		// Close the avatar directory
+		closedir( $av_dir );
+
+		// If we found a locally uploaded avatar
+		if ( $avatar_url ) {
+
+			// Return it wrapped in an <img> element
+			if ( true === $html ) {
+				return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $avatar_url . '" alt="' . $alt . '" class="' . $class . '"' . $css_id . $html_width . $html_height . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
+
+			// ...or only the URL
+			} else {
+				return apply_filters( 'bp_core_fetch_avatar_url', $avatar_url );
+			}
+		}
+	}
+
+	// If no avatars could be found, try to display a gravatar
+
+	// Skips gravatar check if $no_grav is passed
+	if ( !$no_grav ) {
+
+		// Set gravatar size
+		if ( $width )
+			$grav_size = $width;
+		else if ( 'full' == $type )
+			$grav_size = BP_AVATAR_FULL_WIDTH;
+		else if ( 'thumb' == $type )
+			$grav_size = BP_AVATAR_THUMB_WIDTH;
+
+		// Set gravatar type
+		if ( empty( $bp->grav_default->{$object} ) )
+			$default_grav = 'wavatar';
+		else if ( 'mystery' == $bp->grav_default->{$object} )
+			$default_grav = apply_filters( 'bp_core_mysteryman_src', BP_AVATAR_DEFAULT, $grav_size );
+		else
+			$default_grav = $bp->grav_default->{$object};
+
+		// Set gravatar object
+		if ( empty( $email ) ) {
+			if ( 'user' == $object ) {
+				$email = bp_core_get_user_email( $item_id );
+			} else if ( 'group' == $object || 'blog' == $object ) {
+				$email = "{$item_id}-{$object}@{$bp->root_domain}";
+			}
+		}
+
+		// Set host based on if using ssl
+		if ( is_ssl() )
+			$host = 'https://secure.gravatar.com/avatar/';
+		else
+			$host = 'http://www.gravatar.com/avatar/';
+
+		// Filter gravatar vars
+		$email		= apply_filters( 'bp_core_gravatar_email', $email, $item_id, $object );
+		$gravatar	= apply_filters( 'bp_gravatar_url', $host ) . md5( strtolower( $email ) ) . '?d=' . $default_grav . '&amp;s=' . $grav_size;
+
+		// Return gravatar wrapped in <img />
+		if ( true === $html )
+			return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $gravatar . '" alt="' . $alt . '" class="' . $class . '"' . $css_id . $html_width . $html_height . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
+
+		// ...or only return the gravatar URL
+		else
+			return apply_filters( 'bp_core_fetch_avatar_url', $gravatar );
+
+	} else {
+		return apply_filters( 'bp_core_fetch_avatar', false, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
+	}
+}
+
+function bp_core_delete_existing_avatar( $args = '' ) {
+	global $bp;
+
+	$defaults = array(
+		'item_id' => false,
+		'object' => 'user', // user OR group OR blog OR custom type (if you use filters)
+		'avatar_dir' => false
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	if ( !$item_id ) {
+		if ( 'user' == $object )
+			$item_id = $bp->displayed_user->id;
+		else if ( 'group' == $object )
+			$item_id = $bp->groups->current_group->id;
+		else if ( 'blog' == $object )
+			$item_id = $current_blog->id;
+
+		$item_id = apply_filters( 'bp_core_avatar_item_id', $item_id, $object );
+
+		if ( !$item_id ) return false;
+	}
+
+	if ( !$avatar_dir ) {
+		if ( 'user' == $object )
+			$avatar_dir = 'avatars';
+		else if ( 'group' == $object )
+			$avatar_dir = 'group-avatars';
+		else if ( 'blog' == $object )
+			$avatar_dir = 'blog-avatars';
+
+		$avatar_dir = apply_filters( 'bp_core_avatar_dir', $avatar_dir, $object );
+
+		if ( !$avatar_dir ) return false;
+	}
+
+	$avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', BP_AVATAR_UPLOAD_PATH . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );
+
+	if ( !file_exists( $avatar_folder_dir ) )
+		return false;
+
+	if ( $av_dir = opendir( $avatar_folder_dir ) ) {
+		while ( false !== ( $avatar_file = readdir($av_dir) ) ) {
+			if ( ( preg_match( "/-bpfull/", $avatar_file ) || preg_match( "/-bpthumb/", $avatar_file ) ) && '.' != $avatar_file && '..' != $avatar_file )
+				@unlink( $avatar_folder_dir . '/' . $avatar_file );
+		}
+	}
+	closedir($av_dir);
+
+	@rmdir( $avatar_folder_dir );
+
+	do_action( 'bp_core_delete_existing_avatar', $args );
+
+	return true;
+}
+
+function bp_core_avatar_handle_upload( $file, $upload_dir_filter ) {
+	global $bp;
+
+	/***
+	 * You may want to hook into this filter if you want to override this function.
+	 * Make sure you return false.
+	 */
+	if ( !apply_filters( 'bp_core_pre_avatar_handle_upload', true, $file, $upload_dir_filter ) )
+		return true;
+
+	require_once( ABSPATH . '/wp-admin/includes/image.php' );
+	require_once( ABSPATH . '/wp-admin/includes/file.php' );
+
+	$uploadErrors = array(
+		0 => __("There is no error, the file uploaded with success", 'buddypress'),
+		1 => __("Your image was bigger than the maximum allowed file size of: ", 'buddypress') . size_format(BP_AVATAR_ORIGINAL_MAX_FILESIZE),
+		2 => __("Your image was bigger than the maximum allowed file size of: ", 'buddypress') . size_format(BP_AVATAR_ORIGINAL_MAX_FILESIZE),
+		3 => __("The uploaded file was only partially uploaded", 'buddypress'),
+		4 => __("No file was uploaded", 'buddypress'),
+		6 => __("Missing a temporary folder", 'buddypress')
+	);
+
+	if ( !bp_core_check_avatar_upload( $file ) ) {
+		bp_core_add_message( sprintf( __( 'Your upload failed, please try again. Error was: %s', 'buddypress' ), $uploadErrors[$file['file']['error']] ), 'error' );
+		return false;
+	}
+
+	if ( !bp_core_check_avatar_size( $file ) ) {
+		bp_core_add_message( sprintf( __( 'The file you uploaded is too big. Please upload a file under %s', 'buddypress'), size_format(BP_AVATAR_ORIGINAL_MAX_FILESIZE) ), 'error' );
+		return false;
+	}
+
+	if ( !bp_core_check_avatar_type( $file ) ) {
+		bp_core_add_message( __( 'Please upload only JPG, GIF or PNG photos.', 'buddypress' ), 'error' );
+		return false;
+	}
+
+	/* Filter the upload location */
+	add_filter( 'upload_dir', $upload_dir_filter, 10, 0 );
+
+	$bp->avatar_admin->original = wp_handle_upload( $file['file'], array( 'action'=> 'bp_avatar_upload' ) );
+
+	/* Move the file to the correct upload location. */
+	if ( !empty( $bp->avatar_admin->original['error'] ) ) {
+		bp_core_add_message( sprintf( __( 'Upload Failed! Error was: %s', 'buddypress' ), $bp->avatar_admin->original['error'] ), 'error' );
+		return false;
+	}
+
+	/* Get image size */
+	$size = @getimagesize( $bp->avatar_admin->original['file'] );
+
+	/* Check image size and shrink if too large */
+	if ( $size[0] > BP_AVATAR_ORIGINAL_MAX_WIDTH ) {
+		$thumb = wp_create_thumbnail( $bp->avatar_admin->original['file'], BP_AVATAR_ORIGINAL_MAX_WIDTH );
+
+		/* Check for thumbnail creation errors */
+		if ( is_wp_error( $thumb ) ) {
+			bp_core_add_message( sprintf( __( 'Upload Failed! Error was: %s', 'buddypress' ), $thumb->get_error_message() ), 'error' );
+			return false;
+		}
+
+		/* Thumbnail is good so proceed */
+		$bp->avatar_admin->resized = $thumb;
+	}
+
+	/* We only want to handle one image after resize. */
+	if ( empty( $bp->avatar_admin->resized ) )
+		$bp->avatar_admin->image->dir = str_replace( BP_AVATAR_UPLOAD_PATH, '', $bp->avatar_admin->original['file'] );
+	else {
+		$bp->avatar_admin->image->dir = str_replace( BP_AVATAR_UPLOAD_PATH, '', $bp->avatar_admin->resized );
+		@unlink( $bp->avatar_admin->original['file'] );
+	}
+
+	/* Set the url value for the image */
+	$bp->avatar_admin->image->url = BP_AVATAR_URL . $bp->avatar_admin->image->dir;
+
+	return true;
+}
+
+function bp_core_avatar_handle_crop( $args = '' ) {
+	global $bp;
+
+	$defaults = array(
+		'object' => 'user',
+		'avatar_dir' => 'avatars',
+		'item_id' => false,
+		'original_file' => false,
+		'crop_w' => BP_AVATAR_FULL_WIDTH,
+		'crop_h' => BP_AVATAR_FULL_HEIGHT,
+		'crop_x' => 0,
+		'crop_y' => 0
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+
+	/***
+	 * You may want to hook into this filter if you want to override this function.
+	 * Make sure you return false.
+	 */
+	if ( !apply_filters( 'bp_core_pre_avatar_handle_crop', true, $r ) )
+		return true;
+
+	extract( $r, EXTR_SKIP );
+
+	if ( !$original_file )
+		return false;
+
+	$original_file = BP_AVATAR_UPLOAD_PATH . $original_file;
+
+	if ( !file_exists( $original_file ) )
+		return false;
+
+	if ( !$item_id )
+		$avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', dirname( $original_file ), $item_id, $object, $avatar_dir );
+	else
+		$avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', BP_AVATAR_UPLOAD_PATH . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );
+
+	if ( !file_exists( $avatar_folder_dir ) )
+		return false;
+
+	require_once( ABSPATH . '/wp-admin/includes/image.php' );
+	require_once( ABSPATH . '/wp-admin/includes/file.php' );
+
+	/* Delete the existing avatar files for the object */
+	bp_core_delete_existing_avatar( array( 'object' => $object, 'avatar_path' => $avatar_folder_dir ) );
+
+	/* Make sure we at least have a width and height for cropping */
+	if ( !(int)$crop_w )
+		$crop_w = BP_AVATAR_FULL_WIDTH;
+
+	if ( !(int)$crop_h )
+		$crop_h = BP_AVATAR_FULL_HEIGHT;
+
+	/* Set the full and thumb filenames */
+	$full_filename = wp_hash( $original_file . time() ) . '-bpfull.jpg';
+	$thumb_filename = wp_hash( $original_file . time() ) . '-bpthumb.jpg';
+
+	/* Crop the image */
+	$full_cropped = wp_crop_image( $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, BP_AVATAR_FULL_WIDTH, BP_AVATAR_FULL_HEIGHT, false, $avatar_folder_dir . '/' . $full_filename );
+	$thumb_cropped = wp_crop_image( $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, BP_AVATAR_THUMB_WIDTH, BP_AVATAR_THUMB_HEIGHT, false, $avatar_folder_dir . '/' . $thumb_filename );
+
+	/* Remove the original */
+	@unlink( $original_file );
+
+	return true;
+}
+
+/**
+ * bp_core_fetch_avatar_filter()
+ *
+ * Attempts to filter get_avatar function and let BuddyPress have a go
+ * at finding an avatar that may have been uploaded locally.
+ *
+ * @global array $authordata
+ * @param string $avatar The result of get_avatar from before-filter
+ * @param int|string|object $user A user ID, email address, or comment object
+ * @param int $size Size of the avatar image (thumb/full)
+ * @param string $default URL to a default image to use if no avatar is available
+ * @param string $alt Alternate text to use in image tag. Defaults to blank
+ * @return <type>
+ */
+function bp_core_fetch_avatar_filter( $avatar, $user, $size, $default, $alt ) {
+	global $pagenow;
+	
+	// Do not filter if inside WordPress options page
+	if ( 'options-discussion.php' == $pagenow )
+		return $avatar;
+	
+	// If passed an object, assume $user->user_id
+	if ( is_object( $user ) )
+		$id = $user->user_id;
+
+	// If passed a number, assume it was a $user_id
+	else if ( is_numeric( $user ) )
+		$id = $user;
+
+	// If passed a string and that string returns a user, get the $id
+	else if ( is_string( $user ) && ( $user_by_email = get_user_by_email( $user ) ) )
+		$id = $user_by_email->ID;
+
+	// If somehow $id hasn't been assigned, return the result of get_avatar
+	if ( empty( $id ) )
+		return !empty( $avatar ) ? $avatar : $default;
+
+	// Let BuddyPress handle the fetching of the avatar
+	$bp_avatar = bp_core_fetch_avatar( array( 'item_id' => $id, 'width' => $size, 'height' => $size, 'alt' => $alt ) );
+
+	// If BuddyPress found an avatar, use it. If not, use the result of get_avatar
+	return ( !$bp_avatar ) ? $avatar : $bp_avatar;
+}
+add_filter( 'get_avatar', 'bp_core_fetch_avatar_filter', 10, 5 );
+
+function bp_core_check_avatar_upload($file) {
+	if ( $file['error'] )
+		return false;
+
+	return true;
+}
+
+function bp_core_check_avatar_size($file) {
+	if ( $file['file']['size'] > BP_AVATAR_ORIGINAL_MAX_FILESIZE )
+		return false;
+
+	return true;
+}
+
+function bp_core_check_avatar_type($file) {
+	if ( ( strlen($file['file']['type']) && !preg_match('/(jpe?g|gif|png)$/', $file['file']['type'] ) ) && !preg_match( '/(jpe?g|gif|png)$/', $file['file']['name'] ) )
+		return false;
+
+	return true;
+}
+
+/**
+ * bp_core_avatar_upload_path()
+ *
+ * Returns the absolute upload path for the WP installation
+ *
+ * @global object $current_blog Current blog information
+ * @uses wp_upload_dir To get upload directory info
+ * @return string Absolute path to WP upload directory
+ */
+function bp_core_avatar_upload_path() {
+	global $current_blog;
+
+	// Get upload directory information from current site
+	$upload_dir = wp_upload_dir();
+
+	// If multisite, and current blog does not match root blog, make adjustments
+	if ( bp_core_is_multisite() && BP_ROOT_BLOG != $current_blog->blog_id )
+		$upload_dir['basedir'] = get_blog_option( BP_ROOT_BLOG, 'upload_path' );
+
+	return apply_filters( 'bp_core_avatar_upload_path', $upload_dir['basedir'] );
+}
+
+/**
+ * bp_core_avatar_url()
+ *
+ * Returns the raw base URL for root site upload location
+ *
+ * @global object $current_blog Current blog information
+ * @uses wp_upload_dir To get upload directory info
+ * @return string Full URL to current upload location
+ */
+function bp_core_avatar_url() {
+	global $current_blog;
+
+	// Get upload directory information from current site
+	$upload_dir = wp_upload_dir();
+
+	// If multisite, and current blog does not match root blog, make adjustments
+	if ( bp_core_is_multisite() && BP_ROOT_BLOG != $current_blog->blog_id )
+		$upload_dir['baseurl'] = str_replace( get_blog_option( $current_blog->blog_id, 'home' ) , get_blog_option( BP_ROOT_BLOG, 'home' ), $upload_dir['baseurl'] );
+
+	return apply_filters( 'bp_core_avatar_url', $upload_dir['baseurl'] );
+}
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-catchuri.php b/wp-content/plugins/buddypress/bp-core/bp-core-catchuri.php
new file mode 100644
index 0000000000000000000000000000000000000000..7678e3d8eaf4f9ebe180b759c1780e989ddc1f78
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-core/bp-core-catchuri.php
@@ -0,0 +1,301 @@
+<?php
+/*
+Based on contributions from: Chris Taylor - http://www.stillbreathing.co.uk/
+Modified for BuddyPress by: Andy Peatling - http://apeatling.wordpress.com/
+*/
+
+/**
+ * bp_core_set_uri_globals()
+ *
+ * Analyzes the URI structure and breaks it down into parts for use in code.
+ * The idea is that BuddyPress can use complete custom friendly URI's without the
+ * user having to add new re-write rules.
+ *
+ * Future custom components would then be able to use their own custom URI structure.
+ *
+ * The URI's are broken down as follows:
+ *   - http:// domain.com / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
+ *   - OUTSIDE ROOT: http:// domain.com / sites / buddypress / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
+ *
+ *	Example:
+ *    - http://domain.com/members/andy/profile/edit/group/5/
+ *    - $bp->current_component: string 'profile'
+ *    - $bp->current_action: string 'edit'
+ *    - $bp->action_variables: array ['group', 5]
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_set_uri_globals() {
+	global $current_component, $current_action, $action_variables;
+	global $displayed_user_id;
+	global $is_member_page;
+	global $bp_unfiltered_uri;
+	global $bp, $current_blog;
+
+	// Only catch URI's on the root blog if we are not running BP on multiple blogs
+	if ( !defined( 'BP_ENABLE_MULTIBLOG' ) && bp_core_is_multisite() )
+		if ( BP_ROOT_BLOG != (int) $current_blog->blog_id )
+			return false;
+
+	// Ajax or not?
+	if ( strpos( $_SERVER['REQUEST_URI'], 'wp-load.php' ) )
+		$path = bp_core_referrer();
+	else
+		$path = esc_url( $_SERVER['REQUEST_URI'] );
+
+	$path = apply_filters( 'bp_uri', $path );
+
+	// 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;
+
+	// Fetch the current URI and explode each part separated by '/' into an array
+	$bp_uri = explode( '/', $path );
+
+	// Loop and remove empties
+	foreach ( (array)$bp_uri as $key => $uri_chunk )
+		if ( empty( $bp_uri[$key] ) ) unset( $bp_uri[$key] );
+
+	// 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;
+
+	// If this is a WordPress page, return from the function.
+	if ( is_page( $bp_uri[$component_index] ) )
+		return false;
+
+	// Get site path items
+	$paths = explode( '/', bp_core_get_site_path() );
+
+	// Take empties off the end of path
+	if ( empty( $paths[count($paths) - 1] ) )
+		array_pop( $paths );
+
+	// Take empties off the start of path
+	if ( empty( $paths[0] ) )
+		array_shift( $paths );
+
+	foreach ( (array)$bp_uri as $key => $uri_chunk )
+		if ( in_array( $uri_chunk, $paths ))
+			unset( $bp_uri[$key] );
+
+	// Reset the keys by merging with an empty array
+	$bp_uri            = array_merge( array(), $bp_uri );
+	$bp_unfiltered_uri = $bp_uri;
+
+	// If we are under anything with a members slug, set the correct globals
+	if ( $bp_uri[0] == BP_MEMBERS_SLUG ) {
+		$is_member_page    = true;
+		$is_root_component = true;
+	}
+
+	// Catch a member page and set the current member ID
+	if ( !defined( 'BP_ENABLE_ROOT_PROFILES' ) ) {
+		if ( ( $bp_uri[0] == BP_MEMBERS_SLUG && !empty( $bp_uri[1] ) ) || in_array( 'wp-load.php', $bp_uri ) ) {
+			// We are within a member page, set up user id globals
+			if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
+				$displayed_user_id = bp_core_get_userid( urldecode( $bp_uri[1] ) );
+			else
+				$displayed_user_id = bp_core_get_userid_from_nicename( urldecode( $bp_uri[1] ) );
+
+			unset( $bp_uri[0] );
+			unset( $bp_uri[1] );
+
+			// Reset the keys by merging with an empty array
+			$bp_uri = array_merge( array(), $bp_uri );
+		}
+	} else {
+		if ( get_userdatabylogin( $bp_uri[0] ) || in_array( 'wp-load.php', $bp_uri ) ) {
+			$is_member_page    = true;
+			$is_root_component = true;
+
+			// We are within a member page, set up user id globals
+			if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
+				$displayed_user_id = bp_core_get_userid( urldecode( $bp_uri[0] ) );
+			else
+				$displayed_user_id = bp_core_get_userid_from_nicename( urldecode( $bp_uri[0] ) );
+
+			unset( $bp_uri[0] );
+
+			// Reset the keys by merging with an empty array
+			$bp_uri = array_merge( array(), $bp_uri );
+		}
+	}
+
+	if ( !isset( $is_root_component ) )
+		$is_root_component = in_array( $bp_uri[0], $bp->root_components );
+
+	if ( !is_subdomain_install() && !$is_root_component ) {
+		$component_index++;
+		$action_index++;
+	}
+
+	// Set the current component
+	$current_component = $bp_uri[$component_index];
+
+	// Set the current action
+	$current_action    = $bp_uri[$action_index];
+
+	// Set the entire URI as the action variables, we will unset the current_component and action in a second
+	$action_variables  = $bp_uri;
+
+	// Unset the current_component and action from action_variables
+	unset( $action_variables[$component_index] );
+	unset( $action_variables[$action_index] );
+
+	// Remove the username from action variables if this is not a VHOST install
+	if ( !is_subdomain_install() && !$is_root_component )
+		array_shift( $action_variables );
+
+	// Reset the keys by merging with an empty array
+	$action_variables = array_merge( array(), $action_variables );
+}
+add_action( 'bp_loaded', 'bp_core_set_uri_globals', 4 );
+
+/**
+ * bp_catch_uri()
+ *
+ * Takes either a single page name or array of page names and
+ * loads the first template file that can be found.
+ *
+ * Please don't call this function directly anymore, use: bp_core_load_template()
+ *
+ * @package BuddyPress Core
+ * @global $bp_path BuddyPress global containing the template file names to use.
+ * @param $pages Template file names to use.
+ * @uses add_action() Hooks a function on to a specific action
+ */
+function bp_catch_uri( $pages, $skip_blog_check = false ) {
+	global $bp_path, $bp_skip_blog_check;
+
+	$bp_skip_blog_check = $skip_blog_check;
+
+	$bp_path = $pages;
+
+	if ( !bp_is_blog_page() ) {
+		remove_action( 'template_redirect', 'redirect_canonical' );
+	}
+	add_action( 'template_redirect', 'bp_core_do_catch_uri', 2 );
+}
+
+/**
+ * bp_core_do_catch_uri()
+ *
+ * Loads the first template file found based on the $bp_path global.
+ *
+ * @package BuddyPress Core
+ * @global $bp_path BuddyPress global containing the template file names to use.
+ */
+function bp_core_do_catch_uri() {
+	global $bp_path, $bp, $wpdb;
+	global $current_blog, $bp_skip_blog_check;
+	global $bp_no_status_set;
+	global $wp_query;
+
+	/* Can be a single template or an array of templates */
+	$templates = $bp_path;
+
+	/* Don't hijack any URLs on blog pages */
+	if ( bp_is_blog_page() ) {
+		if ( !$bp_skip_blog_check )
+			return false;
+	} else {
+		$wp_query->is_home = false;
+	}
+
+	/* Make sure this is not reported as a 404 */
+	if ( !$bp_no_status_set ) {
+		status_header( 200 );
+		$wp_query->is_404 = false;
+		$wp_query->is_page = true;
+	}
+
+	foreach ( (array)$templates as $template )
+		$filtered_templates[] = $template . '.php';
+
+	if ( $located_template = apply_filters( 'bp_located_template', locate_template( (array) $filtered_templates, false ), $filtered_templates ) ) {
+		load_template( apply_filters( 'bp_load_template', $located_template ) );
+	} else {
+		if ( $located_template = locate_template( array( '404.php' ) ) ) {
+			status_header( 404 );
+			load_template( $located_template );
+		} else
+			bp_core_redirect( $bp->root_domain );
+	}
+	die;
+}
+
+function bp_core_catch_no_access() {
+	global $bp, $bp_path, $bp_unfiltered_uri, $bp_no_status_set;
+
+	// If bp_core_redirect() and $bp_no_status_set is true,
+	// we are redirecting to an accessable page, so skip this check.
+	if ( $bp_no_status_set )
+		return false;
+
+	/* If this user has been marked as a spammer and the logged in user is not a site admin, redirect. */
+	if ( isset( $bp->displayed_user->id ) && bp_core_is_user_spammer( $bp->displayed_user->id ) ) {
+		if ( !is_super_admin() )
+			bp_core_redirect( $bp->root_domain );
+		else
+			bp_core_add_message( __( 'This user has been marked as a spammer. Only site admins can view this profile.', 'buddypress' ), 'error' );
+	}
+
+	// If this user does not exist, redirect to the root domain.
+	if ( !$bp->displayed_user->id && $bp_unfiltered_uri[0] == BP_MEMBERS_SLUG && isset($bp_unfiltered_uri[1]) )
+		bp_core_redirect( $bp->root_domain );
+
+	// Add .php to all options in $bp_path
+	foreach( (array) $bp_path as $template )
+		$filtered_templates[] = "$template.php";
+
+	// If the template file doesn't exist, redirect to the root domain.
+	if ( !bp_is_blog_page() && !file_exists( apply_filters( 'bp_located_template', locate_template( $filtered_templates, false ), $filtered_templates ) ) ) 
+		bp_core_redirect( $bp->root_domain );
+
+	if ( !$bp_path && !bp_is_blog_page() ) {
+		if ( is_user_logged_in() ) {
+			wp_redirect( $bp->root_domain );
+		} else {
+			wp_redirect( site_url( 'wp-login.php?redirect_to=' . site_url() . $_SERVER['REQUEST_URI'] ) );
+		}
+	}
+}
+add_action( 'wp', 'bp_core_catch_no_access' );
+
+/**
+ * bp_core_catch_profile_uri()
+ *
+ * If the extended profiles component is not installed we still need
+ * to catch the /profile URI's and display whatever we have installed.
+ *
+ */
+function bp_core_catch_profile_uri() {
+	global $bp;
+
+	if ( !function_exists('xprofile_install') )
+		bp_core_load_template( apply_filters( 'bp_core_template_display_profile', 'members/single/home' ) );
+}
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-classes.php b/wp-content/plugins/buddypress/bp-core/bp-core-classes.php
new file mode 100644
index 0000000000000000000000000000000000000000..ab7ce396eeb865ca9be1c498f26df10737472098
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-core/bp-core-classes.php
@@ -0,0 +1,652 @@
+<?php
+/**
+ * BP_Core_User class can be used by any component. It will fetch useful
+ * details for any user when provided with a user_id.
+ *
+ * Example:
+ *    $user = new BP_Core_User( $user_id );
+ *    $user_avatar = $user->avatar;
+ *	  $user_email = $user->email;
+ *    $user_status = $user->status;
+ *    etc.
+ *
+ * @package BuddyPress Core
+ */
+class BP_Core_User {
+	var $id;
+	var $avatar;
+	var $avatar_thumb;
+	var $avatar_mini;
+	var $fullname;
+	var $email;
+
+	var $user_url;
+	var $user_link;
+
+	var $last_active;
+
+	/* Extras */
+	var $total_friends;
+	var $total_blogs;
+	var $total_groups;
+
+	function bp_core_user( $user_id, $populate_extras = false ) {
+		if ( $user_id ) {
+			$this->id = $user_id;
+			$this->populate();
+
+			if ( $populate_extras )
+				$this->populate_extras();
+		}
+	}
+
+	/**
+	 * populate()
+	 *
+	 * Populate the instantiated class with data based on the User ID provided.
+	 *
+	 * @package BuddyPress Core
+ 	 * @global $userdata WordPress user data for the current logged in user.
+	 * @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_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.
+	 */
+	function populate() {
+		if ( function_exists( 'xprofile_install' ) )
+			$this->profile_data = $this->get_profile_data();
+
+		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 = 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 = 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 = 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 */
+		wp_cache_set( 'bp_user_fullname_' . $this->id, $this->fullname, 'bp' );
+		wp_cache_set( 'bp_user_email_' . $this->id, $this->email, 'bp' );
+		wp_cache_set( 'bp_user_url_' . $this->id, $this->user_url, 'bp' );
+
+		$this->avatar = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'full' ) );
+		$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_user_meta( $this->id, 'last_activity', true ), __( 'active %s ago', 'buddypress' ) );
+	}
+
+	function populate_extras() {
+		global $bp;
+
+		if ( function_exists('friends_install') )
+			$this->total_friends = BP_Friends_Friendship::total_friend_count( $this->id );
+
+		if ( function_exists('groups_install') ) {
+			$this->total_groups = BP_Groups_Member::total_group_count( $this->id );
+
+			if ( $this->total_groups ) {
+				if ( 1 == $this->total_groups )
+					$this->total_groups .= ' ' . __( 'group', 'buddypress' );
+				else
+					$this->total_groups .= ' ' . __( 'groups', 'buddypress' );
+			}
+		}
+	}
+
+	function get_profile_data() {
+		return BP_XProfile_ProfileData::get_all_for_user( $this->id );
+	}
+
+	/* Static Functions */
+
+	function get_users( $type, $limit = null, $page = 1, $user_id = false, $include = false, $search_terms = false, $populate_extras = true ) {
+		global $wpdb, $bp;
+
+		$sql = array();
+
+		$sql['select_main'] = "SELECT DISTINCT u.ID as id, u.user_registered, u.user_nicename, u.user_login, u.display_name, u.user_email";
+
+		if ( 'active' == $type || 'online' == $type )
+			$sql['select_active'] = ", um.meta_value as last_activity";
+
+		if ( 'popular' == $type )
+			$sql['select_popular'] = ", um.meta_value as total_friend_count";
+
+		if ( 'alphabetical' == $type )
+			$sql['select_alpha'] = ", pd.value as fullname";
+
+		$sql['from'] = "FROM " . CUSTOM_USER_TABLE . " u LEFT JOIN " . CUSTOM_USER_META_TABLE . " um ON um.user_id = u.ID";
+
+		if ( $search_terms && function_exists( 'xprofile_install' ) || 'alphabetical' == $type )
+			$sql['join_profiledata'] = "LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id";
+
+		$sql['where'] = 'WHERE ' . bp_core_get_status_sql( 'u.' );
+
+		if ( 'active' == $type || 'online' == $type )
+			$sql['where_active'] = "AND um.meta_key = 'last_activity'";
+
+		if ( 'popular' == $type )
+			$sql['where_popular'] = "AND um.meta_key = 'total_friend_count'";
+
+		if ( 'online' == $type )
+			$sql['where_online'] = "AND DATE_ADD( um.meta_value, INTERVAL 5 MINUTE ) >= UTC_TIMESTAMP()";
+
+		if ( 'alphabetical' == $type )
+			$sql['where_alpha'] = "AND pd.field_id = 1";
+
+		if ( $include ) {
+			if ( is_array( $include ) )
+				$uids = $wpdb->escape( implode( ',', (array)$include ) );
+			else
+				$uids = $wpdb->escape( $include );
+
+			if ( !empty( $uids ) )
+				$sql['where_users'] = "AND u.ID IN ({$uids})";
+		}
+
+		else if ( $user_id && function_exists( 'friends_install' ) ) {
+			$friend_ids = friends_get_friend_user_ids( $user_id );
+			$friend_ids = $wpdb->escape( implode( ',', (array)$friend_ids ) );
+
+			if ( !empty( $friend_ids ) )
+				$sql['where_friends'] = "AND u.ID IN ({$friend_ids})";
+			else {
+				/* User has no friends, return false since there will be no users to fetch. */
+				return false;
+			}
+		}
+
+		if ( $search_terms && function_exists( 'xprofile_install' ) ) {
+			$search_terms = like_escape( $wpdb->escape( $search_terms ) );
+			$sql['where_searchterms'] = "AND pd.value LIKE '%%$search_terms%%'";
+		}
+
+		switch ( $type ) {
+			case 'active': case 'online': default:
+				$sql[] = "ORDER BY um.meta_value DESC";
+				break;
+			case 'newest':
+				$sql[] = "ORDER BY u.user_registered DESC";
+				break;
+			case 'alphabetical':
+				$sql[] = "ORDER BY pd.value ASC";
+				break;
+			case 'random':
+				$sql[] = "ORDER BY rand()";
+				break;
+			case 'popular':
+				$sql[] = "ORDER BY CONVERT(um.meta_value, SIGNED) DESC";
+				break;
+		}
+
+		if ( $limit && $page )
+			$sql['pagination'] = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		/* Get paginated results */
+		$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'] );
+
+		if ( !empty( $sql['select_active'] ) )
+			unset( $sql['select_active'] );
+
+		if ( !empty( $sql['select_popular'] ) )
+			unset( $sql['select_popular'] );
+
+		if ( !empty( $sql['select_alpha'] ) )
+			unset( $sql['select_alpha'] );
+
+		if ( !empty( $sql['pagination'] ) )
+			unset( $sql['pagination'] );
+
+		array_unshift( $sql, "SELECT COUNT(DISTINCT u.ID)" );
+
+		/* Get total user results */
+		$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.
+		 * We can't add these to the main query above since only users who have this information will be returned (since the much of the data is in usermeta and won't support any type of directional join)
+		 */
+		if ( $populate_extras ) {
+			foreach ( (array)$paged_users as $user )
+				$user_ids[] = $user->id;
+
+			$user_ids = $wpdb->escape( join( ',', (array)$user_ids ) );
+
+			/* Add additional data to the returned results */
+			$paged_users = BP_Core_User::get_user_extras( &$paged_users, $user_ids, $type );
+		}
+
+		return array( 'users' => $paged_users, 'total' => $total_users );
+	}
+
+	function get_users_by_letter( $letter, $limit = null, $page = 1, $populate_extras = true ) {
+		global $wpdb, $bp;
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		// 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.' );
+
+		$total_users_sql = apply_filters( 'bp_core_users_by_letter_count_sql', $wpdb->prepare( "SELECT COUNT(DISTINCT u.ID) FROM " . CUSTOM_USER_TABLE . " u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id LEFT JOIN {$bp->profile->table_name_fields} pf ON pd.field_id = pf.id WHERE {$status_sql} AND pf.name = %s AND pd.value LIKE '$letter%%' ORDER BY pd.value ASC", BP_XPROFILE_FULLNAME_FIELD_NAME ), $letter );
+		$paged_users_sql = apply_filters( 'bp_core_users_by_letter_sql', $wpdb->prepare( "SELECT DISTINCT u.ID as id, u.user_registered, u.user_nicename, u.user_login, u.user_email FROM " . CUSTOM_USER_TABLE . " u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id LEFT JOIN {$bp->profile->table_name_fields} pf ON pd.field_id = pf.id WHERE {$status_sql} AND pf.name = %s AND pd.value LIKE '$letter%%' ORDER BY pd.value ASC{$pag_sql}", BP_XPROFILE_FULLNAME_FIELD_NAME ), $letter, $pag_sql );
+
+		$total_users = $wpdb->get_var( $total_users_sql );
+		$paged_users = $wpdb->get_results( $paged_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.
+		 * We can't add these to the main query above since only users who have this information will be returned (since the much of the data is in usermeta and won't support any type of directional join)
+		 */
+		foreach ( (array)$paged_users as $user )
+			$user_ids[] = $user->id;
+
+		$user_ids = $wpdb->escape( join( ',', (array)$user_ids ) );
+
+		/* Add additional data to the returned results */
+		if ( $populate_extras )
+			$paged_users = BP_Core_User::get_user_extras( &$paged_users, &$user_ids );
+
+		return array( 'users' => $paged_users, 'total' => $total_users );
+	}
+
+	function search_users( $search_terms, $limit = null, $page = 1, $populate_extras = true ) {
+		global $wpdb, $bp;
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		$search_terms = like_escape( $wpdb->escape( $search_terms ) );
+		$status_sql = bp_core_get_status_sql( 'u.' );
+
+		$total_users_sql = apply_filters( 'bp_core_search_users_count_sql', "SELECT COUNT(DISTINCT u.ID) as id FROM " . CUSTOM_USER_TABLE . " u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id WHERE {$status_sql} AND pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC", $search_terms );
+		$paged_users_sql = apply_filters( 'bp_core_search_users_sql', "SELECT DISTINCT u.ID as id, u.user_registered, u.user_nicename, u.user_login, u.user_email FROM " . CUSTOM_USER_TABLE . " u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id WHERE {$status_sql} AND pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC{$pag_sql}", $search_terms, $pag_sql );
+
+		$total_users = $wpdb->get_var( $total_users_sql );
+		$paged_users = $wpdb->get_results( $paged_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.
+		 * We can't add these to the main query above since only users who have this information will be returned (since the much of the data is in usermeta and won't support any type of directional join)
+		 */
+		foreach ( (array)$paged_users as $user )
+			$user_ids[] = $user->id;
+
+		$user_ids = $wpdb->escape( join( ',', (array)$user_ids ) );
+
+		/* Add additional data to the returned results */
+		if ( $populate_extras )
+			$paged_users = BP_Core_User::get_user_extras( &$paged_users, &$user_ids );
+
+		return array( 'users' => $paged_users, 'total' => $total_users );
+	}
+
+	function get_user_extras( $paged_users, $user_ids, $type = false ) {
+		global $bp, $wpdb;
+
+		if ( empty( $user_ids ) )
+			return $paged_users;
+
+		/* Fetch the user's full name */
+		if ( function_exists( 'xprofile_install' ) && 'alphabetical' != $type ) {
+			/* Ensure xprofile globals are set */
+			if ( !defined( 'BP_XPROFILE_FULLNAME_FIELD_NAME' ) )
+				xprofile_setup_globals();
+
+			$names = $wpdb->get_results( $wpdb->prepare( "SELECT pd.user_id as id, pd.value as fullname FROM {$bp->profile->table_name_fields} pf, {$bp->profile->table_name_data} pd WHERE pf.id = pd.field_id AND pf.name = %s AND pd.user_id IN ( {$user_ids} )", BP_XPROFILE_FULLNAME_FIELD_NAME ) );
+			for ( $i = 0; $i < count( $paged_users ); $i++ ) {
+				foreach ( (array)$names as $name ) {
+					if ( $name->id == $paged_users[$i]->id )
+						$paged_users[$i]->fullname = $name->fullname;
+				}
+			}
+		}
+
+		/* Fetch the user's total friend count */
+		if ( 'popular' != $type ) {
+			$friend_count = $wpdb->get_results( "SELECT user_id as id, meta_value as total_friend_count FROM " . CUSTOM_USER_META_TABLE . " WHERE meta_key = 'total_friend_count' AND user_id IN ( {$user_ids} )" );
+			for ( $i = 0; $i < count( $paged_users ); $i++ ) {
+				foreach ( (array)$friend_count as $count ) {
+					if ( $count->id == $paged_users[$i]->id )
+						$paged_users[$i]->total_friend_count = (int)$count->total_friend_count;
+				}
+			}
+		}
+
+		/* Fetch whether or not the user is a friend */
+		if ( function_exists( 'friends_install' ) ) {
+			$friend_status = $wpdb->get_results( $wpdb->prepare( "SELECT initiator_user_id, friend_user_id, is_confirmed FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d AND friend_user_id IN ( {$user_ids} ) ) OR (initiator_user_id IN ( {$user_ids} ) AND friend_user_id = %d )", $bp->loggedin_user->id, $bp->loggedin_user->id ) );
+			for ( $i = 0; $i < count( $paged_users ); $i++ ) {
+				foreach ( (array)$friend_status as $status ) {
+					if ( $status->initiator_user_id == $paged_users[$i]->id || $status->friend_user_id == $paged_users[$i]->id )
+						$paged_users[$i]->is_friend = $status->is_confirmed;
+				}
+			}
+		}
+
+		if ( 'active' != $type ) {
+			$user_activity = $wpdb->get_results( "SELECT user_id as id, meta_value as last_activity FROM " . CUSTOM_USER_META_TABLE . " WHERE meta_key = 'last_activity' AND user_id IN ( {$user_ids} )" );
+			for ( $i = 0; $i < count( $paged_users ); $i++ ) {
+				foreach ( (array)$user_activity as $activity ) {
+					if ( $activity->id == $paged_users[$i]->id )
+						$paged_users[$i]->last_activity = $activity->last_activity;
+				}
+			}
+		}
+
+		/* Fetch the user's last_activity */
+		if ( 'active' != $type ) {
+			$user_activity = $wpdb->get_results( "SELECT user_id as id, meta_value as last_activity FROM " . CUSTOM_USER_META_TABLE . " WHERE meta_key = 'last_activity' AND user_id IN ( {$user_ids} )" );
+			for ( $i = 0; $i < count( $paged_users ); $i++ ) {
+				foreach ( (array)$user_activity as $activity ) {
+					if ( $activity->id == $paged_users[$i]->id )
+						$paged_users[$i]->last_activity = $activity->last_activity;
+				}
+			}
+		}
+
+		/* Fetch the user's latest update */
+		$user_update = $wpdb->get_results( "SELECT user_id as id, meta_value as latest_update FROM " . CUSTOM_USER_META_TABLE . " WHERE meta_key = 'bp_latest_update' AND user_id IN ( {$user_ids} )" );
+		for ( $i = 0; $i < count( $paged_users ); $i++ ) {
+			foreach ( (array)$user_update as $update ) {
+				if ( $update->id == $paged_users[$i]->id )
+					$paged_users[$i]->latest_update = $update->latest_update;
+			}
+		}
+
+		return $paged_users;
+	}
+
+	function get_core_userdata( $user_id ) {
+		global $wpdb;
+
+		if ( !$user = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE ID = %d LIMIT 1", $user_id ) ) )
+			return false;
+
+		return $user;
+	}
+}
+
+
+/**
+ * BP_Core_Notification class can be used by any component.
+ * It will handle the fetching, saving and deleting of a user notification.
+ *
+ * @package BuddyPress Core
+ */
+
+class BP_Core_Notification {
+	var $id;
+	var $item_id;
+	var $secondary_item_id = null;
+	var $user_id;
+	var $component_name;
+	var $component_action;
+	var $date_notified;
+	var $is_new;
+
+	function bp_core_notification( $id = false ) {
+		if ( $id ) {
+			$this->id = $id;
+			$this->populate();
+		}
+	}
+
+	function populate() {
+		global $wpdb, $bp;
+
+		if ( $notification = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->core->table_name_notifications} WHERE id = %d", $this->id ) ) ) {
+			$this->item_id = $notification->item_id;
+			$this->secondary_item_id = $notification->secondary_item_id;
+			$this->user_id = $notification->user_id;
+			$this->component_name = $notification->component_name;
+			$this->component_action = $notification->component_action;
+			$this->date_notified = $notification->date_notified;
+			$this->is_new = $notification->is_new;
+		}
+	}
+
+	function save() {
+		global $wpdb, $bp;
+
+		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 = %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, %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 ) )
+			return false;
+
+		$this->id = $wpdb->insert_id;
+		return true;
+	}
+
+	/* Static functions */
+
+	function check_access( $user_id, $notification_id ) {
+		global $wpdb, $bp;
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->core->table_name_notifications} WHERE id = %d AND user_id = %d", $notification_id, $user_id ) );
+	}
+
+	function get_all_for_user( $user_id ) {
+		global $wpdb, $bp;
+
+ 		return $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->core->table_name_notifications} WHERE user_id = %d AND is_new = 1", $user_id ) );
+	}
+
+	function delete_for_user_by_type( $user_id, $component_name, $component_action ) {
+		global $wpdb, $bp;
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE user_id = %d AND component_name = %s AND component_action = %s", $user_id, $component_name, $component_action ) );
+	}
+
+	function delete_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id ) {
+		global $wpdb, $bp;
+
+		if ( $secondary_item_id )
+			$secondary_item_sql = $wpdb->prepare( " AND secondary_item_id = %d", $secondary_item_id );
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE user_id = %d AND item_id = %d AND component_name = %s AND component_action = %s{$secondary_item_sql}", $user_id, $item_id, $component_name, $component_action ) );
+	}
+
+	function delete_from_user_by_type( $user_id, $component_name, $component_action ) {
+		global $wpdb, $bp;
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE item_id = %d AND component_name = %s AND component_action = %s", $user_id, $component_name, $component_action ) );
+	}
+
+	function delete_all_by_type( $item_id, $component_name, $component_action, $secondary_item_id ) {
+		global $wpdb, $bp;
+
+		if ( $component_action )
+			$component_action_sql = $wpdb->prepare( "AND component_action = %s", $component_action );
+
+		if ( $secondary_item_id )
+			$secondary_item_sql = $wpdb->prepare( "AND secondary_item_id = %d", $secondary_item_id );
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE item_id = %d AND component_name = %s {$component_action_sql} {$secondary_item_sql}", $item_id, $component_name ) );
+	}
+}
+
+/**
+ * BP_Button
+ *
+ * API to create BuddyPress buttons
+ *
+ * @package BuddyPress Core
+ * @since 1.2.6
+ */
+class BP_Button {
+
+	// Button properties
+	var $id;
+	var $component;
+	var $must_be_logged_in;
+	var $block_self;
+
+	// Wrapper div
+	var $wrapper_class;
+	var $wrapper_id;
+
+	// Button
+	var $link_href;
+	var $link_class;
+	var $link_id;
+	var $link_rel;
+	var $link_title;
+	var $link_text;
+
+	// HTML result
+	var $contents;
+
+	/**
+	 * bp_button()
+	 *
+	 * Builds the button based on passed parameters:
+	 *
+	 * component: Which component this button is for
+	 * must_be_logged_in: Button only appears for logged in users
+	 * block_self: Button will not appear when viewing your own profile.
+	 * wrapper_id: The DOM ID of the button wrapper
+	 * wrapper_class: The DOM class of the button wrapper
+	 * link_href: The destination link of the button
+	 * link_title: Title of the button
+	 * link_id: The DOM ID of the button
+	 * link_class: The DOM class of the button
+	 * link_rel: The DOM rel of the button
+	 * link_text: The contents of the button
+	 *
+	 * @param array $args
+	 * @return bool False if not allowed
+	 */
+	function bp_button( $args = '' ) {
+
+		$defaults = array(
+			'id'                => '',
+			'component'         => 'core',
+			'must_be_logged_in' => true,
+			'block_self'        => true,
+
+			'wrapper_id'        => '',
+			'wrapper_class'     => '',
+
+			'link_href'         => '',
+			'link_title'        => '',
+			'link_id'           => '',
+			'link_class'        => '',
+			'link_rel'          => '',
+			'link_text'         => '',
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		// Required button properties
+		$this->id                = $id;
+		$this->component         = $component;
+		$this->must_be_logged_in = (bool)$must_be_logged_in;
+		$this->block_self        = (bool)$block_self;
+
+		// $id and $component are required
+		if ( empty( $id ) || empty( $component ) )
+			return false;
+
+		// No button if component is not active
+		if ( !bp_is_active( $this->component ) )
+			return false;
+
+		// No button for guests if must be logged in
+		if ( true == $this->must_be_logged_in && !is_user_logged_in() )
+			return false;
+
+		// No button if viewing your own profile
+		if ( true == $this->block_self && bp_is_my_profile() )
+			return false;
+
+		// Wrapper properties
+		if ( !empty( $wrapper_id ) )
+			$this->wrapper_id    = ' id="' . $wrapper_id . '"';
+
+		if ( !empty( $wrapper_class ) )
+			$this->wrapper_class = ' class="generic-button ' . $wrapper_class . '"';
+		else
+			$this->wrapper_class = ' class="generic-button"';
+
+		// Link properties
+		if ( !empty( $link_id ) )
+			$this->link_id       = ' id="' . $link_id . '"';
+
+		if ( !empty( $link_href ) )
+			$this->link_href     = ' href="' . $link_href . '"';
+
+		if ( !empty( $link_title ) )
+			$this->link_title    = ' title="' . $link_title . '"';
+
+		if ( !empty( $link_rel ) )
+			$this->link_rel      = ' rel="' . $link_rel . '"';
+
+		if ( !empty( $link_class ) )
+			$this->link_class    = ' class="' . $link_class . '"';
+
+		if ( !empty( $link_text ) )
+			$this->link_text     = $link_text;
+
+		// Build the button
+		$this->contents  = '<div' . $this->wrapper_class . $this->wrapper_id . '>';
+		$this->contents .= '<a'. $this->link_href . $this->link_title . $this->link_id . $this->link_rel . $this->link_class . '>' . $this->link_text . '</a>';
+		$this->contents .= '</div>';
+
+		// Allow button to be manipulated externally
+		$this->contents = apply_filters( 'bp_button_' . $component . '_' . $id, $this->contents, $this );
+	}
+
+	/**
+	 * contents()
+	 *
+	 * Return contents of button
+	 *
+	 * @return string
+	 */
+	function contents() {
+		return $this->contents;
+	}
+
+	/**
+	 * display()
+	 *
+	 * Output contents of button
+	 */
+	function display() {
+		if ( !empty( $this->contents ) )
+			echo $this->contents;
+	}
+}
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-cssjs.php b/wp-content/plugins/buddypress/bp-core/bp-core-cssjs.php
new file mode 100644
index 0000000000000000000000000000000000000000..12c3b154c03e1818b9b1e39f578bb4780082cb3c
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-core/bp-core-cssjs.php
@@ -0,0 +1,176 @@
+<?php
+
+/**
+ * bp_core_add_admin_bar_css()
+ *
+ * Add the CSS needed for the admin bar on blogs (other than the root) and in the admin area.
+ *
+ * @package BuddyPress Core
+ * @uses get_option() Selects a site setting from the DB.
+ */
+function bp_core_add_admin_bar_css() {
+	global $bp, $current_blog;
+
+	if ( defined( 'BP_DISABLE_ADMIN_BAR' ) )
+		return false;
+
+	if ( ( bp_core_is_multisite() && $current_blog->blog_id != BP_ROOT_BLOG ) || is_admin() ) {
+		$stylesheet = get_blog_option( BP_ROOT_BLOG, 'stylesheet' );
+
+		if ( file_exists( WP_CONTENT_DIR . '/themes/' . $stylesheet . '/_inc/css/adminbar.css' ) )
+			wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_admin_bar_css', WP_CONTENT_URL . '/themes/' . $stylesheet . '/_inc/css/adminbar.css' ) );
+		else
+			wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_admin_bar_css', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/css/adminbar.css' ) );
+	}
+}
+add_action( 'init', 'bp_core_add_admin_bar_css' );
+
+/**
+ * bp_core_admin_menu_icon_css()
+ *
+ * Add a hover-able icon to the "BuddyPress" wp-admin area menu.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_admin_menu_icon_css() {
+	global $bp;
+?>
+
+	<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, 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>
+
+<?php
+}
+add_action( 'admin_head', 'bp_core_admin_menu_icon_css' );
+
+function bp_core_confirmation_js() {
+	global $current_blog;
+
+	if ( bp_core_is_multisite() && $current_blog->blog_id != BP_ROOT_BLOG )
+		return false;
+?>
+
+	<script type="text/javascript"> jQuery(document).ready( function() { jQuery("a.confirm").click( function() { if ( confirm( '<?php _e( 'Are you sure?', 'buddypress' ) ?>' ) ) return true; else return false; }); });</script>
+
+<?php
+}
+add_action( 'wp_head', 'bp_core_confirmation_js', 100 );
+
+/**
+ * bp_core_add_jquery_cropper()
+ *
+ * Makes sure the jQuery jCrop library is loaded.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_add_jquery_cropper() {
+	wp_enqueue_script( 'jcrop', array( 'jquery' ) );
+	add_action( 'wp_head', 'bp_core_add_cropper_inline_js' );
+	add_action( 'wp_head', 'bp_core_add_cropper_inline_css' );
+}
+
+/**
+ * bp_core_add_cropper_inline_js()
+ *
+ * Adds the inline JS needed for the cropper to work on a per-page basis.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_add_cropper_inline_js() {
+	global $bp;
+
+	$image = apply_filters( 'bp_inline_cropper_image', getimagesize( BP_AVATAR_UPLOAD_PATH . $bp->avatar_admin->image->dir ) );
+	$aspect_ratio = 1;
+
+	// Calculate Aspect Ratio
+	if ( (int) constant( 'BP_AVATAR_FULL_HEIGHT' ) && ( (int) constant( 'BP_AVATAR_FULL_WIDTH' ) != (int) constant( 'BP_AVATAR_FULL_HEIGHT' ) ) )
+		$aspect_ratio = (int) constant( 'BP_AVATAR_FULL_WIDTH' ) / (int) constant( 'BP_AVATAR_FULL_HEIGHT' );
+?>
+
+	<script type="text/javascript">
+		jQuery(window).load( function(){
+			jQuery('#avatar-to-crop').Jcrop({
+				onChange: showPreview,
+				onSelect: showPreview,
+				onSelect: updateCoords,
+				aspectRatio: <?php echo $aspect_ratio ?>,
+				setSelect: [ 50, 50, <?php echo $image[0] / 2 ?>, <?php echo $image[1] / 2 ?> ]
+			});
+		});
+
+		function updateCoords(c) {
+			jQuery('#x').val(c.x);
+			jQuery('#y').val(c.y);
+			jQuery('#w').val(c.w);
+			jQuery('#h').val(c.h);
+		};
+
+		function showPreview(coords) {
+			if ( parseInt(coords.w) > 0 ) {
+				var rx = <?php echo (int) constant( 'BP_AVATAR_FULL_WIDTH' ) ?> / coords.w;
+				var ry = <?php echo (int) constant( 'BP_AVATAR_FULL_HEIGHT' ) ?> / coords.h;
+
+				jQuery('#avatar-crop-preview').css({
+				<?php if ( $image ) : ?>
+					width: Math.round(rx * <?php echo $image[0] ?>) + 'px',
+					height: Math.round(ry * <?php echo $image[1] ?>) + 'px',
+				<?php endif; ?>
+					marginLeft: '-' + Math.round(rx * coords.x) + 'px',
+					marginTop: '-' + Math.round(ry * coords.y) + 'px'
+				});
+			}
+		}
+	</script>
+
+<?php
+}
+
+/**
+ * bp_core_add_cropper_inline_css()
+ *
+ * Adds the inline CSS needed for the cropper to work on a per-page basis.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_add_cropper_inline_css() {
+	global $bp;
+?>
+
+	<style type="text/css">
+		.jcrop-holder { float: left; margin: 0 20px 20px 0; text-align: left; }
+		.jcrop-vline, .jcrop-hline { font-size: 0; position: absolute; background: white top left repeat url( <?php echo BP_PLUGIN_URL ?>/bp-core/images/Jcrop.gif ); }
+		.jcrop-vline { height: 100%; width: 1px !important; }
+		.jcrop-hline { width: 100%; height: 1px !important; }
+		.jcrop-handle { font-size: 1px; width: 7px !important; height: 7px !important; border: 1px #eee solid; background-color: #333; *width: 9px; *height: 9px; }
+		.jcrop-tracker { width: 100%; height: 100%; }
+		.custom .jcrop-vline, .custom .jcrop-hline { background: yellow; }
+		.custom .jcrop-handle { border-color: black; background-color: #C7BB00; -moz-border-radius: 3px; -webkit-border-radius: 3px; }
+		#avatar-crop-pane { width: <?php echo BP_AVATAR_FULL_WIDTH ?>px; height: <?php echo BP_AVATAR_FULL_HEIGHT ?>px; overflow: hidden; }
+		#avatar-crop-submit { margin: 20px 0; }
+		#avatar-upload-form img, #create-group-form img, #group-settings-form img { border: none !important; }
+	</style>
+
+<?php
+}
+
+/**
+ * bp_core_add_ajax_url_js()
+ *
+ * Adds AJAX target URL so themes can access the WordPress AJAX functionality.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_add_ajax_url_js() {
+	global $bp;
+?>
+
+	<script type="text/javascript">var ajaxurl = "<?php echo site_url( 'wp-load.php' ); ?>";</script>
+
+<?php
+}
+add_action( 'wp_head', 'bp_core_add_ajax_url_js' );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-filters.php b/wp-content/plugins/buddypress/bp-core/bp-core-filters.php
new file mode 100644
index 0000000000000000000000000000000000000000..a33faef43313475a264e1778276d23bc2c8dedfa
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-core/bp-core-filters.php
@@ -0,0 +1,225 @@
+<?php
+
+/**
+ * bp_core_email_from_name_filter()
+ *
+ * Sets the "From" name in emails sent to the name of the site and not "WordPress"
+ *
+ * @package BuddyPress Core
+ * @uses get_blog_option() fetches the value for a meta_key in the wp_X_options table
+ * @return The blog name for the root blog
+ */
+function bp_core_email_from_name_filter() {
+ 	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' );
+
+/**
+ * bp_core_email_from_name_filter()
+ *
+ * Sets the "From" address in emails sent
+ *
+ * @package BuddyPress Core
+ * @global $current_site Object containing current site metadata
+ * @return noreply@sitedomain email address
+ */
+function bp_core_email_from_address_filter() {
+	$domain = (array) explode( '/', site_url() );
+
+	return apply_filters( 'bp_core_email_from_address_filter', __( 'noreply', 'buddypress' ) . '@' . $domain[2] );
+}
+add_filter( 'wp_mail_from', 'bp_core_email_from_address_filter' );
+
+/**
+ * bp_core_allow_default_theme()
+ *
+ * On multiblog installations you must first allow themes to be activated and show
+ * up on the theme selection screen. This function will let the BuddyPress bundled
+ * themes show up on the root blog selection screen and bypass this step. It also
+ * means that the themes won't show for selection on other blogs.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_allow_default_theme( $themes ) {
+	global $bp, $current_blog;
+
+	if ( !is_super_admin() )
+		return $themes;
+
+	if ( $current_blog->ID == $bp->root_blog ) {
+		$themes['bp-default'] = 1;
+	}
+
+	return $themes;
+}
+add_filter( 'allowed_themes', 'bp_core_allow_default_theme' );
+
+/**
+ * bp_core_filter_comments()
+ *
+ * Filter the blog post comments array and insert BuddyPress URLs for users.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_filter_comments( $comments, $post_id ) {
+	global $wpdb;
+
+	foreach( (array)$comments as $comment ) {
+		if ( $comment->user_id )
+			$user_ids[] = $comment->user_id;
+	}
+
+	if ( empty( $user_ids ) )
+		return $comments;
+
+	$user_ids = implode( ',', $user_ids );
+
+	if ( !$userdata = $wpdb->get_results( $wpdb->prepare( "SELECT ID as user_id, user_login, user_nicename FROM {$wpdb->users} WHERE ID IN ({$user_ids})" ) ) )
+		return $comments;
+
+	foreach( (array)$userdata as $user )
+		$users[$user->user_id] = bp_core_get_user_domain( $user->user_id, $user->user_nicename, $user->user_login );
+
+	foreach( (array)$comments as $i => $comment ) {
+		if ( !empty( $comment->user_id ) ) {
+			if ( !empty( $users[$comment->user_id] ) )
+				$comments[$i]->comment_author_url = $users[$comment->user_id];
+		}
+	}
+
+	return $comments;
+}
+add_filter( 'comments_array', 'bp_core_filter_comments', 10, 2 );
+
+/**
+ * bp_core_login_redirect()
+ *
+ * When a user logs in, always redirect them back to the previous page. NOT the admin area.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_login_redirect( $redirect_to ) {
+	global $bp, $current_blog;
+
+	if ( bp_core_is_multisite() && $current_blog->blog_id != BP_ROOT_BLOG )
+		return $redirect_to;
+
+	if ( !empty( $_REQUEST['redirect_to'] ) || strpos( $_REQUEST['redirect_to'], 'wp-admin' ) )
+		return $redirect_to;
+
+	if ( false === strpos( wp_get_referer(), 'wp-login.php' ) && false === strpos( wp_get_referer(), 'activate' ) && empty( $_REQUEST['nr'] ) )
+		return wp_get_referer();
+
+	return $bp->root_domain;
+}
+add_filter( 'login_redirect', 'bp_core_login_redirect' );
+
+/***
+ * bp_core_filter_user_welcome_email()
+ *
+ * Replace the generated password in the welcome email.
+ * This will not filter when the site admin registers a user.
+ *
+ * @uses locate_template To see if custom registration files exist
+ * @param string $welcome_email Complete email passed through WordPress
+ * @return string Filtered $welcome_email with 'PASSWORD' replaced by [User Set]
+ */
+function bp_core_filter_user_welcome_email( $welcome_email ) {
+	/* Don't touch the email if we don't have a custom registration template */
+	if ( '' == locate_template( array( 'registration/register.php' ), false ) && '' == locate_template( array( 'register.php' ), false ) )
+		return $welcome_email;
+
+	// [User Set] Replaces 'PASSWORD' in welcome email; Represents value set by user
+	return str_replace( 'PASSWORD', __( '[User Set]', 'buddypress' ), $welcome_email );
+}
+if ( !is_admin() && empty( $_GET['e'] ) )
+	add_filter( 'update_welcome_user_email', 'bp_core_filter_user_welcome_email' );
+
+/***
+ * bp_core_filter_blog_welcome_email()
+ *
+ * Replace the generated password in the welcome email.
+ * This will not filter when the site admin registers a user.
+ *
+ * @uses locate_template To see if custom registration files exist
+ * @param string $welcome_email Complete email passed through WordPress
+ * @param integer $blog_id ID of the blog user is joining
+ * @param integer $user_id ID of the user joining
+ * @param string $password Password of user
+ * @return string Filtered $welcome_email with $password replaced by [User Set]
+ */
+function bp_core_filter_blog_welcome_email( $welcome_email, $blog_id, $user_id, $password ) {
+	/* Don't touch the email if we don't have a custom registration template */
+	if ( '' == locate_template( array( 'registration/register.php' ), false ) && '' == locate_template( array( 'register.php' ), false ) )
+		return $welcome_email;
+
+	// [User Set] Replaces $password in welcome email; Represents value set by user
+	return str_replace( $password, __( '[User Set]', 'buddypress' ), $welcome_email );
+}
+if ( !is_admin() && empty( $_GET['e'] ) )
+	add_filter( 'update_welcome_email', 'bp_core_filter_blog_welcome_email', 10, 4 );
+
+// Notify user of signup success.
+function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta ) {
+	global $current_site;
+
+	// Send email with activation link.
+	$activate_url = bp_get_activation_page() ."?key=$key";
+	$activate_url = esc_url($activate_url);
+
+	$admin_email = get_site_option( "admin_email" );
+
+	if ( empty( $admin_email ) )
+		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
+
+	$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 and blog, please click the following link:\n\n%s\n\n\n\nAfter you activate, you can visit your blog here:\n\n%s", 'buddypress' ), $activate_url, esc_url("http://{$domain}{$path}" ) );
+	$subject = '[' . $from_name . '] ' . sprintf(__('Activate %s', 'buddypress' ), esc_url('http://' . $domain . $path));
+
+	/* Send the message */
+	$to = apply_filters( 'bp_core_activation_signup_blog_notification_to', $user_email );
+	$subject = apply_filters( 'bp_core_activation_signup_blog_notification_subject', $subject );
+	$message = apply_filters( 'bp_core_activation_signup_blog_notification_message', $message );
+
+	wp_mail( $to, $subject, $message, $message_headers );
+
+	// Return false to stop the original WPMU function from continuing
+	return false;
+}
+if ( !is_admin() )
+	add_filter( 'wpmu_signup_blog_notification', 'bp_core_activation_signup_blog_notification', 1, 7 );
+
+function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) {
+	global $current_site;
+
+	$activate_url = bp_get_activation_page() ."?key=$key";
+	$activate_url = esc_url($activate_url);
+	$admin_email = get_site_option( "admin_email" );
+
+	if ( empty( $admin_email ) )
+		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
+
+	/* If this is an admin generated activation, add a param to email the user login details */
+	if ( is_admin() )
+		$email = '&e=1';
+
+	$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, esc_url( "http://{$domain}{$path}" ) );
+	$subject = '[' . $from_name . '] ' . __( 'Activate Your Account', 'buddypress' );
+
+	/* Send the message */
+	$to = apply_filters( 'bp_core_activation_signup_user_notification_to', $user_email );
+	$subject = apply_filters( 'bp_core_activation_signup_user_notification_subject', $subject );
+	$message = apply_filters( 'bp_core_activation_signup_user_notification_message', $message );
+
+	wp_mail( $to, $subject, $message, $message_headers );
+
+	// Return false to stop the original WPMU function from continuing
+	return false;
+}
+if ( !is_admin() || ( is_admin() && empty( $_POST['noconfirmation'] ) ) )
+	add_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_notification', 1, 4 );
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-notifications.php b/wp-content/plugins/buddypress/bp-core/bp-core-notifications.php
new file mode 100644
index 0000000000000000000000000000000000000000..54c62e224ea02fd3d5e49ed8dd16addeead516e3
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-core/bp-core-notifications.php
@@ -0,0 +1,95 @@
+<?php
+
+function bp_core_add_notification( $item_id, $user_id, $component_name, $component_action, $secondary_item_id = false, $date_notified = false ) {
+	global $bp;
+
+	if ( !$date_notified )
+		$date_notified = bp_core_current_time();
+
+	$notification = new BP_Core_Notification;
+	$notification->item_id = $item_id;
+	$notification->user_id = $user_id;
+	$notification->component_name = $component_name;
+	$notification->component_action = $component_action;
+	$notification->date_notified = $date_notified;
+	$notification->is_new = 1;
+
+	if ( $secondary_item_id )
+		$notification->secondary_item_id = $secondary_item_id;
+
+	if ( !$notification->save() )
+		return false;
+
+	return true;
+}
+
+function bp_core_delete_notification( $id ) {
+	if ( !bp_core_check_notification_access( $bp->loggedin_user->id, $id ) )
+		return false;
+
+	return BP_Core_Notification::delete( $id );
+}
+
+function bp_core_get_notification( $id ) {
+	return new BP_Core_Notification( $id );
+}
+
+function bp_core_get_notifications_for_user( $user_id ) {
+	global $bp;
+
+	$notifications = BP_Core_Notification::get_all_for_user( $user_id );
+
+	/* Group notifications by component and component_action and provide totals */
+	for ( $i = 0; $i < count($notifications); $i++ ) {
+		$notification = $notifications[$i];
+
+		$grouped_notifications[$notification->component_name][$notification->component_action][] = $notification;
+	}
+
+	if ( !$grouped_notifications )
+		return false;
+
+	/* Calculated a renderable outcome for each notification type */
+	foreach ( (array)$grouped_notifications as $component_name => $action_arrays ) {
+		if ( !$action_arrays )
+			continue;
+
+		foreach ( (array)$action_arrays as $component_action_name => $component_action_items ) {
+			$action_item_count = count($component_action_items);
+
+			if ( $action_item_count < 1 )
+				continue;
+
+			if ( function_exists( $bp->{$component_name}->format_notification_function ) ) {
+				$renderable[] = call_user_func( $bp->{$component_name}->format_notification_function, $component_action_name, $component_action_items[0]->item_id, $component_action_items[0]->secondary_item_id, $action_item_count );
+			}
+		}
+	}
+
+	return $renderable;
+}
+
+function bp_core_delete_notifications_for_user_by_type( $user_id, $component_name, $component_action ) {
+	return BP_Core_Notification::delete_for_user_by_type( $user_id, $component_name, $component_action );
+}
+
+function bp_core_delete_notifications_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false ) {
+	return BP_Core_Notification::delete_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id );
+}
+
+function bp_core_delete_all_notifications_by_type( $item_id, $component_name, $component_action = false, $secondary_item_id = false ) {
+	return BP_Core_Notification::delete_all_by_type( $item_id, $component_name, $component_action, $secondary_item_id );
+}
+
+function bp_core_delete_notifications_from_user( $user_id, $component_name, $component_action ) {
+	return BP_Core_Notification::delete_from_user_by_type( $user_id, $component_name, $component_action );
+}
+
+function bp_core_check_notification_access( $user_id, $notification_id ) {
+	if ( !BP_Core_Notification::check_access( $user_id, $notification_id ) )
+		return false;
+
+	return true;
+}
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-settings.php b/wp-content/plugins/buddypress/bp-core/bp-core-settings.php
new file mode 100644
index 0000000000000000000000000000000000000000..7421907a72efe5543f71b7697e8432d6c0ac20b3
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-core/bp-core-settings.php
@@ -0,0 +1,197 @@
+<?php
+
+if ( !defined( 'BP_SETTINGS_SLUG' ) )
+	define( 'BP_SETTINGS_SLUG', 'settings' );
+
+function bp_core_add_settings_nav() {
+	global $bp;
+
+	/* Set up settings as a sudo-component for identification and nav selection */
+	$bp->settings->id = 'settings';
+	$bp->settings->slug = BP_SETTINGS_SLUG;
+
+	/* Register this in the active components array */
+	$bp->active_components[$bp->settings->slug] = $bp->settings->id;
+
+	/* Add the settings navigation item */
+	bp_core_new_nav_item( array( 'name' => __('Settings', 'buddypress'), 'slug' => $bp->settings->slug, 'position' => 100, 'show_for_displayed_user' => false, 'screen_function' => 'bp_core_screen_general_settings', 'default_subnav_slug' => 'general' ) );
+
+	$settings_link = $bp->loggedin_user->domain . $bp->settings->slug . '/';
+
+	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_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( 'bp_setup_nav', 'bp_core_add_settings_nav' );
+
+/**** GENERAL SETTINGS ****/
+
+function bp_core_screen_general_settings() {
+	global $current_user, $bp_settings_updated, $pass_error;
+
+	$bp_settings_updated = false;
+	$pass_error = false;
+
+	if ( isset($_POST['submit']) ) {
+		check_admin_referer('bp_settings_general');
+
+		require_once( WPINC . '/registration.php' );
+
+		// Form has been submitted and nonce checks out, lets do it.
+
+		if ( $_POST['email'] != '' )
+			$current_user->user_email = wp_specialchars( trim( $_POST['email'] ) );
+
+		if ( $_POST['pass1'] != '' && $_POST['pass2'] != '' ) {
+			if ( $_POST['pass1'] == $_POST['pass2'] && !strpos( " " . $_POST['pass1'], "\\" ) )
+				$current_user->user_pass = $_POST['pass1'];
+			else
+				$pass_error = true;
+		} else if ( empty( $_POST['pass1'] ) && !empty( $_POST['pass2'] ) || !empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) {
+			$pass_error = true;
+		} else {
+			unset( $current_user->user_pass );
+		}
+
+		if ( !$pass_error && wp_update_user( get_object_vars( $current_user ) ) )
+			$bp_settings_updated = true;
+	}
+
+	add_action( 'bp_template_title', 'bp_core_screen_general_settings_title' );
+	add_action( 'bp_template_content', 'bp_core_screen_general_settings_content' );
+
+	bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
+}
+
+function bp_core_screen_general_settings_title() {
+	_e( 'General Settings', 'buddypress' );
+}
+
+function bp_core_screen_general_settings_content() {
+	global $bp, $current_user, $bp_settings_updated, $pass_error; ?>
+
+	<?php if ( $bp_settings_updated && !$pass_error ) { ?>
+		<div id="message" class="updated fade">
+			<p><?php _e( 'Changes Saved.', 'buddypress' ) ?></p>
+		</div>
+	<?php } ?>
+
+	<?php if ( $pass_error && !$bp_settings_updated ) { ?>
+		<div id="message" class="error fade">
+			<p><?php _e( 'Your passwords did not match', 'buddypress' ) ?></p>
+		</div>
+	<?php } ?>
+
+	<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 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 />
+		<input type="password" name="pass2" id="pass2" size="16" value="" class="settings-input small" /> &nbsp;<?php _e( 'Repeat New Password', 'buddypress' ) ?>
+
+		<div class="submit">
+			<input type="submit" name="submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?>" id="submit" class="auto" />
+		</div>
+
+		<?php wp_nonce_field('bp_settings_general') ?>
+	</form>
+<?php
+}
+
+/***** NOTIFICATION SETTINGS ******/
+
+function bp_core_screen_notification_settings() {
+	global $current_user, $bp_settings_updated;
+
+	$bp_settings_updated = false;
+
+	if ( $_POST['submit'] ) {
+		check_admin_referer('bp_settings_notifications');
+
+		if ( $_POST['notifications'] ) {
+			foreach ( (array)$_POST['notifications'] as $key => $value ) {
+				update_user_meta( (int)$current_user->id, $key, $value );
+			}
+		}
+
+		$bp_settings_updated = true;
+	}
+
+	add_action( 'bp_template_title', 'bp_core_screen_notification_settings_title' );
+	add_action( 'bp_template_content', 'bp_core_screen_notification_settings_content' );
+
+	bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
+}
+
+function bp_core_screen_notification_settings_title() {
+	_e( 'Notification Settings', 'buddypress' );
+}
+
+function bp_core_screen_notification_settings_content() {
+	global $bp, $current_user, $bp_settings_updated; ?>
+
+	<?php if ( $bp_settings_updated ) { ?>
+		<div id="message" class="updated fade">
+			<p><?php _e( 'Changes Saved.', 'buddypress' ) ?></p>
+		</div>
+	<?php } ?>
+
+	<form action="<?php echo $bp->loggedin_user->domain . BP_SETTINGS_SLUG . '/notifications' ?>" method="post" id="settings-form">
+		<h3><?php _e( 'Email Notifications', 'buddypress' ) ?></h3>
+		<p><?php _e( 'Send a notification by email when:', 'buddypress' ) ?></p>
+
+		<?php do_action( 'bp_notification_settings' ) ?>
+
+		<div class="submit">
+			<input type="submit" name="submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?>" id="submit" class="auto" />
+		</div>
+
+		<?php wp_nonce_field('bp_settings_notifications') ?>
+
+	</form>
+<?php
+}
+
+/**** DELETE ACCOUNT ****/
+
+function bp_core_screen_delete_account() {
+	if ( isset( $_POST['delete-account-understand'] ) ) {
+		check_admin_referer( 'delete-account' );
+
+		// delete the users account
+		if ( bp_core_delete_account() )
+			bp_core_redirect( site_url() );
+	}
+
+	add_action( 'bp_template_title', 'bp_core_screen_delete_account_title' );
+	add_action( 'bp_template_content', 'bp_core_screen_delete_account_content' );
+
+	bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
+}
+
+function bp_core_screen_delete_account_title() {
+	_e( 'Delete Account', 'buddypress' );
+}
+
+function bp_core_screen_delete_account_content() {
+	global $bp, $current_user, $bp_settings_updated, $pass_error; 	?>
+
+	<form action="<?php echo $bp->loggedin_user->domain .  BP_SETTINGS_SLUG . '/delete-account'; ?>" name="account-delete-form" id="account-delete-form" class="standard-form" method="post">
+
+		<div id="message" class="info">
+			<p><?php _e( 'WARNING: Deleting your account will completely remove ALL content associated with it. There is no way back, please be careful with this option.', 'buddypress' ); ?></p>
+		</div>
+
+		<input type="checkbox" name="delete-account-understand" id="delete-account-understand" value="1" onclick="if(this.checked) { document.getElementById('delete-account-button').disabled = ''; } else { document.getElementById('delete-account-button').disabled = 'disabled'; }" /> <?php _e( 'I understand the consequences of deleting my account.', 'buddypress' ); ?>
+
+		<div class="submit">
+			<input type="submit" disabled="disabled" value="<?php _e( 'Delete My Account', 'buddypress' ) ?> &rarr;" id="delete-account-button" name="delete-account-button" />
+		</div>
+
+		<?php wp_nonce_field('delete-account') ?>
+	</form>
+<?php
+}
diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-signup.php b/wp-content/plugins/buddypress/bp-core/bp-core-signup.php
new file mode 100644
index 0000000000000000000000000000000000000000..8f53b1b258051bacbaacfdf634845a32c69e3321
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-core/bp-core-signup.php
@@ -0,0 +1,625 @@
+<?php
+
+/********************************************************************************
+ * Screen Functions
+ *
+ * Screen functions are the controllers of BuddyPress. They will execute when their
+ * specific URL is caught. They will first save or manipulate data using business
+ * functions, then pass on the user to a template file.
+ */
+
+function bp_core_screen_signup() {
+	global $bp, $wpdb;
+
+	if ( $bp->current_component != BP_REGISTER_SLUG )
+		return false;
+
+	/* If the user is logged in, redirect away from here */
+	if ( is_user_logged_in() )
+		bp_core_redirect( $bp->root_domain );
+
+	/* If signups are disabled, just re-direct */
+	if ( !bp_get_signup_allowed() )
+		bp_core_redirect( $bp->root_domain );
+
+	$bp->signup->step = 'request-details';
+
+	/* If the signup page is submitted, validate and save */
+	if ( isset( $_POST['signup_submit'] ) ) {
+
+		/* Check the nonce */
+		check_admin_referer( 'bp_new_signup' );
+
+		require_once( ABSPATH . WPINC . '/registration.php' );
+
+		/* Check the base account details for problems */
+		$account_details = bp_core_validate_user_signup( $_POST['signup_username'], $_POST['signup_email'] );
+
+		/* If there are errors with account details, set them for display */
+		if ( !empty( $account_details['errors']->errors['user_name'] ) )
+			$bp->signup->errors['signup_username'] = $account_details['errors']->errors['user_name'][0];
+
+		if ( !empty( $account_details['errors']->errors['user_email'] ) )
+			$bp->signup->errors['signup_email'] = $account_details['errors']->errors['user_email'][0];
+
+		/* Check that both password fields are filled in */
+		if ( empty( $_POST['signup_password'] ) || empty( $_POST['signup_password_confirm'] ) )
+			$bp->signup->errors['signup_password'] = __( 'Please make sure you enter your password twice', 'buddypress' );
+
+		/* Check that the passwords match */
+		if ( ( !empty( $_POST['signup_password'] ) && !empty( $_POST['signup_password_confirm'] ) ) && $_POST['signup_password'] != $_POST['signup_password_confirm'] )
+			$bp->signup->errors['signup_password'] = __( 'The passwords you entered do not match.', 'buddypress' );
+
+		$bp->signup->username = $_POST['signup_username'];
+		$bp->signup->email = $_POST['signup_email'];
+
+		/* Now we've checked account details, we can check profile information */
+		if ( function_exists( 'xprofile_check_is_required_field' ) ) {
+
+			/* Make sure hidden field is passed and populated */
+			if ( isset( $_POST['signup_profile_field_ids'] ) && !empty( $_POST['signup_profile_field_ids'] ) ) {
+
+				/* Let's compact any profile field info into an array */
+				$profile_field_ids = explode( ',', $_POST['signup_profile_field_ids'] );
+
+				/* Loop through the posted fields formatting any datebox values then validate the field */
+				foreach ( (array) $profile_field_ids as $field_id ) {
+					if ( !isset( $_POST['field_' . $field_id] ) ) {
+						if ( isset( $_POST['field_' . $field_id . '_day'] ) )
+							$_POST['field_' . $field_id] = strtotime( $_POST['field_' . $field_id . '_day'] . $_POST['field_' . $field_id . '_month'] . $_POST['field_' . $field_id . '_year'] );
+					}
+
+					/* Create errors for required fields without values */
+					if ( xprofile_check_is_required_field( $field_id ) && empty( $_POST['field_' . $field_id] ) )
+						$bp->signup->errors['field_' . $field_id] = __( 'This is a required field', 'buddypress' );
+				}
+
+			/* This situation doesn't naturally occur so bounce to website root */
+			} else {
+				bp_core_redirect( $bp->root_domain );
+			}
+		}
+
+		/* Finally, let's check the blog details, if the user wants a blog and blog creation is enabled */
+		if ( isset( $_POST['signup_with_blog'] ) ) {
+			$active_signup = $bp->site_options['registration'];
+
+			if ( 'blog' == $active_signup || 'all' == $active_signup ) {
+				$blog_details = bp_core_validate_blog_signup( $_POST['signup_blog_url'], $_POST['signup_blog_title'] );
+
+				/* If there are errors with blog details, set them for display */
+				if ( !empty( $blog_details['errors']->errors['blogname'] ) )
+					$bp->signup->errors['signup_blog_url'] = $blog_details['errors']->errors['blogname'][0];
+
+				if ( !empty( $blog_details['errors']->errors['blog_title'] ) )
+					$bp->signup->errors['signup_blog_title'] = $blog_details['errors']->errors['blog_title'][0];
+			}
+		}
+
+		do_action( 'bp_signup_validate' );
+
+		/* Add any errors to the action for the field in the template for display. */
+		if ( !empty( $bp->signup->errors ) ) {
+			foreach ( (array)$bp->signup->errors as $fieldname => $error_message )
+				add_action( 'bp_' . $fieldname . '_errors', create_function( '', 'echo "<div class=\"error\">' . $error_message . '</div>";' ) );
+		} else {
+			$bp->signup->step = 'save-details';
+
+			/* No errors! Let's register those deets. */
+			$active_signup = $bp->site_options['registration'];
+
+			if ( 'none' != $active_signup ) {
+
+				/* Let's compact any profile field info into usermeta */
+				$profile_field_ids = explode( ',', $_POST['signup_profile_field_ids'] );
+
+				/* Loop through the posted fields formatting any datebox values then add to usermeta */
+				foreach ( (array) $profile_field_ids as $field_id ) {
+					if ( !isset( $_POST['field_' . $field_id] ) ) {
+						if ( isset( $_POST['field_' . $field_id . '_day'] ) )
+							$_POST['field_' . $field_id] = strtotime( $_POST['field_' . $field_id . '_day'] . $_POST['field_' . $field_id . '_month'] . $_POST['field_' . $field_id . '_year'] );
+					}
+
+					if ( !empty( $_POST['field_' . $field_id] ) )
+						$usermeta['field_' . $field_id] = $_POST['field_' . $field_id];
+				}
+
+				/* Store the profile field ID's in usermeta */
+				$usermeta['profile_field_ids'] = $_POST['signup_profile_field_ids'];
+
+				/* Hash and store the password */
+				$usermeta['password'] = wp_hash_password( $_POST['signup_password'] );
+
+				/* If the user decided to create a blog, save those details to usermeta */
+				if ( 'blog' == $active_signup || 'all' == $active_signup ) {
+					$usermeta['public'] = ( 'public' == $_POST['signup_blog_privacy'] ) ? true : false;
+				}
+
+				$usermeta = apply_filters( 'bp_signup_usermeta', $usermeta );
+
+				/* Finally, sign up the user and/or blog */
+				if ( isset( $_POST['signup_with_blog'] ) && bp_core_is_multisite() )
+					bp_core_signup_blog( $blog_details['domain'], $blog_details['path'], $blog_details['blog_title'], $_POST['signup_username'], $_POST['signup_email'], $usermeta );
+				else {
+					bp_core_signup_user( $_POST['signup_username'], $_POST['signup_password'], $_POST['signup_email'], $usermeta );
+				}
+
+				$bp->signup->step = 'completed-confirmation';
+			}
+
+			do_action( 'bp_complete_signup' );
+		}
+
+	}
+
+	$bp->avatar_admin->step = 'upload-image';
+
+	/* If user has uploaded a new avatar */
+	if ( !empty( $_FILES ) ) {
+
+		/* Check the nonce */
+		check_admin_referer( 'bp_avatar_upload' );
+
+		$bp->signup->step = 'completed-confirmation';
+
+		if ( bp_core_is_multisite() ) {
+			/* Get the activation key */
+			if ( !$bp->signup->key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $_POST[ 'signup_username' ], $_POST[ 'signup_email' ] ) ) ) {
+				bp_core_add_message( __( 'There was a problem uploading your avatar, please try uploading it again', 'buddypress' ) );
+			} else {
+				/* Hash the key to create the upload folder (added security so people don't sniff the activation key) */
+				$bp->signup->avatar_dir = wp_hash( $bp->signup->key );
+			}
+		} else {
+			$user_id = bp_core_get_userid( $_POST['signup_username'] );
+			$bp->signup->avatar_dir = wp_hash( $user_id );
+		}
+
+		/* Pass the file to the avatar upload handler */
+		if ( bp_core_avatar_handle_upload( $_FILES, 'bp_core_signup_avatar_upload_dir' ) ) {
+			$bp->avatar_admin->step = 'crop-image';
+
+			/* Make sure we include the jQuery jCrop file for image cropping */
+			add_action( 'wp', 'bp_core_add_jquery_cropper' );
+		}
+	}
+
+	/* If the image cropping is done, crop the image and save a full/thumb version */
+	if ( isset( $_POST['avatar-crop-submit'] ) ) {
+
+		/* Check the nonce */
+		check_admin_referer( 'bp_avatar_cropstore' );
+
+		/* Reset the avatar step so we can show the upload form again if needed */
+		$bp->signup->step = 'completed-confirmation';
+		$bp->avatar_admin->step = 'upload-image';
+
+		if ( !bp_core_avatar_handle_crop( array( 'original_file' => $_POST['image_src'], 'crop_x' => $_POST['x'], 'crop_y' => $_POST['y'], 'crop_w' => $_POST['w'], 'crop_h' => $_POST['h'] ) ) )
+			bp_core_add_message( __( 'There was a problem cropping your avatar, please try uploading it again', 'buddypress' ), 'error' );
+		else
+			bp_core_add_message( __( 'Your new avatar was uploaded successfully', 'buddypress' ) );
+	}
+	bp_core_load_template( 'registration/register' );
+}
+add_action( 'wp', 'bp_core_screen_signup', 3 );
+
+function bp_core_screen_activation() {
+	global $bp, $wpdb;
+
+	if ( BP_ACTIVATION_SLUG != $bp->current_component )
+		return false;
+
+	/* Check if an activation key has been passed */
+	if ( isset( $_GET['key'] ) ) {
+
+		require_once( ABSPATH . WPINC . '/registration.php' );
+
+		/* Activate the signup */
+		$user = apply_filters( 'bp_core_activate_account', bp_core_activate_signup( $_GET['key'] ) );
+
+		/* If there was errors, add a message and redirect */
+		if ( $user->errors ) {
+			bp_core_add_message( __( 'There was an error activating your account, please try again.', 'buddypress' ), 'error' );
+			bp_core_redirect( $bp->root_domain . '/' . BP_ACTIVATION_SLUG );
+		}
+
+		/* Check for an uploaded avatar and move that to the correct user folder */
+		if ( bp_core_is_multisite() )
+			$hashed_key = wp_hash( $_GET['key'] );
+		else
+			$hashed_key = wp_hash( $user );
+
+		/* Check if the avatar folder exists. If it does, move rename it, move it and delete the signup avatar dir */
+		if ( file_exists( BP_AVATAR_UPLOAD_PATH . '/avatars/signups/' . $hashed_key ) )
+			@rename( BP_AVATAR_UPLOAD_PATH . '/avatars/signups/' . $hashed_key, BP_AVATAR_UPLOAD_PATH . '/avatars/' . $user );
+
+		bp_core_add_message( __( 'Your account is now active!', 'buddypress' ) );
+
+		$bp->activation_complete = true;
+	}
+
+	if ( '' != locate_template( array( 'registration/activate' ), false ) )
+		bp_core_load_template( apply_filters( 'bp_core_template_activate', 'activate' ) );
+	else
+		bp_core_load_template( apply_filters( 'bp_core_template_activate', 'registration/activate' ) );
+}
+add_action( 'wp', 'bp_core_screen_activation', 3 );
+
+
+/********************************************************************************
+ * Business Functions
+ *
+ * Business functions are where all the magic happens in BuddyPress. They will
+ * handle the actual saving or manipulation of information. Usually they will
+ * hand off to a database class for data access, then return
+ * true or false on success or failure.
+ */
+
+/**
+ * bp_core_flush_illegal_names()
+ *
+ * Flush illegal names by getting and setting 'illegal_names' site option
+ */
+function bp_core_flush_illegal_names() {
+	$illegal_names = get_site_option( 'illegal_names' );
+	update_site_option( 'illegal_names', $illegal_names );
+}
+
+/**
+ * bp_core_illegal_names()
+ *
+ * Filter the illegal_names site option and make sure it includes a few
+ * specific BuddyPress and Multi-site slugs
+ *
+ * @param array|string $value Illegal names from field
+ * @param array|string $oldvalue The value as it is currently
+ * @return array Merged and unique array of illegal names
+ */
+function bp_core_illegal_names( $value = '', $oldvalue = '' ) {
+
+	// Make sure $value is array
+	if ( empty( $value ) )
+		$db_illegal_names = array();
+	if ( is_array( $value ) )
+		$db_illegal_names = $value;
+	elseif ( is_string( $value ) )
+		$db_illegal_names = implode( ' ', $names );
+
+	// Add our slugs to the array and allow them to be filtered
+	$filtered_illegal_names = apply_filters( 'bp_core_illegal_usernames', array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', BP_GROUPS_SLUG, BP_MEMBERS_SLUG, BP_FORUMS_SLUG, BP_BLOGS_SLUG, BP_ACTIVITY_SLUG, BP_XPROFILE_SLUG, BP_FRIENDS_SLUG, BP_SEARCH_SLUG, BP_SETTINGS_SLUG, BP_REGISTER_SLUG, BP_ACTIVATION_SLUG ) );
+
+	// Merge the arrays together
+	$merged_names =	array_merge( (array)$filtered_illegal_names, (array)$db_illegal_names );
+
+	// Remove duplicates
+	$illegal_names = array_unique( (array)$merged_names );
+
+	return apply_filters( 'bp_core_illegal_names', $illegal_names );
+}
+add_filter( 'pre_update_site_option_illegal_names', 'bp_core_illegal_names', 10, 2 );
+
+/**
+ * bp_core_validate_user_signup()
+ *
+ * Validate a user name and email address when creating a new user.
+ *
+ * @global object $wpdb DB Layer
+ * @param string $user_name Username to validate
+ * @param string $user_email Email address to validate
+ * @return array Results of user validation including errors, if any
+ */
+function bp_core_validate_user_signup( $user_name, $user_email ) {
+	global $wpdb;
+
+	$errors = new WP_Error();
+	$user_email = sanitize_email( $user_email );
+
+	if ( empty( $user_name ) )
+		$errors->add( 'user_name', __( 'Please enter a username', 'buddypress' ) );
+
+	$maybe = array();
+	preg_match( "/[a-z0-9]+/", $user_name, $maybe );
+
+	// Make sure illegal names include BuddyPress slugs and values
+	bp_core_flush_illegal_names();
+
+	if ( !validate_username( $user_name ) || in_array( $user_name, (array)$illegal_names ) || $user_name != $maybe[0] )
+		$errors->add( 'user_name', __( 'Only lowercase letters and numbers allowed', 'buddypress' ) );
+
+	if( strlen( $user_name ) < 4 )
+		$errors->add( 'user_name',  __( 'Username must be at least 4 characters', 'buddypress' ) );
+
+	if ( strpos( ' ' . $user_name, '_' ) != false )
+		$errors->add( 'user_name', __( 'Sorry, usernames may not contain the character "_"!', 'buddypress' ) );
+
+	/* Is the user_name all numeric? */
+	$match = array();
+	preg_match( '/[0-9]*/', $user_name, $match );
+
+	if ( $match[0] == $user_name )
+		$errors->add( 'user_name', __( 'Sorry, usernames must have letters too!', 'buddypress' ) );
+
+	if ( !is_email( $user_email ) )
+		$errors->add( 'user_email', __( 'Please check your email address.', 'buddypress' ) );
+
+	$limited_email_domains = get_site_option( 'limited_email_domains', 'buddypress' );
+
+	if ( is_array( $limited_email_domains ) && empty( $limited_email_domains ) == false ) {
+		$emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) );
+
+		if ( in_array( $emaildomain, (array)$limited_email_domains ) == false )
+			$errors->add( 'user_email', __( 'Sorry, that email address is not allowed!', 'buddypress' ) );
+	}
+
+	/* Check if the username has been used already. */
+	if ( username_exists( $user_name ) )
+		$errors->add( 'user_name', __( 'Sorry, that username already exists!', 'buddypress' ) );
+
+	/* Check if the email address has been used already. */
+	if ( email_exists( $user_email ) )
+		$errors->add( 'user_email', __( 'Sorry, that email address is already used!', 'buddypress' ) );
+
+	$result = array( 'user_name' => $user_name, 'user_email' => $user_email, 'errors' => $errors );
+
+	/* Apply WPMU legacy filter */
+	$result = apply_filters( 'wpmu_validate_user_signup', $result );
+
+ 	return apply_filters( 'bp_core_validate_user_signup', $result );
+}
+
+function bp_core_validate_blog_signup( $blog_url, $blog_title ) {
+	if ( !bp_core_is_multisite() || !function_exists( 'wpmu_validate_blog_signup' ) )
+		return false;
+
+	return apply_filters( 'bp_core_validate_blog_signup', wpmu_validate_blog_signup( $blog_url, $blog_title ) );
+}
+
+function bp_core_signup_user( $user_login, $user_password, $user_email, $usermeta ) {
+	global $bp, $wpdb;
+
+	/* Multisite installs have their own install procedure */
+	if ( bp_core_is_multisite() ) {
+		wpmu_signup_user( $user_login, $user_email, $usermeta );
+
+	} else {
+		$errors = new WP_Error();
+
+		$user_id = wp_insert_user( array(
+			'user_login' => $user_login,
+			'user_pass' => $user_password,
+			'display_name' => sanitize_title( $user_login ),
+			'user_email' => $user_email
+		) );
+
+		if ( !$user_id ) {
+			$errors->add( 'registerfail', sprintf( __('<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'buddypress' ), get_option( 'admin_email' ) ) );
+			return $errors;
+		}
+
+		/* Update the user status to '2' which we will use as 'not activated' (0 = active, 1 = spam, 2 = not active) */
+		$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->users SET user_status = 2 WHERE ID = %d", $user_id ) );
+
+		/* Set any profile data */
+		if ( function_exists( 'xprofile_set_field_data' ) ) {
+			if ( !empty( $usermeta['profile_field_ids'] ) ) {
+				$profile_field_ids = explode( ',', $usermeta['profile_field_ids'] );
+
+				foreach( (array)$profile_field_ids as $field_id ) {
+					$current_field = $usermeta["field_{$field_id}"];
+
+					if ( !empty( $current_field ) )
+						xprofile_set_field_data( $field_id, $user_id, $current_field );
+				}
+			}
+		}
+	}
+	$bp->signup->username = $user_login;
+
+	/***
+	 * Now generate an activation key and send an email to the user so they can activate their account
+	 * and validate their email address. Multisite installs send their own email, so this is only for single blog installs.
+	 *
+	 * To disable sending activation emails you can user the filter 'bp_core_signup_send_activation_key' and return false.
+	 */
+	if ( apply_filters( 'bp_core_signup_send_activation_key', true ) ) {
+		if ( !bp_core_is_multisite() ) {
+			$activation_key = wp_hash( $user_id );
+			update_user_meta( $user_id, 'activation_key', $activation_key );
+			bp_core_signup_send_validation_email( $user_id, $user_email, $activation_key );
+		}
+	}
+
+	do_action( 'bp_core_signup_user', $user_id, $user_login, $user_password, $user_email, $usermeta );
+
+	return $user_id;
+}
+
+function bp_core_signup_blog( $blog_domain, $blog_path, $blog_title, $user_name, $user_email, $usermeta ) {
+	if ( !bp_core_is_multisite() || !function_exists( 'wpmu_signup_blog' ) )
+		return false;
+
+	return apply_filters( 'bp_core_signup_blog', wpmu_signup_blog( $blog_domain, $blog_path, $blog_title, $user_name, $user_email, $usermeta ) );
+}
+
+function bp_core_activate_signup( $key ) {
+	global $bp, $wpdb;
+
+	$user = false;
+
+	/* Multisite installs have their own activation routine */
+	if ( bp_core_is_multisite() ) {
+		$user = wpmu_activate_signup( $key );
+
+		/* If there was errors, add a message and redirect */
+		if ( $user->errors ) {
+			bp_core_add_message( __( 'There was an error activating your account, please try again.', 'buddypress' ), 'error' );
+			bp_core_redirect( $bp->root_domain . '/' . BP_ACTIVATION_SLUG );
+		}
+
+		$user_id = $user['user_id'];
+
+		/* Set any profile data */
+		if ( function_exists( 'xprofile_set_field_data' ) ) {
+			if ( !empty( $user['meta']['profile_field_ids'] ) ) {
+				$profile_field_ids = explode( ',', $user['meta']['profile_field_ids'] );
+
+				foreach( (array)$profile_field_ids as $field_id ) {
+					$current_field = $user['meta']["field_{$field_id}"];
+
+					if ( !empty( $current_field ) )
+						xprofile_set_field_data( $field_id, $user_id, $current_field );
+				}
+			}
+		}
+
+	} else {
+		/* Get the user_id based on the $key */
+		$user_id = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = 'activation_key' AND meta_value = %s", $key ) );
+
+		if ( empty( $user_id ) )
+			return new WP_Error( 'invalid_key', __( 'Invalid activation key', 'buddypress' ) );
+
+		/* Change the user's status so they become active */
+		if ( !$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->users SET user_status = 0 WHERE ID = %d", $user_id ) ) )
+			return new WP_Error( 'invalid_key', __( 'Invalid activation key', 'buddypress' ) );
+
+		/* Notify the site admin of a new user registration */
+		wp_new_user_notification( $user_id );
+
+		/* Remove the activation key meta */
+		delete_user_meta( $user_id, 'activation_key' );
+	}
+
+	/* Update the user_url and display_name */
+	wp_update_user( array( 'ID' => $user_id, 'user_url' => bp_core_get_user_domain( $user_id, sanitize_title( $user_login ), $user_login ), 'display_name' => bp_core_get_user_displayname( $user_id ) ) );
+
+	/* Add a last active entry */
+	update_user_meta( $user_id, 'last_activity', bp_core_current_time() );
+
+	/* Set the password on multisite installs */
+	if ( bp_core_is_multisite() && !empty( $user['meta']['password'] ) )
+		$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->users SET user_pass = %s WHERE ID = %d", $user['meta']['password'], $user_id ) );
+
+	/* Delete the total member cache */
+	wp_cache_delete( 'bp_total_member_count', 'bp' );
+
+	do_action( 'bp_core_activated_user', $user_id, $key, $user );
+
+	return $user_id;
+}
+
+function bp_core_new_user_activity( $user ) {
+	if ( empty( $user ) || !function_exists( 'bp_activity_add' ) )
+		return false;
+
+	if ( is_array( $user ) )
+		$user_id = $user['user_id'];
+	else
+		$user_id = $user;
+
+	if ( empty( $user_id ) )
+		return false;
+
+	$userlink = bp_core_get_userlink( $user_id );
+
+	bp_activity_add( array(
+		'user_id' => $user_id,
+		'action' => apply_filters( 'bp_core_activity_registered_member_action', sprintf( __( '%s became a registered member', 'buddypress' ), $userlink ), $user_id ),
+		'component' => 'profile',
+		'type' => 'new_member'
+	) );
+}
+add_action( 'bp_core_activated_user', 'bp_core_new_user_activity' );
+
+function bp_core_map_user_registration( $user_id ) {
+	/* Only map data when the site admin is adding users, not on registration. */
+	if ( !is_admin() )
+		return false;
+
+	/* Add a last active entry */
+	update_user_meta( $user_id, 'last_activity', bp_core_current_time() );
+
+	/* Add the user's fullname to Xprofile */
+	if ( function_exists( 'xprofile_set_field_data' ) ) {
+		$firstname = get_user_meta( $user_id, 'first_name', true );
+		$lastname = ' ' . get_user_meta( $user_id, 'last_name', true );
+		$name = $firstname . $lastname;
+
+		if ( empty( $name ) || ' ' == $name )
+			$name = get_user_meta( $user_id, 'nickname', true );
+
+		xprofile_set_field_data( 1, $user_id, $name );
+	}
+}
+add_action( 'user_register', 'bp_core_map_user_registration' );
+
+function bp_core_signup_avatar_upload_dir() {
+	global $bp;
+
+	if ( !$bp->signup->avatar_dir )
+		return false;
+
+	$path  = BP_AVATAR_UPLOAD_PATH . '/avatars/signups/' . $bp->signup->avatar_dir;
+	$newbdir = $path;
+
+	if ( !file_exists( $path ) )
+		@wp_mkdir_p( $path );
+
+	$newurl = BP_AVATAR_URL . '/avatars/signups/' . $bp->signup->avatar_dir;
+	$newburl = $newurl;
+	$newsubdir = '/avatars/signups/' . $bp->signup->avatar_dir;
+
+	return apply_filters( 'bp_core_signup_avatar_upload_dir', array( 'path' => $path, 'url' => $newurl, 'subdir' => $newsubdir, 'basedir' => $newbdir, 'baseurl' => $newburl, 'error' => false ) );
+}
+
+function bp_core_signup_send_validation_email( $user_id, $user_email, $key ) {
+	$activate_url = bp_get_activation_page() ."?key=$key";
+	$activate_url = esc_url( $activate_url );
+	$admin_email = get_site_option( "admin_email" );
+
+	if ( empty( $admin_email ) )
+		$admin_email = 'noreply@' . $_SERVER['SERVER_NAME'];
+
+	$from_name = ( '' == get_option( 'blogname' ) ) ? 'BuddyPress' : wp_specialchars( get_option( 'blogname' ) );
+	$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 );
+	$subject = '[' . $from_name . '] ' . __( 'Activate Your Account', 'buddypress' );
+
+	/* Send the message */
+	$to = apply_filters( 'bp_core_activation_signup_user_notification_to', $user_email );
+	$subject = apply_filters( 'bp_core_activation_signup_user_notification_subject', $subject );
+	$message = apply_filters( 'bp_core_activation_signup_user_notification_message', $message );
+
+	wp_mail( $to, $subject, $message, $message_headers );
+}
+
+/* Stop user accounts logging in that have not been activated (user_status = 2) */
+function bp_core_signup_disable_inactive( $auth_obj, $username ) {
+	global $bp, $wpdb;
+
+	if ( !$user_id = bp_core_get_userid( $username ) )
+		return $auth_obj;
+
+	$user_status = (int) $wpdb->get_var( $wpdb->prepare( "SELECT user_status FROM $wpdb->users WHERE ID = %d", $user_id ) );
+
+	if ( 2 == $user_status )
+		bp_core_redirect( $bp->root_domain );
+	else
+		return $auth_obj;
+}
+add_filter( 'authenticate', 'bp_core_signup_disable_inactive', 11, 2 );
+
+/* Kill the wp-signup.php if custom registration signup templates are present */
+function bp_core_wpsignup_redirect() {
+	if ( false === strpos( $_SERVER['SCRIPT_NAME'], 'wp-signup.php') && $_GET['action'] != 'register' )
+		return false;
+
+	if ( locate_template( array( 'registration/register.php' ), false ) || locate_template( array( 'register.php' ), false ) )
+		bp_core_redirect( bp_get_root_domain() . '/' . BP_REGISTER_SLUG . '/' );
+}
+if ( bp_core_is_multisite() )
+	add_action( 'wp', 'bp_core_wpsignup_redirect' );
+else
+	add_action( 'init', 'bp_core_wpsignup_redirect' );
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-templatetags.php b/wp-content/plugins/buddypress/bp-core/bp-core-templatetags.php
new file mode 100644
index 0000000000000000000000000000000000000000..3eabd4a3af3c55efb31068824aceb49c3bfc09fb
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-core/bp-core-templatetags.php
@@ -0,0 +1,2082 @@
+<?php
+/***
+ * Members template loop that will allow you to loop all members or friends of a member
+ * if you pass a user_id.
+ */
+
+class BP_Core_Members_Template {
+	var $current_member = -1;
+	var $member_count;
+	var $members;
+	var $member;
+
+	var $in_the_loop;
+
+	var $pag_page;
+	var $pag_num;
+	var $pag_links;
+	var $total_member_count;
+
+	function bp_core_members_template( $type, $page_number, $per_page, $max, $user_id, $search_terms, $include, $populate_extras ) {
+		global $bp;
+
+		$this->pag_page = isset( $_REQUEST['upage'] ) ? intval( $_REQUEST['upage'] ) : $page_number;
+		$this->pag_num  = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
+		$this->type     = $type;
+
+		if ( isset( $_REQUEST['letter'] ) && '' != $_REQUEST['letter'] )
+			$this->members = BP_Core_User::get_users_by_letter( $_REQUEST['letter'], $this->pag_num, $this->pag_page, $populate_extras );
+		else
+			$this->members = bp_core_get_users( array( 'type' => $this->type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'include' => $include, 'search_terms' => $search_terms, 'populate_extras' => $populate_extras ) );
+
+		if ( !$max || $max >= (int)$this->members['total'] )
+			$this->total_member_count = (int)$this->members['total'];
+		else
+			$this->total_member_count = (int)$max;
+
+		$this->members = $this->members['users'];
+
+		if ( $max ) {
+			if ( $max >= count($this->members) ) {
+				$this->member_count = count( $this->members );
+			} else {
+				$this->member_count = (int)$max;
+			}
+		} else {
+			$this->member_count = count( $this->members );
+		}
+
+		if ( (int)$this->total_member_count && (int)$this->pag_num ) {
+			$this->pag_links = paginate_links( array(
+				'base'      => add_query_arg( 'upage', '%#%' ),
+				'format'    => '',
+				'total'     => ceil( (int)$this->total_member_count / (int)$this->pag_num ),
+				'current'   => (int)$this->pag_page,
+				'prev_text' => '&larr;',
+				'next_text' => '&rarr;',
+				'mid_size'  => 1
+			) );
+		}
+	}
+
+	function has_members() {
+		if ( $this->member_count )
+			return true;
+
+		return false;
+	}
+
+	function next_member() {
+		$this->current_member++;
+		$this->member = $this->members[$this->current_member];
+
+		return $this->member;
+	}
+
+	function rewind_members() {
+		$this->current_member = -1;
+		if ( $this->member_count > 0 ) {
+			$this->member = $this->members[0];
+		}
+	}
+
+	function members() {
+		if ( $this->current_member + 1 < $this->member_count ) {
+			return true;
+		} elseif ( $this->current_member + 1 == $this->member_count ) {
+			do_action('loop_end');
+			// Do some cleaning up after the loop
+			$this->rewind_members();
+		}
+
+		$this->in_the_loop = false;
+		return false;
+	}
+
+	function the_member() {
+		global $member, $bp;
+
+		$this->in_the_loop = true;
+		$this->member = $this->next_member();
+
+		if ( 0 == $this->current_member ) // loop has just started
+			do_action('loop_start');
+	}
+}
+
+function bp_rewind_members() {
+	global $members_template;
+
+	return $members_template->rewind_members();
+}
+
+function bp_has_members( $args = '' ) {
+	global $bp, $members_template;
+
+	/***
+	 * Set the defaults based on the current page. Any of these will be overridden
+	 * if arguments are directly passed into the loop. Custom plugins should always
+	 * pass their parameters directly to the loop.
+	 */
+	$type = 'active';
+	$user_id = false;
+	$page = 1;
+	$search_terms = false;
+
+	// User filtering
+	if ( !empty( $bp->displayed_user->id ) )
+		$user_id = $bp->displayed_user->id;
+
+	// 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
+	$defaults = array(
+		'type' => $type,
+		'page' => $page,
+		'per_page' => 20,
+		'max' => false,
+
+		'include' => false, // Pass a user_id or comma separated list of user_ids to only show these users
+
+		'user_id' => $user_id, // Pass a user_id to only show friends of this user
+		'search_terms' => $search_terms, // Pass search_terms to filter users by their profile data
+
+		'populate_extras' => true // Fetch usermeta? Friend count, last active etc.
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r );
+
+	if ( $max ) {
+		if ( $per_page > $max )
+			$per_page = $max;
+	}
+
+	// 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;
+
+	$members_template = new BP_Core_Members_Template( $type, $page, $per_page, $max, $user_id, $search_terms, $include, (bool)$populate_extras );
+	return apply_filters( 'bp_has_members', $members_template->has_members(), &$members_template );
+}
+
+function bp_the_member() {
+	global $members_template;
+	return $members_template->the_member();
+}
+
+function bp_members() {
+	global $members_template;
+	return $members_template->members();
+}
+
+function bp_members_pagination_count() {
+	global $bp, $members_template;
+
+	$start_num = intval( ( $members_template->pag_page - 1 ) * $members_template->pag_num ) + 1;
+	$from_num = bp_core_number_format( $start_num );
+	$to_num = bp_core_number_format( ( $start_num + ( $members_template->pag_num - 1 ) > $members_template->total_member_count ) ? $members_template->total_member_count : $start_num + ( $members_template->pag_num - 1 ) );
+	$total = bp_core_number_format( $members_template->total_member_count );
+
+	if ( 'active' == $members_template->type )
+		echo sprintf( __( 'Viewing member %1$s to %2$s (of %3$s active members)', 'buddypress' ), $from_num, $to_num, $total );
+	else if ( 'popular' == $members_template->type )
+		echo sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members with friends)', 'buddypress' ), $from_num, $to_num, $total );
+	else if ( 'online' == $members_template->type )
+		echo sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members online)', 'buddypress' ), $from_num, $to_num, $total );
+	else
+		echo sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members)', 'buddypress' ), $from_num, $to_num, $total );
+
+	?><span class="ajax-loader"></span><?php
+}
+
+function bp_members_pagination_links() {
+	echo bp_get_members_pagination_links();
+}
+	function bp_get_members_pagination_links() {
+		global $members_template;
+
+		return apply_filters( 'bp_get_members_pagination_links', $members_template->pag_links );
+	}
+
+/**
+ * bp_member_user_id()
+ *
+ * Echo id from bp_get_member_user_id()
+ *
+ * @uses bp_get_member_user_id()
+ */
+function bp_member_user_id() {
+	echo bp_get_member_user_id();
+}
+	/**
+	 * bp_get_member_user_id()
+	 *
+	 * Get the id of the user in a members loop
+	 *
+	 * @global object $members_template
+	 * @return string Members id
+	 */
+	function bp_get_member_user_id() {
+		global $members_template;
+
+		return apply_filters( 'bp_get_member_user_id', $members_template->member->id );
+	}
+
+/**
+ * bp_member_user_nicename()
+ *
+ * Echo nicename from bp_get_member_user_nicename()
+ *
+ * @uses bp_get_member_user_nicename()
+ */
+function bp_member_user_nicename() {
+	echo bp_get_member_user_nicename();
+}
+	/**
+	 * bp_get_member_user_nicename()
+	 *
+	 * Get the nicename of the user in a members loop
+	 *
+	 * @global object $members_template
+	 * @return string Members nicename
+	 */
+	function bp_get_member_user_nicename() {
+		global $members_template;
+		return apply_filters( 'bp_get_member_user_nicename', $members_template->member->user_nicename );
+	}
+
+/**
+ * bp_member_user_login()
+ *
+ * Echo login from bp_get_member_user_login()
+ *
+ * @uses bp_get_member_user_login()
+ */
+function bp_member_user_login() {
+	echo bp_get_member_user_login();
+}
+	/**
+	 * bp_get_member_user_login()
+	 *
+	 * Get the login of the user in a members loop
+	 *
+	 * @global object $members_template
+	 * @return string Members login
+	 */
+	function bp_get_member_user_login() {
+		global $members_template;
+		return apply_filters( 'bp_get_member_user_login', $members_template->member->user_login );
+	}
+
+/**
+ * bp_member_user_email()
+ *
+ * Echo email address from bp_get_member_user_email()
+ *
+ * @uses bp_get_member_user_email()
+ */
+function bp_member_user_email() {
+	echo bp_get_member_user_email();
+}
+	/**
+	 * bp_get_member_user_email()
+	 *
+	 * Get the email address of the user in a members loop
+	 *
+	 * @global object $members_template
+	 * @return string Members email address
+	 */
+	function bp_get_member_user_email() {
+		global $members_template;
+		return apply_filters( 'bp_get_member_user_email', $members_template->member->user_email );
+	}
+
+function bp_member_is_loggedin_user() {
+	global $bp, $members_template;
+	return apply_filters( 'bp_member_is_loggedin_user', $bp->loggedin_user->id == $members_template->member->id ? true : false );
+}
+
+function bp_member_avatar( $args = '' ) {
+	echo apply_filters( 'bp_member_avatar', bp_get_member_avatar( $args ) );
+}
+	function bp_get_member_avatar( $args = '' ) {
+		global $bp, $members_template;
+
+		$defaults = array(
+			'type' => 'thumb',
+			'width' => false,
+			'height' => false,
+			'class' => 'avatar',
+			'id' => false,
+			'alt' => __( 'Member avatar', 'buddypress' )
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		return apply_filters( 'bp_get_member_avatar', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->id, 'type' => $type, 'alt' => $alt, 'css_id' => $id, 'class' => $class, 'width' => $width, 'height' => $height, 'email' => $members_template->member->user_email ) ) );
+	}
+
+function bp_member_permalink() {
+	echo bp_get_member_permalink();
+}
+	function bp_get_member_permalink() {
+		global $members_template;
+
+		return apply_filters( 'bp_get_member_permalink', bp_core_get_user_domain( $members_template->member->id, $members_template->member->user_nicename, $members_template->member->user_login ) );
+	}
+	function bp_member_link() { echo bp_get_member_permalink(); }
+	function bp_get_member_link() { return bp_get_member_permalink(); }
+
+function bp_member_name() {
+	echo apply_filters( 'bp_member_name', bp_get_member_name() );
+}
+	function bp_get_member_name() {
+		global $members_template;
+
+		if ( empty($members_template->member->fullname) )
+			$members_template->member->fullname = $members_template->member->display_name;
+
+		return apply_filters( 'bp_get_member_name', $members_template->member->fullname );
+	}
+	add_filter( 'bp_get_member_name', 'wp_filter_kses' );
+	add_filter( 'bp_get_member_name', 'stripslashes' );
+	add_filter( 'bp_get_member_name', 'strip_tags' );
+
+function bp_member_last_active() {
+	echo bp_get_member_last_active();
+}
+	function bp_get_member_last_active() {
+		global $members_template;
+
+		$last_activity = bp_core_get_last_activity( $members_template->member->last_activity, __( 'active %s ago', 'buddypress' ) );
+
+		return apply_filters( 'bp_member_last_active', $last_activity );
+	}
+
+function bp_member_latest_update( $args = '' ) {
+	echo bp_get_member_latest_update( $args );
+}
+	function bp_get_member_latest_update( $args = '' ) {
+		global $members_template, $bp;
+
+		$defaults = array(
+			'length' => 15
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		if ( !$update = maybe_unserialize( $members_template->member->latest_update ) )
+			return false;
+
+		$update_content = apply_filters( 'bp_get_activity_latest_update', strip_tags( bp_create_excerpt( $update['content'], $length ) ) );
+
+		if ( !empty( $update['id'] ) )
+			$update_content .= ' &middot; <a href="' . $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $update['id'] . '">' . __( 'View', 'buddypress' ) . '</a>';
+
+		return apply_filters( 'bp_get_member_latest_update', $update_content );
+	}
+
+function bp_member_profile_data( $args = '' ) {
+	echo bp_get_member_profile_data( $args );
+}
+	function bp_get_member_profile_data( $args = '' ) {
+		global $members_template;
+
+		if ( !function_exists( 'xprofile_install' ) )
+			return false;
+
+		$defaults = array(
+			'field' => false, // Field name
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		// Populate the user if it hasn't been already.
+		if ( empty( $members_template->member->profile_data ) && method_exists( 'BP_XProfile_ProfileData', 'get_all_for_user' ) )
+			$members_template->member->profile_data = BP_XProfile_ProfileData::get_all_for_user( $members_template->member->id );
+
+		$data = xprofile_format_profile_field( $members_template->member->profile_data[$field]['field_type'], $members_template->member->profile_data[$field]['field_data'] );
+
+		return apply_filters( 'bp_get_member_profile_data', $data );
+	}
+
+function bp_member_registered() {
+	echo bp_get_member_registered();
+}
+	function bp_get_member_registered() {
+		global $members_template;
+
+		$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 );
+	}
+
+function bp_member_random_profile_data() {
+	global $members_template;
+
+	if ( function_exists( 'xprofile_get_random_profile_data' ) ) { ?>
+		<?php $random_data = xprofile_get_random_profile_data( $members_template->member->id, true ); ?>
+			<strong><?php echo wp_filter_kses( $random_data[0]->name ) ?></strong>
+			<?php echo wp_filter_kses( $random_data[0]->value ) ?>
+	<?php }
+}
+
+function bp_member_hidden_fields() {
+	if ( isset( $_REQUEST['s'] ) ) {
+		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="' . esc_attr( $_REQUEST['letter'] ) . '" name="selected_letter" />';
+	}
+
+	if ( isset( $_REQUEST['members_search'] ) ) {
+		echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['members_search'] ) . '" name="search_terms" />';
+	}
+}
+
+function bp_directory_members_search_form() {
+	global $bp;
+
+	$search_value = __( 'Search anything...', 'buddypress' );
+	if ( !empty( $_GET['s'] ) )
+	 	$search_value = $_GET['s'];
+
+	?>
+	<form action="" method="get" id="search-members-form">
+		<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
+}
+
+function bp_total_site_member_count() {
+	echo bp_get_total_site_member_count();
+}
+	function bp_get_total_site_member_count() {
+		return apply_filters( 'bp_get_total_site_member_count', bp_core_number_format( bp_core_get_total_member_count() ) );
+	}
+
+
+/** Navigation and other misc template tags **/
+
+/**
+ * bp_get_nav()
+ * TEMPLATE TAG
+ *
+ * Uses the $bp->bp_nav global to render out the navigation within a BuddyPress install.
+ * Each component adds to this navigation array within its own [component_name]_setup_nav() function.
+ *
+ * This navigation array is the top level navigation, so it contains items such as:
+ *      [Blog, Profile, Messages, Groups, Friends] ...
+ *
+ * The function will also analyze the current component the user is in, to determine whether
+ * or not to highlight a particular nav item.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ */
+function bp_get_loggedin_user_nav() {
+	global $bp, $current_blog;
+
+	/* Loop through each navigation item */
+	foreach( (array) $bp->bp_nav as $nav_item ) {
+		/* If the current component matches the nav item id, then add a highlight CSS class. */
+		if ( !bp_is_directory() && $bp->active_components[$bp->current_component] == $nav_item['css_id'] )
+			$selected = ' class="current selected"';
+		else
+			$selected = '';
+
+		/* If we are viewing another person (current_userid does not equal loggedin_user->id)
+		   then check to see if the two users are friends. if they are, add a highlight CSS class
+		   to the friends nav item if it exists. */
+		if ( !bp_is_my_profile() && $bp->displayed_user->id ) {
+			$selected = '';
+
+			if ( function_exists('friends_install') ) {
+				if ( $nav_item['css_id'] == $bp->friends->id ) {
+					if ( friends_check_friendship( $bp->loggedin_user->id, $bp->displayed_user->id ) )
+						$selected = ' class="current selected"';
+				}
+			}
+		}
+
+		/* echo out the final list item */
+		echo apply_filters( 'bp_get_loggedin_user_nav_' . $nav_item['css_id'], '<li id="li-nav-' . $nav_item['css_id'] . '" ' . $selected . '><a id="my-' . $nav_item['css_id'] . '" href="' . $nav_item['link'] . '">' . $nav_item['name'] . '</a></li>', &$nav_item );
+	}
+
+	/* Always add a log out list item to the end of the navigation */
+	if ( function_exists( 'wp_logout_url' ) ) {
+		$logout_link = '<li><a id="wp-logout" href="' .  wp_logout_url( $bp->root_domain ) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';
+	} else {
+		$logout_link = '<li><a id="wp-logout" href="' . site_url() . '/wp-login.php?action=logout&amp;redirect_to=' . $bp->root_domain . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';
+	}
+
+	echo apply_filters( 'bp_logout_nav_link', $logout_link );
+}
+
+/**
+ * bp_get_displayed_user_nav()
+ * TEMPLATE TAG
+ *
+ * Uses the $bp->bp_users_nav global to render out the user navigation when viewing another user other than
+ * yourself.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ */
+function bp_get_displayed_user_nav() {
+	global $bp;
+
+	foreach ( (array)$bp->bp_nav as $user_nav_item ) {
+		if ( !$user_nav_item['show_for_displayed_user'] && !bp_is_my_profile() )
+			continue;
+
+		if ( $bp->current_component == $user_nav_item['slug'] )
+			$selected = ' class="current selected"';
+		else
+			$selected = '';
+
+		if ( $bp->loggedin_user->domain )
+			$link = str_replace( $bp->loggedin_user->domain, $bp->displayed_user->domain, $user_nav_item['link'] );
+		else
+			$link = $bp->displayed_user->domain . $user_nav_item['link'];
+
+		echo apply_filters( 'bp_get_displayed_user_nav_' . $user_nav_item['css_id'], '<li id="' . $user_nav_item['css_id'] . '-personal-li" ' . $selected . '><a id="user-' . $user_nav_item['css_id'] . '" href="' . $link . '">' . $user_nav_item['name'] . '</a></li>', &$user_nav_item );
+	}
+}
+
+/**
+ * bp_get_options_nav()
+ * TEMPLATE TAG
+ *
+ * Uses the $bp->bp_options_nav global to render out the sub navigation for the current component.
+ * Each component adds to its sub navigation array within its own [component_name]_setup_nav() function.
+ *
+ * This sub navigation array is the secondary level navigation, so for profile it contains:
+ *      [Public, Edit Profile, Change Avatar]
+ *
+ * The function will also analyze the current action for the current component to determine whether
+ * or not to highlight a particular sub nav item.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @uses bp_get_user_nav() Renders the navigation for a profile of a currently viewed user.
+ */
+function bp_get_options_nav() {
+	global $bp;
+
+	if ( count( $bp->bp_options_nav[$bp->current_component] ) < 1 )
+		return false;
+
+	/* Loop through each navigation item */
+	foreach ( (array)$bp->bp_options_nav[$bp->current_component] as $subnav_item ) {
+		if ( !$subnav_item['user_has_access'] )
+			continue;
+
+		/* If the current action or an action variable matches the nav item id, then add a highlight CSS class. */
+		if ( $subnav_item['slug'] == $bp->current_action ) {
+			$selected = ' class="current selected"';
+		} else {
+			$selected = '';
+		}
+
+		/* echo out the final list item */
+		echo apply_filters( 'bp_get_options_nav_' . $subnav_item['css_id'], '<li id="' . $subnav_item['css_id'] . '-personal-li" ' . $selected . '><a id="' . $subnav_item['css_id'] . '" href="' . $subnav_item['link'] . '">' . $subnav_item['name'] . '</a></li>', $subnav_item );
+	}
+}
+
+function bp_get_options_title() {
+	global $bp;
+
+	if ( empty( $bp->bp_options_title ) )
+		$bp->bp_options_title = __( 'Options', 'buddypress' );
+
+	echo apply_filters( 'bp_get_options_title', esc_attr( $bp->bp_options_title ) );
+}
+
+
+/** AVATAR TEMPLATE TAGS *******************************************************/
+
+/**
+ * bp_has_options_avatar()
+ * TEMPLATE TAG
+ *
+ * Check to see if there is an options avatar. An options avatar is an avatar for something
+ * like a group, or a friend. Basically an avatar that appears in the sub nav options bar.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ */
+function bp_has_options_avatar() {
+	global $bp;
+
+	if ( empty( $bp->bp_options_avatar ) )
+		return false;
+
+	return true;
+}
+
+function bp_get_options_avatar() {
+	global $bp;
+
+	echo apply_filters( 'bp_get_options_avatar', $bp->bp_options_avatar );
+}
+
+function bp_comment_author_avatar() {
+	global $comment;
+
+	if ( function_exists('bp_core_fetch_avatar') ) {
+		echo apply_filters( 'bp_comment_author_avatar', bp_core_fetch_avatar( array( 'item_id' => $comment->user_id, 'type' => 'thumb' ) ) );
+	} else if ( function_exists('get_avatar') ) {
+		get_avatar();
+	}
+}
+
+function bp_post_author_avatar() {
+	global $post;
+
+	if ( function_exists('bp_core_fetch_avatar') ) {
+		echo apply_filters( 'bp_post_author_avatar', bp_core_fetch_avatar( array( 'item_id' => $post->post_author, 'type' => 'thumb' ) ) );
+	} else if ( function_exists('get_avatar') ) {
+		get_avatar();
+	}
+}
+
+function bp_loggedin_user_avatar( $args = '' ) {
+	echo bp_get_loggedin_user_avatar( $args );
+}
+	function bp_get_loggedin_user_avatar( $args = '' ) {
+		global $bp;
+
+		$defaults = array(
+			'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, 'html' => $html ) ) );
+	}
+
+function bp_displayed_user_avatar( $args = '' ) {
+	echo bp_get_displayed_user_avatar( $args );
+}
+	function bp_get_displayed_user_avatar( $args = '' ) {
+		global $bp;
+
+		$defaults = array(
+			'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, 'html' => $html ) ) );
+	}
+
+function bp_avatar_admin_step() {
+	echo bp_get_avatar_admin_step();
+}
+	function bp_get_avatar_admin_step() {
+		global $bp;
+
+		return apply_filters( 'bp_get_avatar_admin_step', $bp->avatar_admin->step );
+	}
+
+function bp_avatar_to_crop() {
+	echo bp_get_avatar_to_crop();
+}
+	function bp_get_avatar_to_crop() {
+		global $bp;
+
+		return apply_filters( 'bp_get_avatar_to_crop', $bp->avatar_admin->image->url );
+	}
+
+function bp_avatar_to_crop_src() {
+	echo bp_get_avatar_to_crop_src();
+}
+	function bp_get_avatar_to_crop_src() {
+		global $bp;
+
+		return apply_filters( 'bp_get_avatar_to_crop_src', str_replace( WP_CONTENT_DIR, '', $bp->avatar_admin->image->dir ) );
+	}
+
+function bp_avatar_cropper() {
+	global $bp;
+
+	echo '<img id="avatar-to-crop" class="avatar" src="' . $bp->avatar_admin->image . '" />';
+}
+
+/** OTHER TEMPLATE TAGS *******************************************************/
+
+function bp_site_name() {
+	echo apply_filters( 'bp_site_name', get_blog_option( BP_ROOT_BLOG, 'blogname' ) );
+}
+
+function bp_core_get_wp_profile() {
+	global $bp;
+
+	$ud = get_userdata( $bp->displayed_user->id );
+?>
+
+<div class="bp-widget wp-profile">
+	<h4><?php _e( 'My Profile' ) ?></h4>
+
+	<table class="wp-profile-fields zebra">
+		<?php if ( $ud->display_name ) { ?>
+		<tr id="wp_displayname">
+			<td class="label">
+				<?php _e( 'Name', 'buddypress' ) ?>
+			</td>
+			<td class="data">
+				<?php echo $ud->display_name ?>
+			</td>
+		</tr>
+		<?php } ?>
+		<?php if ( $ud->user_description ) { ?>
+		<tr id="wp_desc">
+			<td class="label">
+				<?php _e( 'About Me', 'buddypress' ) ?>
+			</td>
+			<td class="data">
+				<?php echo $ud->user_description ?>
+			</td>
+		</tr>
+		<?php } ?>
+		<?php if ( $ud->user_url ) { ?>
+		<tr id="wp_website">
+			<td class="label">
+				<?php _e( 'Website', 'buddypress' ) ?>
+			</td>
+			<td class="data">
+				<?php echo make_clickable( $ud->user_url ) ?>
+			</td>
+		</tr>
+		<?php } ?>
+		<?php if ( $ud->jabber ) { ?>
+		<tr id="wp_jabber">
+			<td class="label">
+				<?php _e( 'Jabber', 'buddypress' ) ?>
+			</td>
+			<td class="data">
+				<?php echo $ud->jabber ?>
+			</td>
+		</tr>
+		<?php } ?>
+		<?php if ( $ud->aim ) { ?>
+		<tr id="wp_aim">
+			<td class="label">
+				<?php _e( 'AOL Messenger', 'buddypress' ) ?>
+			</td>
+			<td class="data">
+				<?php echo $ud->aim ?>
+			</td>
+		</tr>
+		<?php } ?>
+		<?php if ( $ud->yim ) { ?>
+		<tr id="wp_yim">
+			<td class="label">
+				<?php _e( 'Yahoo Messenger', 'buddypress' ) ?>
+			</td>
+			<td class="data">
+				<?php echo $ud->yim ?>
+			</td>
+		</tr>
+		<?php } ?>
+	</table>
+</div>
+<?php
+}
+
+function bp_get_profile_header() {
+	locate_template( array( '/profile/profile-header.php' ), true );
+}
+
+function bp_exists( $component_name ) {
+	if ( function_exists($component_name . '_install') )
+		return true;
+
+	return false;
+}
+
+function bp_format_time( $time, $just_date = false ) {
+	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 ) {
+		// 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 );
+}
+
+function bp_word_or_name( $youtext, $nametext, $capitalize = true, $echo = true ) {
+	global $bp;
+
+	if ( $capitalize )
+		$youtext = bp_core_ucfirst($youtext);
+
+	if ( $bp->displayed_user->id == $bp->loggedin_user->id ) {
+		if ( $echo )
+			echo apply_filters( 'bp_word_or_name', $youtext );
+		else
+			return apply_filters( 'bp_word_or_name', $youtext );
+	} else {
+		$fullname = (array)explode( ' ', $bp->displayed_user->fullname );
+		$nametext = sprintf( $nametext, $fullname[0] );
+		if ( $echo )
+			echo apply_filters( 'bp_word_or_name', $nametext );
+		else
+			return apply_filters( 'bp_word_or_name', $nametext );
+	}
+}
+
+function bp_your_or_their( $capitalize = true, $echo = true ) {
+	global $bp;
+
+	if ( $capitalize )
+		$yourtext = bp_core_ucfirst($yourtext);
+
+	if ( $bp->displayed_user->id == $bp->loggedin_user->id ) {
+		if ( $echo )
+			echo apply_filters( 'bp_your_or_their', $yourtext );
+		else
+			return apply_filters( 'bp_your_or_their', $yourtext );
+	} else {
+		if ( $echo )
+			echo apply_filters( 'bp_your_or_their', $theirtext );
+		else
+			return apply_filters( 'bp_your_or_their', $theirtext );
+	}
+}
+
+function bp_get_plugin_sidebar() {
+	locate_template( array( 'plugin-sidebar.php' ), true );
+}
+
+function bp_page_title() {
+	echo bp_get_page_title();
+}
+
+function bp_get_page_title() {
+	global $bp, $post, $wp_query, $current_blog;
+
+	if ( is_front_page() || ( is_home() && bp_is_page( 'home' ) ) ) {
+		$title = __( 'Home', 'buddypress' );
+
+	} else if ( bp_is_blog_page() ) {
+		if ( is_single() ) {
+			$title = __( 'Blog &#124; ' . $post->post_title, 'buddypress' );
+		} else if ( is_category() ) {
+			$title = __( 'Blog &#124; Categories &#124; ' . ucwords( $wp_query->query_vars['category_name'] ), 'buddypress' );
+		} else if ( is_tag() ) {
+			$title = __( 'Blog &#124; Tags &#124; ' . ucwords( $wp_query->query_vars['tag'] ), 'buddypress' );
+		} else if ( is_page() ){
+			$title = $post->post_title;
+		} else
+			$title = __( 'Blog', 'buddypress' );
+
+	} else if ( !empty( $bp->displayed_user->fullname ) ) {
+ 		$title = strip_tags( $bp->displayed_user->fullname . ' &#124; ' . ucwords( $bp->current_component ) );
+
+	} else if ( $bp->is_single_item ) {
+		$title = ucwords( $bp->current_component ) . ' &#124; ' . $bp->bp_options_title . ' &#124; ' . $bp->bp_options_nav[$bp->current_component][$bp->current_action]['name'];
+
+	} else if ( $bp->is_directory ) {
+		if ( !$bp->current_component )
+			$title = sprintf( __( '%s Directory', 'buddypress' ), ucwords( BP_MEMBERS_SLUG ) );
+		else
+			$title = sprintf( __( '%s Directory', 'buddypress' ), ucwords( $bp->current_component ) );
+
+	} else if ( bp_is_register_page() ) {
+		$title = __( 'Create an Account', 'buddypress' );
+
+	} else if ( bp_is_activation_page() ) {
+		$title = __( 'Activate your Account', 'buddypress' );
+
+	} else if ( bp_is_group_create() ) {
+		$title = __( 'Create a Group', 'buddypress' );
+
+	} else if ( bp_is_create_blog() ) {
+		$title = __( 'Create a Blog', 'buddypress' );
+	}
+
+	if ( defined( 'BP_ENABLE_MULTIBLOG' ) ) {
+		$blog_title = get_blog_option( $current_blog->blog_id, 'blogname' );
+	} else {
+		$blog_title = get_blog_option( BP_ROOT_BLOG, 'blogname' );
+	}
+
+	return apply_filters( 'bp_page_title', $blog_title . ' &#124; ' . esc_attr( $title ), esc_attr( $title ) );
+}
+
+function bp_styles() {
+	do_action( 'bp_styles' );
+	wp_print_styles();
+}
+
+function bp_has_custom_signup_page() {
+	if ( locate_template( array( 'register.php' ), false ) || locate_template( array( '/registration/register.php' ), false ) )
+		return true;
+
+	return false;
+}
+
+function bp_signup_page() {
+	echo bp_get_signup_page();
+}
+	function bp_get_signup_page() {
+		global $bp;
+
+		if ( bp_has_custom_signup_page() )
+			$page = $bp->root_domain . '/' . BP_REGISTER_SLUG;
+		else
+			$page = $bp->root_domain . '/wp-signup.php';
+
+		return apply_filters( 'bp_get_signup_page', $page );
+	}
+
+function bp_has_custom_activation_page() {
+	if ( locate_template( array( 'activate.php' ), false ) || locate_template( array( '/registration/activate.php' ), false ) )
+		return true;
+
+	return false;
+}
+
+function bp_activation_page() {
+	echo bp_get_activation_page();
+}
+	function bp_get_activation_page() {
+		global $bp;
+
+		if ( bp_has_custom_activation_page() )
+			$page = $bp->root_domain . '/' . BP_ACTIVATION_SLUG;
+		else
+			$page = $bp->root_domain . '/wp-activate.php';
+
+		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;
+
+	return apply_filters( 'bp_search_form_action', $bp->root_domain . '/' . BP_SEARCH_SLUG );
+}
+
+function bp_search_form_type_select() {
+	global $bp;
+
+	// Eventually this won't be needed and a page will be built to integrate all search results.
+	$selection_box = '<select name="search-which" id="search-which" style="width: auto">';
+
+	if ( function_exists( 'xprofile_install' ) )
+		$selection_box .= '<option value="members">' . __( 'Members', 'buddypress' ) . '</option>';
+
+	if ( function_exists( 'groups_install' ) )
+		$selection_box .= '<option value="groups">' . __( 'Groups', 'buddypress' ) . '</option>';
+
+	if ( function_exists( 'bp_forums_setup' ) && !(int)$bp->site_options['bp-disable-forum-directory'] )
+		$selection_box .= '<option value="forums">' . __( 'Forums', 'buddypress' ) . '</option>';
+
+	if ( function_exists( 'bp_blogs_install' ) && bp_core_is_multisite() )
+		$selection_box .= '<option value="blogs">' . __( 'Blogs', 'buddypress' ) . '</option>';
+
+	$selection_box .= '</select>';
+
+	return apply_filters( 'bp_search_form_type_select', $selection_box );
+}
+
+function bp_search_form() {
+	$form = '
+		<form action="' . bp_search_form_action() . '" method="post" id="search-form">
+			<input type="text" id="search-terms" name="search-terms" value="" />
+			' . bp_search_form_type_select() . '
+
+			<input type="submit" name="search-submit" id="search-submit" value="' . __( 'Search', 'buddypress' ) . '" />
+			' . wp_nonce_field( 'bp_search_form' ) . '
+		</form>
+	';
+
+	echo apply_filters( 'bp_search_form', $form );
+}
+
+function bp_log_out_link() {
+	global $bp;
+	if ( function_exists('wp_logout_url') )
+		$logout_link = '<a href="' . wp_logout_url( $bp->root_domain ) . '">' . __( 'Log Out', 'buddypress' ) . '</a>';
+	else
+		$logout_link = '<a href="' . $bp->root_domain . '/wp-login.php?action=logout&amp;redirect_to=' . $bp->root_domain . '">' . __( 'Log Out', 'buddypress' ) . '</a>';
+
+	echo apply_filters( 'bp_logout_link', $logout_link );
+}
+
+function bp_custom_profile_boxes() {
+	do_action( 'bp_custom_profile_boxes' );
+}
+
+function bp_custom_profile_sidebar_boxes() {
+	do_action( 'bp_custom_profile_sidebar_boxes' );
+}
+
+/**
+ * bp_button( $button )
+ *
+ * Creates and outputs a button.
+ * Args: div_id | div_class | a_href | a_title | a_id | a_class | a_rel | a_text
+ *
+ * @param array $button
+ */
+function bp_button( $button = '' ) {
+	echo bp_get_button( $button );
+}
+	/**
+	 * bp_get_button( $button )
+	 *
+	 * Creates and returns a button.
+	 * Args: div_id | div_class | a_href | a_title | a_id | a_class | a_rel | a_text
+	 *
+	 * @param array $button
+	 * @return string
+	 */
+	function bp_get_button( $button = '' ) {
+		$btn = new BP_Button( $button );
+		return apply_filters( 'bp_get_button', $btn->contents, $button );
+	}
+
+/**
+ * bp_create_excerpt()
+ *
+ * Fakes an excerpt on any content. Will not truncate words.
+ *
+ * @package BuddyPress Core
+ * @param $text str The text to create the excerpt from
+ * @uses $excerpt_length The maximum length in characters of the excerpt.
+ * @return str The excerpt text
+ */
+function bp_create_excerpt( $text, $excerpt_length = 55, $filter_shortcodes = true ) { // Fakes an excerpt if needed
+	$text = str_replace(']]>', ']]&gt;', $text);
+
+	if ( $filter_shortcodes )
+		$text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
+
+	$words = preg_split(
+		"%\s*((?:<[^>]+>)+\S*)\s*|\s+%s",
+		$text,
+		$excerpt_length + 1,
+		PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
+	);
+
+	if (count($words) > $excerpt_length) {
+		array_pop($words);
+		array_push($words, '[...]');
+		$text = implode(' ', $words);
+	}
+
+	return apply_filters( 'bp_create_excerpt', $text );
+}
+add_filter( 'bp_create_excerpt', 'wp_trim_excerpt' );
+add_filter( 'bp_create_excerpt', 'stripslashes_deep' );
+add_filter( 'bp_create_excerpt', 'force_balance_tags' );
+
+function bp_total_member_count() {
+	echo bp_get_total_member_count();
+}
+	function bp_get_total_member_count() {
+		return apply_filters( 'bp_get_total_member_count', bp_core_get_total_member_count() );
+	}
+	add_filter( 'bp_get_total_member_count', 'bp_core_number_format' );
+
+/*** Signup form template tags **********************/
+
+function bp_signup_username_value() {
+	echo bp_get_signup_username_value();
+}
+	function bp_get_signup_username_value() {
+		return apply_filters( 'bp_get_signup_username_value', $_POST['signup_username'] );
+	}
+
+function bp_signup_email_value() {
+	echo bp_get_signup_email_value();
+}
+	function bp_get_signup_email_value() {
+		return apply_filters( 'bp_get_signup_email_value', $_POST['signup_email'] );
+	}
+
+function bp_signup_with_blog_value() {
+	echo bp_get_signup_with_blog_value();
+}
+	function bp_get_signup_with_blog_value() {
+		return apply_filters( 'bp_get_signup_with_blog_value', $_POST['signup_with_blog'] );
+	}
+
+function bp_signup_blog_url_value() {
+	echo bp_get_signup_blog_url_value();
+}
+	function bp_get_signup_blog_url_value() {
+		return apply_filters( 'bp_get_signup_blog_url_value', $_POST['signup_blog_url'] );
+	}
+
+function bp_signup_blog_title_value() {
+	echo bp_get_signup_blog_title_value();
+}
+	function bp_get_signup_blog_title_value() {
+		return apply_filters( 'bp_get_signup_blog_title_value', $_POST['signup_blog_title'] );
+	}
+
+function bp_signup_blog_privacy_value() {
+	echo bp_get_signup_blog_privacy_value();
+}
+	function bp_get_signup_blog_privacy_value() {
+		return apply_filters( 'bp_get_signup_blog_privacy_value', $_POST['signup_blog_privacy'] );
+	}
+
+function bp_signup_avatar_dir_value() {
+	echo bp_get_signup_avatar_dir_value();
+}
+	function bp_get_signup_avatar_dir_value() {
+		global $bp;
+
+		return apply_filters( 'bp_get_signup_avatar_dir_value', $bp->signup->avatar_dir );
+	}
+
+function bp_current_signup_step() {
+	echo bp_get_current_signup_step();
+}
+	function bp_get_current_signup_step() {
+		global $bp;
+
+		return $bp->signup->step;
+	}
+
+function bp_signup_avatar( $args = '' ) {
+	echo bp_get_signup_avatar( $args );
+}
+	function bp_get_signup_avatar( $args = '' ) {
+		global $bp;
+
+		$defaults = array(
+			'size' => BP_AVATAR_FULL_WIDTH,
+			'class' => 'avatar',
+			'alt' => __( 'Your Avatar', 'buddypress' )
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		$signup_avatar_dir = ( !empty( $_POST['signup_avatar_dir'] ) ) ? $_POST['signup_avatar_dir'] : $bp->signup->avatar_dir;
+
+		if ( empty( $signup_avatar_dir ) ) {
+			if ( empty( $bp->grav_default->user ) ) {
+				$default_grav = 'wavatar';
+			} else if ( 'mystery' == $bp->grav_default->user ) {
+				$default_grav = BP_PLUGIN_URL . '/bp-core/images/mystery-man.jpg';
+			} else {
+				$default_grav = $bp->grav_default->user;
+			}
+
+			$gravatar_url = apply_filters( 'bp_gravatar_url', 'http://www.gravatar.com/avatar/' );
+			$gravatar_img = '<img src="' . $gravatar_url . md5( strtolower( $_POST['signup_email'] ) ) . '?d=' . $default_grav . '&amp;s=' . $size . '" width="' . $size . '" height="' . $size . '" alt="' . $alt . '" class="' . $class . '" />';
+		} else {
+			$gravatar_img = bp_core_fetch_avatar( array( 'item_id' => $signup_avatar_dir, 'object' => 'signup', 'avatar_dir' => 'avatars/signups', 'type' => 'full', 'width' => $size, 'height' => $size, 'alt' => $alt, 'class' => $class ) );
+		}
+
+		return apply_filters( 'bp_get_signup_avatar', $gravatar_img );
+	}
+
+function bp_signup_allowed() {
+	echo bp_get_signup_allowed();
+}
+	function bp_get_signup_allowed() {
+		global $bp;
+
+		if ( bp_core_is_multisite() ) {
+			if ( in_array( $bp->site_options['registration'], array( 'all', 'user' ) ) )
+				return true;
+		} else {
+			if ( (int)get_option( 'users_can_register') )
+				return true;
+		}
+		return false;
+	}
+
+function bp_blog_signup_allowed() {
+	echo bp_get_blog_signup_allowed();
+}
+	function bp_get_blog_signup_allowed() {
+		global $bp;
+
+		if ( !bp_core_is_multisite() )
+			return false;
+
+		$status = $bp->site_options['registration'];
+		if ( 'none' != $status && 'user' != $status )
+			return true;
+
+		return false;
+	}
+
+function bp_account_was_activated() {
+	global $bp;
+
+	return $bp->activation_complete;
+}
+
+function bp_registration_needs_activation() {
+	return apply_filters( 'bp_registration_needs_activation', true );
+}
+
+function bp_mentioned_user_display_name( $user_id_or_username ) {
+	echo bp_get_mentioned_user_display_name( $user_id_or_username );
+}
+	function bp_get_mentioned_user_display_name( $user_id_or_username ) {
+		if ( !$name = bp_core_get_user_displayname( $user_id_or_username ) )
+			$name = __( 'a user' );
+
+		return apply_filters( 'bp_get_mentioned_user_display_name', $name, $user_id_or_username );
+	}
+
+function bp_get_option( $option_name ) {
+	global $bp;
+
+	return apply_filters( 'bp_get_option', $bp->site_options[$option_name] );
+}
+
+/**
+ * Allow templates to pass parameters directly into the template loops via AJAX
+ *
+ * For the most part this will be filtered in a theme's functions.php for example
+ * in the default theme it is filtered via bp_dtheme_ajax_querystring()
+ *
+ * By using this template tag in the templates it will stop them from showing errors
+ * if someone copies the templates from the default theme into another WordPress theme
+ * without coping the functions from functions.php.
+ */
+function bp_ajax_querystring( $object = false ) {
+	global $bp;
+
+	$bp->ajax_querystring = apply_filters( 'bp_ajax_querystring', $query_string, $object );
+	return $bp->ajax_querystring;
+}
+
+
+/*** CUSTOM LOOP TEMPLATE CLASSES *******************/
+
+
+/* Template functions for fetching globals, without querying the DB again
+   also means we dont have to use the $bp variable in the template (looks messy) */
+
+function bp_last_activity( $user_id = false, $echo = true ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = $bp->displayed_user->id;
+
+	$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 );
+	else
+		return apply_filters( 'bp_last_activity', $last_activity );
+}
+
+function bp_user_has_access() {
+	global $bp;
+
+	if ( is_super_admin() || is_user_logged_in() && $bp->loggedin_user->id == $bp->displayed_user->id )
+		$has_access = true;
+	else
+		$has_access = false;
+
+	return apply_filters( 'bp_user_has_access', $has_access );
+}
+
+function bp_user_firstname() {
+	echo bp_get_user_firstname();
+}
+	function bp_get_user_firstname( $name = false ) {
+		global $bp;
+
+		// Try to get displayed user
+		if ( empty( $name ) )
+			$name = $bp->displayed_user->fullname;
+
+		// Fall back on logged in user
+		if ( empty( $name ) )
+			$name = $bp->loggedin_user->fullname;
+
+		$fullname = (array)explode( ' ', $name );
+
+		return apply_filters( 'bp_get_user_firstname', $fullname[0], $fullname );
+	}
+
+function bp_loggedin_user_link() {
+	echo bp_get_loggedin_user_link();
+}
+	function bp_get_loggedin_user_link() {
+		global $bp;
+
+		return apply_filters( 'bp_get_loggedin_user_link', $bp->loggedin_user->domain );
+	}
+
+/* @todo Deprecate incorrectly named function? */
+function bp_loggedinuser_link() {
+	global $bp;
+
+	if ( $link = bp_core_get_userlink( $bp->loggedin_user->id ) )
+		echo apply_filters( 'bp_loggedin_user_link', $link );
+}
+
+function bp_displayed_user_link() {
+	echo bp_get_displayed_user_link();
+}
+	function bp_get_displayed_user_link() {
+		global $bp;
+
+		return apply_filters( 'bp_get_displayed_user_link', $bp->displayed_user->domain );
+	}
+	function bp_user_link() { bp_displayed_user_link(); } // Deprecated.
+
+function bp_displayed_user_id() {
+	global $bp;
+	return apply_filters( 'bp_displayed_user_id', $bp->displayed_user->id );
+}
+	function bp_current_user_id() { return bp_displayed_user_id(); }
+
+function bp_loggedin_user_id() {
+	global $bp;
+	return apply_filters( 'bp_loggedin_user_id', $bp->loggedin_user->id );
+}
+
+function bp_displayed_user_domain() {
+	global $bp;
+	return apply_filters( 'bp_displayed_user_domain', $bp->displayed_user->domain );
+}
+
+function bp_loggedin_user_domain() {
+	global $bp;
+	return apply_filters( 'bp_loggedin_user_domain', $bp->loggedin_user->domain );
+}
+
+function bp_displayed_user_fullname() {
+	echo bp_get_displayed_user_fullname();
+}
+	function bp_get_displayed_user_fullname() {
+		global $bp;
+
+		return apply_filters( 'bp_displayed_user_fullname', $bp->displayed_user->fullname );
+	}
+	function bp_user_fullname() { echo bp_get_displayed_user_fullname(); }
+
+
+function bp_loggedin_user_fullname() {
+	echo bp_get_loggedin_user_fullname();
+}
+	function bp_get_loggedin_user_fullname() {
+		global $bp;
+		return apply_filters( 'bp_get_loggedin_user_fullname', $bp->loggedin_user->fullname );
+	}
+
+function bp_displayed_user_username() {
+	echo bp_get_displayed_user_username();
+}
+	function bp_get_displayed_user_username() {
+		global $bp;
+		return apply_filters( 'bp_get_displayed_user_username', bp_core_get_username( $bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) );
+	}
+
+function bp_loggedin_user_username() {
+	echo bp_get_loggedin_user_username();
+}
+	function bp_get_loggedin_user_username() {
+		global $bp;
+		return apply_filters( 'bp_get_loggedin_user_username', bp_core_get_username( $bp->loggedin_user->id, $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login ) );
+	}
+
+function bp_current_component() {
+	global $bp;
+	return apply_filters( 'bp_current_component', $bp->current_component );
+}
+
+function bp_current_action() {
+	global $bp;
+	return apply_filters( 'bp_current_action', $bp->current_action );
+}
+
+function bp_current_item() {
+	global $bp;
+	return apply_filters( 'bp_current_item', $bp->current_item );
+}
+
+function bp_action_variables() {
+	global $bp;
+	return apply_filters( 'bp_action_variables', $bp->action_variables );
+}
+
+function bp_root_domain() {
+	echo bp_get_root_domain();
+}
+	function bp_get_root_domain() {
+		global $bp;
+
+		return apply_filters( 'bp_get_root_domain', $bp->root_domain );
+	}
+
+/* Template is_() functions to determine the current page */
+
+function bp_is_blog_page() {
+	global $bp, $is_member_page, $wp_query;
+
+	if ( $wp_query->is_home && !$bp->is_directory )
+		return true;
+
+	if ( !$bp->displayed_user->id && !$bp->is_single_item && !$bp->is_directory && !bp_core_is_root_component( $bp->current_component ) )
+		return true;
+
+	return false;
+}
+
+function bp_is_my_profile() {
+	global $bp;
+
+	if ( is_user_logged_in() && $bp->loggedin_user->id == $bp->displayed_user->id )
+		$my_profile = true;
+	else
+		$my_profile = false;
+
+	return apply_filters( 'bp_is_my_profile', $my_profile );
+}
+function bp_is_home() { return bp_is_my_profile(); }
+
+function bp_is_front_page() {
+	if ( 'posts' == get_option('show_on_front') && is_home() )
+		return true;
+	else if ( bp_is_activity_front_page() )
+		return true;
+	else
+		return is_front_page();
+}
+
+function bp_is_activity_front_page() {
+	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_directory() {
+	global $bp;
+
+	return $bp->is_directory;
+}
+
+function bp_is_page($page) {
+	global $bp;
+
+	if ( !$bp->displayed_user->id && $bp->current_component == $page )
+		return true;
+
+	if ( 'home' == $page )
+		return bp_is_front_page();
+
+	return false;
+}
+
+function bp_is_active( $component ) {
+	global $bp_deactivated;
+
+	if ( !isset( $bp_deactivated[ 'bp-' . $component . '.php' ] ) )
+		return true;
+
+	return false;
+}
+
+function bp_is_profile_component() {
+	global $bp;
+
+	if ( BP_XPROFILE_SLUG == $bp->current_component )
+		return true;
+
+	return false;
+}
+
+function bp_is_activity_component() {
+	global $bp;
+
+	if ( BP_ACTIVITY_SLUG == $bp->current_component )
+		return true;
+
+	return false;
+}
+
+function bp_is_blogs_component() {
+	global $bp;
+
+	if ( BP_BLOGS_SLUG == $bp->current_component )
+		return true;
+
+	return false;
+}
+
+function bp_is_messages_component() {
+	global $bp;
+
+	if ( BP_MESSAGES_SLUG == $bp->current_component )
+		return true;
+
+	return false;
+}
+
+function bp_is_friends_component() {
+	global $bp;
+
+	if ( BP_FRIENDS_SLUG == $bp->current_component )
+		return true;
+
+	return false;
+}
+
+function bp_is_groups_component() {
+	global $bp;
+
+	if ( BP_GROUPS_SLUG == $bp->current_component )
+		return true;
+
+	return false;
+}
+
+function bp_is_settings_component() {
+	global $bp;
+
+	if ( BP_SETTINGS_SLUG == $bp->current_component )
+		return true;
+
+	return false;
+}
+
+function bp_is_member() {
+	global $bp;
+
+	if ( $bp->displayed_user->id )
+		return true;
+
+	return false;
+}
+
+function bp_is_user_activity() {
+	global $bp;
+
+	if ( BP_ACTIVITY_SLUG == $bp->current_component )
+		return true;
+
+	return false;
+}
+
+function bp_is_user_friends_activity() {
+	global $bp;
+
+	if ( BP_ACTIVITY_SLUG == $bp->current_component && 'my-friends' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+function bp_is_activity_permalink() {
+	global $bp;
+
+	if ( BP_ACTIVITY_SLUG == $bp->current_component && is_numeric( $bp->current_action ) )
+		return true;
+
+	return false;
+}
+
+function bp_is_user_profile() {
+	global $bp;
+
+	if ( BP_XPROFILE_SLUG == $bp->current_component || $bp->core->profile->slug == $bp->current_component )
+		return true;
+
+	return false;
+}
+
+function bp_is_profile_edit() {
+	global $bp;
+
+	if ( BP_XPROFILE_SLUG == $bp->current_component && 'edit' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+function bp_is_change_avatar() {
+	global $bp;
+
+	if ( BP_XPROFILE_SLUG == $bp->current_component && 'change-avatar' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+function bp_is_user_groups() {
+	global $bp;
+
+	if ( BP_GROUPS_SLUG == $bp->current_component )
+		return true;
+
+	return false;
+}
+
+function bp_is_group() {
+	global $bp;
+
+	if ( BP_GROUPS_SLUG == $bp->current_component && $bp->groups->current_group )
+		return true;
+
+	return false;
+}
+
+function bp_is_group_home() {
+	global $bp;
+
+	if ( BP_GROUPS_SLUG == $bp->current_component && $bp->is_single_item && ( !$bp->current_action || 'home' == $bp->current_action ) )
+		return true;
+
+	return false;
+}
+
+function bp_is_group_create() {
+	global $bp;
+
+	if ( BP_GROUPS_SLUG == $bp->current_component && 'create' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+
+function bp_is_group_admin_page() {
+	global $bp;
+
+	if ( BP_GROUPS_SLUG == $bp->current_component && $bp->is_single_item && 'admin' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+function bp_is_group_forum() {
+	global $bp;
+
+	if ( BP_GROUPS_SLUG == $bp->current_component && $bp->is_single_item && 'forum' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+function bp_is_group_activity() {
+	global $bp;
+
+	if ( BP_GROUPS_SLUG == $bp->current_component && $bp->is_single_item && 'activity' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+function bp_is_group_forum_topic() {
+	global $bp;
+
+	if ( BP_GROUPS_SLUG == $bp->current_component && $bp->is_single_item && 'forum' == $bp->current_action && 'topic' == $bp->action_variables[0] )
+		return true;
+
+	return false;
+}
+
+function bp_is_group_forum_topic_edit() {
+	global $bp;
+
+	if ( BP_GROUPS_SLUG == $bp->current_component && $bp->is_single_item && 'forum' == $bp->current_action && 'topic' == $bp->action_variables[0] && 'edit' == $bp->action_variables[2] )
+		return true;
+
+	return false;
+}
+
+function bp_is_group_members() {
+	global $bp;
+
+	if ( BP_GROUPS_SLUG == $bp->current_component && $bp->is_single_item && 'members' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+function bp_is_group_invites() {
+	global $bp;
+
+	if ( BP_GROUPS_SLUG == $bp->current_component && 'send-invites' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+function bp_is_group_membership_request() {
+	global $bp;
+
+	if ( BP_GROUPS_SLUG == $bp->current_component && 'request-membership' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+function bp_is_group_leave() {
+	global $bp;
+
+	if ( BP_GROUPS_SLUG == $bp->current_component && $bp->is_single_item && 'leave-group' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+function bp_is_group_single() {
+	global $bp;
+
+	if ( BP_GROUPS_SLUG == $bp->current_component && $bp->is_single_item )
+		return true;
+
+	return false;
+}
+
+function bp_is_user_blogs() {
+	global $bp;
+
+	if ( BP_BLOGS_SLUG == $bp->current_component )
+		return true;
+
+	return false;
+}
+
+function bp_is_user_recent_posts() {
+	global $bp;
+
+	if ( BP_BLOGS_SLUG == $bp->current_component && 'recent-posts' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+function bp_is_user_recent_commments() {
+	global $bp;
+
+	if ( BP_BLOGS_SLUG == $bp->current_component && 'recent-comments' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+function bp_is_create_blog() {
+	global $bp;
+
+	if ( BP_BLOGS_SLUG == $bp->current_component && 'create' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+function bp_is_user_friends() {
+	global $bp;
+
+	if ( BP_FRIENDS_SLUG == $bp->current_component )
+		return true;
+
+	return false;
+}
+
+function bp_is_friend_requests() {
+	global $bp;
+
+	if ( BP_FRIENDS_SLUG == $bp->current_component && 'requests' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+function bp_is_user_messages() {
+	global $bp;
+
+	if ( BP_MESSAGES_SLUG == $bp->current_component )
+		return true;
+
+	return false;
+}
+
+function bp_is_messages_inbox() {
+	global $bp;
+
+	if ( BP_MESSAGES_SLUG == $bp->current_component && ( !$bp->current_action || 'inbox' == $bp->current_action ) )
+		return true;
+
+	return false;
+}
+
+function bp_is_messages_sentbox() {
+	global $bp;
+
+	if ( BP_MESSAGES_SLUG == $bp->current_component && 'sentbox' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+
+function bp_is_notices() {
+	global $bp;
+
+	if ( BP_MESSAGES_SLUG == $bp->current_component && 'notices' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+
+function bp_is_messages_compose_screen() {
+	global $bp;
+
+	if ( BP_MESSAGES_SLUG == $bp->current_component && 'compose' == $bp->current_action )
+		return true;
+
+	return false;
+}
+
+function bp_is_single_item() {
+	global $bp;
+
+	if ( $bp->is_single_item )
+		return true;
+
+	return false;
+}
+
+function bp_is_activation_page() {
+	global $bp;
+
+	if ( BP_ACTIVATION_SLUG == $bp->current_component )
+		return true;
+
+	return false;
+}
+
+function bp_is_register_page() {
+	global $bp;
+
+	if ( BP_REGISTER_SLUG == $bp->current_component )
+		return true;
+
+	return false;
+}
+
+/* Use the above is_() functions to output a body class for each page */
+
+function bp_the_body_class() {
+	echo bp_get_the_body_class();
+}
+	function bp_get_the_body_class( $wp_classes, $custom_classes = false ) {
+		global $bp;
+
+		if ( bp_is_front_page() )
+			$bp_classes[] = 'home-page';
+
+		if ( bp_is_directory() )
+			$bp_classes[] = 'directory';
+
+		if ( bp_is_user_profile() && !bp_is_blog_page() )
+			$bp_classes[] = 'profile';
+
+		if ( bp_is_activity_component() && !bp_is_blog_page() || ( bp_is_activity_front_page() && bp_is_front_page() ) )
+			$bp_classes[] = 'activity';
+
+		if ( bp_is_blogs_component() && !bp_is_blog_page()  )
+			$bp_classes[] = 'blogs';
+
+		if ( bp_is_messages_component() && !bp_is_blog_page()  )
+			$bp_classes[] = 'messages';
+
+		if ( bp_is_friends_component() && !bp_is_blog_page()  )
+			$bp_classes[] = 'friends';
+
+		if ( bp_is_groups_component() && !bp_is_blog_page()  )
+			$bp_classes[] = 'groups';
+
+		if ( bp_is_settings_component() && !bp_is_blog_page()  )
+			$bp_classes[] = 'settings';
+
+		if ( bp_is_single_item() )
+			$bp_classes[] = 'single-item';
+
+		if ( bp_is_messages_inbox() )
+			$bp_classes[] = 'inbox';
+
+		if ( bp_is_messages_sentbox() )
+			$bp_classes[] = 'sentbox';
+
+		if ( bp_is_messages_compose_screen() )
+			$bp_classes[] = 'compose';
+
+		if ( bp_is_notices() )
+			$bp_classes[] = 'notices';
+
+		if ( bp_is_friend_requests() )
+			$bp_classes[] = 'friend-requests';
+
+		if ( bp_is_user_friends() )
+			$bp_classes[] = 'my-friends';
+
+		if ( bp_is_create_blog() )
+			$bp_classes[] = 'create-blog';
+
+		if ( bp_is_user_recent_commments() )
+			$bp_classes[] = 'recent-comments';
+
+		if ( bp_is_user_recent_posts() )
+			$bp_classes[] = 'recent-posts';
+
+		if ( bp_is_user_blogs() && !bp_is_directory() )
+			$bp_classes[] = 'my-blogs';
+
+		if ( bp_is_user_groups() && !bp_is_directory() )
+			$bp_classes[] = 'my-groups';
+
+		if ( bp_is_group_leave() )
+			$bp_classes[] = 'leave-group';
+
+		if ( bp_is_group_invites() )
+			$bp_classes[] = 'group-invites';
+
+		if ( bp_is_group_members() )
+			$bp_classes[] = 'group-members';
+
+		if ( bp_is_group_forum_topic() )
+			$bp_classes[] = 'group-forum-topic';
+
+		if ( bp_is_group_forum_topic_edit() )
+			$bp_classes[] = 'group-forum-topic-edit';
+
+		if ( bp_is_group_forum() )
+			$bp_classes[] = 'group-forum';
+
+		if ( bp_is_group_admin_page() )
+			$bp_classes[] = 'group-admin';
+
+		if ( bp_is_group_create() )
+			$bp_classes[] = 'group-create';
+
+		if ( bp_is_group_home() )
+			$bp_classes[] = 'group-home';
+
+		if ( bp_is_change_avatar() )
+			$bp_classes[] = 'change-avatar';
+
+		if ( bp_is_profile_edit() )
+			$bp_classes[] = 'profile-edit';
+
+		if ( bp_is_user_friends_activity() )
+			$bp_classes[] = 'friends-activity';
+
+		if ( bp_is_user_activity() && !bp_is_directory() )
+			$bp_classes[] = 'my-activity';
+
+		if ( bp_is_activity_permalink() )
+			$bp_classes[] = 'activity-permalink';
+
+		if ( bp_is_register_page() )
+			$bp_classes[] = 'registration';
+
+		if ( bp_is_activation_page() )
+			$bp_classes[] = 'activation';
+
+		if ( is_user_logged_in() )
+			$bp_classes[] = 'logged-in';
+
+		/* Add the current_component, current_action into the bp classes */
+		if ( !bp_is_blog_page() ) {
+			if ( !empty( $bp->current_component ) )
+				$bp_classes[] = $bp->current_component;
+
+			if ( !empty( $bp->current_action ) )
+				$bp_classes[] = $bp->current_action;
+		}
+
+		/* We don't want WordPress blog classes to appear on non-blog pages. */
+		if ( !bp_is_blog_page() || is_home() ) {
+			/* Preserve any custom classes already set */
+			if ( !empty( $custom_classes ) )
+				$wp_classes = (array) $custom_classes;
+			else
+				$wp_classes = array();
+		}
+
+		/* Merge WP classes with BP classes */
+		$classes = array_merge( (array) $bp_classes, (array) $wp_classes );
+
+		/* Remove any duplicates */
+		$classes = array_unique( $classes );
+
+		return apply_filters( 'bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes );
+	}
+	add_filter( 'body_class', 'bp_get_the_body_class', 10, 2 )
+
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-widgets.php b/wp-content/plugins/buddypress/bp-core/bp-core-widgets.php
new file mode 100644
index 0000000000000000000000000000000000000000..913ac5502b54dd283d9cee5453657bc71ef760b8
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-core/bp-core-widgets.php
@@ -0,0 +1,255 @@
+<?php
+
+/* Register widgets for the core component */
+function bp_core_register_widgets() {
+	add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Members_Widget");') );
+	add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Whos_Online_Widget");') );
+	add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Recently_Active_Widget");') );
+}
+add_action( 'bp_register_widgets', 'bp_core_register_widgets' );
+
+/*** MEMBERS WIDGET *****************/
+
+class BP_Core_Members_Widget extends WP_Widget {
+	function bp_core_members_widget() {
+		parent::WP_Widget( false, $name = __( 'Members', 'buddypress' ) );
+
+		if ( is_active_widget( false, false, $this->id_base ) )
+			wp_enqueue_script( 'bp_core_widget_members-js', BP_PLUGIN_URL . '/bp-core/js/widget-members.js', array('jquery') );
+	}
+
+	function widget($args, $instance) {
+		global $bp;
+
+		extract( $args );
+
+		echo $before_widget;
+		echo $before_title
+		   . $widget_name
+		   . $after_title; ?>
+
+		<?php if ( bp_has_members( 'user_id=0&type=newest&max=' . $instance['max_members'] . '&populate_extras=0' ) ) : ?>
+			<div class="item-options" id="members-list-options">
+				<span class="ajax-loader" id="ajax-loader-members"></span>
+				<a href="<?php echo site_url() . '/' . BP_MEMBERS_SLUG ?>" id="newest-members" class="selected"><?php _e( 'Newest', 'buddypress' ) ?></a>
+				|  <a href="<?php echo site_url() . '/' . BP_MEMBERS_SLUG ?>" id="recently-active-members"><?php _e( 'Active', 'buddypress' ) ?></a>
+
+				<?php if ( bp_is_active( 'friends' ) ) : ?>
+
+					| <a href="<?php echo site_url() . '/' . BP_MEMBERS_SLUG ?>" id="popular-members"><?php _e( 'Popular', 'buddypress' ) ?></a>
+
+				<?php endif; ?>
+
+			</div>
+
+			<ul id="members-list" class="item-list">
+				<?php while ( bp_members() ) : bp_the_member(); ?>
+					<li class="vcard">
+						<div class="item-avatar">
+							<a href="<?php bp_member_permalink() ?>"><?php bp_member_avatar() ?></a>
+						</div>
+
+						<div class="item">
+							<div class="item-title fn"><a href="<?php bp_member_permalink() ?>" title="<?php bp_member_name() ?>"><?php bp_member_name() ?></a></div>
+							<div class="item-meta"><span class="activity"><?php bp_member_registered() ?></span></div>
+						</div>
+					</li>
+
+				<?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 esc_attr( $instance['max_members'] ); ?>" />
+
+		<?php else: ?>
+
+			<div class="widget-error">
+				<?php _e('No one has signed up yet!', 'buddypress') ?>
+			</div>
+
+		<?php endif; ?>
+
+		<?php echo $after_widget; ?>
+	<?php
+	}
+
+	function update( $new_instance, $old_instance ) {
+		$instance = $old_instance;
+		$instance['max_members'] = strip_tags( $new_instance['max_members'] );
+
+		return $instance;
+	}
+
+	function form( $instance ) {
+		$instance = wp_parse_args( (array) $instance, array( 'max_members' => 5 ) );
+		$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 esc_attr( $max_members ); ?>" style="width: 30%" /></label></p>
+	<?php
+	}
+}
+
+/*** WHO'S ONLINE WIDGET *****************/
+
+class BP_Core_Whos_Online_Widget extends WP_Widget {
+	function bp_core_whos_online_widget() {
+		parent::WP_Widget( false, $name = __( "Who's Online Avatars", 'buddypress' ) );
+	}
+
+	function widget($args, $instance) {
+		global $bp;
+
+	    extract( $args );
+
+		echo $before_widget;
+		echo $before_title
+		   . $widget_name
+		   . $after_title; ?>
+
+		<?php if ( bp_has_members( 'user_id=0&type=online&per_page=' . $instance['max_members'] . '&max=' . $instance['max_members'] . '&populate_extras=0' ) ) : ?>
+			<div class="avatar-block">
+				<?php while ( bp_members() ) : bp_the_member(); ?>
+					<div class="item-avatar">
+						<a href="<?php bp_member_permalink() ?>"><?php bp_member_avatar() ?></a>
+					</div>
+				<?php endwhile; ?>
+			</div>
+		<?php else: ?>
+
+			<div class="widget-error">
+				<?php _e( 'There are no users currently online', 'buddypress' ) ?>
+			</div>
+
+		<?php endif; ?>
+
+		<?php echo $after_widget; ?>
+	<?php
+	}
+
+	function update( $new_instance, $old_instance ) {
+		$instance = $old_instance;
+		$instance['max_members'] = strip_tags( $new_instance['max_members'] );
+
+		return $instance;
+	}
+
+	function form( $instance ) {
+		$instance = wp_parse_args( (array) $instance, array( 'max_members' => 15 ) );
+		$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 esc_attr( $max_members ); ?>" style="width: 30%" /></label></p>
+	<?php
+	}
+}
+
+/*** RECENTLY ACTIVE WIDGET *****************/
+
+class BP_Core_Recently_Active_Widget extends WP_Widget {
+	function bp_core_recently_active_widget() {
+		parent::WP_Widget( false, $name = __( 'Recently Active Member Avatars', 'buddypress' ) );
+	}
+
+	function widget($args, $instance) {
+		global $bp;
+
+		extract( $args );
+
+		echo $before_widget;
+		echo $before_title
+		   . $widget_name
+		   . $after_title; ?>
+
+		<?php if ( bp_has_members( 'user_id=0&type=active&per_page=' . $instance['max_members'] . '&max=' . $instance['max_members'] . '&populate_extras=0' ) ) : ?>
+			<div class="avatar-block">
+				<?php while ( bp_members() ) : bp_the_member(); ?>
+					<div class="item-avatar">
+						<a href="<?php bp_member_permalink() ?>"><?php bp_member_avatar() ?></a>
+					</div>
+				<?php endwhile; ?>
+			</div>
+		<?php else: ?>
+
+			<div class="widget-error">
+				<?php _e( 'There are no recently active members', 'buddypress' ) ?>
+			</div>
+
+		<?php endif; ?>
+
+		<?php echo $after_widget; ?>
+	<?php
+	}
+
+	function update( $new_instance, $old_instance ) {
+		$instance = $old_instance;
+		$instance['max_members'] = strip_tags( $new_instance['max_members'] );
+
+		return $instance;
+	}
+
+	function form( $instance ) {
+		$instance = wp_parse_args( (array) $instance, array( 'max_members' => 15 ) );
+		$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 esc_attr( $max_members ); ?>" style="width: 30%" /></label></p>
+	<?php
+	}
+}
+
+/** Widget AJAX ******************/
+
+function bp_core_ajax_widget_members() {
+	global $bp;
+
+	check_ajax_referer( 'bp_core_widget_members' );
+
+	switch ( $_POST['filter'] ) {
+		case 'newest-members':
+			$type = 'newest';
+			break;
+
+		case 'recently-active-members':
+			$type = 'active';
+			break;
+
+		case 'popular-members':
+			if ( bp_is_active( 'friends' ) )
+				$type = 'popular';
+			else
+				$type = 'active';
+
+			break;
+	}
+
+	if ( bp_has_members( 'user_id=0&type=' . $type . '&per_page=' . $_POST['max-members'] . '&max=' . $_POST['max-members'] . '&populate_extras=0' ) ) : ?>
+		<?php echo '0[[SPLIT]]'; // return valid result. TODO: remove this. ?>
+		<div class="avatar-block">
+			<?php while ( bp_members() ) : bp_the_member(); ?>
+				<li class="vcard">
+					<div class="item-avatar">
+						<a href="<?php bp_member_permalink() ?>"><?php bp_member_avatar() ?></a>
+					</div>
+
+					<div class="item">
+						<div class="item-title fn"><a href="<?php bp_member_permalink() ?>" title="<?php bp_member_name() ?>"><?php bp_member_name() ?></a></div>
+						<?php if ( 'active' == $type || 'newest' == $type ) : ?>
+							<div class="item-meta"><span class="activity"><?php bp_member_last_active() ?></span></div>
+						<?php elseif ( bp_is_active( 'friends' ) ) : ?>
+							<div class="item-meta"><span class="activity"><?php bp_member_total_friend_count() ?></span></div>
+						<?php endif; ?>
+					</div>
+				</li>
+
+			<?php endwhile; ?>
+		</div>
+
+	<?php else: ?>
+		<?php echo "-1[[SPLIT]]<li>"; ?>
+		<?php _e( 'There were no members found, please try another filter.', 'buddypress' ) ?>
+		<?php echo "</li>"; ?>
+	<?php endif;
+}
+add_action( 'wp_ajax_widget_members', 'bp_core_ajax_widget_members' );
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-wpabstraction.php b/wp-content/plugins/buddypress/bp-core/bp-core-wpabstraction.php
new file mode 100644
index 0000000000000000000000000000000000000000..3faa529212ae80214f4f6dc53e9cd03821a545eb
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-core/bp-core-wpabstraction.php
@@ -0,0 +1,115 @@
+<?php
+/*****
+ * WordPress Abstraction
+ *
+ * The functions within this file will detect the version of WordPress you are running
+ * and will alter the environment so BuddyPress can run regardless.
+ *
+ * The code below mostly contains function mappings. This code is subject to change once
+ * the 3.0 WordPress version merge takes place.
+ */
+
+if ( !bp_core_is_multisite() ) {
+	$wpdb->base_prefix = $wpdb->prefix;
+	$wpdb->blogid = 1;
+}
+
+function bp_core_is_multisite() {
+	if ( function_exists( 'is_multisite' ) )
+		return is_multisite();
+
+	if ( !function_exists( 'wpmu_signup_blog' ) )
+		return false;
+
+	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";
+	else
+		return "{$prefix}spam = 0 AND {$prefix}deleted = 0 AND {$prefix}user_status = 0";
+}
+
+if ( !function_exists( 'get_blog_option' ) ) {
+	function get_blog_option( $blog_id, $option_name, $default = false ) {
+		return get_option( $option_name, $default );
+	}
+}
+
+if ( !function_exists( 'add_blog_option' ) ) {
+	function add_blog_option( $blog_id, $option_name, $option_value ) {
+		return add_option( $option_name, $option_value );
+	}
+}
+
+if ( !function_exists( 'update_blog_option' ) ) {
+	function update_blog_option( $blog_id, $option_name, $option_value ) {
+		return update_option( $option_name, $option_value );
+	}
+}
+
+if ( !function_exists( 'switch_to_blog' ) ) {
+	function switch_to_blog() {
+		return 1;
+	}
+}
+
+if ( !function_exists( 'restore_current_blog' ) ) {
+	function restore_current_blog() {
+		return 1;
+	}
+}
+
+if ( !function_exists( 'get_blogs_of_user' ) ) {
+	function get_blogs_of_user() {
+		return false;
+	}
+}
+
+if ( !function_exists( 'update_blog_status' ) ) {
+	function update_blog_status() {
+		return true;
+	}
+}
+
+if ( !function_exists( 'is_subdomain_install' ) ) {
+	function is_subdomain_install() {
+		if ( ( defined( 'VHOST' ) && 'yes' == VHOST ) || ( defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL ) )
+			return true;
+
+		return false;
+	}
+}
+
+// Deprecated - 1.2.6
+if ( !function_exists( 'is_site_admin' ) ) {
+	function is_site_admin( $user_id = false ) {
+		return is_super_admin( $user_id );
+	}
+}
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-core/css/widget-members.css b/wp-content/plugins/buddypress/bp-core/css/widget-members.css
new file mode 100644
index 0000000000000000000000000000000000000000..b3b2c9a8395ed2bbf3c4cf18a60a773bc8e178ad
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-core/css/widget-members.css
@@ -0,0 +1,22 @@
+.widget_bp_core_members_widget ul#members-list {
+	margin: 15px 0 0 0;
+	padding: 0;
+	list-style: none;
+}
+	
+	.widget_bp_core_members_widget ul#members-list li {
+		min-height: 60px;
+	}
+	
+	.widget_bp_core_members_widget ul#members-list li img.avatar {
+		float: left;
+		margin: 0 10px 0 0;
+	}
+	
+	.widget_bp_core_members_widget ul#members-list li span.activity {
+		font-size: 11px;
+	}
+	
+.widget_bp_core_members_widget img#ajax-loader-members {
+	float: right;
+}
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-core/images/Jcrop.gif b/wp-content/plugins/buddypress/bp-core/images/Jcrop.gif
new file mode 100644
index 0000000000000000000000000000000000000000..72ea7ccb5321d5384d70437cfaac73011237901e
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-core/images/Jcrop.gif differ
diff --git a/wp-content/plugins/buddypress/bp-core/images/admin_menu_icon.png b/wp-content/plugins/buddypress/bp-core/images/admin_menu_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..d3624b2c49da35cb17605b19759a1a5d83175ebe
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-core/images/admin_menu_icon.png differ
diff --git a/wp-content/plugins/buddypress/bp-core/images/mystery-man-50.jpg b/wp-content/plugins/buddypress/bp-core/images/mystery-man-50.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..e0e8679fe4542ae3dba2795d0d1cda3515875ff3
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-core/images/mystery-man-50.jpg differ
diff --git a/wp-content/plugins/buddypress/bp-core/images/mystery-man.jpg b/wp-content/plugins/buddypress/bp-core/images/mystery-man.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..61917a7a6a94312c9709e6c9392d4ba3e42b5895
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-core/images/mystery-man.jpg differ
diff --git a/wp-content/plugins/buddypress/bp-core/js/admin-bar.js b/wp-content/plugins/buddypress/bp-core/js/admin-bar.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/wp-content/plugins/buddypress/bp-core/js/widget-members.js b/wp-content/plugins/buddypress/bp-core/js/widget-members.js
new file mode 100644
index 0000000000000000000000000000000000000000..e3eb5d75e3ad0ef3e2d57c811ecb4adddff7623f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-core/js/widget-members.js
@@ -0,0 +1,48 @@
+jQuery(document).ready( function() {
+	jQuery(".widget div#members-list-options a").live('click',
+		function() {
+			jQuery('#ajax-loader-members').toggle();
+
+			jQuery(".widget div#members-list-options a").removeClass("selected");
+			jQuery(this).addClass('selected');
+
+			jQuery.post( ajaxurl, {
+				action: 'widget_members',
+				'cookie': encodeURIComponent(document.cookie),
+				'_wpnonce': jQuery("input#_wpnonce-members").val(),
+				'max-members': jQuery("input#members_widget_max").val(),
+				'filter': jQuery(this).attr('id')
+			},
+			function(response)
+			{
+				jQuery('#ajax-loader-members').toggle();
+				member_wiget_response(response);
+			});
+
+			return false;
+		}
+	);
+});
+
+function member_wiget_response(response) {
+	response = response.substr(0, response.length-1);
+	response = response.split('[[SPLIT]]');
+
+	if ( response[0] != "-1" ) {
+		jQuery(".widget ul#members-list").fadeOut(200,
+			function() {
+				jQuery(".widget ul#members-list").html(response[1]);
+				jQuery(".widget ul#members-list").fadeIn(200);
+			}
+		);
+
+	} else {
+		jQuery(".widget ul#members-list").fadeOut(200,
+			function() {
+				var message = '<p>' + response[1] + '</p>';
+				jQuery(".widget ul#members-list").html(message);
+				jQuery(".widget ul#members-list").fadeIn(200);
+			}
+		);
+	}
+}
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums.php b/wp-content/plugins/buddypress/bp-forums.php
new file mode 100644
index 0000000000000000000000000000000000000000..10d434e299d48009aefc770d39e3cbf8f104f3e7
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums.php
@@ -0,0 +1,556 @@
+<?php
+
+/* Define the parent forum ID */
+if ( !defined( 'BP_FORUMS_PARENT_FORUM_ID' ) )
+	define( 'BP_FORUMS_PARENT_FORUM_ID', 1 );
+
+if ( !defined( 'BP_FORUMS_SLUG' ) )
+	define( 'BP_FORUMS_SLUG', 'forums' );
+
+if ( !defined( 'BB_PATH' ) )
+	require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-bbpress.php' );
+
+require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-templatetags.php' );
+require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-filters.php' );
+
+function bp_forums_setup() {
+	global $bp;
+
+	/* For internal identification */
+	$bp->forums->id = 'forums';
+
+	$bp->forums->image_base = BP_PLUGIN_URL . '/bp-forums/images';
+	$bp->forums->bbconfig = $bp->site_options['bb-config-location'];
+	$bp->forums->slug = BP_FORUMS_SLUG;
+
+	/* Register this in the active components array */
+	$bp->active_components[$bp->forums->slug] = $bp->forums->id;
+
+	do_action( 'bp_forums_setup' );
+}
+add_action( 'bp_setup_globals', 'bp_forums_setup' );
+
+function bp_forums_is_installed_correctly() {
+	global $bp;
+
+	if ( file_exists( $bp->forums->bbconfig ) )
+		return true;
+
+	return false;
+}
+
+function bp_forums_setup_root_component() {
+	/* Register 'forums' as a root component */
+	bp_core_add_root_component( BP_FORUMS_SLUG );
+}
+add_action( 'bp_setup_root_components', 'bp_forums_setup_root_component' );
+
+function bp_forums_directory_forums_setup() {
+	global $bp;
+
+	if ( $bp->current_component == $bp->forums->slug ) {
+		if ( (int) $bp->site_options['bp-disable-forum-directory'] || !function_exists( 'groups_install' ) )
+			return false;
+
+		if ( !bp_forums_is_installed_correctly() ) {
+			bp_core_add_message( __( 'The forums component has not been set up yet.', 'buddypress' ), 'error' );
+			bp_core_redirect( $bp->root_domain );
+		}
+
+		$bp->is_directory = true;
+
+		do_action( 'bbpress_init' );
+
+		/* Check to see if the user has posted a new topic from the forums page. */
+		if ( isset( $_POST['submit_topic'] ) && function_exists( 'bp_forums_new_topic' ) ) {
+			/* Check the nonce */
+			check_admin_referer( 'bp_forums_new_topic' );
+
+			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_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' ) ) {
+					if ( !$topic = groups_new_group_forum_topic( $_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id ) )
+						bp_core_add_message( __( 'There was an error when creating the topic', 'buddypress'), 'error' );
+					else
+						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' );
+				}
+			}
+		}
+
+		do_action( 'bp_forums_directory_forums_setup' );
+
+		bp_core_load_template( apply_filters( 'bp_forums_template_directory_forums_setup', 'forums/index' ) );
+	}
+}
+add_action( 'wp', 'bp_forums_directory_forums_setup', 2 );
+
+function bp_forums_add_admin_menu() {
+	global $bp;
+
+	if ( !is_super_admin() )
+		return false;
+
+	require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-admin.php' );
+
+	/* Add the administration tab under the "Site Admin" tab for site administrators */
+	add_submenu_page( 'bp-general-settings', __( 'Forums Setup', 'buddypress' ), __( 'Forums Setup', 'buddypress' ), 'manage_options', 'bb-forums-setup', "bp_forums_bbpress_admin" );
+}
+add_action( 'admin_menu', 'bp_forums_add_admin_menu' );
+
+/* Forum Functions */
+
+function bp_forums_get_forum( $forum_id ) {
+	do_action( 'bbpress_init' );
+	return bb_get_forum( $forum_id );
+}
+
+function bp_forums_new_forum( $args = '' ) {
+	do_action( 'bbpress_init' );
+
+	$defaults = array(
+		'forum_name' => '',
+		'forum_desc' => '',
+		'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_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 = '' ) {
+	global $bp;
+
+	do_action( 'bbpress_init' );
+
+	$defaults = array(
+		'type' => 'newest',
+		'forum_id' => false,
+		'user_id' => false,
+		'page' => 1,
+		'per_page' => 15,
+		'exclude' => false,
+		'show_stickies' => 'all',
+		'filter' => false // if $type = tag then filter is the tag name, otherwise it's terms to search on.
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	switch ( $type ) {
+		case 'newest':
+			$query = new BB_Query( 'topic', array( 'forum_id' => $forum_id, 'topic_author_id' => $user_id, 'per_page' => $per_page, 'page' => $page, 'number' => $per_page, 'exclude' => $exclude, 'topic_title' => $filter, 'sticky' => $show_stickies ), 'get_latest_topics' );
+			$topics =& $query->results;
+		break;
+
+		case 'popular':
+			$query = new BB_Query( 'topic', array( 'forum_id' => $forum_id, 'topic_author_id' => $user_id, 'per_page' => $per_page, 'page' => $page, 'order_by' => 't.topic_posts', 'topic_title' => $filter, 'sticky' => $show_stickies ) );
+			$topics =& $query->results;
+		break;
+
+		case 'unreplied':
+			$query = new BB_Query( 'topic', array( 'forum_id' => $forum_id, 'topic_author_id' => $user_id, 'post_count' => 1, 'per_page' => $per_page, 'page' => $page, 'order_by' => 't.topic_time', 'topic_title' => $filter, 'sticky' => $show_stickies ) );
+			$topics =& $query->results;
+		break;
+
+		case 'tags':
+			$query = new BB_Query( 'topic', array( 'forum_id' => $forum_id, 'topic_author_id' => $user_id, 'tag' => $filter, 'per_page' => $per_page, 'page' => $page, 'order_by' => 't.topic_time', 'sticky' => $show_stickies ) );
+			$topics =& $query->results;
+		break;
+	}
+
+	return apply_filters( 'bp_forums_get_forum_topics', $topics, &$r );
+}
+
+function bp_forums_get_topic_details( $topic_id ) {
+	do_action( 'bbpress_init' );
+
+	$query = new BB_Query( 'topic', 'topic_id=' . $topic_id . '&page=1' /* Page override so bbPress doesn't use the URI */ );
+
+	return $query->results[0];
+}
+
+function bp_forums_get_topic_id_from_slug( $topic_slug ) {
+	do_action( 'bbpress_init' );
+	return bb_get_id_from_slug( 'topic', $topic_slug );
+}
+
+function bp_forums_new_topic( $args = '' ) {
+	global $bp;
+
+	do_action( 'bbpress_init' );
+
+	$defaults = array(
+		'topic_title' => '',
+		'topic_slug' => '',
+		'topic_text' => '',
+		'topic_poster' => $bp->loggedin_user->id, // accepts ids
+		'topic_poster_name' => $bp->loggedin_user->fullname, // accept names
+		'topic_last_poster' => $bp->loggedin_user->id, // accepts ids
+		'topic_last_poster_name' => $bp->loggedin_user->fullname, // accept names
+		'topic_start_time' => date( 'Y-m-d H:i:s' ),
+		'topic_time' => date( 'Y-m-d H:i:s' ),
+		'topic_open' => 1,
+		'topic_tags' => false, // accepts array or comma delim
+		'forum_id' => 0 // accepts ids or slugs
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	$topic_title = strip_tags( $topic_title );
+
+	if ( empty( $topic_title ) || !strlen( trim( $topic_title ) ) )
+		return false;
+
+	if ( empty( $topic_slug ) )
+		$topic_slug = sanitize_title( $topic_title );
+
+	if ( !$topic_id = bb_insert_topic( array( 'topic_title' => stripslashes( $topic_title ), 'topic_slug' => $topic_slug, 'topic_poster' => $topic_poster, 'topic_poster_name' => $topic_poster_name, 'topic_last_poster' => $topic_last_poster, 'topic_last_poster_name' => $topic_last_poster_name, 'topic_start_time' => $topic_start_time, 'topic_time' => $topic_time, 'topic_open' => $topic_open, 'forum_id' => (int)$forum_id, 'tags' => $topic_tags ) ) )
+		return false;
+
+	/* Now insert the first post. */
+	if ( !bp_forums_insert_post( array( 'topic_id' => $topic_id, 'post_text' => $topic_text, 'post_time' => $topic_time, 'poster_id' => $topic_poster ) ) )
+		return false;
+
+	do_action( 'bp_forums_new_topic', $topic_id );
+
+	return $topic_id;
+}
+
+function bp_forums_update_topic( $args = '' ) {
+	global $bp;
+
+	do_action( 'bbpress_init' );
+
+	$defaults = array(
+		'topic_id' => false,
+		'topic_title' => '',
+		'topic_text' => ''
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	if ( !$topic_id = bb_insert_topic( array( 'topic_id' => $topic_id, 'topic_title' => stripslashes( $topic_title ) ) ) )
+		return false;
+
+	if ( !$post = bb_get_first_post( $topic_id ) )
+		return false;
+
+	/* Update the first post */
+	if ( !$post = bp_forums_insert_post( array( 'post_id' => $post->post_id, 'topic_id' => $topic_id, 'post_text' => $topic_text, 'post_time' => $post->post_time, 'poster_id' => $post->poster_id, 'poster_ip' => $post->poster_ip, 'post_status' => $post->post_status, 'post_position' => $post->post_position ) ) )
+		return false;
+
+	return bp_forums_get_topic_details( $topic_id );
+}
+
+function bp_forums_sticky_topic( $args = '' ) {
+	global $bp;
+
+	do_action( 'bbpress_init' );
+
+	$defaults = array(
+		'topic_id' => false,
+		'mode' => 'stick' // stick/unstick
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	if ( 'stick' == $mode )
+		return bb_stick_topic( $topic_id );
+	else if ( 'unstick' == $mode )
+		return bb_unstick_topic( $topic_id );
+
+	return false;
+}
+
+function bp_forums_openclose_topic( $args = '' ) {
+	global $bp;
+
+	do_action( 'bbpress_init' );
+
+	$defaults = array(
+		'topic_id' => false,
+		'mode' => 'close' // stick/unstick
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	if ( 'close' == $mode )
+		return bb_close_topic( $topic_id );
+	else if ( 'open' == $mode )
+		return bb_open_topic( $topic_id );
+
+	return false;
+}
+
+function bp_forums_delete_topic( $args = '' ) {
+	global $bp;
+
+	do_action( 'bbpress_init' );
+
+	$defaults = array(
+		'topic_id' => false
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	return bb_delete_topic( $topic_id, 1 );
+}
+
+function bp_forums_total_topic_count() {
+	do_action( 'bbpress_init' );
+
+	$query = new BB_Query( 'topic', array( 'page' => 1, 'per_page' => -1, 'count' => true ) );
+	$count = $query->count;
+	$query = null;
+
+	return $count;
+}
+
+function bp_forums_total_topic_count_for_user( $user_id = false ) {
+	global $bp;
+
+	do_action( 'bbpress_init' );
+
+	if ( !$user_id )
+		$user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
+
+	$query = new BB_Query( 'topic', array( 'topic_author_id' => $user_id, 'page' => 1, 'per_page' => -1, 'count' => true ) );
+	$count = $query->count;
+	$query = null;
+
+	return $count;
+}
+
+function bp_forums_get_topic_extras( $topics ) {
+	global $bp, $wpdb, $bbdb;
+
+	if ( empty( $topics ) )
+		return $topics;
+
+	/* Get the topic ids */
+	foreach ( (array)$topics as $topic ) $topic_ids[] = $topic->topic_id;
+	$topic_ids = $wpdb->escape( join( ',', (array)$topic_ids ) );
+
+	/* Fetch the topic's last poster details */
+	$poster_details = $wpdb->get_results( $wpdb->prepare( "SELECT t.topic_id, t.topic_last_poster, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$wpdb->users} u, {$bbdb->topics} t WHERE u.ID = t.topic_last_poster AND t.topic_id IN ( {$topic_ids} )" ) );
+	for ( $i = 0; $i < count( $topics ); $i++ ) {
+		foreach ( (array)$poster_details as $poster ) {
+			if ( $poster->topic_id == $topics[$i]->topic_id ) {
+				$topics[$i]->topic_last_poster_email = $poster->user_email;
+				$topics[$i]->topic_last_poster_nicename = $poster->user_nicename;
+				$topics[$i]->topic_last_poster_login = $poster->user_login;
+				$topics[$i]->topic_last_poster_displayname = $poster->display_name;
+			}
+		}
+	}
+
+	/* Fetch fullname for the topic's last poster */
+	if ( function_exists( 'xprofile_install' ) ) {
+		$poster_names = $wpdb->get_results( $wpdb->prepare( "SELECT t.topic_id, pd.value FROM {$bp->profile->table_name_data} pd, {$bbdb->topics} t WHERE pd.user_id = t.topic_last_poster AND pd.field_id = 1 AND t.topic_id IN ( {$topic_ids} )" ) );
+		for ( $i = 0; $i < count( $topics ); $i++ ) {
+			foreach ( (array)$poster_names as $name ) {
+				if ( $name->topic_id == $topics[$i]->topic_id )
+					$topics[$i]->topic_last_poster_displayname = $name->value;
+			}
+		}
+	}
+
+	return $topics;
+}
+
+/* Post Functions */
+
+function bp_forums_get_topic_posts( $args = '' ) {
+	do_action( 'bbpress_init' );
+
+	$defaults = array(
+		'topic_id' => false,
+		'page' => 1,
+		'per_page' => 15,
+		'order' => 'ASC'
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+
+	$query = new BB_Query( 'post', $args, 'get_thread' );
+	return bp_forums_get_post_extras( $query->results );
+}
+
+function bp_forums_get_post( $post_id ) {
+	do_action( 'bbpress_init' );
+	return bb_get_post( $post_id );
+}
+
+function bp_forums_delete_post( $args = '' ) {
+	global $bp;
+
+	do_action( 'bbpress_init' );
+
+	$defaults = array(
+		'post_id' => false
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	return bb_delete_post( $post_id, 1 );
+}
+
+function bp_forums_insert_post( $args = '' ) {
+	global $bp;
+
+	do_action( 'bbpress_init' );
+
+	$defaults = array(
+		'post_id' => false,
+		'topic_id' => false,
+		'post_text' => '',
+		'post_time' => date( 'Y-m-d H:i:s' ),
+		'poster_id' => $bp->loggedin_user->id, // accepts ids or names
+		'poster_ip' => $_SERVER['REMOTE_ADDR'],
+		'post_status' => 0, // use bb_delete_post() instead
+		'post_position' => false
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	if ( !$post = bp_forums_get_post( $post_id ) )
+		$post_id = false;
+
+	if ( !isset( $topic_id ) )
+		$topic_id = $post->topic_id;
+
+	if ( empty( $post_text ) )
+		$post_text = $post->post_text;
+
+	if ( !isset( $post_time ) )
+		$post_time = $post->post_time;
+
+	if ( !isset( $post_position ) )
+		$post_position = $post->post_position;
+
+	$post_id = bb_insert_post( array( 'post_id' => $post_id, 'topic_id' => $topic_id, 'post_text' => stripslashes( trim( $post_text ) ), 'post_time' => $post_time, 'poster_id' => $poster_id, 'poster_ip' => $poster_ip, 'post_status' => $post_status, 'post_position' => $post_position ) );
+
+	if ( $post_id )
+		do_action( 'bp_forums_new_post', $post_id );
+
+	return $post_id;
+}
+
+function bp_forums_get_post_extras( $posts ) {
+	global $bp, $wpdb;
+
+	if ( empty( $posts ) )
+		return $posts;
+
+	/* Get the user ids */
+	foreach ( (array)$posts as $post ) $user_ids[] = $post->poster_id;
+	$user_ids = $wpdb->escape( join( ',', (array)$user_ids ) );
+
+	/* Fetch the poster's user_email, user_nicename and user_login */
+	$poster_details = $wpdb->get_results( $wpdb->prepare( "SELECT u.ID as user_id, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$wpdb->users} u WHERE u.ID IN ( {$user_ids} )" ) );
+
+	for ( $i = 0; $i < count( $posts ); $i++ ) {
+		foreach ( (array)$poster_details as $poster ) {
+			if ( $poster->user_id == $posts[$i]->poster_id ) {
+				$posts[$i]->poster_email = $poster->user_email;
+				$posts[$i]->poster_login = $poster->user_nicename;
+				$posts[$i]->poster_nicename = $poster->user_login;
+				$posts[$i]->poster_name = $poster->display_name;
+			}
+		}
+	}
+
+	/* Fetch fullname for each poster. */
+	if ( function_exists( 'xprofile_install' ) ) {
+		$poster_names = $wpdb->get_results( $wpdb->prepare( "SELECT pd.user_id, pd.value FROM {$bp->profile->table_name_data} pd WHERE pd.user_id IN ( {$user_ids} )" ) );
+		for ( $i = 0; $i < count( $posts ); $i++ ) {
+			foreach ( (array)$poster_names as $name ) {
+				if ( $name->user_id == $topics[$i]->user_id )
+				$posts[$i]->poster_name = $poster->value;
+			}
+		}
+	}
+
+	return $posts;
+}
+
+
+function bp_forums_get_forum_topicpost_count( $forum_id ) {
+	global $wpdb, $bbdb;
+
+	do_action( 'bbpress_init' );
+
+	/* Need to find a bbPress function that does this */
+	return $wpdb->get_results( $wpdb->prepare( "SELECT topics, posts from {$bbdb->forums} WHERE forum_id = %d", $forum_id ) );
+}
+
+
+function bp_forums_filter_caps( $allcaps ) {
+	global $bp, $wp_roles, $bb_table_prefix;
+
+	$bb_cap = get_user_meta( $bp->loggedin_user->id, $bb_table_prefix . 'capabilities', true );
+
+	if ( empty( $bb_cap ) )
+		return $allcaps;
+
+	$bb_cap = array_keys($bb_cap);
+	$bb_cap = $wp_roles->get_role( $bb_cap[0] );
+	$bb_cap = $bb_cap->capabilities;
+
+	return array_merge( (array) $allcaps, (array) $bb_cap );
+}
+add_filter( 'user_has_cap', 'bp_forums_filter_caps' );
+
+
+/********************************************************************************
+ * Caching
+ *
+ * Caching functions handle the clearing of cached objects and pages on specific
+ * actions throughout BuddyPress.
+ */
+
+// List actions to clear super cached pages on, if super cache is installed
+add_action( 'bp_forums_new_forum', 'bp_core_clear_cache' );
+add_action( 'bp_forums_new_topic', 'bp_core_clear_cache' );
+add_action( 'bp_forums_new_post', 'bp_core_clear_cache' );
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bb-config.php b/wp-content/plugins/buddypress/bp-forums/bb-config.php
new file mode 100644
index 0000000000000000000000000000000000000000..b34b28bacca4a06515831d2de7906907b21cf401
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bb-config.php
@@ -0,0 +1,11 @@
+<?php
+/***
+ * *** IMPORTANT ****
+ * This file will stop people from accessing your bbPress installation directly.
+ * It is very important from a security standpoint that this file is not moved.
+ * Your actual bb-config.php file will be installed in the root of your WordPress
+ * installation once you have set up the forums component in BuddyPress.
+ */
+
+header("HTTP/1.0 403 Forbidden"); die;
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin-action.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin-action.php
new file mode 100644
index 0000000000000000000000000000000000000000..d51f5eb56c3329d7e705c3dd850d4b20e3b937eb
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin-action.php
@@ -0,0 +1,5 @@
+<?php
+require_once('../bb-load.php');
+
+bb_auth();
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin-ajax.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin-ajax.php
new file mode 100644
index 0000000000000000000000000000000000000000..0a141ca2a4a77c3cba1ee00a50990142f2922d49
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin-ajax.php
@@ -0,0 +1,243 @@
+<?php
+
+define( 'BB_IS_ADMIN', true );
+define( 'DOING_AJAX', true );
+
+require_once('../bb-load.php');
+
+if ( !class_exists( 'WP_Ajax_Response' ) )
+	require_once( BACKPRESS_PATH . 'class.wp-ajax-response.php' );
+
+require_once( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );
+
+if ( !$bb_current_id = bb_get_current_user_info( 'id' ) )
+	die('-1');
+
+function bb_grab_results() {
+	global $ajax_results;
+	$ajax_results = @ unserialize(func_get_arg(0));
+	if ( false === $ajax_results )
+		$ajax_results = func_get_args();
+	return;
+}
+
+$id = (int) @$_POST['id'];
+
+switch ( $action = $_POST['action'] ) :
+case 'add-tag' : // $id is topic_id
+	if ( !bb_current_user_can('edit_tag_by_on', $bb_current_id, $id) )
+		die('-1');
+
+	bb_check_ajax_referer( "add-tag_$id" );
+
+	global $tag, $topic;
+	add_action('bb_tag_added', 'bb_grab_results', 10, 3);
+	add_action('bb_already_tagged', 'bb_grab_results', 10, 3);
+	$tag_name = @$_POST['tag'];
+	$tag_name = stripslashes( $tag_name );
+
+	$topic = get_topic( $id );
+	if ( !$topic )
+		die('0');
+
+	$tag_name = rawurldecode($tag_name);
+	$x = new WP_Ajax_Response();
+	foreach ( bb_add_topic_tags( $id, $tag_name ) as $tag_id ) {
+		if ( !is_numeric($tag_id) || !$tag = bb_get_tag( (int) $tag_id, bb_get_current_user_info( 'id' ), $topic->topic_id ) ) {
+			if ( !$tag = bb_get_tag( $tag_id ) ) {
+				continue;
+			}
+		}
+		$tag->user_id = bb_get_current_user_info( 'id' );
+		$tag_id_val = $tag->tag_id . '_' . $tag->user_id;
+		$tag->raw_tag = esc_attr( $tag->raw_tag );
+		$x->add( array(
+			'what' => 'tag',
+			'id' => $tag_id_val,
+			'data' => _bb_list_tag_item( $tag, array( 'list_id' => 'tags-list', 'format' => 'list' ) )
+		) );
+	}
+	$x->send();
+	break;
+
+case 'delete-tag' :
+	list($tag_id, $user_id) = explode('_', $_POST['id']);
+	$tag_id   = (int) $tag_id;
+	$user_id  = (int) $user_id;
+	$topic_id = (int) $_POST['topic_id'];
+
+	if ( !bb_current_user_can('edit_tag_by_on', $user_id, $topic_id) )
+		die('-1');
+
+	bb_check_ajax_referer( "remove-tag_$tag_id|$topic_id" );
+
+	add_action('bb_rpe_tag_removed', 'bb_grab_results', 10, 3);
+
+	$tag   = bb_get_tag( $tag_id );
+	$user  = bb_get_user( $user_id );
+	$topic = get_topic ( $topic_id );
+	if ( !$tag || !$topic )
+		die('0');
+	if ( false !== bb_remove_topic_tag( $tag_id, $user_id, $topic_id ) )
+		die('1');
+	break;
+
+case 'dim-favorite' :
+	$user_id  = bb_get_current_user_info( 'id' );
+
+	if ( !$topic = get_topic( $id ) )
+		die('0');
+
+	if ( !bb_current_user_can( 'edit_favorites_of', $user_id ) )
+		die('-1');
+
+	bb_check_ajax_referer( "toggle-favorite_$topic->topic_id" );
+
+	$is_fav = is_user_favorite( $user_id, $topic->topic_id );
+
+	if ( 1 == $is_fav ) {
+		if ( bb_remove_user_favorite( $user_id, $topic->topic_id ) )
+			die('1');
+	} elseif ( false === $is_fav ) {
+		if ( bb_add_user_favorite( $user_id, $topic->topic_id ) )
+			die('1');
+	}
+	break;
+
+case 'delete-post' : // $id is post_id
+	if ( !bb_current_user_can( 'delete_post', $id ) )
+		die('-1');
+
+	bb_check_ajax_referer( "delete-post_$id" );
+
+	$status = (int) $_POST['status'];
+
+	if ( !$bb_post = bb_get_post( $id ) )
+		die('0');
+
+	if ( $status == $bb_post->post_status )
+		die('1'); // We're already there
+
+	if ( bb_delete_post( $id, $status ) )
+		die('1');
+	break;
+/*
+case 'add-post' : // Can put last_modified stuff back in later
+	bb_check_ajax_referer( $action );
+	$error = false;
+	$post_id = 0;
+	$topic_id = (int) $_POST['topic_id'];
+	$last_mod = (int) $_POST['last_mod'];
+	if ( !$post_content = trim($_POST['post_content']) )
+		$error = new WP_Error( 'no-content', __('You need to actually submit some content!') );
+	if ( !bb_current_user_can( 'write_post', $topic_id ) )
+		die('-1');
+	if ( !$topic = get_topic( $topic_id ) )
+		die('0');
+	if ( !topic_is_open( $topic_id ) )
+		$error = new WP_Error( 'topic-closed', __('This topic is closed.') );
+	if ( $throttle_time = bb_get_option( 'throttle_time' ) )
+		if ( isset($bb_current_user->data->last_posted) && time() < $bb_current_user->data->last_posted + $throttle_time && !bb_current_user_can('throttle') )
+			$error = new WP_Error( 'throttle-limit', sprintf( __('Slow down!  You can only post every %d seconds.'), $throttle_time );
+
+	if ( !$error ) :
+		if ( !$post_id = bb_new_post( $topic_id, rawurldecode($_POST['post_content']) ) )
+			die('0');
+
+		$bb_post = bb_get_post( $post_id );
+
+		$new_page = bb_get_page_number( $bb_post->post_position );
+
+		ob_start();
+			echo "<li id='post-$post_id'>";
+			bb_post_template();
+			echo '</li>';
+		$data = ob_get_contents();
+		ob_end_clean();
+	endif;
+	$x = new WP_Ajax_Response( array(
+		'what' => 'post',
+		'id' => $post_id,
+		'data' => is_wp_error($error) ? $error : $data
+	) );
+	$x->send();
+	break;
+*/
+case 'add-forum' :
+	if ( !bb_current_user_can( 'manage_forums' ) )
+		die('-1');
+
+	bb_check_ajax_referer( $action );
+
+	if ( !$forum_id = bb_new_forum( $_POST ) )
+		die('0');
+
+	global $forums_count;
+	$forums_count = 2; // Hack
+
+	$data = bb_forum_row( $forum_id, false, true );
+
+	$forum = bb_get_forum( $forum_id );
+	if ( $forum->forum_parent ) {
+		$siblings = bb_get_forums( $forum->forum_parent );
+		$last_sibling = array_pop( $siblings );
+		if ( $last_sibling->forum_id == $forum_id )
+			$last_sibling = array_pop( $siblings );
+		if ( $last_sibling ) {
+			$position = "forum-$last_sibling->forum_id";
+		} else {
+			$position = "+forum-$forum->forum_parent";
+			$data = "<ul id='forum-root-$forum->forum_parent' class='list-block holder'>$data</ul>";
+		}
+	} else {
+		$position = 1;
+	}
+
+	$x = new WP_Ajax_Response( array(
+		'what' => 'forum',
+		'id' => $forum_id,
+		'data' => $data,
+		'position' => $position,
+		'supplemental' => array( 'name' => $forum->forum_name )
+	) );
+	$x->send();
+	break;
+
+case 'order-forums' :
+	if ( !bb_current_user_can( 'manage_forums' ) )
+		die('-1');
+
+	bb_check_ajax_referer( $action );
+
+	if ( !is_array($_POST['order']) )
+		die('0');
+
+	global $bbdb;
+
+	$forums = array();
+
+	bb_get_forums(); // cache
+
+	foreach ( $_POST['order'] as $pos => $forum_id ) :
+		$forum = $bbdb->escape_deep( get_object_vars( bb_get_forum( $forum_id ) ) );
+		$forum['forum_order'] = $pos;
+		$forums[(int) $forum_id] = $forum;
+	endforeach;
+
+	foreach ( $_POST['root'] as $root => $ids )
+		foreach ( $ids as $forum_id )
+			$forums[(int) $forum_id]['forum_parent'] = (int) $root;
+
+	foreach ( $forums as $forum )
+		bb_update_forum( $forum );
+
+	die('1');
+	break;
+
+default :
+	do_action( 'bb_ajax_' . $_POST['action'] );
+	break;
+endswitch;
+
+die('0');
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin-base.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin-base.php
new file mode 100644
index 0000000000000000000000000000000000000000..060e811fc4369ec5033197326757a68a8c08112a
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin-base.php
@@ -0,0 +1,19 @@
+<?php
+require_once('admin.php');
+
+do_action( $bb_admin_page . '_pre_head' );
+
+bb_get_admin_header(); 
+?>
+
+<div class="wrap">
+
+<?php if ( is_callable($bb_admin_page) ) : call_user_func( $bb_admin_page ); else : ?>
+
+<p><?php _e('Nothing to see here.'); ?><p>
+
+<?php endif; ?>
+
+</div>
+
+<?php bb_get_admin_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin-footer.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin-footer.php
new file mode 100644
index 0000000000000000000000000000000000000000..41dea7cf3faee8d9c0b15fe1011eeb2369d45fc7
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin-footer.php
@@ -0,0 +1,33 @@
+			</div>
+			<div class="clear"></div>
+			<!-- If you like showing off the fact that your server rocks -->
+			<!-- <p id="bbShowOff">
+<?php
+global $bbdb;
+printf(
+__( 'This page generated in %s seconds, using %d queries.' ),
+bb_number_format_i18n( bb_timer_stop(), 2 ),
+bb_number_format_i18n( $bbdb->num_queries )
+);
+?>
+			</p> -->
+			<div class="clear"></div>
+		</div>
+	</div>
+	<div id="bbFoot">
+		<p id="bbThanks">
+<?php
+printf(
+	__( 'Thank you for using <a href="%s">bbPress</a>. | <a href="%s">Documentation</a> | <a href="%s">Feedback</a>' ),
+	'http://bbpress.org/',
+	'http://bbpress.org/documentation/',
+	'http://bbpress.org/forums/forum/requests-and-feedback'
+);
+?>
+		</p>
+		<p id="bbVersion"><?php printf( __( 'Version %s' ), bb_get_option( 'version' ) ); ?></p>
+	</div>
+
+	<?php do_action( 'bb_admin_footer' ); ?>
+</body>
+</html>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin-header.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin-header.php
new file mode 100644
index 0000000000000000000000000000000000000000..1b69231d97f4aa6c2750cca4dc8a512aa38eb156
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin-header.php
@@ -0,0 +1,51 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"<?php bb_language_attributes( '1.1' ); ?>>
+<head>
+	<meta http-equiv="X-UA-Compatible" content="IE=8" />
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<title><?php bb_admin_title() ?></title>
+	<link rel="stylesheet" href="<?php bb_uri('bb-admin/style.css', null, BB_URI_CONTEXT_LINK_STYLESHEET_HREF + BB_URI_CONTEXT_BB_ADMIN); ?>" type="text/css" />
+<?php if ( 'rtl' == bb_get_option( 'text_direction' ) ) : ?>
+	<link rel="stylesheet" href="<?php bb_uri('bb-admin/style-rtl.css', null, BB_URI_CONTEXT_LINK_STYLESHEET_HREF + BB_URI_CONTEXT_BB_ADMIN); ?>" type="text/css" />
+<?php endif; do_action('bb_admin_print_scripts'); ?>
+	<script type="text/javascript">
+		//<![CDATA[
+		addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
+		var userSettings = {'url':'<?php echo $bb->cookie_path; ?>','uid':'<?php if ( ! isset($bb_current_user) ) $bb_current_user = bb_get_current_user(); echo $bb_current_user->ID; ?>','time':'<?php echo time(); ?>'};
+		//]]>
+	</script>
+<?php do_action( 'bb_admin_head' ); ?>
+</head>
+
+<?php
+global $bb_admin_body_class;
+if ( 'f' == bb_get_user_setting( 'fm' ) ) {
+	$bb_admin_body_class .= ' bb-menu-folded';
+}
+?>
+
+<body class="bb-admin no-js <?php echo trim( $bb_admin_body_class ); ?>">
+	<script type="text/javascript">
+		//<![CDATA[
+		(function(){
+			var c = document.body.className;
+			c = c.replace(/no-js/, 'js');
+			document.body.className = c;
+		})();
+		//]]>
+	</script>
+	<div id="bbWrap">
+		<div id="bbContent">
+			<div id="bbHead">
+				<h1><a href="<?php bb_uri(); ?>"><span><?php bb_option('name'); ?></span> <em><?php _e('Visit Site'); ?></em></a></h1>
+				<div id="bbUserInfo">
+					<p>
+						<?php printf( __('Howdy, %1$s'), bb_get_profile_link( array( 'text' => bb_get_current_user_info( 'name' ) ) ) );?>
+						| <?php bb_logout_link( array( 'redirect' => bb_get_uri( null, null, BB_URI_CONTEXT_HEADER ) ) ); ?>
+					</p>
+				</div>
+			</div>
+
+			<div id="bbBody">
+
+<?php bb_admin_menu(); ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin.php
new file mode 100644
index 0000000000000000000000000000000000000000..ae2060540466f2b7f2b2ddfbbfee51e30d0e30bb
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/admin.php
@@ -0,0 +1,37 @@
+<?php
+define( 'BB_IS_ADMIN', true );
+
+require_once('../bb-load.php');
+
+bb_ssl_redirect();
+
+bb_auth();
+
+if ( bb_get_option( 'bb_db_version' ) > bb_get_option_from_db( 'bb_db_version' ) ) {
+	bb_safe_redirect( 'upgrade.php' );
+	die();
+}
+
+require_once( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );
+
+$bb_admin_page = bb_find_filename( $_SERVER['PHP_SELF'] );
+
+if ( $bb_admin_page == 'admin-base.php' ) {
+	$bb_admin_page = $_GET['plugin'];
+}
+
+wp_enqueue_script( 'common' );
+
+bb_user_settings();
+if ( isset( $_GET['foldmenu'] ) ) {
+	if ( $_GET['foldmenu'] ) {
+		bb_update_user_setting( 'fm', 'f' );
+	} else {
+		bb_delete_user_setting( 'fm' );
+	}
+	bb_safe_redirect( remove_query_arg( 'foldmenu', stripslashes( $_SERVER['REQUEST_URI'] ) ) );
+	die;
+}
+bb_admin_menu_generator();
+bb_get_current_admin_menu();
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/bb-forum.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/bb-forum.php
new file mode 100644
index 0000000000000000000000000000000000000000..3e168facbf7eb9fc2a0003b969cfe900ae9b420f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/bb-forum.php
@@ -0,0 +1,61 @@
+<?php
+require_once('admin.php');
+
+if ( !bb_current_user_can('manage_forums') )
+	bb_die(__("You don't have the authority to mess with the forums."));
+
+if ( !isset($_POST['action']) ) {
+	wp_redirect( bb_get_uri('bb-admin/forums.php', null, BB_URI_CONTEXT_HEADER + BB_URI_CONTEXT_BB_ADMIN) );
+	exit;
+}
+
+$sent_from = wp_get_referer();
+
+switch ( $_POST['action'] ) :
+case 'add' :
+	if ( !isset($_POST['forum_name']) || '' === $_POST['forum_name'] )
+		bb_die(__('Bad forum name.  Go back and try again.'));
+
+	bb_check_admin_referer( 'add-forum' );
+
+	if ( false !== bb_new_forum( $_POST ) ) :
+		bb_safe_redirect( $sent_from );
+		exit;
+	else :
+		bb_die(__('The forum was not added'));
+	endif;
+	break;
+case 'update' :
+	bb_check_admin_referer( 'update-forum' );
+
+	if ( !$forums = bb_get_forums() )
+		bb_die(__('No forums to update!'));
+	if ( (int) $_POST['forum_id'] && isset($_POST['forum_name']) && '' !== $_POST['forum_name'] )
+		bb_update_forum( $_POST );
+	foreach ( array('action', 'id') as $arg )
+		$sent_from = remove_query_arg( $arg, $sent_from );
+	bb_safe_redirect( add_query_arg( 'message', 'updated', $sent_from ) );
+	exit;
+	break;
+case 'delete' :
+	bb_check_admin_referer( 'delete-forums' );
+
+	$forum_id = (int) $_POST['forum_id'];
+	$move_topics_forum = (int) $_POST['move_topics_forum'];
+
+	if ( !bb_current_user_can( 'delete_forum', $forum_id ) )
+		bb_die(__("You don't have the authority to kill off the forums."));
+
+	if ( isset($_POST['move_topics']) && $_POST['move_topics'] != 'delete' )
+		bb_move_forum_topics( $forum_id, $move_topics_forum );
+
+	if ( !bb_delete_forum( $forum_id ) )
+		bb_die( __('Error occured while trying to delete forum') );
+
+	foreach ( array('action', 'id') as $arg )
+		$sent_from = remove_query_arg( $arg, $sent_from );
+	bb_safe_redirect( add_query_arg( 'message', 'deleted', $sent_from ) );
+	exit;
+	break;
+endswitch;
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/delete-post.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/delete-post.php
new file mode 100644
index 0000000000000000000000000000000000000000..f18b546f12323d4fe56d95af20397c51c0fd9b4b
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/delete-post.php
@@ -0,0 +1,78 @@
+<?php
+require('admin-action.php');
+
+$post_id = (int) $_GET['id'];
+
+if ( !bb_current_user_can( 'delete_post', $post_id ) ) {
+	wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
+	exit;
+}
+
+bb_check_admin_referer( 'delete-post_' . $post_id );
+
+$status  = (int) $_GET['status'];
+$bb_post = bb_get_post ( $post_id );
+$old_status = (int) $bb_post->post_status;
+
+if ( !$bb_post )
+	bb_die(__('There is a problem with that post, pardner.'));
+
+if ( 0 == $status && 0 != $bb_post->post_status ) // We're undeleting
+	add_filter('bb_delete_post', 'bb_topics_replied_on_undelete_post');
+
+bb_delete_post( $post_id, $status );
+
+$message = '';
+switch ( $old_status ) {
+	case 0:
+		switch ( $status ) {
+			case 0:
+				break;
+			case 1:
+				$message = 'deleted';
+				break;
+			default:
+				$message = 'spammed';
+				break;
+		}
+		break;
+	case 1:
+		switch ( $status ) {
+			case 0:
+				$message = 'undeleted';
+				break;
+			case 1:
+				break;
+			default:
+				$message = 'spammed';
+				break;
+		}
+		break;
+	default:
+		switch ( $status ) {
+			case 0:
+				$message = 'unspammed-normal';
+				break;
+			case 1:
+				$message = 'unspammed-deleted';
+				break;
+			default:
+				break;
+		}
+		break;
+}
+
+$topic = get_topic( $bb_post->topic_id );
+
+if ( $sendto = wp_get_referer() ) {
+	$sendto = remove_query_arg( 'message', $sendto );
+	$sendto = add_query_arg( 'message', $message, $sendto );
+} elseif ( $topic->topic_posts == 0 ) {
+	$sendto = get_forum_link( $topic->forum_id );
+} else {
+	$the_page = bb_get_page_number( $bb_post->post_position );
+	$sendto = get_topic_link( $bb_post->topic_id, $the_page );
+}
+
+bb_safe_redirect( $sendto );
+exit;
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/delete-topic.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/delete-topic.php
new file mode 100644
index 0000000000000000000000000000000000000000..a613383791a8c701060af98b9d488ad7285cd453
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/delete-topic.php
@@ -0,0 +1,53 @@
+<?php
+require('admin-action.php');
+
+$topic_id = (int) $_GET['id'];
+
+if ( !bb_current_user_can( 'delete_topic', $topic_id ) ) {
+	wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
+	exit;
+}
+
+bb_check_admin_referer( 'delete-topic_' . $topic_id );
+
+$topic = get_topic( $topic_id );
+$old_status = (int) $topic->topic_status;
+
+if ( !$topic )
+	bb_die(__('There is a problem with that topic, pardner.'));
+
+$status = $topic->topic_status ? 0 : 1;
+bb_delete_topic( $topic->topic_id, $status );
+
+$message = '';
+switch ( $old_status ) {
+	case 0:
+		switch ( $status ) {
+			case 0:
+				break;
+			case 1:
+				$message = 'deleted';
+				break;
+		}
+		break;
+	case 1:
+		switch ( $status ) {
+			case 0:
+				$message = 'undeleted';
+				break;
+			case 1:
+				break;
+		}
+		break;
+}
+
+if ( $sendto = wp_get_referer() ) {
+	$sendto = remove_query_arg( 'message', $sendto );
+	$sendto = add_query_arg( 'message', $message, $sendto );
+} elseif ( 0 == $topic->topic_status )
+	$sendto = get_forum_link( $topic->forum_id );
+else
+	$sendto = get_topic_link( $topic_id );
+	
+wp_redirect( $sendto );
+exit;
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/export.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/export.php
new file mode 100644
index 0000000000000000000000000000000000000000..3750d766976bc77a83fb6a2df5926536908e479d
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/export.php
@@ -0,0 +1,306 @@
+<?php
+
+require_once( '../bb-load.php' );
+require_once( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );
+
+define('BB_EXPORT_USERS', 1);
+define('BB_EXPORT_FORUMS', 2);
+define('BB_EXPORT_TOPICS', 4);
+
+// Some example usage of the bitwise export levels (can be defined in bb-config.php)
+//define('BB_EXPORT_LEVEL', BB_EXPORT_USERS);
+//define('BB_EXPORT_LEVEL', BB_EXPORT_USERS + BB_EXPORT_FORUMS);
+//define('BB_EXPORT_LEVEL', BB_EXPORT_USERS + BB_EXPORT_FORUMS + BB_EXPORT_TOPICS);
+
+if ( !defined('BB_EXPORT_LEVEL') )
+	define('BB_EXPORT_LEVEL', 0);
+
+if ( !BB_EXPORT_LEVEL || !bb_current_user_can( 'import_export' ) )
+	bb_die( __('Either export is disabled or you are not allowed to export.') );
+
+// See bb_export_user for syntax
+function _bb_export_object( $object, $properties = null, $tabs = 1 ) {
+	$r = '';
+
+	if ( !$type = $object['type'] )
+		return;
+	unset($object['type']);
+
+	$atts = '';
+	$id = 0;
+	foreach ( $object as $att => $v ) {
+		if ( 'id' == $att ) {
+			$id = $v;
+			$v = $type . '_' . $v;
+		}
+		$atts .= " $att='$v'";
+	}
+	unset($att, $v);
+
+	$r .= str_repeat("\t", $tabs) . "<$type{$atts}>\n";
+
+	foreach ( (array) $properties as $k => $v ) {
+		if ( 'meta' == $k ) {
+			$data = '';
+			foreach ( $v as $mk => $mv )
+				$data .= str_repeat("\t", $tabs + 1) . "<meta key='$mk'><![CDATA[$mv]]></meta>\n";
+		} else {
+			if ( '!' == $k{0} ) {
+				$k = substr($k, 1);
+				$v = "<![CDATA[$v]]>";
+			}
+			$data = str_repeat("\t", $tabs + 1) . "<$k>$v</$k>\n";
+		}
+		$r .= $data;
+	}
+
+	$r .= apply_filters( 'in_bb_export_object_' . $type, '', $id );
+
+	$r .= str_repeat("\t", $tabs) . "</$type>\n\n";
+
+	return $r;
+}
+
+// See bb_export_user for syntax
+function _bb_translate_for_export( $translate, &$data ) {
+	$r = array();
+	foreach ( $translate as $prop => $export ) {
+		if ( '?' == $export{0} ) {
+			$export = substr($export, 1);
+			if ( !$data[$prop] ) {
+				unset($data[$prop]);
+				continue;
+			}
+		}
+		if ( false === $export ) {
+			unset($data[$prop]);
+			continue;
+		}
+		$r[$export] = $data[$prop];
+		unset($data[$prop]);
+	}
+	unset($export, $prop);
+	return $r;
+}
+
+function bb_export_user( $user_id ) {
+	global $bbdb;
+	if ( !$_user = bb_get_user( $user_id ) )
+		return;
+
+	$_user = get_object_vars($_user);
+
+	$atts = array(
+		'type' => 'user',
+		'id' => $_user['ID']
+	);
+
+	// ?url means url is optional.  Only include it in the export if it exists
+	// !title means the title should be wrapped in CDATA
+	// ?! is the correct order, not !?
+	$translate = array(
+		'user_login' => 'login',
+		'user_pass' => 'pass',
+		'user_email' => 'email',
+		'user_url' => '?url',
+		'user_registered' => 'incept',
+		'display_name' => '?!title',
+		'user_nicename' => '?nicename',
+		'user_status' => '?status',
+		'ID' => false
+	);
+
+	$user = _bb_translate_for_export( $translate, $_user );
+
+	$meta = array();
+	foreach ( $_user as $k => $v ) {
+		if ( 0 !== strpos($k, $bbdb->prefix) && isset($_user[$bbdb->prefix . $k]) )
+			continue;
+		$meta[$k] = maybe_serialize($v);
+	}
+	unset($_user, $k, $v);
+
+	$user['meta'] = $meta;
+
+	return _bb_export_object( $atts, $user );
+}
+
+function bb_export_forum( $forum_id ) {
+	if ( !$_forum = bb_get_forum( $forum_id ) )
+		return;
+
+	$_forum = get_object_vars( $_forum );
+
+	$translate = array(
+		'forum_name'   => '!title',
+		'forum_desc'   => '?!content',
+		'forum_parent' => '?parent'
+	);
+
+	$forum = _bb_translate_for_export( $translate, $_forum );
+
+	return _bb_export_object( array('type' => 'forum', 'id' => $_forum['forum_id']), $forum );
+}
+
+function bb_export_topic( $topic_id ) {
+	if ( !$_topic = get_topic( $topic_id ) )
+		return;
+
+	$_topic = get_object_vars( $_topic );
+
+	$atts = array(
+		'type' => 'topic',
+		'id' => $_topic['topic_id'],
+		'author' => 'user_' . $_topic['topic_poster'],
+		'in' => 'forum_' . $_topic['forum_id']
+	);
+
+	$translate = array(
+		'topic_title' => '!title',
+		'topic_start_time' => 'incept',
+		'topic_status' => '?status',
+		'topic_id' => false,
+		'topic_poster' => false,
+		'topic_poster_name' => false,
+		'topic_last_poster' => false,
+		'topic_last_poster_name' => false,
+		'topic_time' => false,
+		'forum_id' => false,
+		'topic_last_post_id' => false,
+		'topic_posts' => false,
+		'tag_count' => false
+	);
+
+	$topic = _bb_translate_for_export( $translate, $_topic );
+
+	$meta = array();
+	foreach ( $_topic as $k => $v )
+		$meta[$k] = maybe_serialize($v);
+	unset($_topic, $k, $v);
+
+	$topic['meta'] = $meta;
+
+	return _bb_export_object( $atts, $topic );
+}
+
+function bb_export_post( $post_id ) {
+	if ( !$_post = bb_get_post( $post_id ) )
+		return;
+
+	$_post = get_object_vars($_post);
+
+	$atts = array(
+		'type' => 'post',
+		'id' => $_post['post_id'],
+		'author' => 'user_' . $_post['poster_id']
+	);
+
+	$translate = array(
+		'post_time' => 'incept',
+		'post_text' => '!content',
+		'post_status' => '?status',
+		'post_id' => false,
+		'poster_id' => false,
+		'forum_id' => false,
+		'topic_id' => false,
+		'post_position' => false
+	);
+
+	$post = _bb_translate_for_export( $translate, $_post );
+
+	$post['meta'] = $_post;
+
+	return _bb_export_object( $atts, $post, 2 );
+}
+
+// One of these things is not like the others...
+function bb_export_tag( $tag ) {
+	// id here is not numeric.  does not currently preserve tagged_on
+	return "\t\t<tag author='user_$tag->user_id' id='tag_$tag->tag'><![CDATA[$tag->raw_tag]]></tag>\n";
+}
+
+function bb_export_topic_tags( $r, $topic_id ) {
+	global $topic_tag_cache;
+	if ( !get_topic( $topic_id ) )
+		return;
+
+	if ( !$tags = bb_get_topic_tags( $topic_id ) )
+		return $r;
+
+	$r .= "\n";
+
+	foreach ( (array) $tags as $tag )
+		$r .= bb_export_tag( $tag );
+	$topic_tag_cache = array();
+
+	return $r;
+}
+
+function bb_export_topic_posts( $r, $topic_id ) {
+	if ( !get_topic( $topic_id ) )
+		return;
+
+	$r .= "\n";
+
+	$page = 1;
+	while ( $posts = get_thread( $topic_id, $page++ ) ) {
+		foreach ( $posts as $post )
+			$r .= bb_export_post( $post->post_id );
+	}
+
+	return $r;
+}
+
+function bb_export() {
+	global $bb;
+
+	define( 'BB_EXPORTING', true );
+	do_action( 'bb_pre_export' );
+
+	$bb->use_cache = false; // Turn off hard cache
+	$bb->page_topics = 100;
+
+	echo "<forums-data version='0.75'>\n";
+
+	if (BB_EXPORT_LEVEL & BB_EXPORT_USERS) {
+		$page = 1;
+		while ( ( $users = bb_user_search( array('page' => $page++) ) ) && !is_wp_error( $users ) ) {
+			foreach ( $users as $user )
+				echo bb_export_user( $user->ID );
+		}
+		unset($users, $user, $page);
+	}
+
+	if (BB_EXPORT_LEVEL & BB_EXPORT_FORUMS) {
+		$forums = bb_get_forums();
+		foreach ( $forums as $forum )
+			echo bb_export_forum( $forum->forum_id );
+		unset($forums, $forum);
+	}
+
+	if (BB_EXPORT_LEVEL & BB_EXPORT_TOPICS) {
+		$page = 1;
+		while ( $topics = get_latest_topics( 0, $page++ ) ) {
+			foreach ( $topics as $topic )
+				echo bb_export_topic( $topic->topic_id );
+		}
+		unset($topics, $topic, $page);
+	}
+
+	do_action( 'bb_export' );
+
+	echo '</forums-data>';
+}
+
+add_filter( 'in_bb_export_object_topic', 'bb_export_topic_tags', 10, 2 );
+add_filter( 'in_bb_export_object_topic', 'bb_export_topic_posts', 10, 2 );
+add_filter( 'get_forum_where', 'bb_no_where', 9999 );
+add_filter( 'get_forums_where', 'bb_no_where', 9999 );
+add_filter( 'get_latest_topics_where', 'bb_no_where', 9999 );
+add_filter( 'get_thread_where', 'bb_no_where', 9999 );
+add_filter( 'get_user_where', 'bb_no_where', 9999 );
+add_filter( 'cache_users_where', 'bb_no_where', 9999 );
+
+bb_export();
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/forums.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/forums.php
new file mode 100644
index 0000000000000000000000000000000000000000..c2fdecb35c68f8e05ab3837923ac23e23eb703c0
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/forums.php
@@ -0,0 +1,106 @@
+<?php
+require_once('admin.php');
+
+$forums = bb_get_forums();
+$forums_count = $forums ? count($forums) : 0;
+
+if ( isset($_GET['action']) && 'delete' == $_GET['action'] ) {
+	$forum_to_delete = (int) $_GET['id'];
+	$deleted_forum = bb_get_forum( $forum_to_delete );
+	if ( !$deleted_forum || $forums_count < 2 || !bb_current_user_can( 'delete_forum', $forum_to_delete ) ) {
+		bb_safe_redirect( add_query_arg( array('action' => false, 'id' => false) ) );
+		exit;
+	}
+}
+
+if ( isset($_GET['message']) ) {
+	switch ( $_GET['message'] ) :
+	case 'updated' :
+		bb_admin_notice( __( '<strong>Forum Updated.</strong>' ) );
+		break;
+	case 'deleted' :
+		bb_admin_notice( sprintf(
+			__( '<strong>Forum deleted.</strong>  You should <a href="%s">recount your site information</a>.' ),
+			bb_get_uri('bb-admin/tools-recount.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN)
+		) );
+		break;
+	endswitch;
+}
+
+if ( !isset($_GET['action']) )
+	wp_enqueue_script( 'admin-forums' );
+elseif ( 'delete' == @$_GET['action'] )
+	bb_admin_notice( sprintf( __( 'Are you sure you want to delete the "<strong>%s</strong>" forum?' ), $deleted_forum->forum_name ) );
+
+$bb_admin_body_class = ' bb-admin-forums';
+
+bb_get_admin_header();
+?>
+
+<div class="wrap">
+
+<h2><?php _e('Forums'); ?></h2>
+<?php do_action( 'bb_admin_notices' ); ?>
+<?php switch ( @$_GET['action'] ) : ?>
+<?php case 'edit' : ?>
+<?php bb_forum_form( (int) $_GET['id'] ); ?>
+<?php break; case 'delete' : ?>
+
+<form class="settings" method="post" id="delete-forums" action="<?php bb_uri('bb-admin/bb-forum.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>">
+	<fieldset>
+		<legend><?php _e('Delete Forum'); ?></legend>
+		<p><?php _e('This forum contains:'); ?></p>
+		<ul>
+			<li><?php printf(__ngettext('%d topic', '%d topics', $deleted_forum->topics), $deleted_forum->topics); ?></li>
+			<li><?php printf(__ngettext('%d post', '%d posts', $deleted_forum->posts), $deleted_forum->posts); ?></li>
+		</ul>
+		<div id="option-forum-delete-contents">
+			<div class="label"><?php _e( 'Action' ); ?></div>
+			<div class="inputs">
+				<label class="radios">
+					<input type="radio" name="move_topics" id="move-topics-delete" value="delete" /> <?php _e('Delete all topics and posts in this forum. <em>This can never be undone.</em>'); ?>
+				</label>
+				<label class="radios">
+					<input type="radio" name="move_topics" id="move-topics-move" value="move" checked="checked" /> <?php _e('Move topics from this forum into the replacement forum below.'); ?>
+				</label>
+			</div>
+		</div>
+		<div id="option-forum-delete-contents">
+			<label for="move-topics-forum"><?php _e( 'Replacement forum' ); ?></label>
+			<div class="inputs">
+				<?php bb_forum_dropdown( array('id' => 'move_topics_forum', 'callback' => 'strcmp', 'callback_args' => array($deleted_forum->forum_id), 'selected' => $deleted_forum->forum_parent) ); ?>
+			</div>
+		</div>
+	</fieldset>
+	<fieldset class="submit">
+		<?php bb_nonce_field( 'delete-forums' ); ?>
+		<input type="hidden" name="action" value="delete" />
+		<input type="hidden" name="forum_id" value="<?php echo $deleted_forum->forum_id; ?>" />
+		<a href="<?php bb_uri('bb-admin/forums.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN); ?>" class="cancel"><?php _e('Cancel') ?></a>
+		<input class="submit delete" type="submit" name="submit" value="<?php _e('Delete Forum') ?>" />
+	</fieldset>
+</form>
+
+<?php break; default : ?>
+
+
+<?php if ( bb_forums( 'type=list&walker=BB_Walker_ForumAdminlistitems' ) ) : ?>
+<ul id="forum-list" class="list:forum list-block holder">
+	<li class="thead list-block"><?php _e('Forum'); ?></li>
+<?php while ( bb_forum() ) : ?>
+<?php bb_forum_row(); ?>
+<?php endwhile; ?>
+</ul>
+<?php endif; // bb_forums() ?>
+
+<hr class="settings" />
+
+<?php bb_forum_form(); ?>
+
+<?php break; endswitch; // action ?>
+
+<div id="ajax-response"></div>
+
+</div>
+
+<?php bb_get_admin_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/admin-header-logo.gif b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/admin-header-logo.gif
new file mode 100644
index 0000000000000000000000000000000000000000..8696dba07c861ce783eb061c5fe373d4ec1cef3f
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/admin-header-logo.gif differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/bbpress-logo.png b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/bbpress-logo.png
new file mode 100644
index 0000000000000000000000000000000000000000..2487b2d7a5974283fbf4b8a05acdc43bbf17c7a8
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/bbpress-logo.png differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/blank.gif b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/blank.gif
new file mode 100644
index 0000000000000000000000000000000000000000..e565824aafafe632011b281cba976baf8b3ba89a
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/blank.gif differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/button-grad.png b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/button-grad.png
new file mode 100644
index 0000000000000000000000000000000000000000..0f101761a65e9bbf55bf1e36c873ec0ed36e071c
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/button-grad.png differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/drag.gif b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/drag.gif
new file mode 100644
index 0000000000000000000000000000000000000000..381a6204fde35cab19cec5f99393827fb27f3781
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/drag.gif differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/gray-grad.png b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/gray-grad.png
new file mode 100644
index 0000000000000000000000000000000000000000..99c45cef250a0546451e8d797a1d49ec65e7c952
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/gray-grad.png differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/icons32.png b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/icons32.png
new file mode 100644
index 0000000000000000000000000000000000000000..3dd6ea44ed79dcf54b287b9137dc5015aea61807
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/icons32.png differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/input-lock.png b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/input-lock.png
new file mode 100644
index 0000000000000000000000000000000000000000..61da0fddf292f1cef60598c83e48756774622d7a
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/input-lock.png differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu-arrows.gif b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu-arrows.gif
new file mode 100644
index 0000000000000000000000000000000000000000..ec854c1f9694622e24727a1adaff3dac4ad75def
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu-arrows.gif differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu-bits-rtl.gif b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu-bits-rtl.gif
new file mode 100644
index 0000000000000000000000000000000000000000..3765bfb807ef524845c68d1ed1644c47d11fe84c
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu-bits-rtl.gif differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu-bits.gif b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu-bits.gif
new file mode 100644
index 0000000000000000000000000000000000000000..9a10a9a168d6e17db802ded92ac0c3c990096a2d
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu-bits.gif differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu-dark-rtl.gif b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu-dark-rtl.gif
new file mode 100644
index 0000000000000000000000000000000000000000..7bfd25d58aca207c062a4869a4b972fb08bc31f6
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu-dark-rtl.gif differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu-dark.gif b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu-dark.gif
new file mode 100644
index 0000000000000000000000000000000000000000..739b888f32573b02c0e4535df814bf949f068745
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu-dark.gif differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu.png b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu.png
new file mode 100644
index 0000000000000000000000000000000000000000..a213aa7d53f49c2d01606a1cb5e5a774c4ec85f0
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/menu.png differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/visit-site-button-grad.gif b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/visit-site-button-grad.gif
new file mode 100644
index 0000000000000000000000000000000000000000..a7b703e5592564ab5ee0ca8694e4320897dea0e8
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/visit-site-button-grad.gif differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/white-grad-active.png b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/white-grad-active.png
new file mode 100644
index 0000000000000000000000000000000000000000..04780150b1687255e4f6c7a58184ce0f29e1b4b4
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/white-grad-active.png differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/white-grad.png b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/white-grad.png
new file mode 100644
index 0000000000000000000000000000000000000000..aaf57aa9500bb4e3cf74c2fd34b5fa900e90cb50
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/images/white-grad.png differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/class.bb-install.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/class.bb-install.php
new file mode 100644
index 0000000000000000000000000000000000000000..6ae02da629f691c57ee5b065f111594acbafbf36
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/class.bb-install.php
@@ -0,0 +1,2763 @@
+<?php
+/**
+ * bbPress Installation class
+ *
+ * @since 0.9
+ */
+class BB_Install
+{
+	/**
+	 * The file where the class was instantiated
+	 *
+	 * @var string
+	 */
+	var $caller;
+
+	/**
+	 * Whether or not we need to load some of the includes normally loaded by bb-settings.php
+	 *
+	 * @var boolean
+	 */
+	var $load_includes = false;
+
+	/**
+	 * An array of available languages to use in the installer
+	 *
+	 * @var array
+	 */
+	var $languages = array( 'en_US' => 'en_US' );
+
+	/**
+	 * The currently selected language for the installer
+	 *
+	 * @var string
+	 */
+	var $language = 'en_US';
+
+	/**
+	 * The current step in the install process
+	 *
+	 * @var integer
+	 */
+	var $step;
+
+	/**
+	 * Info about config files and their locations
+	 *
+	 * @var array
+	 */
+	var $configs = array(
+		'writable' => false,
+		'bb-config.php' => false,
+		'config.php' => false
+	);
+
+	/**
+	 * An array of the current status of each step
+	 *
+	 * @var array
+	 */
+	var $step_status = array(
+		0 => 'incomplete',
+		1 => 'incomplete',
+		2 => 'incomplete',
+		3 => 'incomplete',
+		4 => 'incomplete'
+	);
+
+	/**
+	 * An array of most strings in use, including errors
+	 *
+	 * @var array
+	 */
+	var $strings = array();
+
+	/**
+	 * The data being manipulated as we go through the forms
+	 *
+	 * @var array
+	 */
+	var $data = array();
+
+	/**
+	 * A boolean that can get flagged to stop posting of a form getting processed
+	 *
+	 * @var boolean
+	 */
+	var $stop_process = false;
+
+	/**
+	 * Keeps track of where the tabindex is up to
+	 *
+	 * @var integer
+	 */
+	var $tabindex = 0;
+
+	/**
+	 * Constructor
+	 *
+	 * Loads everything we might need to do the business
+	 *
+	 * @param string $caller The full path of the file that instantiated the class
+	 * @return boolean Always returns true
+	 */
+	function BB_Install( $caller )
+	{
+		$this->caller = $caller;
+
+		$this->set_initial_step();
+		$this->define_paths();
+
+		// We need to load these when bb-settings.php isn't loaded
+		if ( $this->load_includes ) {
+			require_once( BACKPRESS_PATH . 'functions.core.php' );
+			require_once( BACKPRESS_PATH . 'functions.compat.php' );
+			require_once( BACKPRESS_PATH . 'functions.formatting.php' );
+			require_once( BACKPRESS_PATH . 'functions.plugin-api.php' );
+			require_once( BACKPRESS_PATH . 'class.wp-error.php' );
+			require_once( BB_PATH . BB_INC . 'functions.bb-core.php' );
+			require_once( BB_PATH . BB_INC . 'functions.bb-meta.php' );
+			require_once( BB_PATH . BB_INC . 'class.bp-options.php' );
+			require_once( BACKPRESS_PATH . 'functions.bp-options.php' );
+			require_once( BACKPRESS_PATH . 'functions.kses.php' );
+			require_once( BB_PATH . BB_INC . 'functions.bb-l10n.php' );
+			require_once( BB_PATH . BB_INC . 'functions.bb-template.php' );
+		}
+
+		$this->get_languages();
+		$this->set_language();
+
+		if ( $this->language ) {
+			global $locale;
+			global $l10n;
+			$locale = $this->language;
+			unset( $l10n['default'] );
+
+			if ( !class_exists( 'MO' ) ) {
+				require_once( BACKPRESS_PATH . 'pomo/mo.php' );
+			}
+		}
+
+		// Load the default text localization domain. Doing this twice doesn't hurt too much.
+		bb_load_default_textdomain();
+
+		// Pull in locale data after loading text domain.
+		if ( $this->load_includes ) {
+			require_once( BB_PATH . BB_INC . 'class.bb-locale.php' );
+		}
+		global $bb_locale;
+		$bb_locale = new BB_Locale();
+
+		$this->prepare_strings();
+		$this->check_prerequisites();
+		$this->check_configs();
+
+		if ( $this->step > -1 ) {
+			$this->set_step();
+			$this->prepare_data();
+			$this->process_form();
+		}
+
+		return true;
+	}
+
+	/**
+	 * Set initial step
+	 *
+	 * Sets the step from the post data and keeps it within range
+	 *
+	 * @return integer The calculated step
+	 */
+	function set_initial_step()
+	{
+		// Set the step based on the $_POST value or 0
+		$this->step = $_POST['step'] ? (integer) $_POST['step'] : 0;
+
+		// Make sure the requested step is from 0-4
+		if ( 0 > $this->step || 4 < $this->step ) {
+			$this->step = 0;
+		}
+		return $this->step;
+	}
+
+	/**
+	 * Prepare text strings
+	 *
+	 * Sets up many of the strings to be used by the class that may
+	 * be later subject to change due to processing of the forms
+	 */
+	function prepare_strings()
+	{
+		$this->strings = array(
+			-1 => array(
+				'title'       => __( 'bbPress &rsaquo; Error' ),
+				'h1'          => __( 'Oh dear!' ),
+				'messages'    => array()
+			),
+			0 => array(
+				'title'       => sprintf( __( '%1$s &rsaquo; %2$s' ), __( 'bbPress installer' ), __( 'Welcome' ) ),
+				'h2'          => __( 'Welcome to the bbPress installer' ),
+				'status'      => '',
+				'messages'    => array(),
+				'intro'       => array(
+					__( 'We\'re now going to go through a few steps to get you up and running.' ),
+					__( 'Ready? Then let\'s get started!' )
+				)
+			),
+			1 => array(
+				'title'       => sprintf( __( '%1$s &rsaquo; %2$s' ), __( 'bbPress installer' ), __( 'Step 1' ) ),
+				'h2'          => sprintf( __( '%1$s - %2$s' ), __( 'Step 1' ), __( 'Database configuration' ) ),
+				'status'      => '',
+				'intro'       => array(
+					__( 'In this step you need to enter your database connection details. The installer will attempt to create a file called <code>bb-config.php</code> in the root directory of your bbPress installation.' ),
+					__( 'If you\'re not sure what to put here, contact your web hosting provider.' )
+				),
+				'messages'    => array()
+			),
+			2 => array(
+				'title'       => sprintf( __( '%1$s &rsaquo; %2$s' ), __( 'bbPress installer' ), __( 'Step 2' ) ),
+				'h2'          => sprintf( __( '%1$s - %2$s' ), __( 'Step 2' ), __( 'WordPress integration (optional)' ) ),
+				'status'      => __( '&laquo; skipped' ),
+				'intro'       => array(
+					__( 'bbPress can integrate login and user data seamlessly with WordPress. You can safely skip this step if you do not wish to integrate with an existing WordPress install.' )
+				),
+				'messages'    => array(),
+				'form_errors' => array()
+			),
+			3 => array(
+				'title'       => sprintf( __( '%1$s &rsaquo; %2$s' ), __( 'bbPress installer' ), __( 'Step 3' ) ),
+				'h2'          => sprintf( __( '%1$s - %2$s' ), __( 'Step 3' ), __( 'Site settings' ) ),
+				'status'      => '',
+				'intro'       => array(
+					__( 'Finalize your installation by adding a name, your first user and your first forum.' )
+				),
+				'messages'    => array(),
+				'form_errors' => array(),
+				'scripts'     => array()
+			),
+			4 => array(
+				'title'       => sprintf( __( '%1$s &rsaquo; %2$s' ), __( 'bbPress installer' ), __( 'Finished' ) ),
+				'h2'          => __( 'Installation complete!' ),
+				'messages'    => array()
+			)
+		);
+	}
+
+	/**
+	 * Check installation pre-requisites
+	 *
+	 * Checks for appropriate PHP extensions.
+	 *
+	 * @return boolean False if any pre-requisites are not met, otherwise true
+	 */
+	function check_prerequisites()
+	{
+		// BPDB wants the MySQL extension - this is also checked when BPDB is initialised so may be a bit redundant here
+		if ( !extension_loaded( 'mysql' ) ) {
+			$this->strings[-1]['messages']['error'][] = __( 'Your PHP installation appears to be missing the MySQL extension which is required for bbPress' );
+			$this->step = -1;
+		}
+
+		if ( defined( 'BB_IS_WP_LOADED' ) && BB_IS_WP_LOADED ) {
+			$this->strings[-1]['messages']['error'][] = __( 'Please complete your installation before attempting to include WordPress within bbPress' );
+			$this->step = -1;
+		}
+
+		if ( $this->step === -1 ) {
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Define path constants
+	 *
+	 * Sets some bbPress constants if they are not otherwise available based
+	 * on the classes initiating file path.
+	 *
+	 * @return boolean False if no path was supplied, otherwise always true
+	 */
+	function define_paths()
+	{
+		if ( !$this->caller ) {
+			return false;
+		}
+
+		if ( !defined( 'BACKPRESS_PATH' ) ) {
+			// Define BACKPRESS_PATH
+			// Tell us to load includes because bb-settings.php was not loaded
+			// bb-settings.php is generally not loaded on steps -1, 0 and 1 but
+			// there are exceptions, so this is safer than just reading the step
+			$this->load_includes = true;
+			define( 'BACKPRESS_PATH', BB_PATH . BB_INC . 'backpress/' );
+		}
+
+		// Define the language file directory
+		if ( !defined( 'BB_LANG_DIR' ) ) {
+			define( 'BB_LANG_DIR', BB_PATH . 'my-languages/' );
+		}
+
+		return true;
+	}
+
+	/**
+	 * Gets an array of available languages form the language directory
+	 *
+	 * @return array
+	 */
+	function get_languages()
+	{
+		foreach ( bb_glob( BB_LANG_DIR . '*.mo' ) as $language ) {
+			$language = str_replace( '.mo', '', basename( $language ) );
+			$this->languages[$language] = $language;
+		}
+		
+		return $this->languages;
+	}
+
+	/**
+	 * Returns a language selector for switching installation languages
+	 *
+	 * @return string|false Either the html for the selector or false if there are no languages
+	 */
+	function get_language_selector()
+	{
+		// Don't provide a selection if there is only english
+		if ( 2 > count( $this->languages ) ) {
+			return false;
+		}
+
+		$r = '<script type="text/javascript" charset="utf-8">' . "\n";
+		$r .= "\t" . 'function changeLanguage(selectObj) {' . "\n";
+		$r .= "\t\t" . 'var selectedLanguage = selectObj.options[selectObj.selectedIndex].value;' . "\n";
+		$r .= "\t\t" . 'location.href = "install.php?language=" + selectedLanguage;' . "\n";
+		$r .= "\t" . '}' . "\n";
+		$r .= '</script>' . "\n";
+		//$r .= '<form id="lang" action="install.php">' . "\n";
+		$r .= "\t" . '<fieldset>' . "\n";
+		$r .= "\t\t" . '<label class="has-note has-label for-select">' . "\n";
+		$r .= "\t\t\t" . '<span>' . __( 'Installation language' ) . '</span>' . "\n";
+		$this->tabindex++;
+		$r .= "\t\t\t" . '<select class="has-note" onchange="changeLanguage(this);" name="language" tabindex="' . $this->tabindex . '">' . "\n";
+		foreach ( $this->languages as $language ) {
+			$selected = '';
+			if ( $language == $this->language ) {
+				$selected = ' selected="selected"';
+			}
+			$r .= "\t\t\t\t" . '<option value="' . $language . '"' . $selected . '>' . $language . '</option>' . "\n";
+		}
+		$r .= "\t\t\t" . '</select>' . "\n";
+		$r .= "\t\t\t" . '<a class="note-toggle" href="javascript:void(0);" onclick="toggleNote(\'note-language\');">?</a>' . "\n";
+		$r .= "\t\t\t" . '<p id="note-language" class="note" style="display:none">' . __( 'Sets the language to be used during the installation process only.' ) . '</p>' . "\n";
+		$r .= "\t\t\t" . '<div class="clear"></div>' . "\n";
+		$r .= "\t\t" . '</label>' . "\n";
+		$r .= "\t" . '</fieldset>' . "\n";
+		//$r .= '</form>' . "\n";
+
+		echo $r;
+	}
+
+	/**
+	 * Sets the current installation language
+	 *
+	 * @return string The currently set language
+	 */
+	function set_language()
+	{
+		if ( isset( $_COOKIE['bb_install_language'] ) && 1 < count( $this->languages ) ) {
+			if ( in_array( $_COOKIE['bb_install_language'], $this->languages ) ) {
+				$this->language = $_COOKIE['bb_install_language'];
+			}
+		}
+
+		$language_requested = false;
+		if ( isset( $_POST['language'] ) && $_POST['language'] ) {
+			$language_requested = (string) $_POST['language'];
+		} elseif ( isset( $_GET['language'] ) && $_GET['language'] ) {
+			$language_requested = (string) $_GET['language'];
+		}
+
+		if ( $language_requested && 1 < count( $this->languages ) ) {
+			if ( in_array( $language_requested, $this->languages ) ) {
+				$this->language = $language_requested;
+				setcookie( 'bb_install_language', $this->language );
+			}
+		}
+
+		if ( !$this->language || 'en_US' === $this->language ) {
+			$this->language = 'en_US';
+			setcookie( 'bb_install_language', ' ', time() - 31536000 );
+		}
+
+		return $this->language;
+	}
+
+	/**
+	 * Tests whether database tables exist
+	 *
+	 * Checks for the existence of the forum table in the database that is
+	 * currently configured.
+	 *
+	 * @return boolean False if the table isn't found, otherwise true
+	 */
+	function database_tables_are_installed()
+	{
+		global $bbdb;
+		$bbdb->suppress_errors();
+		$installed = (boolean) $bbdb->get_results( 'DESCRIBE `' . $bbdb->forums . '`;', ARRAY_A );
+		$bbdb->suppress_errors( false );
+		return $installed;
+	}
+
+	/**
+	 * Tests whether an option is set in the database
+	 *
+	 * @return boolean False if the option isn't set, otherwise true
+	 */
+	function bb_options_are_set()
+	{
+		if ( $this->load_includes ) {
+			return false;
+		}
+		if ( !bb_get_option( 'uri' ) ) {
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Tests whether bbPress is installed
+	 *
+	 * @return boolean False if bbPress isn't installed, otherwise true
+	 */
+	function is_installed()
+	{
+		if ( !$this->database_tables_are_installed() ) {
+			return false;
+		}
+		if ( !$this->bb_options_are_set() ) {
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Checks for configs and sets variables describing current install state
+	 *
+	 * @return integer The current step we should be on based on the existence of the config file
+	 */
+	function check_configs()
+	{
+		// Check for a config file
+		if ( file_exists( BB_PATH . 'bb-config.php' ) ) {
+			$this->configs['bb-config.php'] = BB_PATH . 'bb-config.php';
+		} elseif ( file_exists( dirname( BB_PATH ) . '/bb-config.php' ) ) {
+			$this->configs['bb-config.php'] = dirname( BB_PATH ) . '/bb-config.php';
+		}
+
+		// Check for an old config file
+		if ( file_exists( BB_PATH . 'config.php' ) ) {
+			$this->configs['config.php'] = BB_PATH . 'config.php';
+		} elseif ( file_exists( dirname( BB_PATH ) . '/config.php' ) ) {
+			$this->configs['config.php'] = dirname( BB_PATH ) . '/config.php';
+		}
+
+		if ( $this->configs['config.php'] && !$this->configs['bb-config.php'] ) {
+			// There is an old school config file
+			// Step -1 is where we send fatal errors from any screen
+			$this->strings[-1]['messages']['error'][] = __( 'An old <code>config.php</code> file has been detected in your installation. You should remove it and run the <a href="install.php">installer</a> again. You can use the same database connection details if you do.' );
+			$this->step = -1;
+			return $this->step;
+		}
+
+		// Check if bbPress is already installed
+		// Is there a current config file
+		if ( $this->configs['bb-config.php'] ) {
+
+			// Is it valid
+			if ( $this->validate_current_config() ) {
+				// Step 1 is complete
+				$this->step_status[1] = 'complete';
+				$this->strings[1]['status'] = __( '&laquo; completed' );
+
+				// On step 1 we want to report that the file is good and allow the user to continue
+				if ( $this->step === 1 ) {
+					// Stop form processing if it is posted
+					$this->stop_process = true;
+
+					// Display a nice message saying the config file exists
+					$this->strings[1]['messages']['message'][] = __( 'A valid configuration file was found at <code>bb-config.php</code><br />You may continue to the next step.' );
+					return $this->step;
+				}
+			} else {
+				// Invalid config files on any step cause us to exit to step 0
+				$this->strings[-1]['messages']['error'][] = __( 'An invalid configuration file was found at <code>bb-config.php</code><br />The installation cannot continue.' );
+				$this->strings[-1]['messages'][0][] = __( 'Usually this is caused by one of the database connection settings being incorrect. Make sure that the specified user has appropriate permission to access the database.' );
+				$this->step = -1;
+			}
+
+			// If we have made it this far, then we can check if the database tables exist and have content
+			if ( $this->is_installed() ) {
+				// The database is installed
+				// The following standard functions should be available
+				if ( bb_get_option( 'bb_db_version' ) > bb_get_option_from_db( 'bb_db_version' ) ) {
+					// The database needs upgrading
+					$this->strings[-1]['messages'][0][] = __( 'bbPress is already installed, but appears to require an upgrade.' );
+				} else {
+					$this->strings[-1]['messages'][0][] = __( 'bbPress is already installed.' );
+				}
+				$this->strings[-1]['messages'][0][] = sprintf(
+					__( 'Perhaps you meant to run the <a href="%s">upgrade script</a> instead?' ),
+					bb_get_uri( 'bb-admin/upgrade.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN )
+				);
+				$this->step = -1;
+			}
+
+		} else {
+
+			if ( 2 > $this->step && !file_exists( BB_PATH . 'bb-config-sample.php' ) ) {
+				// There is no sample config file
+				$this->strings[0]['messages']['error'][] = __( 'I could not find the file <code>bb-config-sample.php</code><br />Please upload it to the root directory of your bbPress installation.' );
+				$this->step = 0;
+			}
+
+			if ( 1 !== $this->step ) {
+				// There is no config file, go back to the beginning
+				$this->strings[0]['messages']['message'][] = __( 'There doesn\'t seem to be a <code>bb-config.php</code> file. This usually means that you want to install bbPress.' );
+				$this->step = 0;
+			}
+
+		}
+
+		// Check if the config file path is writable
+		if ( file_exists( $this->configs['bb-config.php'] ) ) {
+			if ( is_writable( $this->configs['bb-config.php'] ) ) {
+				$this->configs['writable'] = true;
+			}
+		} elseif ( is_writable( BB_PATH ) ) {
+			$this->configs['writable'] = true;
+		}
+
+		return $this->step;
+	}
+
+	/**
+	 * Determines if the current config is valid
+	 *
+	 * @return boolean False if the config is bad, otherwise true
+	 */
+	function validate_current_config()
+	{
+		// If we are validating then the config file has already been included
+		// So we can just check for valid constants
+
+		// The required constants for a valid config file
+		$required_constants = array(
+			'BBDB_NAME',
+			'BBDB_USER',
+			'BBDB_PASSWORD',
+			'BBDB_HOST'
+		);
+
+		// Check the required constants are defined
+		foreach ( $required_constants as $required_constant ) {
+			if ( !defined( $required_constant ) ) {
+				return false;
+			}
+		}
+
+		global $bb_table_prefix;
+
+		if ( !isset( $bb_table_prefix ) ) {
+			return false;
+		}
+
+		// Everthing is OK so far, validate the connection as well
+		return $this->validate_current_database();
+	}
+
+	/**
+	 * Validates the current database settings
+	 *
+	 * @return boolean False if the current database isn't valid, otherwise true
+	 */
+	function validate_current_database()
+	{
+		global $bbdb;
+		$db = $bbdb->db_connect( "SELECT * FROM $bbdb->forums LIMIT 1" );
+
+		if ( !is_resource( $db ) ) {
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Sets up default values for input data as well as labels and notes
+	 *
+	 * @return void
+	 */
+	function prepare_data()
+	{
+		/**
+		 * Should be exactly the same as the default value of the KEYS in bb-config-sample.php
+		 * @since 1.0
+		 */
+		$_bb_default_secret_key = 'put your unique phrase here';
+
+		$this->data = array(
+			0 => array(
+				'form' => array(
+					'forward_0_0' => array(
+						'value' => __( 'Go to step 1' )
+					)
+				)
+			),
+			1 => array(
+				'form' => array(
+					'bbdb_name' => array(
+						'value' => '',
+						'label' => __( 'Database name' ),
+						'note'  => __( 'The name of the database in which you want to run bbPress.' )
+					),
+					'bbdb_user' => array(
+						'value' => '',
+						'label' => __( 'Database user' ),
+						'note'  => __( 'The database user that has access to that database.' ),
+						'autocomplete' => 'off'
+					),
+					'bbdb_password' => array(
+						'type'  => 'password',
+						'value' => '',
+						'label' => __( 'Database password' ),
+						'note'  => __( 'That database user\'s password.' ),
+						'autocomplete' => 'off'
+					),
+					'bb_lang' => array(
+						'value' => '',
+						'label' => __( 'Language' ),
+						'note' => sprintf( __( 'The language which bbPress will be presented in once installed. Your current installer language choice (%s) will be the same for the rest of the install process.' ), $this->language )
+					),
+					'toggle_1' => array(
+						'value'   => 0,
+						'label'   => __( 'Show advanced settings' ),
+						'note'    => __( 'These settings usually do not have to be changed.' ),
+						'checked' => '',
+						'display' => 'none'
+					),
+					'bbdb_host'        => array(
+						'value'        => 'localhost',
+						'label'        => __( 'Database host' ),
+						'note'         => __( 'The domain name or IP address of the server where the database is located. If the database is on the same server as the web site, then this probably should remain <strong>localhost</strong>.' ),
+						'prerequisite' => 'toggle_1'
+					),
+					'bbdb_charset' => array(
+						'value'        => 'utf8',
+						'label'        => __( 'Database character set' ),
+						'note'         => __( 'The best choice is <strong>utf8</strong>, but you will need to match the character set which you created the database with.' ),
+						'prerequisite' => 'toggle_1'
+					),
+					'bbdb_collate' => array(
+						'value'        => '',
+						'label'        => __( 'Database character collation' ),
+						'note'         => __( 'The character collation value set when the database was created.' ),
+						'prerequisite' => 'toggle_1'
+					),
+					/*
+					'bb_auth_key' => array(
+						'value'        => $_bb_default_secret_key,
+						'label'        => __( 'bbPress "auth" cookie key' ),
+						'note'         => __( 'This should be a unique and secret phrase, it will be used to make your bbPress "auth" cookie unique and harder for an attacker to decipher.' ),
+						'prerequisite' => 'toggle_1'
+					),
+					'bb_secure_auth_key' => array(
+						'value'        => $_bb_default_secret_key,
+						'label'        => __( 'bbPress "secure auth" cookie key' ),
+						'note'         => __( 'This should be a unique and secret phrase, it will be used to make your bbPress "secure auth" cookie unique and harder for an attacker to decipher.' ),
+						'prerequisite' => 'toggle_1'
+					),
+					'bb_logged_in_key' => array(
+						'value'        => $_bb_default_secret_key,
+						'label'        => __( 'bbPress "logged in" cookie key' ),
+						'note'         => __( 'This should be a unique and secret phrase, it will be used to make your bbPress "logged in" cookie unique and harder for an attacker to decipher.' ),
+						'prerequisite' => 'toggle_1'
+					),
+					'bb_nonce_key' => array(
+						'value'        => $_bb_default_secret_key,
+						'label'        => __( 'bbPress "nonce" key' ),
+						'note'         => __( 'This should be a unique and secret phrase, it will be used to make form submission harder for an attacker to spoof.' ),
+						'prerequisite' => 'toggle_1'
+					),
+					*/
+					'bb_table_prefix' => array(
+						'value'        => 'bb_',
+						'label'        => __( 'Table name prefix' ),
+						'note'         => __( 'If you are running multiple bbPress sites in a single database, you will probably want to change this.' ),
+						'prerequisite' => 'toggle_1'
+					),
+					'config' => array(
+						'value' => '',
+						'label' => __( 'Contents for <code>bb-config.php</code>' ),
+						'note'  => __( 'Once you have created the configuration file, you can check for it below.' )
+					),
+					'forward_1_0' => array(
+						'value' => __( 'Save database configuration file' )
+					),
+					'back_1_1' => array(
+						'value' => __( '&laquo; Go back' )
+					),
+					'forward_1_1' => array(
+						'value' => __( 'Check for configuration file' )
+					),
+					'forward_1_2' => array(
+						'value' => __( 'Go to step 2' )
+					)
+				)
+			),
+
+			2 => array(
+				'form' => array(
+					'toggle_2_0' => array(
+						'value'        => 0,
+						'label'        => __( 'Add integration settings' ),
+						'note'         => __( 'If you want to integrate bbPress with an existing WordPress site.' ),
+						'checked'      => '',
+						'display'      => 'none',
+						'toggle_value' => array(
+							'target'    => 'forward_2_0',
+							'off_value' => __( 'Skip WordPress integration' ),
+							'on_value'  => __( 'Save WordPress integration settings' )
+						)
+					),
+					'toggle_2_1' => array(
+						'value'   => 0,
+						'label'   => __( 'Add cookie integration settings' ),
+						'note'    => __( 'If you want to allow shared logins with an existing WordPress site.' ),
+						'checked' => '',
+						'display' => 'none',
+						'prerequisite' => 'toggle_2_0'
+					),
+					'wp_siteurl' => array(
+						'value' => '',
+						'label' => __( 'WordPress address (URL)' ),
+						'note'  => __( 'This value should exactly match the <strong>WordPress address (URL)</strong> setting in your WordPress general settings.' ),
+						'prerequisite' => 'toggle_2_1'
+					),
+					'wp_home' => array(
+						'value' => '',
+						'label' => __( 'Blog address (URL)' ),
+						'note'  => __( 'This value should exactly match the <strong>Blog address (URL)</strong> setting in your WordPress general settings.' ),
+						'prerequisite' => 'toggle_2_1'
+					),
+					'wp_auth_key' => array(
+						'value' => '',
+						'label' => __( 'WordPress "auth" cookie key' ),
+						'note'  => __( 'This value must match the value of the constant named "AUTH_KEY" in your WordPress <code>wp-config.php</code> file. This will replace the bbPress "auth" cookie key set in the first step.' ),
+						'prerequisite' => 'toggle_2_1',
+						'autocomplete' => 'off'
+					),
+					'wp_auth_salt' => array(
+						'value' => '',
+						'label' => __( 'WordPress "auth" cookie salt' ),
+						'note'  => __( 'This must match the value of the WordPress setting named "auth_salt" in your WordPress site. Look for the option labeled "auth_salt" in <a href="#" id="getAuthSaltOption" onclick="window.open(this.href); return false;">this WordPress admin page</a>. If you leave this blank the installer will try to fetch the value based on your WordPress database integration settings.' ),
+						'prerequisite' => 'toggle_2_1',
+						'autocomplete' => 'off'
+					),
+					'wp_secure_auth_key' => array(
+						'value' => '',
+						'label' => __( 'WordPress "secure auth" cookie key' ),
+						'note'  => __( 'This value must match the value of the constant named "SECURE_AUTH_KEY" in your WordPress <code>wp-config.php</code> file. This will replace the bbPress "secure auth" cookie key set in the first step.' ),
+						'prerequisite' => 'toggle_2_1',
+						'autocomplete' => 'off'
+					),
+					'wp_secure_auth_salt' => array(
+						'value' => '',
+						'label' => __( 'WordPress "secure auth" cookie salt' ),
+						'note'  => __( 'This must match the value of the WordPress setting named "secure_auth_salt" in your WordPress site. Look for the option labeled "secure_auth_salt" in <a href="#" id="getSecureAuthSaltOption" onclick="window.open(this.href); return false;">this WordPress admin page</a>. If you leave this blank the installer will try to fetch the value based on your WordPress database integration settings. Sometimes this value is not set in WordPress, in that case you can leave this setting blank as well.' ),
+						'prerequisite' => 'toggle_2_1',
+						'autocomplete' => 'off'
+					),
+					'wp_logged_in_key' => array(
+						'value' => '',
+						'label' => __( 'WordPress "logged in" cookie key' ),
+						'note'  => __( 'This value must match the value of the constant named "LOGGED_IN_KEY" in your WordPress <code>wp-config.php</code> file. This will replace the bbPress "logged in" cookie key set in the first step.' ),
+						'prerequisite' => 'toggle_2_1',
+						'autocomplete' => 'off'
+					),
+					'wp_logged_in_salt' => array(
+						'value' => '',
+						'label' => __( 'WordPress "logged in" cookie salt' ),
+						'note'  => __( 'This must match the value of the WordPress setting named "logged_in_salt" in your WordPress site. Look for the option labeled "logged_in_salt" in <a href="#" id="getLoggedInSaltOption" onclick="window.open(this.href); return false;">this WordPress admin page</a>. If you leave this blank the installer will try to fetch the value based on your WordPress database integration settings.' ),
+						'prerequisite' => 'toggle_2_1',
+						'autocomplete' => 'off'
+					),
+					'toggle_2_2' => array(
+						'value'   => 0,
+						'label'   => __( 'Add user database integration settings' ),
+						'note'    => __( 'If you want to share user data with an existing WordPress site.' ),
+						'checked' => '',
+						'display' => 'none',
+						'prerequisite' => 'toggle_2_0'
+					),
+					'wp_table_prefix' => array(
+						'value' => 'wp_',
+						'default_value' => '', // Used when setting is ignored
+						'label' => __( 'User database table prefix' ),
+						'note'  => __( 'If your bbPress and WordPress sites share the same database, then this is the same value as <code>$table_prefix</code> in your WordPress <code>wp-config.php</code> file. It is usually <strong>wp_</strong>.' ),
+						'prerequisite' => 'toggle_2_2'
+					),
+					'wordpress_mu_primary_blog_id' => array(
+						'value' => '',
+						'default_value' => '',
+						'label' => __( 'WordPress MU primary blog ID' ),
+						'note'  => __( 'If you are integrating with a WordPress MU site you need to specify the primary blog ID for that site. It is usually <strong>1</strong>. You should probably leave this blank if you are integrating with a standard WordPress site' ),
+						'prerequisite' => 'toggle_2_2'
+					),
+					'toggle_2_3' => array(
+						'value'   => 0,
+						'label'   => __( 'Show advanced database settings' ),
+						'note'    => __( 'If your bbPress and WordPress site do not share the same database, then you will need to add advanced settings.' ),
+						'checked' => '',
+						'display' => 'none',
+						'prerequisite' => 'toggle_2_2'
+					),
+					'user_bbdb_name' => array(
+						'value' => '',
+						'label' => __( 'User database name' ),
+						'note'  => __( 'The name of the database in which your user tables reside.' ),
+						'prerequisite' => 'toggle_2_3'
+					),
+					'user_bbdb_user' => array(
+						'value' => '',
+						'label' => __( 'User database user' ),
+						'note'  => __( 'The database user that has access to that database.' ),
+						'prerequisite' => 'toggle_2_3',
+						'autocomplete' => 'off'
+					),
+					'user_bbdb_password' => array(
+						'type'  => 'password',
+						'value' => '',
+						'label' => __( 'User database password' ),
+						'note'  => __( 'That database user\'s password.' ),
+						'prerequisite' => 'toggle_2_3',
+						'autocomplete' => 'off'
+					),
+					'user_bbdb_host' => array(
+						'value' => '',
+						'label' => __( 'User database host' ),
+						'note'  => __( 'The domain name or IP address of the server where the database is located. If the database is on the same server as the web site, then this probably should be <strong>localhost</strong>.' ),
+						'prerequisite' => 'toggle_2_3'
+					),
+					'user_bbdb_charset' => array(
+						'value' => '',
+						'label' => __( 'User database character set' ),
+						'note'  => __( 'The best choice is <strong>utf8</strong>, but you will need to match the character set which you created the database with.' ),
+						'prerequisite' => 'toggle_2_3'
+					),
+					'user_bbdb_collate' => array(
+						'value' => '',
+						'label' => __( 'User database character collation' ),
+						'note'  => __( 'The character collation value set when the user database was created.' ),
+						'prerequisite' => 'toggle_2_3'
+					),
+					'custom_user_table' => array(
+						'value' => '',
+						'label' => __( 'User database "user" table' ),
+						'note'  => __( 'The complete table name, including any prefix.' ),
+						'prerequisite' => 'toggle_2_3'
+					),
+					'custom_user_meta_table' => array(
+						'value' => '',
+						'label' => __( 'User database "user meta" table' ),
+						'note'  => __( 'The complete table name, including any prefix.' ),
+						'prerequisite' => 'toggle_2_3'
+					),
+					'forward_2_0' => array(
+						'value' => __( 'Skip WordPress integration' )
+					),
+					'back_2_1' => array(
+						'value' => __( '&laquo; Go back' )
+					),
+					'forward_2_1' => array(
+						'value' => __( 'Go to step 3' )
+					)
+				)
+			),
+
+			3 => array(
+				'form' => array(
+					'name' => array(
+						'value' => '',
+						'label' => __( 'Site name' ),
+						'note'  => __( 'This is what you are going to call your bbPress site.' )
+					),
+					'uri' => array(
+						'value' => $this->guess_uri(),
+						'label' => __( 'Site address (URL)' ),
+						'note'  => __( 'We have attempted to guess this, it\'s usually correct, but change it here if you wish.' )
+					),
+					'keymaster_user_login' => array(
+						'value'     => '',
+						'maxlength' => 60,
+						'label'     => __( '"Key Master" Username' ),
+						'note'      => __( 'This is the user login for the initial bbPress administrator (known as a "Key Master").' ),
+						'autocomplete' => 'off'
+					),
+					'keymaster_user_email' => array(
+						'value'     => '',
+						'maxlength' => 100,
+						'label'     => __( '"Key Master" Email address' ),
+						'note'      => __( 'The login details will be emailed to this address.' ),
+						'autocomplete' => 'off'
+					),
+					'keymaster_user_type' => array(
+						'value' => 'new'
+					),
+					'forum_name' => array(
+						'value'     => '',
+						'maxlength' => 150,
+						'label'     => __( 'First forum name' ),
+						'note'      => __( 'This can be changed after installation, so don\'t worry about it too much.' )
+					),
+					'forward_3_0' => array(
+						'value' => __( 'Save site settings' )
+					),
+					'back_3_1' => array(
+						'value' => __( '&laquo; Go back' )
+					),
+					'forward_3_1' => array(
+						'value' => __( 'Complete the installation' )
+					)
+				)
+			),
+
+			4 => array(
+				'form' => array(
+					'toggle_4' => array(
+						'value' => 0,
+						'label' => __( 'Show installation messages' )
+					),
+					'error_log' => array(
+						'value' => '',
+						'label' => __( 'Installation errors' )
+					),
+					'installation_log' => array(
+						'value' => '',
+						'label' => __( 'Installation log' )
+					)
+				)
+			)
+		);
+	}
+
+	/**
+	 * Guesses the final installed URI based on the location of the install script
+	 *
+	 * @return string The guessed URI
+	 */
+	function guess_uri()
+	{
+		global $bb;
+
+		if ( $bb->uri ) {
+			$uri = $bb->uri;
+		} else {
+			$schema = 'http://';
+			if ( isset( $_SERVER['HTTPS'] ) && strtolower( $_SERVER['HTTPS'] ) == 'on' ) {
+				$schema = 'https://';
+			}
+			$uri = preg_replace( '|/bb-admin/.*|i', '/', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
+		}
+
+		return rtrim( $uri, " \t\n\r\0\x0B/" ) . '/';
+	}
+
+	/**
+	 * Writes the given alterations to file
+	 *
+	 * @param $file_source string The full path to the file to be read from
+	 * @param $file_target string The full path to the file to be written to
+	 * @param $alterations array An array of arrays containing alterations to be made
+	 * @return void
+	 */
+	function write_lines_to_file( $file_source, $file_target, $alterations )
+	{
+		if ( !$file_source || !file_exists( $file_source ) || !is_file( $file_source ) ) {
+			return -1;
+		}
+
+		if ( !$file_target ) {
+			$file_target = $file_source;
+		}
+
+		if ( !$alterations || !is_array( $alterations ) ) {
+			return -2;
+		}
+
+		/*
+		Alterations array takes the form
+		array(
+			'1st 20 chars of line' => array( 'Search string', 'Replacement string' ),
+			'1st 20 chars of line' => array( 'Search string', 'Replacement string' )
+		);
+		*/
+
+		// Get the existing lines in the file
+		$lines = file( $file_source );
+
+		// Initialise an array to store the modified lines
+		$modified_lines = array();
+
+		// Loop through the lines and modify them
+		foreach ( $lines as $line ) {
+			if ( isset( $alterations[substr( $line, 0, 20 )] ) ) {
+				$alteration = $alterations[substr( $line, 0, 20 )];
+				$modified_lines[] = str_replace( $alteration[0], $alteration[1], $line );
+			} else {
+				$modified_lines[] = $line;
+			}
+		}
+
+		$writable = true;
+		if ( file_exists( $file_target ) ) {
+			if ( !is_writable( $file_target ) ) {
+				$writable = false;
+			}
+		} else {
+			$dir_target = dirname( $file_target );
+			if ( file_exists( $dir_target ) ) {
+				if ( !is_writable( $dir_target ) || !is_dir( $dir_target ) ) {
+					$writable = false;
+				}
+			} else {
+				$writable = false;
+			}
+		}
+
+		if ( !$writable ) {
+			return trim( join( null, $modified_lines ) );
+		}
+
+		// Open the file for writing - rewrites the whole file
+		$file_handle = fopen( $file_target, 'w' );
+
+		// Write lines one by one to avoid OS specific newline hassles
+		foreach ( $modified_lines as $modified_line ) {
+			if ( false !== strpos( $modified_line, '?>' ) ) {
+				$modified_line = '?>';
+			}
+			fwrite( $file_handle, $modified_line );
+			if ( $modified_line == '?>' ) {
+				break;
+			}
+		}
+
+		// Close the config file
+		fclose( $file_handle );
+
+		@chmod( $file_target, 0666 );
+
+		return 1;
+	}
+
+	/**
+	 * Reports whether the request method is post or not
+	 *
+	 * @return boolean True if the page was posted, otherwise false
+	 */
+	function is_posted()
+	{
+		if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) ) {
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Determines which step the installer is on based on user input
+	 *
+	 * @return boolean Always returns true
+	 **/
+	function set_step()
+	{
+		if ( $this->is_posted() ) {
+			switch ( $this->step ) {
+				case 1:
+					$this->set_language();
+					if ( $_POST['forward_0_0'] ) {
+						$this->stop_process = 1;
+					}
+					break;
+
+				case 2:
+					if ( $_POST['forward_1_2'] ) {
+						$this->stop_process = 1;
+					}
+					break;
+
+				case 3:
+					// If this is actually a request to go back to step 2
+					if ( $_POST['back_2_1'] ) {
+						$this->step = 2;
+						break;
+					}
+
+					// If we have come forward from step 2 then don't process form 3
+					if ( $_POST['forward_2_1'] ) {
+						$this->stop_process = true;
+					}
+
+					// Determine what the status of the previous step was based on input
+					if ( $_POST['toggle_2_0'] ) {
+						$this->strings[2]['status'] = __( '&laquo; completed' );
+						$this->step_status[2] = 'complete';
+					}
+					break;
+
+				case 4:
+					// Determine what the status of the previous step was based on input
+					if ( $_POST['toggle_2_0'] ) {
+						$this->strings[2]['status'] = __( '&laquo; completed' );
+						$this->step_status[2] = 'complete';
+					}
+
+					// If this is actually a request to go back to step 3
+					if ( $_POST['back_3_1'] ) {
+						$this->step = 3;
+						break;
+					}
+
+					// We have to have come forward from step 3
+					if ( $_POST['forward_3_1'] ) {
+						$this->strings[3]['status'] = __( '&laquo; completed' );
+						$this->step_status[3] = 'complete';
+					} else {
+						$this->step = 2;
+					}
+					break;
+			}
+		}
+		return true;
+	}
+
+	/**
+	 * Sanitizes all data stored in the data array
+	 *
+	 * @return boolean Always returns true
+	 **/
+	function sanitize_form_data()
+	{
+		foreach ( $this->data as $step => $data ) {
+			if ( isset( $data['form'] ) && is_array( $data['form'] ) ) {
+				foreach ( $data['form'] as $key => $value ) {
+					$this->data[$step]['form'][$key]['value'] = esc_attr( $value['value'] );
+				}
+			}
+		}
+		return true;
+	}
+
+	/**
+	 * Directs processing of the form data based on the current step
+	 *
+	 * @return boolean Always returns true
+	 **/
+	function process_form()
+	{
+		if ( $this->is_posted() && !$this->stop_process ) {
+			switch ( $this->step ) {
+				case 1:
+					$this->process_form_config_file();
+					break;
+
+				case 2:
+					$this->process_form_wordpress_integration();
+					break;
+
+				case 3:
+					$this->process_form_site_options();
+					break;
+
+				case 4:
+					$this->process_form_finalise_installation();
+					break;
+			}
+		}
+		return true;
+	}
+
+	/**
+	 * Takes inputted form data and injects it into the data array
+	 *
+	 * @param integer $step Which steps data to process
+	 * @return boolean Always returns true
+	 **/
+	function inject_form_values_into_data( $step )
+	{
+		$data =& $this->data[$step]['form'];
+
+		foreach ( $data as $key => $value ) {
+			if ( 'forward_' !== substr( $key, 0, 8 ) && 'back_' !== substr( $key, 0, 5 ) ) {
+				if ( isset( $data[$key]['prerequisite'] ) && !$_POST[$data[$key]['prerequisite']] ) {
+					if ( isset( $data[$key]['default_value'] ) ) {
+						$data[$key]['value'] = $data[$key]['default_value'];
+					}
+					// do nothing - keep the default value
+				} else {
+					$data[$key]['value'] = stripslashes_deep( trim( $_POST[$key] ) );
+				}
+			}
+		}
+
+		return true;
+	}
+
+	/**
+	 * Validates the supplied config file data and writes it to the config file.
+	 *
+	 * @return void
+	 **/
+	function process_form_config_file()
+	{
+		$this->inject_form_values_into_data( 1 );
+
+		$data =& $this->data[1]['form'];
+		
+		if ( 'en_US' == $data['bb_lang']['value'] ) {
+			$data['bb_lang']['value'] = '';
+		}
+
+		if ( $data['toggle_1']['value'] ) {
+			$data['toggle_1']['checked'] = 'checked="checked"';
+			$data['toggle_1']['display'] = 'block';
+
+			// Deal with slashes in the keys
+			//$data['bb_auth_key']['value']        = addslashes( stripslashes( $data['bb_auth_key']['value'] ) );
+			//$data['bb_secure_auth_key']['value'] = addslashes( stripslashes( $data['bb_secure_auth_key']['value'] ) );
+			//$data['bb_logged_in_key']['value']   = addslashes( stripslashes( $data['bb_logged_in_key']['value'] ) );
+			//$data['bb_nonce_key']['value']       = addslashes( stripslashes( $data['bb_nonce_key']['value'] ) );
+		}
+
+		$requested_prefix = $data['bb_table_prefix']['value'];
+		$data['bb_table_prefix']['value'] = preg_replace( '/[^0-9a-zA-Z_]/', '', $data['bb_table_prefix']['value'] );
+		if ( $requested_prefix !== $data['bb_table_prefix']['value'] ) {
+			$data['toggle_1']['checked'] = 'checked="checked"';
+			$data['toggle_1']['display'] = 'block';
+			$this->step_status[1] = 'incomplete';
+			$this->strings[1]['messages']['error'][] = __( 'The table prefix can only contain letters, numbers and underscores.<br />Please review the suggestion below.' );
+			$this->strings[1]['form_errors']['bb_table_prefix'][] = __( '&bull; Based on your input the following prefix is suggested.' );
+			return 'incomplete';
+		}
+		if ( empty( $data['bb_table_prefix']['value'] ) ) {
+			$data['bb_table_prefix']['value'] = 'bb_';
+			$data['toggle_1']['checked'] = 'checked="checked"';
+			$data['toggle_1']['display'] = 'block';
+			$this->step_status[1] = 'incomplete';
+			$this->strings[1]['messages']['error'][] = __( 'The table prefix can not be blank.<br />Please review the suggestion below.' );
+			$this->strings[1]['form_errors']['bb_table_prefix'][] = __( '&bull; The default prefix has been inserted.' );
+			return 'incomplete';
+		}
+
+		// Stop here if we are going backwards
+		if ( $_POST['back_1_1'] ) {
+			$this->step_status[1] = 'incomplete';
+			return 'incomplete';
+		}
+
+		// Test the db connection.
+		define( 'BBDB_NAME',     $data['bbdb_name']['value'] );
+		define( 'BBDB_USER',     $data['bbdb_user']['value'] );
+		define( 'BBDB_PASSWORD', $data['bbdb_password']['value'] );
+		define( 'BBDB_HOST',     $data['bbdb_host']['value'] );
+		define( 'BBDB_CHARSET',  $data['bbdb_charset']['value'] );
+		define( 'BBDB_COLLATE',  $data['bbdb_collate']['value'] );
+
+		// We'll fail here if the values are no good.
+		require_once( BACKPRESS_PATH . 'class.bpdb-multi.php' );
+
+		$bbdb =& new BPDB_Multi( array(
+			'name'     => BBDB_NAME,
+			'user'     => BBDB_USER,
+			'password' => BBDB_PASSWORD,
+			'host'     => BBDB_HOST,
+			'charset'  => defined( 'BBDB_CHARSET' ) ? BBDB_CHARSET : false,
+			'collate'  => defined( 'BBDB_COLLATE' ) ? BBDB_COLLATE : false,
+			'errors'   => 'suppress'
+		) );
+
+		if ( !$bbdb->db_connect( 'SHOW TABLES;' ) ) {
+			$bbdb->suppress_errors( false );
+			$this->step_status[1] = 'incomplete';
+			$this->strings[1]['messages']['error'][] = __( 'There was a problem connecting to the database you specified.<br />Please check the settings, then try again.' );
+			return 'error';
+		}
+		$bbdb->suppress_errors( false );
+
+		$config_result = $this->write_lines_to_file(
+			BB_PATH . 'bb-config-sample.php',
+			BB_PATH . 'bb-config.php',
+			array(
+				"define( 'BBDB_NAME',"  => array( "'bbpress'",                     "'" . $data['bbdb_name']['value'] . "'" ),
+				"define( 'BBDB_USER',"  => array( "'username'",                    "'" . $data['bbdb_user']['value'] . "'" ),
+				"define( 'BBDB_PASSWO"  => array( "'password'",                    "'" . $data['bbdb_password']['value'] . "'" ),
+				"define( 'BBDB_HOST',"  => array( "'localhost'",                   "'" . $data['bbdb_host']['value'] . "'" ),
+				"define( 'BBDB_CHARSE"  => array( "'utf8'",                        "'" . $data['bbdb_charset']['value'] . "'" ),
+				"define( 'BBDB_COLLAT"  => array( "''",                            "'" . $data['bbdb_collate']['value'] . "'" ),
+				//"define( 'BB_AUTH_KEY"  => array( "'put your unique phrase here'", "'" . $data['bb_auth_key']['value'] . "'" ),
+				//"define( 'BB_SECURE_A"  => array( "'put your unique phrase here'", "'" . $data['bb_secure_auth_key']['value'] . "'" ),
+				//"define( 'BB_LOGGED_I"  => array( "'put your unique phrase here'", "'" . $data['bb_logged_in_key']['value'] . "'" ),
+				//"define( 'BB_NONCE_KE"  => array( "'put your unique phrase here'", "'" . $data['bb_nonce_key']['value'] . "'" ),
+				"\$bb_table_prefix = '" => array( "'bb_'",                         "'" . $data['bb_table_prefix']['value'] . "'" ),
+				"define( 'BB_LANG', '"  => array( "''",                            "'" . $data['bb_lang']['value'] . "'" )
+			)
+		);
+
+		switch ( $config_result ) {
+			case -1:
+				$this->step_status[1] = 'error';
+				$this->strings[1]['messages']['error'][] = __( 'I could not find the file <code>bb-config-sample.php</code><br />Please upload it to the root directory of your bbPress installation.' );
+				return 'error';
+				break;
+			case 1:
+				$this->configs['bb-config.php'] = BB_PATH . 'bb-config.php';
+				$this->step_status[1] = 'complete';
+				$this->strings[1]['messages']['message'][] = __( 'Your settings have been saved to the file <code>bb-config.php</code><br />You can now continue to the next step.' );
+				break;
+			default:
+				// Just write the contents to screen
+				$this->data[1]['form']['config']['value'] = $config_result;
+
+				$this->step_status[1] = 'manual';
+				$this->strings[1]['messages']['error'][] = __( 'Your settings could not be saved to a configuration file. You will need to save the text shown below into a file named <code>bb-config.php</code> in the root directory of your bbPress installation before you can continue.' );
+				break;
+		}
+	}
+
+	/**
+	 * Validates the WordPress integration settings
+	 *
+	 * @return void
+	 **/
+	function process_form_wordpress_integration()
+	{
+		// Check the referer
+		bb_check_admin_referer( 'bbpress-installer' );
+
+		$this->inject_form_values_into_data( 2 );
+
+		$data =& $this->data[2]['form'];
+
+		// If there are no settings then goto step 3
+		if ( !$data['toggle_2_0']['value'] && !$_POST['back_2_1'] ) {
+			$this->step_status[2] = 'complete';
+			$this->strings[2]['messages']['message'][] = __( 'You have chosen to skip the WordPress integration step. You can always integrate WordPress later from within the admin area of bbPress.' );
+			return 'complete';
+		}
+
+		// If integration is selected
+		if ( $data['toggle_2_0']['value'] ) {
+			$data['toggle_2_0']['checked'] = 'checked="checked"';
+			$data['toggle_2_0']['display'] = 'block';
+			$data['forward_2_0']['value'] = $data['toggle_2_0']['toggle_value']['on_value'];
+
+			if ( $data['toggle_2_1']['value'] ) {
+				$data['toggle_2_1']['checked'] = 'checked="checked"';
+				$data['toggle_2_1']['display'] = 'block';
+
+				// Check the wp_siteurl URL for errors
+				$data['wp_siteurl']['value'] = $data['wp_siteurl']['value'] ? rtrim( $data['wp_siteurl']['value'], " \t\n\r\0\x0B/" ) . '/' : '';
+				$this->strings[2]['form_errors']['wp_siteurl'][] = empty( $data['wp_siteurl']['value'] ) ? 'empty' : false;
+				if ( $parsed = parse_url( $data['wp_siteurl']['value'] ) ) {
+					$this->strings[2]['form_errors']['wp_siteurl'][] = preg_match( '/https?/i', $parsed['scheme'] ) ? false : 'urlscheme';
+					$this->strings[2]['form_errors']['wp_siteurl'][] = empty( $parsed['host'] ) ? 'urlhost' : false;
+				} else {
+					$this->strings[2]['form_errors']['wp_siteurl'][] = 'urlparse';
+				}
+
+				// Check the wp_home URL for errors
+				$data['wp_home']['value'] = $data['wp_home']['value'] ? rtrim( $data['wp_home']['value'], " \t\n\r\0\x0B/" ) . '/' : '';
+				$this->strings[2]['form_errors']['wp_home'][] = empty( $data['wp_home']['value'] ) ? 'empty' : false;
+				if ( $parsed = parse_url( $data['wp_home']['value'] ) ) {
+					$this->strings[2]['form_errors']['wp_home'][] = preg_match( '/https?/i', $parsed['scheme'] ) ? false : 'urlscheme';
+					$this->strings[2]['form_errors']['wp_home'][] = empty( $parsed['host'] ) ? 'urlhost' : false;
+				} else {
+					$this->strings[2]['form_errors']['wp_home'][] = 'urlparse';
+				}
+
+				// Deal with slashes in the keys
+				$data['wp_auth_key']['value']         = addslashes( stripslashes( $data['wp_auth_key']['value'] ) );
+				$data['wp_auth_salt']['value']        = addslashes( stripslashes( $data['wp_auth_salt']['value'] ) );
+				$data['wp_secure_auth_key']['value']  = addslashes( stripslashes( $data['wp_secure_auth_key']['value'] ) );
+				$data['wp_secure_auth_salt']['value'] = addslashes( stripslashes( $data['wp_secure_auth_salt']['value'] ) );
+				$data['wp_logged_in_key']['value']    = addslashes( stripslashes( $data['wp_logged_in_key']['value'] ) );
+				$data['wp_logged_in_salt']['value']   = addslashes( stripslashes( $data['wp_logged_in_salt']['value'] ) );
+
+				// Check the keys for errors
+				$this->strings[2]['form_errors']['wp_auth_key'][]         = empty( $data['wp_auth_key']['value'] ) ? 'empty' : false;
+				$this->strings[2]['form_errors']['wp_secure_auth_key'][]  = empty( $data['wp_secure_auth_key']['value'] ) ? 'empty' : false;
+				$this->strings[2]['form_errors']['wp_logged_in_key'][]    = empty( $data['wp_logged_in_key']['value'] ) ? 'empty' : false;
+
+				// Salts can be taken from the database if specified
+				if ( !$data['toggle_2_2']['value'] ) {
+					$this->strings[2]['form_errors']['wp_auth_salt'][]        = empty( $data['wp_auth_salt']['value'] ) ? 'empty' : false;
+					// NB; secure_auth_salt is not always set in WordPress
+					$this->strings[2]['form_errors']['wp_logged_in_salt'][]   = empty( $data['wp_logged_in_salt']['value'] ) ? 'empty' : false;
+				}
+			}
+
+			// If database integration is selected
+			if ( $data['toggle_2_2']['value'] ) {
+				$data['toggle_2_2']['checked'] = 'checked="checked"';
+				$data['toggle_2_2']['display'] = 'block';
+
+				// Make the wp_table_prefix valid
+				$data['wp_table_prefix']['value'] = preg_replace( '/[^0-9a-zA-Z_]/', '', $data['wp_table_prefix']['value'] );
+				$data['wp_table_prefix']['value'] = empty( $data['wp_table_prefix']['value'] ) ? 'wp_' : $data['wp_table_prefix']['value'];
+
+				// Make the wordpress_mu_primary_blog_id valid
+				$data['wordpress_mu_primary_blog_id']['value'] = preg_replace( '/[^0-9]/', '', $data['wordpress_mu_primary_blog_id']['value'] );
+
+				// If advanced database integration is selected
+				if ( $data['toggle_2_3']['value'] ) {
+					$data['toggle_2_3']['checked'] = 'checked="checked"';
+					$data['toggle_2_3']['display'] = 'block';
+				}
+			}
+
+			if ( !$data['toggle_2_1']['value'] && !$data['toggle_2_2']['value'] ) {
+				$this->step_status[2] = 'incomplete';
+				$this->strings[2]['messages']['error'][] = __( 'You must enter your settings for integration setup to complete. Choose which integration settings you wish to enter from the options below.' );
+				$this->strings[2]['form_errors']['toggle_2_1'][] = true;
+				$this->strings[2]['form_errors']['toggle_2_2'][] = true;
+				return 'incomplete';
+			}
+
+			// Remove empty values from the error array
+			foreach ( $this->strings[2]['form_errors'] as $input => $types) {
+				$types = array_filter( $types);
+				if ( !count( $types ) ) {
+					unset( $this->strings[2]['form_errors'][$input] );
+				}
+			}
+
+			// Check for errors and build error messages
+			if ( count( $this->strings[2]['form_errors'] ) ) {
+
+				$this->step_status[2] = 'incomplete';
+				$this->strings[2]['messages']['error'][] = __( 'Your integration settings have not been processed due to errors with the items marked below.' );
+
+				foreach ( $this->strings[2]['form_errors'] as $input => $types ) {
+					$errors = array();
+
+					foreach ( $types as $type ) {
+						switch ( $type ) {
+							case 'empty':
+								// Only return this error when empty
+								$errors = array( __( '&bull; This value is required to continue.' ) );
+								break(2);
+							case 'urlparse':
+								$errors[] = __( '&bull; This does not appear to be a valid URL.' );
+								break;
+							case 'urlscheme':
+								$errors[] = __( '&bull; The URL must begin with "http" or "https".' );
+								break;
+							case 'urlhost':
+								$errors[] = __( '&bull; The URL does not contain a host name.' );
+								break;
+						}
+					}
+
+					$this->strings[2]['form_errors'][$input] = $errors;
+				}
+
+				return 'incomplete';
+			}
+
+			// If database integration is selected
+			if ( $data['toggle_2_2']['value'] ) {
+
+				// Test the db connection.
+
+				// Setup variables and constants if available
+				global $bb;
+				$bb->wp_table_prefix = $data['wp_table_prefix']['value'];
+				if ( $data['toggle_2_3']['value'] ) {
+					// These may be empty at this particular stage
+					if ( !empty( $data['user_bbdb_name']['value'] ) ) {
+						$bb->user_bbdb_name = $data['user_bbdb_name']['value'];
+					}
+					if ( !empty( $data['user_bbdb_user']['value'] ) ) {
+						$bb->user_bbdb_user = $data['user_bbdb_user']['value'];
+					}
+					if ( !empty( $data['user_bbdb_password']['value'] ) ) {
+						$bb->user_bbdb_password = $data['user_bbdb_password']['value'];
+					}
+					if ( !empty( $data['user_bbdb_host']['value'] ) ) {
+						$bb->user_bbdb_host = $data['user_bbdb_host']['value'];
+					}
+					if ( !empty( $data['user_bbdb_charset']['value'] ) ) {
+						$bb->user_bbdb_charset = preg_replace( '/[^a-z0-9_-]/i', '', $data['user_bbdb_charset']['value'] );
+					}
+					if ( !empty( $data['user_bbdb_collate']['value'] ) ) {
+						$bb->user_bbdb_collate = preg_replace( '/[^a-z0-9_-]/i', '', $data['user_bbdb_collate']['value'] );
+					}
+					if ( !empty( $data['custom_user_table']['value'] ) ) {
+						$bb->custom_user_table = preg_replace( '/[^a-z0-9_-]/i', '', $data['custom_user_table']['value'] );
+					}
+					if ( !empty( $data['custom_user_meta_table']['value'] ) ) {
+						$bb->custom_user_meta_table = preg_replace( '/[^a-z0-9_-]/i', '', $data['custom_user_meta_table']['value'] );
+					}
+				}
+
+				// Bring in the database object
+				global $bbdb;
+				global $bb_table_prefix;
+
+				// Resolve the custom user tables for bpdb
+				bb_set_custom_user_tables();
+
+				if ( isset( $bb->custom_databases) && isset( $bb->custom_databases['user'] ) ) {
+					$bbdb->add_db_server( 'user', $bb->custom_databases['user'] );
+				}
+
+				// Add custom tables if required
+				if ( isset( $bb->custom_tables['users'] ) || isset( $bb->custom_tables['usermeta'] ) ) {
+					$bbdb->tables = array_merge( $bbdb->tables, $bb->custom_tables );
+					if ( is_wp_error( $bbdb->set_prefix( $bb_table_prefix ) ) ) {
+						die( __( 'Your user table prefix may only contain letters, numbers and underscores.' ) );
+					}
+				}
+
+				// Hide errors for the test
+				$bbdb->hide_errors();
+
+				$result = $bbdb->query( 'DESCRIBE ' . $bbdb->users . ';' );
+				$result_error = $bbdb->get_error();
+
+				// Select from the user table (may fail if there are no records in the table)
+				if ( !$result && $result_error ) {
+					// We couldn't connect to the database at all
+
+					// Turn errors back on
+					$bbdb->show_errors();
+
+					// Set the status
+					$this->step_status[2] = 'incomplete';
+					if ( !empty( $data['user_bbdb_name']['value'] ) ) {
+						$this->strings[2]['form_errors']['user_bbdb_name'][] = true;
+					}
+					if ( !empty( $data['user_bbdb_user']['value'] ) ) {
+						$this->strings[2]['form_errors']['user_bbdb_user'][] = true;
+					}
+					if ( !empty( $data['user_bbdb_password']['value'] ) ) {
+						$this->strings[2]['form_errors']['user_bbdb_password'][] = true;
+					}
+					if ( !empty( $data['user_bbdb_host']['value'] ) ) {
+						$this->strings[2]['form_errors']['user_bbdb_host'][] = true;
+					}
+					if ( !empty( $data['custom_user_table']['value'] ) ) {
+						$this->strings[2]['form_errors']['custom_user_table'][] = true;
+					}
+					if ( !empty( $data['custom_user_meta_table']['value'] ) ) {
+						$this->strings[2]['form_errors']['custom_user_meta_table'][] = true;
+					}
+					$this->strings[2]['messages']['error'][] = __( 'There was a problem connecting to the WordPress user database you specified. Please check the settings, then try again.' );
+					return 'incomplete';
+				}
+
+				if ( $result_error ) {
+					// The result is an error, presumably telling us the table doesn't exist
+
+					// Turn errors back on
+					$bbdb->show_errors();
+
+					// Set the status
+					$this->step_status[2] = 'incomplete';
+
+					if ( $data['toggle_2_3']['value'] ) {
+						$this->strings[2]['messages']['error'][] = __( 'Existing WordPress user tables could not be found in the WordPress database you specified.' );
+					} else {
+						$this->strings[2]['messages']['error'][] = __( 'Existing WordPress user tables could not be found in the bbPress database you specified in step 1.<br /><br />This is probably because the database does not already contain working WordPress tables. You may need to specify advanced database settings or leave integration until after installation.' );
+					}
+					$this->strings[2]['form_errors']['wp_table_prefix'][] = __( '&bull; This may not be a valid user table prefix.' );
+					return 'incomplete';
+				}
+
+				// Turn errors back on
+				$bbdb->show_errors();
+			}
+		}
+
+		// Stop here if we are going backwards
+		if ( $_POST['back_2_1'] ) {
+			$this->step_status[2] = 'incomplete';
+			return 'incomplete';
+		}
+
+		// If we make it this may we are complete, so set the status to complete
+		$this->step_status[2] = 'complete';
+		$this->strings[2]['messages']['message'][] = __( 'Your WordPress integration cookie and database settings have been successfully validated. They will be saved after the next step.<br /><br />Once you have finished installing, you should visit the WordPress integration section of the bbPress admin area for further options and integration instructions, including user mapping and the correct cookie settings to add to your WordPress configuration file.' );
+		return 'complete';
+	}
+
+	/**
+	 * Validates the site options.
+	 *
+	 * @return void
+	 **/
+	function process_form_site_options()
+	{
+		// Check the referer
+		bb_check_admin_referer( 'bbpress-installer' );
+
+		$this->inject_form_values_into_data( 2 );
+		$this->inject_form_values_into_data( 3 );
+
+		$data =& $this->data[3]['form'];
+
+		$this->strings[3]['form_errors']['name'][] = empty( $data['name']['value'] ) ? 'empty' : false;
+
+		$data['uri']['value'] = $data['uri']['value'] ? rtrim( $data['uri']['value'], " \t\n\r\0\x0B/" ) . '/' : '';
+		$this->strings[3]['form_errors']['uri'][] = empty( $data['uri']['value'] ) ? 'empty' : false;
+		if ( $parsed = parse_url( $data['uri']['value'] ) ) {
+			$this->strings[3]['form_errors']['uri'][] = preg_match( '/https?/i', $parsed['scheme'] ) ? false : 'urlscheme';
+			$this->strings[3]['form_errors']['uri'][] = empty( $parsed['host'] ) ? 'urlhost' : false;
+		} else {
+			$this->strings[3]['form_errors']['uri'][] = 'urlparse';
+		}
+
+		$this->strings[3]['form_errors']['keymaster_user_login'][] = empty( $data['keymaster_user_login']['value'] ) ? 'empty' : false;
+		if ( $data['keymaster_user_login']['value'] != sanitize_user( $data['keymaster_user_login']['value'], true ) ) {
+			$this->strings[3]['form_errors']['keymaster_user_login'][] = 'userlogin';
+		}
+		$data['keymaster_user_login']['value'] = sanitize_user( $data['keymaster_user_login']['value'], true );
+
+		// Check for a valid email
+		$this->strings[3]['form_errors']['keymaster_user_email'][] = empty( $data['keymaster_user_email']['value'] ) ? 'empty' : false;
+		$this->strings[3]['form_errors']['keymaster_user_email'][] = !is_email( $data['keymaster_user_email']['value'] ) ? 'email' : false;
+
+		// Check for a forum name
+		if ( !$this->database_tables_are_installed() ) {
+			$this->strings[3]['form_errors']['forum_name'][] = empty( $data['forum_name']['value'] ) ? 'empty' : false;
+		}
+
+		// Remove empty values from the error array
+		foreach ( $this->strings[3]['form_errors'] as $input => $types ) {
+			$types = array_filter( $types );
+			if ( !count( $types ) ) {
+				unset( $this->strings[3]['form_errors'][$input] );
+			}
+		}
+
+		// Check for errors and build error messages
+		if ( count( $this->strings[3]['form_errors'] ) ) {
+
+			$this->step_status[3] = 'incomplete';
+			$this->strings[3]['messages']['error'][] = __( 'Your site settings have not been processed due to errors with the items marked below.' );
+
+			foreach ( $this->strings[3]['form_errors'] as $input => $types ) {
+				$errors = array();
+
+				foreach ( $types as $type ) {
+					switch ( $type ) {
+						case 'empty':
+							// Only return this error when empty
+							$errors = array( __( '&bull; This value is required to continue.' ) );
+							break(2);
+						case 'urlparse':
+							$errors[] = __( '&bull; This does not appear to be a valid URL.' );
+							break;
+						case 'urlscheme':
+							$errors[] = __( '&bull; The URL must begin with "http" or "https".' );
+							break;
+						case 'urlhost':
+							$errors[] = __( '&bull; The URL does not contain a host name.' );
+							break;
+						case 'userlogin':
+							$errors[] = __( '&bull; Contains disallowed characters which have been removed.' );
+							break;
+						case 'email':
+							$errors[] = __( '&bull; The user email address appears to be invalid.' );
+							break;
+					}
+				}
+
+				$this->strings[3]['form_errors'][$input] = $errors;
+			}
+
+			return 'incomplete';
+		}
+
+		// Stop here if we are going backwards
+		if ( $_POST['back_3_1'] ) {
+			$this->step_status[3] = 'incomplete';
+			return 'incomplete';
+		}
+
+		// If we make it this far we are good to go
+		$this->step_status[3] = 'complete';
+		$this->strings[3]['messages']['message'][] = __( 'Your site settings have been saved and we are now ready to complete the installation. So what are you waiting for?' );
+		return 'complete';
+	}
+
+	/**
+	 * Finalises the installation by creating the database and writing all the supplied data to the database.
+	 *
+	 * @return void
+	 **/
+	function process_form_finalise_installation()
+	{
+		require_once( BB_PATH . 'bb-admin/includes/functions.bb-upgrade.php' );
+		require_once( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );
+
+		$this->inject_form_values_into_data( 2 );
+		$this->inject_form_values_into_data( 3 );
+
+		$data2 =& $this->data[2]['form'];
+		$data3 =& $this->data[3]['form'];
+		$data4 =& $this->data[4]['form'];
+
+		$error_log = array();
+		$installation_log = array();
+
+		// Check the referer
+		bb_check_admin_referer( 'bbpress-installer' );
+		$installation_log[] = __( 'Referrer is OK, beginning installation&hellip;' );
+
+		global $bbdb;
+
+		// Setup user table variables and constants if available
+		if ( $data2['toggle_2_2']['value'] ) {
+
+			$installation_log[] = '>>> ' . __( 'Setting up custom user table constants' );
+
+			global $bb;
+			global $bb_table_prefix;
+
+			if ( !empty( $data2['wp_table_prefix']['value'] ) ) {
+				$bb->wp_table_prefix = $data2['wp_table_prefix']['value'];
+			}
+			if ( !empty( $data2['user_bbdb_name']['value'] ) ) {
+				$bb->user_bbdb_name = $data2['user_bbdb_name']['value'];
+			}
+			if ( !empty( $data2['user_bbdb_user']['value'] ) ) {
+				$bb->user_bbdb_user = $data2['user_bbdb_user']['value'];
+			}
+			if ( !empty( $data2['user_bbdb_password']['value'] ) ) {
+				$bb->user_bbdb_password = $data2['user_bbdb_password']['value'];
+			}
+			if ( !empty( $data2['user_bbdb_host']['value'] ) ) {
+				$bb->user_bbdb_host = $data2['user_bbdb_host']['value'];
+			}
+			if ( !empty( $data2['user_bbdb_charset']['value'] ) ) {
+				$bb->user_bbdb_charset = preg_replace( '/[^a-z0-9_-]/i', '', $data2['user_bbdb_charset']['value'] );
+			}
+			if ( !empty( $data2['user_bbdb_collate']['value'] ) ) {
+				$bb->user_bbdb_collate = preg_replace( '/[^a-z0-9_-]/i', '', $data2['user_bbdb_collate']['value'] );
+			}
+
+			bb_set_custom_user_tables();
+
+			// Add custom user database if required
+			if ( isset( $bb->custom_databases['user'] ) ) {
+				$bbdb->add_db_server( 'user', $bb->custom_databases['user'] );
+			}
+
+			// Add custom tables if required
+			if ( isset( $bb->custom_tables ) ) {
+				$bbdb->tables = array_merge( $bbdb->tables, $bb->custom_tables );
+				if ( is_wp_error( $bbdb->set_prefix( $bb_table_prefix ) ) )
+					die( __( 'Your user table prefix may only contain letters, numbers and underscores.' ) );
+			}
+		}
+
+		// Create the database
+		$installation_log[] = "\n" . __( 'Step 1 - Creating database tables' );
+
+		if ( !$this->database_tables_are_installed() ) {
+			// Hide db errors
+			$bbdb->hide_errors();
+			// Install the database
+			$alterations = bb_install();
+			// Show db errors
+			$bbdb->show_errors();
+
+			if ( isset( $alterations['errors'] ) && is_array( $alterations['errors'] ) ) {
+				$error_log = array_merge( $error_log, $alterations['errors'] );
+			}
+			if ( isset( $alterations['messages'] ) && is_array( $alterations['messages'] ) ) {
+				$installation_log = array_merge( $installation_log, $alterations['messages'] );
+			}
+
+			if ( !$this->database_tables_are_installed() ) {
+				$installation_log[] = '>>> ' . __( 'Database installation failed!!!' );
+				$installation_log[] = '>>>>>> ' . __( 'Halting installation!' );
+				$error_log[] = __( 'Database installation failed!!!' );
+
+				$this->step_status[4] = 'incomplete';
+				$this->strings[4]['h2'] = __( 'Installation failed!' );
+				$this->strings[4]['messages']['error'][] = __( 'The database failed to install. You may need to replace bbPress with a fresh copy and start again.' );
+
+				$data4['installation_log']['value'] = join( "\n", $installation_log );
+				$data4['error_log']['value'] = join( "\n", $error_log );
+
+				return 'incomplete';
+			}
+		} else {
+			$installation_log[] = '>>> ' . __( 'Database is already installed!!!' );
+		}
+
+		// Integration settings passed from step 2
+		// These are already validated provided that the referer checks out
+		$installation_log[] = "\n" . __( 'Step 2 - WordPress integration (optional)' );
+		if ( $data2['toggle_2_0']['value'] ) {
+			if ( $data2['toggle_2_1']['value'] ) {
+				bb_update_option( 'wp_siteurl', $data2['wp_siteurl']['value'] );
+				$installation_log[] = '>>> ' . __( 'WordPress address (URL):' ) . ' ' . $data2['wp_siteurl']['value'];
+
+				bb_update_option( 'wp_home', $data2['wp_home']['value'] );
+				$installation_log[] = '>>> ' . __( 'Blog address (URL):' ) . ' ' . $data2['wp_home']['value'];
+
+				$config_result = $this->write_lines_to_file(
+					BB_PATH . 'bb-config.php',
+					false,
+					array(
+						"define( 'BB_AUTH_KEY"  => array( "'" . BB_AUTH_KEY . "'",        "'" . $data2['wp_auth_key']['value'] . "'" ),
+						"define( 'BB_SECURE_A"  => array( "'" . BB_SECURE_AUTH_KEY . "'", "'" . $data2['wp_secure_auth_key']['value'] . "'" ),
+						"define( 'BB_LOGGED_I"  => array( "'" . BB_LOGGED_IN_KEY . "'",   "'" . $data2['wp_logged_in_key']['value'] . "'" ),
+					)
+				);
+
+				switch ( $config_result ) {
+					case 1:
+						$installation_log[] = '>>> ' . __( 'WordPress cookie keys set.' );
+						break;
+					default:
+						$error_log[] = '>>> ' . __( 'WordPress cookie keys not set.' );
+						$error_log[] = '>>>>>> ' . __( 'Your "bb-config.php" file was not writable.' );
+						$error_log[] = '>>>>>> ' . __( 'You will need to manually re-define "BB_AUTH_KEY", "BB_SECURE_AUTH_KEY" and "BB_LOGGED_IN_KEY" in your "bb-config.php" file.' );
+						$installation_log[] = '>>> ' . __( 'WordPress cookie keys not set.' );
+						break;
+				}
+
+				if ( !empty( $data2['wp_auth_salt']['value'] ) ) {
+					bb_update_option( 'bb_auth_salt', $data2['wp_auth_salt']['value'] );
+					$installation_log[] = '>>> ' . __( 'WordPress "auth" cookie salt set from input.' );
+				}
+
+				if ( !empty( $data2['wp_secure_auth_salt']['value'] ) ) {
+					bb_update_option( 'bb_secure_auth_salt', $data2['wp_secure_auth_salt']['value'] );
+					$installation_log[] = '>>> ' . __( 'WordPress "secure auth" cookie salt set from input.' );
+				}
+
+				if ( !empty( $data2['wp_logged_in_salt']['value'] ) ) {
+					bb_update_option( 'bb_logged_in_salt', $data2['wp_logged_in_salt']['value'] );
+					$installation_log[] = '>>> ' . __( 'WordPress "logged in" cookie salt set from input.' );
+				}
+			}
+
+			if ( $data2['toggle_2_2']['value'] ) {
+				if (
+					!bb_get_option( 'bb_auth_salt' ) ||
+					!bb_get_option( 'bb_secure_auth_salt' ) ||
+					!bb_get_option( 'bb_logged_in_salt' )
+				) {
+					$installation_log[] = '>>> ' . __( 'Fetching missing WordPress cookie salts.' );
+
+					$_prefix = $bb->wp_table_prefix;
+					if ( !empty( $data2['wordpress_mu_primary_blog_id']['value'] ) ) {
+						$_prefix .= $data2['wordpress_mu_primary_blog_id']['value'] . '_';
+					}
+
+					if ( isset( $bb->custom_databases['user'] ) ) {
+						$bbdb->tables['options'] = array( 'user', $_prefix . 'options' );
+					} else {
+						$bbdb->tables['options'] = $_prefix . 'options';
+					}
+
+					unset( $_prefix );
+
+					$bbdb->set_prefix( $bb_table_prefix );
+
+					if ( !bb_get_option( 'bb_auth_salt' ) ) {
+						$wp_auth_salt = $bbdb->get_var( "SELECT `option_value` FROM $bbdb->options WHERE `option_name` = 'auth_salt' LIMIT 1" );
+						if ( $wp_auth_salt ) {
+							bb_update_option( 'bb_auth_salt', $wp_auth_salt );
+							$installation_log[] = '>>>>>> ' . __( 'WordPress "auth" cookie salt set.' );
+						} else {
+							$error_log[] = '>>> ' . __( 'WordPress "auth" cookie salt not set.' );
+							$error_log[] = '>>>>>> ' . __( 'Could not fetch "auth" cookie salt from the WordPress options table.' );
+							$error_log[] = '>>>>>> ' . __( 'You will need to manually define the "auth" cookie salt in your database.' );
+							$installation_log[] = '>>>>>> ' . __( 'WordPress "auth" cookie salt not set.' );
+						}
+					}
+
+					if ( !bb_get_option( 'bb_secure_auth_salt' ) ) {
+						$wp_secure_auth_salt = $bbdb->get_var( "SELECT `option_value` FROM $bbdb->options WHERE `option_name` = 'secure_auth_salt' LIMIT 1" );
+						if ( $wp_secure_auth_salt ) {
+							bb_update_option( 'bb_secure_auth_salt', $wp_secure_auth_salt );
+							$installation_log[] = '>>>>>> ' . __( 'WordPress "secure auth" cookie salt set.' );
+						} else {
+							// This cookie salt is sometimes empty so don't error
+							$installation_log[] = '>>>>>> ' . __( 'WordPress "secure auth" cookie salt not set.' );
+						}
+					}
+
+					if ( !bb_get_option( 'bb_logged_in_salt' ) ) {
+						$wp_logged_in_salt = $bbdb->get_var( "SELECT `option_value` FROM $bbdb->options WHERE `option_name` = 'logged_in_salt' LIMIT 1" );
+						if ( $wp_logged_in_salt ) {
+							bb_update_option( 'bb_logged_in_salt', $wp_logged_in_salt );
+							$installation_log[] = '>>>>>> ' . __( 'WordPress "logged in" cookie salt set.' );
+						} else {
+							$error_log[] = '>>> ' . __( 'WordPress "logged in" cookie salt not set.' );
+							$error_log[] = '>>>>>> ' . __( 'Could not fetch "logged in" cookie salt from the WordPress options table.' );
+							$error_log[] = '>>>>>> ' . __( 'You will need to manually define the "logged in" cookie salt in your database.' );
+							$installation_log[] = '>>>>>> ' . __( 'WordPress "logged in" cookie salt not set.' );
+						}
+					}
+				}
+
+				if ( !empty( $data2['wp_table_prefix']['value'] ) ) {
+					bb_update_option( 'wp_table_prefix', $data2['wp_table_prefix']['value'] );
+					$installation_log[] = '>>> ' . __( 'User database table prefix:' ) . ' ' . $data2['wp_table_prefix']['value'];
+				}
+
+				if ( !empty( $data2['wordpress_mu_primary_blog_id']['value'] ) ) {
+					bb_update_option( 'wordpress_mu_primary_blog_id', $data2['wordpress_mu_primary_blog_id']['value'] );
+					$installation_log[] = '>>> ' . __( 'WordPress MU primary blog ID:' ) . ' ' . $data2['wordpress_mu_primary_blog_id']['value'];
+				}
+
+				if ( $data2['toggle_2_3']['value'] ) {
+					if ( !empty( $data2['user_bbdb_name']['value'] ) ) {
+						bb_update_option( 'user_bbdb_name', $data2['user_bbdb_name']['value'] );
+						$installation_log[] = '>>> ' . __( 'User database name:' ) . ' ' . $data2['user_bbdb_name']['value'];
+					}
+					if ( !empty( $data2['user_bbdb_user']['value'] ) ) {
+						bb_update_option( 'user_bbdb_user', $data2['user_bbdb_user']['value'] );
+						$installation_log[] = '>>> ' . __( 'User database user:' ) . ' ' . $data2['user_bbdb_user']['value'];
+					}
+					if ( !empty( $data2['user_bbdb_password']['value'] ) ) {
+						bb_update_option( 'user_bbdb_password', $data2['user_bbdb_password']['value'] );
+						$installation_log[] = '>>> ' . __( 'User database password:' ) . ' ' . $data2['user_bbdb_password']['value'];
+					}
+					if ( !empty( $data2['user_bbdb_host']['value'] ) ) {
+						bb_update_option( 'user_bbdb_host', $data2['user_bbdb_host']['value'] );
+						$installation_log[] = '>>> ' . __( 'User database host:' ) . ' ' . $data2['user_bbdb_host']['value'];
+					}
+					if ( !empty( $data2['user_bbdb_charset']['value'] ) ) {
+						bb_update_option( 'user_bbdb_charset', $data2['user_bbdb_charset']['value'] );
+						$installation_log[] = '>>> ' . __( 'User database character set:' ) . ' ' . $data2['user_bbdb_charset']['value'];
+					}
+					if ( !empty( $data2['user_bbdb_collate']['value'] ) ) {
+						bb_update_option( 'user_bbdb_collate', $data2['user_bbdb_collate']['value'] );
+						$installation_log[] = '>>> ' . __( 'User database collation:' ) . ' ' . $data2['user_bbdb_collate']['value'];
+					}
+					if ( !empty( $data2['custom_user_table']['value'] ) ) {
+						bb_update_option( 'custom_user_table', $data2['custom_user_table']['value'] );
+						$installation_log[] = '>>> ' . __( 'User database "user" table:' ) . ' ' . $data2['custom_user_table']['value'];
+					}
+					if ( !empty( $data2['custom_user_meta_table']['value'] ) ) {
+						bb_update_option( 'custom_user_meta_table', $data2['custom_user_meta_table']['value'] );
+						$installation_log[] = '>>> ' . __( 'User database "user meta" table:' ) . ' ' . $data2['custom_user_meta_table']['value'];
+					}
+				}
+			}
+		} else {
+			$installation_log[] = '>>> ' . __( 'Integration not enabled' );
+		}
+
+		// Site settings passed from step 3
+		// These are already validated provided that the referer checks out
+		$installation_log[] = "\n" . __( 'Step 3 - Site settings' );
+		bb_update_option( 'name', $data3['name']['value'] );
+		$installation_log[] = '>>> ' . __( 'Site name:' ) . ' ' . $data3['name']['value'];
+		bb_update_option( 'uri', $data3['uri']['value'] );
+		$installation_log[] = '>>> ' . __( 'Site address (URL):' ) . ' ' . $data3['uri']['value'];
+		bb_update_option( 'from_email', $data3['keymaster_user_email']['value'] );
+		$installation_log[] = '>>> ' . __( 'From email address:' ) . ' ' . $data3['keymaster_user_email']['value'];
+
+		// Create the key master
+		$keymaster_created = false;
+
+		switch ( $data3['keymaster_user_type']['value'] ) {
+			case 'new':
+
+				// Check to see if the user login already exists
+				if ( $keymaster_user = bb_get_user( $data3['keymaster_user_login']['value'], array( 'by' => 'login' ) ) ) {
+					// The keymaster is an existing bbPress user
+					$installation_log[] = '>>> ' . __( 'Key master could not be created!' );
+					$installation_log[] = '>>>>>> ' . __( 'That login is already taken!' );
+					$error_log[] = __( 'Key master could not be created!' );
+
+					if ( $keymaster_user->bb_capabilities['keymaster'] ) {
+						// The existing user is a key master - continue
+						$bb_current_user = bb_set_current_user( $keymaster_user->ID );
+						$installation_log[] = '>>>>>> ' . __( 'Existing key master entered!' );
+						$data4['keymaster_user_password']['value'] = __( 'Your bbPress password' );
+						$data3['keymaster_user_email']['value'] = $keymaster_user->user_email;
+						bb_update_option( 'from_email', $keymaster_user->user_email);
+						$installation_log[] = '>>>>>> ' . __( 'Re-setting admin email address.' );
+						$keymaster_created = true;
+					} else {
+						// The existing user is a non-key master user - halt installation
+						$installation_log[] = '>>>>>> ' . __( 'Existing user without key master role entered!' );
+						$installation_log[] = '>>>>>>>>> ' . __( 'Halting installation!' );
+						$this->step_status[4] = 'incomplete';
+						$this->strings[4]['h2'] = __( 'Installation failed!' );
+						$this->strings[4]['messages']['error'][] = __( 'The key master could not be created. An existing user was found with that user login.' );
+
+						$data4['installation_log']['value'] = join( "\n", $installation_log );
+						$data4['error_log']['value'] = join( "\n", $error_log );
+
+						return 'incomplete';
+					}
+
+					break;
+				}
+
+				// Helper function to let us know the password that was created
+				global $keymaster_password;
+				function bb_get_keymaster_password( $user_id, $pass ) {
+					global $keymaster_password;
+					$keymaster_password = $pass;
+				}
+				add_action( 'bb_new_user', 'bb_get_keymaster_password', 10, 2 );
+
+				// Create the new user (automattically given key master role when BB_INSTALLING is true)
+				if ( $keymaster_user_id = bb_new_user( $data3['keymaster_user_login']['value'], $data3['keymaster_user_email']['value'], '' ) ) {
+					$bb_current_user = bb_set_current_user( $keymaster_user_id );
+					$data4['keymaster_user_password']['value'] = $keymaster_password;
+					$installation_log[] = '>>> ' . __( 'Key master created' );
+					$installation_log[] = '>>>>>> ' . __( 'Username:' ) . ' ' . $data3['keymaster_user_login']['value'];
+					$installation_log[] = '>>>>>> ' . __( 'Email address:' ) . ' ' . $data3['keymaster_user_email']['value'];
+					$installation_log[] = '>>>>>> ' . __( 'Password:' ) . ' ' . $data4['keymaster_user_password']['value'];
+					$keymaster_created = true;
+				} else {
+					$installation_log[] = '>>> ' . __( 'Key master could not be created!' );
+					$installation_log[] = '>>>>>> ' . __( 'Halting installation!' );
+					$error_log[] = __( 'Key master could not be created!' );
+					$this->step_status[4] = 'incomplete';
+					$this->strings[4]['h2'] = __( 'Installation failed!' );
+					$this->strings[4]['messages']['error'][] = __( 'The key master could not be created. You may need to replace bbPress with a fresh copy and start again.' );
+
+					$data4['installation_log']['value'] = join( "\n", $installation_log );
+					$data4['error_log']['value'] = join( "\n", $error_log );
+
+					return 'incomplete';
+				}
+				break;
+
+			case 'old':
+				if ( $keymaster_user = bb_get_user( $data3['keymaster_user_login']['value'], array( 'by' => 'login' ) ) ) {
+					// The keymaster is an existing bbPress or WordPress user
+					$bb_current_user = bb_set_current_user( $keymaster_user->ID );
+					$bb_current_user->set_role( 'keymaster' );
+					$data4['keymaster_user_password']['value'] = __( 'Your existing password' );
+					$installation_log[] = '>>> ' . __( 'Key master role assigned to existing user' );
+					$installation_log[] = '>>>>>> ' . __( 'Username:' ) . ' ' . $data3['keymaster_user_login']['value'];
+					$installation_log[] = '>>>>>> ' . __( 'Email address:' ) . ' ' . $data3['keymaster_user_email']['value'];
+					$installation_log[] = '>>>>>> ' . __( 'Password:' ) . ' ' . $data4['keymaster_user_password']['value'];
+					$keymaster_created = true;
+				} else {
+					$installation_log[] = '>>> ' . __( 'Key master role could not be assigned to existing user!' );
+					$installation_log[] = '>>>>>> ' . __( 'Halting installation!' );
+					$error_log[] = __( 'Key master could not be created!' );
+					$this->step_status[4] = 'incomplete';
+					$this->strings[4]['h2'] = __( 'Installation failed!' );
+					$this->strings[4]['messages']['error'][] = __( 'The key master could not be assigned. You may need to replace bbPress with a fresh copy and start again.' );
+
+					$data4['installation_log']['value'] = join( "\n", $installation_log );
+					$data4['error_log']['value'] = join( "\n", $error_log );
+
+					return 'incomplete';
+				}
+				break;
+		}
+
+		// Don't create an initial forum if any forums already exist
+		if (!$bbdb->get_results( 'SELECT `forum_id` FROM `' . $bbdb->forums . '` LIMIT 1;' ) ) {
+			if ( $this->language != BB_LANG) {
+				global $locale, $l10n;
+				$locale = BB_LANG;
+				unset( $l10n['default'] );
+				bb_load_default_textdomain();
+			}
+
+			$description = __( 'Just another bbPress community' );
+			bb_update_option( 'description', $description);
+
+			if ( $this->language != BB_LANG) {
+				$locale = $this->language;
+				unset( $l10n['default'] );
+				bb_load_default_textdomain();
+			}
+
+			$installation_log[] = '>>> ' . __( 'Description:' ) . ' ' . $description;
+
+			if ( $forum_id = bb_new_forum( array( 'forum_name' => $data3['forum_name']['value'] ) ) ) {
+				$installation_log[] = '>>> ' . __( 'Forum name:' ) . ' ' . $data3['forum_name']['value'];
+
+				if ( $this->language != BB_LANG) {
+					$locale = BB_LANG;
+					unset( $l10n['default'] );
+					bb_load_default_textdomain();
+				}
+
+				$topic_title = __( 'Your first topic' );
+				$topic_id = bb_insert_topic(
+					array(
+						'topic_title' => $topic_title,
+						'forum_id' => $forum_id,
+						'tags' => 'bbPress'
+					)
+				);
+				$post_text = __( 'First Post!  w00t.' );
+				bb_insert_post(
+					array(
+						'topic_id' => $topic_id,
+						'post_text' => $post_text
+					)
+				);
+
+				if ( $this->language != BB_LANG ) {
+					$locale = $this->language;
+					unset( $l10n['default'] );
+					bb_load_default_textdomain();
+				}
+
+				$installation_log[] = '>>>>>> ' . __( 'Topic:' ) . ' ' . $topic_title;
+				$installation_log[] = '>>>>>>>>> ' . __( 'Post:' ) . ' ' . $post_text;
+			} else {
+				$installation_log[] = '>>> ' . __( 'Forum could not be created!' );
+				$error_log[] = __( 'Forum could not be created!' );
+			}
+		} else {
+			$installation_log[] = '>>> ' . __( 'There are existing forums in this database.' );
+			$installation_log[] = '>>>>>> ' . __( 'No new forum created.' );
+			$error_log[] = __( 'Forums already exist!' );
+		}
+
+		if ( defined( 'BB_PLUGIN_DIR' ) && BB_PLUGIN_DIR && !file_exists( BB_PLUGIN_DIR ) ) {
+			// Just suppress errors as this is not critical
+			if ( @mkdir( BB_PLUGIN_DIR, 0750 ) ) {
+				$installation_log[] = '>>> ' . sprintf( __( 'Making plugin directory at %s.' ),  BB_PLUGIN_DIR );
+			}
+		}
+
+		if ( defined( 'BB_THEME_DIR' ) && BB_THEME_DIR && !file_exists( BB_THEME_DIR ) ) {
+			// Just suppress errors as this is not critical
+			if ( @mkdir( BB_THEME_DIR, 0750 ) ) {
+				$installation_log[] = '>>> ' . sprintf( __( 'Making theme directory at %s.' ),  BB_THEME_DIR );
+			}
+		}
+
+		if ( $keymaster_created ) {
+			$keymaster_email_message = sprintf(
+				__( "Your new bbPress site has been successfully set up at:\n\n%1\$s\n\nYou can log in to the key master account with the following information:\n\nUsername: %2\$s\nPassword: %3\$s\n\nWe hope you enjoy your new forums. Thanks!\n\n--The bbPress Team\nhttp://bbpress.org/" ),
+				bb_get_uri( null, null, BB_URI_CONTEXT_TEXT ),
+				$data3['keymaster_user_login']['value'],
+				$data4['keymaster_user_password']['value']
+			);
+
+			if ( bb_mail( $data3['keymaster_user_email']['value'], __( 'New bbPress installation' ), $keymaster_email_message ) ) {
+				$installation_log[] = '>>> ' . __( 'Key master email sent' );
+			} else {
+				$installation_log[] = '>>> ' . __( 'Key master email not sent!' );
+				$error_log[] = __( 'Key master email not sent!' );
+			}
+		}
+
+		if ( count( $error_log ) ) {
+			$this->strings[4]['h2'] = __( 'Installation completed with some errors!' );
+			$this->strings[4]['messages']['error'][] = __( 'Your installation completed with some minor errors. See the error log below for more specific information.' );
+			$installation_log[] = "\n" . __( 'There were some errors encountered during installation!' );
+		} else {
+			$this->strings[4]['messages']['message'][] = __( 'Your installation completed successfully.' );
+			$installation_log[] = "\n" . __( 'Installation complete!' );
+		}
+
+		$this->step_status[4] = 'complete';
+
+		$data4['installation_log']['value'] = join( "\n", $installation_log );
+		$data4['error_log']['value'] = join( "\n", $error_log );
+
+		return 'complete';
+	}
+
+	/**
+	 * Prints a text input form element.
+	 *
+	 * @param $key string The key of the data to populate the element with.
+	 * @param $direction string Optional. The text direction, only 'ltr' or 'rtl' are acceptable.
+	 * @return void
+	 **/
+	function input_text( $key, $direction = false )
+	{
+		$data = $this->data[$this->step]['form'][$key];
+
+		$class = '';
+		$classes = array();
+		if ( isset( $data['note'] ) ) {
+			$classes[] = 'has-note';
+		}
+		if ( isset( $data['label'] ) ) {
+			$classes[] = 'has-label';
+		}
+
+		if ( isset( $this->data[$this->step]['form'][$key]['type'] ) ) {
+			$type = $this->data[$this->step]['form'][$key]['type'];
+		} else {
+			$type = 'text';
+		}
+		$classes[] = 'for-input-' . $type;
+
+		if ( isset( $this->strings[$this->step]['form_errors'][$key] ) ) {
+			$classes[] = 'error';
+		}
+		if ( count( $classes ) ) {
+			$class = ' class="' . join( ' ', $classes ) . '"';
+		}
+
+		$r = "\t" . '<label id="label-' . esc_attr( $key ) . '" for="' . esc_attr( $key ) . '"' . $class . '>' . "\n";
+
+		if ( isset( $data['label'] ) ) {
+			$r .= "\t\t" . '<span>' . $data['label'] . '</span>' . "\n";
+		}
+
+		if ( isset( $this->strings[$this->step]['form_errors'][$key] ) ) {
+			foreach ( $this->strings[$this->step]['form_errors'][$key] as $error ) {
+				if ( !is_bool( $error ) ) {
+					$r .= "\t\t" . '<span class="error">' . $error . '</span>' . "\n";
+				}
+			}
+		}
+
+		if ( isset( $data['maxlength'] ) && is_integer( $data['maxlength'] ) ) {
+			$maxlength = ' maxlength="' . esc_attr( $data['maxlength'] ) . '"';
+		}
+
+		if ( $direction && in_array( strtolower( $direction ), array( 'ltr', 'rtl' ) ) ) {
+			$direction = ' dir="' . esc_attr( strtolower( $direction ) ) . '"';
+		}
+
+		if ( isset( $data['autocomplete'] ) ) {
+			$autocomplete = ' autocomplete="' . esc_attr( $data['autocomplete'] ) . '"';
+		} else {
+			$autocomplete = '';
+		}
+
+		$this->tabindex++;
+		$r .= "\t\t" . '<input' . $direction . ' type="' . esc_attr( $type ) . '" id="' . esc_attr( $key ) . '" name="' . esc_attr( $key ) . '" class="text' . $has_note_class . '" value="' . esc_attr( $data['value'] ) . '"' . $maxlength . $autocomplete . ' tabindex="' . $this->tabindex . '" />' . "\n";
+
+		if ( isset( $data['note'] ) ) {
+			$r .= "\t\t" . '<a class="note-toggle" href="javascript:void(0);" onclick="toggleNote(\'note-' . esc_attr( $key ) . '\');">?</a>' . "\n";
+			$r .= "\t\t" . '<p id="note-' . esc_attr( $key ) . '" class="note" style="display:none">' . $data['note'] . '</p>' . "\n";
+		}
+
+		$r .= "\t\t" . '<div class="clear"></div>' . "\n";
+		$r .= "\t" . '</label>' . "\n";
+
+		echo $r;
+	}
+
+	/**
+	 * Prints a hidden input form element.
+	 *
+	 * @param $key string The key of the data to populate the element with.
+	 * @return void
+	 **/
+	function input_hidden( $key )
+	{
+		$r = "\t" . '<input type="hidden" id="' . esc_attr( $key ) . '" name="' . esc_attr( $key ) . '" value="' . esc_attr( $this->data[$this->step]['form'][$key]['value'] ) . '" />' . "\n";
+
+		echo $r;
+	}
+
+	/**
+	 * Prints a textarea form element.
+	 *
+	 * @param $key string The key of the data to populate the element with.
+	 * @param $direction string Optional. The text direction, only 'ltr' or 'rtl' are acceptable.
+	 * @return void
+	 **/
+	function textarea( $key, $direction = false)
+	{
+		$data = $this->data[$this->step]['form'][$key];
+
+		$class = '';
+		$classes = array( 'for-textarea' );
+		if ( isset( $data['note'] ) ) {
+			$classes[] = 'has-note';
+		}
+		if ( isset( $data['label'] ) ) {
+			$classes[] = 'has-label';
+		}
+		if ( count( $classes ) ) {
+			$class = ' class="' . join( ' ', $classes ) . '"';
+		}
+
+		$r = "\t" . '<label id="label-' . esc_attr( $key ) . '"' . $class . ' for="' . esc_attr( $key ) . '">' . "\n";
+
+		if ( isset( $data['label'] ) ) {
+			$r .= "\t\t" . '<span>' . $data['label'] . '</span>' . "\n";
+		}
+
+		if ( isset( $data['note'] ) ) {
+			$r .= "\t\t" . '<a class="note-toggle" href="javascript:void(0);" onclick="toggleNote(\'note-' . esc_attr( $key ) . '\');">?</a>' . "\n";
+			$r .= "\t\t" . '<p id="note-' . esc_attr( $key ) . '" class="note" style="display:none">' . $data['note'] . '</p>' . "\n";
+		}
+
+		if ( $direction && in_array( strtolower( $direction ), array( 'ltr', 'rtl' ) ) ) {
+			$direction = ' dir="' . esc_attr( strtolower( $direction ) ) . '"';
+		}
+
+		$this->tabindex++;
+		$r .= "\t\t" . '<textarea id="' . esc_attr( $key ) . '" rows="5" cols="30"' . $direction . ' tabindex="' . $this->tabindex . '">' . esc_html( $data['value'] ) . '</textarea>' . "\n";
+
+		$r .= "\t" . '</label>' . "\n";
+
+		echo $r;
+	}
+
+	/**
+	 * Prints a select form element populated with options.
+	 *
+	 * @param $key string The key of the data to populate the element with.
+	 * @return void
+	 **/
+	function select( $key )
+	{
+		$data = $this->data[$this->step]['form'][$key];
+
+		$class = '';
+		$classes = array( 'for-select' );
+		if ( isset( $data['note'] ) ) {
+			$classes[] = 'has-note';
+		}
+		if ( isset( $data['label'] ) ) {
+			$classes[] = 'has-label';
+		}
+		if ( count( $classes ) ) {
+			$class = ' class="' . join( ' ', $classes ) . '"';
+		}
+
+		$r = "\t" . '<label id="label-' . esc_attr( $key ) . '"' . $class . ' for="' . esc_attr( $key ) . '">' . "\n";
+
+		if ( isset( $data['label'] ) ) {
+			$r .= "\t\t" . '<span>' . $data['label'] . '</span>' . "\n";
+		}
+
+		if ( isset( $data['options'] ) ) {
+			$r .= "\t\t" . '<select id="' . esc_attr( $key ) . '" name="' . esc_attr( $key ) . '"';
+			if ( isset( $data['onchange'] ) ) {
+				$r .= ' onchange="' . esc_attr( $data['onchange'] ) . '"';
+			}
+			$this->tabindex++;
+			$r .= ' tabindex="' . $this->tabindex . '">' . "\n";
+
+			foreach ( $data['options'] as $value => $display ) {
+				if ( $data['value'] == $value ) {
+					$selected = ' selected="selected"';
+				} else {
+					$selected = '';
+				}
+
+				$r .= "\t\t\t" . '<option value="' . esc_attr( $value ) . '"' . $selected . '>' . esc_html( $display ) . '</option>' . "\n";
+			}
+
+			$r .= "\t\t" . '</select>';
+		}
+
+		if ( isset( $data['note'] ) ) {
+			$r .= "\t\t" . '<a class="note-toggle" href="javascript:void(0);" onclick="toggleNote(\'note-' . esc_attr( $key ) . '\');">?</a>' . "\n";
+			$r .= "\t\t" . '<p id="note-' . esc_attr( $key ) . '" class="note" style="display:none">' . $data['note'] . '</p>' . "\n";
+		}
+
+		$r .= "\t\t" . '<div class="clear"></div>' . "\n";
+		$r .= "\t" . '</label>' . "\n";
+
+		echo $r;
+	}
+
+	/**
+	 * Prints an appropriate language selection form element if there are any available.
+	 *
+	 * @return void
+	 **/
+	function select_language()
+	{
+		if ( count( $this->languages ) > 1 ) {
+			$this->data[1]['form']['bb_lang']['value'] = $this->language;
+			$this->data[1]['form']['bb_lang']['options'] = $this->languages;
+			$this->select( 'bb_lang' );
+		} else {
+			$this->data[1]['form']['bb_lang']['value'] = 'en_US';
+			$this->input_hidden( 'bb_lang' );
+		}
+	}
+
+	/**
+	 * Prints an input checkbox which controls display of an optional section of settings.
+	 *
+	 * @param string $key The identifier of the area to be toggled.
+	 * @return void
+	 **/
+	function input_toggle( $key )
+	{
+		$data = $this->data[$this->step]['form'][$key];
+
+		$class = '';
+		$classes = array( 'for-toggle' );
+		if ( isset( $data['note'] ) ) {
+			$classes[] = 'has-note';
+		}
+		if ( isset( $data['label'] ) ) {
+			$classes[] = 'has-label';
+		}
+
+		$onclick = 'toggleBlock(this, \'' . esc_js( $key . '_target' ) . '\' );';
+		if ( isset( $data['toggle_value'] ) ) {
+			$onclick .= ' toggleValue(this, \'' . esc_js( $data['toggle_value']['target'] ) . '\', \'' . esc_js( $data['toggle_value']['off_value'] ) . '\', \'' . esc_js( $data['toggle_value']['on_value'] ) . '\' );';
+		}
+
+		$checked = $data['checked'] ? ' ' . trim( $data['checked'] ) : '';
+
+		if ( isset( $this->strings[$this->step]['form_errors'][$key] ) ) {
+			$classes[] = 'error';
+		}
+		if ( count( $classes ) ) {
+			$class = ' class="' . join( ' ', $classes ) . '"';
+		}
+
+		$r = "\t" . '<label id="label-' . esc_attr( $key ) . '"' . $class . ' for="' . esc_attr( $key ) . '">' . "\n";
+
+		$r .= "\t\t" . '<span>' . "\n";
+		$this->tabindex++;
+		$r .= "\t\t\t" . '<input type="checkbox" id="' . esc_attr( $key ) . '" name="' . esc_attr( $key ) . '" class="checkbox" onclick="' . esc_attr( $onclick ) . '"' . $checked . ' value="1" tabindex="' . $this->tabindex . '" />' . "\n";
+		if ( isset( $data['label'] ) ) {
+			$r .= "\t\t\t" . $data['label'] . "\n";
+		}
+		$r .= "\t\t" . '</span>' . "\n";
+
+		if ( isset( $data['note'] ) ) {
+			$r .= "\t\t" . '<a class="note-toggle" href="javascript:void(0);" onclick="toggleNote(\'note-' . esc_attr( $key ) . '\');">?</a>' . "\n";
+			$r .= "\t\t" . '<p id="note-' . esc_attr( $key ) . '" class="note" style="display:none">' . $data['note'] . '</p>' . "\n";
+		}
+
+		$r .= "\t\t" . '<div class="clear"></div>' . "\n";
+		$r .= "\t" . '</label>' . "\n";
+
+		echo $r;
+	}
+
+	/**
+	 * Prints the input buttons which post each step and optionally go back a step.
+	 *
+	 * @param string $forward The HTML element ID of the forward button.
+	 * @param string $back Optional. The HTML element ID of the back button.
+	 * @return void
+	 **/
+	function input_buttons( $forward, $back = false, $step = false )
+	{
+		$data_back = $back ? $this->data[$this->step]['form'][$back] : false;
+		$data_forward = $this->data[$this->step]['form'][$forward];
+
+		$r = '<fieldset class="buttons">' . "\n";
+
+		if ( !$step ) {
+			$step = $this->step;
+		}
+		$r .= "\t" . '<input type="hidden" id="step" name="step" value="' . (int) $step . '" />' . "\n";
+
+		if ( $back) {
+			$r .= "\t" . '<label id="label-' . esc_attr( $back ) . '" for="' . esc_attr( $back ) . '" class="back">' . "\n";
+			$this->tabindex++;
+			$r .= "\t\t" . '<input type="submit" id="' . esc_attr( $back ) . '" name="' . esc_attr( $back ) . '" class="button" value="' . esc_attr( $data_back['value'] ) . '" tabindex="' . $this->tabindex . '" />' . "\n";
+			$r .= "\t" . '</label>' . "\n";
+		}
+
+		$r .= "\t" . '<label id="label-' . esc_attr( $forward ) . '" for="' . esc_attr( $forward ) . '" class="forward">' . "\n";
+		$this->tabindex++;
+		$r .= "\t\t" . '<input type="submit" id="' . esc_attr( $forward ) . '" name="' . esc_attr( $forward ) . '" class="button" value="' . esc_attr( $data_forward['value'] ) . '" tabindex="' . $this->tabindex . '" />' . "\n";
+		$r .= "\t" . '</label>' . "\n";
+
+		$r .= '</fieldset>' . "\n";
+
+		echo $r;
+	}
+
+	/**
+	 * Prints hidden input elements containing the data inputted in a given step.
+	 *
+	 * @param integer $step Optional. The number of the step whose hidden inputs should be printed.
+	 * @return void
+	 **/
+	function hidden_step_inputs( $step = false )
+	{
+		if ( !$step ) {
+			$step = $this->step;
+		} elseif ( $step !== $this->step ) {
+			$this->inject_form_values_into_data( $step );
+		}
+
+		$data = $this->data[$step]['form'];
+
+		$r = '<fieldset>' . "\n";
+
+		foreach ( $data as $key => $value ) {
+			if ( 'forward_' !== substr( $key, 0, 8 ) && 'back_' !== substr( $key, 0, 5 ) ) {
+				$r .= "\t" . '<input type="hidden" name="' . esc_attr( $key ) . '" value="' . esc_attr( $value['value'] ) . '" />' . "\n";
+			}
+		}
+
+		$r .= '</fieldset>' . "\n";
+
+		echo $r;
+	}
+
+	/**
+	 * Rewrites the admin user input into a select element containing existing WordPress administrators.
+	 *
+	 * @return boolean True if the select element was created, otherwise false.
+	 **/
+	function populate_keymaster_user_login_from_user_tables()
+	{
+		$data =& $this->data[3]['form']['keymaster_user_login'];
+
+		// Get the existing WordPress admin users
+
+		// Setup variables and constants if available
+		global $bb;
+		if ( !empty( $this->data[2]['form']['wp_table_prefix']['value'] ) ) {
+			$bb->wp_table_prefix = $this->data[2]['form']['wp_table_prefix']['value'];
+		}
+		if ( !empty( $this->data[2]['form']['user_bbdb_name']['value'] ) ) {
+			$bb->user_bbdb_name = $this->data[2]['form']['user_bbdb_name']['value'];
+		}
+		if ( !empty( $this->data[2]['form']['user_bbdb_user']['value'] ) ) {
+			$bb->user_bbdb_user = $this->data[2]['form']['user_bbdb_user']['value'];
+		}
+		if ( !empty( $this->data[2]['form']['user_bbdb_password']['value'] ) ) {
+			$bb->user_bbdb_password = $this->data[2]['form']['user_bbdb_password']['value'];
+		}
+		if ( !empty( $this->data[2]['form']['user_bbdb_host']['value'] ) ) {
+			$bb->user_bbdb_host = $this->data[2]['form']['user_bbdb_host']['value'];
+		}
+		if ( !empty( $this->data[2]['form']['user_bbdb_charset']['value'] ) ) {
+			$bb->user_bbdb_charset = preg_replace( '/[^a-z0-9_-]/i', '', $this->data[2]['form']['user_bbdb_charset']['value'] );
+		}
+		if ( !empty( $this->data[2]['form']['user_bbdb_collate']['value'] ) ) {
+			$bb->user_bbdb_charset = preg_replace( '/[^a-z0-9_-]/i', '', $this->data[2]['form']['user_bbdb_collate']['value'] );
+		}
+		if ( !empty( $this->data[2]['form']['custom_user_table']['value'] ) ) {
+			$bb->custom_user_table = preg_replace( '/[^a-z0-9_-]/i', '', $this->data[2]['form']['custom_user_table']['value'] );
+		}
+		if ( !empty( $this->data[2]['form']['custom_user_meta_table']['value'] ) ) {
+			$bb->custom_user_meta_table = preg_replace( '/[^a-z0-9_-]/i', '', $this->data[2]['form']['custom_user_meta_table']['value'] );
+		}
+
+		global $bbdb;
+		global $bb_table_prefix;
+
+		// Resolve the custom user tables for bpdb
+		bb_set_custom_user_tables();
+
+		if ( isset( $bb->custom_databases ) && isset( $bb->custom_databases['user'] ) ) {
+			$bbdb->add_db_server( 'user', $bb->custom_databases['user'] );
+		}
+
+		// Add custom tables if required
+		if ( isset( $bb->custom_tables['users'] ) || isset( $bb->custom_tables['usermeta'] ) ) {
+			$bbdb->tables = array_merge( $bbdb->tables, $bb->custom_tables );
+			if ( is_wp_error( $bbdb->set_prefix( $bb_table_prefix ) ) ) {
+				die( __( 'Your user table prefix may only contain letters, numbers and underscores.' ) );
+			}
+		}
+
+		$bb_keymaster_meta_key       = $bbdb->escape( $bb_table_prefix . 'capabilities' );
+		$wp_administrator_meta_key   = $bbdb->escape( $bb->wp_table_prefix . 'capabilities' );
+		if ( !empty( $this->data[2]['form']['wordpress_mu_primary_blog_id']['value'] ) ) {
+			$wp_administrator_meta_key = $bb->wp_table_prefix . $this->data[2]['form']['wordpress_mu_primary_blog_id']['value'] . '_capabilities';
+		}
+
+		$keymaster_query = <<<EOQ
+			SELECT
+				user_login, user_email, display_name
+			FROM
+				$bbdb->users
+			LEFT JOIN
+				$bbdb->usermeta ON
+				$bbdb->users.ID = $bbdb->usermeta.user_id
+			WHERE
+				(
+					(
+						meta_key = '$wp_administrator_meta_key' AND
+						meta_value LIKE '%administrator%'
+					) OR
+					(
+						meta_key = '$bb_keymaster_meta_key' AND
+						meta_value LIKE '%keymaster%'
+					)
+				) AND
+				user_email IS NOT NULL AND
+				user_email != ''
+			ORDER BY
+				user_login;
+EOQ;
+		$bbdb->suppress_errors();
+
+		if ( $keymasters = $bbdb->get_results( $keymaster_query, ARRAY_A ) ) {
+
+			$bbdb->suppress_errors( false );
+
+			if ( count( $keymasters ) ) {
+				$email_maps = '';
+				$data['options']  = array();
+				$data['onchange'] = 'changeKeymasterEmail( this, \'keymaster_user_email\' );';
+				$data['note']     = __( 'Please select an existing bbPress Keymaster or WordPress administrator.' );
+
+				$data['options'][''] = '';
+				foreach ( $keymasters as $keymaster ) {
+					$email_maps .= 'emailMap[\'' . $keymaster['user_login'] . '\'] = \'' . $keymaster['user_email'] . '\';' . "\n\t\t\t\t\t\t\t\t";
+					if ( $keymaster['display_name'] ) {
+						$data['options'][$keymaster['user_login']] = $keymaster['user_login'] . ' (' . $keymaster['display_name'] . ')';
+					} else {
+						$data['options'][$keymaster['user_login']] = $keymaster['user_login'];
+					}
+				}
+
+				$this->strings[3]['scripts']['changeKeymasterEmail'] = <<<EOS
+						<script type="text/javascript" charset="utf-8">
+							function changeKeymasterEmail( selectObj, target ) {
+								var emailMap = new Array;
+								emailMap[''] = '';
+								$email_maps
+								var targetObj = document.getElementById( target );
+								var selectedAdmin = selectObj.options[selectObj.selectedIndex].value;
+								targetObj.value = emailMap[selectedAdmin];
+							}
+						</script>
+EOS;
+
+				$this->data[3]['form']['keymaster_user_type']['value'] = 'old';
+
+				return true;
+			}
+		}
+
+		$bbdb->suppress_errors( false );
+
+		return false;
+	}
+
+	/**
+	 * Sends HTTP headers and prints the page header.
+	 *
+	 * @return void
+	 **/
+	function header()
+	{
+		nocache_headers();
+
+		bb_install_header( $this->strings[$this->step]['title'], $this->strings[$this->step]['h1'], true );
+	}
+
+	/**
+	 * Prints the page footer.
+	 *
+	 * @return void
+	 **/
+	function footer()
+	{
+		bb_install_footer();
+	}
+
+	/**
+	 * Prints the returned messages for the current step.
+	 *
+	 * @return void
+	 **/
+	function messages()
+	{
+		if ( isset( $this->strings[$this->step]['messages'] ) ) {
+			$messages = $this->strings[$this->step]['messages'];
+
+			// This count works as long as $messages is only two-dimensional
+			$count = ( count( $messages, COUNT_RECURSIVE ) - count( $messages ) );
+			$i = 0;
+			$r = '';
+			foreach ( $messages as $type => $paragraphs ) {
+				$class = $type ? $type : '';
+
+				foreach ( $paragraphs as $paragraph ) {
+					$i++;
+					$class = ( $i === $count ) ? ( $class . ' last' ) : $class;
+					$r .= '<p class="' . esc_attr( $class ) . '">' . $paragraph . '</p>' . "\n";
+				}
+			}
+			echo $r;
+		}
+	}
+
+	/**
+	 * Prints the introduction paragraphs for the current step.
+	 *
+	 * @return void
+	 **/
+	function intro()
+	{
+		if ( 'incomplete' == $this->step_status[$this->step] && isset( $this->strings[$this->step]['intro'] ) ) {
+			$messages = $this->strings[$this->step]['intro'];
+			$count = count( $messages );
+			$i = 0;
+			$r = '';
+			foreach ( $messages as $paragraph ) {
+				$i++;
+				$class = ( $i === $count ) ? 'intro last' : 'intro';
+				$r .= '<p class="' . $class . '">' . $paragraph . '</p>' . "\n";
+			}
+			echo $r;
+		}
+	}
+
+	/**
+	 * Prints the standard header for each step.
+	 *
+	 * @param integer $step The number of the step whose header should be printed.
+	 * @return void
+	 **/
+	function step_header( $step )
+	{
+		$class = ( $step == $this->step ) ? 'open' : 'closed';
+
+		$r = '<div id="' . esc_attr( 'step' . $step ) . '" class="' . $class . '">' . "\n";
+		$r .= '<h2 class="' . $class . '">' . $this->strings[$step]['h2'] . '</h2>' . "\n";
+		$r .= '<div>' . "\n";
+
+		if ( $step < $this->step && $this->strings[$step]['status'] ) {
+			$r .= '<p class="status">' . $this->strings[$step]['status'] . '</p>' . "\n";
+		}
+
+		echo $r;
+
+		if ( $step == $this->step ) {
+			$this->intro();
+		}
+
+		$this->tabindex = 0;
+	}
+
+	/**
+	 * Prints the standard step footer.
+	 *
+	 * @return void
+	 **/
+	function step_footer()
+	{
+		$r = '</div></div>' . "\n";
+
+		echo $r;
+	}
+} // END class BB_Install
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/defaults.bb-htaccess.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/defaults.bb-htaccess.php
new file mode 100644
index 0000000000000000000000000000000000000000..25a3f8ef0b50d02ea25ac5afc31fe36e5154a6f6
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/defaults.bb-htaccess.php
@@ -0,0 +1,46 @@
+<?php
+
+$_rules = <<<EOF
+# BEGIN bbPress
+
+Options -MultiViews
+
+<IfModule mod_rewrite.c>
+RewriteEngine On
+RewriteBase %PATH%
+
+RewriteRule ^page/([0-9]+)/?$ %PATH%index.php?page=$1 [L,QSA]
+RewriteRule ^forum/([^/]+)/page/([0-9]+)/?$ %PATH%forum.php?id=$1&page=$2 [L,QSA]
+RewriteRule ^forum/([^/]+)/?$ %PATH%forum.php?id=$1 [L,QSA]
+RewriteRule ^forum/?$ %PATH% [R=302,L,QSA]
+RewriteRule ^topic/([^/]+)/page/([0-9]+)/?$ %PATH%topic.php?id=$1&page=$2 [L,QSA]
+RewriteRule ^topic/([^/]+)/?$ %PATH%topic.php?id=$1 [L,QSA]
+RewriteRule ^topic/?$ %PATH% [R=302,L,QSA]
+RewriteRule ^tags/([^/]+)/page/([0-9]+)/?$ %PATH%tags.php?tag=$1&page=$2 [L,QSA]
+RewriteRule ^tags/([^/]+)/?$ %PATH%tags.php?tag=$1 [L,QSA]
+RewriteRule ^tags/?$ %PATH%tags.php [L,QSA]
+RewriteRule ^profile/([^/]+)/page/([0-9]+)/?$ %PATH%profile.php?id=$1&page=$2 [L,QSA]
+RewriteRule ^profile/([^/]+)/([^/]+)/?$ %PATH%profile.php?id=$1&tab=$2 [L,QSA]
+RewriteRule ^profile/([^/]+)/([^/]+)/page/([0-9]+)/?$ %PATH%profile.php?id=$1&tab=$2&page=$3 [L,QSA]
+RewriteRule ^profile/([^/]+)/?$ %PATH%profile.php?id=$1 [L,QSA]
+RewriteRule ^profile/?$ %PATH%profile.php [L,QSA]
+RewriteRule ^view/([^/]+)/page/([0-9]+)/?$ %PATH%view.php?view=$1&page=$2 [L,QSA]
+RewriteRule ^view/([^/]+)/?$ %PATH%view.php?view=$1 [L,QSA]
+RewriteRule ^rss/?$ %PATH%rss.php [L,QSA]
+RewriteRule ^rss/topics/?$ %PATH%rss.php?topics=1 [L,QSA]
+RewriteRule ^rss/forum/([^/]+)/?$ %PATH%rss.php?forum=$1 [L,QSA]
+RewriteRule ^rss/forum/([^/]+)/topics/?$ %PATH%rss.php?forum=$1&topics=1 [L,QSA]
+RewriteRule ^rss/topic/([^/]+)/?$ %PATH%rss.php?topic=$1 [L,QSA]
+RewriteRule ^rss/tags/([^/]+)/?$ %PATH%rss.php?tag=$1 [L,QSA]
+RewriteRule ^rss/tags/([^/]+)/topics/?$ %PATH%rss.php?tag=$1&topics=1 [L,QSA]
+RewriteRule ^rss/profile/([^/]+)/?$ %PATH%rss.php?profile=$1 [L,QSA]
+RewriteRule ^rss/view/([^/]+)/?$ %PATH%rss.php?view=$1 [L,QSA]
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteRule ^.*$ %PATH%index.php [L]
+</IfModule>
+
+# END bbPress
+EOF;
+
+$_rules = str_replace( '%PATH%', bb_get_option( 'path' ), $_rules );
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/defaults.bb-schema.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/defaults.bb-schema.php
new file mode 100644
index 0000000000000000000000000000000000000000..81c3ae03ea80ad2307257722f2812e85f45f97fa
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/defaults.bb-schema.php
@@ -0,0 +1,219 @@
+<?php
+
+// Globalise as this file is included within the functions bb_install() and bb_upgrade_all()
+global $bb_queries, $bbdb, $bb_schema_ignore;
+
+// Die if no database class is loaded
+if ( !isset($bbdb) || ( !is_a( $bbdb, 'BPDB' ) && !is_a( $bbdb, 'db' ) ) )
+	die( __('Database class not loaded.') );
+
+// Initialise the query array
+$bb_queries = array();
+
+// forums
+$bb_queries['forums'] = "CREATE TABLE IF NOT EXISTS `$bbdb->forums` (
+	`forum_id` int(10) NOT NULL auto_increment,
+	`forum_name` varchar(150) NOT NULL default '',
+	`forum_slug` varchar(255) NOT NULL default '',
+	`forum_desc` text NOT NULL,
+	`forum_parent` int(10) NOT NULL default 0,
+	`forum_order` int(10) NOT NULL default 0,
+	`topics` bigint(20) NOT NULL default 0,
+	`posts` bigint(20) NOT NULL default 0,
+	PRIMARY KEY (`forum_id`),
+	KEY `forum_slug` (`forum_slug`)
+);";
+
+// meta
+$bb_queries['meta'] = "CREATE TABLE IF NOT EXISTS `$bbdb->meta` (
+	`meta_id` bigint(20) NOT NULL auto_increment,
+	`object_type` varchar(16) NOT NULL default 'bb_option',
+	`object_id` bigint(20) NOT NULL default 0,
+	`meta_key` varchar(255) default NULL,
+	`meta_value` longtext default NULL,
+	PRIMARY KEY (`meta_id`),
+	KEY `object_type__meta_key` (`object_type`, `meta_key`),
+	KEY `object_type__object_id__meta_key` (`object_type`, `object_id`, `meta_key`)
+);";
+
+// posts
+$bb_queries['posts'] = "CREATE TABLE IF NOT EXISTS `$bbdb->posts` (
+	`post_id` bigint(20) NOT NULL auto_increment,
+	`forum_id` int(10) NOT NULL default 1,
+	`topic_id` bigint(20) NOT NULL default 1,
+	`poster_id` int(10) NOT NULL default 0,
+	`post_text` text NOT NULL,
+	`post_time` datetime NOT NULL default '0000-00-00 00:00:00',
+	`poster_ip` varchar(15) NOT NULL default '',
+	`post_status` tinyint(1) NOT NULL default 0,
+	`post_position` bigint(20) NOT NULL default 0,
+	PRIMARY KEY (`post_id`),
+	KEY `topic_time` (`topic_id`, `post_time`),
+	KEY `poster_time` (`poster_id`, `post_time`),
+	KEY `post_time` (`post_time`),
+	FULLTEXT KEY `post_text` (`post_text`)
+) TYPE = MYISAM;";
+
+// terms
+$bb_queries['terms'] = "CREATE TABLE IF NOT EXISTS `$bbdb->terms` (
+	`term_id` bigint(20) NOT NULL auto_increment,
+	`name` varchar(55) NOT NULL default '',
+	`slug` varchar(200) NOT NULL default '',
+	`term_group` bigint(10) NOT NULL default 0,
+	PRIMARY KEY (`term_id`),
+	UNIQUE KEY `slug` (`slug`),
+	KEY name (name)
+);";
+
+// term_relationships
+$bb_queries['term_relationships'] = "CREATE TABLE IF NOT EXISTS `$bbdb->term_relationships` (
+	`object_id` bigint(20) NOT NULL default 0,
+	`term_taxonomy_id` bigint(20) NOT NULL default 0,
+	`user_id` bigint(20) NOT NULL default 0,
+	`term_order` int(11) NOT NULL default 0,
+	PRIMARY KEY (`object_id`, `term_taxonomy_id`),
+	KEY `term_taxonomy_id` (`term_taxonomy_id`)
+);";
+
+// term_taxonomy
+$bb_queries['term_taxonomy'] = "CREATE TABLE IF NOT EXISTS `$bbdb->term_taxonomy` (
+	`term_taxonomy_id` bigint(20) NOT NULL auto_increment,
+	`term_id` bigint(20) NOT NULL default 0,
+	`taxonomy` varchar(32) NOT NULL default '',
+	`description` longtext NOT NULL,
+	`parent` bigint(20) NOT NULL default 0,
+	`count` bigint(20) NOT NULL default 0,
+	PRIMARY KEY (`term_taxonomy_id`),
+	UNIQUE KEY `term_id_taxonomy` (`term_id`, `taxonomy`),
+	KEY `taxonomy` (`taxonomy`)
+);";
+
+// topics
+$bb_queries['topics'] = "CREATE TABLE IF NOT EXISTS `$bbdb->topics` (
+	`topic_id` bigint(20) NOT NULL auto_increment,
+	`topic_title` varchar(100) NOT NULL default '',
+	`topic_slug` varchar(255) NOT NULL default '',
+	`topic_poster` bigint(20) NOT NULL default 0,
+	`topic_poster_name` varchar(40) NOT NULL default 'Anonymous',
+	`topic_last_poster` bigint(20) NOT NULL default 0,
+	`topic_last_poster_name` varchar(40) NOT NULL default '',
+	`topic_start_time` datetime NOT NULL default '0000-00-00 00:00:00',
+	`topic_time` datetime NOT NULL default '0000-00-00 00:00:00',
+	`forum_id` int(10) NOT NULL default 1,
+	`topic_status` tinyint(1) NOT NULL default 0,
+	`topic_open` tinyint(1) NOT NULL default 1,
+	`topic_last_post_id` bigint(20) NOT NULL default 1,
+	`topic_sticky` tinyint(1) NOT NULL default 0,
+	`topic_posts` bigint(20) NOT NULL default 0,
+	`tag_count` bigint(20) NOT NULL default 0,
+	PRIMARY KEY (`topic_id`),
+	KEY `topic_slug` (`topic_slug`),
+	KEY `forum_time` (`forum_id`, `topic_time`),
+	KEY `user_start_time` (`topic_poster`, `topic_start_time`),
+	KEY `stickies` (`topic_status`, `topic_sticky`, `topic_time`)
+);";
+
+// users - 'user_login', 'user_nicename' and 'user_registered' indices are inconsistent with WordPress
+$bb_queries['users'] = "CREATE TABLE IF NOT EXISTS `$bbdb->users` (
+	`ID` bigint(20) unsigned NOT NULL auto_increment,
+	`user_login` varchar(60) NOT NULL default '',
+	`user_pass` varchar(64) NOT NULL default '',
+	`user_nicename` varchar(50) NOT NULL default '',
+	`user_email` varchar(100) NOT NULL default '',
+	`user_url` varchar(100) NOT NULL default '',
+	`user_registered` datetime NOT NULL default '0000-00-00 00:00:00',
+	`user_status` int(11) NOT NULL default 0,
+	`display_name` varchar(250) NOT NULL default '',
+	PRIMARY KEY (`ID`),
+	UNIQUE KEY `user_login` (`user_login`),
+	UNIQUE KEY `user_nicename` (`user_nicename`),
+	KEY `user_registered` (`user_registered`)
+);";
+
+// usermeta
+$bb_queries['usermeta'] = "CREATE TABLE IF NOT EXISTS `$bbdb->usermeta` (
+	`umeta_id` bigint(20) NOT NULL auto_increment,
+	`user_id` bigint(20) NOT NULL default 0,
+	`meta_key` varchar(255),
+	`meta_value` longtext,
+	PRIMARY KEY (`umeta_id`),
+	KEY `user_id` (`user_id`),
+	KEY `meta_key` (`meta_key`)
+);";
+
+$bb_queries = apply_filters( 'bb_schema_pre_charset', $bb_queries );
+
+// Set the charset and collation on each table
+foreach ($bb_queries as $_table_name => $_sql) {
+	// Skip SQL that isn't creating a table
+	if (!preg_match('@^\s*CREATE\s+TABLE\s+@im', $_sql)) {
+		continue;
+	}
+	
+	// Skip if the table's database doesn't support collation
+	if (!$bbdb->has_cap('collation', $bbdb->$_table_name)) {
+		continue;
+	}
+	
+	// Find out if the table has a custom database set
+	if (
+		isset($bbdb->db_tables) &&
+		is_array($bbdb->db_tables) &&
+		isset($bbdb->db_tables[$bbdb->$_table_name])
+	) {
+		// Set the database for this table
+		$_database = $bbdb->db_tables[$bbdb->$_table_name];
+	} else {
+		// Set the default global database
+		$_database = 'dbh_global';
+	}
+	
+	// Make sure the database exists
+	if (
+		isset($bbdb->db_servers) &&
+		is_array($bbdb->db_servers) &&
+		isset($bbdb->db_servers[$_database]) &&
+		is_array($bbdb->db_servers[$_database])
+	) {
+		$_charset_collate = '';
+		if (isset($bbdb->db_servers[$_database]['charset']) && !empty($bbdb->db_servers[$_database]['charset'])) {
+			// Add a charset if set
+			$_charset_collate .= ' DEFAULT CHARACTER SET \'' . $bbdb->db_servers[$_database]['charset'] . '\'';
+		}
+		if (isset($bbdb->db_servers[$_database]['collate']) && !empty($bbdb->db_servers[$_database]['collate'])) {
+			// Add a collation if set
+			$_charset_collate .= ' COLLATE \'' . $bbdb->db_servers[$_database]['collate'] . '\'';
+		}
+		if ($_charset_collate) {
+			// Modify the SQL
+			$bb_queries[$_table_name] = str_replace(';', $_charset_collate . ';', $_sql);
+		}
+	}
+	unset($_database, $_charset_collate);
+}
+unset($_table_name, $_sql);
+
+$bb_queries = apply_filters( 'bb_schema', $bb_queries );
+
+// These elements in the schema may need to be ignored when doing comparisons due to inconsistencies with WordPress
+if ( bb_get_option('wp_table_prefix') || ( defined( 'BB_SCHEMA_IGNORE_WP_USERS_KEYS' ) && BB_SCHEMA_IGNORE_WP_USERS_KEYS ) ) {
+	$bb_schema_ignore = array(
+		'tables' => array(),
+		'columns' => array(),
+		'indices' => array(
+			$bbdb->users => array(
+				'user_login',
+				'user_nicename',
+				'user_registered'
+			)
+		)
+	);
+} else {
+	$bb_schema_ignore = false;
+}
+
+$bb_schema_ignore = apply_filters( 'bb_schema_ignore', $bb_schema_ignore );
+
+do_action( 'bb_schema_defined' );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/functions.bb-admin.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/functions.bb-admin.php
new file mode 100644
index 0000000000000000000000000000000000000000..d341861cf074a915535879e86c61ca7fc6191175
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/functions.bb-admin.php
@@ -0,0 +1,1432 @@
+<?php
+
+function bb_get_admin_header()
+{
+	do_action( 'bb_admin-header.php' );
+	include( 'admin-header.php' );
+	do_action( 'bb_get_admin_header' );
+}
+
+function bb_get_admin_footer()
+{
+	do_action( 'bb_admin-footer.php' );
+	include( 'admin-footer.php' );
+}
+
+function bb_admin_notice( $message, $class = false )
+{
+	if ( is_string( $message ) ) {
+		$message = '<p>' . $message . '</p>';
+		$class = $class ? $class : 'updated';
+	} elseif ( is_wp_error( $message ) ) {
+		$errors = $message->get_error_messages();
+		switch ( count( $errors ) ) {
+			case 0:
+				return false;
+				break;
+			case 1:
+				$message = '<p>' . $errors[0] . '</p>';
+				break;
+			default:
+				$message = '<ul>' . "\n\t" . '<li>' . join( '</li>' . "\n\t" . '<li>', $errors ) . '</li>' . "\n" . '</ul>';
+				break;
+		}
+		$class = $class ? $class : 'error';
+	} else {
+		return false;
+	}
+
+	$message = '<div id="message" class="' . esc_attr( $class ) . '">' . $message . '</div>';
+	$message = str_replace( "'", "\'", $message );
+	$lambda = create_function( '', "echo '$message';" );
+	add_action( 'bb_admin_notices', $lambda );
+	return $lambda;
+}
+
+/* Menu */
+
+function bb_admin_menu_generator()
+{
+	global $bb_menu, $bb_submenu;
+	$bb_menu = array();
+	$bb_submenu = array();
+
+	// Dashboard menu items < 50
+	$bb_menu[0]  = array( __( 'Dashboard' ), 'moderate', 'index.php', '', 'bb-menu-dashboard' );
+		$bb_submenu['index.php'][5]   = array( __( 'Dashboard' ), 'moderate', 'index.php' );
+
+	// 50 < Plugin added menu items < 100
+
+	$bb_menu[100] = array( '', 'read', 'separator' );
+
+	// 100 < Plugin added menu items < 150
+
+	// 150 < First menu items < 200
+	$bb_menu[150] = array( __( 'Forums' ), 'manage_forums', 'forums.php', '', 'bb-menu-forums' );
+		$bb_submenu['forums.php'][5]   = array( __( 'Forums' ), 'manage_forums', 'forums.php' );
+	$bb_menu[155] = array( __( 'Topics' ), 'moderate', 'topics.php', '', 'bb-menu-topics' );
+		$bb_submenu['topics.php'][5]   = array( __( 'Topics' ), 'moderate', 'topics.php' );
+	$bb_menu[160] = array( __( 'Posts' ), 'moderate', 'posts.php', '', 'bb-menu-posts' );
+		$bb_submenu['posts.php'][5]   = array( __( 'Posts' ), 'moderate', 'posts.php' );
+
+	// 200 < Plugin added menu items < 250
+
+	$bb_menu[250] = array( '', 'read', 'separator' );
+
+	// 250 < Plugin added menu items < 300
+
+	// 300 < Second menu items < 350
+	$bb_menu[300] = array( __( 'Appearance' ), 'manage_themes', 'themes.php', '', 'bb-menu-appearance' );
+		$bb_submenu['themes.php'][5]   = array(__('Themes'), 'manage_themes', 'themes.php');
+	$bb_menu[305] = array( __( 'Plugins' ), 'use_keys', 'plugins.php', '', 'bb-menu-plugins' );
+		$bb_submenu['plugins.php'][5]  = array( __( 'Installed' ), 'manage_plugins', 'plugins.php' );
+	$bb_menu[310] = array( __( 'Users' ), 'moderate', 'users.php', '', 'bb-menu-users' );
+		$bb_submenu['users.php'][5]  = array( __( 'Users' ), 'moderate', 'users.php' );
+	$bb_menu[315] = array( __( 'Tools' ), 'recount', 'tools-recount.php', '', 'bb-menu-tools' );
+		$bb_submenu['tools-recount.php'][5] = array( __( 'Re-count' ), 'recount', 'tools-recount.php' );
+	$bb_menu[320] = array( __( 'Settings' ), 'manage_options', 'options-general.php', '', 'bb-menu-settings' );
+		$bb_submenu['options-general.php'][5]  = array( __( 'General' ), 'manage_options', 'options-general.php' );
+		//$bb_submenu['options-general.php'][10] = array( __( 'Date and Time' ), 'manage_options', 'options-time.php' );
+		$bb_submenu['options-general.php'][15] = array( __( 'Writing' ), 'manage_options', 'options-writing.php' );
+		$bb_submenu['options-general.php'][20] = array( __( 'Reading' ), 'manage_options', 'options-reading.php' );
+		$bb_submenu['options-general.php'][25] = array( __( 'Discussion' ), 'manage_options', 'options-discussion.php' );
+		$bb_submenu['options-general.php'][30] = array( __( 'Permalinks' ), 'manage_options', 'options-permalinks.php' );
+		$bb_submenu['options-general.php'][35] = array( __( 'WordPress Integration' ), 'manage_options', 'options-wordpress.php' );
+
+	// 350 < Plugin added menu items
+
+	do_action( 'bb_admin_menu_generator' );
+	ksort( $bb_menu );
+
+	$last_key = false;
+	foreach ( $bb_menu as $key => $m ) {
+		if ( $last_key === false || $bb_menu[$last_key][2] === 'separator' ) {
+			$bb_menu[$key][3] .= ' bb-menu-first';
+		}
+		if ( $bb_menu[$key][2] === 'separator' ) {
+			$bb_menu[$last_key][3] .= ' bb-menu-last';
+		}
+		$last_key = $key;
+		if ( isset( $bb_submenu[$m[2]] ) ) {
+			ksort( $bb_submenu[$m[2]] );
+		}
+	}
+	$bb_menu[$last_key][3] .= ' bb-menu-last';
+}
+
+function bb_admin_add_menu( $display_name, $capability, $file_name, $menu_position = false, $class = '', $id = '' )
+{
+	global $bb_menu;
+
+	if ( $display_name && $capability && $file_name ) {
+		// Get an array of the keys
+		$menu_keys = array_keys( $bb_menu );
+
+		if ( $menu_position ) {
+			if ( is_numeric( $menu_position ) ) {
+				if ( !isset( $bb_menu[$menu_position] ) ) {
+					$plugin_menu_next = $menu_position;
+				} else {
+					return bb_admin_add_menu( $display_name, $capability, $file_name, ( $menu_position + 1 ), $class, $id );
+				}
+			} else {
+				// Set the bounds for different menu groups (main or side)
+				switch ( $menu_position ) {
+					case 'dash':
+						$lower = 50;
+						$upper = 100;
+						break;
+					case 'main':
+						$lower = 200;
+						$upper = 250;
+						break;
+					default:
+						$lower = 350;
+						$upper = 500;
+						break;
+				}
+
+				// Get an array of all plugin added keys
+				$plugin_menu_keys = array_filter( $menu_keys, create_function( '$v', 'if ($v >= ' . $lower . ' && $v < ' . $upper . ') { return $v; }' ) );
+
+				// If there is an array of keys
+				if ( is_array( $plugin_menu_keys ) && count( $plugin_menu_keys ) ) {
+					// Get the highest key value and add one
+					$plugin_menu_next = max( $plugin_menu_keys ) + 1;
+				} else {
+					// It's the first one
+					$plugin_menu_next = $lower;
+				}
+			}
+		} else {
+			$plugin_menu_next = max( array_keys( $bb_menu ) ) + 1;
+			$bb_menu[$plugin_menu_next] = array( '', 'read', 'separator' );
+			$plugin_menu_next++;
+		}
+
+		// Add the menu item at the given key
+		$bb_menu[$plugin_menu_next] = array( $display_name, $capability, $file_name, $class, $id );
+
+		ksort( $bb_menu );
+
+		return $plugin_menu_next;
+	}
+
+	return false;
+}
+
+function bb_admin_add_submenu( $display_name, $capability, $file_name, $parent = 'plugins.php' )
+{
+	global $bb_submenu;
+	if ( $display_name && $capability && $file_name ) {
+		$bb_submenu[$parent][] = array( $display_name, $capability, $file_name );
+		ksort( $bb_submenu );
+	}
+}
+
+function bb_get_current_admin_menu()
+{
+	global $bb_menu, $bb_submenu, $bb_admin_page, $bb_current_menu, $bb_current_submenu;
+	foreach ( $bb_submenu as $m => $b ) {
+		foreach ( $b as $s ) {
+			if ( $s[2] == $bb_admin_page ) {
+				$bb_current_submenu = $s;
+				$bb_current_menu = $m;
+				break;
+			}
+		}
+	}
+	if ( !isset($bb_current_menu) ) {
+		$bb_current_menu = $bb_menu[0];
+		$bb_current_submenu = $bb_submenu['index.php'][5];
+	} else {
+		foreach ( $bb_menu as $m ) {
+			if ( $m[2] == $bb_current_menu ) {
+				$bb_current_menu = $m;
+				break;
+			}
+		}
+	}
+	if ( $bb_current_submenu && !bb_current_user_can( $bb_current_submenu[1] ) || !bb_current_user_can( $bb_current_menu[1] ) ) {
+		wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
+		exit;
+	}
+}
+
+function bb_admin_title()
+{
+	global $bb_current_menu, $bb_current_submenu;
+
+	$title = $bb_current_menu[0] . ' &lsaquo; ' . bb_get_option( 'name' ) . ' &#8212; ' . __( 'bbPress' );
+
+	if ( $bb_current_submenu && $bb_current_submenu[0] !== $bb_current_menu[0] ) {
+		$title = $bb_current_submenu[0] . ' &lsaquo; ' . $title;
+	}
+
+	echo esc_html( $title );
+}
+
+function bb_admin_menu()
+{
+	global $bb_menu, $bb_submenu, $bb_current_menu, $bb_current_submenu;
+
+	if ( !is_array( $bb_menu ) || !count( $bb_menu ) ) {
+		return '';
+	}
+
+	$r = "\t\t\t" . '<ul id="bbAdminMenu">' . "\n";
+
+	foreach ( $bb_menu as $key => $m ) {
+		if ( !bb_current_user_can( $m[1] ) ) {
+			continue;
+		}
+		$class = 'bb-menu';
+		if ( isset( $m[3] ) ) {
+			$class .= ' ' . $m[3];
+		}
+		$id = '';
+		if ( isset( $m[4] ) ) {
+			$id .= ' id="' . $m[4] . '"';
+		}
+		$m[0] = esc_html( $m[0] );
+		if ( $m[2] === 'separator' ) {
+			if ( 'f' == bb_get_user_setting( 'fm' ) ) {
+				$href = '?foldmenu=0';
+			} else {
+				$href = '?foldmenu=1';
+			}
+			$m[0] = '<br />';
+			$class .= ' bb-menu-separator';
+		} elseif ( strpos( $m[2], 'http://' ) === 0 || strpos( $m[2], 'https://' ) === 0 ) {
+			$href = esc_url( $m[2] );
+			$class .= ' bb-menu-external';
+		} else {
+			$href = esc_url( bb_get_option( 'path' ) . 'bb-admin/' . bb_get_admin_tab_link( $m[2] ) );
+		}
+		if ( $m[2] == $bb_current_menu[2] ) {
+			$class .= ' bb-menu-current';
+		}
+
+		$sr = '';
+		if ( $m[2] !== 'separator' && isset( $bb_submenu[$m[2]] ) && is_array( $bb_submenu[$m[2]] ) && count( $bb_submenu[$m[2]] ) ) {
+			$sr .= "\t\t\t\t\t" . '<div class="bb-menu-sub-wrap"><span>' . $m[0] . '</span>' . "\n";
+			$sr .= "\t\t\t\t\t\t" . '<ul>' . "\n";
+			$sc = 0;
+			foreach ( $bb_submenu[$m[2]] as $skey => $sm ) {
+				if ( $sc === 0 && $sm[2] === $m[2] ) {
+					$no_submenu = true;
+				}
+				if ( $sc > 0 ) {
+					$no_submenu = false;
+				}
+				$sc++;
+				$sclass = 'bb-menu-sub';
+				if ( isset( $sm[3] ) ) {
+					$sclass .= ' ' . $sm[3];
+				}
+				if ( strpos( $sm[2], 'http://' ) === 0 || strpos( $sm[2], 'https://' ) === 0 ) {
+					$shref = $sm[2];
+					$sclass .= ' bb-menu-external';
+				} else {
+					$shref = bb_get_option( 'path' ) . 'bb-admin/' . bb_get_admin_tab_link( $sm[2] );
+				}
+				if ( $sm[2] == $bb_current_submenu[2] ) {
+					$sclass .= ' bb-menu-sub-current';
+				}
+				$sr .= "\t\t\t\t\t\t\t" . '<li class="' . esc_attr( trim( $sclass ) ) . '"><a href="' . esc_url( $shref ) . '">' . esc_html( $sm[0] ) . '</a></li>' . "\n";
+			}
+			$sr .= "\t\t\t\t\t\t" . '</ul>' . "\n";
+			$sr .= "\t\t\t\t\t" . '</div>' . "\n";
+		}
+
+		if ( $sr && !$no_submenu ) {
+			$class .= ' bb-menu-has-submenu';
+			if ( $m[2] == $bb_current_menu[2] ) {
+				$class .= ' bb-menu-open';
+			}
+		}
+
+		$r .= "\t\t\t\t" . '<li' . $id . ' class="' . esc_attr( trim( $class ) ) . '"><a href="' . $href . '">';
+
+		if ( $m[2] !== 'separator' ) {
+			$r .= '<div class="bb-menu-icon"></div>';
+		}
+
+		$r .= '<span>' . $m[0] . '</span></a>' . "\n";
+
+		if ( $sr && !$no_submenu ) {
+			$r .= '<div class="bb-menu-toggle"></div>';
+			$r .= $sr;
+		}
+
+		$r .= "\t\t\t\t" . '</li>' . "\n";
+	}
+
+	$r .= "\t\t\t" . '</ul>' . "\n";
+
+	echo $r;
+}
+
+function bb_get_admin_tab_link( $tab )
+{
+	if ( is_array( $tab ) ) {
+		$tab = $tab[2];
+	}
+	if ( strpos( $tab, '.php' ) !== false ) {
+		return $tab;
+	} else {
+		return 'admin-base.php?plugin=' . $tab;
+	}
+}
+
+/* Stats */
+
+function bb_get_recently_moderated_objects( $num = 5 ) {
+	$post_query  = new BB_Query( 'post', array( 'per_page' => $num, 'post_status' => '-normal', 'topic_status' => 0 ) ); // post_time != moderation_time;
+	$topic_query = new BB_Query( 'topic', array( 'per_page' => $num, 'topic_status' => '-normal' ) ); // topic_time == topic_start_time != moderation_time;
+
+	$objects = array();
+	if ( $post_query->results )
+		foreach ( array_keys($post_query->results) as $key )
+			$objects[bb_gmtstrtotime($post_query->results[$key]->post_time)] = array('type' => 'post', 'data' => $post_query->results[$key]);
+	if ( $topic_query->results )
+		foreach ( array_keys($topic_query->results) as $key )
+			$objects[bb_gmtstrtotime($topic_query->results[$key]->topic_time)] = array('type' => 'topic', 'data' => $topic_query->results[$key]);
+	krsort($objects);
+	return array_slice($objects, 0, $num);
+}
+
+/* Users */
+
+// Not bbdb::prepared
+function bb_get_ids_by_role( $role = 'moderator', $sort = 0, $page = 1, $limit = 50 ) {
+	global $bbdb, $bb_last_countable_query;
+	$sort = $sort ? 'DESC' : 'ASC';
+	$key = $bbdb->escape( $bbdb->prefix . 'capabilities' );
+
+	if ( !$page = abs( (int) $page ) )
+		$page = 1;
+	$limit = abs( (int) $limit );
+
+	$limit = ($limit * ($page - 1)) . ", $limit";
+
+	$role = $bbdb->escape_deep($role);
+
+	if ( is_array($role) )
+		$and_where = "( meta_value LIKE '%" . join("%' OR meta_value LIKE '%", $role) . "%' )";
+	else
+		$and_where = "meta_value LIKE '%$role%'";
+	$bb_last_countable_query = "SELECT user_id FROM $bbdb->usermeta WHERE meta_key = '$key' AND $and_where ORDER BY user_id $sort LIMIT $limit";
+
+	$ids = false;
+
+	$_tuple = compact( 'ids', 'role', 'sort', 'page', 'key', 'limit', 'bb_last_countable_query' );
+	$_tuple = apply_filters( 'bb_get_ids_by_role', $_tuple );
+	extract( $_tuple, EXTR_OVERWRITE );
+
+	if ( !$ids ) {
+		$ids = (array) $bbdb->get_col( $bb_last_countable_query );
+	}
+
+	if ( $ids ) {
+		bb_cache_users( $ids );
+	}
+
+	return $ids;
+}
+
+function bb_user_row( $user, $role = '', $email = false ) {
+	$actions = "<a href='" . esc_attr( get_user_profile_link( $user->ID ) ) . "'>" . __('View') . "</a>";
+	if ( bb_current_user_can( 'edit_user', $user_id ) )
+		$actions .= " | <a href='" . esc_attr( get_profile_tab_link( $user->ID, 'edit' ) ) . "'>" . __('Edit') . "</a>";
+	$r  = "\t<tr id='user-$user->ID'" . get_alt_class("user-$role") . ">\n";
+	$r .= "\t\t<td class=\"user\">" . bb_get_avatar( $user->ID, 32 ) . "<span class=\"row-title\"><a href='" . get_user_profile_link( $user->ID ) . "'>" . get_user_name( $user->ID ) . "</a></span><div><span class=\"row-actions\">$actions</span>&nbsp;</div></td>\n";
+	$r .= "\t\t<td><a href='" . get_user_profile_link( $user->ID ) . "'>" . get_user_display_name( $user->ID ) . "</a></td>\n";
+	if ( $email ) {
+		$email = bb_get_user_email( $user->ID );
+		$r .= "\t\t<td><a href='mailto:$email'>$email</a></td>\n";
+	}
+	
+	$registered_time = bb_gmtstrtotime( $user->user_registered );
+	if ( $registered_time < ( time() - 86400 ) ) {
+		$time = date( 'Y/m/d\<\b\r \/\>H:i:s', bb_offset_time( $registered_time ) );
+	} else {
+		$time = sprintf( __( '%s ago' ), bb_since( $registered_time ) );
+	}
+	
+	$r .= "\t\t<td>" . $time . "</td>\n";
+	
+	if (
+		!isset($user->capabilities) ||
+		!is_array($user->capabilities) ||
+		empty($user->capabilities)
+	) {
+		$role = array( __('Inactive (no role)') );
+	} else {
+		global $wp_roles;
+		$_roles = $wp_roles->get_names();
+		$role = array();
+		foreach ( $user->capabilities as $cap => $cap_set ) {
+			if (!$cap_set) {
+				continue;
+			}
+			$role[] = $_roles[$cap];
+		}
+		if ( !count( $role ) ) {
+			$role[] = __('None');
+		}
+	}
+	
+	$r .= "\t\t<td>" . join(', ', $role) . "</td>\n\t</tr>";
+	return $r;
+}
+
+// BB_User_Search class
+// by Mark Jaquith
+
+class BB_User_Search {
+	var $results;
+	var $search_term;
+	var $page;
+	var $raw_page;
+	var $users_per_page = 50;
+	var $first_user;
+	var $last_user;
+	var $query_limit;
+	var $total_users_for_query = 0;
+	var $search_errors;
+	var $paging_text;
+	var $paging_text_bottom;
+
+	function BB_User_Search ($search_term = false, $page = 1, $roles = false ) { // constructor
+		$this->search_term = $search_term ? stripslashes($search_term) : false;
+		$this->raw_page = ( '' == $page ) ? false : (int) $page;
+		$page = (int) $page;
+		$this->page = $page < 2 ? 1 : $page;
+		$roles = (array) $roles;
+		$_roles = array();
+		foreach ( $roles as $role ) {
+			if ( false !== $role ) {
+				$_roles[] = stripslashes( $role );
+			}
+		}
+		$this->roles = empty( $_roles ) ? false : $_roles;
+
+		$this->prepare_query();
+		$this->query();
+		$this->prepare_vars_for_template_usage();
+		$this->do_paging();
+	}
+
+	function prepare_query() {
+		$this->first_user = ($this->page - 1) * $this->users_per_page;
+	}
+
+	function query() {
+		$users = bb_user_search( array(
+				'query' => $this->search_term,
+				'user_email' => true,
+				'users_per_page' => $this->users_per_page,
+				'page' => $this->page,
+				'roles' => $this->roles
+		) );
+
+		if ( is_wp_error($users) )
+			$this->search_errors = $users;
+		else if ( $users )
+			$this->results = $users;
+		//	foreach ( (array) $users as $user )
+		//		$this->results[] = $user->ID;
+
+		if ( $this->results )
+			$this->total_users_for_query = bb_count_last_query();
+		elseif ( !is_wp_error($this->search_errors) )
+			$this->search_errors = new WP_Error( 'no_matching_users_found', __( '<strong>No matching users were found!</strong>' ) );
+
+		if ( is_wp_error( $this->search_errors ) )
+			bb_admin_notice( $this->search_errors );
+	}
+
+	function prepare_vars_for_template_usage() {
+		$this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone
+	}
+
+	function do_paging() {
+		global $bb_current_submenu;
+		$displaying_num = sprintf(
+			__( '%1$s to %2$s of %3$s' ),
+			bb_number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ),
+			$this->page * $this->users_per_page < $this->total_users_for_query ? bb_number_format_i18n( $this->page * $this->users_per_page ) : '<span class="total-type-count">' . bb_number_format_i18n( $this->total_users_for_query ) . '</span>',
+			'<span class="total-type-count">' . bb_number_format_i18n( $this->total_users_for_query ) . '</span>'
+		);
+		$page_number_links = $this->total_users_for_query > $this->users_per_page ? get_page_number_links( $this->page, $this->total_users_for_query, $this->users_per_page, false ) : '';
+		$this->paging_text = "<div class='tablenav-pages'><span class='displaying-num'>$displaying_num</span><span class=\"displaying-pages\">$page_number_links</span><div class=\"clear\"></div></div>\n";
+		$this->paging_text_bottom = "<div class='tablenav-pages'><span class=\"displaying-pages\">$page_number_links</span><div class=\"clear\"></div></div>\n";
+	}
+
+	function get_results() {
+		return (array) $this->results;
+	}
+
+	function page_links() {
+		echo $this->paging_text;
+	}
+
+	function results_are_paged() {
+		if ( isset($this->paging_text) && $this->paging_text )
+			return true;
+		return false;
+	}
+
+	function is_search() {
+		if ( $this->search_term )
+			return true;
+		return false;
+	}
+
+	function display( $show_search = true, $show_email = false ) {
+		global $wp_roles;
+
+		$r = '';
+
+		if ( isset($this->title) )
+			$title = $this->title;
+		elseif ( $this->is_search() )
+			$title = sprintf(__('Users Matching "%s" by Role'), esc_html( $this->search_term ));
+
+		$h2_search = $this->search_term;
+		$h2_role   = $this->roles[0];
+
+		$roles = $wp_roles->get_names();
+		if ( in_array( $h2_role, array_keys( $roles ) ) ) {
+			$h2_role = $roles[$h2_role];
+		}
+
+		$h2_search = $h2_search ? ' ' . sprintf( __('containing &#8220;%s&#8221;'), esc_html( $h2_search ) ) : '';
+		$h2_role  = $h2_role  ? ' ' . sprintf( __('with role &#8220;%s&#8221;'), esc_html( $h2_role ) ) : '';
+
+		$h2_span = '<span class="subtitle">';
+		$h2_span .= apply_filters( 'bb_user_search_description', sprintf( __( '%1$s%2$s' ), $h2_search, $h2_role ), $h2_search, $h2_role, $this );
+		$h2_span .= '</span>';
+
+		echo "<h2 class=\"first\">" . apply_filters( 'bb_user_search_title', __('Users') ) . $h2_span . "</h2>\n";
+		do_action( 'bb_admin_notices' );
+
+		if ( $show_search ) {
+			$roles = apply_filters( 'bb_user_search_form_roles', $wp_roles->get_names() );
+			
+			$r .= "<form action='' method='get' id='search' class='search-form'>\n";
+			$r .= "<fieldset>\n";
+			$r .= "<div>\n";
+			$r .= "\t\t<label for='usersearch'>" . __('Search term') . "</label>";
+			$r .= "\t\t<div><input type='text' name='usersearch' id='usersearch' class='text-input' value='" . esc_html( $this->search_term, 1) . "' /></div>\n";
+			$r .= "</div>\n";
+			$r .= "<div>\n";
+			$r .= "\t\t<label for='userrole'>" . __('Role') . "</label>";
+			$r .= "\t\t<div><select name='userrole[]' id='userrole'>\n";
+			$r .= "\t\t\t<option value=''>All</option>\n";
+			
+			foreach ( $roles as $role => $display ) {
+				$selected = '';
+				if ( is_array( $this->roles ) && in_array( $role, $this->roles ) ) {
+					$selected = ' selected="selected"';
+				}
+				$value = esc_attr($role);
+				$display = esc_html(translate($display));
+				$r .= "\t\t\t<option value='$value'$selected>$display</option>\n";
+			}
+			
+			$r .= "\t\t</select></div>\n";
+			$r .= "</div>\n";
+			
+			$r = apply_filters( 'bb_user_search_form_inputs', $r, $this );
+			
+			$r .= "<div class=\"submit\">\n";
+			$r .= "\t\t<label class='hidden' for='submit'>" . __('Search') . "</label>";
+			$r .= "\t\t<div><input type='submit' id='submit' class='button submit-input' value='" . __('Filter') . "' /></div>\n";
+			$r .= "</div>\n";
+			$r .= "</fieldset>\n";
+			$r .= "</form>\n\n";
+		}
+
+		if ( $this->get_results() ) {
+			if ( $this->results_are_paged() )
+				$r .= "<div class='tablenav'>\n" . $this->paging_text . "</div><div class=\"clear\"></div>\n\n";
+
+			//foreach($roleclasses as $role => $roleclass) {
+				//ksort($roleclass);
+				//if ( !empty($role) )
+				//	$r .= "\t\t<h3>{$wp_roles->role_names[$role]}</h3>\n";
+				//else
+				//	$r .= "\t\t<h3><em>" . __('Users with no role in these forums') . "</h3>\n";
+				$r .= "<table class='widefat'>\n";
+				$r .= "<thead>\n";
+				$r .= "\t<tr>\n";
+				if ( $show_email ) {
+					$r .= "\t\t<th style='width:30%;'>" . __('Username') . "</th>\n";
+					$r .= "\t\t<th style='width:20%;'>" . __('Name') . "</th>\n";
+					$r .= "\t\t<th style='width:20%;'>" . __('E-mail') . "</th>\n";
+				} else {
+					$r .= "\t\t<th style='width:40%;'>" . __('Username') . "</th>\n";
+					$r .= "\t\t<th style='width:30%;'>" . __('Name') . "</th>\n";
+				}
+				$r .= "\t\t<th style='width:15%;'>" . __('Registered') . "</th>\n";
+				$r .= "\t\t<th style='width:15%;'>" . __('Role') . "</th>\n";
+				$r .= "\t</tr>\n";
+				$r .= "</thead>\n\n";
+				$r .= "<tfoot>\n";
+				$r .= "\t<tr>\n";
+				if ( $show_email ) {
+					$r .= "\t\t<th style='width:30%;'>" . __('Username') . "</th>\n";
+					$r .= "\t\t<th style='width:20%;'>" . __('Name') . "</th>\n";
+					$r .= "\t\t<th style='width:20%;'>" . __('E-mail') . "</th>\n";
+				} else {
+					$r .= "\t\t<th style='width:40%;'>" . __('Username') . "</th>\n";
+					$r .= "\t\t<th style='width:30%;'>" . __('Name') . "</th>\n";
+				}
+				$r .= "\t\t<th style='width:15%;'>" . __('Registered') . "</th>\n";
+				$r .= "\t\t<th style='width:15%;'>" . __('Role') . "</th>\n";
+				$r .= "\t</tr>\n";
+				$r .= "</tfoot>\n\n";
+
+				$r .= "<tbody id='role-$role'>\n";
+				foreach ( (array) $this->get_results() as $user_object )
+					$r .= bb_user_row($user_object, $role, $show_email);
+				$r .= "</tbody>\n";
+				$r .= "</table>\n\n";
+			//}
+
+			if ( $this->results_are_paged() )
+				$r .= "<div class='tablenav bottom'>\n" . $this->paging_text_bottom . "</div><div class=\"clear\"></div>\n\n";
+		}
+		echo $r;
+	}
+
+}
+
+class BB_Users_By_Role extends BB_User_Search {
+	var $role = '';
+	var $title = '';
+
+	function BB_Users_By_Role($role = '', $page = '') { // constructor
+		$this->role = $role ? $role : 'member';
+		$this->raw_page = ( '' == $page ) ? false : (int) $page;
+		$this->page = (int) ( '' == $page ) ? 1 : $page;
+
+		$this->prepare_query();
+		$this->query();
+		$this->do_paging();
+	}
+
+	function query() {
+		if ( $_results = bb_get_ids_by_role( $this->role, 0, $this->page, $this->users_per_page ) ) {
+			$this->results = bb_get_user($_results);
+			$this->total_users_for_query = bb_count_last_query();
+		} else
+			$this->search_errors = new WP_Error( 'no_matching_users_found', __( '<strong>No matching users were found!</strong>' ) );
+
+		if ( is_wp_error( $this->search_errors ) )
+			bb_admin_notice( $this->search_errors );
+	}
+
+}
+
+/* Forums */
+
+// Expects forum_name, forum_desc to be pre-escaped
+function bb_new_forum( $args ) {
+	global $bbdb;
+	if ( !bb_current_user_can( 'manage_forums' ) )
+		return false;
+
+	$defaults = array( 'forum_name' => '', 'forum_desc' => '', 'forum_parent' => 0, 'forum_order' => false, 'forum_is_category' => 0 );
+	$args = wp_parse_args( $args, $defaults );
+	if ( 1 < func_num_args() ) : // For back compat
+		$args['forum_name']  = func_get_arg(0);
+		$args['forum_desc']  = func_get_arg(1);
+		$args['forum_order'] = 2 < func_num_args() ? func_get_arg(2) : 0;
+	endif;
+
+	extract($args, EXTR_SKIP);
+
+	if ( !is_numeric($forum_order) )
+		$forum_order = (int) $bbdb->get_var("SELECT MAX(forum_order) FROM $bbdb->forums") + 1;
+
+	$forum_order = (int) $forum_order;
+	$forum_parent = (int) $forum_parent;
+	$forum_is_category = (int) $forum_is_category;
+
+	$forum_name = apply_filters( 'bb_pre_forum_name', stripslashes( wp_specialchars_decode( $forum_name, ENT_QUOTES ) ) );
+	$forum_desc = apply_filters( 'bb_pre_forum_desc', stripslashes($forum_desc) );
+
+	if ( strlen($forum_name) < 1 )
+		return false;
+
+	$forum_sql = "SELECT forum_slug FROM $bbdb->forums WHERE forum_slug = %s";
+
+	$forum_slug = $_forum_slug = bb_slug_sanitize($forum_name);
+	if ( strlen($_forum_slug) < 1 )
+		return false;
+
+	while ( is_numeric($forum_slug) || $existing_slug = $bbdb->get_var( $bbdb->prepare( $forum_sql, $forum_slug ) ) )
+		$forum_slug = bb_slug_increment($_forum_slug, $existing_slug);
+
+	$bbdb->insert( $bbdb->forums, compact( 'forum_name', 'forum_slug', 'forum_desc', 'forum_parent', 'forum_order' ) );
+	$forum_id = $bbdb->insert_id;
+	if ($forum_id && $forum_is_category)
+		bb_update_forummeta($forum_id, 'forum_is_category', $forum_is_category);
+	wp_cache_flush( 'bb_forums' );
+
+	return $forum_id;
+}
+
+// Expects forum_name, forum_desc to be pre-escaped
+function bb_update_forum( $args ) {
+	global $bbdb;
+	if ( !bb_current_user_can( 'manage_forums' ) )
+		return false;
+
+	$defaults = array( 'forum_id' => 0, 'forum_name' => '', 'forum_slug' => '', 'forum_desc' => '', 'forum_parent' => 0, 'forum_order' => 0, 'forum_is_category' => 0 );
+	$fields = array( 'forum_name', 'forum_desc', 'forum_parent', 'forum_order' );
+	$args = wp_parse_args( $args, $defaults );
+	if ( 1 < func_num_args() ) : // For back compat
+		$args['forum_id']    = func_get_arg(0);
+		$args['forum_name']  = func_get_arg(1);
+		$args['forum_desc']  = 2 < func_num_args() ? func_get_arg(2) : '';
+		$args['forum_order'] = 3 < func_num_args() && is_numeric(func_get_arg(3)) ? func_get_arg(3) : 0;
+	endif;
+
+	extract($args, EXTR_SKIP);
+
+	if ( !$forum_id = (int) $forum_id )
+		return false;
+	if ( !$forum = bb_get_forum( $forum_id ) )
+		return false;
+	$forum_order = (int) $forum_order;
+	$forum_parent = (int) $forum_parent;
+	$forum_is_category = (int) $forum_is_category;
+
+	$forum_name = apply_filters( 'bb_pre_forum_name', stripslashes( wp_specialchars_decode( $forum_name, ENT_QUOTES ) ), $forum_id );
+	$forum_desc = apply_filters( 'bb_pre_forum_desc', stripslashes($forum_desc), $forum_id );
+
+	if ( strlen($forum_name) < 1 )
+		return false;
+
+	// Slug is not changing, don't update it
+	if ( !$forum_slug || $forum_slug == $forum->forum_slug ) {
+		// [sic]
+	} else {
+		$forum_slug = $_forum_slug = bb_slug_sanitize($forum_slug);
+		if ( strlen($_forum_slug) < 1 )
+			return false;
+
+		$forum_sql = "SELECT forum_slug FROM $bbdb->forums WHERE forum_slug = %s";
+
+		while ( is_numeric($forum_slug) || $existing_slug = $bbdb->get_var( $bbdb->prepare( $forum_sql, $forum_slug ) ) )
+			$forum_slug = bb_slug_increment($_forum_slug, $existing_slug);
+
+		$fields[] = 'forum_slug';
+	}
+
+	wp_cache_delete( $forum_id, 'bb_forum' );
+	wp_cache_flush( 'bb_forums' );
+
+	$update_result = $bbdb->update( $bbdb->forums, compact( $fields ), compact( 'forum_id' ) );
+
+	if ($forum_is_category)
+		bb_update_forummeta($forum_id, 'forum_is_category', $forum_is_category);
+	else
+		bb_delete_forummeta($forum_id, 'forum_is_category');
+
+	return $update_result;
+}
+
+// When you delete a forum, you delete *everything*
+// NOT bbdb::prepared
+function bb_delete_forum( $forum_id ) {
+	global $bbdb;
+	if ( !bb_current_user_can( 'delete_forum', $forum_id ) )
+		return false;
+	if ( !$forum_id = (int) $forum_id )
+		return false;
+
+	if ( !$forum = bb_get_forum( $forum_id ) )
+		return false;
+
+	if ( $topic_ids = $bbdb->get_col( $bbdb->prepare( "SELECT topic_id FROM $bbdb->topics WHERE forum_id = %d", $forum_id ) ) ) {
+		foreach ($topic_ids as $topic_id) {
+			bb_remove_topic_tags( $topic_id );
+		}
+		$_topic_ids = join(',', array_map('intval', $topic_ids));
+		$bbdb->query("DELETE FROM $bbdb->posts WHERE topic_id IN ($_topic_ids) AND topic_id != 0");
+		$bbdb->query("DELETE FROM $bbdb->meta WHERE object_type = 'bb_topic' AND object_id IN ($_topic_ids)");
+		$bbdb->query( $bbdb->prepare( "DELETE FROM $bbdb->topics WHERE forum_id = %d", $forum_id ) );
+	}
+	
+	$bbdb->update( $bbdb->forums, array( 'forum_parent' => $forum->forum_parent ), array( 'forum_parent' => $forum_id ) );
+
+	$return = $bbdb->query( $bbdb->prepare( "DELETE FROM $bbdb->forums WHERE forum_id = %d", $forum_id ) );
+
+	wp_cache_flush( 'bb_post' );
+
+	if ( $topic_ids )
+		foreach ( $topic_ids as $topic_id ) {
+			// should maybe just flush these groups instead
+			wp_cache_delete( $topic_id, 'bb_topic' );
+			wp_cache_delete( $topic_id, 'bb_thread' );
+		}
+
+	wp_cache_delete( $forum_id, 'bb_forum' );
+	wp_cache_flush( 'bb_forums' );
+
+	return $return;
+}
+
+function bb_forum_row( $forum_id = 0, $echo = true, $close = false ) {
+	global $forum, $forums_count;
+	if ( $forum_id )
+		$_forum = bb_get_forum( $forum_id );
+	else
+		$_forum =& $forum;
+
+	if ( !$_forum )
+		return;
+
+	$description = get_forum_description( $_forum->forum_id );
+
+	$r  = '';
+	if ( $close )
+		$r .= "\t<li id='forum-$_forum->forum_id'" . get_alt_class( 'forum', 'forum clear list-block' ) . ">\n";
+	$r .= "\t\t<div class='list-block posrel'>\n";
+	$r .= "\t\t\t<div class=\"row-title\">" . get_forum_name( $_forum->forum_id ) . "</div>\n";
+	if ( $description )
+		$r .= "\t\t\t<p class=\"row-description\">" . get_forum_description( $_forum->forum_id ) . "</p>\n";
+	$r .= "\t\t\t<div class=\"row-actions\"><span>\n";
+		$r .= "\t\t\t\t<a class='edit' href='" . get_forum_link() . "'>" . __('View') . "</a>\n";
+	if ( bb_current_user_can( 'manage_forums' ) )
+		$r .= "\t\t\t\t| <a class='edit' href='" . esc_attr( bb_get_uri('bb-admin/forums.php', array('action' => 'edit', 'id' => $_forum->forum_id), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN) ) . "'>" . __('Edit') . "</a>\n";
+	if ( bb_current_user_can( 'delete_forum', $_forum->forum_id ) && 1 < $forums_count )
+		$r .= "\t\t\t\t| <a class='delete' href='" . esc_attr( bb_get_uri('bb-admin/forums.php', array('action' => 'delete', 'id' => $_forum->forum_id), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN) ) . "'>" . __('Delete') . "</a>\n";
+	$r .= "\t\t\t</span>&nbsp;</div>\n";
+	$r .= "\t\t</div>\n";
+	if ( $close )
+		$r .= "\t</li>\n";
+
+	if ( $echo )
+		echo $r;
+	return $r;
+}
+
+function bb_forum_form( $forum_id = 0 ) {
+	$forum_id = (int) $forum_id;
+	if ( $forum_id && !$forum = bb_get_forum( $forum_id ) ) {
+		return;
+	}
+
+	$forum_name = '';
+	$forum_slug = '';
+	$forum_description = '';
+	$forum_position = '';
+
+	if ( $forum_id ) {
+		$forum_name = get_forum_name( $forum_id );
+		$forum_slug = $forum->forum_slug;
+		$forum_description = get_forum_description( $forum_id );
+		$forum_position = get_forum_position( $forum_id );
+		$legend = __( 'Edit Forum' );
+		$submit = __( 'Save Changes' );
+		$action = 'update';
+	} else {
+		$legend = __( 'Add Forum' );
+		$submit = __( 'Add Forum' );
+		$action = 'add';
+	}
+
+	$forum_options = array(
+		'forum_name' => array(
+			'title' => __( 'Name' ),
+			'value' => $forum_name
+		),
+		'forum_slug' => array(
+			'title' => __( 'Slug' ),
+			'value' => $forum_slug
+		),
+		'forum_desc' => array(
+			'title' => __( 'Description' ),
+			'value' => $forum_description,
+			'class' => 'long'
+		),
+		'forum_parent' => array(
+			'title' => __( 'Parent' ),
+			'type' => 'select',
+			'options' => bb_get_forum_dropdown( array(
+				'cut_branch' => $forum_id,
+				'id' => 'forum_parent',
+				'none' => true,
+				'selected' => $forum_id ? get_forum_parent( $forum_id ) : 0,
+				'disable_categories' => 0,
+				'options_only' => true
+			) )
+		),
+		'forum_order' => array(
+			'title' => __( 'Position' ),
+			'value' => $forum_position,
+			'class' => 'short'
+		),
+		'forum_is_category' => array(
+			'title' => __( 'Category' ),
+			'type' => 'checkbox',
+			'options' => array(
+				1 => array(
+					'label' => __( 'Make this forum a category' ),
+					'value' => bb_get_forum_is_category( $forum_id ),
+				)
+			),
+			'note' => __( 'Categories are forums where new topics cannot be created. Categories usually contain a group of sub-forums.' )
+		)
+	);
+	
+	if ( !$forum_id ) {
+		unset( $forum_options['forum_slug'] );
+		unset( $forum_options['forum_order'] );
+	}
+	
+?>
+<form class="settings" method="post" id="<?php echo $action; ?>-forum" action="<?php bb_uri('bb-admin/bb-forum.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>" class="add:forum-list: forum-form">
+	<fieldset>
+		<legend><?php echo $legend; ?></legend>
+<?php
+foreach ( $forum_options as $option => $args ) {
+	bb_option_form_element( $option, $args );
+}
+?>
+	<fieldset class="submit">
+<?php if ( $forum_id ) : ?>
+		<input type="hidden" name="forum_id" value="<?php echo $forum_id; ?>" />
+<?php endif; ?>
+		<?php bb_nonce_field( 'order-forums', 'order-nonce' ); ?>
+		<?php bb_nonce_field( $action . '-forum' ); ?>
+		<input type="hidden" name="action" value="<?php echo $action; ?>" />
+		<input class="submit" type="submit" name="submit" value="<?php echo $submit; ?>" />
+	</fieldset>
+</form>
+<?php
+}
+
+class BB_Walker_ForumAdminlistitems extends BB_Walker {
+	var $tree_type = 'forum';
+	var $db_fields = array ('parent' => 'forum_parent', 'id' => 'forum_id'); //TODO: decouple this
+	
+	function start_lvl($output, $depth) {
+		$indent = str_repeat("\t", $depth) . '    ';
+		$output .= $indent . "<ul id='forum-root-$this->forum_id' class='list-block holder'>\n";
+		return $output;
+	}
+	
+	function end_lvl($output, $depth) {
+		$indent = str_repeat("\t", $depth) . '    ';
+		$output .= $indent . "</ul>\n";
+		return $output;
+	}
+	
+	function start_el($output, $forum, $depth) {
+		$this->forum_id = $forum->forum_id;
+		$indent = str_repeat("\t", $depth + 1);
+		$output .= $indent . "<li id='forum-$this->forum_id'" . get_alt_class( 'forum', 'forum clear list-block' ) . ">\n";
+
+		return $output;
+	}
+	
+	function end_el($output, $forum, $depth) {
+		$indent = str_repeat("\t", $depth + 1);
+		$output .= $indent . "</li>\n";
+		return $output;
+	}
+}
+
+
+
+/* Topics */
+
+function bb_move_forum_topics( $from_forum_id, $to_forum_id ) {
+	global $bbdb;
+	
+	$from_forum_id = (int) $from_forum_id ;
+	$to_forum_id = (int) $to_forum_id;
+	
+	add_filter('get_forum_where', 'bb_no_where'); // Just in case
+	
+	$from_forum = bb_get_forum( $from_forum_id );
+	if ( !$to_forum = bb_get_forum( $to_forum_id ) )
+		return false;
+
+	$posts = $to_forum->posts + ( $from_forum ? $from_forum->posts : 0 );
+	$topics = $to_forum->topics + ( $from_forum ? $from_forum->topics : 0 );
+	
+	$bbdb->update( $bbdb->forums, compact( 'topics', 'posts' ), array( 'forum_id' => $to_forum_id ) );
+	$bbdb->update( $bbdb->forums, array( 'topics' => 0, 'posts' => 0 ), array( 'forum_id' => $from_forum_id ) );
+	$bbdb->update( $bbdb->posts, array( 'forum_id' => $to_forum_id ), array( 'forum_id' => $from_forum_id ) );
+	$topic_ids = $bbdb->get_col( $bbdb->prepare( "SELECT topic_id FROM $bbdb->topics WHERE forum_id = %d", $from_forum_id ) );
+	$return = $bbdb->update( $bbdb->topics, array( 'forum_id' => $to_forum_id ), array( 'forum_id' => $from_forum_id ) );
+
+	wp_cache_flush( 'bb_post' );
+
+	if ( $topic_ids )
+		foreach ( $topic_ids as $topic_id ) {
+			// should maybe just flush these groups
+			wp_cache_delete( $topic_id, 'bb_topic' );
+			wp_cache_delete( $topic_id, 'bb_thread' );
+		}
+
+	wp_cache_delete( $from_forum_id, 'bb_forum' );
+	wp_cache_delete( $to_forum_id, 'bb_forum' );
+	wp_cache_flush( 'bb_forums' );
+	
+	return $return;
+}
+
+/* Posts */
+
+function bb_admin_list_posts() {
+	global $bb_posts, $bb_post;
+	
+	if ( !$bb_posts ) {
+?>
+<p class="no-results"><?php _e('No posts found.'); ?></p>
+<?php
+	} else {
+?>
+<table id="posts-list" class="widefat" cellspacing="0" cellpadding="0">
+<thead>
+	<tr>
+		<th scope="col"><?php _e( 'Post' ); ?></th>
+		<th scope="col"><?php _e( 'Author' ); ?></th>
+		<th scope="col"><?php _e( 'Topic' ); ?></th>
+		<th scope="col"><?php _e( 'Date' ); ?></th>
+	</tr>
+</thead>
+<tfoot>
+	<tr>
+		<th scope="col"><?php _e( 'Post' ); ?></th>
+		<th scope="col"><?php _e( 'Author' ); ?></th>
+		<th scope="col"><?php _e( 'Topic' ); ?></th>
+		<th scope="col"><?php _e( 'Date' ); ?></th>
+	</tr>
+</tfoot>
+<tbody>
+<?php
+		foreach ( $bb_posts as $bb_post ) {
+?>
+	<tr id="post-<?php post_id(); ?>"<?php alt_class('post', post_del_class()); ?>>
+		<td class="post">
+			<?php post_text(); ?>
+			<div>
+				<span class="row-actions">
+					<a href="<?php echo esc_url( get_post_link() ); ?>"><?php _e( 'View' ); ?></a>
+<?php
+	bb_post_admin( array(
+		'before_each' => ' | ',
+		'each' => array(
+			'undelete' => array(
+				'before' => ' '
+			)
+		),
+		'last_each' => array(
+			'before' => ' | '
+		)
+	) );
+?>
+				</span>&nbsp;
+			</div>
+		</td>
+
+		<td class="author">
+			<a href="<?php user_profile_link( get_post_author_id() ); ?>">
+				<?php post_author_avatar( '16' ); ?>
+				<?php post_author(); ?>
+			</a>
+		</td>
+
+		<td class="topic">
+			<a href="<?php topic_link( $bb_post->topic_id ); ?>"><?php topic_title( $bb_post->topic_id ); ?></a>
+		</td>
+		
+		<td class="date">
+<?php
+	if ( bb_get_post_time( 'U' ) < ( time() - 86400 ) ) {
+		bb_post_time( 'Y/m/d\<\b\r \/\>H:i:s' );
+	} else {
+		printf( __( '%s ago' ), bb_get_post_time( 'since' ) );
+	}
+?>
+		</td>
+	</tr>
+<?php 
+		}
+?>
+</tbody>
+</table>
+<?php
+	}
+}
+
+/* Recounts */
+
+function bb_recount_list()
+{
+	global $recount_list;
+	$recount_list = array(
+		5  => array( 'topic-posts', __( 'Count posts of every topic' ) ),
+		6  => array( 'topic-voices', __( 'Count voices of every topic' ) ),
+		10 => array( 'topic-deleted-posts', __( 'Count deleted posts on every topic' ) ),
+		15 => array( 'forums', __( 'Count topics and posts in every forum' ) ),
+		20 => array( 'topics-replied', __( 'Count topics to which each user has replied' ) ),
+		25 => array( 'topic-tag-count', __( 'Count tags for every topic' ) ),
+		30 => array( 'tags-tag-count', __( 'Count topics for every tag' ) ),
+		35 => array( 'tags-delete-empty', __( 'Delete tags with no topics' ) ),
+		40 => array( 'clean-favorites', __( 'Remove deleted topics from users\' favorites' ) )
+	);
+	do_action( 'bb_recount_list' );
+	ksort( $recount_list );
+	return $recount_list;
+}
+
+/* Themes */
+
+function bb_get_current_theme_data( $property = 'all' ) {
+	if (!$property) {
+		$property = 'all';
+	}
+	$directory = bb_get_active_theme_directory();
+	$stylesheet = $directory . 'style.css';
+	if (file_exists($stylesheet)) {
+		$data = bb_get_theme_data($stylesheet);
+	}
+	if ($property == 'all') {
+		return $data;
+	} elseif (isset($data[$property])) {
+		return $data[$property];
+	} else {
+		return false;
+	}
+}
+
+// Output sanitized for display
+function bb_get_theme_data( $theme_file )
+{
+	if ( strpos($theme_file, '#') !== false ) {
+		$theme_file = bb_get_theme_directory( $theme_file ) . 'style.css';
+	}
+	$theme_code = implode( '', file( $theme_file ) );
+	$theme_code = str_replace ( '\r', '\n', $theme_code );
+	// Grab just the first commented area from the file
+	preg_match( '|/\*(.*)\*/|msU', $theme_code, $theme_block );
+	$theme_data = trim( $theme_block[1] );
+	preg_match( '|Theme Name:(.*)|i', $theme_data, $theme_name );
+	preg_match( '|Theme URI:(.*)|i', $theme_data, $theme_uri );
+	preg_match( '|Description:(.*)|i', $theme_data, $description );
+	preg_match( '|Author:(.*)|i', $theme_data, $author_name );
+	preg_match( '|Author URI:(.*)|i', $theme_data, $author_uri );
+	preg_match( '|Ported By:(.*)|i', $theme_data, $porter_name );
+	preg_match( '|Porter URI:(.*)|i', $theme_data, $porter_uri );
+//	preg_match( '|Template:(.*)|i', $theme_data, $template );
+	if ( preg_match( '|Version:(.*)|i', $theme_data, $version ) )
+		$version = esc_html( trim( $version[1] ) );
+	else
+		$version ='';
+	if ( preg_match('|Status:(.*)|i', $theme_data, $status) )
+		$status = esc_html( trim($status[1]) );
+	else
+		$status = 'publish';
+
+	$description = trim($description[1]);
+	$description = bb_encode_bad( $description );
+	$description = bb_code_trick( $description );
+	$description = force_balance_tags( $description );
+	$description = bb_filter_kses( $description );
+	$description = bb_autop( $description );
+
+	$name = $theme_name[1];
+	$name = esc_html( trim($name) );
+	$theme = $name;
+
+	if ( $author_name || $author_uri ) {
+		if ( empty($author_uri[1]) ) {
+			$author = bb_filter_kses( trim($author_name[1]) );
+		} else {
+			$author = '<a href="' . esc_url( trim($author_uri[1]) ) . '" title="' . esc_attr__( 'Visit author homepage' ) . '">' . bb_filter_kses( trim($author_name[1]) ) . '</a>';
+		}
+	} else {
+		$author = '';
+	}
+
+	if ( $porter_name || $porter_uri ) {
+		if ( empty($porter_uri[1]) ) {
+			$porter = bb_filter_kses( trim($porter_name[1]) );
+		} else {
+			$porter = '<a href="' . esc_url( trim($porter_uri[1]) ) . '" title="' . esc_attr__( 'Visit porter homepage' ) . '">' . bb_filter_kses( trim($porter_name[1]) ) . '</a>';
+		}
+	} else {
+		$porter = '';
+	}
+
+	global $bb;
+
+	// Normalise the path to the theme
+	$theme_file = str_replace( '\\', '/', $theme_file );
+
+	foreach ( $bb->theme_locations as $_name => $_data ) {
+		$_directory = str_replace( '\\', '/', $_data['dir'] );
+		if ( 0 === strpos( $theme_file, $_directory ) ) {
+			$location = $_name;
+			break;
+		}
+	}
+
+	return array(
+		'Location' => $location,
+		'Name' => $name,
+		'Title' => $theme,
+		'Description' => $description,
+		'Author' => $author,
+		'Porter' => $porter,
+		'Version' => $version,
+//		'Template' => $template[1],
+		'Status' => $status,
+		'URI' => esc_url( $theme_uri[1] )
+	);
+}
+
+if ( !function_exists( 'checked' ) ) :
+function checked( $checked, $current) {
+	if ( $checked == $current)
+		echo ' checked="checked"';
+}
+endif;
+
+if ( !function_exists( 'selected' ) ) :
+function selected( $selected, $current) {
+	if ( $selected === $current)
+		echo ' selected="selected"';
+}
+endif;
+
+/* Options */
+
+function bb_option_form_element( $name = 'name', $args = null ) {
+	global $bb_hardcoded;
+
+	$defaults = array(
+		'title' => 'title',
+		'type' => 'text',
+		'value' => false,
+		'options' => false,
+		'message' => false,
+		'class' => false,
+		'default' => false,
+		'before' => '',
+		'after' => '',
+		'note' => false,
+		'attributes' => false,
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+
+	$id = str_replace( array( '_', '[', ']' ), array( '-', '-', '' ), $name );
+	if ( false !== strpos( $name, '[' ) ) {
+		list( $option_name, $option_key ) = preg_split( '/[\[\]]/', $name, -1, PREG_SPLIT_NO_EMPTY );
+		$option = bb_get_option( $option_name );
+		$value = false === $args['value'] ? esc_attr( $option[$option_key] ) : esc_attr( $args['value'] );
+		$hardcoded = isset( $bb_hardcoded[$option_name][$option_key] );
+	} else {
+		$value = false === $args['value'] ? bb_get_form_option( $name ) : esc_attr( $args['value'] );
+		$hardcoded = isset( $bb_hardcoded[$name] );
+	}
+
+	$class = $args['class'] ? (array) $args['class'] : array();
+	array_unshift( $class, $args['type'] );
+	$disabled = $hardcoded ? ' disabled="disabled"' : '';
+
+	if ( $args['attributes'] ) {
+		$attributes = array();
+		foreach ( $args['attributes'] as $k => $v )
+			$attributes[] = "$k='$v'";
+		$attributes = ' ' . join( ' ', $attributes );
+	} else {
+		$attributes = '';
+	}
+
+?>
+
+		<div id="option-<?php echo $id; ?>"<?php if ( $hardcoded ) echo ' class="disabled"'; ?>>
+<?php
+			switch ( $args['type'] ) {
+				case 'radio' :
+				case 'checkbox' :
+				case 'message' :
+?>
+			<div class="label">
+				<?php echo $args['title']; ?>
+			</div>
+
+<?php
+					break;
+				case 'select' :
+				default :
+?>
+			<label for="<?php echo $id; ?>">
+				<?php echo $args['title']; ?>
+			</label>
+
+<?php
+					break;
+			}
+?>
+			<div class="inputs">
+
+<?php
+			if ( $args['before'] ) {
+				echo '<span class="before">' . $args['before'] . '</span>';
+			}
+			switch ( $args['type'] ) {
+				case 'select' :
+					echo "<select$disabled class='" . join( ' ', $class ) . "' name='$name' id='$id'$attributes>\n";
+					if ( is_array( $args['options'] ) ) {
+						foreach ( $args['options'] as $option => $label )
+							echo "\t<option value='$option'" . ( $value == $option ? " selected='selected'" : '' ) . ">$label</option>\n";
+					} elseif ( is_string( $args['options'] ) ) {
+						echo $args['options'] . "\n";
+					}
+					echo "</select>\n";
+					break;
+				case 'radio' :
+				case 'checkbox' :
+					if ( is_array( $args['options'] ) ) {
+						$_id = 0;
+						if ( 'radio' === $args['type'] && !in_array( $value, array_keys( $args['options'] ) ) && empty( $value ) ) {
+							$use_first_value = true;
+						}
+						$type = $args['type'];
+						foreach ( $args['options'] as $option => $label ) {
+							if ( $use_first_value ) {
+								$use_first_value = false;
+								$value = $option;
+							}
+							if ( is_array( $label ) ) {
+								if ( isset( $label['attributes'] ) ) {
+									$attributes = array();
+									foreach ( $label['attributes'] as $k => $v )
+										$attributes[] = "$k='$v'";
+									$attributes = ' ' . join( ' ', $attributes );
+								} else {
+									$attributes = '';
+								}
+								if ( isset( $label['name'] ) ) {
+									$name = $label['name'];
+									$id = str_replace( array( '_', '[', ']' ), array( '-', '-', '' ), $name );
+									$hardcoded = isset( $bb_hardcoded[$name] );
+								}
+								if ( isset( $label['value'] ) ) {
+									$_value = $label['value'];
+								} else {
+									$_value = $args['value'];
+								}
+								$value = false === $_value ? bb_get_form_option( $name ) : esc_attr( $_value );
+								$label = $label['label'];
+							}
+							echo "<label class=\"{$type}s\"><input$disabled type='$type' class='" . join( ' ', $class ) . "' name='$name' id='$id-$_id' value='$option'" . ( $value == $option ? " checked='checked'" : '' ) . "{$attributes} /> $label</label>\n";
+							$_id++;
+						}
+					} elseif ( is_string( $args['options'] ) ) {
+						echo $args['options'] . "\n";
+					}
+					break;
+				case 'message' :
+					if ( $args['message'] ) {
+						echo $args['message'];
+					}
+					break;
+				default :
+					echo "<input$disabled type='$args[type]' class='" . join( ' ', $class ) . "' name='$name' id='$id' value='$value'$attributes />\n";
+					break;
+			}
+			if ( $args['after'] ) {
+				echo '<span class="after">' . $args['after'] . '</span>';
+			}
+
+			if ( $args['note'] ) {
+				foreach ( (array) $args['note'] as $note ) {
+?>
+
+				<p><?php echo $note; ?></p>
+
+<?php
+				}
+			}
+?>
+
+			</div>
+		</div>
+
+<?php
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/functions.bb-plugin.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/functions.bb-plugin.php
new file mode 100644
index 0000000000000000000000000000000000000000..d99c5c2e00b84c08e9ea50ee47e5559715bfae3b
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/functions.bb-plugin.php
@@ -0,0 +1,441 @@
+<?php
+
+function bb_get_plugins_callback( $type = 'normal', $path, $filename )
+{
+	if ( '.php' != substr( $filename, -4 ) ) {
+		return false;
+	}
+
+	$data = array( 'autoload' => 0 );
+
+	if ( $has_underscore = '_' === substr( $filename, 0, 1 ) ) {
+		switch ( $type ) {
+			case 'all':
+			case 'autoload':
+				$data['autoload'] = 1;
+				break;
+			case 'normal':
+			default:
+				return false;
+				break;
+		}
+	} elseif ( 'autoload' === $type ) {
+		return false;
+	}
+
+	if ( $_data = bb_get_plugin_data( $path ) ) {
+		return array_merge( $_data , $data );
+	}
+
+	return false;
+}
+
+function bb_get_plugins( $location = 'all', $type = 'normal', $status = 'all' )
+{
+	static $plugin_cache = array();
+
+	if ( !in_array( $type, array( 'all', 'autoload', 'normal' ) ) ) {
+		$type = 'normal';
+	}
+
+	if ( 'autoload' === $type || !in_array( $status, array( 'all', 'active', 'inactive' ) ) ) {
+		$status = 'all';
+	}
+
+	if ( isset( $plugin_cache[$location][$type][$status] ) ) {
+		return $plugin_cache[$location][$type][$status];
+	}
+
+	global $bb;
+	$directories = array();
+	if ( 'all' === $location ) {
+		foreach ( $bb->plugin_locations as $_data ) {
+			$directories[] = $_data['dir'];
+		}
+	} elseif ( isset( $bb->plugin_locations[$location]['dir'] ) ) {
+		$directories[] = $bb->plugin_locations[$location]['dir'];
+	}
+
+	require_once( BB_PATH . BB_INC . 'class.bb-dir-map.php' );
+
+	$plugin_arrays = array();
+	foreach ( $directories as $directory ) {
+		$dir_map = new BB_Dir_Map(
+			$directory,
+			array(
+				'callback' => 'bb_get_plugins_callback',
+				'callback_args' => array( $type ),
+				'recurse' => 1
+			)
+		);
+		$dir_plugins = $dir_map->get_results();
+		$dir_plugins = is_wp_error( $dir_plugins ) ? array() : $dir_plugins;
+		$plugin_arrays[] = $dir_plugins;
+		unset($dir_map, $dir_plugins);
+	}
+	
+	$plugins = array();
+	foreach ($plugin_arrays as $plugin_array) {
+		$plugins = array_merge($plugins, $plugin_array);
+	}
+
+	$active_plugins = (array) bb_get_option( 'active_plugins' );
+	
+	$adjusted_plugins = array();
+	foreach ($plugins as $plugin => $plugin_data) {
+		$_id = $plugin_data['location'] . '#' . $plugin;
+		$plugin_data['active'] = 0;
+		if ( 'autoload' === $type || in_array( $_id, $active_plugins ) ) {
+			$plugin_data['active'] = 1;
+		}
+		if (
+			'active' === $status && $plugin_data['active'] ||
+			'inactive' === $status && !$plugin_data['active'] ||
+			'all' === $status
+		) {
+			$adjusted_plugins[$_id] = $plugin_data;
+		}
+	}
+
+	uasort( $adjusted_plugins, 'bb_plugins_sort' );
+
+	$plugin_cache[$location][$type][$status] = $adjusted_plugins;
+
+	return $adjusted_plugins;
+}
+
+function bb_plugins_sort( $a, $b )
+{
+	return strnatcasecmp( $a['name'], $b['name'] );
+}
+
+function bb_get_plugin_counts()
+{
+	$all_plugins = bb_get_plugins( 'all', 'all' );
+	$active_plugins = (array) bb_get_option( 'active_plugins' );
+	$counts = array(
+		'plugin_count_all' => count( $all_plugins ),
+		'plugin_count_active' => count( $active_plugins ),
+		'plugin_count_inactive' => 0,
+		'plugin_count_autoload' => 0
+	);
+	foreach ( $all_plugins as $id => $all_plugin ) {
+		if ( $all_plugin['autoload'] ) {
+			$counts['plugin_count_autoload']++;
+		} elseif ( !in_array( $id, $active_plugins ) ) {
+			$counts['plugin_count_inactive']++;
+		}
+	}
+	return $counts;
+}
+
+/**
+ * Parse the plugin contents to retrieve plugin's metadata.
+ *
+ * The metadata of the plugin's data searches for the following in the plugin's
+ * header. All plugin data must be on its own line. For plugin description, it
+ * must not have any newlines or only parts of the description will be displayed
+ * and the same goes for the plugin data. The below is formatted for printing.
+ *
+ * <code>
+ * /*
+ * Plugin Name: Name of Plugin
+ * Plugin URI: Link to plugin information
+ * Description: Plugin Description
+ * Author: Plugin author's name
+ * Author URI: Link to the author's web site
+ * Version: Must be set
+ * Requires at least: Optional.  Minimum bbPress version this plugin requires
+ * Tested up to: Optional. Maximum bbPress version this plugin has been tested with
+ * Text Domain: Optional. Unique identifier, should be same as the one used in
+ *		bb_load_plugin_textdomain()
+ * Domain Path: Optional. Only useful if the translations are located in a
+ *		folder above the plugin's base path. For example, if .mo files are
+ *		located in the locale folder then Domain Path will be "/locale/" and
+ *		must have the first slash. Defaults to the base folder the plugin is
+ *		located in.
+ *  * / # You must remove the space to close comment (the space is here only for documentation purposes).
+ * </code>
+ *
+ * Plugin data returned array contains the following:
+ *		'location' - Location of plugin file
+ *		'name' - Name of the plugin, must be unique.
+ *		'uri' - Plugin's web site.
+ *		'plugin_link' - Title of plugin linked to plugin's web site.
+ *		'description' - Description of what the plugin does and/or notes
+ *		from the author.
+ *		'author' - The author's name
+ *		'author_uri' - The author's web site address.
+ *		'author_link' - The author's name linked to the author's web site.
+ *		'version' - The plugin version number.
+ *		'requires' - Minimum bbPress version plugin requires
+ *		'tested' - Maximum bbPress version plugin has been tested with
+ *		'text_domain' - Plugin's text domain for localization.
+ *		'domain_path' - Plugin's relative directory path to .mo files.
+ *
+ * Some users have issues with opening large files and manipulating the contents
+ * for want is usually the first 1kiB or 2kiB. This function stops pulling in
+ * the plugin contents when it has all of the required plugin data.
+ *
+ * The first 8kiB of the file will be pulled in and if the plugin data is not
+ * within that first 8kiB, then the plugin author should correct their plugin
+ * and move the plugin data headers to the top.
+ *
+ * The plugin file is assumed to have permissions to allow for scripts to read
+ * the file. This is not checked however and the file is only opened for
+ * reading.
+ *
+ * @link http://trac.wordpress.org/ticket/5651 Previous Optimizations.
+ * @link http://trac.wordpress.org/ticket/7372 Further and better Optimizations.
+ * @since 1.5.0
+ *
+ * @param string $plugin_file Path to the plugin file
+ * @param bool $markup If the returned data should have HTML markup applied
+ * @param bool $translate If the returned data should be translated
+ * @return array See above for description.
+ */
+function bb_get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
+	global $bb;
+
+	if ( preg_match( '/^([a-z0-9_-]+)#((?:[a-z0-9\/\\_-]+.)+)(php)$/i', $plugin_file, $_matches ) ) {
+		$plugin_file = $bb->plugin_locations[$_matches[1]]['dir'] . $_matches[2] . $_matches[3];
+		
+		$_directory = $bb->plugin_locations[$_matches[1]]['dir'];
+		$_plugin = $_matches[2] . $_matches[3];
+
+		if ( !$_plugin ) {
+			// Not likely
+			return false;
+		}
+
+		if ( validate_file( $_plugin ) ) {
+			// $plugin has .., :, etc.
+			return false;
+		}
+
+		$plugin_file = $_directory . $_plugin;
+		unset( $_matches, $_directory, $_plugin );
+	}
+
+	if ( !file_exists( $plugin_file ) ) {
+		// The plugin isn't there
+		return false;
+	}
+
+	// We don't need to write to the file, so just open for reading.
+	$fp = fopen($plugin_file, 'r');
+
+	// Pull only the first 8kiB of the file in.
+	$plugin_code = fread( $fp, 8192 );
+
+	// PHP will close file handle, but we are good citizens.
+	fclose($fp);
+
+	// Grab just the first commented area from the file
+	if ( !preg_match( '|/\*(.*?Plugin Name:.*?)\*/|ims', $plugin_code, $plugin_block ) )
+		return false;
+        $plugin_data = trim( $plugin_block[1] );
+
+	preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $name );
+	preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $uri );
+	preg_match( '|Version:(.*)|i', $plugin_data, $version );
+	preg_match( '|Description:(.*)$|mi', $plugin_data, $description );
+	preg_match( '|Author:(.*)$|mi', $plugin_data, $author );
+	preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri );
+	preg_match( '|Text Domain:(.*)$|mi', $plugin_data, $text_domain );
+	preg_match( '|Domain Path:(.*)$|mi', $plugin_data, $domain_path );
+	preg_match( '|Requires at least:(.*)$|mi', $plugin_data, $requires );
+	preg_match( '|Tested up to:(.*)$|mi', $plugin_data, $tested );
+
+	// Normalise the path to the plugin
+	$plugin_file = str_replace( '\\', '/', $plugin_file );
+
+	foreach ( $bb->plugin_locations as $_name => $_data ) {
+		$_directory = str_replace( '\\', '/', $_data['dir'] );
+		if ( 0 === strpos( $plugin_file, $_directory ) ) {
+			$location = array( 1 => $_name );
+			break;
+		}
+	}
+
+	$plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
+
+	$fields = array(
+		'location' => '',
+		'name' => 'html',
+		'uri' => 'url',
+		'version' => 'text',
+		'description' => 'html',
+		'author' => 'html',
+		'author_uri' => 'url',
+		'text_domain' => '',
+		'domain_path' => '',
+		'requires' => 'text',
+		'tested' => 'text',
+	);
+	foreach ( $fields as $field => $san ) {
+		if ( !empty( ${$field} ) ) {
+			${$field} = trim(${$field}[1]);
+			switch ( $san ) {
+			case 'html' :
+				${$field} = bb_filter_kses( ${$field} );
+				break;
+			case 'text' :
+				${$field} = esc_html(  ${$field} );
+				break;
+			case 'url' :
+				${$field} = esc_url( ${$field} );
+				break;
+			}
+		} else {
+			${$field} = '';
+		}
+	}
+
+	$plugin_data = compact( array_keys( $fields ) );
+
+	if ( $translate )
+		$plugin_data = _bb_get_plugin_data_translate( $plugin_data );
+
+	if ( $markup )
+		$plugin_data['description'] = bb_autop( preg_replace( '/[\r\n]+/', "\n", trim( $plugin_data['description'] ) ) );
+
+	$plugin_data['plugin_link'] = ( $plugin_data['uri'] ) ?
+		"<a href='{$plugin_data['uri']}' title='" . esc_attr__( 'Visit plugin site' ) . "'>{$plugin_data['name']}</a>" :
+		$plugin_data['name'];
+	$plugin_data['author_link'] = ( $plugin_data['author'] && $plugin_data['author_uri'] ) ?
+		"<a href='{$plugin_data['author_uri']}' title='" . esc_attr__( 'Visit author homepage' ) . "'>{$plugin_data['author']}</a>" :
+		$plugin_data['author'];
+
+	return $plugin_data;
+}
+
+function _bb_get_plugin_data_translate( $plugin_data ) {
+	//Translate fields
+	if( !empty($plugin_data['text_domain']) ) {
+		if( ! empty( $plugin_data['domain_path'] ) )
+			bb_load_plugin_textdomain($plugin_data['text_domain'], dirname($plugin_file). $plugin_data['domain_path']);
+		else
+			bb_load_plugin_textdomain($plugin_data['text_domain'], dirname($plugin_file));
+
+		foreach ( array('name', 'plugin_url', 'description', 'author', 'author_uri', 'version') as $field )
+			$plugin_data[$field] = translate($plugin_data[$field], $plugin_data['text_domain']);
+	}
+
+	return $plugin_data;
+}
+
+/**
+ * Attempts activation of plugin in a "sandbox" and redirects on success.
+ *
+ * A plugin that is already activated will not attempt to be activated again.
+ *
+ * The way it works is by setting the redirection to the error before trying to
+ * include the plugin file. If the plugin fails, then the redirection will not
+ * be overwritten with the success message. Also, the options will not be
+ * updated and the activation hook will not be called on plugin error.
+ *
+ * It should be noted that in no way the below code will actually prevent errors
+ * within the file. The code should not be used elsewhere to replicate the
+ * "sandbox", which uses redirection to work.
+ *
+ * If any errors are found or text is outputted, then it will be captured to
+ * ensure that the success redirection will update the error redirection.
+ *
+ * @since 1.0
+ *
+ * @param string $plugin Plugin path to main plugin file with plugin data.
+ * @param string $redirect Optional. URL to redirect to.
+ * @return WP_Error|null WP_Error on invalid file or null on success.
+ */
+function bb_activate_plugin( $plugin, $redirect = '' ) {
+	$active_plugins = (array) bb_get_option( 'active_plugins' );
+	$plugin = bb_plugin_basename( trim( $plugin ) );
+
+	$valid_path = bb_validate_plugin( $plugin );
+	if ( is_wp_error( $valid_path ) )
+		return $valid_path;
+
+	if ( in_array( $plugin, $active_plugins ) ) {
+		return false;
+	}
+
+	if ( !empty( $redirect ) ) {
+		// We'll override this later if the plugin can be included without fatal error
+		wp_redirect( add_query_arg( '_scrape_nonce', bb_create_nonce( 'scrape-plugin_' . $plugin ), $redirect ) ); 
+	}
+
+	ob_start();
+	@include( $valid_path );
+	// Add to the active plugins array
+	$active_plugins[] = $plugin;
+	ksort( $active_plugins );
+	bb_update_option( 'active_plugins', $active_plugins );
+	do_action( 'bb_activate_plugin_' . $plugin );
+	ob_end_clean();
+
+	return $valid_path;
+}
+
+/**
+ * Deactivate a single plugin or multiple plugins.
+ *
+ * The deactivation hook is disabled by the plugin upgrader by using the $silent
+ * parameter.
+ *
+ * @since unknown
+ *
+ * @param string|array $plugins Single plugin or list of plugins to deactivate.
+ * @param bool $silent Optional, default is false. Prevent calling deactivate hook.
+ */
+function bb_deactivate_plugins( $plugins, $silent = false ) {
+	$active_plugins = (array) bb_get_option( 'active_plugins' );
+
+	if ( !is_array( $plugins ) ) {
+		$plugins = array( $plugins );
+	}
+
+	foreach ( $plugins as $plugin ) {
+		$plugin = bb_plugin_basename( trim( $plugin ) );
+		if ( !in_array( $plugin, $active_plugins ) ) {
+			continue;
+		}
+		// Remove the deactivated plugin
+		array_splice( $active_plugins, array_search( $plugin, $active_plugins ), 1 );
+		if ( !$silent ) {
+			do_action( 'bb_deactivate_plugin_' . $plugin );
+		}
+	}
+
+	bb_update_option( 'active_plugins', $active_plugins );
+}
+
+/**
+ * Validate the plugin path.
+ *
+ * Checks that the file exists and is valid file.
+ *
+ * @since 1.0
+ * @uses validate_file() to check the passed plugin identifier isn't malformed
+ * @uses bb_get_plugin_path() to get the full path of the plugin
+ * @uses bb_get_plugins() to get the plugins that actually exist
+ *
+ * @param string $plugin Plugin Path
+ * @param string $location The location of plugin, one of 'user', 'core' or 'all'
+ * @param string $type The type of plugin, one of 'all', 'autoload' or 'normal'
+ * @return WP_Error|int 0 on success, WP_Error on failure.
+ */
+function bb_validate_plugin( $plugin, $location = 'all', $type = 'all' ) {
+	if ( validate_file( trim( $plugin ) ) ) {
+		return new WP_Error( 'plugin_invalid', __( 'Invalid plugin path.' ) );
+	}
+	$path = bb_get_plugin_path( trim( $plugin ) );
+	if ( !file_exists( $path ) ) {
+		return new WP_Error( 'plugin_not_found', __( 'Plugin file does not exist.' ) );
+	}
+	if ( !in_array( trim( $plugin ), array_keys( bb_get_plugins( $location, $type ) ) ) ) {
+		return new WP_Error( 'plugin_not_available', __( 'That type of plugin is not available in the specified location.' ) );
+	}
+
+	return $path;
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/functions.bb-upgrade.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/functions.bb-upgrade.php
new file mode 100644
index 0000000000000000000000000000000000000000..37bdeb24b1423e8c57b8a444a74a804bee914879
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/functions.bb-upgrade.php
@@ -0,0 +1,503 @@
+<?php
+function bb_install() {
+	require_once( BACKPRESS_PATH . 'class.bp-sql-schema-parser.php' );
+	require_once( BB_PATH . 'bb-admin/includes/defaults.bb-schema.php' );
+	$alterations = BP_SQL_Schema_Parser::delta( $bbdb, $bb_queries, $bb_schema_ignore );
+
+	bb_update_db_version();
+
+	return array_filter($alterations);
+}
+
+function bb_upgrade_all() {
+	if ( !ini_get('safe_mode') )
+		set_time_limit(600);
+
+	$bb_upgrade = array();
+
+	// Pre DB Delta
+	$bb_upgrade['messages'][] = bb_upgrade_160(); // Break blocked users
+	$bb_upgrade['messages'][] = bb_upgrade_170(); // Escaping in usermeta
+	$bb_upgrade['messages'][] = bb_upgrade_180(); // Delete users for real
+	$bb_upgrade['messages'][] = bb_upgrade_190(); // Move topic_resolved to topicmeta
+	$bb_upgrade['messages'][] = bb_upgrade_200(); // Indices
+	$bb_upgrade['messages'][] = bb_upgrade_210(); // Convert text slugs to varchar slugs
+	$bb_upgrade['messages'][] = bb_upgrade_220(); // remove bb_tagged primary key, add new column and primary key
+
+	require_once( BACKPRESS_PATH . 'class.bp-sql-schema-parser.php' );
+	require_once( BB_PATH . 'bb-admin/includes/defaults.bb-schema.php' );
+	$delta = BP_SQL_Schema_Parser::delta( $bbdb, $bb_queries, $bb_schema_ignore );
+	if ( is_array( $delta ) ) {
+		$bb_upgrade['messages'] = array_merge($bb_upgrade['messages'], $delta['messages']);
+		$bb_upgrade['errors'] = $delta['errors'];
+	} else {
+		$bb_upgrade['errors'] = array();
+	}
+
+	// Post DB Delta
+	$bb_upgrade['messages'][] = bb_upgrade_1000(); // Make forum and topic slugs
+	$bb_upgrade['messages'][] = bb_upgrade_1010(); // Make sure all forums have a valid parent
+	$bb_upgrade['messages'][] = bb_upgrade_1020(); // Add a user_nicename to existing users
+	$bb_upgrade['messages'][] = bb_upgrade_1030(); // Move admin_email option to from_email
+	$bb_upgrade['messages'][] = bb_upgrade_1040(); // Activate Akismet and bozo plugins and convert active plugins to new convention on upgrade only
+	$bb_upgrade['messages'][] = bb_upgrade_1050(); // Update active theme if present
+	$bb_upgrade['messages'][] = bb_upgrade_1070(); // trim whitespace from raw_tag
+	$bb_upgrade['messages'][] = bb_upgrade_1080(); // Convert tags to taxonomy
+	$bb_upgrade['messages'][] = bb_upgrade_1090(); // Add display names
+	$bb_upgrade['messages'][] = bb_upgrade_1100(); // Replace forum_stickies index with stickies (#876)
+	$bb_upgrade['messages'][] = bb_upgrade_1110(); // Create plugin directory (#1083)
+	$bb_upgrade['messages'][] = bb_upgrade_1120(); // Create theme directory (#1083)
+
+	bb_update_db_version();
+	wp_cache_flush();
+
+	$bb_upgrade['messages'] = array_filter($bb_upgrade['messages']);
+	$bb_upgrade['errors'] = array_filter($bb_upgrade['errors']);
+
+	return $bb_upgrade;
+}
+
+function bb_upgrade_process_all_slugs() {
+	global $bbdb;
+	// Forums
+
+	$forums = (array) $bbdb->get_results("SELECT forum_id, forum_name FROM $bbdb->forums ORDER BY forum_order ASC" );
+
+	$slugs = array();
+	foreach ( $forums as $forum ) :
+		$slug = bb_slug_sanitize( wp_specialchars_decode( $forum->forum_name, ENT_QUOTES ) );
+		$slugs[$slug][] = $forum->forum_id;
+	endforeach;
+
+	foreach ( $slugs as $slug => $forum_ids ) :
+		foreach ( $forum_ids as $count => $forum_id ) :
+			$_slug = $slug;
+			$count = - $count; // madness
+			if ( is_numeric($slug) || $count )
+				$_slug = bb_slug_increment( $slug, $count );
+			$bbdb->query("UPDATE $bbdb->forums SET forum_slug = '$_slug' WHERE forum_id = '$forum_id';");
+		endforeach;
+	endforeach;
+	unset($forums, $forum, $slugs, $slug, $_slug, $forum_ids, $forum_id, $count);
+
+	// Topics
+
+	$topics = (array) $bbdb->get_results("SELECT topic_id, topic_title FROM $bbdb->topics ORDER BY topic_start_time ASC" );
+
+	$slugs = array();
+	foreach ( $topics as $topic) :
+		$slug = bb_slug_sanitize( wp_specialchars_decode( $topic->topic_title, ENT_QUOTES ) );
+		$slugs[$slug][] = $topic->topic_id;
+	endforeach;
+
+	foreach ( $slugs as $slug => $topic_ids ) :
+		foreach ( $topic_ids as $count => $topic_id ) :
+			$_slug = $slug;
+			$count = - $count;
+			if ( is_numeric($slug) || $count )
+				$_slug = bb_slug_increment( $slug, $count );
+			$bbdb->query("UPDATE $bbdb->topics SET topic_slug = '$_slug' WHERE topic_id = '$topic_id';");
+		endforeach;
+	endforeach;
+	unset($topics, $topic, $slugs, $slug, $_slug, $topic_ids, $topic_id, $count);
+}
+
+// Reversibly break passwords of blocked users.
+function bb_upgrade_160() {
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 535 )
+		return;
+
+	require_once( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );
+	$blocked = bb_get_ids_by_role( 'blocked' );
+	foreach ( $blocked as $b )
+		bb_break_password( $b );
+	return 'Done reversibly breaking passwords: ' . __FUNCTION__;
+}
+
+function bb_upgrade_170() {
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 536 )
+		return;
+
+	global $bbdb;
+	foreach ( (array) $bbdb->get_results("SELECT * FROM $bbdb->usermeta WHERE meta_value LIKE '%&quot;%' OR meta_value LIKE '%&#039;%'") as $meta ) {
+		$value = str_replace(array('&quot;', '&#039;'), array('"', "'"), $meta->meta_value);
+		$value = stripslashes($value);
+		bb_update_usermeta( $meta->user_id, $meta->meta_key, $value);
+	}
+	bb_update_option( 'bb_db_version', 536 );
+	return 'Done updating usermeta: ' . __FUNCTION__;
+}
+
+function bb_upgrade_180() {
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 559 )
+		return;
+
+	global $bbdb;
+
+	foreach ( (array) $bbdb->get_col("SELECT ID FROM $bbdb->users WHERE user_status = 1") as $user_id )
+		bb_delete_user( $user_id );
+	bb_update_option( 'bb_db_version', 559 );
+	return 'Done clearing deleted users: ' . __FUNCTION__;
+}
+
+function bb_upgrade_190() {
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 630 )
+		return;
+
+	global $bbdb;
+
+	$exists = false;
+	foreach ( (array) $bbdb->get_col("DESC $bbdb->topics") as $col )
+		if ( 'topic_resolved' == $col )
+			$exists = true;
+	if ( !$exists )
+		return;
+
+	$topics = (array) $bbdb->get_results("SELECT topic_id, topic_resolved FROM $bbdb->topics" );
+	foreach ( $topics  as $topic )
+		bb_update_topicmeta( $topic->topic_id, 'topic_resolved', $topic->topic_resolved );
+	unset($topics,$topic);
+
+	$bbdb->query("ALTER TABLE $bbdb->topics DROP topic_resolved");
+
+	bb_update_option( 'bb_db_version', 630 );
+
+	return 'Done converting topic_resolved: ' . __FUNCTION__;
+}
+
+function bb_upgrade_200() {
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 845 )
+		return;
+
+	global $bbdb;
+
+	$bbdb->hide_errors();
+	$bbdb->query( "DROP INDEX tag_id_index ON $bbdb->tagged" );
+	$bbdb->query( "DROP INDEX user_id ON $bbdb->topicmeta" );
+	$bbdb->query( "DROP INDEX forum_id ON $bbdb->topics" );
+	$bbdb->query( "DROP INDEX topic_time ON $bbdb->topics" );
+	$bbdb->query( "DROP INDEX topic_start_time ON $bbdb->topics" );
+	$bbdb->query( "DROP INDEX tag_id_index ON $bbdb->tagged" );
+	$bbdb->query( "DROP INDEX topic_id ON $bbdb->posts" );
+	$bbdb->query( "DROP INDEX poster_id ON $bbdb->posts" );
+	$bbdb->show_errors();
+
+	bb_update_option( 'bb_db_version', 845 );
+
+	return 'Done removing old indices: ' . __FUNCTION__;
+}
+
+// 210 converts text slugs to varchar(255) width slugs (upgrading from alpha version - fires before dbDelta)
+// 1000 Gives new slugs (upgrading from previous release - fires after dbDelta)
+function bb_upgrade_210() {
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 846 )
+		return;
+
+	global $bbdb;
+
+	$bbdb->hide_errors();
+	if ( !$bbdb->get_var("SELECT forum_slug FROM $bbdb->forums ORDER BY forum_order ASC LIMIT 1" ) )
+		return; // Wait till after dbDelta
+	$bbdb->show_errors();
+
+	bb_upgrade_process_all_slugs();
+
+	bb_update_option( 'bb_db_version', 846 );
+	
+	return 'Done adding slugs: ' . __FUNCTION__;
+}
+
+function bb_upgrade_220() {
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 1051 )
+		return;
+
+	global $bbdb;
+
+	$bbdb->query( "ALTER TABLE $bbdb->tagged DROP PRIMARY KEY" );
+	$bbdb->query( "ALTER TABLE $bbdb->tagged ADD tagged_id bigint(20) unsigned NOT NULL auto_increment PRIMARY KEY FIRST" );
+
+	return "Done removing key from $bbdb->tagged: " . __FUNCTION__;
+}
+
+function bb_upgrade_1000() { // Give all topics and forums slugs
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 846 )
+		return;
+
+	bb_upgrade_process_all_slugs();
+
+	bb_update_option( 'bb_db_version', 846 );
+	
+	return 'Done adding slugs: ' . __FUNCTION__;;
+}
+
+// Make sure all forums have a valid parent
+function bb_upgrade_1010() {
+	global $bbdb;
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 952 )
+		return;
+
+	$forums = (array) $bbdb->get_results( "SELECT forum_id, forum_parent FROM $bbdb->forums" );
+	$forum_ids = (array) $bbdb->get_col( '', 0 );
+
+	foreach ( $forums as $forum ) {
+		if ( $forum->forum_parent && !in_array( $forum->forum_parent, $forum_ids ) )
+			$bbdb->query( "UPDATE $bbdb->forums SET forum_parent = 0 WHERE forum_id = '$forum->forum_id'" );
+	}
+
+	bb_update_option( 'bb_db_version', 952 );
+	
+	return 'Done re-parenting orphaned forums: ' . __FUNCTION__;
+}
+
+// Add a nicename for existing users if they don't have one already
+function bb_upgrade_1020() {
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 977 )
+		return;
+	
+	global $bbdb;
+	
+	$users = $bbdb->get_results( "SELECT ID, user_login, user_nicename FROM $bbdb->users WHERE user_nicename IS NULL OR user_nicename = ''" );
+	
+	if ( $users ) {
+		foreach ( $users as $user ) {
+			$user_nicename = $_user_nicename = bb_user_nicename_sanitize( $user->user_login );
+			while ( is_numeric($user_nicename) || $existing_user = bb_get_user_by_nicename( $user_nicename ) )
+				$user_nicename = bb_slug_increment($_user_nicename, $existing_user->user_nicename, 50);
+			
+			$bbdb->query( "UPDATE $bbdb->users SET user_nicename = '$user_nicename' WHERE ID = $user->ID;" );
+		}
+	}
+	
+	bb_update_option( 'bb_db_version', 977 );
+	
+	return 'Done adding nice-names to existing users: ' . __FUNCTION__;
+}
+
+// Move admin_email option to from_email
+function bb_upgrade_1030() {
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 1058 )
+		return;
+	
+	$admin_email = bb_get_option('admin_email');
+	if ($admin_email) {
+		bb_update_option('from_email', $admin_email);
+	}
+	bb_delete_option('admin_email');
+	
+	bb_update_option( 'bb_db_version', 1058 );
+	
+	return 'Done moving admin_email to from_email: ' . __FUNCTION__;
+}
+
+// Activate Akismet and bozo plugins and convert active plugins to new convention on upgrade only
+function bb_upgrade_1040() {
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 1230 )
+		return;
+	
+	// Only do this when upgrading
+	if ( defined( 'BB_UPGRADING' ) && BB_UPGRADING ) {
+		$plugins = bb_get_option('active_plugins');
+		if ( bb_get_option('akismet_key') && !in_array('core#akismet.php', $plugins) ) {
+			$plugins[] = 'core#akismet.php';
+		}
+		if ( !in_array('core#bozo.php', $plugins) ) {
+			$plugins[] = 'core#bozo.php';
+		}
+		
+		$new_plugins = array();
+		foreach ($plugins as $plugin) {
+			if (substr($plugin, 0, 5) != 'core#') {
+				if ($plugin != 'akismet.php' && $plugin != 'bozo.php') {
+					$new_plugins[] = 'user#' . $plugin;
+				}
+			} else {
+				$new_plugins[] = $plugin;
+			}
+		}
+		
+		bb_update_option( 'active_plugins', $new_plugins );
+	}
+	
+	bb_update_option( 'bb_db_version', 1230 );
+	
+	return 'Done activating Akismet and Bozo plugins and converting active plugins to new convention on upgrade only: ' . __FUNCTION__;
+}
+
+// Update active theme if present
+function bb_upgrade_1050() {
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 1234 )
+		return;
+	
+	// Only do this when upgrading
+	if ( defined( 'BB_UPGRADING' ) && BB_UPGRADING ) {
+		if ( $theme = bb_get_option( 'bb_active_theme' ) ) {
+			bb_update_option( 'bb_active_theme', bb_theme_basename( $theme ) );
+		}
+	}
+	
+	bb_update_option( 'bb_db_version', 1234 );
+	
+	return 'Done updating active theme if present: ' . __FUNCTION__;
+}
+
+function bb_upgrade_1070() {
+	global $bbdb;
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 1467 )
+		return;
+
+	$bbdb->query( "UPDATE `$bbdb->tags` SET `raw_tag` = TRIM(`raw_tag`)" );
+
+	bb_update_option( 'bb_db_version', 1467 );
+
+	return 'Whitespace trimmed from raw_tag: ' . __FUNCTION__;
+}
+
+function bb_upgrade_1080() {
+	global $bbdb, $wp_taxonomy_object;
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 1526 )
+		return;
+
+	$offset = 0;
+	while ( $tags = (array) $bbdb->get_results( "SELECT * FROM $bbdb->tags LIMIT $offset, 100" ) ) {
+		if ( !ini_get('safe_mode') ) set_time_limit(600);
+		$wp_taxonomy_object->defer_term_counting(true);
+		for ( $i = 0; isset($tags[$i]); $i++ ) {
+			$bbdb->insert( $bbdb->terms, array( 
+				'name' => $tags[$i]->raw_tag,
+				'slug' => $tags[$i]->tag
+			) );
+			$term_id = $bbdb->insert_id;
+			$bbdb->insert( $bbdb->term_taxonomy, array(
+				'term_id' => $term_id,
+				'taxonomy' => 'bb_topic_tag',
+				'description' => ''
+			) );
+			$term_taxonomy_id = $bbdb->insert_id;
+			$topics = (array) $bbdb->get_results( $bbdb->prepare( "SELECT user_id, topic_id FROM $bbdb->tagged WHERE tag_id = %d", $tags[$i]->tag_id ) );
+			for ( $j = 0; isset($topics[$j]); $j++ ) {
+				$bbdb->insert( $bbdb->term_relationships, array(
+					'object_id' => $topics[$j]->topic_id,
+					'term_taxonomy_id' => $term_taxonomy_id,
+					'user_id' => $topics[$j]->user_id
+				) );
+			}
+			$wp_taxonomy_object->update_term_count( array( $term_taxonomy_id ), 'bb_topic_tag' );
+		}
+		$wp_taxonomy_object->defer_term_counting(false);
+		$offset += 100;
+	}
+
+	bb_update_option( 'bb_db_version', 1526 );
+
+	return 'Tags copied to taxonomy tables: ' . __FUNCTION__;
+}
+
+function bb_upgrade_1090() {
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 1589 )
+		return;
+
+	global $bbdb;
+
+	$users = (array) $bbdb->get_results( "SELECT `ID`, `user_login` FROM $bbdb->users WHERE `display_name` = '' OR `display_name` IS NULL;" );
+
+	if ($users) {
+		foreach ($users as $user) {
+			$bbdb->query( "UPDATE $bbdb->users SET `display_name` = '" . $user->user_login . "' WHERE ID = " . $user->ID . ";" );
+		}
+		unset($user, $users);
+	}
+
+	bb_update_option( 'bb_db_version', 1589 );
+
+	return 'Display names populated: ' . __FUNCTION__;
+}
+
+function bb_upgrade_1100() {
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 1638 )
+		return;
+
+	global $bbdb;
+
+	$bbdb->query( "DROP INDEX forum_stickies ON $bbdb->topics" );
+
+	bb_update_option( 'bb_db_version', 1638 );
+
+	return 'Index forum_stickies dropped: ' . __FUNCTION__;
+}
+
+function bb_upgrade_1110() {
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 2077 )
+		return;
+
+	// No matter what happens, update the db version
+	bb_update_option( 'bb_db_version', 2077 );
+
+	if ( !defined( 'BB_PLUGIN_DIR' ) ) {
+		return;
+	}
+
+	if ( !BB_PLUGIN_DIR ) {
+		return;
+	}
+
+	if ( file_exists( BB_PLUGIN_DIR ) ) {
+		return;
+	}
+
+	// Just suppress errors as this is not critical
+	if ( @mkdir( BB_PLUGIN_DIR, 0755 ) ) {
+		return 'Making plugin directory at ' . BB_PLUGIN_DIR . ': ' . __FUNCTION__;
+	}
+
+	return;
+}
+
+function bb_upgrade_1120() {
+	if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 2078 ) {
+		return;
+	}
+
+	// No matter what happens, update the db version
+	bb_update_option( 'bb_db_version', 2078 );
+
+	if ( !defined( 'BB_THEME_DIR' ) ) {
+		return;
+	}
+
+	if ( !BB_THEME_DIR ) {
+		return;
+	}
+
+	if ( file_exists( BB_THEME_DIR ) ) {
+		return;
+	}
+
+	// Just suppress errors as this is not critical
+	if ( @mkdir( BB_THEME_DIR, 0755 ) ) {
+		return 'Making theme directory at ' . BB_THEME_DIR . ': ' . __FUNCTION__;
+	}
+
+	return;
+}
+
+function bb_deslash($content) {
+    // Note: \\\ inside a regex denotes a single backslash.
+
+    // Replace one or more backslashes followed by a single quote with
+    // a single quote.
+    $content = preg_replace("/\\\+'/", "'", $content);
+
+    // Replace one or more backslashes followed by a double quote with
+    // a double quote.
+    $content = preg_replace('/\\\+"/', '"', $content);
+
+    // Replace one or more backslashes with one backslash.
+    $content = preg_replace("/\\\+/", "\\", $content);
+
+    return $content;
+}
+
+function bb_update_db_version() {
+	bb_update_option( 'bb_db_version', bb_get_option( 'bb_db_version' ) );
+}
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/index.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/index.php
new file mode 100644
index 0000000000000000000000000000000000000000..04246639161129d5a3c313ef3e0e7d5d35304aa1
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/index.php
@@ -0,0 +1,123 @@
+<?php
+require_once('admin.php');
+require_once( BB_PATH . BB_INC . 'functions.bb-statistics.php' );
+
+$rn_forums = get_total_forums();
+$rn_forums = sprintf(__ngettext('<span>%d</span> forum', '<span>%d</span> forums', $rn_forums), $rn_forums);
+
+$rn_topics = get_total_topics();
+$rn_topics = sprintf(__ngettext('<span>%d</span> topic', '<span>%d</span> topics', $rn_topics), $rn_topics);
+
+$rn_posts = get_total_posts();
+$rn_posts = sprintf(__ngettext('<span>%d</span> post', '<span>%d</span> posts', $rn_posts), $rn_posts);
+
+$rn_users = bb_get_total_users();
+$rn_users = sprintf(__ngettext('<span>%d</span> user', '<span>%d</span> users', $rn_users), $rn_users);
+
+$rn_topic_tags = bb_get_total_topic_tags();
+$rn_topic_tags = sprintf(__ngettext('<span>%d</span> tag', '<span>%d</span> tags', $rn_topic_tags), $rn_topic_tags);
+
+$rn_topics_average = get_topics_per_day();
+$rn_topics_average = sprintf(__ngettext('<span>%d</span> topic', '<span>%d</span> topics', $rn_topics_average), $rn_topics_average);
+
+$rn_posts_average = get_posts_per_day();
+$rn_posts_average = sprintf(__ngettext('<span>%d</span> post', '<span>%d</span> posts', $rn_posts_average), $rn_posts_average);
+
+$rn_users_average = get_registrations_per_day();
+$rn_users_average = sprintf(__ngettext('<span>%d</span> user', '<span>%d</span> users', $rn_users_average), $rn_users_average);
+
+$rn_topic_tags_average = bb_get_topic_tags_per_day();
+$rn_topic_tags_average = sprintf(__ngettext('<span>%d</span> tag', '<span>%d</span> tags', $rn_topic_tags_average), $rn_topic_tags_average);
+
+$bb_admin_body_class = ' bb-admin-dashboard';
+
+bb_get_admin_header();
+?>
+
+<div class="wrap">
+	<h2><?php _e('Dashboard'); ?></h2>
+	<?php do_action( 'bb_admin_notices' ); ?>
+
+	<div id="dashboard-right-now" class="dashboard">
+		<h3><?php _e('Right Now'); ?></h3>
+		<div class="table">
+			<table cellpadding="0" cellspacing="0">
+				<thead>
+					<tr>
+						<th><?php _e( 'Totals' ); ?></th>
+						<th><?php _e( 'Per Day' ); ?></th>
+					</tr>
+				</thead>
+				<tbody>
+					<tr>
+						<td><?php echo $rn_forums; ?></td>
+						<td>-</td>
+					</tr>
+					<tr>
+						<td><?php echo $rn_topics; ?></td>
+						<td><?php echo $rn_topics_average; ?></td>
+					</tr>
+					<tr>
+						<td><?php echo $rn_posts; ?></td>
+						<td><?php echo $rn_posts_average; ?></td>
+					</tr>
+					<tr>
+						<td><?php echo $rn_topic_tags; ?></td>
+						<td><?php echo $rn_topic_tags_average; ?></td>
+					</tr>
+					<tr>
+						<td><?php echo $rn_users; ?></td>
+						<td><?php echo $rn_users_average; ?></td>
+					</tr>
+				</tbody>
+			</table>
+		</div>
+
+		<div class="versions">
+			<p class="theme"><a class="button" href="<?php bb_uri( 'bb-admin/themes.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN ); ?>"><?php _e( 'Change Theme' ); ?></a><?php printf ( __( 'Theme <a href="%1$s">%2$s</a>' ), bb_get_uri( 'bb-admin/themes.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN ), bb_get_current_theme_data( 'Name' ) ); ?></p>
+			<p class="bbpress"><?php printf( __( 'You are using <span class="b">bbPress %s</span>' ), bb_get_option( 'version' ) ); ?></p>
+		</div>
+	</div>
+
+	<div id="dashboard-moderated" class="dashboard">
+		<h3><?php _e('Recently Moderated Items'); ?></h3>
+		<?php if ( $objects = bb_get_recently_moderated_objects() ) : ?>
+		<ul class="posts">
+			<?php add_filter( 'get_topic_where', 'bb_no_where' ); foreach ( $objects as $object ) : ?>
+			<?php if ( 'post' == $object['type'] ) : global $bb_post; $bb_post = $object['data']; ?>
+			<li>
+<?php
+					printf(
+						__( '<a href="%1$s">Post</a> on <a href="%2$s">%3$s</a> by <a href="%4$s">%5$s</a>' ),
+						esc_attr( add_query_arg( 'view', 'all', get_post_link() ) ),
+						get_topic_link( $bb_post->topic_id ),
+						get_topic_title( $bb_post->topic_id ),
+						get_user_profile_link( $bb_post->poster_id ),
+						get_post_author()
+					);
+?>
+			</li>
+			<?php elseif ( 'topic' == $object['type'] ) : global $topic; $topic = $object['data']; ?>
+			<li>
+<?php
+					printf(
+						__( 'Topic titled <a href="%1$s">%2$s</a> started by <a href="%3$s">%4$s</a>' ),
+						esc_attr( add_query_arg( 'view', 'all', get_topic_link() ) ),
+						get_topic_title(),
+						get_user_profile_link( $topic->topic_poster ),
+						get_topic_author()
+					);
+?>
+			</li>
+			<?php endif; endforeach; remove_filter( 'get_topic_where', 'bb_no_where' ); ?>
+		</ul>
+		<?php else : ?>
+		<p>
+			<?php _e('No moderated posts or topics&#8230; you must have very well behaved members.'); ?>
+		</p>
+		<?php endif; ?>
+	</div>
+	<div class="clear"></div>
+</div>
+
+<?php bb_get_admin_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/install-rtl.css b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/install-rtl.css
new file mode 100644
index 0000000000000000000000000000000000000000..9accfa7183b2ba0a2191ecff4fa925268c2c5c09
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/install-rtl.css
@@ -0,0 +1,100 @@
+body {
+	font-family: Tahoma, "Times New Roman";
+}
+
+div#container {
+	text-align: right;
+}
+
+dl {
+	border-left-width: 0;
+	border-right: 1px solid rgb(125, 125, 125);
+	margin-right: 2.5em;
+	margin-left: 0;
+}
+
+dt {
+	padding-right: 0.6em;
+	padding-left: 0;
+}
+
+dd {
+	padding-right: 3.6em;
+	padding-left: 0;
+}
+
+p.status {
+	right: auto;
+	left: 0;
+	text-shadow: none;
+}
+
+h2 {
+	text-shadow: none;
+}
+
+label a.note-toggle {
+	float: right;
+	padding-left: 0;
+	width: 18px;
+	margin-left: 0;
+	margin-right: 6px;
+}
+
+label.has-note.for-textarea a.note-toggle {
+	margin-left: 0;
+	margin-right: 6px;
+}
+
+label.has-note.for-select a.note-toggle {
+	margin-left: 0;
+	margin-right: 4px;
+}
+
+label.has-note.for-toggle a.note-toggle {
+	margin-left: 0;
+	margin-right: 6px;
+}
+
+label.for-textarea span,
+label.for-toggle span {
+	float: right;
+}
+
+label span.error {
+	margin-right: 3em;
+	margin-left: 0.4em;
+}
+
+fieldset.buttons label.forward {
+	float: left;
+}
+
+fieldset.buttons label.back {
+	float: right;
+}
+
+p.note {
+	margin-right: 2.5em;
+	margin-left: 0;
+	border-left-width: 0;
+	border-right: 1px solid rgb(50, 140, 0);
+}
+
+input.text {
+	font-family: Tahoma, "Times New Roman";
+	float: right;
+}
+
+select {
+	font-family: Tahoma, "Times New Roman";
+	float: right;
+}
+
+textarea {
+	font-family: Tahoma, "Times New Roman";
+}
+
+input.button {
+	font-family: Tahoma, "Times New Roman";
+}
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/install.css b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/install.css
new file mode 100644
index 0000000000000000000000000000000000000000..6870df00cc25f928f2c0ce067516fa636844bf43
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/install.css
@@ -0,0 +1,433 @@
+/*
+Start with some basic resets
+*/
+
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.7.0
+*/
+html{color:#000;background:#FFF;}
+body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td{margin:0;padding:0;}
+table{border-collapse:collapse;border-spacing:0;}
+fieldset,img{border:0;}
+address,caption,cite,code,dfn,em,strong,th,var,optgroup{font-style:inherit;font-weight:inherit;}
+del,ins{text-decoration:none;}
+li{list-style:none;}
+caption,th{text-align:left;}
+h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}
+q:before,q:after{content:'';}
+abbr,acronym{border:0;font-variant:normal;}
+sup{vertical-align:baseline;}
+sub{vertical-align:baseline;}
+legend{color:#000;}
+input,button,textarea,select,optgroup,option{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;}
+input,button,textarea,select{*font-size:100%;}
+body{font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}
+select,input,button,textarea,button{font:99% arial,helvetica,clean,sans-serif;}
+table{font-size:inherit;font:100%;}
+pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}
+
+/*
+Now for our own code
+*/
+
+html {
+	background-color: rgb(247, 247, 247);
+}
+
+body {
+	text-align: center;
+	font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
+	font-size: 1em;
+	color: rgb(255, 255, 255);
+}
+
+div#container {
+	margin: 2em auto 1em auto;
+	padding: 1em 32px;
+	width: 700px;
+	background-color: rgb(255, 255, 255);
+	text-align: left;
+	-moz-border-radius: 11px;
+	-khtml-border-radius: 11px;
+	-webkit-border-radius: 11px;
+	border-radius: 11px;
+	border: 1px solid rgb(223, 223, 223);
+	color: rgb(51, 51, 51);
+}
+
+a {
+	color: rgb(50, 140, 0);
+	text-decoration: none;
+}
+
+a:hover {
+	text-decoration: underline;
+}
+
+strong {
+	font-weight: bold;
+}
+
+em {
+	font-style: italic;
+}
+
+div.logo img {
+	margin: 12px 0 27px 0;
+	width: 200px;
+	height: 57px;
+	display: block;
+}
+
+h1 {
+	margin: 0 0 2em 0;
+	font-size: 0.75em;
+	font-weight: bold;
+}
+
+p {
+	margin: 0 0 1em 0;
+	font-size: 0.75em;
+	line-height: 1.4em;
+}
+
+dl {
+	border-left: 1px solid rgb(125, 125, 125);
+	margin: 1.5em 0 1.5em 2.5em;
+	font-size: 0.75em;
+}
+
+dl code {
+	font-size: 1.4em;
+}
+
+dt {
+	font-size: 1em;
+	padding: 0.6em 0 0.2em 0.6em;
+}
+
+dd {
+	font-size: 1em;
+	padding: 0 0 0.6em 3.6em;
+}
+
+p.status {
+	position: absolute;
+	right: 0;
+	top: -2.4em;
+	margin: 0;
+	padding: 0.5em 1em;
+	line-height: 1.4em;
+	text-shadow: rgb(255, 255, 255) 0px 1px 0px;
+	color: rgb(70, 70, 70);
+}
+
+p code {
+	font-size: 1.25em;
+}
+
+div.open div p.error.last,
+div.open div p.message.last {
+	margin-bottom: 1.4em;
+}
+
+h2 {
+	font-size: 0.75em;
+	background-color: rgb(236, 236, 236);
+	padding: 0.5em 1em;
+	text-shadow: rgb(255, 255, 255) 0px 1px 0px;
+	color: rgb(70, 70, 70);
+	font-weight: bold;
+	line-height: 1.4em;
+}
+
+div.open,
+div.closed {
+	border: 1px solid rgb(223, 223, 223);
+	-moz-border-radius: 6px;
+	-khtml-border-radius: 6px;
+	-webkit-border-radius: 6px;
+	border-radius: 6px;
+	margin-bottom: 1em;
+	background-color: rgb(247, 247, 247);
+}
+
+div.open div {
+	padding: 1em;
+	margin: 1px 0;
+}
+
+div.closed div {
+	position: relative;
+}
+
+p.error {
+	border: 1px solid rgb(204, 0, 0);
+	background-color: rgb(255, 235, 232);
+	padding: 0.6em;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+}
+
+p.error a {
+	color: rgb(204, 0, 0);
+}
+
+dl.error {
+	margin-top: -1em;
+}
+
+p.message {
+	border: 1px solid rgb(230, 219, 85);
+	background-color: rgb(255, 251, 204);
+	padding: 0.6em;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+}
+
+div.open div.toggle {
+	margin: 0;
+	padding: 0;
+}
+
+div.open h2 {
+	color: rgb(0, 0, 0);
+}
+
+form {
+	clear: both;
+	border: 1px solid rgb(223, 223, 223);
+	background-color: rgb(255, 255, 255);
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+	padding: 1em 1em 1em 1em;
+}
+
+legend {
+	font-size: 0.9em;
+	font-weight: bold;
+	padding-bottom: 0.5em;
+}
+
+label {
+	display: block;
+	margin: 0 0 1.8em 0;
+	font-size: 0.75em;
+	color: rgb(34, 34, 34);
+	cursor: pointer;
+	clear: both;
+}
+
+label span {
+	display: block;
+	margin-bottom: 5px;
+}
+
+label.error {
+	border: 1px solid rgb(204, 0, 0);
+	background-color: rgb(255, 235, 232);
+	padding: 0.6em;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+}
+
+label.forward {
+	clear: none;
+}
+
+label a.note-toggle {
+	background-color: rgb(223, 223, 223);
+	color: rgb(255, 255, 255);
+	display: block;
+	text-align: center;
+	float: left;
+	font-weight: bold;
+	font-size: 1.2em;
+	padding-top: 1px;
+	padding-left: 1px;
+	width: 18px;
+	height: 18px;
+	line-height: 18px;
+	margin-left: 6px;
+	margin-top: 4px;
+	-moz-border-radius: 9px;
+	-khtml-border-radius: 9px;
+	-webkit-border-radius: 9px;
+	border-radius: 9px;
+}
+
+label a.note-toggle:hover {
+	text-decoration: none;
+	background-color: rgb(50, 140, 0);
+}
+
+label.has-note.for-textarea a.note-toggle {
+	margin-top: -2px;
+	margin-left: 6px;
+}
+
+label.has-note.for-select a.note-toggle {
+	margin-top: 3px;
+	margin-left: 4px;
+}
+
+label.has-note.for-toggle a.note-toggle {
+	margin-top: -2px;
+	margin-left: 6px;
+}
+
+label.for-textarea span,
+label.for-toggle span {
+	float: left;
+}
+
+label.for-toggle span {
+	margin-bottom: 0;
+}
+
+label span.error {
+	color: rgb(204, 0, 0);
+	display: block;
+	margin: 0.4em 0.4em 0.4em 3em;
+}
+
+label code {
+	font-size: 1.25em;
+}
+
+fieldset.buttons label.forward {
+	margin: 0;
+	float: right;
+}
+
+fieldset.buttons label.back {
+	margin: 0;
+	float: left;
+}
+
+p.note {
+	margin: 0 0 0 2.5em;
+	color: rgb(102, 102, 102);
+	border-left: 1px solid rgb(50, 140, 0);
+	padding: 0.6em;
+	font-size: 0.9em;
+	font-style: italic;
+	clear: both;
+}
+
+input.text {
+	font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
+	font-size: 1.2em;
+	padding: 4px;
+	border: 1px solid rgb(187, 187, 187);
+	width: 400px;
+	display: block;
+	float: left;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+	clear: both;
+}
+
+select {
+	font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
+	font-size: 1.2em;
+	padding: 0;
+	border: 1px solid rgb(187, 187, 187);
+	display: block;
+	float: left;
+}
+
+textarea {
+	font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
+	font-size: 0.9em;
+	padding: 0;
+	border: 1px solid rgb(187, 187, 187);
+	width: 630px;
+	max-width: 630px;
+	height: 38em;
+	display: block;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+	clear: both;
+}
+
+textarea#config {
+	text-align: left;
+}
+
+textarea.short,
+textarea#error_log {
+	height: 15em;
+}
+
+textarea#error_log {
+	border-color: rgb(153, 0, 0);
+	color: rgb(153, 0, 0);
+}
+
+input.checkbox {
+	font-size: 1.25em;
+}
+
+input.button {
+	background: url('images/white-grad.png') repeat-x 0 0 rgb(242, 242, 242);
+	-moz-border-radius: 15px;
+	-khtml-border-radius: 15px;
+	-webkit-border-radius: 15px;
+	border-radius: 15px;
+	border: 1px solid rgb(187, 187, 187);
+	color: rgb(70, 70, 70);
+	cursor: pointer;
+	font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
+	font-size: 1.2em;
+	line-height: 1.2em;
+	padding: 0.45em 0.9em;
+	text-decoration: none;
+}
+
+input.button:hover {
+	border-color: rgb(102, 102, 102);
+	color: rgb(0, 0, 0);
+}
+
+input.button:active {
+	background-image: url('images/white-grad-active.png');
+}
+
+label#label-toggle_4 {
+	margin-bottom: 0;
+}
+
+label#label-toggle_4 span {
+	margin-bottom: 0.4em;
+}
+
+label#label-error_log,
+label#label-installation_log {
+	margin-top: 1.8em;
+	margin-bottom: 0;
+}
+
+div.clear {
+	clear: both;
+	height: 0;
+	line-height: 0;
+	font-size: 0;
+	margin: 0 !important;
+	padding: 0 !important;
+}
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/install.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/install.php
new file mode 100644
index 0000000000000000000000000000000000000000..6bb98b3e7a2e8c638396b06a88173ca74979e88d
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/install.php
@@ -0,0 +1,401 @@
+<?php
+// Modify error reporting levels
+error_reporting(E_ALL ^ E_NOTICE);
+
+// Let everyone know we are installing
+define('BB_INSTALLING', true);
+
+// Load bbPress
+require_once('../bb-load.php');
+
+// Instantiate the install class
+require_once( BB_PATH . 'bb-admin/includes/class.bb-install.php' );
+$bb_install = new BB_Install(__FILE__);
+
+$bb_install->header();
+?>
+		<script type="text/javascript" charset="utf-8">
+			function toggleNote(target) {
+				var targetObj = document.getElementById(target);
+				if (targetObj.style.display == 'none') {
+					targetObj.style.display = 'block';
+				} else {
+					targetObj.style.display = 'none';
+				}
+			}
+			function toggleBlock(toggleObj, target) {
+				var targetObj = document.getElementById(target);
+				if (toggleObj.checked) {
+					targetObj.style.display = 'block';
+				} else {
+					targetObj.style.display = 'none';
+				}
+			}
+			function toggleValue(toggleObj, target, offValue, onValue) {
+				var targetObj = document.getElementById(target);
+				if (toggleObj.checked) {
+					targetObj.value = onValue;
+				} else {
+					targetObj.value = offValue;
+				}
+			}
+		</script>
+<?php
+switch ($bb_install->step) {
+	case -1:
+		$bb_install->messages();
+		$bb_install->intro();
+		break;
+
+	default:
+		$bb_install->step_header(0);
+
+		if ($bb_install->step === 0) {
+?>
+				<form action="install.php" method="post">
+<?php
+			$bb_install->messages();
+			$bb_install->get_language_selector();
+			$bb_install->input_buttons('forward_0_0', false, 1);
+?>
+				</form>
+<?php
+		} else {
+			$bb_install->sanitize_form_data();
+		}
+		
+		$bb_install->step_footer();
+		
+		$bb_install->step_header(1);
+		
+		if ($bb_install->step === 1) {
+			
+			switch($bb_install->step_status[1]) {
+				case 'incomplete':
+?>
+				<form action="install.php" method="post">
+<?php
+					$bb_install->messages();
+?>
+					<fieldset>
+<?php
+					$bb_install->input_text('bbdb_name');
+					$bb_install->input_text('bbdb_user');
+					$bb_install->input_text('bbdb_password');
+					$bb_install->select_language();
+					$bb_install->input_toggle('toggle_1');
+?>
+						<div class="toggle" id="toggle_1_target" style="<?php echo esc_attr( 'display:' . $bb_install->data[$bb_install->step]['form']['toggle_1']['display'] ); ?>;">
+<?php
+					$bb_install->input_text('bbdb_host');
+					$bb_install->input_text('bbdb_charset');
+					$bb_install->input_text('bbdb_collate');
+					//$bb_install->input_text('bb_auth_key');
+					//$bb_install->input_text('bb_secure_auth_key');
+					//$bb_install->input_text('bb_logged_in_key');
+					//$bb_install->input_text('bb_nonce_key');
+					$bb_install->input_text('bb_table_prefix', 'ltr');
+?>
+						</div>
+					</fieldset>
+<?php
+					$bb_install->input_buttons('forward_1_0');
+?>
+				</form>
+<?php
+					break;
+				
+				case 'manual':
+?>
+				<form action="install.php" method="post">
+<?php
+					$bb_install->messages();
+					$bb_install->hidden_step_inputs();
+?>
+					<fieldset>
+<?php
+					$bb_install->textarea('config', 'ltr');
+?>
+					</fieldset>
+<?php
+					$bb_install->input_buttons('forward_1_1', 'back_1_1');
+?>
+				</form>
+<?php
+					break;
+				
+				case 'complete':
+?>
+				<form action="install.php" method="post">
+<?php
+					$bb_install->messages();
+					$bb_install->input_buttons('forward_1_2', false, 2);
+?>
+				</form>
+<?php
+					break;
+			}
+		}
+		
+		$bb_install->step_footer();
+		
+		$bb_install->step_header(2);
+		
+		if ($bb_install->step === 2) {
+			
+			switch ($bb_install->step_status[2]) {
+				case 'incomplete':
+?>
+				<form action="install.php" method="post">
+<?php
+					$bb_install->messages();
+?>
+					<fieldset>
+<?php
+					bb_nonce_field('bbpress-installer');
+					$bb_install->input_toggle('toggle_2_0');
+?>
+					</fieldset>
+					<div class="toggle" id="toggle_2_0_target" style="<?php echo esc_attr( 'display:' . $bb_install->data[$bb_install->step]['form']['toggle_2_0']['display'] ); ?>;">
+						<fieldset>
+<?php
+					$bb_install->input_toggle('toggle_2_1');
+?>
+						</fieldset>
+						<div class="toggle" id="toggle_2_1_target" style="<?php echo esc_attr( 'display:' . $bb_install->data[$bb_install->step]['form']['toggle_2_1']['display'] ); ?>;">
+							<fieldset>
+								<legend><?php _e('Cookies'); ?></legend>
+								<p><?php _e('Integrating cookies allows you and your users to login to either your bbPress or your WordPress site and be automatically logged into both.'); ?></p>
+								<p><?php _e('You may need to make changes to your WordPress configuration once installation is complete. See the "WordPress Integration" section of the bbPress administration area when you are done.'); ?></p>
+<?php
+					$bb_install->input_text('wp_siteurl', 'ltr');
+					$bb_install->input_text('wp_home', 'ltr');
+					$bb_install->input_text('wp_auth_key');
+					$bb_install->input_text('wp_auth_salt');
+					$bb_install->input_text('wp_secure_auth_key');
+					$bb_install->input_text('wp_secure_auth_salt');
+					$bb_install->input_text('wp_logged_in_key');
+					$bb_install->input_text('wp_logged_in_salt');
+?>
+							</fieldset>
+						</div>
+						<fieldset>
+<?php
+					$bb_install->input_toggle('toggle_2_2');
+?>
+						</fieldset>
+						<div class="toggle" id="toggle_2_2_target" style="<?php echo esc_attr( 'display:' . $bb_install->data[$bb_install->step]['form']['toggle_2_2']['display'] ); ?>;">
+							<fieldset>
+								<legend><?php _e('User database'); ?></legend>
+								<p><?php _e('Integrating your WordPress database user tables allows you to store user data in one location, instead of having separate user data for both bbPress and WordPress.'); ?></p>
+<?php
+					$bb_install->input_text('wp_table_prefix', 'ltr');
+					$bb_install->input_text('wordpress_mu_primary_blog_id', 'ltr');
+					$bb_install->input_toggle('toggle_2_3');
+?>
+							</fieldset>
+							<div class="toggle" id="toggle_2_3_target" style="<?php echo esc_attr( 'display:' . $bb_install->data[$bb_install->step]['form']['toggle_2_3']['display'] ); ?>;">
+								<fieldset>
+									<legend><?php _e('Separate user database settings'); ?></legend>
+									<p><?php _e('Most of the time these settings are <em>not</em> required. Look before you leap!'); ?></p>
+									<p><?php _e('If required, then all settings except for the character set must be specified.'); ?></p>
+<?php
+					$bb_install->input_text('user_bbdb_name');
+					$bb_install->input_text('user_bbdb_user');
+					$bb_install->input_text('user_bbdb_password');
+					$bb_install->input_text('user_bbdb_host');
+					$bb_install->input_text('user_bbdb_charset');
+					$bb_install->input_text('user_bbdb_collate');
+?>
+								</fieldset>
+								<fieldset>
+									<legend><?php _e('Custom user tables'); ?></legend>
+									<p><?php _e('Only set these options if your integrated user tables do not fit the usual mould of <em>wp_user</em> and <em>wp_usermeta</em>.'); ?></p>
+<?php
+					$bb_install->input_text('custom_user_table');
+					$bb_install->input_text('custom_user_meta_table');
+?>
+								</fieldset>
+							</div>
+						</div>
+					</div>
+<?php
+					$bb_install->input_buttons('forward_2_0');
+?>
+				</form>
+				<script type="text/javascript" charset="utf-8">
+					function updateWordPressOptionURL () {
+						var siteURLInputValue = document.getElementById('wp_siteurl').value;
+						if (siteURLInputValue && siteURLInputValue.substr(-1,1) != '/') {
+							siteURLInputValue += '/';
+						}
+						var authSaltAnchor = document.getElementById('getAuthSaltOption');
+						var secureAuthSaltAnchor = document.getElementById('getSecureAuthSaltOption');
+						var loggedInSaltAnchor = document.getElementById('getLoggedInSaltOption');
+						if (siteURLInputValue) {
+							authSaltAnchor.href = siteURLInputValue + 'wp-admin/options.php';
+							secureAuthSaltAnchor.href = siteURLInputValue + 'wp-admin/options.php';
+							loggedInSaltAnchor.href = siteURLInputValue + 'wp-admin/options.php';
+						} else {
+							authSaltAnchor.href = '';
+							secureAuthSaltAnchor.href = '';
+							loggedInSaltAnchor.href = '';
+						}
+					}
+					var siteURLInput = document.getElementById('wp_siteurl');
+					if (siteURLInput.value) {
+						updateWordPressOptionURL();
+					}
+					siteURLInput.onkeyup = updateWordPressOptionURL;
+					siteURLInput.onblur = updateWordPressOptionURL;
+					siteURLInput.onclick = updateWordPressOptionURL;
+					siteURLInput.onchange = updateWordPressOptionURL;
+				</script>
+<?php
+					break;
+				
+				case 'complete':
+?>
+				<form action="install.php" method="post">
+<?php
+					$bb_install->messages();
+?>
+					<fieldset>
+<?php
+					bb_nonce_field('bbpress-installer');
+?>
+					</fieldset>
+<?php
+					$bb_install->hidden_step_inputs();
+					$bb_install->input_buttons('forward_2_1', 'back_2_1', 3);
+?>
+				</form>
+<?php
+					break;
+			}
+		}
+		
+		$bb_install->step_footer();
+		
+		$bb_install->step_header(3);
+		
+		if ($bb_install->step === 3) {
+			
+			switch($bb_install->step_status[3]) {
+				case 'incomplete':
+?>
+				<form action="install.php" method="post">
+<?php
+					$bb_install->messages();
+?>
+					<fieldset>
+<?php
+					bb_nonce_field('bbpress-installer');
+?>
+					</fieldset>
+<?php
+					$bb_install->hidden_step_inputs(2);
+?>
+					<fieldset>
+<?php
+					$bb_install->input_text('name');
+					$bb_install->input_text('uri', 'ltr');
+
+					if ($bb_install->populate_keymaster_user_login_from_user_tables()) {
+						echo $bb_install->strings[3]['scripts']['changeKeymasterEmail'];
+						$bb_install->select('keymaster_user_login');
+						$bb_install->input_hidden('keymaster_user_email');
+					} else {
+						$bb_install->input_text('keymaster_user_login');
+						$bb_install->input_text('keymaster_user_email', 'ltr');
+					}
+					$bb_install->input_hidden('keymaster_user_type');
+
+					if (!$bb_install->database_tables_are_installed()) {
+						$bb_install->input_text('forum_name');
+					}
+?>
+					</fieldset>
+<?php
+					$bb_install->input_buttons('forward_3_0');
+?>
+				</form>
+<?php
+					break;
+				
+				case 'complete':
+?>
+				<form action="install.php" method="post">
+<?php
+					$bb_install->messages();
+?>
+					<fieldset>
+<?php
+					bb_nonce_field('bbpress-installer');
+?>
+					</fieldset>
+<?php
+					$bb_install->hidden_step_inputs(2);
+					$bb_install->hidden_step_inputs(); // The current step (3) is assumed here
+					$bb_install->input_buttons('forward_3_1', 'back_3_1', 4);
+?>
+				</form>
+<?php
+					break;
+			}
+		}
+		
+		$bb_install->step_footer();
+		
+		if ($bb_install->step === 4) {
+		
+			$bb_install->step_header(4);
+			$bb_install->messages();
+
+			if ($bb_install->step_status[4] == 'complete') {
+?>
+				<p><?php _e('You can now log in with the following details:'); ?></p>
+				<dl>
+					<dt><?php _e('Username:'); ?></dt>
+					<dd><code><?php echo esc_html( $bb_install->data[3]['form']['keymaster_user_login']['value'] ); ?></code></dd>
+					<dt><?php _e('Password:'); ?></dt>
+					<dd><code><?php echo esc_html( $bb_install->data[4]['form']['keymaster_user_password']['value'] ); ?></code></dd>
+					<dt><?php _e('Site address:'); ?></dt>
+					<dd dir="ltr"><a href="<?php bb_uri(); ?>"><?php bb_uri(null, null, BB_URI_CONTEXT_TEXT); ?></a></dd>
+				</dl>
+<?php
+				if ($bb_install->data[3]['form']['keymaster_user_type']['value'] == 'bbPress') {
+?>
+				<p><?php _e('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you. If you lose it, you will have to delete the tables from the database yourself, and re-install bbPress.'); ?></p>
+<?php
+				}
+			}
+?>
+				<form action="<?php bb_uri(null, null, BB_URI_CONTEXT_FORM_ACTION); ?>">
+					<fieldset>
+<?php
+			$bb_install->input_toggle('toggle_4');
+?>
+						<div class="toggle" id="toggle_4_target" style="display:none;">
+<?php
+			if ($bb_install->data[4]['form']['error_log']['value']) {
+				$bb_install->textarea('error_log');
+			}
+			$bb_install->textarea('installation_log');
+?>
+						</div>
+					</fieldset>
+				</form>
+<?php
+			$bb_install->step_footer();
+			
+		} else {
+//? >
+//			<div id="step4" class="closed"></div>
+//<?php
+		}
+		
+		break;
+}
+$bb_install->footer();
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/js/admin-forums.js b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/js/admin-forums.js
new file mode 100644
index 0000000000000000000000000000000000000000..4414acd37516a3b8092ed8f27aa169b4a63d0322
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/js/admin-forums.js
@@ -0,0 +1,140 @@
+jQuery( function($) { // In here $ is jQuery
+
+bbSortForums = {
+	handleText: 'drag',
+	handle: '',
+	sortCfg: {
+		accept: 'forum',
+		handle: 'img.sort-handle',
+		opacity: .3,
+		helperclass: 'helper',
+		onStop: function() {
+			bbSortForums.place = null;
+			bbSortForums.recolor();
+		}
+	},
+	editText: 'Edit Forum Order',
+	saveText: 'Save Forum Order',
+	place: null,  // The id of the list item it's currently hovering before
+	placed: null, // The id of the list item it's been made a child of
+	rtl: 'rtl' == $('html').attr( 'dir' ),
+
+	recolor: function() {
+		$('#forum-list li:gt(0)').css( 'background-color', '' ).filter(':even').removeClass('alt').end().filter(':odd').addClass('alt');
+	},
+
+	checkHover: function(el, doit) {
+		if ( this.place == el.id && doit )
+			return;
+
+		if ( !doit ) {
+			this.place = null;
+			return;
+		}
+
+		this.place = el.id;
+		if ( $('#' + this.place).children('ul:has(li:visible)').size() ) // Don't shift over if there's already a UL with stuff in it
+			return;
+
+		var id = this.place.split('-')[1];
+		$('#' + this.place).not(':has(ul)').append("<ul id='forum-root-" + id + "' class='list-block holder'></ul>").end().children('ul').append(jQuery.iSort.helper.get(0)); // Place in shifted box
+		this.placed = 'forum-' + id;
+	},
+
+	serialize: function () {
+		h = '';
+		$('#forum-list, #forum-list ul').each( function() {
+			var i = this.id;
+			$('#' + i + '> .forum').each( function () {
+				if (h.length > 0)
+					h += '&';
+				var root = 'forum-list' == i ? 0 : i.split('-')[2];
+				h += 'root[' + root + '][]=' + this.id.split('-')[1];
+			} );
+		} );
+		return h;
+	},
+
+	init: function() {
+		this.handle = "<img class='sort-handle' src='images/drag.gif' alt='" + this.handleText +  "' />";
+		var div = document.createElement('div');
+		div.innerHTML = this.saveText; // Save the raquo!
+		this.saveText = div.childNodes[0].nodeValue;
+		div.innerHTML = this.editText; // Save the raquo!
+		this.editText = div.childNodes[0].nodeValue;
+		div = null;
+		$('#forum-list').after("<form class='settings' action='' onsubmit='return false;'><fieldset class='submit'><input class='submit' type='submit' name='submit' id='forum-order-edit' value='" + this.editText + "' /></fieldset></form>");
+
+		$('#forum-order-edit').toggle( function() {
+			$(this).val(bbSortForums.saveText);
+			$('#forum-list li:gt(0) div.row-title').before(bbSortForums.handle);
+			$('#forum-list').Sortable( bbSortForums.sortCfg );
+			$('body').addClass('sorting');
+		}, function() {
+			$(this).val(bbSortForums.editText);
+			$('.sort-handle').remove();
+
+			var hash = bbSortForums.serialize();
+			hash += '&' + $.SortSerialize('forum-list').hash.replace(/forum-list/g, 'order').replace(/forum-/g, '')
+			$('#forum-list').SortableDestroy();
+			$('body').removeClass('sorting');
+
+			$.post(
+				'admin-ajax.php',
+				'action=order-forums&_ajax_nonce=' +  $('#add-forum input[name=order-nonce]').val() + '&' + hash
+			);
+		} );
+	}
+}
+
+// overwrite with more advanced function
+jQuery.iSort.checkhover = function(e,o) {
+	if (!jQuery.iDrag.dragged)
+		return;
+
+	if ( e.dropCfg.el.size() > 0 ) {
+		var bottom = jQuery.grep(e.dropCfg.el, function(i) { // All the list items whose bottom edges are inside the draggable
+			var x = bbSortForums.rtl ? i.pos.x + i.pos.wb > jQuery.iDrag.dragged.dragCfg.nx + jQuery.iDrag.dragged.dragCfg.oC.wb : i.pos.x < jQuery.iDrag.dragged.dragCfg.nx;
+			return i.pos.y + i.pos.hb > jQuery.iDrag.dragged.dragCfg.ny && i.pos.y + i.pos.hb < jQuery.iDrag.dragged.dragCfg.ny + 30 && x;
+		} );
+
+		if ( bottom.length > 0 ) { // Use the lowest one one the totem pole
+			var x = bbSortForums.rtl ? bottom[bottom.length-1].pos.x + bottom[bottom.length-1].pos.wb - 30 > jQuery.iDrag.dragged.dragCfg.nx + jQuery.iDrag.dragged.dragCfg.oC.wb : bottom[bottom.length-1].pos.x + 30 < jQuery.iDrag.dragged.dragCfg.nx;
+			if ( bbSortForums.placed != bottom[bottom.length-1].id || !x ) { // Testing to see if still placed in shifted box
+				bbSortForums.placed = null;
+				jQuery(bottom[bottom.length-1]).after(jQuery.iSort.helper.get(0));
+			}
+			bbSortForums.checkHover(bottom[bottom.length-1], x); // If far enough right, shift it over
+			return;
+		}
+
+		// Didn't find anything by checking bottems.  Look at tops
+		var top = jQuery.grep(e.dropCfg.el, function(i) { // All the list items whose top edges are inside the draggable
+			var x = bbSortForums.rtl ? i.pos.x + i.pos.wb > jQuery.iDrag.dragged.dragCfg.nx : i.pos.x < jQuery.iDrag.dragged.dragCfg.nx;
+			return i.pos.y > jQuery.iDrag.dragged.dragCfg.ny && i.pos.y < jQuery.iDrag.dragged.dragCfg.ny + 30 && x;
+		} );
+
+		if ( top.length ) { // Use the highest one (should be only one)
+			jQuery(top[0]).before(jQuery.iSort.helper.get(0));
+			bbSortForums.checkHover(top[0], false);
+			return;
+		}
+	}
+	jQuery.iSort.helper.get(0).style.display = 'block';
+}
+
+if ( 'undefined' != typeof bbSortForumsL10n )
+	$.extend( bbSortForums, bbSortForumsL10n );
+
+bbSortForums.init();
+
+var options = $('#forum-parent').get(0).options;
+var addAfter = function( r, settings ) {
+	var name = $("<span>" + $('name', r).text() + "</span>").html();
+	var id = $('forum', r).attr('id');
+	options[options.length] = new Option(name, id);
+}
+
+$('#forum-list').wpList( { addAfter: addAfter } );
+
+} );
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/js/common.js b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/js/common.js
new file mode 100644
index 0000000000000000000000000000000000000000..60fdd246f51ad51f404ca6d65f0736f7c11d1ce4
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/js/common.js
@@ -0,0 +1,87 @@
+var showNotice, adminMenu, columns;
+(function($){
+// sidebar admin menu
+adminMenu = {
+
+	init : function() {
+		$('ul#bbAdminMenu li.bb-menu div.bb-menu-toggle').each( function() {
+			if ( $(this).siblings('div.bb-menu-sub-wrap').length )
+				$(this).click(function(){ adminMenu.toggle( $(this).siblings('div.bb-menu-sub-wrap') ); });
+			else
+				$(this).hide();
+		});
+
+		$('#bbAdminMenu li.bb-menu.bb-menu-separator a').click(function(){
+			if ( $('body').hasClass('bb-menu-folded') ) {
+				adminMenu.fold(1);
+				deleteUserSetting( 'fm' );
+			} else {
+				adminMenu.fold();
+				setUserSetting( 'fm', 'f' );
+			}
+			return false;
+		});
+
+		if ( $('body').hasClass('bb-menu-folded') ) {
+			this.fold();
+		}
+		this.restoreMenuState();
+	},
+
+	restoreMenuState : function() {
+		$('ul#bbAdminMenu li.bb-menu.bb-menu-has-submenu').each(function(i, e) {
+			var v = getUserSetting( 'm'+i );
+			if ( $(e).hasClass('bb-menu-current') ) return true; // leave the current parent open
+
+			if ( 'o' == v ) $(e).addClass('bb-menu-open');
+			else if ( 'c' == v ) $(e).removeClass('bb-menu-open');
+		});
+	},
+
+	toggle : function(el) {
+		el['slideToggle'](150, function(){el.css('display','');}).parent().toggleClass( 'bb-menu-open' );
+
+		$('ul#bbAdminMenu li.bb-menu.bb-menu-has-submenu').each(function(i, e) {
+			var v = $(e).hasClass('bb-menu-open') ? 'o' : 'c';
+			setUserSetting( 'm'+i, v );
+		});
+
+		return false;
+	},
+
+	fold : function(off) {
+		if (off) {
+			$('body').removeClass('bb-menu-folded');
+			$('#bbAdminMenu li.bb-menu.bb-menu-has-submenu').unbind();
+		} else {
+			$('body').addClass('bb-menu-folded');
+			$('#bbAdminMenu li.bb-menu.bb-menu-has-submenu').hoverIntent({
+				over: function(e){
+					var m, b, h, o, f;
+					m = $(this).find('div.bb-menu-sub-wrap');
+					b = m.parent().offset().top + m.height() + 1; // Bottom offset of the menu
+					h = $('#bbWrap').height(); // Height of the entire page
+					o = 60 + b - h;
+					f = $(window).height() + $('body').scrollTop() - 15; // The fold
+					if (f < (b - o)) {
+						o = b - f;
+					}
+					if (o > 1) {
+						m.css({'marginTop':'-'+o+'px'});
+					} else if ( m.css('marginTop') ) {
+						m.css({'marginTop':''});
+					}
+					m.addClass('bb-menu-sub-open');
+				},
+				out: function(){ $(this).find('div.bb-menu-sub-wrap').removeClass('bb-menu-sub-open').css({'marginTop':''}); },
+				timeout: 220,
+				sensitivity: 8,
+				interval: 100
+			});
+		}
+	}
+};
+
+$(document).ready(function(){adminMenu.init();});
+
+})(jQuery);
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/js/utils.js b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/js/utils.js
new file mode 100644
index 0000000000000000000000000000000000000000..3125bff6df6f510b9eb2f46f9acecf0e1184f395
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/js/utils.js
@@ -0,0 +1,166 @@
+// utility functions
+function convertEntities(o) {
+	var c, v;
+	c = function(s) {
+		if (/&[^;]+;/.test(s)) {
+			var e = document.createElement("div");
+			e.innerHTML = s;
+			return !e.firstChild ? s : e.firstChild.nodeValue;
+		}
+		return s;
+	}
+
+	if ( typeof o === 'string' ) {
+		return c(o);
+	} else if ( typeof o === 'object' ) {
+		for (v in o) {
+			if ( typeof o[v] === 'string' ) {
+				o[v] = c(o[v]);
+			}
+		}
+	}
+	return o;
+}
+
+var wpCookies = {
+// The following functions are from Cookie.js class in TinyMCE, Moxiecode, used under LGPL.
+
+	each : function(o, cb, s) {
+		var n, l;
+
+		if (!o)
+			return 0;
+
+		s = s || o;
+
+		if (typeof(o.length) != 'undefined') {
+			for (n=0, l = o.length; n<l; n++) {
+				if (cb.call(s, o[n], n, o) === false)
+					return 0;
+			}
+		} else {
+			for (n in o) {
+				if (o.hasOwnProperty(n)) {
+					if (cb.call(s, o[n], n, o) === false) {
+						return 0;
+					}
+				}
+			}
+		}
+		return 1;
+	},
+
+	getHash : function(n) {
+		var v = this.get(n), h;
+
+		if (v) {
+			this.each(v.split('&'), function(v) {
+				v = v.split('=');
+				h = h || {};
+				h[v[0]] = v[1];
+			});
+		}
+		return h;
+	},
+
+	setHash : function(n, v, e, p, d, s) {
+		var o = '';
+
+		this.each(v, function(v, k) {
+			o += (!o ? '' : '&') + k + '=' + v;
+		});
+
+		this.set(n, o, e, p, d, s);
+	},
+
+	get : function(n) {
+		var c = document.cookie, e, p = n + "=", b;
+
+		if (!c)
+			return;
+
+		b = c.indexOf("; " + p);
+
+		if (b == -1) {
+			b = c.indexOf(p);
+
+			if (b != 0)
+				return null;
+
+		} else {
+			b += 2;
+		}
+
+		e = c.indexOf(";", b);
+
+		if (e == -1)
+			e = c.length;
+
+		return decodeURIComponent(c.substring(b + p.length, e));
+	},
+
+	set : function(n, v, e, p, d, s) {
+		document.cookie = n + "=" + encodeURIComponent(v) +
+			((e) ? "; expires=" + e.toGMTString() : "") +
+			((p) ? "; path=" + p : "") +
+			((d) ? "; domain=" + d : "") +
+			((s) ? "; secure" : "");
+	},
+
+	remove : function(n, p) {
+		var d = new Date();
+
+		d.setTime(d.getTime() - 1000);
+
+		this.set(n, '', d, p, d);
+	}
+};
+
+// Returns the value as string. Second arg or empty string is returned when value is not set.
+function getUserSetting( name, def ) {
+	var o = getAllUserSettings();
+
+	if ( o.hasOwnProperty(name) )
+		return o[name];
+
+	if ( typeof def != 'undefined' )
+		return def;
+
+	return '';
+}
+
+// Both name and value must be only ASCII letters, numbers or underscore
+// and the shorter, the better (cookies can store maximum 4KB). Not suitable to store text.
+function setUserSetting( name, value, del ) {
+	if ( 'object' !== typeof userSettings )
+		return false;
+	
+	var c = 'bb-user-settings-' + userSettings.uid, o = wpCookies.getHash(c) || {}, d = new Date(), p,
+	n = name.toString().replace(/[^A-Za-z0-9_]/, ''), v = value.toString().replace(/[^A-Za-z0-9_]/, '');
+
+	if ( del ) {
+		delete o[n];
+	} else {
+		o[n] = v;
+	}
+
+	d.setTime( d.getTime() + 31536000000 );
+	p = userSettings.url;
+
+	wpCookies.setHash(c, o, d, p);
+	wpCookies.set('bb-user-settings-time-'+userSettings.uid, userSettings.time, d, p);
+	
+	return name;
+}
+
+function deleteUserSetting( name ) {
+	return setUserSetting( name, '', 1 );
+}
+
+// Returns all settings as js object.
+function getAllUserSettings() {
+	if ( 'object' !== typeof userSettings )
+		return {};
+
+	return wpCookies.getHash('bb-user-settings-' + userSettings.uid) || {};
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-discussion.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-discussion.php
new file mode 100644
index 0000000000000000000000000000000000000000..34bdca0e4ee99f53c084f2720204e767b67d1777
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-discussion.php
@@ -0,0 +1,131 @@
+<?php
+
+require_once('admin.php');
+
+if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && $_POST['action'] == 'update') {
+	
+	bb_check_admin_referer( 'options-discussion-update' );
+	
+	// Deal with pingbacks checkbox when it isn't checked
+	if (!isset($_POST['enable_pingback'])) {
+		$_POST['enable_pingback'] = false;
+	}
+	
+	// Deal with avatars checkbox when it isn't checked
+	if (!isset($_POST['avatars_show'])) {
+		$_POST['avatars_show'] = false;
+	}
+	
+	foreach ( (array) $_POST as $option => $value ) {
+		if ( !in_array( $option, array('_wpnonce', '_wp_http_referer', 'action', 'submit') ) ) {
+			$option = trim( $option );
+			$value = is_array( $value ) ? $value : trim( $value );
+			$value = stripslashes_deep( $value );
+			if ( $value ) {
+				bb_update_option( $option, $value );
+			} else {
+				bb_delete_option( $option );
+			}
+		}
+	}
+	
+	$goback = add_query_arg('updated', 'true', wp_get_referer());
+	bb_safe_redirect($goback);
+	exit;
+}
+
+if ( !empty($_GET['updated']) ) {
+	bb_admin_notice( __( '<strong>Settings saved.</strong>' ) );
+}
+
+$remote_options = array(
+	'enable_pingback' => array(
+		'title' => __( 'Enable Pingbacks' ),
+		'type' => 'checkbox',
+		'options' => array(
+			1 => __( 'Allow link notifications from other sites.' )
+		)
+	),
+);
+
+$bb_get_option_avatars_show = create_function( '$a', 'return 1;' );
+add_filter( 'bb_get_option_avatars_show', $bb_get_option_avatars_show );
+$avatar_options = array(
+	'avatars_show' => array(
+		'title' => __( 'Avatar display' ),
+		'type' => 'radio',
+		'options' => array(
+			0 => __( 'Don&#8217;t show avatars' ),
+			1 => __( 'Show avatars' )
+		)
+	),
+	'avatars_rating' => array(
+		'title' => __( 'Maximum rating' ),
+		'type' => 'radio',
+		'options' => array(
+			'g' => __( 'G &#8212; Suitable for all audiences' ),
+			'pg' => __( 'PG &#8212; Possibly offensive, usually for audiences 13 and above' ),
+			'r' => __( 'R &#8212; Intended for adult audiences above 17' ),
+			'x' => __( 'X &#8212; Even more mature than above' )
+		)
+	),
+	'avatars_default' => array(
+		'title' => __( 'Default avatar' ),
+		'type' => 'radio',
+		'options' => array(
+			'default'   => bb_get_avatar( '',             32, 'default' )   . ' ' . __( 'Mystery Man' ),
+			'blank'     => bb_get_avatar( '',             32, 'blank' )     . ' ' . __( 'Blank' ),
+			'logo'      => bb_get_avatar( '',             32, 'logo' )      . ' ' . __( 'Gravatar Logo' ),
+			'identicon' => bb_get_avatar( rand( 0, 999 ), 32, 'identicon' ) . ' ' . __( 'Identicon (Generated)' ),
+			'wavatar'   => bb_get_avatar( rand( 0, 999 ), 32, 'wavatar' )   . ' ' . __( 'Wavatar (Generated)' ),
+			'monsterid' => bb_get_avatar( rand( 0, 999 ), 32, 'monsterid' ) . ' ' . __( 'MonsterID  (Generated)' )
+		),
+		'note' => array(
+			__( 'For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their e-mail address.' )
+		),
+	)
+);
+remove_filter( 'bb_get_option_avatars_show', $bb_get_option_avatars_show );
+
+$bb_admin_body_class = ' bb-admin-settings';
+
+bb_get_admin_header();
+
+?>
+
+<div class="wrap">
+
+<h2><?php _e('Discussion Settings'); ?></h2>
+<?php do_action( 'bb_admin_notices' ); ?>
+
+<form class="settings" method="post" action="<?php bb_uri( 'bb-admin/options-discussion.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN ); ?>">
+	<fieldset>
+<?php
+foreach ( $remote_options as $option => $args ) {
+	bb_option_form_element( $option, $args );
+}
+?>
+	</fieldset>
+	<fieldset>
+		<legend><?php _e('Avatars'); ?></legend>
+		<p>
+			<?php _e('bbPress includes built-in support for <a href="http://gravatar.com/">Gravatars</a>. A Gravatar is an image that follows you from site to site, appearing beside your name when you comment on Gravatar enabled sites. Here you can enable the display of Gravatars on your site.'); ?>
+		</p>
+<?php
+foreach ( $avatar_options as $option => $args ) {
+	bb_option_form_element( $option, $args );
+}
+?>
+	</fieldset>
+	<fieldset class="submit">
+		<?php bb_nonce_field( 'options-discussion-update' ); ?>
+		<input type="hidden" name="action" value="update" />
+		<input class="submit" type="submit" name="submit" value="<?php _e('Save Changes') ?>" />
+	</fieldset>
+</form>
+
+</div>
+
+<?php
+
+bb_get_admin_footer();
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-general.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-general.php
new file mode 100644
index 0000000000000000000000000000000000000000..5bb5fcc82f81a6c7e4cfa54b537d7e6d52fdcc42
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-general.php
@@ -0,0 +1,244 @@
+<?php
+
+require_once('admin.php');
+
+if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && $_POST['action'] == 'update' ) {
+	
+	bb_check_admin_referer( 'options-general-update' );
+	
+	foreach ( (array) $_POST as $option => $value ) {
+		if ( !in_array( $option, array( '_wpnonce', '_wp_http_referer', 'action', 'submit' ) ) ) {
+			$option = trim( $option );
+			$value = is_array( $value ) ? $value : trim( $value );
+			$value = stripslashes_deep( $value );
+			if ( $option == 'uri' && !empty( $value ) ) {
+				$value = rtrim( $value, " \t\n\r\0\x0B/" ) . '/';
+			}
+			if ( $value ) {
+				bb_update_option( $option, $value );
+			} else {
+				bb_delete_option( $option );
+			}
+		}
+	}
+	
+	$goback = add_query_arg( 'updated', 'true', wp_get_referer() );
+	bb_safe_redirect( $goback );
+	exit;
+}
+
+if ( !empty( $_GET['updated'] ) ) {
+	bb_admin_notice( __( '<strong>Settings saved.</strong>' ) );
+}
+
+$general_options = array(
+	'name' => array(
+		'title' => __( 'Site title' ),
+		'class' => 'long',
+	),
+	'description' => array(
+		'title' => __( 'Tagline' ),
+		'class' => 'long',
+		'note' => __( 'In a few words, explain what this site is about.' )
+	),
+	'uri' => array(
+		'title' => __( 'bbPress address (URL)' ),
+		'class' => array('long', 'code'),
+		'note' => __( 'The full URL of your bbPress install.' ),
+	),
+	'from_email' => array(
+		'title' => __( 'E-mail address' ),
+		'note' => __( 'This address is used for admin purposes, like new user notification.' ),
+	)
+);
+
+$time_options = array(
+	'gmt_offset' => array(
+		'title' => __( 'Time zone' ),
+		'type' => 'select',
+		'options' => array(
+			'-12'   => '-12:00',
+			'-11.5' => '-11:30',
+			'-11'   => '-11:00',
+			'-10.5' => '-10:30',
+			'-10'   => '-10:00',
+			'-9.5'  => '-9:30',
+			'-9'    => '-9:00',
+			'-8.5'  => '-8:30',
+			'-8'    => '-8:00',
+			'-7.5'  => '-7:30',
+			'-7'    => '-7:00',
+			'-6.5'  => '-6:30',
+			'-6'    => '-6:00',
+			'-5.5'  => '-5:30',
+			'-5'    => '-5:00',
+			'-4.5'  => '-4:30',
+			'-4'    => '-4:00',
+			'-3.5'  => '-3:30',
+			'-3'    => '-3:00',
+			'-2.5'  => '-2:30',
+			'-2'    => '-2:00',
+			'-1.5'  => '-1:30',
+			'-1'    => '-1:00',
+			'-0.5'  => '-0:30',
+			'0'     => '',
+			'0.5'   => '+0:30',
+			'1'     => '+1:00',
+			'1.5'   => '+1:30',
+			'2'     => '+2:00',
+			'2.5'   => '+2:30',
+			'3'     => '+3:00',
+			'3.5'   => '+3:30',
+			'4'     => '+4:00',
+			'4.5'   => '+4:30',
+			'5'     => '+5:00',
+			'5.5'   => '+5:30',
+			'5.75'  => '+5:45',
+			'6'     => '+6:00',
+			'6.5'   => '+6:30',
+			'7'     => '+7:00',
+			'7.5'   => '+7:30',
+			'8'     => '+8:00',
+			'8.5'   => '+8:30',
+			'8.75'  => '+8:45',
+			'9'     => '+9:00',
+			'9.5'   => '+9:30',
+			'10'    => '+10:00',
+			'10.5'  => '+10:30',
+			'11'    => '+11:00',
+			'11.5'  => '+11:30',
+			'12'    => '+12:00',
+			'12.75' => '+12:45',
+			'13'    => '+13:00',
+			'13.75' => '+13:45',
+			'14'    => '+14:00'
+		),
+		'after' => __( 'hours' )
+	),
+	'datetime_format' => array(
+		'title' => __( 'Date and time format' ),
+		'class' => 'short',
+		'value' => bb_get_datetime_formatstring_i18n(),
+		'after' => bb_datetime_format_i18n( bb_current_time() ),
+		'note' => array(
+			__( '<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>.' ),
+			__( 'Click "Save Changes" to update sample output.' )
+		)
+	),
+	'date_format' => array(
+		'title' => __( 'Date format' ),
+		'class' => 'short',
+		'value' => bb_get_datetime_formatstring_i18n( 'date' ),
+		'after' => bb_datetime_format_i18n( bb_current_time(), 'date' )
+	)
+);
+
+if ( !$gmt_offset = bb_get_option( 'gmt_offset' ) ) {
+	$gmt_offset = 0;
+}
+
+if ( wp_timezone_supported() ) {
+	unset( $time_options['gmt_offset'] );
+
+	if ( !$timezone_string = bb_get_option( 'timezone_string' ) ) {
+		// set the Etc zone if no timezone string exists
+		$_gmt_offset = (integer) round( $gmt_offset );
+		if ( $_gmt_offset === 0 ) {
+			$timezone_string = 'Etc/UTC';
+		} elseif ( $_gmt_offset > 0 ) {
+			// Zoneinfo has these signed backwards to common convention
+			$timezone_string = 'Etc/GMT-' . abs( $_gmt_offset );
+		} else {
+			// Zoneinfo has these signed backwards to common convention
+			$timezone_string = 'Etc/GMT+' . abs( $_gmt_offset );
+		}
+		unset( $_gmt_offset );
+	}
+
+	// Build the new selector
+	$_time_options = array(
+		'timezone_string' => array(
+			'title' => __( 'Time zone' ),
+			'type' => 'select',
+			'options' => wp_timezone_choice( $timezone_string ), // This passes a string of html, which gets used verbatim
+			'note' => array(
+				__( 'Choose a city in the same time zone as you.' ),
+				sprintf( __( '<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>' ), bb_gmdate_i18n( bb_get_datetime_formatstring_i18n(), bb_current_time() ) ),
+				sprintf( __( 'Local time is <code>%s</code>' ), bb_datetime_format_i18n( bb_current_time() ) )
+			)
+		)
+	);
+
+	$_now = localtime( bb_current_time(), true );
+	if ( $now['tm_isdst'] ) {
+		$_time_options['timezone_string']['note'][] = __( 'This time zone is currently in daylight savings time.' );
+	} else {
+		$_time_options['timezone_string']['note'][] = __( 'This time zone is currently in standard time.' );
+	}
+
+	if ( function_exists( 'timezone_transitions_get' ) ) {
+		$timezone_object = new DateTimeZone( $timezone_string );
+		$found_transition = false;
+		foreach ( timezone_transitions_get( $timezone_object ) as $timezone_transition ) {
+			if ( $timezone_transition['ts'] > time() ) {
+				$note = $timezone_transition['isdst'] ? __('Daylight savings time begins on <code>%s</code>') : __('Standard time begins on <code>%s</code>');
+				$_time_options['timezone_string']['note'][] = sprintf( $note, bb_gmdate_i18n( bb_get_datetime_formatstring_i18n(), $timezone_transition['ts'], false ) );
+				break;
+			}
+		}
+	}
+
+	$time_options = array_merge( $_time_options, $time_options );
+
+} else {
+	// Tidy up the old style dropdown
+	$time_options['gmt_offset']['note'] = array(
+		1 => sprintf( __( '<abbr title="Coordinated Universal Time">UTC</abbr> %s is <code>%s</code>' ), $time_options['gmt_offset']['options'][$gmt_offset], bb_datetime_format_i18n( bb_current_time() ) ),
+		2 => __( 'Unfortunately, you have to manually update this for Daylight Savings Time.' )
+	);
+
+	if ( $gmt_offset ) {
+		$time_options['gmt_offset']['note'][0] = sprintf( __( '<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>' ), bb_gmdate_i18n( bb_get_datetime_formatstring_i18n(), bb_current_time(), true ) );
+		ksort($time_options['gmt_offset']['note']);
+	}
+
+	foreach ( $time_options['gmt_offset']['options'] as $_key => $_value ) {
+		$time_options['gmt_offset']['options'][$_key] = sprintf( __( 'UTC %s' ), $_value );
+	}
+}
+
+
+$bb_admin_body_class = ' bb-admin-settings';
+
+bb_get_admin_header();
+
+?>
+
+<div class="wrap">
+
+<h2><?php _e('General Settings'); ?></h2>
+<?php do_action( 'bb_admin_notices' ); ?>
+
+<form class="settings" method="post" action="<?php bb_uri( 'bb-admin/options-general.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN ); ?>">
+	<fieldset>
+<?php
+foreach ( $general_options as $option => $args ) {
+	bb_option_form_element( $option, $args );
+}
+foreach ( $time_options as $option => $args ) {
+	bb_option_form_element( $option, $args );
+}
+?>
+	</fieldset>
+	<fieldset class="submit">
+		<?php bb_nonce_field( 'options-general-update' ); ?>
+		<input type="hidden" name="action" value="update" />
+		<input class="submit" type="submit" name="submit" value="<?php _e('Save Changes') ?>" />
+	</fieldset>
+</form>
+
+</div>
+
+<?php
+
+bb_get_admin_footer();
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-permalinks.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-permalinks.php
new file mode 100644
index 0000000000000000000000000000000000000000..727eb60966fcc21a7921fcec8847cde50b30d86c
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-permalinks.php
@@ -0,0 +1,188 @@
+<?php
+
+require_once('admin.php');
+
+$file_source = BB_PATH . 'bb-admin/includes/defaults.bb-htaccess.php';
+$file_target = BB_PATH . '.htaccess';
+include( $file_source );
+$file_source_rules = $_rules; // This is a string
+
+if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && $_POST['action'] == 'update') {
+
+	bb_check_admin_referer( 'options-permalinks-update' );
+
+	foreach ( (array) $_POST as $option => $value ) {
+		if ( !in_array( $option, array('_wpnonce', '_wp_http_referer', 'action', 'submit') ) ) {
+			$option = trim( $option );
+			$value = is_array( $value ) ? $value : trim( $value );
+			$value = stripslashes_deep( $value );
+			if ( $value ) {
+				bb_update_option( $option, $value );
+			} else {
+				bb_delete_option( $option );
+			}
+		}
+	}
+
+	$mod_rewrite = (string) bb_get_option( 'mod_rewrite' );
+
+	$goback = remove_query_arg( array( 'updated', 'notapache', 'notmodrewrite' ), wp_get_referer() );
+
+	// Make sure mod_rewrite is possible on the server
+	if ( !$is_apache ) {
+		bb_delete_option( 'mod_rewrite_writable' );
+		$goback = add_query_arg( 'notapache', 'true', $goback );
+		bb_safe_redirect( $goback );
+		exit;
+	} elseif ( '0' !== $mod_rewrite && !apache_mod_loaded( 'mod_rewrite', true ) ) {
+		bb_delete_option( 'mod_rewrite_writable' );
+		bb_update_option( 'mod_rewrite', '0' );
+		$goback = add_query_arg( 'notmodrewrite', 'true', $goback );
+		bb_safe_redirect( $goback );
+		exit;
+	}
+
+	$file_target_rules = array();
+
+	$file_target_exists = false;
+	$file_target_writable = true;
+	if ( file_exists( $file_target ) ) {
+		if ( is_readable( $file_target ) ) {
+			$file_target_rules = explode( "\n", implode( '', file(  $file_target ) ) );
+		}
+		$file_target_exists = true;
+		if ( !is_writable( $file_target ) ) {
+			$file_target_writable = false;
+		}
+	} else {
+		$file_target_dir = dirname( $file_target );
+		if ( file_exists( $file_target_dir ) ) {
+			if ( !is_writable( $file_target_dir ) || !is_dir( $file_target_dir ) ) {
+				$file_target_writable = false;
+			}
+		} else {
+			$file_target_writable = false;
+		}
+	}
+
+	// Strip out existing bbPress rules
+	$_keep_rule = true;
+	$_kept_rules = array();
+	foreach ( $file_target_rules as $_rule ) {
+		if ( false !== strpos( $_rule, '# BEGIN bbPress' ) ) {
+			$_keep_rule = false;
+			continue;
+		} elseif ( false !== strpos( $_rule, '# END bbPress' ) ) {
+			$_keep_rule = true;
+			continue;
+		}
+		if ( $_keep_rule ) {
+			$_kept_rules[] = $_rule;
+		}
+	}
+
+	$file_target_rules = join( "\n", $_kept_rules ) . "\n" . $file_source_rules;
+	
+	$file_target_written = 0;
+	if ( $file_target_writable ) {
+		// Open the file for writing - rewrites the whole file
+		if ( $file_target_handle = fopen( $file_target, 'w' ) ) {
+			if ( fwrite( $file_target_handle, $file_target_rules ) ) {
+				$file_target_written = 1;
+			}
+			// Close the file
+			fclose( $file_target_handle );
+			@chmod( $file_target, 0666 );
+		}
+	}
+
+	bb_update_option( 'mod_rewrite_writable', $file_target_writable );
+	$goback = add_query_arg( 'updated', 'true', $goback );
+	bb_safe_redirect( $goback );
+	exit;
+}
+
+if ( $is_apache && bb_get_option( 'mod_rewrite' ) && !bb_get_option( 'mod_rewrite_writable' ) ) {
+	$manual_instructions = true;
+}
+
+if ( !empty( $_GET['notmodrewrite'] ) ) {
+	$manual_instructions = false;
+	bb_admin_notice( __( '<strong>It appears that your server does not support custom permalink structures.</strong>' ), 'error' );
+}
+
+if ( !empty( $_GET['notapache'] ) ) {
+	$manual_instructions = false;
+	bb_admin_notice( __( '<strong>Rewriting on webservers other than Apache using mod_rewrite is currently unsupported, but we won&#8217;t stop you from trying.</strong>' ), 'error' );
+}
+
+if ( !empty( $_GET['updated'] ) ) {
+	if ( $manual_instructions ) {
+		bb_admin_notice( __( '<strong>You should update your .htaccess now.</strong>' ) );
+	} else {
+		bb_admin_notice( __( '<strong>Permalink structure updated.</strong>' ) );
+	}
+}
+
+$permalink_options = array(
+	'mod_rewrite' => array(
+		'title' => __( 'Permalink type' ),
+		'type' => 'radio',
+		'options' => array(
+			'0' => sprintf( __( '<span>None</span> <code>%s</code>' ), bb_get_uri( 'forums.php', array( 'id' => 1 ), BB_URI_CONTEXT_TEXT ) ),
+			'1' => sprintf( __( '<span>Numeric</span> <code>%s</code>' ), bb_get_uri( 'forums/1', null, BB_URI_CONTEXT_TEXT ) ),
+			'slugs' => sprintf( __( '<span>Name based</span> <code>%s</code>' ), bb_get_uri( '/forums/first-forum', null, BB_URI_CONTEXT_TEXT ) )
+		)
+	)
+);
+
+$bb_admin_body_class = ' bb-admin-settings';
+
+bb_get_admin_header();
+
+?>
+
+<div class="wrap">
+
+<h2><?php _e( 'Permalink Settings' ); ?></h2>
+<?php do_action( 'bb_admin_notices' ); ?>
+
+<form class="settings" method="post" action="<?php bb_uri( 'bb-admin/options-permalinks.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN ); ?>">
+	<fieldset>
+		<p>
+			<?php _e( 'By default bbPress uses web URLs which have question marks and lots of numbers in them, however bbPress offers you the ability to choose an alternative URL structure for your permalinks. This can improve the aesthetics, usability, and forward-compatibility of your links.' ); ?>
+		</p>
+<?php
+foreach ( $permalink_options as $option => $args ) { 
+	bb_option_form_element( $option, $args );
+}
+?>
+	</fieldset>
+	<fieldset class="submit">
+		<?php bb_nonce_field( 'options-permalinks-update' ); ?>
+		<input type="hidden" name="action" value="update" />
+		<input class="submit" type="submit" name="submit" value="<?php _e('Save Changes') ?>" />
+	</fieldset>
+</form>
+
+<?php
+if ( $manual_instructions ) {
+?>
+<form class="settings" method="post" action="<?php bb_uri( 'bb-admin/options-permalinks.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN ); ?>">
+	<fieldset>
+		<p>
+			<?php _e( 'If your <code>.htaccess</code> file were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.' ); ?>
+		</p>
+		<textarea dir="ltr" id="rewrite-rules" class="readonly" readonly="readonly" rows="6"><?php echo esc_html( trim( $file_source_rules ) ); ?></textarea>
+	</fieldset>
+</form>
+
+<?php
+}
+?>
+
+</div>
+
+<?php
+
+bb_get_admin_footer();
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-reading.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-reading.php
new file mode 100644
index 0000000000000000000000000000000000000000..b70ac9333c746c3046d3c50b60e02b7b450774d7
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-reading.php
@@ -0,0 +1,69 @@
+<?php
+
+require_once('admin.php');
+
+if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && $_POST['action'] == 'update') {
+	
+	bb_check_admin_referer( 'options-reading-update' );
+	
+	foreach ( (array) $_POST as $option => $value ) {
+		if ( !in_array( $option, array('_wpnonce', '_wp_http_referer', 'action', 'submit') ) ) {
+			$option = trim( $option );
+			$value = is_array( $value ) ? $value : trim( $value );
+			$value = stripslashes_deep( $value );
+			if ( $value ) {
+				bb_update_option( $option, $value );
+			} else {
+				bb_delete_option( $option );
+			}
+		}
+	}
+	
+	$goback = add_query_arg('updated', 'true', wp_get_referer());
+	bb_safe_redirect($goback);
+	exit;
+}
+
+if ( !empty($_GET['updated']) ) {
+	bb_admin_notice( __( '<strong>Settings saved.</strong>' ) );
+}
+
+$reading_options = array(
+	'page_topics' => array(
+		'title' => __( 'Items per page' ),
+		'class' => 'short',
+		'note' => __( 'Number of topics, posts or tags to show per page.' ),
+	)
+);
+
+$bb_admin_body_class = ' bb-admin-settings';
+
+bb_get_admin_header();
+
+?>
+
+<div class="wrap">
+
+<h2><?php _e('Reading Settings'); ?></h2>
+<?php do_action( 'bb_admin_notices' ); ?>
+
+<form class="settings" method="post" action="<?php bb_uri('bb-admin/options-reading.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>">
+	<fieldset>
+<?php
+foreach ( $reading_options as $option => $args ) {
+	bb_option_form_element( $option, $args );
+}
+?>
+	</fieldset>
+	<fieldset class="submit">
+		<?php bb_nonce_field( 'options-reading-update' ); ?>
+		<input type="hidden" name="action" value="update" />
+		<input class="submit" type="submit" name="submit" value="<?php _e('Save Changes') ?>" />
+	</fieldset>
+</form>
+
+</div>
+
+<?php
+
+bb_get_admin_footer();
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-wordpress.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-wordpress.php
new file mode 100644
index 0000000000000000000000000000000000000000..8994e7308b53995775c89038f5bb21a18f1925ae
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-wordpress.php
@@ -0,0 +1,311 @@
+<?php
+
+require_once('admin.php');
+
+if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) )
+	$action = @$_POST['action'];
+else
+	$action = false;
+
+if ( in_array( $action, array('update-users', 'update-options') ) ) {
+	bb_check_admin_referer( 'options-wordpress-' . $action );
+	
+	// Deal with advanced user database checkbox when it isn't checked
+	if (!isset($_POST['user_bbdb_advanced'])) {
+		$_POST['user_bbdb_advanced'] = false;
+	}
+	
+	foreach ( (array) $_POST as $option => $value ) {
+		if ( !in_array( $option, array('_wpnonce', '_wp_http_referer', 'action', 'submit') ) ) {
+			$option = trim( $option );
+			$value = is_array( $value ) ? $value : trim( $value );
+			$value = stripslashes_deep( $value );
+			if ( ( $option == 'wp_siteurl' || $option == 'wp_home' ) && !empty( $value ) ) {
+				$value = rtrim( $value, " \t\n\r\0\x0B/" ) . '/';
+			}
+			if ( $value ) {
+				bb_update_option( $option, $value );
+			} else {
+				bb_delete_option( $option );
+			}
+		}
+	}
+	
+	if ($action == 'update-users') {
+		bb_apply_wp_role_map_to_orphans();
+	}
+	
+	$goback = add_query_arg('updated', $action, wp_get_referer());
+	bb_safe_redirect($goback);
+	exit;
+}
+
+switch (@$_GET['updated']) {
+	case 'update-users':
+		bb_admin_notice( __( '<strong>User role mapping saved.</strong>' ) );
+		break;
+	case 'update-options':
+		bb_admin_notice( __( '<strong>User integration settings saved.</strong>' ) );
+		break;
+}
+
+
+
+$bb_role_names[''] = _c( 'none|no bbPress role' );
+$bb_role_names = array_merge( $bb_role_names, array_map( create_function( '$a', 'return sprintf( _c( "bbPress %s|bbPress role" ), $a );' ), $wp_roles->get_names() ) );
+
+$wpRoles = array(
+	'administrator' => __('WordPress Administrator'),
+	'editor'        => __('WordPress Editor'),
+	'author'        => __('WordPress Author'),
+	'contributor'   => __('WordPress Contributor'),
+	'subscriber'    => __('WordPress Subscriber')
+);
+
+$cookie_options = array(
+	'wp_siteurl' => array(
+		'title' => __( 'WordPress address (URL)' ),
+		'class' => 'long',
+		'note' => __( 'This value should exactly match the <strong>WordPress address (URL)</strong> setting in your WordPress general settings.' )
+	),
+	'wp_home' => array(
+		'title' => __( 'Blog address (URL)' ),
+		'class' => 'long',
+		'note' => __( 'This value should exactly match the <strong>Blog address (URL)</strong> setting in your WordPress general settings.' )
+	),
+	'bb_auth_salt' => array(
+		'title' => __( 'WordPress "auth" cookie salt' ),
+		'note' => __( 'This must match the value of the WordPress setting named "auth_salt" in your WordPress site. Look for the option labeled "auth_salt" in <a href="#" id="getAuthSaltOption" onclick="window.open(this.href); return false;">this WordPress admin page</a>.' )
+	),
+	'bb_secure_auth_salt' => array(
+		'title' => __( 'WordPress "secure auth" cookie salt' ),
+		'note' => __( 'This must match the value of the WordPress setting named "secure_auth_salt" in your WordPress site. Look for the option labeled "secure_auth_salt" in <a href="#" id="getSecureAuthSaltOption" onclick="window.open(this.href); return false;">this WordPress admin page</a>. Sometimes this value is not set in WordPress, in that case you can leave this setting blank as well.' )
+	),
+	'bb_logged_in_salt' => array(
+		'title' => __( 'WordPress "logged in" cookie salt' ),
+		'note' => __( 'This must match the value of the WordPress setting named "logged_in_salt" in your WordPress site. Look for the option labeled "logged_in_salt" in <a href="#" id="getLoggedInSaltOption" onclick="window.open(this.href); return false;">this WordPress admin page</a>.' )
+	)
+);
+
+foreach ( array( 'bb_auth_salt', 'bb_secure_auth_salt', 'bb_logged_in_salt' ) as $salt_constant ) {
+	if ( defined( strtoupper( $salt_constant ) ) ) {
+		$cookie_options[$salt_constant]['note'] = array(
+			sprintf( __( 'You have defined the "%s" constant which locks this setting.' ), strtoupper( $salt_constant ) ),
+			$cookie_options[$salt_constant]['note'],
+		);
+		$cookie_options[$salt_constant]['value'] = constant( strtoupper( $salt_constant ) );
+		$bb_hardcoded[$salt_constant] = true;
+	}
+}
+
+$user_db_options = array(
+	'wp_table_prefix' => array(
+		'title' => __( 'User database table prefix' ),
+		'note'  => __( 'If your bbPress and WordPress sites share the same database, then this is the same value as <code>$table_prefix</code> in your WordPress <code>wp-config.php</code> file. It is usually <strong>wp_</strong>.' )
+	),
+	'wordpress_mu_primary_blog_id' => array(
+		'title' => __( 'WordPress MU primary blog ID' ),
+		'note'  => __( 'If you are integrating with a WordPress MU site you need to specify the primary blog ID for that site. It is usually <strong>1</strong>. You should probably leave this blank if you are integrating with a standard WordPress site' )
+	),
+	'user_bbdb_advanced' => array(
+		'title' => __( 'Show advanced database settings' ),
+		'type' => 'checkbox',
+		'options' => array(
+			1 => array(
+				'label' => __( 'If your bbPress and WordPress site do not share the same database, then you will need to add advanced settings.' ),
+				'attributes' => array( 'onclick' => 'toggleAdvanced(this);' )
+			)
+		)
+	)
+);
+
+$advanced_user_db_options = array(
+	'user_bbdb_name' => array(
+		'title' => __( 'User database name' ),
+		'note' => __( 'The name of the database in which your user tables reside.' )
+	),
+	'user_bbdb_user' => array(
+		'title' => __( 'User database user' ),
+		'note' => __( 'The database user that has access to that database.' )
+	),
+	'user_bbdb_password' => array(
+		'title' => __( 'User database password' ),
+		'note' => __( 'That database user\'s password.' )
+	),
+	'user_bbdb_host' => array(
+		'title' => __( 'User database host' ),
+		'note' => __( 'The domain name or IP address of the server where the database is located. If the database is on the same server as the web site, then this probably should be <strong>localhost</strong>.' )
+	),
+	'user_bbdb_charset' => array(
+		'title' => __( 'User database character set' ),
+		'note' => __( 'The best choice is <strong>utf8</strong>, but you will need to match the character set which you created the database with.' )
+	),
+	'user_bbdb_collate' => array(
+		'title' => __( 'User database character collation' ),
+		'note' => __( 'The character collation value set when the user database was created.' )
+	)
+);
+
+$custom_table_options = array(
+	'custom_user_table' => array(
+		'title' => __( 'User database "user" table' ),
+		'note' => __( 'The complete table name, including any prefix.' ),
+	),
+	'custom_user_meta_table' => array(
+		'title' => __( 'User database "user meta" table' ),
+		'note' => __( 'The complete table name, including any prefix.' ),
+	),
+);
+
+$advanced_display = bb_get_option( 'user_bbdb_advanced' ) ? 'block' : 'none';
+
+$bb_admin_body_class = ' bb-admin-settings';
+
+bb_get_admin_header();
+
+?>
+
+<div class="wrap">
+
+<h2><?php _e( 'WordPress Integration Settings' ); ?></h2>
+<?php do_action( 'bb_admin_notices' ); ?>
+
+<form class="settings" method="post" action="<?php bb_uri('bb-admin/options-wordpress.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>">
+	<fieldset>
+		<legend><?php _e('User Role Map'); ?></legend>
+		<p><?php _e('Here you can match WordPress roles to bbPress roles.'); ?></p>
+		<p><?php _e('This will have no effect until your user tables are integrated below. Only standard WordPress roles are supported. Changes do not affect users with existing roles in both WordPress and bbPress.'); ?></p>
+<?php foreach ( $wpRoles as $wpRole => $wpRoleName ) bb_option_form_element( "wp_roles_map[$wpRole]", array( 'title' => $wpRoleName, 'type' => 'select', 'options' => $bb_role_names ) ); ?>
+	</fieldset>
+	<fieldset class="submit">
+		<?php bb_nonce_field( 'options-wordpress-update-users' ); ?>
+		<input type="hidden" name="action" value="update-users" />
+		<input class="submit" type="submit" name="submit" value="<?php _e('Save Changes') ?>" />
+	</fieldset>
+</form>
+
+<hr class="settings" />
+
+<div class="settings">
+	<h3><?php _e('User Integration'); ?></h3>
+	<p><?php _e('Usually, you will have to specify both cookie integration and user database integration settings. Make sure you have a "User role map" setup above before trying to add user integration.'); ?></p>
+	<p><?php _e('<em><strong>Note:</strong> changing the settings below may cause you to be logged out!</em>'); ?></p>
+</div>
+
+<form class="settings" method="post" action="<?php bb_uri('bb-admin/options-wordpress.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>">
+	<fieldset>
+		<legend><?php _e('Cookies'); ?></legend>
+		<p><?php _e('Cookie sharing allows users to log in to either your bbPress or your WordPress site, and have access to both.'); ?></p>
+	<?php foreach ( $cookie_options as $option => $args ) bb_option_form_element( $option, $args ); ?>
+		<script type="text/javascript" charset="utf-8">
+/* <![CDATA[ */
+			function updateWordPressOptionURL () {
+				var siteURLInputValue = document.getElementById('wp-siteurl').value;
+				if (siteURLInputValue && siteURLInputValue.substr(-1,1) != '/') {
+					siteURLInputValue += '/';
+				}
+				var authSaltAnchor = document.getElementById('getAuthSaltOption');
+				var secureAuthSaltAnchor = document.getElementById('getSecureAuthSaltOption');
+				var loggedInSaltAnchor = document.getElementById('getLoggedInSaltOption');
+				if (siteURLInputValue) {
+					authSaltAnchor.href = siteURLInputValue + 'wp-admin/options.php';
+					secureAuthSaltAnchor.href = siteURLInputValue + 'wp-admin/options.php';
+					loggedInSaltAnchor.href = siteURLInputValue + 'wp-admin/options.php';
+				} else {
+					authSaltAnchor.href = '';
+					secureAuthSaltAnchor.href = '';
+					loggedInSaltAnchor.href = '';
+				}
+			}
+			var siteURLInput = document.getElementById('wp-siteurl');
+			if (siteURLInput.value) {
+				updateWordPressOptionURL();
+			}
+			siteURLInput.onkeyup = updateWordPressOptionURL;
+			siteURLInput.onblur = updateWordPressOptionURL;
+			siteURLInput.onclick = updateWordPressOptionURL;
+			siteURLInput.onchange = updateWordPressOptionURL;
+/* ]]> */
+		</script>
+<?php
+$cookie_settings = array(
+	'cookiedomain' => 'COOKIE_DOMAIN',
+	'cookiepath' => 'COOKIEPATH'
+);
+$wp_settings = '';
+foreach ($cookie_settings as $bb_setting => $wp_setting) {
+	if ( isset($bb->$bb_setting) ) {
+		$wp_settings .= 'define(\'' . $wp_setting . '\', \'' . $bb->$bb_setting . '\');' . "\n";
+	}
+}
+?>
+		<p><?php printf(__('To complete cookie integration, you will need to add some settings to your <code>wp-config.php</code> file in the root directory of your WordPress installation. To get those settings, you will need to install and configure the <a href="%s">"bbPress Integration" plugin for WordPress</a>.'), 'http://wordpress.org/extend/plugins/bbpress-integration/'); ?></p>
+		<p><?php _e('You will also have to manually ensure that the following constants are equivalent in WordPress\' and bbPress\' respective config files.'); ?></p>
+		<div class="table">
+			<table>
+				<tr>
+					<th><?php _e('WordPress'); ?></th>
+					<td></td>
+					<th><?php _e('bbPress'); ?></th>
+				</tr>
+				<tr>
+					<td>AUTH_KEY</td>
+					<td>&lt;=&gt;</td>
+					<td>BB_AUTH_KEY</td>
+				</tr>
+				<tr>
+					<td>SECURE_AUTH_KEY</td>
+					<td>&lt;=&gt;</td>
+					<td>BB_SECURE_AUTH_KEY</td>
+				</tr>
+				<tr>
+					<td>LOGGED_IN_KEY</td>
+					<td>&lt;=&gt;</td>
+					<td>BB_LOGGED_IN_KEY</td>
+				</tr>
+			</table>
+		</div>
+	</fieldset>
+
+	<fieldset>
+		<legend><?php _e('User database'); ?></legend>
+		<p><?php _e('User database sharing allows you to store user data in your WordPress database.'); ?></p>
+		<p><?php _e('You should setup a "User role map" before'); ?></p>
+		<script type="text/javascript" charset="utf-8">
+			function toggleAdvanced(checkedObj) {
+				var advanced1 = document.getElementById('advanced1');
+				var advanced2 = document.getElementById('advanced2');
+				if (checkedObj.checked) {
+					advanced1.style.display = 'block';
+					advanced2.style.display = 'block';
+				} else {
+					advanced1.style.display = 'none';
+					advanced2.style.display = 'none';
+				}
+			}
+		</script>
+	<?php foreach ( $user_db_options as $option => $args ) bb_option_form_element( $option, $args ); ?>
+	</fieldset>
+	<fieldset id="advanced1" style="display:<?php echo $advanced_display; ?>">
+		<legend><?php _e('Separate user database settings'); ?></legend>
+		<p><?php _e('Most of the time these settings are <em>not</em> required. Look before you leap!'); ?></p>
+		<p><?php _e('All settings except for the character set must be specified.'); ?></p>
+	<?php foreach ( $advanced_user_db_options as $option => $args ) bb_option_form_element( $option, $args ); ?>
+	</fieldset>
+	<fieldset id="advanced2" style="display:<?php echo $advanced_display; ?>">
+		<legend><?php _e('Custom user tables'); ?></legend>
+		<p><?php _e('Only set these values if your user tables differ from the default WordPress naming convention.'); ?></p>
+	<?php foreach ( $custom_table_options as $option => $args ) bb_option_form_element( $option, $args ); ?>
+	</fieldset>
+	<fieldset class="submit">
+		<?php bb_nonce_field( 'options-wordpress-update-options' ); ?>
+		<input type="hidden" name="action" value="update-options" />
+		<input class="submit" type="submit" name="submit" value="<?php _e('Save Changes') ?>" />
+	</fieldset>
+</form>
+
+</div>
+
+<?php
+bb_get_admin_footer();
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-writing.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-writing.php
new file mode 100644
index 0000000000000000000000000000000000000000..a98e4271ad60b40acdae093dfecd4adb973bd58f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/options-writing.php
@@ -0,0 +1,86 @@
+<?php
+
+require_once('admin.php');
+
+if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && $_POST['action'] == 'update') {
+	
+	bb_check_admin_referer( 'options-writing-update' );
+	
+	// Deal with xmlrpc checkbox when it isn't checked
+	if (!isset($_POST['enable_xmlrpc'])) {
+		$_POST['enable_xmlrpc'] = false;
+	}
+	
+	foreach ( (array) $_POST as $option => $value ) {
+		if ( !in_array( $option, array('_wpnonce', '_wp_http_referer', 'action', 'submit') ) ) {
+			$option = trim( $option );
+			$value = is_array( $value ) ? $value : trim( $value );
+			$value = stripslashes_deep( $value );
+			if ( $value ) {
+				bb_update_option( $option, $value );
+			} else {
+				bb_delete_option( $option );
+			}
+		}
+	}
+	
+	$goback = add_query_arg('updated', 'true', wp_get_referer());
+	bb_safe_redirect($goback);
+	exit;
+}
+
+if ( !empty($_GET['updated']) ) {
+	bb_admin_notice( __( '<strong>Settings saved.</strong>' ) );
+}
+
+$general_options = array(
+	'edit_lock' => array(
+		'title' => __( 'Lock post editing after' ),
+		'class' => 'short',
+		'after' => __( 'minutes' ),
+		'note' => __( 'A user can edit a post for this many minutes after submitting.' ),
+	)
+);
+
+$remote_options = array(
+	'enable_xmlrpc' => array(
+		'title' => __( 'XML-RPC' ),
+		'type' => 'checkbox',
+		'options' => array(
+			1 => __( 'Enable the bbPress XML-RPC publishing protocol.' )
+		)
+	)
+);
+
+$bb_admin_body_class = ' bb-admin-settings';
+
+bb_get_admin_header();
+
+?>
+
+<div class="wrap">
+
+<h2><?php _e('Writing Settings'); ?></h2>
+<?php do_action( 'bb_admin_notices' ); ?>
+
+<form class="settings" method="post" action="<?php bb_uri( 'bb-admin/options-writing.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN ); ?>">
+	<fieldset><?php foreach ( $general_options as $option => $args ) bb_option_form_element( $option, $args ); ?></fieldset>
+	<fieldset>
+		<legend><?php _e('Remote Publishing'); ?></legend>
+		<p>
+			<?php _e( 'To interact with bbPress from a desktop client or remote website that uses the XML-RPC publishing interface you must enable it below.' ); ?>
+		</p>
+<?php		foreach ( $remote_options as $option => $args ) bb_option_form_element( $option, $args ); ?>
+	</fieldset>
+	<fieldset class="submit">
+		<?php bb_nonce_field( 'options-writing-update' ); ?>
+		<input type="hidden" name="action" value="update" />
+		<input class="submit" type="submit" name="submit" value="<?php _e('Save Changes') ?>" />
+	</fieldset>
+</form>
+
+</div>
+
+<?php
+
+bb_get_admin_footer();
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/plugins.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/plugins.php
new file mode 100644
index 0000000000000000000000000000000000000000..fe92cdaa90034ae2503a243601bb0fe2b4c78b3f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/plugins.php
@@ -0,0 +1,268 @@
+<?php
+require_once( 'admin.php' );
+
+require_once( 'includes/functions.bb-plugin.php' );
+
+$plugin_request = 'all';
+
+if ( isset( $_GET['plugin_request'] ) ) {
+	$plugin_request = (string) $_GET['plugin_request'];
+}
+
+switch ( $plugin_request ) {
+	case 'active':
+		$_plugin_type = 'normal';
+		$_plugin_status = 'active';
+		break;
+	case 'inactive':
+		$_plugin_type = 'normal';
+		$_plugin_status = 'inactive';
+		break;
+	case 'autoload':
+		$_plugin_type = 'autoload';
+		$_plugin_status = 'all';
+		break;
+	default:
+		$plugin_request = 'all'; // For sanitisation
+		$_plugin_type = 'all';
+		$_plugin_status = 'all';
+		break;
+}
+
+$plugin_nav_class = array(
+	'all' => '',
+	'active' => '',
+	'inactive' => '',
+	'autoload' => ''
+);
+$plugin_nav_class[$plugin_request] = ' class="current"';
+
+// Get plugin counts
+extract( bb_get_plugin_counts() );
+
+// Get requested plugins
+$requested_plugins = bb_get_plugins( 'all', $_plugin_type, $_plugin_status );
+
+// Get currently active 
+$active_plugins = (array) bb_get_option( 'active_plugins' );
+
+// Check for missing plugin files and remove them from the active plugins array
+$update = false;
+foreach ( $active_plugins as $index => $plugin ) {
+	if ( !file_exists( bb_get_plugin_path( $plugin ) ) ) {
+		$update = true;
+		unset( $active_plugins[$index] );
+	}
+}
+if ( $update ) {
+	bb_update_option( 'active_plugins', $active_plugins );
+}
+unset( $update, $index, $plugin );
+
+// Set the action
+$action = '';
+if( isset( $_GET['action'] ) && !empty( $_GET['action'] ) ) {
+	$action = trim( $_GET['action'] );
+}
+
+// Set the plugin
+$plugin = isset( $_GET['plugin'] ) ? trim( stripslashes( $_GET['plugin'] ) ) : '';
+
+// Deal with user actions
+if ( !empty( $action ) ) {
+	switch ( $action ) {
+		case 'activate':
+			// Activation
+			bb_check_admin_referer( 'activate-plugin_' . $plugin );
+
+			$result = bb_activate_plugin( $plugin, 'plugins.php?message=error&plugin=' . urlencode( $plugin ) );
+			if ( is_wp_error( $result ) )
+				bb_die( $result );
+
+			// Overrides the ?message=error one above
+			wp_redirect( 'plugins.php?plugin_request=' . $plugin_request . '&message=activate&plugin=' . urlencode( $plugin ) );
+			break;
+
+		case 'deactivate':
+			// Deactivation
+			bb_check_admin_referer( 'deactivate-plugin_' . $plugin );
+
+			// Remove the deactivated plugin
+			bb_deactivate_plugins( $plugin );
+
+			// Redirect
+			wp_redirect( 'plugins.php?plugin_request=' . $plugin_request . '&message=deactivate&plugin=' . urlencode( $plugin ) );
+			break;
+
+		case 'scrape':
+			// Scrape php errors from the plugin
+			bb_check_admin_referer('scrape-plugin_' . $plugin);
+
+			$valid_path = bb_validate_plugin( $plugin );
+			if ( is_wp_error( $valid_path ) )
+				bb_die( $valid_path );
+
+			// Pump up the errors and output them to screen
+			error_reporting( E_ALL ^ E_NOTICE );
+			@ini_set( 'display_errors', true );
+
+			include( $valid_path );
+			break;
+	}
+
+	// Stop processing
+	exit;
+}
+
+// Display notices
+if ( isset($_GET['message']) ) {
+	switch ( $_GET['message'] ) {
+		case 'error' :
+			bb_admin_notice( __( '<strong>Plugin could not be activated, it produced a Fatal Error</strong>. The error is shown below.' ), 'error' );
+			break;
+		case 'activate' :
+			$plugin_data = bb_get_plugin_data( $plugin );
+			bb_admin_notice( sprintf( __( '<strong>"%s" plugin activated</strong>' ), esc_attr( $plugin_data['name'] ) ) );
+			break;
+		case 'deactivate' :
+			$plugin_data = bb_get_plugin_data( $plugin );
+			bb_admin_notice( sprintf( __( '<strong>"%s" plugin deactivated</strong>' ), esc_attr( $plugin_data['name'] ) ) );
+			break;
+	}
+}
+
+if ( isset( $bb->safemode ) && $bb->safemode === true ) {
+	bb_admin_notice( __( '<strong>"Safe mode" is on, all plugins are disabled even if they are listed as active.</strong>' ), 'error' );
+}
+
+$bb_admin_body_class = ' bb-admin-plugins';
+
+bb_get_admin_header();
+?>
+
+<div class="wrap">
+
+	<h2><?php _e( 'Manage Plugins' ); ?></h2>
+	<?php do_action( 'bb_admin_notices' ); ?>
+
+<?php
+if ( bb_verify_nonce( $_GET['_scrape_nonce'], 'scrape-plugin_' . $plugin ) ) {
+	$scrape_src = esc_attr(
+		bb_nonce_url(
+			bb_get_uri(
+				'bb-admin/plugins.php',
+				array(
+					'action' => 'scrape',
+					'plugin' => urlencode( $plugin )
+				),
+				BB_URI_CONTEXT_IFRAME_SRC + BB_URI_CONTEXT_BB_ADMIN
+			),
+			'scrape-plugin_' . $plugin
+		)
+	);
+?>
+
+	<div class="plugin-error"><iframe src="<?php echo $scrape_src; ?>"></iframe></div>
+
+<?php
+}
+?>
+
+	<div class="table-filter">
+		<a<?php echo $plugin_nav_class['all']; ?> href="<?php bb_uri( 'bb-admin/plugins.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN ); ?>"><?php printf( __( 'All <span class="count">(%d)</span>' ), $plugin_count_all ); ?></a> |
+		<a<?php echo $plugin_nav_class['active']; ?> href="<?php bb_uri( 'bb-admin/plugins.php', array( 'plugin_request' => 'active' ), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN ); ?>"><?php printf( __( 'Active <span class="count">(%d)</span>' ), $plugin_count_active ); ?></a> |
+		<a<?php echo $plugin_nav_class['inactive']; ?> href="<?php bb_uri( 'bb-admin/plugins.php', array( 'plugin_request' => 'inactive' ), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN ); ?>"><?php printf( __( 'Inactive <span class="count">(%d)</span>' ), $plugin_count_inactive ); ?></a> |
+		<a<?php echo $plugin_nav_class['autoload']; ?> href="<?php bb_uri( 'bb-admin/plugins.php', array( 'plugin_request' => 'autoload' ), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN ); ?>"><?php printf( __( 'Autoloaded <span class="count">(%d)</span>' ), $plugin_count_autoload ); ?></a>
+	</div>
+
+<?php
+if ( $requested_plugins ) :
+?> 
+
+	<table id="plugins-list" class="widefat">
+		<thead>
+			<tr>
+				<th><?php _e( 'Plugin' ); ?></th>
+				<th><?php _e( 'Description' ); ?></th>
+			</tr>
+		</thead>
+		<tfoot>
+			<tr>
+				<th><?php _e( 'Plugin' ); ?></th>
+				<th><?php _e( 'Description' ); ?></th>
+			</tr>
+		</tfoot>
+		<tbody>
+
+<?php
+	foreach ( $requested_plugins as $plugin => $plugin_data ) :
+		$class =  ' class="inactive"';
+		$action = 'activate';
+		$action_class = 'edit';
+		$action_text = __( 'Activate' );
+		if ( $plugin_data['autoload'] ) {
+			$class =  ' class="autoload"';
+		} elseif ( in_array( $plugin, $active_plugins ) ) {
+			$class =  ' class="active"';
+			$action = 'deactivate';
+			$action_class = 'delete';
+			$action_text = __( 'Deactivate' );
+		}
+		$href = esc_attr(
+			bb_nonce_url(
+				bb_get_uri(
+					'bb-admin/plugins.php',
+					array(
+						'plugin_request' => $plugin_request,
+						'action' => $action,
+						'plugin' => urlencode($plugin)
+					),
+					BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN
+				),
+				$action . '-plugin_' . $plugin
+			)
+		);
+		$meta = array();
+		if ( $plugin_data['version'] ) $meta[] = sprintf( __( 'Version %s' ), $plugin_data['version'] );
+		if ( $plugin_data['author_link'] ) $meta[] = sprintf( __( 'By %s' ), $plugin_data['author_link'] );
+		if ( $plugin_data['uri'] ) $meta[] = '<a href="' . $plugin_data['uri'] . '">' . esc_html__( 'Visit plugin site' ) . '</a>';
+		if ( count( $meta ) ) {
+			$meta = '<p class="meta">' . join( ' | ', $meta ) . '</p>';
+		} else {
+			$meta = '';
+		}
+?>
+
+			<tr<?php echo $class; ?>>
+				<td class="plugin-name">
+					<span class="row-title"><?php echo $plugin_data['name']; ?></span>
+					<div><span class="row-actions"><?php if ( !$plugin_data['autoload'] ) : ?><a class="<?php echo $action_class; ?>" href="<?php echo $href; ?>"><?php echo $action_text; ?></a><?php else : ?><span class="note"><?php _e( 'Autoloaded' ); ?></span><?php endif; ?></span>&nbsp;</div>
+				</td>
+				<td class="plugin-description">
+					<?php echo $plugin_data['description']; ?>
+					<?php echo $meta; ?>
+				</td>
+			</tr>
+
+<?php
+	endforeach;
+?>
+
+		</tbody>
+	</table>
+
+<?php
+else :
+?>
+
+	<p class="no-results"><?php _e( 'No plugins found.' ); ?></p>
+
+<?php
+endif;
+?>
+
+</div>
+
+<?php
+bb_get_admin_footer();
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/posts.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/posts.php
new file mode 100644
index 0000000000000000000000000000000000000000..cb0f997bc3f7730b5d523b3f1a0b4db21841e841
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/posts.php
@@ -0,0 +1,119 @@
+<?php
+require_once('admin.php');
+
+if ( !empty( $_GET['message'] ) ) {
+	switch ( (string) $_GET['message'] ) {
+		case 'undeleted':
+			bb_admin_notice( __( '<strong>Post undeleted.</strong>' ) );
+			break;
+		case 'deleted':
+			bb_admin_notice( __( '<strong>Post deleted.</strong>' ) );
+			break;
+		case 'spammed':
+			bb_admin_notice( __( '<strong>Post spammed.</strong>' ) );
+			break;
+		case 'unspammed-normal':
+			bb_admin_notice( __( '<strong>Post removed from spam.</strong> It is now a normal post.' ) );
+			break;
+		case 'unspammed-deleted':
+			bb_admin_notice( __( '<strong>Post removed from spam.</strong> It is now a deleted post.' ) );
+			break;
+	}
+}
+
+$ip_available = false;
+if ( bb_current_user_can( 'view_by_ip' ) ) {
+	$ip_available = true;
+} elseif (isset($_GET['poster_ip'])) {
+	unset( $_GET['poster_ip'] );
+}
+
+$bb_admin_body_class = ' bb-admin-posts';
+
+bb_get_admin_header();
+
+if ( !bb_current_user_can('browse_deleted') )
+	die(__("Now how'd you get here?  And what did you think you'd being doing?")); //This should never happen.
+add_filter( 'get_topic_where', 'bb_no_where' );
+add_filter( 'get_topic_link', 'bb_make_link_view_all' );
+add_filter( 'post_edit_uri', 'bb_make_link_view_all' );
+$post_query = new BB_Query_Form( 'post', array( 'post_status' => 'normal', 'count' => true, 'per_page' => 20 ) );
+$bb_posts =& $post_query->results;
+$total = $post_query->found_rows;
+?>
+
+<div class="wrap">
+
+<h2><?php _e( 'Posts' ); ?>
+<?php
+$h2_search = $post_query->get( 'post_text' );
+$h2_forum  = $post_query->get( 'forum_id' );
+$h2_tag    = $post_query->get( 'tag_id' );
+$h2_author = $post_query->get( 'post_author_id' );
+
+$h2_search = $h2_search ? ' ' . sprintf( __('containing &#8220;%s&#8221;'), esc_html( $h2_search ) ) : '';
+$h2_forum  = $h2_forum  ? ' ' . sprintf( __('in &#8220;%s&#8221;')      , get_forum_name( $h2_forum ) ) : '';
+$h2_tag    = $h2_tag    ? ' ' . sprintf( __('with tag &#8220;%s&#8221;'), esc_html( bb_get_tag_name( $h2_tag ) ) ) : '';
+$h2_author = $h2_author ? ' ' . sprintf( __('by %s')                    , esc_html( get_user_name( $h2_author ) ) ) : '';
+
+if ($ip_available) {
+	$h2_ip = $post_query->get( 'poster_ip' );
+	$h2_ip = $h2_ip ? ' ' . sprintf( __('from IP address %s'), esc_html( $h2_ip ) ) : '';
+} else {
+	$h2_ip = '';
+}
+
+if ( $h2_search || $h2_forum || $h2_tag || $h2_author || $h2_ip ) {
+	echo '<span class="subtitle">';
+	
+	printf( __( '%1$s%2$s%3$s%4$s%5$s' ), $h2_search, $h2_forum, $h2_tag, $h2_author, $h2_ip );
+	
+	echo '</span>';
+}
+?>
+</h2>
+<?php do_action( 'bb_admin_notices' ); ?>
+
+<?php $post_query->form( array( 'poster_ip' => $ip_available, 'tag' => true, 'post_author' => true, 'post_status' => true, 'submit' => __( 'Filter' ) ) ); ?>
+
+<div class="tablenav">
+<?php if ( $total ) : ?>
+	<div class="tablenav-pages">
+		<span class="displaying-num"><?php echo $displaying_num = sprintf(
+			__( '%1$s to %2$s of %3$s' ),
+			bb_number_format_i18n( ( $page - 1 ) * $post_query->get( 'per_page' ) + 1 ),
+			$page * $post_query->get( 'per_page' ) < $total ? bb_number_format_i18n( $page * $post_query->get( 'per_page' ) ) : '<span class="total-type-count">' . bb_number_format_i18n( $total ) . '</span>',
+			'<span class="total-type-count">' . bb_number_format_i18n( $total ) . '</span>'
+		); ?></span><span class="displaying-pages">
+<?php
+$_page_link_args = array(
+	'page' => $page,
+	'total' => $total,
+	'per_page' => $post_query->get( 'per_page' ),
+	'mod_rewrite' => false,
+	'prev_text' => __( '&laquo;' ),
+	'next_text' => __( '&raquo;' )
+);
+echo $page_number_links = get_page_number_links( $_page_link_args );
+?></span>
+		<div class="clear"></div>
+	</div>
+<?php endif; ?>
+</div>
+<div class="clear"></div>
+
+<?php bb_admin_list_posts(); ?>
+
+<div class="tablenav bottom">
+<?php if ( $total ) : ?>
+	<div class="tablenav-pages">
+		<span class="displaying-pages"><?php echo $page_number_links; ?></span>
+		<div class="clear"></div>
+	</div>
+<?php endif; ?>
+</div>
+<div class="clear"></div>
+
+</div>
+
+<?php bb_get_admin_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/rewrite-rules.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/rewrite-rules.php
new file mode 100644
index 0000000000000000000000000000000000000000..572821198b10d10209698b517bf2699f174346a3
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/rewrite-rules.php
@@ -0,0 +1,4 @@
+<?php
+require('admin-action.php');
+
+wp_redirect( bb_get_uri('bb-admin/options-permalinks.php', null, BB_URI_CONTEXT_BB_ADMIN + BB_URI_CONTEXT_HEADER) );
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/sticky.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/sticky.php
new file mode 100644
index 0000000000000000000000000000000000000000..f124fdae0bcafd8edcb9f1c26ba545beb3e0eabf
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/sticky.php
@@ -0,0 +1,29 @@
+<?php
+require('admin-action.php');
+
+$topic_id = (int) $_GET['id'];
+$topic    =  get_topic ( $topic_id );
+$super = ( isset($_GET['super']) && 1 == (int) $_GET['super'] ) ? 1 : 0;
+
+if ( !$topic )
+	bb_die(__('There is a problem with that topic, pardner.'));
+
+if ( !bb_current_user_can( 'stick_topic', $topic_id ) ) {
+	wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
+	exit;
+}
+
+bb_check_admin_referer( 'stick-topic_' . $topic_id );
+
+if ( topic_is_sticky( $topic_id ) )
+	bb_unstick_topic ( $topic_id );
+else
+	bb_stick_topic   ( $topic_id, $super );
+
+if ( !$redirect = wp_get_referer() )
+	$redirect = get_topic_link( $topic_id );
+
+bb_safe_redirect( $redirect );
+exit;
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/style-rtl.css b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/style-rtl.css
new file mode 100644
index 0000000000000000000000000000000000000000..85a52a4296a9fd27757b50ee1142f90585cbb431
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/style-rtl.css
@@ -0,0 +1,456 @@
+/*
+Start with some basic resets
+*/
+
+caption,th{text-align:right;}
+
+
+body {
+	font-family: Tahoma, "Times New Roman";
+}
+
+
+
+/* Header */
+
+div#bbHead h1 {
+	padding-right: 39px;
+	padding-left: 0;
+	margin-right: 16px;
+	margin-left: 0;
+	background-position: 100% 7px;
+	font-family: "Times New Roman", Tahoma;
+}
+
+div#bbHead h1 a em {
+	margin-left: auto;
+	margin-right: 5px;
+}
+
+div#bbUserInfo {
+	right: auto;
+	left: 15px;
+}
+
+
+
+/* Body */
+
+div#bbBody {
+	margin-left: 0;
+	margin-right: 175px;
+	padding-right: 0;
+	padding-left: 15px;
+}
+
+body.bb-menu-folded div#bbBody {
+	margin-left: auto;
+	margin-right: 59px;
+}
+
+h2 {
+	padding-right: 0;
+	padding-left: 15px;
+	font-family: "Times New Roman", Tahoma;
+}
+
+body.bb-admin-dashboard h2 {
+	padding-left: auto;
+	padding-right: 47px;
+	background-position: 100% -172px;
+}
+
+body.bb-admin-forums h2 {
+	padding-left: auto;
+	padding-right: 47px;
+	background-position: 100% -802px;
+}
+
+body.bb-admin-topics h2 {
+	padding-left: auto;
+	padding-right: 47px;
+	background-position: 100% -802px;
+}
+
+body.bb-admin-posts h2 {
+	padding-left: auto;
+	padding-right: 47px;
+	background-position: 100% -802px;
+}
+
+body.bb-admin-appearance h2 {
+	padding-left: auto;
+	padding-right: 47px;
+	background-position: 100% 8px;
+}
+
+body.bb-admin-plugins h2 {
+	padding-left: auto;
+	padding-right: 47px;
+	background-position: 100% -532px;
+}
+
+body.bb-admin-users h2 {
+	padding-left: auto;
+	padding-right: 47px;
+	background-position: 100% -891px;
+}
+
+body.bb-admin-tools h2 {
+	padding-left: auto;
+	padding-right: 47px;
+	background-position: 100% -621px;
+}
+
+body.bb-admin-settings h2 {
+	padding-left: auto;
+	padding-right: 47px;
+	background-position: 100% -712px;
+}
+
+
+
+
+
+/* Menu */
+ul#bbAdminMenu {
+	float: right;
+	margin-right: -160px;
+	margin-left: 5px;
+}
+
+body.bb-menu-folded ul#bbAdminMenu {
+	margin-left: 5px;
+	margin-right: -44px;
+}
+
+ul#bbAdminMenu li.bb-menu a {
+	font-family: "Times New Roman", Tahoma;
+}
+
+ul#bbAdminMenu li.bb-menu div.bb-menu-toggle {
+	float: left;
+	background-image: url('images/menu-bits-rtl.gif');
+	background-position: 100% -110px;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-has-submenu.bb-menu-current div.bb-menu-toggle {
+	background-position: 100% -208px;
+}
+
+ul#bbAdminMenu li.bb-menu a div.bb-menu-icon {
+	float: right;
+	background-position: -331px -39px;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li.bb-menu a:hover div.bb-menu-icon {
+	background-position: -331px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-dashboard a div.bb-menu-icon {
+	background-position: -62px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-dashboard.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-dashboard a:hover div.bb-menu-icon {
+	background-position: -62px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-forums a div.bb-menu-icon {
+	background-position: -272px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-forums.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-forums a:hover div.bb-menu-icon {
+	background-position: -272px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-topics a div.bb-menu-icon {
+	background-position: -272px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-topics.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-topics a:hover div.bb-menu-icon {
+	background-position: -272px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-posts a div.bb-menu-icon {
+	background-position: -272px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-posts.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-posts a:hover div.bb-menu-icon {
+	background-position: -272px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-appearance a div.bb-menu-icon {
+	background-position: -1px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-appearance.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-appearance a:hover div.bb-menu-icon {
+	background-position: -1px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-plugins a div.bb-menu-icon {
+	background-position: -181px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-plugins.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-plugins a:hover div.bb-menu-icon {
+	background-position: -181px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-users a div.bb-menu-icon {
+	background-position: -303px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-users.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-users a:hover div.bb-menu-icon {
+	background-position: -303px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-tools a div.bb-menu-icon {
+	background-position: -212px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-tools.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-tools a:hover div.bb-menu-icon {
+	background-position: -212px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-settings a div.bb-menu-icon {
+	background-position: -241px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-settings.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-settings a:hover div.bb-menu-icon {
+	background-position: -241px -7px;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-separator a {
+	background-position: -55px -34px;
+	cursor: e-resize;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu.bb-menu-separator a {
+	background-position: 0 5px;
+	cursor: w-resize;
+}
+
+ul#bbAdminMenu li.bb-menu div.bb-menu-sub-wrap {
+	border-left-width: 1px;
+	border-right-width: 0;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu div.bb-menu-sub-wrap {
+	left: auto;
+	right: 36px;
+}
+
+ul#bbAdminMenu li.bb-menu div.bb-menu-sub-wrap span {
+	font-family: "Times New Roman", Tahoma;
+	padding-right: 10px;
+	padding-left: 5px;
+}
+
+ul#bbAdminMenu li.bb-menu li.bb-menu-sub a {
+	font-family: Tahoma, "Times New Roman";
+	padding-right:12px;
+	padding-left: 5px;
+	background-image: url('images/menu-bits-rtl.gif');
+	background-position: 100% -306px;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu li.bb-menu-sub a {
+	background-image: url('images/menu-bits-rtl.gif');
+	background-position: 100% -306px;
+	border-right-width: 0 !important;
+	border-left-width: 1px !important;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-current li.bb-menu-sub a {
+	background-image: url('images/menu-dark-rtl.gif');
+	background-position: 100% -20px !important;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu.bb-menu-current li.bb-menu-sub a {
+	background-image: url('images/menu-dark-rtl.gif');
+	background-position: 100% -20px !important;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-current li.bb-menu-sub.bb-menu-sub-current a {
+	background-position: 100% 0 !important;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu.bb-menu-current li.bb-menu-sub.bb-menu-sub-current a {
+	background-position: 100% 0 !important;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-open li.bb-menu-sub a {
+	background-position: 100% -306px;
+}
+
+
+
+/* Dashboard */
+
+div.dashboard div.versions p.theme a.button {
+	float: left;
+}
+
+
+
+/* Search forms */
+
+form.search-form fieldset {
+	float: right;
+}
+
+form.search-form fieldset div {
+	float: right;
+	margin-right: 0;
+	margin-left: 5px;
+}
+
+
+
+/* Table nav */
+
+div.tablenav {
+	float: left;
+}
+
+span.displaying-num {
+	text-align: left;
+}
+
+span.displaying-pages {
+	float: left;
+}
+
+span.displaying-pages span,
+span.displaying-pages a {
+	float: right;
+}
+
+
+
+/* Tabled info */
+
+table#plugins-list.widefat tr.autoload td.plugin-name {
+	background-position: 0 0;
+	padding-right: 7px;
+	padding-left: 20px;
+}
+
+
+
+/* Forums */
+
+ul#forum-list li ul li {
+	border-left-width: 0;
+	border-right: 1px dashed rgb(223, 223, 223);
+}
+
+ul#forum-list li ul.list-block {
+	padding: 0 30px 0 0;
+}
+
+ul#forum-list li img.sort-handle {
+	float: right;
+	margin: 0 -4px 0 3px;
+}
+
+#dragHelper img.sort-handle {
+	float: right;
+	margin: 0 0 0 3px;
+}
+
+#dragHelper div.row-description {
+	margin: 0 4px 0 0;
+}
+
+
+
+/* Themes */
+
+table.theme-list td {
+	border-left: 1px solid rgb(221, 221, 221);
+	border-right-width: 0;
+}
+
+table.theme-list td.position-3 {
+	border-left: none;
+}
+
+table.theme-list-active td div.screen-shot {
+	float: right;
+	margin-right: 0;
+	margin-left: 15px;
+}
+
+
+
+/* Options */
+
+form.settings div {
+	margin-right: 0;
+	margin-left: 10px;
+}
+
+form.settings div label,
+form.settings div div.label {
+	float: right;
+}
+
+form.settings div.disabled label,
+form.settings div.disabled div.label {
+	background-position: 0 0;
+	padding-right: 0;
+	padding-left: 20px;
+}
+
+form.settings div div.inputs {
+	margin: 0 210px 0 0;
+}
+
+form.settings div.table {
+	margin: 0 220px 0 0;
+}
+
+form.settings div p {
+	margin: 0 3em 0 0;
+	border-left-width: 0;
+	border-right: 1px solid rgb(223, 223, 223);
+}
+
+form.settings a.cancel {
+	float: right;
+	margin-right: 0;
+	margin-left: 6px;
+}
+
+
+
+/* Footer */
+
+p#bbShowOff {
+	margin-right: 0;
+	margin-left: 8px;
+	float: left;
+	font-family: "Times New Roman", Tahoma;
+}
+
+div#bbFoot {
+	font-family: "Times New Roman", Tahoma;
+}
+
+p#bbThanks {
+	float: right;
+}
+
+p#bbVersion {
+	text-align: left;
+}
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/style.css b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/style.css
new file mode 100644
index 0000000000000000000000000000000000000000..4fc7e27f2c9473982b810e5529b8a34e9177e7af
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/style.css
@@ -0,0 +1,1854 @@
+/*
+Start with some basic resets
+*/
+
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.7.0
+*/
+html{color:#000;background:#FFF;}
+body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td{margin:0;padding:0;}
+table{border-collapse:collapse;border-spacing:0;}
+fieldset,img{border:0;}
+address,caption,cite,code,dfn,em,strong,th,var,optgroup{font-style:inherit;font-weight:inherit;}
+del,ins{text-decoration:none;}
+li{list-style:none;}
+caption,th{text-align:left;}
+h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}
+q:before,q:after{content:'';}
+abbr,acronym{border:0;font-variant:normal;}
+sup{vertical-align:baseline;}
+sub{vertical-align:baseline;}
+legend{color:#000;}
+input,button,textarea,select,optgroup,option{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;}
+input,button,textarea,select{*font-size:100%;}
+body{font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}
+select,input,button,textarea,button{font:99% arial,helvetica,clean,sans-serif;}
+table{font-size:inherit;font:100%;}
+pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}
+
+
+html {
+	height: 100%;
+	background-color: rgb(249, 249, 249);
+}
+
+body {
+	height: 100%;
+	min-width: 785px;
+	color: rgb(51, 51, 51);
+	line-height: 1.4em;
+	font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
+	font-size: 0.8em;
+}
+
+a {
+	outline: none;
+}
+
+div#bbWrap {
+	height: auto;
+	min-height: 100%;
+	width: 100%;
+}
+
+div#bbContent {
+	height: 100%;
+	padding-bottom: 45px;
+}
+
+
+/* Header */
+
+div#bbHead {
+	position: relative;
+	background-color: rgb(70, 70, 70);
+}
+
+div#bbHead h1 {
+	padding: 10px 0 5px 39px;
+	margin-left: 16px;
+	min-height: 31px;
+	background: transparent url('images/admin-header-logo.gif') no-repeat 0 8px;
+	font: normal normal normal 22px/normal Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;
+	color: white;
+}
+
+div#bbHead h1 a {
+	text-decoration: none;
+}
+
+div#bbHead h1 a span {
+	color: rgb(255, 255, 255);
+}
+
+div#bbHead h1 a:hover span {
+	text-decoration: underline;
+}
+
+div#bbHead h1 a em {
+	background: rgb(88, 88, 88) url('images/visit-site-button-grad.gif') repeat-x 0 0;
+	color: rgb(170, 170, 170);
+	text-shadow: rgb(63, 63, 63) 0px -1px 0px;
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	cursor: pointer;
+	display: inline-block;
+	font-size: 0.5em;
+	font-style: normal;
+	line-height: 17px;
+	margin-left: 5px;
+	padding: 0px 6px;
+	vertical-align: middle;
+}
+
+div#bbHead h1 a:hover em {
+	color: rgb(255, 255, 255);
+}
+
+div#bbHead h1 a:active em {
+	background-position: 0 -27px;
+}
+
+div#bbUserInfo {
+	position: absolute;
+	top: 14px;
+	right: 15px;
+	font-size: 0.95em;
+	color: rgb(153, 153, 153);
+}
+
+div#bbUserInfo a {
+	color: rgb(204, 204, 204);
+	text-decoration: none;
+}
+
+div#bbUserInfo a:hover {
+	color: rgb(255, 255, 255);
+	text-decoration: underline;
+}
+
+
+
+
+/* Body */
+
+div#bbBody {
+	margin-left: 180px;
+	padding-right: 15px;
+}
+
+body.bb-menu-folded div#bbBody {
+	margin-left: 65px;
+}
+
+h2 {
+	display: block;
+	color: rgb(70, 70, 70);
+	font: italic normal normal 1.9em/1.45em Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;
+	padding: 14px 15px 3px 0;
+	text-shadow: rgb(255, 255, 255) 0px 1px 0px;
+	background: transparent none no-repeat 0 0;
+	margin-left: -5px;
+}
+
+h2 span.subtitle {
+	font-size: 0.75em;
+	padding-left: 25px;
+}
+
+body.bb-admin-dashboard h2 {
+	padding-left: 47px;
+	background-image: url('images/icons32.png');
+	background-position: 0 -172px;
+}
+
+body.bb-admin-forums h2 {
+	padding-left: 47px;
+	background-image: url('images/icons32.png');
+	background-position: 0 -981px;
+}
+
+body.bb-admin-topics h2 {
+	padding-left: 47px;
+	background-image: url('images/icons32.png');
+	background-position: 0 -1071px;
+}
+
+body.bb-admin-posts h2 {
+	padding-left: 47px;
+	background-image: url('images/icons32.png');
+	background-position: 0 -1161px;
+}
+
+body.bb-admin-appearance h2 {
+	padding-left: 47px;
+	background-image: url('images/icons32.png');
+	background-position: 0 8px;
+}
+
+body.bb-admin-plugins h2 {
+	padding-left: 47px;
+	background-image: url('images/icons32.png');
+	background-position: 0 -532px;
+}
+
+body.bb-admin-users h2 {
+	padding-left: 47px;
+	background-image: url('images/icons32.png');
+	background-position: 0 -891px;
+}
+
+body.bb-admin-tools h2 {
+	padding-left: 47px;
+	background-image: url('images/icons32.png');
+	background-position: 0 -621px;
+}
+
+body.bb-admin-settings h2 {
+	padding-left: 47px;
+	background-image: url('images/icons32.png');
+	background-position: 0 -712px;
+}
+
+
+
+
+
+/* Menu */
+ul#bbAdminMenu * {
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-khtml-user-select: none;
+	user-select: none;
+}
+
+ul#bbAdminMenu {
+	float: left;
+	margin: 15px 5px 15px -165px;
+	position: relative;
+	width: 145px;
+}
+
+body.bb-menu-folded ul#bbAdminMenu {
+	margin-left: -50px;
+	width: auto;
+}
+
+ul#bbAdminMenu li.bb-menu {
+	
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu {
+	position: relative;
+}
+
+ul#bbAdminMenu li.bb-menu a {
+	display: block;
+	color: rgb(0, 102, 0);
+	background: rgb(241, 241, 241) url('images/menu-bits.gif') repeat-x 0 -379px;
+	border: 1px solid rgb(227, 227, 227);
+	width: 133px;
+	padding: 5px;
+	font: normal normal normal 1em/1.4em Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;
+	text-decoration: none;
+	border-bottom-width: 0;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu a {
+	height: 17px;
+	width: 17px;
+	background-image: none;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu a span {
+	display: none;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-current a {
+	background-position: 0 0;
+	border-color: rgb(109, 109, 109);
+	color: rgb(255, 255, 255);
+	text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0px;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu.bb-menu-current a {
+	background-color: rgb(230, 230, 230);
+	background-image: none;
+	border-color: rgb(227, 227, 227);
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-current a:hover {
+	border-color: rgb(181, 181, 181);
+	color: rgb(255, 255, 255);
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-first a {
+	-moz-border-radius-topleft: 6px;
+	-moz-border-radius-topright: 6px;
+	-khtml-border-top-left-radius: 6px;
+	-khtml-border-top-right-radius: 6px;
+	-webkit-border-top-left-radius: 6px;
+	-webkit-border-top-right-radius: 6px;
+	border-top-left-radius: 6px;
+	border-top-right-radius: 6px;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-last a {
+	-moz-border-radius-bottomleft: 6px;
+	-moz-border-radius-bottomright: 6px;
+	-khtml-border-bottom-left-radius: 6px;
+	-khtml-border-bottom-right-radius: 6px;
+	-webkit-border-bottom-left-radius: 6px;
+	-webkit-border-bottom-right-radius: 6px;
+	border-bottom-left-radius: 6px;
+	border-bottom-right-radius: 6px;
+	border-bottom-width: 1px;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-open.bb-menu-has-submenu a,
+ul#bbAdminMenu li.bb-menu.bb-menu-open a {
+	-moz-border-radius-bottomleft: 0;
+	-moz-border-radius-bottomright: 0;
+	-khtml-border-bottom-left-radius: 0;
+	-khtml-border-bottom-right-radius: 0;
+	-webkit-border-bottom-left-radius: 0;
+	-webkit-border-bottom-right-radius: 0;
+	border-bottom-left-radius: 0;
+	border-bottom-right-radius: 0;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu.bb-menu-last a {
+	-moz-border-radius-bottomleft: 6px;
+	-moz-border-radius-bottomright: 6px;
+	-khtml-border-bottom-left-radius: 6px;
+	-khtml-border-bottom-right-radius: 6px;
+	-webkit-border-bottom-left-radius: 6px;
+	-webkit-border-bottom-right-radius: 6px;
+	border-bottom-left-radius: 6px;
+	border-bottom-right-radius: 6px;
+	border-bottom-width: 1px;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-open a {
+	border-bottom-width: 0;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-current.bb-menu-has-submenu a:hover {
+	border-color: rgb(109, 109, 109);
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu.bb-menu-current.bb-menu-has-submenu a:hover {
+	border-color: rgb(227, 227, 227);
+}
+
+ul#bbAdminMenu li.bb-menu div.bb-menu-toggle {
+	float: right;
+	height: 27px;
+	width: 24px;
+	display: none;
+	background-image: url('images/menu-bits.gif');
+	background-repeat: no-repeat;
+	background-position: 0 -110px;
+	margin-top: -27px;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-last div.bb-menu-toggle {
+	margin-top: -28px;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-last.bb-menu-open div.bb-menu-toggle {
+	margin-top: -27px;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-has-submenu:hover div.bb-menu-toggle,
+ul#bbAdminMenu li.bb-menu.bb-menu-has-submenu.bb-menu-open div.bb-menu-toggle {
+	display: block;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu.bb-menu-has-submenu:hover div.bb-menu-toggle,
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu.bb-menu-has-submenu.bb-menu-open div.bb-menu-toggle {
+	display: none;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-has-submenu.bb-menu-current div.bb-menu-toggle {
+	background-position: 0 -208px;
+}
+
+ul#bbAdminMenu li.bb-menu a:hover,
+ul#bbAdminMenu li.bb-menu a:active,
+ul#bbAdminMenu li.bb-menu a:focus {
+	color: rgb(213, 78, 33);
+}
+
+ul#bbAdminMenu li.bb-menu a div.bb-menu-icon {
+	height: 22px;
+	width: 22px;
+	float: left;
+	background: transparent url('images/menu.png') no-repeat -337px -39px;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li.bb-menu a:hover div.bb-menu-icon {
+	background-position: -337px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-dashboard a div.bb-menu-icon {
+	background-position: -67px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-dashboard.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-dashboard a:hover div.bb-menu-icon {
+	background-position: -67px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-forums a div.bb-menu-icon {
+	background-position: -367px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-forums.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-forums a:hover div.bb-menu-icon {
+	background-position: -367px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-topics a div.bb-menu-icon {
+	background-position: -397px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-topics.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-topics a:hover div.bb-menu-icon {
+	background-position: -397px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-posts a div.bb-menu-icon {
+	background-position: -427px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-posts.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-posts a:hover div.bb-menu-icon {
+	background-position: -427px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-appearance a div.bb-menu-icon {
+	background-position: -6px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-appearance.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-appearance a:hover div.bb-menu-icon {
+	background-position: -6px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-plugins a div.bb-menu-icon {
+	background-position: -186px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-plugins.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-plugins a:hover div.bb-menu-icon {
+	background-position: -186px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-users a div.bb-menu-icon {
+	background-position: -308px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-users.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-users a:hover div.bb-menu-icon {
+	background-position: -308px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-tools a div.bb-menu-icon {
+	background-position: -217px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-tools.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-tools a:hover div.bb-menu-icon {
+	background-position: -217px -7px;
+}
+
+ul#bbAdminMenu li#bb-menu-settings a div.bb-menu-icon {
+	background-position: -246px -39px;
+}
+
+ul#bbAdminMenu li#bb-menu-settings.bb-menu-current a div.bb-menu-icon,
+ul#bbAdminMenu li#bb-menu-settings a:hover div.bb-menu-icon {
+	background-position: -246px -7px;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-separator {
+	
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-separator a {
+	background: transparent url('images/menu-arrows.gif') no-repeat 0 5px;
+	border-width: 0;
+	padding: 0;
+	height: 21px;
+	cursor: w-resize;
+	width: 145px;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu.bb-menu-separator a {
+	background: transparent url('images/menu-arrows.gif') no-repeat -171px -34px;
+	height: 21px;
+	cursor: e-resize;
+	width: 29px;
+}
+
+ul#bbAdminMenu li.bb-menu div.bb-menu-sub-wrap {
+	display: none;
+	border: 1px solid rgb(227, 227, 227);
+	border-bottom-width: 0;
+	border-left-width: 0;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu div.bb-menu-sub-wrap {
+	display: none;
+	position: absolute;
+	left: 36px;
+	top: 0;
+	width: 145px;
+	z-index: 1000;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-current div.bb-menu-sub-wrap {
+	border-color: rgb(170, 170, 170);
+	border-bottom-width: 1px;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu div.bb-menu-sub-wrap {
+	border-width: 0;
+	border-color: rgb(227, 227, 227);
+	border-style: solid;
+	border-bottom-width: 1px;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu.bb-menu-current div.bb-menu-sub-wrap {
+	border-color: rgb(170, 170, 170);
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-open div.bb-menu-sub-wrap {
+	display: block;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-last div.bb-menu-sub-wrap {
+	border-bottom-width: 1px;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu div.bb-menu-sub-wrap.bb-menu-sub-open {
+	display: block;
+	border-bottom-width: 1px;
+}
+
+ul#bbAdminMenu li.bb-menu div.bb-menu-sub-wrap span {
+	display: none;
+	font: normal normal normal 1em/1.45em Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;
+	background-color: rgb(241, 241, 241);
+	border: 1px solid rgb(227, 227, 227);
+	-moz-border-radius-topleft: 6px;
+	-moz-border-radius-topright: 6px;
+	-khtml-border-top-left-radius: 6px;
+	-khtml-border-top-right-radius: 6px;
+	-webkit-border-top-left-radius: 6px;
+	-webkit-border-top-right-radius: 6px;
+	border-top-left-radius: 6px;
+	border-top-right-radius: 6px;
+	padding: 5px 5px 4px 10px;
+	cursor: default;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-current div.bb-menu-sub-wrap span {
+	background-color: rgb(234, 234, 234);
+	border-color: rgb(170, 170, 170);
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu div.bb-menu-sub-wrap span {
+	display: block;
+}
+
+ul#bbAdminMenu li.bb-menu li.bb-menu-sub a {
+	width: 127px !important;
+	-moz-border-radius: 0 !important;
+	-khtml-border-radius: 0 !important;
+	-webkit-border-radius: 0 !important;
+	border-radius: 0 !important;
+	border-width: 0 !important;
+	font: normal normal normal 0.85em/1.7em 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
+	padding: 1px 5px 3px 12px;
+	color: rgb(0, 102, 0);
+	text-shadow: none;
+	background: rgb(255, 255, 255) url('images/menu-bits.gif') no-repeat 0 -306px;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu li.bb-menu-sub a {
+	height: auto;
+	background: rgb(255, 255, 255) url('images/menu-bits.gif') no-repeat 0 -306px;
+	border-right-width: 1px !important;
+}
+
+ul#bbAdminMenu li.bb-menu li.bb-menu-sub a:hover {
+	background-color: rgb(222, 236, 225) !important;
+	color: rgb(51, 51, 51);
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-current li.bb-menu-sub a {
+	background-image: url('images/menu-dark.gif');
+	background-position: 0 -20px !important;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu.bb-menu-current li.bb-menu-sub a {
+	background-image: url('images/menu-dark.gif');
+	background-position: 0 -20px !important;
+	border-color: rgb(170, 170, 170) !important;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-current li.bb-menu-sub.bb-menu-sub-current a {
+	color: rgb(51, 51, 51);
+	font-weight: bold;
+	background-color: rgb(245, 245, 245) !important;
+	background-position: 0 0 !important;
+}
+
+body.bb-menu-folded ul#bbAdminMenu li.bb-menu.bb-menu-current li.bb-menu-sub.bb-menu-sub-current a {
+	background-position: 0 0 !important;
+}
+
+ul#bbAdminMenu li.bb-menu.bb-menu-open li.bb-menu-sub a {
+	background-position: 0 -306px;
+}
+
+div.wrap {
+	float: left;
+	width: 100%;
+}
+
+div#message {
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	border-style: solid;
+	border-width: 1px;
+	margin: 5px 0 2px 0;
+	padding: 0 0.65em;
+	font-size: 0.9em;
+}
+
+div#message.updated {
+	background-color: rgb(255, 251, 204);
+	border-color: rgb(230, 219, 85);
+}
+
+div#message.error {
+	background-color: rgb(255, 235, 232);
+	border-color: rgb(204, 0, 0);
+}
+
+div#message p {
+	line-height: 1;
+	margin: 0.6em 0;
+	padding: 2px;
+}
+
+div#message p strong {
+	font-weight: bold;
+}
+
+div#message a {
+	color: rgb(0, 102, 0);
+	text-decoration: none;
+}
+
+div#message a:hover {
+	color: rgb(213, 78, 33);
+}
+
+div.plugin-error {
+	background-color: rgb(255, 235, 232);
+	border-color: rgb(204, 0, 0);
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	border-style: solid;
+	border-width: 1px;
+	margin: 5px 0 2px 0;
+	padding: 0;
+	height: 160px;
+}
+
+div.plugin-error iframe {
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	display: block;
+	width: 100%;
+	height: 100%;
+	margin: 0;
+	padding: 0;
+	border-width: 0;
+}
+
+
+/* Dashboard */
+
+div.dashboard {
+	background-color: rgb(255, 255, 255);
+	border: 1px solid rgb(223, 223, 223);
+	-moz-border-radius: 6px;
+	-khtml-border-radius: 6px;
+	-webkit-border-radius: 6px;
+	border-radius: 6px;
+	margin: 10px 5px 20px 5px;
+}
+
+div.dashboard a {
+	color: rgb(0, 102, 0);
+}
+
+div.dashboard a:hover {
+	color: rgb(213, 78, 33);
+}
+
+div.dashboard h3 {
+	-moz-border-radius-topleft: 6px;
+	-moz-border-radius-topright: 6px;
+	-khtml-border-top-left-radius: 6px;
+	-khtml-border-top-right-radius: 6px;
+	-webkit-border-top-left-radius: 6px;
+	-webkit-border-top-right-radius: 6px;
+	border-top-left-radius: 6px;
+	border-top-right-radius: 6px;
+	background: url('images/gray-grad.png') repeat-x rgb(223, 223, 223);
+	text-shadow: rgb(255, 255, 255) 0px 1px 0px;
+	color: rgb(70, 70, 70);
+	font-size: 0.9em;
+	font-weight: bold;
+	line-height: 1;
+	margin: 0px;
+	padding: 7px 9px;
+}
+
+div.dashboard div.table {
+	border-bottom: 1px solid rgb(236, 236, 236);
+	background: rgb(249, 249, 249);
+}
+
+div.dashboard div.table table {
+	width: 100%;
+}
+
+div.dashboard div.table thead th {
+	color: rgb(119, 119, 119);
+	font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;
+	font-size: 1em;
+	font-style: italic;
+	padding: 3px 8px 4px;
+	background: rgb(255, 255, 255);
+	width: 50%;
+}
+
+div.dashboard div.table tbody td {
+	border-top: 1px solid rgb(236, 236, 236);
+	padding: 4px 16px;
+	white-space: nowrap;
+	font-size: 0.9em;
+	color: rgb(70, 70, 70);
+}
+
+div.dashboard div.table tbody td span {
+	font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;
+	font-size: 1.6em;
+	padding-right: 6px;
+}
+
+div.dashboard p {
+	color: rgb(51, 51, 51);
+	font-size: 0.85em;
+	margin: 8px;
+}
+
+div.dashboard div.versions p span.b {
+	font-weight: bold;
+}
+
+div.dashboard div.versions p a {
+	text-decoration: none;
+	font-weight: bold;
+}
+
+div.dashboard div.versions p.theme a.button {
+	display: block;
+	float: right;
+	font-weight: normal;
+	-moz-border-radius: 10px;
+	-khtml-border-radius: 10px;
+	-webkit-border-radius: 10px;
+	border-radius: 10px;
+	padding: 4px 10px;
+	background: url('images/white-grad.png') repeat-x scroll rgb(242, 242, 242);
+	border: 1px solid rgb(187, 187, 187);
+	color: rgb(70, 70, 70);
+	cursor: pointer;
+	font-size: 1em;
+	line-height: 1.2em;
+}
+
+div.dashboard div.versions p.theme a.button:hover {
+	border-color: rgb(102, 102, 102);
+	color: rgb(0, 0, 0);
+}
+
+div.dashboard div.versions p.theme a.button:active {
+	background: url('images/white-grad-active.png') repeat-x scroll rgb(238, 238, 238);
+}
+
+div.dashboard ul li {
+	color: rgb(51, 51, 51);
+	font-size: 0.85em;
+	margin: 8px;
+}
+
+div.dashboard ul li a {
+	text-decoration: none;
+	font-weight: bold;
+}
+
+
+
+/* Search forms */
+
+form.search-form fieldset {
+	margin: 10px 0 0 0;
+	float: left;
+}
+
+form.search-form fieldset div {
+	float: left;
+	margin-right: 5px;
+	margin-top: 3px;
+}
+
+form.search-form fieldset div div {
+	float: none;
+	margin: 0;
+}
+
+form.search-form fieldset div label {
+	display: block;
+	line-height: 1;
+	padding: 0 0 3px 0;
+	font-size: 0.8em;
+	color: rgb(70, 70, 70);
+}
+
+form.search-form fieldset div div input.text-input {
+	width: 100px;
+	padding: 3px;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+	border: 1px solid rgb(223, 223, 223);
+	font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
+	font-size: 0.85em;
+	line-height: 1.3em;
+}
+
+form.search-form fieldset div div input.checkbox-input {
+	margin: 4px;
+}
+
+form.search-form fieldset div div select {
+	height: 2.1em;
+	margin: 0;
+	padding: 3px;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+	border: 1px solid rgb(223, 223, 223);
+	font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
+	font-size: 0.85em;
+}
+
+form.search-form fieldset div div option {
+	padding: 3px;
+	font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
+	font-size: 0.9em;
+}
+
+form.search-form div.submit label {
+	width: 0;
+	overflow: hidden;
+}
+
+form.search-form div.submit input.button {
+	font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
+	-moz-border-radius: 10px;
+	-khtml-border-radius: 10px;
+	-webkit-border-radius: 10px;
+	border-radius: 10px;
+	padding: 4px 9px 5px;
+	background: url('images/white-grad.png') repeat-x scroll rgb(242, 242, 242);
+	border: 1px solid rgb(187, 187, 187);
+	color: rgb(70, 70, 70);
+	cursor: pointer;
+	line-height: 1.1em;
+	font-size: 0.85em;
+}
+
+form.search-form div.submit input.button:hover {
+	border-color: rgb(102, 102, 102);
+	color: rgb(0, 0, 0);
+}
+
+form.search-form div.submit input.button:active {
+	background: url('images/white-grad-active.png') repeat-x scroll rgb(238, 238, 238);
+}
+
+
+
+/* Table nav */
+
+div.tablenav {
+	float: right;
+}
+
+div.tablenav a {
+	color: rgb(0, 102, 0);
+}
+
+div.tablenav a:hover {
+	color: rgb(213, 78, 33);
+}
+
+div.tablenav-pages {
+	margin: 13px 0 0 0;
+}
+
+div.tablenav.bottom div.tablenav-pages {
+	margin: 0 0 16px 0;
+}
+
+span.displaying-num {
+	display: block;
+	text-align: right;
+	line-height: 1;
+	font-size: 0.8em;
+	color: rgb(70, 70, 70);
+	padding: 0 0 3px 0;
+}
+
+span.displaying-pages {
+	display: block;
+	float: right;
+	cursor: default;
+	color: rgb(85, 85, 85);
+}
+
+span.displaying-pages span,
+span.displaying-pages a {
+	display: block;
+	float: left;
+	-moz-border-radius: 5px;
+	-khtml-border-radius: 5px;
+	-webkit-border-radius: 5px;
+	border-radius: 5px;
+	border: 1px solid rgb(211, 211, 211);
+	padding: 3px 7px;
+	text-decoration: none;
+	background-color: rgb(223, 223, 223);
+	font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
+	font-size: 0.85em;
+	line-height: 1.3em;
+	margin-left: 3px;
+}
+
+span.displaying-pages span.dots {
+	border-width: 0;
+	background-color: transparent;
+	padding: 4px 0 0 0;
+	font-weight: bold;
+}
+
+span.displaying-pages a {
+	font-weight: bold;
+	background: url('images/menu-bits.gif') repeat-x 0 -379px rgb(238, 238, 238);
+	border-color: rgb(227, 227, 227);
+}
+
+span.displaying-pages a:hover {
+	border-color: rgb(213, 78, 33);
+}
+
+span.displaying-pages a:active {
+	color: rgb(255, 255, 255);
+}
+
+div.table-filter {
+	color: rgb(102, 102, 102);
+	margin: 8px 0px 5px;
+	font-size: 0.85em;
+}
+
+div.table-filter a {
+	color: rgb(0, 102, 0);
+	text-decoration: none;
+}
+
+div.table-filter a.current {
+	color: rgb(0, 0, 0);
+	font-weight: bold;
+}
+
+div.table-filter a:hover {
+	color: rgb(213, 78, 33);
+}
+
+div.table-filter a span.count {
+	color: rgb(153, 153, 153);
+	font-weight: normal;
+}
+
+
+
+
+/* Tabled info */
+
+p.no-results {
+	margin: 10px 0;
+	font-size: 0.85em;
+}
+
+table.widefat {
+	width: 100%;
+	border: 1px solid rgb(223, 223, 223);
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+	border-collapse: separate;
+	margin: 10px 0;
+}
+
+table.widefat a {
+	color: rgb(0, 102, 0);
+	text-decoration: none;
+}
+
+table.widefat a:hover {
+	color: rgb(213, 78, 33);
+}
+
+table.widefat tr td {
+	width: 18%;
+	vertical-align: top;
+	padding: 3px 7px;
+	font-size: 0.85em;
+	border-bottom: 1px solid rgb(223, 223, 223);
+}
+
+table.widefat tr.alt td {
+	background-color: rgb(255, 255, 255);
+}
+
+table.widefat tr.deleted td {
+	background-color: rgb(245, 224, 224);
+}
+
+table.widefat tr.deleted.alt td {
+	background-color: rgb(248, 233, 233);
+}
+
+table.widefat tr.spam td {
+	background-color: rgb(238, 218, 204);
+}
+
+table.widefat tr.spam.alt td {
+	background-color: rgb(243, 228, 218);
+}
+
+table#plugins-list.widefat tr.inactive td {
+	background-color: rgb(238, 238, 238);
+}
+
+table#plugins-list.widefat tr.active td {
+	background-color: rgb(255, 255, 255);
+}
+
+table#plugins-list.widefat tr.autoload td {
+	background-color: rgb(249, 249, 249);
+}
+
+table#plugins-list.widefat tr.autoload td.plugin-name {
+	background-image: url('images/input-lock.png');
+	background-repeat: no-repeat;
+	background-position: 100% 0;
+	padding-right: 20px;
+}
+
+table.widefat tr th {
+	background: url('images/gray-grad.png') repeat-x rgb(223, 223, 223);
+	text-shadow: rgb(255, 255, 255) 0px 1px 0px;
+	color: rgb(51, 51, 51);
+	font-weight: bold;
+	vertical-align: top;
+	padding: 7px 7px 8px;
+	font-size: 0.85em;
+	line-height: 1.3em;
+	border-bottom: 1px solid rgb(223, 223, 223);
+}
+
+table.widefat tfoot tr th {
+	border-bottom-width: 0;
+}
+
+table#posts-list.widefat tr td.post {
+	width: 46%;
+	font-size: 0.9em;
+}
+
+table#topics-list.widefat tr td.topic {
+	width: 28%;
+	font-size: 0.9em;
+}
+
+table#plugins-list.widefat tr td.plugin-name {
+	width: 25%;
+	font-size: 0.9em;
+}
+
+table#plugins-list.widefat tr td.plugin-description {
+	width: 75%;
+}
+
+table.widefat tr td.author img.avatar {
+	vertical-align: top;
+	border: 1px solid rgb(223, 223, 223);
+}
+
+table.widefat tr td.post p {
+	margin-bottom: 0.4em;
+}
+
+table.widefat tr td.plugin-description p {
+	margin-bottom: 0.8em;
+}
+
+table.widefat tr td.plugin-description p.meta {
+	margin-bottom: 0;
+}
+
+table.widefat tr td.topic span.row-title,
+table.widefat tr td.user span.row-title {
+	margin-bottom: 0.4em;
+	display: block;
+	font-weight: bold;
+}
+
+table.widefat tr td.user img.avatar {
+	display: block;
+	float: left;
+	margin: 3px 8px 3px -1px;
+	border: 1px solid rgb(223, 223, 223);
+}
+
+table.widefat tr td.plugin-name span.row-title {
+	margin-bottom: 0.8em;
+	display: block;
+	font-weight: bold;
+}
+
+table.widefat tr td.post div,
+table.widefat tr td.topic div,
+table.widefat tr td.plugin-name div {
+	font-size: 0.85em;
+}
+
+table.widefat tr span.row-actions {
+	display: none;
+}
+
+table#plugins-list.widefat tr span.row-actions {
+	display: inline;
+}
+
+table.widefat tr:hover span.row-actions {
+	display: inline;
+}
+
+table.widefat tr span.row-actions span.note {
+	color: rgb(102, 102, 102);
+}
+
+table.widefat tr a.post-undelete-link {
+	display: none;
+}
+
+table.widefat tr.deleted a.post-undelete-link {
+	display: inline;
+}
+
+table.widefat tr.deleted a.post-delete-link {
+	display: none;
+}
+
+table.widefat tr td em  {
+	font-style: italic;
+}
+
+table.widefat tr td strong  {
+	font-weight: bold;
+}
+
+table.widefat tr td code,
+table.widefat tr td kbd {
+	font-family: Consolas, Monaco, Courier, monospace;
+	font-size: 1.2em;
+	background: rgb(234, 234, 234);
+	margin: 0px 1px;
+	padding: 1px 3px;
+	color: rgb(51, 51, 51);
+}
+
+
+
+/* Forums */
+
+body.sorting {
+	overflow-x: hidden;
+}
+
+ul#forum-list {
+	xwidth: 100%;
+	border: 1px solid rgb(223, 223, 223);
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+	margin: 10px 0;
+}
+
+ul#forum-list a {
+	color: rgb(0, 102, 0);
+	text-decoration: none;
+}
+
+ul#forum-list a:hover {
+	color: rgb(213, 78, 33);
+}
+
+ul#forum-list li {
+	border-top: 1px solid rgb(223, 223, 223);
+	background-color: rgb(249, 249, 249);
+}
+
+ul#forum-list li.alt {
+	background-color: rgb(255, 255, 255);
+}
+
+ul#forum-list li ul li {
+	border-left: 1px dashed rgb(223, 223, 223);
+}
+
+ul#forum-list li ul.list-block {
+	padding: 0 0 0 30px;
+}
+
+ul#forum-list li.list-block {
+	padding: 3px 0 0 0;
+}
+
+ul#forum-list li div.list-block {
+	padding: 0 7px 3px 7px;
+}
+
+ul#forum-list li.thead {
+	background: url('images/gray-grad.png') repeat-x rgb(223, 223, 223);
+	text-shadow: rgb(255, 255, 255) 0px 1px 0px;
+	color: rgb(51, 51, 51);
+	font-weight: bold;
+	vertical-align: top;
+	padding: 7px 7px 8px;
+	font-size: 0.85em;
+	line-height: 1.3em;
+	border-top-width: 0;
+}
+
+ul#forum-list li img.sort-handle {
+	float: left;
+	margin: 0 3px 0 -4px;
+	cursor: move;
+}
+
+ul#forum-list li div.row-title {
+	font-size: 0.9em;
+	font-weight: bold;
+}
+
+ul#forum-list li p.row-description {
+	font-size: 0.85em;
+}
+
+ul#forum-list li div.list-block div.row-actions {
+	font-size: 0.8em;
+	margin-top: 0.4em;
+}
+
+ul#forum-list li div.list-block div.row-actions span {
+	display: none;
+}
+
+ul#forum-list li div.list-block:hover div.row-actions span {
+	display: inline;
+}
+
+ul#forum-list.sorting li div.list-block div.row-actions span {
+	display: none;
+}
+
+ul#forum-list.sorting li div.list-block div.row-actions span {
+	display: none;
+}
+
+.helper {
+	background-color: rgb(200, 250, 200);
+	outline: 1px dashed #777;
+	width: 100% !important;
+	padding: 3px 0;
+}
+
+#dragHelper {
+	xwidth: auto !important;
+	padding: 3px;
+}
+
+#dragHelper img.sort-handle {
+	float: left;
+	margin: 0 3px 0 0;
+}
+
+#dragHelper div.row-description {
+	margin: 0 0 0 4px;
+}
+
+#dragHelper div.row-actions span {
+	display: none;
+}
+
+
+
+/* Themes */
+
+h3.themes {
+	display: block;
+	color: rgb(51, 51, 51);
+	font-size: 1.17em;
+	font-weight: bold;
+	padding: 0 0 1em 0;
+	margin-top: 10px;
+}
+
+table.theme-list-active,
+table.theme-list {
+	margin: 0 auto 40px;
+	width: 100%;
+	border-collapse: collapse;
+}
+
+table.theme-list {
+	margin-bottom: 20px;
+	width: 100%;
+	border-top: 1px solid rgb(221, 221, 221);
+	border-bottom: 1px solid rgb(221, 221, 221);
+	border-collapse: collapse;
+}
+
+table.theme-list td {
+	width: 240px;
+	padding: 20px;
+	border-bottom: 1px solid rgb(221, 221, 221);
+	border-right: 1px solid rgb(221, 221, 221);
+	vertical-align: top;
+}
+
+table.theme-list td.position-3 {
+	border-right: none;
+}
+
+table.theme-list td h3.themes,
+table.theme-list-active td h3.themes {
+	margin-top: 0;
+	font-size: 1em;
+}
+
+table.theme-list td div.screen-shot {
+	border: 1px solid rgb(204, 204, 204);
+	width: 240px;
+	height: 180px;
+	margin-bottom: 10px;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+}
+
+table.theme-list td div.screen-shot img {
+	width: 240px;
+	height: 180px;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+}
+
+table.theme-list-active td div.screen-shot {
+	border: 1px solid rgb(153, 153, 153);
+	width: 150px;
+	height: 112px;
+	float: left;
+	margin-right: 15px;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+}
+
+table.theme-list-active td div.screen-shot img {
+	width: 150px;
+	height: 112px;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+}
+
+table.theme-list td div.description p,
+table.theme-list-active td div.description p {
+	color: rgb(102, 102, 102);
+	font-style: italic;
+	margin: 0 0 1em 0;
+	font-size: 0.9em;
+}
+
+table.theme-list td div.description div.actions {
+	margin: 0 0 1em 0;
+	font-size: 1em;
+}
+
+table.theme-list td div.description p.location,
+table.theme-list-active td div.description p.location {
+	color: inherit;
+	font-style: normal;
+	margin: 0 0 0 0;
+}
+
+table.theme-list td a,
+table.theme-list-active td a {
+	color: rgb(0, 102, 0);
+}
+
+table.theme-list td a:hover,
+table.theme-list-active td a:hover {
+	color: rgb(213, 78, 33);
+}
+
+
+
+/* Options */
+
+form.settings fieldset {
+	margin-top: 10px;
+	margin-bottom: 20px;
+}
+
+form.settings legend,
+div.settings h3 {
+	display: block;
+	color: rgb(51, 51, 51);
+	font-size: 1.17em;
+	font-weight: bold;
+	padding: 0 0 1em 0;
+}
+
+div.settings {
+	margin-bottom: 20px;
+}
+
+hr.settings {
+	height: 1px;
+	background-color: rgb(221, 221, 221);
+	border-width: 0;
+	margin-bottom: 20px;
+}
+
+form.settings p,
+div.settings p {
+	float: none;
+	display: block;
+	color: rgb(51, 51, 51);
+	font-size: 0.9em;
+	margin: 0 0 1em 0;
+}
+
+form.settings ul,
+div.settings ul {
+	float: none;
+	display: block;
+	color: rgb(51, 51, 51);
+	font-size: 0.9em;
+	margin: 0 4em 1em 4em;
+}
+
+form.settings ul li,
+div.settings ul li {
+	list-style: disc outside none;
+}
+
+form.settings strong,
+div.settings strong {
+	font-weight: bold;
+}
+
+form.settings em,
+div.settings em {
+	font-style: italic;
+}
+
+form.settings code,
+form.settings kbd {
+	font-family: Consolas, Monaco, Courier, monospace;
+	font-size: 1.2em;
+	background: rgb(234, 234, 234);
+	margin: 0px 1px;
+	padding: 1px 3px;
+	color: rgb(51, 51, 51);
+}
+
+form.settings a {
+	color: rgb(0, 102, 0);
+}
+
+form.settings a:hover {
+	color: rgb(213, 78, 33);
+}
+
+form.settings div {
+	clear: both;
+	padding: 10px;
+	margin-right: 10px;
+}
+
+form.settings div label {
+	float: left;
+	display: block;
+	padding: 3px;
+	width: 200px;
+	color: rgb(34, 34, 34);
+	text-shadow: rgb(255, 255, 255) 0px 1px 0px;
+}
+
+form.settings div div.label {
+	float: left;
+	display: block;
+	padding: 3px;
+	width: 190px;
+	color: rgb(34, 34, 34);
+	text-shadow: rgb(255, 255, 255) 0px 1px 0px;
+}
+
+form.settings div.disabled label,
+form.settings div.disabled div.label {
+	background-image: url('images/input-lock.png');
+	background-repeat: no-repeat;
+	background-position: 100% 0;
+	padding-right: 20px;
+	width: 180px;
+}
+
+form.settings div.disabled div.label {
+	width: 170px;
+}
+
+form.settings div div.inputs {
+	clear: none;
+	padding: 0;
+	margin: 0 0 0 210px;
+}
+
+form.settings div div.inputs label {
+	float: none;
+	clear: none;
+	display: block;
+	padding: 0;
+	margin: 3px 0 6px 0;
+	width: auto;
+	color: rgb(51, 51, 51);
+	text-shadow: none;
+	font-size: 0.85em;
+}
+
+form.settings div.disabled div.inputs label {
+	background-image: none;
+}
+
+form.settings div div.inputs label.radios img {
+	margin: -2px 0 0 0;
+	vertical-align: middle;
+	border: 1px solid rgb(223, 223, 223);
+}
+
+form.settings input.text,
+form.settings textarea {
+	width: 300px;
+	padding: 3px;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+	border: 1px solid rgb(223, 223, 223);
+	font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
+	font-size: 1em;
+}
+
+form.settings div.disabled input.text,
+form.settings div.disabled textarea {
+	background-color: rgb(221, 221, 221);
+}
+
+form.settings div input.text.short {
+	width: 100px;
+}
+
+form.settings div input.text.code {
+	font-family: Consolas, Monaco, Courier, monospace;
+	font-size: 1.2em;
+}
+
+form.settings input.readonly,
+form.settings textarea.readonly {
+	background-color: rgb(221, 221, 221);
+}
+
+form.settings div.table {
+	margin: 0 0 0 220px;
+	padding: 3px;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+	border: 1px solid rgb(223, 223, 223);
+	background-color: rgb(221, 221, 221);
+	width: 300px;
+}
+
+form.settings div.table table {
+	width: 100%;
+	font-family: Consolas, Monaco, Courier, monospace;
+	font-size: 1.2em;
+	border-collapse: collapse;
+}
+
+form.settings div.table table th {
+	border-bottom: 1px dotted rgb(70, 70, 70);
+	padding: 6px;
+}
+
+form.settings div.table table td {
+	padding: 6px;
+}
+
+form.settings div span.after {
+	font-size: 0.85em;
+}
+
+form.settings div p {
+	color: rgb(102, 102, 102);
+	font-style: italic;
+	margin: 0 0 0 3em;
+	padding: 0.3em;
+	border-left: 1px solid rgb(223, 223, 223);
+}
+
+form.settings input.submit {
+	font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
+	-moz-border-radius: 11px;
+	-khtml-border-radius: 11px;
+	-webkit-border-radius: 11px;
+	border-radius: 11px;
+	border: 1px solid rgb(63, 163, 50);
+	cursor: pointer;
+	font-size: 11px;
+	line-height: 16px;
+	padding: 2px 8px;
+	background: url('images/button-grad.png') 0 0 rgb(33, 117, 155);
+	color: rgb(255, 255, 255);
+	font-weight: bold;
+	text-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0;
+}
+
+form.settings input.submit:hover {
+	border-color: rgb(0, 102, 0);
+}
+
+form.settings input.submit:active {
+	background-position: 0 30px;
+}
+
+form.settings a.cancel {
+	display: block;
+	float: left;
+	font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
+	-moz-border-radius: 11px;
+	-khtml-border-radius: 11px;
+	-webkit-border-radius: 11px;
+	border-radius: 11px;
+	border: 1px solid rgb(187, 187, 187);
+	cursor: pointer;
+	font-size: 11px;
+	line-height: 16px;
+	padding: 2px 8px;
+	background: url('images/white-grad.png') repeat-x scroll rgb(242, 242, 242);
+	color: rgb(70, 70, 70);
+	cursor: pointer;
+	font-weight: bold;
+	text-shadow: rgba(255, 255, 255, 0.7) 0 -1px 0;
+	margin-right: 6px;
+	text-decoration: none;
+}
+
+form.settings a.cancel:hover {
+	border-color: rgb(153, 51, 51);
+	color: rgb(204, 51, 51);
+}
+
+form.settings a.cancel:active {
+	background: url('images/white-grad-active.png') repeat-x scroll rgb(238, 238, 238);
+}
+
+form.settings div#option-mod-rewrite div.inputs label.radios span {
+	display: inline-block;
+	width: 7em;
+}
+
+form.settings div#option-mod-rewrite div.inputs label.radios code {
+	white-space: nowrap;
+}
+
+form.settings textarea#rewrite-rules {
+	width: 99%;
+}
+
+
+/* Footer */
+
+p#bbShowOff {
+	margin: 0 8px 8px 0;
+	padding: 6px 8px;
+	color: rgb(255, 255, 255);
+	background-color: rgb(170, 170, 170);
+	font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;
+	font-size: 0.9em;
+	font-style: italic;
+	-moz-border-radius: 6px;
+	-khtml-border-radius: 6px;
+	-webkit-border-radius: 6px;
+	border-radius: 6px;
+	float: right;
+}
+
+div#bbFoot {
+	background-color: rgb(70, 70, 70);
+	color: rgb(153, 153, 153);
+	margin-top: -45px;
+	clear: both;
+	position: relative;
+	width: 100%;
+	font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;
+	font-size: 0.9em;
+	font-style: italic;
+}
+
+div#bbFoot p {
+	line-height: 15px;
+	padding: 15px;
+}
+
+div#bbFoot p a {
+	color: rgb(204, 204, 204);
+	text-decoration: none;
+}
+
+p#bbThanks {
+	float: left;
+}
+
+p#bbVersion {
+	text-align: right;
+}
+
+div.clear {
+	clear: both !important;
+	height: 0;
+	line-height: 0;
+	font-size: 0;
+}
+
+
+
+
+
+
+
+
+/* Layout classes */
+/*
+.absleft {
+	position: absolute;
+	left: 0;
+}
+
+.absright {
+	position: absolute;
+	right: 0;
+}
+
+.abstop {
+	position: absolute;
+	top: 0;
+}
+
+.posrel {
+	position: relative;
+}
+
+.alignleft {
+	float: left;
+}
+
+.alignright {
+	float: right;
+}
+*/
+/*
+.alternate, .alt {
+	background: #f1f1f1;
+}
+*/
+/*
+.active {
+	background-color: rgb(200, 250, 200);
+}
+*/
+
+
+
+
+/* List Blocks */
+
+
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/tag-destroy.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/tag-destroy.php
new file mode 100644
index 0000000000000000000000000000000000000000..6a9b317065804424e234b321a20720d4992ebc7f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/tag-destroy.php
@@ -0,0 +1,22 @@
+<?php
+require('admin.php');
+
+if ( !bb_current_user_can('manage_tags') )
+	bb_die(__('You are not allowed to manage tags.'));
+
+$tag_id = (int) $_POST['id' ];
+
+bb_check_admin_referer( 'destroy-tag_' . $tag_id );
+
+$old_tag = bb_get_tag( $tag_id );
+if ( !$old_tag )
+	bb_die(__('Tag not found.'));
+
+if ( $destroyed = bb_destroy_tag( $tag_id ) ) {
+	printf(__("Rows deleted from tags table: %d <br />\n"), $destroyed['tags']);
+	printf(__("Rows deleted from tagged table: %d <br />\n"), $destroyed['tagged']);
+	printf(__('<a href="%s">Home</a>'), bb_get_uri());
+} else {
+   die(printf(__("Something odd happened when attempting to destroy that tag.<br />\n<a href=\"%s\">Try Again?</a>"), wp_get_referer()));
+}
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/tag-merge.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/tag-merge.php
new file mode 100644
index 0000000000000000000000000000000000000000..6f7680e46ebe4fe1d1bf730f12145f28639690dd
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/tag-merge.php
@@ -0,0 +1,26 @@
+<?php
+require('admin.php');
+
+if ( !bb_current_user_can('manage_tags') )
+	bb_die(__('You are not allowed to manage tags.'));
+
+$old_id = (int) $_POST['id' ];
+$tag = $_POST['tag'];
+
+bb_check_admin_referer( 'merge-tag_' . $old_id );
+
+if ( ! $tag = bb_get_tag( $tag ) )
+	bb_die(__('Tag specified not found.'));
+
+if ( ! bb_get_tag( $old_id ) )
+	bb_die(__('Tag to be merged not found.'));
+
+if ( $merged = bb_merge_tags( $old_id, $tag->tag_id ) ) {
+	printf(__("Number of topics from which the old tag was removed: %d <br />\n"),  $merged['old_count']);
+    printf(__("Number of topics to which the new tag was added: %d <br />\n"),$merged['diff_count']);
+	printf(__("Number of rows deleted from tags table:%d <br />\n"),$merged['destroyed']['tags']);
+	printf(__('<a href="%s">New Tag</a>'), bb_get_tag_link());
+} else {
+   die(printf(__("Something odd happened when attempting to merge those tags.<br />\n<a href=\"%s\">Try Again?</a>"), wp_get_referer()));
+}
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/tag-rename.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/tag-rename.php
new file mode 100644
index 0000000000000000000000000000000000000000..cf15cb2de644fa87733947019ae6aed383a1e1ae
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/tag-rename.php
@@ -0,0 +1,22 @@
+<?php
+require('admin.php');
+
+if ( !bb_current_user_can('manage_tags') )
+	bb_die(__('You are not allowed to manage tags.'));
+
+$tag_id = (int) $_POST['id' ];
+$tag    =       $_POST['tag'];
+
+bb_check_admin_referer( 'rename-tag_' . $tag_id );
+
+$old_tag = bb_get_tag( $tag_id );
+if ( !$old_tag )
+	bb_die(__('Tag not found.'));
+
+$tag = stripslashes( $tag );
+if ( $tag = bb_rename_tag( $tag_id, $tag ) )
+	wp_redirect( bb_get_tag_link() );
+else
+	die(printf(__('There already exists a tag by that name or the name is invalid. <a href="%s">Try Again</a>'), wp_get_referer()));
+exit;
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/themes.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/themes.php
new file mode 100644
index 0000000000000000000000000000000000000000..703c5e27a35c97eb30cdb7d49f32447345646fc6
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/themes.php
@@ -0,0 +1,159 @@
+<?php
+require_once('admin.php');
+
+$themes = bb_get_themes();
+
+$activetheme = bb_get_option('bb_active_theme');
+if (!$activetheme) {
+	$activetheme = BB_DEFAULT_THEME;
+}
+
+if ( isset($_GET['theme']) ) {
+	if ( !bb_current_user_can( 'manage_themes' ) ) {
+		wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
+		exit;
+	}
+	
+	bb_check_admin_referer( 'switch-theme' );
+	do_action( 'bb_deactivate_theme_' . $activetheme );
+	
+	$theme = stripslashes($_GET['theme']);
+	$theme_data = bb_get_theme_data( $theme );
+	if ($theme_data['Name']) {
+		$name = $theme_data['Name'];
+	} else {
+		$name = preg_replace( '/^([a-z0-9_-]+#)/i', '', $theme);
+	}
+	if ($theme == BB_DEFAULT_THEME) {
+		bb_delete_option( 'bb_active_theme' );
+	} else {
+		bb_update_option( 'bb_active_theme', $theme );
+	}
+	do_action( 'bb_activate_theme_' . $theme );
+	wp_redirect( bb_get_uri('bb-admin/themes.php', array('activated' => 1, 'name' => urlencode( $name ) ), BB_URI_CONTEXT_HEADER + BB_URI_CONTEXT_BB_ADMIN ) );
+	exit;
+}
+
+if ( isset($_GET['activated']) )
+	$theme_notice = bb_admin_notice( sprintf( __( '<strong>Theme "%s" activated</strong>' ), esc_attr($_GET['name'])) );
+
+if ( !in_array($activetheme, $themes) ) {
+	if ($activetheme == BB_DEFAULT_THEME) {
+		remove_action( 'bb_admin_notices', $theme_notice );
+		bb_admin_notice( __( '<strong>Default theme is missing.</strong>' ), 'error' );
+	} else {
+		bb_delete_option( 'bb_active_theme' );
+		remove_action( 'bb_admin_notices', $theme_notice );
+		bb_admin_notice( __( '<strong>Theme not found.  Default theme applied.</strong>' ), 'error' );
+	}
+}
+
+function bb_admin_theme_row( $theme, $position ) {
+	$theme_directory = bb_get_theme_directory( $theme );
+	$theme_data = file_exists( $theme_directory . 'style.css' ) ? bb_get_theme_data( $theme ) : false;
+	$screen_shot = file_exists( $theme_directory . 'screenshot.png' ) ? esc_url( bb_get_theme_uri( $theme ) . 'screenshot.png' ) : false;
+	$activation_url = bb_get_uri('bb-admin/themes.php', array('theme' => urlencode($theme)), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN);
+	$activation_url = esc_url( bb_nonce_url( $activation_url, 'switch-theme' ) );
+
+	if ( 1 === $position || 0 === $position ) {
+		echo '<tr>';
+	}
+?>
+	<td class="position-<?php echo( (int) $position ); ?>">
+		<div class="screen-shot"><?php if ( $screen_shot ) : ?><a href="<?php echo $activation_url; ?>" title="<?php echo esc_attr( sprintf( __( 'Activate "%s"' ), $theme_data['Title'] ) ); ?>"><img alt="<?php echo esc_attr( $theme_data['Title'] ); ?>" src="<?php echo $screen_shot; ?>" /></a><?php endif; ?></div>
+		<div class="description">
+			<h3 class="themes">
+<?php
+	printf(
+		__( '%1$s %2$s by <cite>%3$s</cite>' ),
+		$theme_data['Title'],
+		$theme_data['Version'],
+		$theme_data['Author']
+	);
+?>
+			</h3>
+			
+<?php
+	if ( $theme_data['Porter'] ) {
+?>
+			<p>
+<?php
+	printf(
+		__( 'Ported by <cite>%s</cite>' ),
+		$theme_data['Porter']
+	);
+?>
+			</p>
+<?php
+	}
+?>
+			
+			<?php echo $theme_data['Description']; // Description is autop'ed ?>
+<?php
+	if ( 0 !== $position ) {
+?>
+			<div class="actions">
+				<a href="<?php echo $activation_url; ?>" title="<?php echo esc_attr( sprintf( __( 'Activate "%s"' ), $theme_data['Title'] ) ); ?>"><?php _e( 'Activate' ); ?></a>
+			</div>
+<?php
+	}
+?>
+			<p class="location"><?php printf(__('All of this theme\'s files are located in the "%s" themes directory.'), $theme_data['Location']); ?></p>
+		</div>
+	</td>
+<?php
+
+	if ( 3 === $position || 0 === $position ) {
+		echo '</tr>';
+	}
+}
+
+if ( isset( $bb->safemode ) && $bb->safemode === true ) {
+	bb_admin_notice( __( '<strong>"Safe mode" is on, the default theme will be used instead of the active theme indicated below.</strong>' ), 'error' );
+}
+
+$bb_admin_body_class = ' bb-admin-appearance';
+
+bb_get_admin_header();
+?>
+
+<h2><?php _e('Manage Themes'); ?></h2>
+<?php do_action( 'bb_admin_notices' ); ?>
+
+<h3 class="themes"><?php _e('Current Theme'); ?></h3>
+<div>
+<table class="theme-list-active">
+<?php bb_admin_theme_row( $themes[$activetheme], 0 ); unset($themes[$activetheme] ); ?>
+</table>
+</div>
+
+<?php if ( !empty($themes) ) : ?>
+
+<h3 class="themes"><?php _e('Available Themes'); ?></h3>
+<div>
+<table class="theme-list">
+<?php
+$i = 0;
+foreach ( $themes as $theme ) {
+	$position = 1 + ( $i % 3 );
+
+	bb_admin_theme_row( $theme, $position );
+
+	$i++;
+}
+
+switch ( $position ) {
+	case 1:
+		echo '<td class="position-2"></td><td class="position-3"></td></tr>';
+		break;
+	case 2:
+		echo '<td class="position-3"></td></tr>';
+		break;
+	case 3:
+		break;
+}
+?>
+</table>
+</div>
+
+<?php endif; bb_get_admin_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/tools-recount.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/tools-recount.php
new file mode 100644
index 0000000000000000000000000000000000000000..debe1d2118c0b10369a514470e441f24c93340e2
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/tools-recount.php
@@ -0,0 +1,211 @@
+<?php
+require_once('admin.php');
+
+if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) ) {
+	bb_check_admin_referer( 'do-counts' );
+
+	$messages = array();
+	if ( isset($_POST['topic-posts']) && 1 == $_POST['topic-posts'] ) {
+		if ( $topics = (array) $bbdb->get_results("SELECT topic_id, COUNT(post_id) AS count FROM $bbdb->posts WHERE post_status = '0' GROUP BY topic_id") ) {
+			$messages[] = __('Counted posts');
+			foreach ($topics as $topic) {
+				$topic_id = (int) $topic->topic_id;
+				$bbdb->query( $bbdb->prepare( "UPDATE $bbdb->topics SET topic_posts = %s WHERE topic_id = %s" ), $topic->count, $topic_id );
+			}
+			unset($topics, $topic, $topic_id);
+		}
+	}
+
+	if ( isset($_POST['topic-voices']) && 1 == $_POST['topic-voices'] ) {
+		if ( $topics = (array) $bbdb->get_results("SELECT topic_id FROM $bbdb->topics ORDER BY topic_id") ) {
+			$messages[] = __('Counted voices');
+			foreach ($topics as $topic) {
+				$topic_id = (int) $topic->topic_id;
+				if ( $voices = $bbdb->get_col( $bbdb->prepare( "SELECT DISTINCT poster_id FROM $bbdb->posts WHERE topic_id = %s AND post_status = '0';", $topic_id ) ) ) {
+					$voices = count( $voices );
+					bb_update_topicmeta( $topic_id, 'voices_count', $voices );
+				}
+			}
+			unset($topics, $topic, $topic_id);
+		}
+	}
+
+	if ( isset($_POST['topic-deleted-posts']) && 1 == $_POST['topic-deleted-posts'] ) {
+		$old = (array) $bbdb->get_col("SELECT object_id FROM $bbdb->meta WHERE object_type = 'bb_topics' AND meta_key = 'deleted_posts'");
+		$old = array_flip($old);
+		if ( $topics = (array) $bbdb->get_results("SELECT topic_id, COUNT(post_id) AS count FROM $bbdb->posts WHERE post_status != '0' GROUP BY topic_id") ) {
+			$messages[] = __('Counting deleted posts&#8230;');
+			foreach ( $topics as $topic ) {
+				bb_update_topicmeta( $topic->topic_id, 'deleted_posts', $topic->count );
+				unset($old[$topic->topic_id]);
+			}
+			unset($topics, $topic);
+		}
+		if ( $old ) {
+			$old = join(',', array_flip($old));
+			$bbdb->query("DELETE FROM $bbdb->meta WHERE object_type = 'bb_topic' AND object_id IN ($old) AND meta_key = 'deleted_posts'");
+			$messages[] = __('&#8230;counted deleted posts');
+		} else {
+			$messages[] = __('&#8230;no deleted posts to count');
+		}
+	}
+
+	if ( isset($_POST['forums']) && 1 == $_POST['forums'] ) {
+		if ( $all_forums = (array) $bbdb->get_col("SELECT forum_id FROM $bbdb->forums") ) {
+			$messages[] = __('Counted forum topics and posts');
+			$all_forums = array_flip( $all_forums );
+			$forums = $bbdb->get_results("SELECT forum_id, COUNT(topic_id) AS topic_count, SUM(topic_posts) AS post_count FROM $bbdb->topics WHERE topic_status = 0 GROUP BY forum_id");
+			foreach ( (array) $forums as $forum ) {
+				$bbdb->query("UPDATE $bbdb->forums SET topics = '$forum->topic_count', posts = '$forum->post_count' WHERE forum_id = '$forum->forum_id'");
+				unset($all_forums[$forum->forum_id]);
+			}
+			if ( $all_forums ) {
+				$all_forums = implode(',', array_flip( $all_forums ) );
+				$bbdb->query("UPDATE $bbdb->forums SET topics = 0, posts = 0 WHERE forum_id IN ($all_forums)");
+			}
+			unset($all_forums, $forums, $forum);
+		}
+	}
+
+	if ( isset($_POST['topics-replied']) && 1 == $_POST['topics-replied'] ) {
+		if ( $users = (array) $bbdb->get_col("SELECT ID FROM $bbdb->users") ) {
+			$messages[] = __('Counted topics to which each user has replied');
+			foreach ( $users as $user )
+				bb_update_topics_replied( $user );
+			unset($users, $user);
+		}
+	}
+
+	if ( isset($_POST['topic-tag-count']) && 1 == $_POST['topic-tag-count'] ) {
+		// Reset tag count to zero
+		$bbdb->query( "UPDATE $bbdb->topics SET tag_count = 0" );
+
+		// Get all tags
+		$terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag' );
+
+		if ( !is_wp_error( $terms ) && is_array( $terms ) ) {
+			$messages[] = __('Counted topic tags');
+			foreach ( $terms as $term ) {
+				$topic_ids = bb_get_tagged_topic_ids( $term->term_id );
+				if ( !is_wp_error( $topic_ids ) && is_array( $topic_ids ) ) {
+					$bbdb->query(
+						"UPDATE $bbdb->topics SET tag_count = tag_count + 1 WHERE topic_id IN (" . join( ',', $topic_ids ) . ")"
+					);
+				}
+				unset( $topic_ids );
+			}
+		}
+		unset( $terms, $term );
+	}
+
+	if ( isset($_POST['tags-tag-count']) && 1 == $_POST['tags-tag-count'] ) {
+		// Get all tags
+		$terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag', array( 'hide_empty' => false ) );
+
+		if ( !is_wp_error( $terms ) && is_array( $terms ) ) {
+			$messages[] = __('Counted tagged topics');
+			$_terms = array();
+			foreach ( $terms as $term ) {
+				$_terms[] = $term->term_id;
+			}
+			if ( count( $_terms ) ) {
+				$wp_taxonomy_object->update_term_count( $_terms, 'bb_topic_tag' );
+			}
+		}
+		unset( $term, $_terms );
+	}
+
+	if ( isset($_POST['tags-delete-empty']) && 1 == $_POST['tags-delete-empty'] ) {
+		// Get all tags
+		if ( !isset( $terms ) ) {
+			$terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag', array( 'hide_empty' => false ) );
+		}
+
+		if ( !is_wp_error( $terms ) && is_array( $terms ) ) {
+			$messages[] = __('Deleted tags with no topics');
+			foreach ( $terms as $term ) {
+				$topic_ids = bb_get_tagged_topic_ids( $term->term_id );
+				if ( !is_wp_error( $topic_ids ) && is_array( $topic_ids ) ) {
+					if ( false === $topic_ids || ( is_array( $topic_ids ) && !count( $topic_ids ) ) ) {
+						bb_destroy_tag( $term->term_taxonomy_id );
+					}
+				}
+				unset( $topic_ids );
+			}
+		}
+		unset( $terms, $term );
+	}
+
+	if ( isset($_POST['clean-favorites']) && 1 == $_POST['clean-favorites'] ) {
+		$favorites_key = $bbdb->prefix . 'favorites';
+		if ( $users = $bbdb->get_results("SELECT user_id AS id, meta_value AS favorites FROM $bbdb->usermeta WHERE meta_key = '" . $favorites_key . "'") ) {
+			$messages[] = __('Removed deleted topics from users\' favorites');
+			$topics = $bbdb->get_col("SELECT topic_id FROM $bbdb->topics WHERE topic_status = '0'");
+			foreach ( $users as $user ) {
+				foreach ( explode(',', $user->favorites) as $favorite ) {
+					if ( !in_array($favorite, $topics) ) {
+						bb_remove_user_favorite( $user->id, $favorite );
+					}
+				}
+			}
+			unset($topics, $users, $user, $favorite);
+		}
+	}
+
+	bb_recount_list();
+	foreach ( (array) $recount_list as $item ) {
+		if ( isset($item[2]) && isset($_POST[$item[0]]) && 1 == $_POST[$item[0]] && is_callable($item[2]) ) {
+			call_user_func( $item[2] );
+		}
+	}
+	
+	if ( count( $messages ) ) {
+		$messages = join( '</p>' . "\n" . '<p>', $messages );
+		bb_admin_notice( $messages );
+	}
+}
+
+
+$bb_admin_body_class = ' bb-admin-tools';
+
+bb_get_admin_header();
+?>
+<h2><?php _e('Tools') ?></h2>
+<?php do_action( 'bb_admin_notices' ); ?>
+
+<form class="settings" method="post" action="<?php bb_uri('bb-admin/tools-recount.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>">
+	<fieldset>
+		<legend><?php _e( 'Re-count' ) ?></legend>
+		<p><?php _e( 'To minimize database queries, bbPress keeps it\'s own count of various items like posts in each topic and topics in each forum. Occasionally these internal counters may become incorrect, you can manually re-count these items using this form.' ) ?></p>
+		<p><?php _e( 'You can also clean out some stale items here, like empty tags.' ) ?></p>
+<?php
+bb_recount_list();
+if ( $recount_list ) {
+?>
+		<div id="option-counts">
+			<div class="label">
+				<?php _e( 'Items to re-count' ); ?>
+			</div>
+			<div class="inputs">
+<?php
+	foreach ( $recount_list as $item ) {
+		echo '<label class="checkboxs"><input type="checkbox" class="checkbox" name="' . esc_attr( $item[0] ) . '" id="' . esc_attr( str_replace( '_', '-', $item[0] ) ) . '" value="1" /> ' . esc_html( $item[1] ) . '</label>' . "\n";
+	}
+?>
+			</div>
+		</div>
+<?php
+} else {
+?>
+		<p><?php _e( 'There are no re-count tools available.' ) ?></p>
+<?php
+}
+?>
+	</fieldset>
+	<fieldset class="submit">
+		<?php bb_nonce_field( 'do-counts' ); ?>
+		<input class="submit" type="submit" name="submit" value="<?php _e('Recount Items') ?>" />
+	</fieldset>
+</form>
+
+<?php bb_get_admin_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/topic-move.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/topic-move.php
new file mode 100644
index 0000000000000000000000000000000000000000..fcf0d1a996a2aaae558020a98e02042a87ae12b7
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/topic-move.php
@@ -0,0 +1,30 @@
+<?php
+require_once('admin-action.php');
+
+$topic_id = absint( $_POST['topic_id'] );
+$forum_id = absint( $_POST['forum_id'] );
+
+if ( !is_numeric($topic_id) || !is_numeric($forum_id) )
+	bb_die(__('Invalid topic or forum.'));
+
+if ( !bb_current_user_can( 'move_topic', $topic_id, $forum_id ) ) {
+	wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
+	exit;
+}
+
+bb_check_admin_referer( 'move-topic_' . $topic_id );
+
+$topic = get_topic( $topic_id );
+$forum = bb_get_forum( $forum_id );
+
+if ( !$topic || !$forum )
+	bb_die(__('Your topic or forum caused all manner of confusion'));
+
+bb_move_topic( $topic_id, $forum_id );
+
+if ( !$redirect = wp_get_referer() )
+	$redirect = get_topic_link( $topic_id );
+
+bb_safe_redirect( $redirect );
+exit;
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/topic-toggle.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/topic-toggle.php
new file mode 100644
index 0000000000000000000000000000000000000000..ac8c10a9928bee1bd605ad3ea43608e11ca3b7f2
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/topic-toggle.php
@@ -0,0 +1,33 @@
+<?php
+require('admin-action.php');
+
+$topic_id = (int) $_GET['id'];
+$topic    =  get_topic ( $topic_id );
+
+if ( !$topic )
+	bb_die(__('There is a problem with that topic, pardner.'));
+
+if ( !bb_current_user_can( 'close_topic', $topic_id ) ) {
+	wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
+	exit;
+}
+
+bb_check_admin_referer( 'close-topic_' . $topic_id );
+
+if ( topic_is_open( $topic_id ) ) {
+	bb_close_topic( $topic_id );
+	$message = 'closed';
+} else {
+	bb_open_topic ( $topic_id );
+	$message = 'opened';
+}
+
+if ( $sendto = wp_get_referer() ) {
+	$sendto = remove_query_arg( 'message', $sendto );
+	$sendto = add_query_arg( 'message', $message, $sendto );
+} else {
+	$sendto = get_topic_link( $topic_id );
+}
+
+bb_safe_redirect( $sendto );
+exit;
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/topics.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/topics.php
new file mode 100644
index 0000000000000000000000000000000000000000..d74308f0c0562e8b48a491b7a3121c759d0756ae
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/topics.php
@@ -0,0 +1,180 @@
+<?php
+require_once('admin.php');
+
+if ( !empty( $_GET['message'] ) ) {
+	switch ( (string) $_GET['message'] ) {
+		case 'undeleted':
+			bb_admin_notice( __( '<strong>Topic undeleted.</strong>' ) );
+			break;
+		case 'deleted':
+			bb_admin_notice( __( '<strong>Topic deleted.</strong>' ) );
+			break;
+		case 'opened':
+			bb_admin_notice( __( '<strong>Topic opened.</strong>' ) );
+			break;
+		case 'closed':
+			bb_admin_notice( __( '<strong>Topic closed.</strong>' ) );
+			break;
+	}
+}
+
+$bb_admin_body_class = ' bb-admin-topics';
+
+bb_get_admin_header();
+
+if ( !bb_current_user_can('browse_deleted') )
+	die(__("Now how'd you get here?  And what did you think you'd being doing?")); //This should never happen.
+add_filter( 'topic_link', 'bb_make_link_view_all' );
+add_filter( 'topic_last_post_link', 'bb_make_link_view_all' );
+$topic_query_vars = array( 'topic_status' => 'normal', 'open' => 'open', 'count' => true, 'per_page' => 20 );
+if ( isset($_POST['search']) && $_POST['search'] ) {
+	$topic_query_vars['post_status'] = 'all';
+} elseif ( isset($_GET['search']) && $_GET['search'] ) {
+	$topic_query_vars['post_status'] = 'all';
+}
+$topic_query = new BB_Query_Form( 'topic', $topic_query_vars );
+$topics = $topic_query->results;
+?>
+
+<div class="wrap">
+
+<h2><?php _e( 'Topics' ); ?>
+<?php
+$h2_search = $topic_query->get( 'search' );
+$h2_forum  = $topic_query->get( 'forum_id' );
+$h2_tag    = $topic_query->get( 'tag_id' );
+$h2_author = $topic_query->get( 'topic_author_id' );
+
+$h2_search = $h2_search ? ' ' . sprintf( __('containing &#8220;%s&#8221;'), esc_html( $h2_search ) ) : '';
+$h2_forum  = $h2_forum  ? ' ' . sprintf( __('in &#8220;%s&#8221;')      , get_forum_name( $h2_forum ) ) : '';
+$h2_tag    = $h2_tag    ? ' ' . sprintf( __('with tag &#8220;%s&#8221;'), esc_html( bb_get_tag_name( $h2_tag ) ) ) : '';
+$h2_author = $h2_author ? ' ' . sprintf( __('by %s')                    , esc_html( get_user_name( $h2_author ) ) ) : '';
+
+if ( $h2_search || $h2_forum || $h2_tag || $h2_author ) {
+	echo '<span class="subtitle">';
+	
+	printf( __( '%1$s%2$s%3$s%4$s' ), $h2_search, $h2_forum, $h2_tag, $h2_author );
+	
+	echo '</span>';
+}
+?>
+</h2>
+<?php do_action( 'bb_admin_notices' ); ?>
+
+<?php $topic_query->form( array('tag' => true, 'topic_author' => true, 'topic_status' => true, 'open' => true, 'submit' => __('Filter')) ); ?>
+
+<div class="tablenav">
+<?php if ( $topic_query->found_rows ) : ?>
+	<div class="tablenav-pages">
+		<span class="displaying-num"><?php echo $displaying_num = sprintf(
+			__( '%1$s to %2$s of %3$s' ),
+			bb_number_format_i18n( ( $page - 1 ) * $topic_query->get( 'per_page' ) + 1 ),
+			$page * $topic_query->get( 'per_page' ) < $topic_query->found_rows ? bb_number_format_i18n( $page * $topic_query->get( 'per_page' ) ) : '<span class="total-type-count">' . bb_number_format_i18n( $topic_query->found_rows ) . '</span>',
+			'<span class="total-type-count">' . bb_number_format_i18n( $topic_query->found_rows ) . '</span>'
+		); ?></span><span class="displaying-pages">
+<?php
+$_page_link_args = array(
+	'page' => $page,
+	'total' => $topic_query->found_rows,
+	'per_page' => $topic_query->get( 'per_page' ),
+	'mod_rewrite' => false,
+	'prev_text' => __( '&laquo;' ),
+	'next_text' => __( '&raquo;' )
+);
+echo $page_number_links = get_page_number_links( $_page_link_args );
+?></span>
+		<div class="clear"></div>
+	</div>
+<?php endif; ?>
+</div>
+<div class="clear"></div>
+
+<?php if ( !$topics ) : ?>
+
+<p class="no-results"><?php _e('No topics found.'); ?></p>
+
+<?php else : bb_cache_first_posts( $topics ); bb_cache_last_posts( $topics ); ?>
+
+<table id="topics-list" class="widefat">
+<thead>
+<tr>
+	<th scope="col"><?php _e('Topic') ?></th>
+	<th scope="col"><?php _e('Author') ?></th>
+	<th scope="col"><?php _e('Posts') ?></th>
+	<th scope="col"><?php _e('Date') ?></th>
+	<th scope="col"><?php _e('Freshness') ?></th>
+</tr>
+</thead>
+<tfoot>
+<tr>
+	<th scope="col"><?php _e('Topic') ?></th>
+	<th scope="col"><?php _e('Author') ?></th>
+	<th scope="col"><?php _e('Posts') ?></th>
+	<th scope="col"><?php _e('Date') ?></th>
+	<th scope="col"><?php _e('Freshness') ?></th>
+</tr>
+</thead>
+
+<tbody>
+<?php foreach ( $topics as $topic ) : $first_post = bb_get_first_post( $topic ); ?>
+<tr id="topic-<?php echo $topic->topic_id; ?>"<?php topic_class(); ?>>
+	<td class="topic">
+		<span class="row-title"><?php bb_topic_labels(); ?> <a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></span>
+		<div>
+		<span class="row-actions">
+			<a href="<?php topic_link(); ?>"><?php _e( 'View' ); ?></a> |
+			<?php if ( $first_post ) : post_edit_link( $first_post->post_id ); ?> |
+			<?php endif; topic_close_link( array( 'id' => $topic->topic_id, 'before' => '', 'after' => '', 'close_text' => __( 'Close' ), 'open_text' => _x( 'Open', 'action' ) ) ); ?> |
+			<?php topic_delete_link( array( 'id' => $topic->topic_id, 'before' => '', 'after' => '', 'delete_text' => __( 'Delete' ), 'undelete_text' => __( 'Undelete' ) ) ); ?>
+		</span>&nbsp;
+		</div>
+	</td>
+	<td class="author">
+		<a class="author-link" href="<?php user_profile_link( $topic->topic_poster ); ?>">
+			<?php echo bb_get_avatar( $topic->topic_poster, '16' ); ?>
+			<?php topic_author(); ?>
+		</a>
+	</td>
+	<td class="posts num"><?php topic_posts(); ?></td>
+	<td class="date num">
+<?php
+	if ( get_topic_start_time( 'U' ) < ( time() - 86400 ) ) {
+		topic_start_time( 'Y/m/d\<\b\r \/\>H:i:s' );
+	} else {
+		printf( __( '%s ago' ), get_topic_start_time( 'since' ) );
+	}
+?>
+	</td>
+	<td class="freshness num"><a href="<?php topic_last_post_link(); ?>" title="<?php echo esc_attr( sprintf( __( 'Last post by %s' ), get_topic_last_poster() ) ); ?>">
+<?php
+	if ( get_topic_time( 'U' ) < ( time() - 86400 ) ) {
+		topic_time( 'Y/m/d\<\b\r \/\>H:i:s' );
+	} else {
+		printf( __( '%s ago' ), get_topic_time( 'since' ) );
+	}
+?>
+	
+	<?php //topic_time( bb_get_datetime_formatstring_i18n() ); ?>
+	
+	
+	</a></td>
+</tr>
+<?php endforeach; ?>
+</tbody>
+</table>
+
+<?php endif; ?>
+
+<div class="tablenav bottom">
+<?php if ( $topic_query->found_rows ) : ?>
+	<div class="tablenav-pages">
+		<span class="displaying-pages"><?php echo $page_number_links; ?></span>
+		<div class="clear"></div>
+	</div>
+<?php endif; ?>
+</div>
+<div class="clear"></div>
+
+</div>
+
+<?php bb_get_admin_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/upgrade.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/upgrade.php
new file mode 100644
index 0000000000000000000000000000000000000000..e3cc6d1b3abcb5774be5daa2d9fb8b168fd313ac
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/upgrade.php
@@ -0,0 +1,210 @@
+<?php
+// Remove these lines if you want to upgrade and are using safe mode
+if ( ini_get('safe_mode') )
+	die("You're running in safe mode which does not allow this upgrade
+	script to set a running time limit.  Depending on the size of your
+	database and on which parts of the script you are running, the script
+	can take quite some time to run (or it could take just a few seconds).
+	To throw caution to the wind and run the script in safe mode anyway,
+	remove the first few lines of code in the <code>bb-admin/upgrade.php</code>
+	file. Backups are always a good idea.");
+// Stop removing lines
+
+// Very old (pre 0.7) installs may need further upgrade utilities.
+// Post to http://lists.bbpress.org/mailman/listinfo/bbdev if needed
+
+require('../bb-load.php');
+require( BB_PATH . 'bb-admin/includes/functions.bb-upgrade.php' );
+
+$step = 'unrequired';
+
+$forced = false;
+if ( isset( $_POST['force'] ) && 1 == $_POST['force'] ) {
+	$forced = true;
+} elseif ( isset( $_GET['force'] ) && 1 == $_GET['force'] ) {
+	$forced = true;
+}
+
+if ( bb_get_option( 'bb_db_version' ) > bb_get_option_from_db( 'bb_db_version' ) || $forced ) {
+	
+	$forced_input = '';
+	if ( $forced ) {
+		$forced_input = '<input type="hidden" name="force" value="1" />';
+	}
+	
+	$step = 'required';
+	
+	if ( strtolower( $_SERVER['REQUEST_METHOD']) == 'post' ) {
+		
+		bb_check_admin_referer( 'bbpress-upgrader' );
+		
+		define('BB_UPGRADING', true);
+		
+		$bbdb->hide_errors();
+		
+		$messages = bb_upgrade_all();
+		
+		$bbdb->show_errors();
+		
+		$upgrade_log = array(__('Beginning upgrade&hellip;'));
+		if (is_array($messages['messages'])) {
+			$upgrade_log = array_merge($upgrade_log, $messages['messages']);
+		}
+		$upgrade_log[] = '>>> ' . __('Done');
+		
+		$error_log = array();
+		if (is_array($messages['errors'])) {
+			$error_log = $messages['errors'];
+		}
+		
+		if ( bb_get_option( 'bb_db_version' ) === bb_get_option_from_db( 'bb_db_version' ) && !count($error_log) ) {
+			$step = 'complete';
+		} else {
+			$step = 'error';
+		}
+		
+		wp_cache_flush();
+	}
+	
+}
+
+bb_install_header( __('bbPress database upgrade'), false, true );
+?>
+		<script type="text/javascript" charset="utf-8">
+			function toggleAdvanced(toggle, target) {
+				var toggleObj = document.getElementById(toggle);
+				var targetObj = document.getElementById(target);
+				if (toggleObj.checked) {
+					targetObj.style.display = 'block';
+				} else {
+					targetObj.style.display = 'none';
+				}
+			}
+		</script>
+<?php
+switch ($step) {
+	case 'unrequired':
+?>
+		<p class="last">
+			<?php printf( __('Nothing to upgrade.  <a href="%s">Get back to work!</a>'), bb_get_uri('bb-admin/', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN) ); ?>
+		</p>
+<?php
+		break;
+	
+	case 'required'
+?>
+		<div class="open">
+			<h2><?php _e('Database upgrade required'); ?></h2>
+			<div>
+				<form action="<?php bb_uri('bb-admin/upgrade.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>" method="post">
+					<p class="error">
+						<?php _e('It looks like your database is out-of-date. You can upgrade it here.'); ?>
+					</p>
+					<fieldset class="buttons">
+						<?php bb_nonce_field( 'bbpress-upgrader' ); ?>
+						<?php echo $forced_input; ?>
+						<label for="upgrade_next" class="forward">
+							<input class="button" id="upgrade_next" type="submit" value="<?php _e( 'Upgrade database' ); ?>" />
+						</label>
+					</fieldset>
+				</form>
+			</div>
+		</div>
+<?php
+		break;
+	
+	case 'complete':
+?>
+		<div class="open">
+			<h2><?php _e('Database upgrade complete'); ?></h2>
+			<div>
+				<form action="<?php bb_uri('bb-admin/', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>" method="get">
+					<p class="message">
+						<?php _e('Your database has been successfully upgraded, enjoy!'); ?>
+					</p>
+					<fieldset>
+						<label class="has-label for-toggle" for="upgrade_log_container_toggle">
+							<span>
+								<?php _e('Show upgrade messages'); ?>
+								<input class="checkbox" type="checkbox" id="upgrade_log_container_toggle" value="1" onclick="toggleAdvanced('upgrade_log_container_toggle', 'upgrade_log_container');" />
+							</span>
+							<div class="clear"></div>
+						</label>
+					</fieldset>
+					<div class="toggle" id="upgrade_log_container" style="display:none;">
+						<fieldset>
+							<label class="has-label for-textarea" for="upgrade_log">
+								<span><?php _e('Upgrade log'); ?></span>
+								<textarea id="upgrade_log" class="short"><?php echo(join("\n", $upgrade_log)); ?></textarea>
+							</label>
+						</fieldset>
+					</div>
+					<fieldset class="buttons">
+						<label for="upgrade_next" class="back">
+							<input class="button" id="upgrade_back" type="button" value="<?php _e( '&laquo; Go back to forums' ); ?>" onclick="location.href='<?php echo esc_js( bb_get_uri() ); ?>'; return false;" />
+						</label>
+						<label for="upgrade_next" class="forward">
+							<input class="button" id="upgrade_next" type="submit" value="<?php _e( 'Go to admin' ); ?>" />
+						</label>
+					</fieldset>
+				</form>
+			</div>
+		</div>
+<?php
+		break;
+	
+	case 'error':
+?>
+		<div class="open">
+			<h2><?php _e('Database upgrade failed'); ?></h2>
+			<div>
+				<form action="<?php bb_uri('bb-admin/upgrade.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>" method="post">
+					<p class="error">
+						<?php _e('The upgrade process seems to have failed. Check the upgrade messages below for more information.<br /><br />Attempting to go to the admin area without resolving the listed errors will return you to this upgrade page.'); ?>
+					</p>
+					<fieldset>
+						<?php bb_nonce_field( 'bbpress-upgrader' ); ?>
+						<?php echo $forced_input; ?>
+						<label class="has-label for-toggle" for="upgrade_log_container_toggle" style="margin-bottom: 1.9em;">
+							<span>
+								<?php _e('Show upgrade messages'); ?>
+								<input class="checkbox" type="checkbox" id="upgrade_log_container_toggle" value="1" onclick="toggleAdvanced('upgrade_log_container_toggle', 'upgrade_log_container');" />
+							</span>
+							<div class="clear"></div>
+						</label>
+					</fieldset>
+					<div class="toggle" id="upgrade_log_container" style="display:none;">
+						<fieldset>
+<?php
+		if (count($error_log)) {
+?>
+							<label class="has-label for-textarea" for="error_log">
+								<span><?php _e('Error log'); ?></span>
+								<textarea id="error_log" class="short"><?php echo(join("\n", $error_log)); ?></textarea>
+							</label>
+<?php
+		}
+?>
+							<label class="has-label for-textarea" for="upgrade_log">
+								<span><?php _e('Upgrade log'); ?></span>
+								<textarea id="upgrade_log" class="short"><?php echo(join("\n", $upgrade_log)); ?></textarea>
+							</label>
+						</fieldset>
+					</div>
+					<fieldset class="buttons">
+						<label for="upgrade_next" class="back">
+							<input class="button" id="upgrade_back" type="button" value="<?php _e( '&laquo; Go back to forums' ); ?>" onclick="location.href='<?php echo esc_js( bb_get_uri() ); ?>'; return false;" />
+						</label>
+						<label for="upgrade_next" class="forward">
+							<input class="button" id="upgrade_next" type="submit" value="<?php _e( 'Try again' ); ?>" />
+						</label>
+					</fieldset>
+				</form>
+			</div>
+		</div>
+<?php
+		break;
+}
+
+bb_install_footer();
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/users.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/users.php
new file mode 100644
index 0000000000000000000000000000000000000000..6564a4d9aad64c46cf6440497fbc75817df7fa3c
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/users.php
@@ -0,0 +1,22 @@
+<?php
+require_once('admin.php');
+
+// Query the users
+$bb_user_search = new BB_User_Search(@$_GET['usersearch'], @$_GET['page'], @$_GET['userrole']);
+
+$bb_admin_body_class = ' bb-admin-users';
+
+bb_get_admin_header();
+?>
+
+<div class="wrap">
+
+<?php
+$bb_user_search->display( true, bb_current_user_can( 'edit_users' ) );
+?>
+
+</div>
+
+<?php
+bb_get_admin_footer();
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-config-sample.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-config-sample.php
new file mode 100644
index 0000000000000000000000000000000000000000..0c1861a682ce14eb6999a3e6e52446af717b5a07
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-config-sample.php
@@ -0,0 +1,64 @@
+<?php
+/** 
+ * The base configurations of bbPress.
+ *
+ * This file has the following configurations: MySQL settings, Table Prefix,
+ * Secret Keys and bbPress Language. You can get the MySQL settings from your
+ * web host.
+ *
+ * This file is used by the installer during installation.
+ *
+ * @package bbPress
+ */
+
+// ** MySQL settings - You can get this info from your web host ** //
+/** The name of the database for bbPress */
+define( 'BBDB_NAME', 'bbpress' );
+
+/** MySQL database username */
+define( 'BBDB_USER', 'username' );
+
+/** MySQL database password */
+define( 'BBDB_PASSWORD', 'password' );
+
+/** MySQL hostname */
+define( 'BBDB_HOST', 'localhost' );
+
+/** Database Charset to use in creating database tables. */
+define( 'BBDB_CHARSET', 'utf8' );
+
+/** The Database Collate type. Don't change this if in doubt. */
+define( 'BBDB_COLLATE', '' );
+
+/**#@+
+ * Authentication Unique Keys.
+ *
+ * Change these to different unique phrases!
+ * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/bbpress/ WordPress.org secret-key service}
+ *
+ * @since 1.0
+ */
+define( 'BB_AUTH_KEY', 'put your unique phrase here' );
+define( 'BB_SECURE_AUTH_KEY', 'put your unique phrase here' );
+define( 'BB_LOGGED_IN_KEY', 'put your unique phrase here' );
+define( 'BB_NONCE_KEY', 'put your unique phrase here' );
+/**#@-*/
+
+/**
+ * bbPress Database Table prefix.
+ *
+ * You can have multiple installations in one database if you give each a unique
+ * prefix. Only numbers, letters, and underscores please!
+ */
+$bb_table_prefix = 'bb_';
+
+/**
+ * bbPress Localized Language, defaults to English.
+ *
+ * Change this to localize bbPress. A corresponding MO file for the chosen
+ * language must be installed to a directory called "my-languages" in the root
+ * directory of bbPress. For example, install de.mo to "my-languages" and set
+ * BB_LANG to 'de' to enable German language support.
+ */
+define( 'BB_LANG', '' );
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-cron.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-cron.php
new file mode 100644
index 0000000000000000000000000000000000000000..4f51e92bfb282b061c98c9c5c4c07d089eba4039
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-cron.php
@@ -0,0 +1,57 @@
+<?php
+/**
+ * bbPress Cron Implementation for hosts, which do not offer CRON or for which
+ * the user has not setup a CRON job pointing to this file.
+ *
+ * The HTTP request to this file will not slow down the visitor who happens to
+ * visit when the cron job is needed to run.
+ *
+ * @package bbPress
+ */
+
+ignore_user_abort( true );
+
+/**
+ * Tell bbPress we are doing the CRON task.
+ *
+ * @var bool
+ */
+define( 'DOING_CRON', true );
+
+/** Setup bbPress environment */
+require_once( './bb-load.php' );
+
+if ( $_GET['check'] != backpress_get_option( 'cron_check' ) ) {
+	exit;
+}
+
+if ( bb_get_option( 'doing_cron' ) > time() ) {
+	exit;
+}
+
+bb_update_option( 'doing_cron', time() + 30 );
+
+$crons = _get_cron_array();
+$keys = array_keys( $crons );
+if ( !is_array( $crons ) || $keys[0] > time() ) {
+	return;
+}
+
+foreach ( $crons as $timestamp => $cronhooks ) {
+	if ( $timestamp > time() ) {
+		break;
+	}
+	foreach ( $cronhooks as $hook => $keys ) {
+		foreach ( $keys as $key => $args ) {
+			$schedule = $args['schedule'];
+			if ( $schedule != false ) {
+				$new_args = array( $timestamp, $schedule, $hook, $args['args'] );
+				call_user_func_array( 'wp_reschedule_event' , $new_args );
+			}
+			wp_unschedule_event( $timestamp, $hook, $args['args'] );
+ 			do_action_ref_array( $hook, $args['args'] );
+		}
+	}
+}
+
+bb_update_option( 'doing_cron', 0 );
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-edit.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..327a98aef595cbda9d4d27d6ccce9571ccdaa7cb
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-edit.php
@@ -0,0 +1,46 @@
+<?php
+require('./bb-load.php');
+
+bb_auth('logged_in');
+
+$post_id = (int) $_POST['post_id'];
+
+$bb_post  = bb_get_post( $post_id );
+
+if ( !$bb_post ) {
+	wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
+	die();
+}
+
+if ( !bb_current_user_can( 'edit_post', $post_id ) )
+	bb_die(__('Sorry, post is too old.'));
+
+bb_check_admin_referer( 'edit-post_' . $post_id );
+
+if ( 0 != $bb_post->post_status && 'all' == $_GET['view'] ) // We're trying to edit a deleted post
+	add_filter('bb_is_first_where', 'bb_no_where');
+
+if ( bb_is_first( $bb_post->post_id ) && bb_current_user_can( 'edit_topic', $bb_post->topic_id ) ) {
+	bb_insert_topic( array(
+		'topic_title' => stripslashes( $_POST['topic'] ),
+		'topic_id' => $bb_post->topic_id
+	) );
+}
+
+bb_insert_post( array(
+	'post_text' => stripslashes( $_POST['post_content'] ),
+	'post_id' => $post_id,
+	'topic_id' => $bb_post->topic_id
+) );
+
+if ( $post_id ) {
+	if ( $_REQUEST['view'] === 'all' ) {
+		add_filter( 'get_post_link', 'bb_make_link_view_all' );
+	}
+	$post_link = get_post_link( $post_id );
+	wp_redirect( $post_link );
+} else {
+	wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
+}
+exit;
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bp-log.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bp-log.php
new file mode 100644
index 0000000000000000000000000000000000000000..f30628f0ed31211c0f251b573797dc95c66eab1b
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bp-log.php
@@ -0,0 +1,550 @@
+<?php
+
+
+/**
+ * BackPress logging level constants
+ */
+define('BP_LOG_NONE',    0);
+define('BP_LOG_FAIL',    1);
+define('BP_LOG_ERROR',   2);
+define('BP_LOG_WARNING', 4);
+define('BP_LOG_NOTICE',  8);
+define('BP_LOG_DEBUG',   16);
+
+/**
+ * Combination of all errors (excluding none and debug)
+ */
+define('BP_LOG_ALL', BP_LOG_FAIL + BP_LOG_ERROR + BP_LOG_WARNING + BP_LOG_NOTICE);
+
+
+
+/**
+ * Provides easy and abstracted logging facilities
+ *
+ * @package BackPress
+ */
+class BP_Log
+{
+	/**
+	 * The logging level
+	 *
+	 * @var integer
+	 */
+	var $level = BP_LOG_NONE;
+
+	/**
+	 * The type of logging
+	 *
+	 * @var string
+	 */
+	var $type = 'php';
+	
+	/**
+	 * The types of logging available
+	 *
+	 * @var array
+	 */
+	var $types = array('php', 'file', 'display', 'console');
+
+	/**
+	 * The filename of the file to log messages to when type is "file"
+	 *
+	 * @var string
+	 */
+	var $filename = '';
+
+	/**
+	 * Whether or not the javascript functions are available
+	 *
+	 * @var boolean
+	 **/
+	var $console_javascript_loaded = false;
+
+	/**
+	 * Console log messages which are queued up to be displayed on page load
+	 *
+	 * @var array
+	 **/
+	var $console_javascript_onloads = array();
+
+	/**
+	 * Initialises the logging
+	 *
+	 * @return void
+	 */
+	function BP_log($level = false, $type = false, $filename = false)
+	{
+		$this->set_level($level);
+		$this->set_type($type);
+		$this->set_filename($filename);
+	}
+
+	/**
+	 * Sets the logging level
+	 *
+	 * @return integer|boolean The old level on success or false
+	 * @uses BP_LOG_LEVEL
+	 */
+	function set_level($level)
+	{
+		$old_level = $this->level;
+
+		if (is_integer($level)) {
+			$this->level = $level;
+		} elseif (defined('BP_LOG_LEVEL') && is_integer(BP_LOG_LEVEL)) {
+			$this->level = BP_LOG_LEVEL;
+		} else {
+			return false;
+		}
+
+		return $old_level;
+	}
+
+	/**
+	 * Sets the logging type
+	 *
+	 * @return string|false The old type on success or false
+	 * @uses BP_LOG_TYPE
+	 */
+	function set_type($type)
+	{
+		$old_type = $this->type;
+		$type = strtolower($type);
+
+		if (in_array($type, $this->types)) {
+			$this->type = $type;
+		} elseif (defined('BP_LOG_TYPE') && in_array(BP_LOG_TYPE, $this->types)) {
+			$this->type = BP_LOG_TYPE;
+		} else {
+			return false;
+		}
+
+		return $old_type;
+	}
+
+	/**
+	 * Sets the logging filename
+	 *
+	 * @return string|boolean The old filename on success or false
+	 * @uses BP_LOG_FILENAME
+	 */
+	function set_filename($filename)
+	{
+		$old_filename = $this->filename;
+
+		if (is_string($filename)) {
+			$_filename = $filename;
+		} elseif (defined('BP_LOG_FILENAME') && is_string(BP_LOG_FILENAME)) {
+			$_filename = BP_LOG_FILENAME;
+		} else {
+			return false;
+		}
+
+		if (isset($_filename) && file_exists($_filename) && is_file($_filename) && is_writable($_filename)) {
+			$this->filename = $_filename;
+		} else {
+			return false;
+		}
+
+		return $old_filename;
+	}
+
+	/**
+	 * Sends a message to the log
+	 *
+	 * @return boolean True on success, false on failure
+	 */
+	function send($message = '', $level = BP_LOG_DEBUG, $type = false, $prefix = false)
+	{
+		// Make sure the level of this message is set to be logged
+		if (($level & $this->level) === 0) {
+			return;
+		}
+
+		// Format the message into an array of lines to be logged
+		$lines = $this->format_message($message, $level, $prefix);
+
+		// Do some validation on the type
+		if ($type && in_array($type, $this->types)) {
+			$_type = $type;
+		} else {
+			$_type = $this->type;
+		}
+
+		// Get a name for the level
+		if ($level) {
+			$_level = $this->get_level_from_integer($level);
+		}
+
+		// Setup strings to prepend to some of the types
+		$prepend = $_level . ': ';
+		if ($prefix) {
+			$prepend .= $prefix . ': ';
+		}
+		$pad = str_repeat(' ', strlen($prepend) - 2) . '| ';
+
+		// Switch over the four types
+		switch ($_type) {
+			case 'php':
+				$php_fail = false;
+
+				// Check that the error_log() function is available
+				if (function_exists('error_log') && is_callable('error_log')) {
+					foreach ($lines as $key => $line) {
+						if ($key === 0) {
+							$_prepend = $prepend;
+						} else {
+							$_prepend = $pad;
+						}
+						if (!error_log($_prepend . $line, 0)) {
+							$php_fail = true;
+							break;
+						}
+					}
+				} else {
+					$php_fail = true;
+				}
+
+				if ($php_fail) {
+					// The PHP error log process failed, path of least resistance is to write to display
+					$this->send($message, $level, 'display', $prefix);
+					return;
+				}
+				break;
+
+			case 'file':
+				$file_fail = false;
+
+				// We've already done the prerequisite checks on the file by now so just write to it
+				if (!$file_handle = fopen($this->filename, 'a')) {
+					$file_fail = true;
+				} else {
+					// Prepare a string to write
+					$_lines = array(
+						'[' . date('c') . ']',
+						'[client ' . $_SERVER['REMOTE_ADDR'] . ']',
+						$prepend,
+						join("\n", $lines)
+					);
+				}
+				if (fwrite($file_handle, join(' ', $_lines) . "\n") === false) {
+					$file_fail = true;
+				}
+				if ($file_handle) {
+					fclose($file_handle);
+				}
+				if ($file_fail) {
+					// Writing to file failed, output to display
+					$this->send($message, $level, 'display', $prefix);
+					return;
+				}
+				break;
+
+			case 'display':
+				$_lines = array();
+				foreach ($lines as $key => $line) {
+					if ($key === 0) {
+						$_lines[] = $prepend . $line;
+					} else {
+						$_lines[] = $pad . $line;
+					}
+				}
+				echo '<div class="bplog_message bplog_level_' . strtolower($_level) . '"><pre>' . join("\n", $_lines) . '</pre></div>' . "\n";
+				break;
+
+			case 'console':
+				$_lines = array();
+				foreach ($lines as $key => $line) {
+					if ($key === 0 && $prefix) {
+						$_lines[] = $prefix . ': ' . $line;
+					} else {
+						$_lines[] = $line;
+					}
+				}
+				
+				$_lines = $ident . $_level . ' ~\n' . str_replace('\'', '\\\'', join('\n', $_lines));
+				
+				if (!$this->console_javascript_loaded) {
+					// Queue it for logging onload
+					$this->console_javascript_onloads[] = array('message' => $_lines, 'level' => $level, 'time' => date('c'));
+				} else {
+					// Log it now
+					echo '<script type="text/javascript" charset="utf-8">bp_log_add(\'' . $this->_esc_js_log( $_lines ) . '\', ' . $this->_esc_js_log( $level ) . ', \'' . $this->_esc_js_log( date('c') ) . '\');</script>' . "\n";
+				}
+				break;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Gets the name of the log level from an integer
+	 *
+	 * @return string The logging level
+	 */
+	function get_level_from_integer($integer)
+	{
+		switch ($integer) {
+			case BP_LOG_NONE:
+				return 'BP_LOG_NONE';
+				break;
+			case BP_LOG_FAIL:
+				return 'BP_LOG_FAIL';
+				break;
+			case BP_LOG_ERROR:
+				return 'BP_LOG_ERROR';
+				break;
+			case BP_LOG_WARNING:
+				return 'BP_LOG_WARNING';
+				break;
+			case BP_LOG_NOTICE:
+				return 'BP_LOG_NOTICE';
+				break;
+			case BP_LOG_DEBUG:
+				return 'BP_LOG_DEBUG';
+				break;
+			default:
+				return 'BP_LOG_UNDEFINED';
+				break;
+		}
+	}
+
+	/**
+	 * Formats a message for output to a log file
+	 *
+	 * @return boolean True on success, false on failure
+	 */
+	function format_message($message, $level = BP_LOG_DEBUG, $prefix = false, $tabs = 0)
+	{
+		$lines = array();
+		
+		if (is_null($message)) {
+			$lines[] = 'null (' . var_export($message, true) . ')';
+			return $lines;
+		}
+		
+		if (is_bool($message)) {
+			$lines[] = 'bool (' . var_export($message, true) . ')';
+			return $lines;
+		}
+
+		if (is_string($message)) {
+			if ($level === BP_LOG_DEBUG || $message === '') {
+				$lines[] = 'string(' . strlen($message) . ') ("' . $message . '")';
+			} else {
+				$lines[] = $message;
+			}
+			return $lines;
+		}
+
+		if (is_array($message) || is_object($message)) {
+			if (is_array($message)) {
+				$lines[] = 'array(' . count($message) . ') (';
+			} else {
+				$lines[] = 'object(' . get_class($message) . ') (';
+			}
+			$tabs++;
+			foreach ($message as $key => $value) {
+				$array = $this->format_message($value, $level, false, $tabs);
+				if (is_array($array)) {
+					$array[0] = str_repeat('    ', $tabs) . $key . ' => ' . $array[0];
+					$lines = array_merge($lines, $array);
+				} else {
+					$lines[] = str_repeat('    ', $tabs) . $key . ' => ' . $array;
+				}
+			}
+			$tabs--;
+			$lines[] = str_repeat('    ', $tabs) . ')';
+			return $lines;
+		}
+
+		if (is_int($message)) {
+			$lines[] = 'int (' . $message . ')';
+			return $lines;
+		}
+
+		if (is_float($message)) {
+			$lines[] = 'float (' . $message . ')';
+			return $lines;
+		}
+
+		if (is_resource($message)) {
+			$lines[] = 'resource (' . get_resource_type($message) . ')';
+			return $lines;
+		}
+
+		$lines[] = 'unknown (' . $message . ')';
+		return $lines;
+	}
+
+	/**
+	 * Send a debug message
+	 *
+	 * @return boolean True on success, false on failure
+	 */
+	function debug($message, $prefix = false)
+	{
+		$this->send($message, BP_LOG_DEBUG, false, $prefix);
+	}
+
+	/**
+	 * Send a notice message
+	 *
+	 * If the message is an array, then it sends each index as a separate message
+	 *
+	 * @return boolean True on success, false on failure
+	 */
+	function notice($message)
+	{
+		if (is_array($message)) {
+			foreach ($message as $value) {
+				$this->send($value, BP_LOG_NOTICE);
+			}
+		} else {
+			$this->send($message, BP_LOG_NOTICE);
+		}
+	}
+
+	/**
+	 * Send a warning message
+	 *
+	 * If the message is an array, then it sends each index as a separate message
+	 *
+	 * @return boolean True on success, false on failure
+	 */
+	function warning($message)
+	{
+		if (is_array($message)) {
+			foreach ($message as $value) {
+				$this->send($value, BP_LOG_WARNING);
+			}
+		} else {
+			$this->send($message, BP_LOG_WARNING);
+		}
+	}
+
+	/**
+	 * Send an error message
+	 *
+	 * If the message is an array, then it sends each index as a separate message
+	 *
+	 * @return boolean True on success, false on failure
+	 */
+	function error($message)
+	{
+		if (is_array($message)) {
+			foreach ($message as $value) {
+				$this->send($value, BP_LOG_ERROR);
+			}
+		} else {
+			$this->send($message, BP_LOG_ERROR);
+		}
+	}
+
+	/**
+	 * Send an error message and die
+	 *
+	 * If the message is an array, then it sends each index as a separate message
+	 *
+	 * @return boolean True on success, false on failure
+	 */
+	function fail($message)
+	{
+		if (is_array($message)) {
+			foreach ($message as $value) {
+				$this->send($value, BP_LOG_FAIL);
+			}
+		} else {
+			$this->send($message, BP_LOG_FAIL);
+		}
+
+		die();
+	}
+
+	/**
+	 * Outputs javascript functions for the head of the html document
+	 *
+	 * Must be included in the head of the debug document somehow when using 'console' type.
+	 *
+	 * @return void
+	 **/
+	function console_javascript()
+	{
+		if ($this->type !== 'console') {
+			return;
+		}
+
+		$this->console_javascript_loaded = true;
+?>
+
+	<script type="text/javascript" charset="utf-8">
+		var BP_LOG_NONE    = 0;
+		var BP_LOG_FAIL    = 1;
+		var BP_LOG_ERROR   = 2;
+		var BP_LOG_WARNING = 4;
+		var BP_LOG_NOTICE  = 8;
+		var BP_LOG_DEBUG   = 16;
+		
+		function bp_log_send(message, level, time) {
+			if (window.console) {
+				// Works in later Safari and Firefox with Firebug
+				switch (level) {
+					case BP_LOG_NONE:
+						// This shouldn't happen really
+						break;
+					case BP_LOG_FAIL:
+					case BP_LOG_ERROR:
+						window.console.error("[" + time + "] " + message);
+						break;
+					case BP_LOG_WARNING:
+						window.console.warn("[" + time + "] " + message);
+						break;
+					case BP_LOG_NOTICE:
+						window.console.info("[" + time + "] " + message);
+						break;
+					case BP_LOG_DEBUG:
+						window.console.log("[" + time + "] " + message);
+						break;
+					default:
+						break;
+				}
+			}
+		}
+
+		var bp_log_queue = new Array();
+
+		function bp_log_add(message, level, time) {
+			bp_log_queue.push(new Array(message, level, time));
+		}
+
+		function bp_log_process() {
+			while (item = bp_log_queue.shift()) {
+				bp_log_send(item[0], item[1], item[2]);
+			}
+		}
+
+		function bp_log_onload() {
+<?php
+		foreach ($this->console_javascript_onloads as $onload) {
+			echo "\t\t\t" . 'bp_log_send(\'' . $this->_esc_js_log( $onload['message'] ) . '\', ' . $this->_esc_js_log( $onload['level'] ) . ', \'' . $this->_esc_js_log( $onload['time'] ) . '\');' . "\n";
+		}
+?>
+			bp_log_process();
+		}
+
+		window.onload = bp_log_onload;
+	</script>
+
+<?php
+	}
+
+	function _esc_js_log( $message )
+	{
+		return str_replace(
+			array( '\'', "\n" ),
+			array( '\\\'', '\n' ),
+			$message
+		);
+	}
+	
+} // END class BP_Log
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bp-roles.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bp-roles.php
new file mode 100644
index 0000000000000000000000000000000000000000..95489e2fedd04fc1fa1831a75785ce0942544b07
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bp-roles.php
@@ -0,0 +1,86 @@
+<?php
+
+class BP_Roles {
+	var $role_objects = array();
+	var $role_names = array();
+
+	function BP_Roles() {
+		$this->__construct();
+	}
+
+	function __construct() {
+		do_action_ref_array('init_roles', array(&$this) );
+	}
+
+	function add_role($role, $display_name, $capabilities = '') {
+		if ( isset($this->role_objects[$role]) )
+			return;
+
+		$this->role_objects[$role] = new BP_Role($role, $capabilities, $this);
+		$this->role_names[$role] = $display_name;
+		return $this->role_objects[$role];
+	}
+
+	function remove_role($role) {
+		if ( ! isset($this->role_objects[$role]) )
+			return;
+
+		unset($this->role_objects[$role]);
+		unset($this->role_names[$role]);
+	}
+
+	function add_cap($role, $cap, $grant = true) {
+		if ( isset($this->role_objects[$role]) )
+			$this->role_objects[$role]->add_cap($cap, $grant);
+	}
+
+	function remove_cap($role, $cap) {
+		if ( isset($this->role_objects[$role]) )
+			$this->role_objects[$role]->remove_cap($cap, $grant);
+	}
+
+	function &get_role($role) {
+		if ( isset($this->role_objects[$role]) )
+			return $this->role_objects[$role];
+		else
+			return null;
+	}
+
+	function get_names() {
+		return $this->role_names;
+	}
+
+	function is_role($role) {
+		return isset($this->role_names[$role]);
+	}
+
+	function map_meta_cap( $cap, $user_id ) {
+		$args = array_slice(func_get_args(), 2);
+		return apply_filters( 'map_meta_cap', array( $cap ), $cap, $user_id, $args );
+	}
+}
+
+class BP_Role {
+	var $name;
+	var $capabilities;
+
+	function BP_Role($role, $capabilities) {
+		$this->name = $role;
+		$this->capabilities = $capabilities;
+	}
+
+	function add_cap($cap, $grant = true) {
+		$this->capabilities[$cap] = $grant;
+	}
+
+	function remove_cap($cap) {
+		unset($this->capabilities[$cap]);
+	}
+
+	function has_cap($cap) {
+		$capabilities = apply_filters('role_has_cap', $this->capabilities, $cap, $this->name);
+		$grant = !empty( $capabilities[$cap] );
+		return apply_filters("{$this->name}_has_cap", $grant);
+	}
+
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bp-sql-schema-parser.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bp-sql-schema-parser.php
new file mode 100644
index 0000000000000000000000000000000000000000..86efec038c442a3f67d361af4e0bf93a7ba7ea12
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bp-sql-schema-parser.php
@@ -0,0 +1,615 @@
+<?php
+/**
+ * Parses SQL schema statements for comparison to real table structures
+ *
+ * @package BackPress
+ **/
+class BP_SQL_Schema_Parser
+{
+	/**
+	 * Builds a column definition as used in CREATE TABLE statements from
+	 * an array such as those returned by DESCRIBE `foo` statements
+	 */
+	function get_column_definition( $column_data )
+	{
+		if ( !is_array( $column_data ) ) {
+			return $column_data;
+		}
+
+		$null = '';
+		if ( $column_data['Null'] == 'NO' ) {
+			$null = 'NOT NULL';
+		}
+
+		$default = '';
+
+		// Defaults aren't allowed at all on certain column types
+		if ( !in_array(
+			strtolower( $column_data['Type'] ),
+			array( 'tinytext', 'text', 'mediumtext', 'longtext', 'blob', 'mediumblob', 'longblob' )
+		) ) {
+			if ( $column_data['Null'] == 'YES' && $column_data['Default'] === null ) {
+				$default = 'default NULL';
+			} elseif ( preg_match( '@^\d+$@', $column_data['Default'] ) ) {
+				$default = 'default ' . $column_data['Default'];
+			} elseif ( is_string( $column_data['Default'] ) || is_float( $column_data['Default'] ) ) {
+				$default = 'default \'' . $column_data['Default'] . '\'';
+			}
+		}
+
+		$column_definition = '`' . $column_data['Field'] . '` ' . $column_data['Type'] . ' ' . $null . ' ' . $column_data['Extra'] . ' ' . $default;
+		return preg_replace( '@\s+@', ' ', trim( $column_definition ) );
+	}
+
+	/**
+	 * Builds an index definition as used in CREATE TABLE statements from
+	 * an array similar to those returned by SHOW INDEX FROM `foo` statements
+	 */
+	function get_index_definition( $index_data )
+	{
+		if ( !is_array( $index_data ) ) {
+			return $index_data;
+		}
+
+		if ( !count( $index_data ) ) {
+			return $index_data;
+		}
+
+		$_name = '`' . $index_data[0]['Key_name'] . '`';
+
+		if ( $index_data[0]['Index_type'] == 'BTREE' && $index_data[0]['Key_name'] == 'PRIMARY' ) {
+			$_type = 'PRIMARY KEY';
+			$_name = '';
+		} elseif ( $index_data[0]['Index_type'] == 'BTREE' && !$index_data[0]['Non_unique'] ) {
+			$_type = 'UNIQUE KEY';
+		} elseif ( $index_data[0]['Index_type'] == 'FULLTEXT' ) {
+			$_type = 'FULLTEXT KEY';
+		} else {
+			$_type = 'KEY';
+		}
+
+		$_columns = array();
+		foreach ( $index_data as $_index ) {
+			if ( $_index['Sub_part'] ) {
+				$_columns[] = '`' . $_index['Column_name'] . '`(' . $_index['Sub_part'] . ')';
+			} else {
+				$_columns[] = '`' . $_index['Column_name'] . '`';
+			}
+		}
+		$_columns = join( ', ', $_columns );
+
+		$index_definition = $_type . ' ' . $_name . ' (' . $_columns . ')';
+		return preg_replace( '@\s+@', ' ', $index_definition );
+	}
+
+	/**
+	 * Returns a table structure from a raw sql query of the form "CREATE TABLE foo" etc.
+	 * The resulting array contains the original query, the columns as would be returned by DESCRIBE `foo`
+	 * and the indices as would be returned by SHOW INDEX FROM `foo` on a real table
+	 */
+	function describe_table( $query )
+	{
+		// Retrieve the table structure from the query
+		if ( !preg_match( '@^CREATE\s+TABLE(\s+IF\s+NOT\s+EXISTS)?\s+`?([^\s|`]+)`?\s+\((.*)\)\s*([^\)|;]*)\s*;?@ims', $query, $_matches ) ) {
+			return $query;
+		}
+
+		$_if_not_exists = $_matches[1];
+
+		// Tidy up the table name
+		$_table_name = trim( $_matches[2] );
+
+		// Tidy up the table columns/indices
+		$_columns_indices = trim( $_matches[3], " \t\n\r\0\x0B," );
+		// Split by commas not followed by a closing parenthesis ")", using fancy lookaheads
+		$_columns_indices = preg_split( '@,(?!(?:[^\(]+\)))@ms', $_columns_indices );
+		$_columns_indices = array_map( 'trim', $_columns_indices );
+
+		// Tidy the table attributes
+		$_attributes = preg_replace( '@\s+@', ' ', trim( $_matches[4] ) );
+		unset( $_matches );
+
+		// Initialise some temporary arrays
+		$_columns = array();
+		$_indices = array();
+
+		// Loop over the columns/indices
+		foreach ( $_columns_indices as $_column_index ) {
+			if ( preg_match( '@^(PRIMARY\s+KEY|UNIQUE\s+(?:KEY|INDEX)|FULLTEXT\s+(?:KEY|INDEX)|KEY|INDEX)\s+(?:`?(\w+)`?\s+)*\((.+?)\)$@im', $_column_index, $_matches ) ) {
+				// It's an index
+
+				// Tidy the type
+				$_index_type = strtoupper( preg_replace( '@\s+@', ' ', trim( $_matches[1] ) ) );
+				$_index_type = str_replace( 'INDEX', 'KEY', $_index_type );
+				// Set the index name
+				$_index_name = ( 'PRIMARY KEY' == $_matches[1] ) ? 'PRIMARY' : $_matches[2];
+				// Split into columns
+				$_index_columns = array_map( 'trim', explode( ',', $_matches[3] ) );
+
+				foreach ( $_index_columns as $_index_columns_index => $_index_column ) {
+					preg_match( '@`?(\w+)`?(?:\s*\(\s*(\d+)\s*\))?@i', $_index_column, $_matches_column );
+
+					$_indices[$_index_name][] = array(
+						'Table'        => $_table_name,
+						'Non_unique'   => ( 'UNIQUE KEY' == $_index_type || 'PRIMARY' == $_index_name ) ? '0' : '1',
+						'Key_name'     => $_index_name,
+						'Seq_in_index' => (string) ( $_index_columns_index + 1 ),
+						'Column_name'  => $_matches_column[1],
+						'Sub_part'     => ( isset( $_matches_column[2] ) && $_matches_column[2] ) ? $_matches_column[2] : null,
+						'Index_type'   => ( 'FULLTEXT KEY' == $_index_type ) ? 'FULLTEXT' : 'BTREE'
+					);
+				}
+				unset( $_index_type, $_index_name, $_index_columns, $_index_columns_index, $_index_column, $_matches_column );
+
+			} elseif ( preg_match( "@^`?(\w+)`?\s+(?:(\w+)(?:\s*\(\s*(\d+)\s*\))?(?:\s+(unsigned)){0,1})(?:\s+(NOT\s+NULL))?(?:\s+(auto_increment))?(?:\s+(default)\s+(?:(NULL|'[^']*'|\d+)))?@im", $_column_index, $_matches ) ) {
+				// It's a column
+
+				// Tidy the NOT NULL
+				$_matches[5] = isset( $_matches[5] ) ? strtoupper( preg_replace( '@\s+@', ' ', trim( $_matches[5] ) ) ) : '';
+
+				$_columns[$_matches[1]] = array(
+					'Field'   => $_matches[1],
+					'Type'    => ( is_numeric( $_matches[3] ) ) ? $_matches[2] . '(' . $_matches[3] . ')' . ( ( isset( $_matches[4] ) && strtolower( $_matches[4] ) == 'unsigned' ) ? ' unsigned' : '' ) : $_matches[2],
+					'Null'    => ( 'NOT NULL' == strtoupper( $_matches[5] ) ) ? 'NO' : 'YES',
+					'Default' => ( isset( $_matches[7] ) && 'default' == strtolower( $_matches[7] ) && 'NULL' !== strtoupper( $_matches[8] ) ) ? trim( $_matches[8], "'" ) : null,
+					'Extra'   => ( isset( $_matches[6] ) && 'auto_increment' == strtolower( $_matches[6] ) ) ? 'auto_increment' : ''
+				);
+			}
+		}
+		unset( $_matches, $_columns_indices, $_column_index );
+
+		// Tidy up the original query
+		$_tidy_query = 'CREATE TABLE';
+		if ( $_if_not_exists ) {
+			$_tidy_query .= ' IF NOT EXISTS';
+		}
+		$_tidy_query .= ' `' . $_table_name . '` (' . "\n";
+		foreach ( $_columns as $_column ) {
+			$_tidy_query .= "\t" . BP_SQL_Schema_Parser::get_column_definition( $_column ) . ",\n";
+		}
+		unset( $_column );
+		foreach ( $_indices as $_index ) {
+			$_tidy_query .= "\t" . BP_SQL_Schema_Parser::get_index_definition( $_index ) . ",\n";
+		}
+		$_tidy_query = substr( $_tidy_query, 0, -2 ) . "\n" . ') ' . $_attributes . ';';
+
+		// Add to the query array using the table name as the index
+		$description = array(
+			'query_original' => $query,
+			'query_tidy' => $_tidy_query,
+			'columns' => $_columns,
+			'indices' => $_indices
+		);
+		unset( $_table_name, $_columns, $_indices, $_tidy_query );
+
+		return $description;
+	}
+
+	/**
+	 * Helper function to flatten arrays
+	 */
+	function _flatten_array( $array, $cut_branch = 0, $keep_child_array_keys = true )
+	{
+		if ( !is_array( $array ) ) {
+			return $array;
+		}
+
+		if ( empty( $array ) ) {
+			return null;
+		}
+
+		$temp = array();
+		foreach ( $array as $k => $v ) {
+			if ( $cut_branch && $k == $cut_branch )
+				continue;
+			if ( is_array( $v ) ) {
+				if ( $keep_child_array_keys ) {
+					$temp[$k] = true;
+				}
+				$temp += BP_SQL_Schema_Parser::_flatten_array( $v, $cut_branch, $keep_child_array_keys );
+			} else {
+				$temp[$k] = $v;
+			}
+		}
+		return $temp;
+	}
+
+	/**
+	 * Splits grouped SQL statements into queries within a highly structured array
+	 * Only supports CREATE TABLE, INSERT and UPDATE
+	 */
+	function parse( $sql )
+	{
+		// Only accept strings or arrays
+		if ( is_string( $sql ) ) {
+			// Just pop strings into an array to start with
+			$queries = array( $sql );
+		} elseif ( is_array( $sql ) ) {
+			// Flatten the array
+			$queries = BP_SQL_Schema_Parser::_flatten_array( $sql, 0, false );
+			// Remove empty nodes
+			$queries = array_filter( $queries );
+		} else {
+			return false;
+		}
+
+		// Clean up the queries
+		$_clean_queries = array();
+		foreach ( $queries as $_query ) {
+			// Trim space and semi-colons
+			$_query = trim( $_query, "; \t\n\r\0\x0B" );
+			// If it exists and isn't a number
+			if ( $_query && !is_numeric( $_query ) ) {
+				// Is it more than one query?
+				if ( strpos( ';', $_query ) !== false ) {
+					// Explode by semi-colon
+					foreach ( explode( ';', $_query ) as $_part ) {
+						$_part = trim( $_part );
+						if ( $_part && !is_numeric( $_part ) ) {
+							// Pull out any commented code
+							// Can't properly deal with /*!4321 FOO `bar` */ version specific inclusion, just includes it regardless of version
+							$_part = preg_replace( '@/\*![0-9]*([^\*]*)\*/@', '$1', $_part );
+							$_part = preg_replace( '@/\*[^\*]*\*/@', '', $_part );
+							$_part = preg_replace( '@[\-\-|#].*$@m', '', $_part );
+							$_clean_queries[] = trim( $_part ) . ';';
+						}
+					}
+					unset( $_part );
+				} else {
+					$_clean_queries[] = $_query . ';';
+				}
+			}
+		}
+		unset( $_query );
+		if ( !count( $_clean_queries ) ) {
+			return false;
+		}
+		$queries = $_clean_queries;
+		unset( $_clean_queries );
+
+		$_queries = array();
+		foreach ( $queries as $_query ) {
+			// Only process table creation, inserts and updates, capture the table/database name while we are at it
+			if ( !preg_match( '@^(CREATE\s+TABLE(?:\s+IF\s+NOT\s+EXISTS)?|INSERT\s+INTO|UPDATE)\s+`?([^\s|`]+)`?@im', $_query, $_matches ) ) {
+				continue;
+			}
+
+			// Tidy up the type so we can switch it
+			$_type = strtoupper( preg_replace( '@\s+@', ' ', trim( $_matches[1] ) ) );
+			$_table_name = trim( $_matches[2] );
+			unset( $_matches );
+
+			switch ( $_type ) {
+				case 'CREATE TABLE':
+				case 'CREATE TABLE IF NOT EXISTS':
+					$_description = BP_SQL_Schema_Parser::describe_table( $_query );
+					if ( is_array( $_description ) ) {
+						$_queries['tables'][$_table_name] = $_description;
+					}
+					break;
+
+				case 'INSERT INTO':
+					// Just add the query as is for now
+					$_queries['insert'][$_table_name][] = $_query;
+					break;
+
+				case 'UPDATE':
+					// Just add the query as is for now
+					$_queries['update'][$_table_name][] = $_query;
+					break;
+			}
+			unset( $_type, $_table_name );
+		}
+		unset( $_query );
+
+		if ( !count( $_queries ) ) {
+			return false;
+		}
+		return $_queries;
+	}
+
+	/**
+	 * Evaluates the difference between a given set of SQL queries and real database structure
+	 */
+	function delta( $db_object, $queries, $ignore = false, $execute = true )
+	{
+		if ( !$db_object || !is_object( $db_object ) || !( is_a( $db_object, 'BPDB' ) || is_a( $db_object, 'BPDB_Multi' ) || is_a( $db_object, 'BPDB_Hyper' ) ) ) {
+			return __( 'Passed variable is not a BackPress database object.' );
+		}
+
+		if ( !$_queries = BP_SQL_Schema_Parser::parse( $queries ) ) {
+			return __( 'No schema available.' );
+		}
+
+		// Set up default elements to ignore
+		$ignore_defaults = array(
+			'tables'  => array(), // Just a list of tablenames, including prefix. Does not affect INSERT and UPDATE queries.
+			'columns' => array(), // Arrays of column names, keyed with the table names, including prefix.
+			'indices' => array()  // Arrays of index names, keyed with the table names, including prefix.
+		);
+
+		// Add the elements to ignore that were passed to the function
+		if ( !$ignore || !is_array( $ignore ) ) {
+			$ignore = $ignore_defaults;
+		} else {
+			if ( isset( $ignore['tables'] ) && is_array( $ignore['tables'] ) ) {
+				$ignore['tables'] = array_merge( $ignore_defaults['tables'], $ignore['tables'] );
+			}
+			if ( isset( $ignore['columns'] ) && is_array( $ignore['columns'] ) ) {
+				$ignore['columns'] = array_merge( $ignore_defaults['columns'], $ignore['columns'] );
+			}
+			if ( isset( $ignore['indices'] ) && is_array( $ignore['indices'] ) ) {
+				$ignore['indices'] = array_merge( $ignore_defaults['indices'], $ignore['indices'] );
+			}
+		}
+
+		// Build an array of $db_object registered tables and their database identifiers
+		$_tables = $db_object->tables;
+		$db_object_tables = array();
+		foreach ( $_tables as $_table_id => $_table_name ) {
+			if ( is_array( $_table_name ) && isset( $db_object->db_servers['dbh_' . $_table_name[0]] ) ) {
+				$db_object_tables[$db_object->$_table_id] = 'dbh_' . $_table_name[0];
+			} else {
+				$db_object_tables[$db_object->$_table_id] = 'dbh_global';
+			}
+		}
+		unset( $_tables, $_table_id, $_table_name );
+
+		$alterations = array();
+
+		// Loop through table queries
+		if ( isset( $_queries['tables'] ) ) {
+			foreach ( $_queries['tables'] as $_new_table_name => $_new_table_data ) {
+				if ( in_array( $_new_table_name, $ignore['tables'] ) ) {
+					continue;
+				}
+
+				// See if the table is custom and registered in $db_object under a custom database
+				if (
+					isset( $db_object_tables[$_new_table_name] ) &&
+					$db_object_tables[$_new_table_name] != 'dbh_global' &&
+					isset( $db_object->db_servers[$db_object_tables[$_new_table_name]]['ds'] )
+				) {
+					// Force the database connection
+					$_dbhname = $db_object->db_servers[$db_object_tables[$_new_table_name]]['ds'];
+					$db_object->_force_dbhname = $_dbhname;
+				} else {
+					$_dbhname = 'dbh_global';
+				}
+
+				// Fetch the existing table column structure from the database
+				$db_object->suppress_errors();
+				if ( !$_existing_table_columns = $db_object->get_results( 'DESCRIBE `' . $_new_table_name . '`;', ARRAY_A ) ) {
+					$db_object->suppress_errors( false );
+					// The table doesn't exist, add it and then continue to the next table
+					$alterations[$_dbhname][$_new_table_name][] = array(
+						'action' => 'create_table',
+						'message' => __( 'Creating table' ),
+						'query' => $_new_table_data['query_tidy']
+					);
+					continue;
+				}
+				$db_object->suppress_errors( false );
+
+				// Add an index to the existing columns array
+				$__existing_table_columns = array();
+				foreach ( $_existing_table_columns as $_existing_table_column ) {
+					// Remove 'Key' from returned column structure
+					unset( $_existing_table_column['Key'] );
+					$__existing_table_columns[$_existing_table_column['Field']] = $_existing_table_column;
+				}
+				$_existing_table_columns = $__existing_table_columns;
+				unset( $__existing_table_columns );
+
+				// Loop over the columns in this table and look for differences
+				foreach ( $_new_table_data['columns'] as $_new_column_name => $_new_column_data ) {
+					if ( isset( $ignore['columns'][$_new_table_name] ) && in_array( $_new_column_name, $ignore['columns'][$_new_table_name] ) ) {
+						continue;
+					}
+
+					if ( !in_array( $_new_column_data, $_existing_table_columns ) ) {
+						// There is a difference
+						if ( !isset( $_existing_table_columns[$_new_column_name] ) ) {
+							// The column doesn't exist, so add it
+							$alterations[$_dbhname][$_new_table_name][] = array(
+								'action' => 'add_column',
+								'message' => sprintf( __( 'Adding column: %s' ), $_new_column_name ),
+								'column' => $_new_column_name,
+								'query' => 'ALTER TABLE `' . $_new_table_name . '` ADD COLUMN ' . BP_SQL_Schema_Parser::get_column_definition( $_new_column_data ) . ';'
+							);
+							continue;
+						}
+
+						// Adjust defaults on columns that allow defaults
+						if (
+							$_new_column_data['Default'] !== $_existing_table_columns[$_new_column_name]['Default'] &&
+							!in_array(
+								strtolower( $_new_column_data['Type'] ),
+								array( 'tinytext', 'text', 'mediumtext', 'longtext', 'blob', 'mediumblob', 'longblob' )
+							)
+						) {
+							// Change the default value for the column
+							$alterations[$_dbhname][$_new_table_name][] = array(
+								'action' => 'set_default',
+								'message' => sprintf( __( 'Setting default on column: %s' ), $_new_column_name ),
+								'column' => $_new_column_name,
+								'query' => 'ALTER TABLE `' . $_new_table_name . '` ALTER COLUMN `' . $_new_column_name . '` SET DEFAULT \'' . $_new_column_data['Default'] . '\';'
+							);
+							// Don't continue, overwrite this if the next conditional is met
+						}
+
+						if (
+							$_new_column_data['Type'] !== $_existing_table_columns[$_new_column_name]['Type'] ||
+							$_new_column_data['Null'] !== $_existing_table_columns[$_new_column_name]['Null'] ||
+							$_new_column_data['Extra'] !== $_existing_table_columns[$_new_column_name]['Extra']
+						) {
+							// Change the structure for the column
+							$alterations[$_dbhname][$_new_table_name][] = array(
+								'action' => 'change_column',
+								'message' => sprintf( __( 'Changing column: %s' ), $_new_column_name ),
+								'column' => $_new_column_name,
+								'query' => 'ALTER TABLE `' . $_new_table_name . '` CHANGE COLUMN `' . $_new_column_name . '` ' . BP_SQL_Schema_Parser::get_column_definition( $_new_column_data ) . ';'
+							);
+						}
+					}
+				}
+				unset( $_existing_table_columns, $_new_column_name, $_new_column_data );
+
+				// Fetch the table index structure from the database
+				if ( !$_existing_table_indices = $db_object->get_results( 'SHOW INDEX FROM `' . $_new_table_name . '`;', ARRAY_A ) ) {
+					continue;
+				}
+
+				// Add an index to the existing columns array and organise by index name
+				$__existing_table_indices = array();
+				foreach ( $_existing_table_indices as $_existing_table_index ) {
+					// Remove unused parts from returned index structure
+					unset(
+						$_existing_table_index['Collation'],
+						$_existing_table_index['Cardinality'],
+						$_existing_table_index['Packed'],
+						$_existing_table_index['Null'],
+						$_existing_table_index['Comment']
+					);
+					$__existing_table_indices[$_existing_table_index['Key_name']][] = $_existing_table_index;
+				}
+				$_existing_table_indices = $__existing_table_indices;
+				unset( $__existing_table_indices );
+
+				// Loop over the indices in this table and look for differences
+				foreach ( $_new_table_data['indices'] as $_new_index_name => $_new_index_data ) {
+					if ( isset( $ignore['indices'][$_new_table_name] ) && in_array( $_new_index_name, $ignore['indices'][$_new_table_name] ) ) {
+						continue;
+					}
+
+					if ( !in_array( $_new_index_data, $_existing_table_indices ) ) {
+						// There is a difference
+						if ( !isset( $_existing_table_indices[$_new_index_name] ) ) {
+							// The index doesn't exist, so add it
+							$alterations[$_dbhname][$_new_table_name][] = array(
+								'action' => 'add_index',
+								'message' => sprintf( __( 'Adding index: %s' ), $_new_index_name ),
+								'index' => $_new_index_name,
+								'query' => 'ALTER TABLE `' . $_new_table_name . '` ADD ' . BP_SQL_Schema_Parser::get_index_definition( $_new_index_data ) . ';'
+							);
+							continue;
+						}
+
+						if ( $_new_index_data !== $_existing_table_indices[$_new_index_name] ) {
+							// The index is incorrect, so drop it and add the new one
+							if ( $_new_index_name == 'PRIMARY' ) {
+								$_drop_index_name = 'PRIMARY KEY';
+							} else {
+								$_drop_index_name = 'INDEX `' . $_new_index_name . '`';
+							}
+							$alterations[$_dbhname][$_new_table_name][] = array(
+								'action' => 'drop_index',
+								'message' => sprintf( __( 'Dropping index: %s' ), $_new_index_name ),
+								'index' => $_new_index_name,
+								'query' => 'ALTER TABLE `' . $_new_table_name . '` DROP ' . $_drop_index_name . ';'
+							);
+							unset( $_drop_index_name );
+							$alterations[$_dbhname][$_new_table_name][] = array(
+								'action' => 'add_index',
+								'message' => sprintf( __( 'Adding index: %s' ), $_new_index_name ),
+								'index' => $_new_index_name,
+								'query' => 'ALTER TABLE `' . $_new_table_name . '` ADD ' . BP_SQL_Schema_Parser::get_index_definition( $_new_index_data ) . ';'
+							);
+						}
+					}
+				}
+				unset( $_new_index_name, $_new_index_data );
+
+				// Go back to the default database connection
+				$db_object->_force_dbhname = false;
+			}
+			unset( $_new_table_name, $_new_table_data, $_dbhname );
+		}
+
+		// Now deal with the sundry INSERT and UPDATE statements (if any)
+		if ( isset( $_queries['insert'] ) && is_array( $_queries['insert'] ) && count( $_queries['insert'] ) ) {
+			foreach ( $_queries['insert'] as $_table_name => $_inserts ) {
+				foreach ( $_inserts as $_insert ) {
+					$alterations['dbh_global'][$_table_name][] = array(
+						'action' => 'insert',
+						'message' => __( 'Inserting data' ),
+						'query' => $_insert
+					);
+				}
+				unset( $_insert );
+			}
+			unset( $_table_name, $_inserts );
+		}
+		if ( isset( $_queries['update'] ) && is_array( $_queries['update'] ) && count( $_queries['update'] ) ) {
+			foreach ( $_queries['update'] as $_table_name => $_updates ) {
+				foreach ( $_updates as $_update ) {
+					$alterations['dbh_global'][$_table_name][] = array(
+						'action' => 'update',
+						'message' => __( 'Updating data' ),
+						'query' => $_update
+					);
+				}
+				unset( $_update );
+			}
+			unset( $_table_name, $_updates );
+		}
+
+		// Initialise an array to hold the output messages
+		$messages = array();
+		$errors = array();
+
+		foreach ( $alterations as $_dbhname => $_tables ) {
+			// Force the database connection (this was already checked to be valid in the previous loop)
+			$db_object->_force_dbhname = $_dbhname;
+
+			// Note the database in the return messages
+			$messages[] = '>>> ' . sprintf( __( 'Modifying database: %s (%s)' ), $db_object->db_servers[$_dbhname]['name'], $db_object->db_servers[$_dbhname]['host'] );
+
+			foreach ( $_tables as $_table_name => $_alterations ) {
+				// Note the table in the return messages
+				$messages[] = '>>>>>> ' . sprintf( __( 'Table: %s' ), $_table_name );
+
+				foreach ( $_alterations as $_alteration ) {
+					// If there is no query, then skip
+					if ( !$_alteration['query'] ) {
+						continue;
+					}
+
+					// Note the action in the return messages
+					$messages[] = '>>>>>>>>> ' . $_alteration['message'];
+
+					if ( !$execute ) {
+						$messages[] = '>>>>>>>>>>>> ' . __( 'Skipped' );
+						continue;
+					}
+
+					// Run the query
+					$_result = $db_object->query( $_alteration['query'] );
+					$_result_error = $db_object->get_error();
+
+					if ( $_result_error ) {
+						// There was an error
+						$_result =& $_result_error;
+						unset( $_result_error );
+						$messages[] = '>>>>>>>>>>>> ' . __( 'SQL ERROR! See the error log for more detail' );
+						$errors[] = __( 'SQL ERROR!' );
+						$errors[] = '>>> ' . sprintf( __( 'Database: %s (%s)' ), $db_object->db_servers[$_dbhname]['name'], $db_object->db_servers[$_dbhname]['host'] );
+						$errors[] = '>>>>>> ' . $_result->error_data['db_query']['query'];
+						$errors[] = '>>>>>> ' . $_result->error_data['db_query']['error'];
+					} else {
+						$messages[] = '>>>>>>>>>>>> ' . __( 'Done' );
+					}
+					unset( $_result );
+				}
+				unset( $_alteration );
+			}
+			unset( $_table_name, $_alterations );
+		}
+		unset( $_dbhname, $_tables );
+
+		// Reset the database connection
+		$db_object->_force_dbhname = false;
+
+		return array( 'messages' => $messages, 'errors' => $errors );
+	}
+} // END class BP_SQL_Schema_Parser
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bp-user.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bp-user.php
new file mode 100644
index 0000000000000000000000000000000000000000..356e2bc4e2a3f0a36134950b4cab57e8de130c8f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bp-user.php
@@ -0,0 +1,398 @@
+<?php
+// Last sync [WP11537]
+
+/**
+ * BackPress User class.
+ *
+ * @since 2.0.0
+ * @package BackPress
+ * @subpackage User
+ */
+class BP_User {
+	/**
+	 * User data container.
+	 *
+	 * This will be set as properties of the object.
+	 *
+	 * @since 2.0.0
+	 * @access private
+	 * @var array
+	 */
+	var $data;
+
+	/**
+	 * The user's ID.
+	 *
+	 * @since 2.1.0
+	 * @access public
+	 * @var int
+	 */
+	var $ID = 0;
+
+	/**
+	 * The deprecated user's ID.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @deprecated Use BP_User::$ID
+	 * @see BP_User::$ID
+	 * @var int
+	 */
+	var $id = 0;
+
+	/**
+	 * The individual capabilities the user has been given.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @var array
+	 */
+	var $caps = array();
+
+	/**
+	 * User metadata option name.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @var string
+	 */
+	var $cap_key;
+
+	/**
+	 * The roles the user is part of.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @var array
+	 */
+	var $roles = array();
+
+	/**
+	 * All capabilities the user has, including individual and role based.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @var array
+	 */
+	var $allcaps = array();
+
+	/**
+	 * First name of the user.
+	 *
+	 * Created to prevent notices.
+	 *
+	 * @since 2.7.0
+	 * @access public
+	 * @var string
+	 */
+	var $first_name = '';
+
+	/**
+	 * Last name of the user.
+	 *
+	 * Created to prevent notices.
+	 *
+	 * @since 2.7.0
+	 * @access public
+	 * @var string
+	 */
+	var $last_name = '';
+
+	/**
+	 * PHP4 Constructor - Sets up the object properties.
+	 *
+	 * Retrieves the userdata and then assigns all of the data keys to direct
+	 * properties of the object. Calls {@link BP_User::_init_caps()} after
+	 * setting up the object's user data properties.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 *
+	 * @param int|string $id User's ID or username
+	 * @param int $name Optional. User's username
+	 * @return BP_User
+	 */
+	function BP_User( $id, $name = '' ) {
+		global $wp_users_object;
+
+		if ( empty( $id ) && empty( $name ) )
+			return;
+
+		if ( ! is_numeric( $id ) ) {
+			$name = $id;
+			$id = 0;
+		}
+
+		if ( ! empty( $id ) )
+			$this->data = $wp_users_object->get_user( $id );
+		else
+			$this->data = $wp_users_object->get_user( $name, array( 'by' => 'login' ) );
+
+		if ( empty( $this->data->ID ) )
+			return;
+
+		foreach ( get_object_vars( $this->data ) as $key => $value ) {
+			$this->{$key} = $value;
+		}
+
+		$this->id = $this->ID;
+		$this->_init_caps();
+	}
+
+	/**
+	 * Setup capability object properties.
+	 *
+	 * Will set the value for the 'cap_key' property to current database table
+	 * prefix, followed by 'capabilities'. Will then check to see if the
+	 * property matching the 'cap_key' exists and is an array. If so, it will be
+	 * used.
+	 *
+	 * @since 2.1.0
+	 * @access protected
+	 */
+	function _init_caps() {
+		global $wp_users_object;
+		$this->cap_key = $wp_users_object->db->prefix . 'capabilities';
+		$this->caps = &$this->{$this->cap_key};
+		if ( ! is_array( $this->caps ) )
+			$this->caps = array();
+		$this->get_role_caps();
+	}
+
+	/**
+	 * Retrieve all of the role capabilities and merge with individual capabilities.
+	 *
+	 * All of the capabilities of the roles the user belongs to are merged with
+	 * the users individual roles. This also means that the user can be denied
+	 * specific roles that their role might have, but the specific user isn't
+	 * granted permission to.
+	 *
+	 * @since 2.0.0
+	 * @uses $wp_roles
+	 * @access public
+	 */
+	function get_role_caps() {
+		global $wp_roles, $wp_users_object;
+
+		if ( ! isset( $wp_roles ) )
+			$wp_roles = new BP_Roles( $wp_users_object->db );
+
+		//Filter out caps that are not role names and assign to $this->roles
+		if ( is_array( $this->caps ) )
+			$this->roles = array_filter( array_keys( $this->caps ), array( &$wp_roles, 'is_role' ) );
+
+		//Build $allcaps from role caps, overlay user's $caps
+		$this->allcaps = array();
+		foreach ( (array) $this->roles as $role ) {
+			$role =& $wp_roles->get_role( $role );
+			$this->allcaps = array_merge( (array) $this->allcaps, (array) $role->capabilities );
+		}
+		$this->allcaps = array_merge( (array) $this->allcaps, (array) $this->caps );
+	}
+
+	/**
+	 * Add role to user.
+	 *
+	 * Updates the user's meta data option with capabilities and roles.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 *
+	 * @param string $role Role name.
+	 */
+	function add_role( $role ) {
+		$this->caps[$role] = true;
+		$this->update_user();
+	}
+
+	/**
+	 * Remove role from user.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 *
+	 * @param string $role Role name.
+	 */
+	function remove_role( $role ) {
+		if ( empty( $this->caps[$role] ) || ( count( $this->caps ) <= 1 ) )
+			return;
+		unset( $this->caps[$role] );
+		$this->update_user();
+	}
+
+	/**
+	 * Set the role of the user.
+	 *
+	 * This will remove the previous roles of the user and assign the user the
+	 * new one. You can set the role to an empty string and it will remove all
+	 * of the roles from the user.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 *
+	 * @param string $role Role name.
+	 */
+	function set_role( $role ) {
+		foreach ( (array) $this->roles as $oldrole )
+			unset( $this->caps[$oldrole] );
+		if ( !empty( $role ) ) {
+			$this->caps[$role] = true;
+			$this->roles = array( $role => true );
+		} else {
+			$this->roles = false;
+		}
+		$this->update_user();
+	}
+
+	function update_user() {
+		global $wp_users_object;
+		$wp_users_object->update_meta( array( 'id' => $this->ID, 'meta_key' => $this->cap_key, 'meta_value' => $this->caps ) );
+		$this->get_role_caps();
+		//$this->update_user_level_from_caps(); // WP
+	}
+
+	/**
+	 * Choose the maximum level the user has.
+	 *
+	 * Will compare the level from the $item parameter against the $max
+	 * parameter. If the item is incorrect, then just the $max parameter value
+	 * will be returned.
+	 *
+	 * Used to get the max level based on the capabilities the user has. This
+	 * is also based on roles, so if the user is assigned the Administrator role
+	 * then the capability 'level_10' will exist and the user will get that
+	 * value.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 *
+	 * @param int $max Max level of user.
+	 * @param string $item Level capability name.
+	 * @return int Max Level.
+	 */
+/*
+	function level_reduction( $max, $item ) {
+		if ( preg_match( '/^level_(10|[0-9])$/i', $item, $matches ) ) {
+			$level = intval( $matches[1] );
+			return max( $max, $level );
+		} else {
+			return $max;
+		}
+	}
+*/
+
+	/**
+	 * Update the maximum user level for the user.
+	 *
+	 * Updates the 'user_level' user metadata (includes prefix that is the
+	 * database table prefix) with the maximum user level. Gets the value from
+	 * the all of the capabilities that the user has.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 */
+/*
+	function update_user_level_from_caps() {
+		global $wp_users_object;
+		$this->user_level = array_reduce( array_keys( $this->allcaps ), array( &$this, 'level_reduction' ), 0 );
+		update_usermeta( $this->ID, $wpdb->prefix.'user_level', $this->user_level );
+	}
+*/
+
+/*
+	function translate_level_to_cap($level) {
+		return 'level_' . $level;
+	}
+*/
+
+	/**
+	 * Add capability and grant or deny access to capability.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 *
+	 * @param string $cap Capability name.
+	 * @param bool $grant Whether to grant capability to user.
+	 */
+	function add_cap( $cap, $grant = true ) {
+		$this->caps[$cap] = $grant;
+		$this->update_user();
+	}
+
+	/**
+	 * Remove capability from user.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 *
+	 * @param string $cap Capability name.
+	 */
+	function remove_cap( $cap ) {
+		if ( empty( $this->caps[$cap] ) ) return;
+		unset( $this->caps[$cap] );
+		$this->update_user();
+	}
+
+	/**
+	 * Remove all of the capabilities of the user.
+	 *
+	 * @since 2.1.0
+	 * @access public
+	 */
+	function remove_all_caps() {
+		global $wp_users_object;
+		$this->caps = array();
+		$wp_users_object->delete_meta( $this->ID, $this->cap_key );
+		$this->get_role_caps();
+	}
+
+	/**
+	 * Whether user has capability or role name.
+	 *
+	 * This is useful for looking up whether the user has a specific role
+	 * assigned to the user. The second optional parameter can also be used to
+	 * check for capabilities against a specfic post.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 *
+	 * @param string|int $cap Capability or role name to search.
+	 * @param int $post_id Optional. Post ID to check capability against specific post.
+	 * @return bool True, if user has capability; false, if user does not have capability.
+	 */
+	function has_cap( $cap ) {
+		global $wp_roles;
+
+		if ( is_numeric( $cap ) )
+			$cap = $this->translate_level_to_cap( $cap );
+
+		$args = array_slice( func_get_args(), 1 );
+		$args = array_merge( array( $cap, $this->ID ), $args );
+		$caps = call_user_func_array( array(&$wp_roles, 'map_meta_cap'), $args );
+		// Must have ALL requested caps
+		$capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args );
+		foreach ( (array) $caps as $cap ) {
+			//echo "Checking cap $cap<br />";
+			if ( empty( $capabilities[$cap] ) || !$capabilities[$cap] )
+				return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Convert numeric level to level capability name.
+	 *
+	 * Prepends 'level_' to level number.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 *
+	 * @param int $level Level number, 1 to 10.
+	 * @return string
+	 */
+	function translate_level_to_cap( $level ) {
+		return 'level_' . $level;
+	}
+
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bpdb-multi.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bpdb-multi.php
new file mode 100644
index 0000000000000000000000000000000000000000..fb5027f737395903a857c57f57de62a4d02abf4c
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bpdb-multi.php
@@ -0,0 +1,196 @@
+<?php
+//  backPress Multi DB Class
+
+//  ORIGINAL CODE FROM:
+//  Justin Vincent (justin@visunet.ie)
+//	http://php.justinvincent.com
+
+require( BACKPRESS_PATH . 'class.bpdb.php' );
+
+class BPDB_Multi extends BPDB {
+	/**
+	 * Associative array (dbhname => dbh) for established mysql connections
+	 * @var array
+	 */
+        var $dbhs = array();
+
+	var $_force_dbhname = false;
+	var $last_table = '';
+	var $db_tables = array();
+	var $db_servers = array();
+
+	// function BPDB_Multi() {} // Not used - rely on PHP4 constructor from BPDB to call BPDB_Multi::__construct
+
+	function __construct() {
+		$args = func_get_args();
+		$args = call_user_func_array( array(&$this, '_init'), $args );
+
+		if ( $args['host'] ) {
+			$this->db_servers['dbh_global'] = $args;
+			$this->db_connect( '/* */' );
+		}
+	}
+
+	/**
+	 * Figure out which database server should handle the query, and connect to it.
+	 * @param string query
+	 * @return resource mysql database connection
+	 */
+	function &db_connect( $query = '' ) {
+		$false = false;
+		if ( empty( $query ) )
+			return $false;
+		
+		$this->last_table = $table = $this->get_table_from_query( $query );
+		
+		// We can attempt to force the connection identifier in use
+		if ( $this->_force_dbhname && isset($this->db_servers[$this->_force_dbhname]) )
+			$dbhname = $this->_force_dbhname;
+		
+		if ( !isset($dbhname) ) {
+			if ( isset( $this->db_tables[$table] ) )
+				$dbhname = $this->db_tables[$table];
+			else
+				$dbhname = 'dbh_global';
+		}
+
+		if ( !isset($this->db_servers[$dbhname]) )
+			return $false;
+
+		if ( isset($this->dbhs[$dbhname]) && is_resource($this->dbhs[$dbhname]) ) // We're already connected!
+			return $this->dbhs[$dbhname];
+		
+		$success = $this->db_connect_host( $this->db_servers[$dbhname] );
+
+		if ( $success && is_resource($this->dbh) ) {
+			$this->dbhs[$dbhname] =& $this->dbh;
+		} else {
+			unset($this->dbhs[$dbhname]);
+			unset($this->dbh);
+			return $false;
+		}
+
+		return $this->dbhs[$dbhname];
+	}
+
+	/**
+	 * Sets the prefix of the database tables
+	 * @param string prefix
+	 * @param false|array tables (optional: false)
+	 *	table identifiers are array keys
+	 *	array values
+	 *		empty: set prefix: array( 'posts' => false, 'users' => false, ... )
+	 *		string: set to that array value: array( 'posts' => 'my_posts', 'users' => 'my_users' )
+	 *		array: array[0] is DB identifier, array[1] is table name: array( 'posts' => array( 'global', 'my_posts' ), 'users' => array( 'users', 'my_users' ) )
+	 *	OR array values (with numeric keys): array( 'posts', 'users', ... )
+	 *
+	 * @return string the previous prefix (mostly only meaningful if all $table parameter was false)
+	 */
+	function set_prefix( $prefix, $tables = false ) {
+		$old_prefix = parent::set_prefix( $prefix, $tables );
+		if ( !$old_prefix || is_wp_error($old_prefix) ) {
+			return $old_prefix;
+		}
+
+		if ( $tables && is_array($tables) ) {
+			$_tables = $tables;
+		} else {
+			$_tables = $this->tables;
+		}
+		
+		foreach ( $_tables as $key => $value ) {
+			// array( 'posts' => array( 'global', 'my_posts' ), 'users' => array( 'users', 'my_users' ) )
+			if ( is_array($value) && isset($this->db_servers['dbh_' . $value[0]]) ) {
+				$this->add_db_table( $value[0], $value[1] );
+				$this->$key = $value[1];
+			}
+		}
+
+		return $old_prefix;
+	}
+
+	/**
+	 * Find the first table name referenced in a query
+	 * @param string query
+	 * @return string table
+	 */
+	function get_table_from_query ( $q ) {
+		// Remove characters that can legally trail the table name
+		rtrim($q, ';/-#');
+
+		// Quickly match most common queries
+		if ( preg_match('/^\s*(?:'
+				. 'SELECT.*?\s+FROM'
+				. '|INSERT(?:\s+IGNORE)?(?:\s+INTO)?'
+				. '|REPLACE(?:\s+INTO)?'
+				. '|UPDATE(?:\s+IGNORE)?'
+				. '|DELETE(?:\s+IGNORE)?(?:\s+FROM)?'
+				. ')\s+`?(\w+)`?/is', $q, $maybe) )
+			return $maybe[1];
+
+		// Refer to the previous query
+		if ( preg_match('/^\s*SELECT.*?\s+FOUND_ROWS\(\)/is', $q) )
+			return $this->last_table;
+
+		// Big pattern for the rest of the table-related queries in MySQL 5.0
+		if ( preg_match('/^\s*(?:'
+				. '(?:EXPLAIN\s+(?:EXTENDED\s+)?)?SELECT.*?\s+FROM'
+				. '|INSERT(?:\s+LOW_PRIORITY|\s+DELAYED|\s+HIGH_PRIORITY)?(?:\s+IGNORE)?(?:\s+INTO)?'
+				. '|REPLACE(?:\s+LOW_PRIORITY|\s+DELAYED)?(?:\s+INTO)?'
+				. '|UPDATE(?:\s+LOW_PRIORITY)?(?:\s+IGNORE)?'
+				. '|DELETE(?:\s+LOW_PRIORITY|\s+QUICK|\s+IGNORE)*(?:\s+FROM)?'
+				. '|DESCRIBE|DESC|EXPLAIN|HANDLER'
+				. '|(?:LOCK|UNLOCK)\s+TABLE(?:S)?'
+				. '|(?:RENAME|OPTIMIZE|BACKUP|RESTORE|CHECK|CHECKSUM|ANALYZE|OPTIMIZE|REPAIR).*\s+TABLE'
+				. '|TRUNCATE(?:\s+TABLE)?'
+				. '|CREATE(?:\s+TEMPORARY)?\s+TABLE(?:\s+IF\s+NOT\s+EXISTS)?'
+				. '|ALTER(?:\s+IGNORE)?'
+				. '|DROP\s+TABLE(?:\s+IF\s+EXISTS)?'
+				. '|CREATE(?:\s+\w+)?\s+INDEX.*\s+ON'
+				. '|DROP\s+INDEX.*\s+ON'
+				. '|LOAD\s+DATA.*INFILE.*INTO\s+TABLE'
+				. '|(?:GRANT|REVOKE).*ON\s+TABLE'
+				. '|SHOW\s+(?:.*FROM|.*TABLE)'
+				. ')\s+`?(\w+)`?/is', $q, $maybe) )
+			return $maybe[1];
+
+		// All unmatched queries automatically fall to the global master
+		return '';
+	}
+
+	/**
+	 * Add a database server's information.  Does not automatically connect.
+	 * @param string $ds Dataset: the name of the dataset.
+	 * @param array $args
+	 *	name => string DB name (required)
+	 *	user => string DB user (optional: false)
+	 *	password => string DB user password (optional: false)
+	 *	host => string DB hostname (optional: 'localhost')
+	 *	charset => string DB default charset.  Used in a SET NAMES query. (optional)
+	 *	collate => string DB default collation.  If charset supplied, optionally added to the SET NAMES query (optional)
+	 */
+	function add_db_server( $ds, $args = null ) {
+		$defaults = array(
+			'user' => false,
+			'password' => false,
+			'name' => false,
+			'host' => 'localhost',
+			'charset' => false,
+			'collate' => false
+		);
+
+		$args = wp_parse_args( $args, $defaults );
+		$args['ds'] = 'dbh_' . $ds;
+
+		$this->db_servers['dbh_' . $ds] = $args;
+	}
+
+	/**
+	 * Maps a table to a dataset.
+	 * @param string $ds Dataset: the name of the dataset.
+	 * @param string $table
+	 */
+	function add_db_table( $ds, $table ) {
+		$this->db_tables[$table] = 'dbh_' . $ds;
+	}
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bpdb.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bpdb.php
new file mode 100644
index 0000000000000000000000000000000000000000..a2b9095c8f15a26d802e534b1448ca132db9f04a
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.bpdb.php
@@ -0,0 +1,1164 @@
+<?php
+//  backPress DB Class
+
+//  ORIGINAL CODE FROM:
+//  Justin Vincent (justin@visunet.ie)
+//	http://php.justinvincent.com
+
+define( 'EZSQL_VERSION', 'BP1.25' );
+define( 'OBJECT', 'OBJECT', true );
+define( 'OBJECT_K', 'OBJECT_K', false );
+define( 'ARRAY_A', 'ARRAY_A', false );
+define( 'ARRAY_K', 'ARRAY_K', false );
+define( 'ARRAY_N', 'ARRAY_N', false );
+
+if ( !defined( 'SAVEQUERIES' ) ) {
+	define( 'SAVEQUERIES', false );
+}
+
+if ( !defined( 'BPDB__ERROR_STRING' ) ) {
+	define( 'BPDB__ERROR_STRING', 'DB Error: %s, %s: %s' );
+}
+if ( !defined( 'BPDB__ERROR_HTML' ) ) {
+	define( 'BPDB__ERROR_HTML', '<div class="error"><p><strong>DB Error in %3$s:</strong> %1$s</p><pre>%2$s</pre></div>' );
+}
+if ( !defined( 'BPDB__CONNECT_ERROR_MESSAGE' ) ) {
+	define( 'BPDB__CONNECT_ERROR_MESSAGE', 'DB Error: cannot connect' );
+}
+if ( !defined( 'BPDB__SELECT_ERROR_MESSAGE' ) ) {
+	define( 'BPDB__SELECT_ERROR_MESSAGE', 'DB Error: cannot select' );
+}
+if ( !defined( 'BPDB__DB_VERSION_ERROR' ) ) {
+	define( 'BPDB__DB_VERSION_ERROR', 'DB Requires MySQL version 4.0 or higher' );
+}
+if ( !defined( 'BPDB__PHP_EXTENSION_MISSING' ) ) {
+	define( 'BPDB__PHP_EXTENSION_MISSING', 'DB Requires The MySQL PHP extension' );
+}
+
+class BPDB
+{
+	/**
+	 * Whether to show SQL/DB errors
+	 *
+	 * @since 1.0
+	 * @access private
+	 * @var bool
+	 */
+	var $show_errors = false;
+
+	/**
+	 * Whether to suppress errors during the DB bootstrapping.
+	 *
+	 * @access private
+	 * @since 1.0
+	 * @var bool
+	 */
+	var $suppress_errors = false;
+
+	/**
+	 * The last error during query.
+	 *
+	 * @since 1.0
+	 * @var string
+	 */
+	var $last_error = '';
+
+	/**
+	 * Amount of queries made
+	 *
+	 * @since 1.0
+	 * @access private
+	 * @var int
+	 */
+	var $num_queries = 0;
+
+	/**
+	 * The last query made
+	 *
+	 * @since 1.0
+	 * @access private
+	 * @var string
+	 */
+	var $last_query = null;
+
+	/**
+	 * Saved info on the table column
+	 *
+	 * @since 1.0
+	 * @access private
+	 * @var array
+	 */
+	var $col_info = array();
+	
+	/**
+	 * Saved queries that were executed
+	 *
+	 * @since 1.0
+	 * @access private
+	 * @var array
+	 */
+	var $queries = array();
+
+	/**
+	 * Whether to use the query log
+	 *
+	 * @since 1.0
+	 * @access private
+	 * @var bool
+	 */
+	var $save_queries = false;
+
+	/**
+	 * Table prefix
+	 *
+	 * You can set this to have multiple installations
+	 * in a single database. The second reason is for possible
+	 * security precautions.
+	 *
+	 * @since 1.0
+	 * @access private
+	 * @var string
+	 */
+	var $prefix = '';
+	
+	/**
+	 * Whether the database queries are ready to start executing.
+	 *
+	 * @since 1.0
+	 * @access private
+	 * @var bool
+	 */
+	var $ready = false;
+
+	/**
+	 * The currently connected MySQL connection resource.
+	 *
+	 * @since 1.0
+	 * @access private
+	 * @var bool|resource
+	 */
+	var $dbh = false;
+
+	/**
+	 * List of tables
+	 *
+	 * @since 1.0
+	 * @access private
+	 * @var array
+	 */
+	var $tables = array();
+
+	/**
+	 * Whether to use mysql_real_escape_string
+	 *
+	 * @since 1.0
+	 * @access public
+	 * @var bool
+	 */
+	var $real_escape = false;
+
+	/**
+	 * PHP4 style constructor
+	 *
+	 * @since 1.0
+	 *
+	 * @return unknown Returns the result of bpdb::__construct()
+	 */
+	function BPDB()
+	{
+		$args = func_get_args();
+		register_shutdown_function( array( &$this, '__destruct' ) );
+		return call_user_func_array( array( &$this, '__construct' ), $args );
+	}
+
+	/**
+	 * PHP5 style constructor
+	 *
+	 * Grabs the arguments, calls bpdb::_init() and then connects to the database
+	 *
+	 * @since 1.0
+	 *
+	 * @return void
+	 */
+	function __construct()
+	{
+		$args = func_get_args();
+		$args = call_user_func_array( array( &$this, '_init' ), $args );
+
+		$this->db_connect_host( $args );
+	}
+
+	/**
+	 * Initialises the class variables based on provided arguments
+	 *
+	 * @since 1.0
+	 *
+	 * @param array $args The provided connection settings
+	 * @return array The current connection settings after processing by init
+	 */
+	function _init( $args )
+	{
+		if ( !extension_loaded( 'mysql' ) ) {
+			$this->show_errors();
+			$this->bail( BPDB__PHP_EXTENSION_MISSING );
+			return;
+		}
+
+		if ( 4 == func_num_args() ) {
+			$args = array(
+				'user' => $args,
+				'password' => func_get_arg( 1 ),
+				'name' => func_get_arg( 2 ),
+				'host' => func_get_arg( 3 )
+			);
+		}
+
+		$defaults = array(
+			'user' => false,
+			'password' => false,
+			'name' => false,
+			'host' => 'localhost',
+			'charset' => false,
+			'collate' => false,
+			'errors' => false
+		);
+
+		$args = wp_parse_args( $args, $defaults );
+
+		switch ( $args['errors'] ) {
+			case 'show' :
+				$this->show_errors( true );
+				break;
+			case 'suppress' :
+				$this->suppress_errors( true );
+				break;
+		}
+
+		return $args;
+	}
+
+	/**
+	 * PHP5 style destructor, registered as shutdown function in PHP4
+	 *
+	 * @since 1.0
+	 *
+	 * @return bool Always returns true
+	 */
+	function __destruct()
+	{
+		return true;
+	}
+
+	/**
+	 * Figure out which database server should handle the query, and connect to it.
+	 *
+	 * @since 1.0
+	 *
+	 * @param string query
+	 * @return resource mysql database connection
+	 */
+	function &db_connect( $query = '' )
+	{
+		$false = false;
+		if ( empty( $query ) ) {
+			return $false;
+		}
+		return $this->dbh;
+	}
+
+	/**
+	 * Connects to the database server and selects a database
+	 *
+	 * @since 1.0
+	 *
+	 * @param array args
+	 *	name => string DB name (required)
+	 *	user => string DB user (optional: false)
+	 *	password => string DB user password (optional: false)
+	 *	host => string DB hostname (optional: 'localhost')
+	 *	charset => string DB default charset.  Used in a SET NAMES query. (optional)
+	 *	collate => string DB default collation.  If charset supplied, optionally added to the SET NAMES query (optional)
+	 * @return void|bool void if cannot connect, false if cannot select, true if success
+	 */
+	function db_connect_host( $args )
+	{
+		extract( $args, EXTR_SKIP );
+
+		unset( $this->dbh ); // De-reference before re-assigning
+		$this->dbh = @mysql_connect( $host, $user, $password, true );
+
+		if ( !$this->dbh ) {
+			if ( !$this->suppress_errors ) {
+				$this->show_errors();
+			}
+			$this->bail( BPDB__CONNECT_ERROR_MESSAGE );
+			return;
+		}
+
+		$this->ready = true;
+
+		if ( $this->has_cap( 'collation' ) ) {
+			if ( !empty( $charset ) ) {
+				if ( function_exists( 'mysql_set_charset' ) ) {
+					mysql_set_charset( $charset, $this->dbh );
+					$this->real_escape = true;
+				} else {
+					$collation_query = "SET NAMES '{$charset}'";
+					if ( !empty( $collate ) ) {
+						$collation_query .= " COLLATE '{$collate}'";
+					}
+					$this->query( $collation_query, true );
+				}
+			}
+		}
+
+		return $this->select( $name, $this->dbh );
+	}
+
+	/**
+	 * Sets the table prefix for the WordPress tables.
+	 *
+	 * @since 1.0
+	 *
+	 * @param string prefix
+	 * @param false|array tables (optional: false)
+	 *	table identifiers are array keys
+	 *	array values
+	 *		empty: set prefix: array( 'posts' => false, 'users' => false, ... )
+	 *		string: set to that array value: array( 'posts' => 'my_posts', 'users' => 'my_users' )
+	 *	OR array values (with numeric keys): array( 'posts', 'users', ... )
+	 *
+	 * @return string the previous prefix (mostly only meaningful if all $table parameter was false)
+	 */
+	function set_prefix( $prefix, $tables = false )
+	{
+		if ( !$prefix ) {
+			return false;
+		}
+		if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) {
+			return new WP_Error( 'invalid_db_prefix', 'Invalid database prefix' ); // No gettext here
+		}
+
+		$old_prefix = $this->prefix;
+
+		if ( $tables && is_array( $tables ) ) {
+			$_tables =& $tables;
+		} else {
+			$_tables =& $this->tables;
+			$this->prefix = $prefix;
+		}
+
+		foreach ( $_tables as $key => $value ) {
+			if ( is_numeric( $key ) ) { // array( 'posts', 'users', ... )
+				$this->$value = $prefix . $value;
+			} elseif ( !$value ) {
+				$this->$key = $prefix . $key; // array( 'posts' => false, 'users' => false, ... )
+			} elseif ( is_string( $value ) ) { // array( 'posts' => 'my_posts', 'users' => 'my_users' )
+				$this->$key = $value;
+			}
+		}
+
+		return $old_prefix;
+	}
+
+	/**
+	 * Selects a database using the current database connection.
+	 *
+	 * The database name will be changed based on the current database
+	 * connection. On failure, the execution will bail and display an DB error.
+	 *
+	 * @since 1.0
+	 *
+	 * @param string $db MySQL database name
+	 * @return bool True on success, false on failure.
+	 */
+	function select( $db, &$dbh )
+	{
+		if ( !@mysql_select_db( $db, $dbh ) ) {
+			$this->ready = false;
+			$this->show_errors();
+			$this->bail( BPDB__SELECT_ERROR_MESSAGE );
+			return false;
+		}
+		return true;
+	}
+
+	function _weak_escape( $string )
+	{
+		return addslashes( $string );
+	}
+
+	function _real_escape( $string )
+	{
+		if ( $this->dbh && $this->real_escape ) {
+			return mysql_real_escape_string( $string, $this->dbh );
+		} else {
+			return addslashes( $string );
+		}
+	}
+
+	function _escape( $data )
+	{
+		if ( is_array( $data ) ) {
+			foreach ( (array) $data as $k => $v ) {
+				if ( is_array( $v ) ) {
+					$data[$k] = $this->_escape( $v );
+				} else {
+					$data[$k] = $this->_real_escape( $v );
+				}
+			}
+		} else {
+			$data = $this->_real_escape( $data );
+		}
+
+		return $data;
+	}
+
+	/**
+	 * Escapes content for insertion into the database using addslashes(), for security
+	 *
+	 * @since 1.0
+	 *
+	 * @param string|array $data
+	 * @return string query safe string
+	 */
+	function escape( $data )
+	{
+		if ( is_array( $data ) ) {
+			foreach ( (array) $data as $k => $v ) {
+				if ( is_array( $v ) ) {
+					$data[$k] = $this->escape( $v );
+				} else {
+					$data[$k] = $this->_weak_escape( $v );
+				}
+			}
+		} else {
+			$data = $this->_weak_escape( $data );
+		}
+
+		return $data;
+	}
+
+	/**
+	 * Escapes content by reference for insertion into the database, for security
+	 *
+	 * @since 1.0
+	 *
+	 * @param string $s
+	 */
+	function escape_by_ref( &$string )
+	{
+		$string = $this->_real_escape( $string );
+	}
+
+	/**
+	 * Escapes array recursively for insertion into the database, for security
+	 * @param array $array
+	 */
+	function escape_deep( $array )
+	{
+		return $this->_escape( $array );
+	}
+
+	/**
+	 * Prepares a SQL query for safe execution.  Uses sprintf()-like syntax.
+	 *
+	 * This function only supports a small subset of the sprintf syntax; it only supports %d (decimal number), %s (string).
+	 * Does not support sign, padding, alignment, width or precision specifiers.
+	 * Does not support argument numbering/swapping.
+	 *
+	 * May be called like {@link http://php.net/sprintf sprintf()} or like {@link http://php.net/vsprintf vsprintf()}.
+	 *
+	 * Both %d and %s should be left unquoted in the query string.
+	 *
+	 * <code>
+	 * wpdb::prepare( "SELECT * FROM `table` WHERE `column` = %s AND `field` = %d", "foo", 1337 )
+	 * </code>
+	 *
+	 * @link http://php.net/sprintf Description of syntax.
+	 * @since 1.0
+	 *
+	 * @param string $query Query statement with sprintf()-like placeholders
+	 * @param array|mixed $args The array of variables to substitute into the query's placeholders if being called like {@link http://php.net/vsprintf vsprintf()}, or the first variable to substitute into the query's placeholders if being called like {@link http://php.net/sprintf sprintf()}.
+	 * @param mixed $args,... further variables to substitute into the query's placeholders if being called like {@link http://php.net/sprintf sprintf()}.
+	 * @return null|string Sanitized query string
+	 */
+	function prepare( $query = null ) // ( $query, *$args )
+	{
+		if ( is_null( $query ) ) {
+			return;
+		}
+		$args = func_get_args();
+		array_shift( $args );
+		// If args were passed as an array (as in vsprintf), move them up
+		if ( isset( $args[0] ) && is_array( $args[0] ) ) {
+			$args = $args[0];
+		}
+		$query = str_replace( "'%s'", '%s', $query ); // in case someone mistakenly already singlequoted it
+		$query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting
+		$query = str_replace( '%s', "'%s'", $query ); // quote the strings
+		array_walk( $args, array( &$this, 'escape_by_ref' ) );
+		return @vsprintf( $query, $args );
+	}
+
+	/**
+	 * Get SQL/DB error
+	 *
+	 * @since 1.0
+	 *
+	 * @param string $str Error string
+	 */
+	function get_error( $str = '' )
+	{
+		if ( empty( $str ) ) {
+			if ( $this->last_error ) {
+				$str = $this->last_error;
+			} else {
+				return false;
+			}
+		}
+
+		$caller = $this->get_caller();
+		$error_str = sprintf( BPDB__ERROR_STRING, $str, $this->last_query, $caller );
+
+		if ( class_exists( 'WP_Error' ) ) {
+			return new WP_Error( 'db_query', $error_str, array( 'query' => $this->last_query, 'error' => $str, 'caller' => $caller ) );
+		} else {
+			return array( 'query' => $this->last_query, 'error' => $str, 'caller' => $caller, 'error_str' => $error_str );
+		}
+	}
+
+	/**
+	 * Print SQL/DB error.
+	 *
+	 * @since 1.0
+	 *
+	 * @param string $str The error to display
+	 * @return bool False if the showing of errors is disabled.
+	 */
+	function print_error( $str = '' )
+	{
+		if ( $this->suppress_errors ) {
+			return false;
+		}
+
+		$error = $this->get_error( $str );
+		if ( is_object( $error ) && is_a( $error, 'WP_Error' ) ) {
+			$err = $error->get_error_data();
+			$err['error_str'] = $error->get_error_message();
+		} else {
+			$err =& $error;
+		}
+
+		$log_file = ini_get( 'error_log' );
+		if ( !empty( $log_file ) && ( 'syslog' != $log_file ) && is_writable( $log_file ) && function_exists( 'error_log' ) ) {
+			error_log($err['error_str'], 0);
+		}
+
+		// Is error output turned on or not
+		if ( !$this->show_errors ) {
+			return false;
+		}
+
+		$str = htmlspecialchars( $err['error'], ENT_QUOTES );
+		$query = htmlspecialchars( $err['query'], ENT_QUOTES );
+		$caller = htmlspecialchars( $err['caller'], ENT_QUOTES );
+
+		// If there is an error then take note of it
+
+		printf( BPDB__ERROR_HTML, $str, $query, $caller );
+	}
+
+	/**
+	 * Enables showing of database errors.
+	 *
+	 * This function should be used only to enable showing of errors.
+	 * bpdb::hide_errors() should be used instead for hiding of errors. However,
+	 * this function can be used to enable and disable showing of database
+	 * errors.
+	 *
+	 * @since 1.0
+	 *
+	 * @param bool $show Whether to show or hide errors
+	 * @return bool Old value for showing errors.
+	 */
+	function show_errors( $show = true )
+	{
+		$errors = $this->show_errors;
+		$this->show_errors = $show;
+		return $errors;
+	}
+
+	/**
+	 * Disables showing of database errors.
+	 *
+	 * @since 1.0
+	 *
+	 * @return bool Whether showing of errors was active or not
+	 */
+	function hide_errors()
+	{
+		return $this->show_errors( false );
+	}
+
+	/**
+	 * Whether to suppress database errors.
+	 *
+	 * @since 1.0
+	 *
+	 * @param bool $suppress
+	 * @return bool previous setting
+	 */
+	function suppress_errors( $suppress = true )
+	{
+		$errors = $this->suppress_errors;
+		$this->suppress_errors = $suppress;
+		return $errors;
+	}
+
+	/**
+	 * Kill cached query results.
+	 *
+	 * @since 1.0
+	 */
+	function flush()
+	{
+		$this->last_result = array();
+		$this->col_info = array();
+		$this->last_query = null;
+		$this->last_error = '';
+		$this->num_rows = 0;
+	}
+
+	/**
+	 * Perform a MySQL database query, using current database connection.
+	 *
+	 * More information can be found on the codex page.
+	 *
+	 * @since 1.0
+	 *
+	 * @param string $query
+	 * @return int|false Number of rows affected/selected or false on error
+	 */
+	function query( $query, $use_current = false )
+	{
+		if ( !$this->ready ) {
+			return false;
+		}
+
+		// filter the query, if filters are available
+		// NOTE: some queries are made before the plugins have been loaded, and thus cannot be filtered with this method
+		if ( function_exists( 'apply_filters' ) ) {
+			$query = apply_filters( 'query', $query );
+		}
+
+		// initialise return
+		$return_val = 0;
+		$this->flush();
+
+		// Log how the function was called
+		$this->func_call = "\$db->query(\"$query\")";
+
+		// Keep track of the last query for debug..
+		$this->last_query = $query;
+
+		// Perform the query via std mysql_query function..
+		if ( SAVEQUERIES ) {
+			$this->timer_start();
+		}
+
+		if ( $use_current ) {
+			$dbh =& $this->dbh;
+		} else {
+			$dbh = $this->db_connect( $query );
+		}
+
+		$this->result = @mysql_query( $query, $dbh );
+		++$this->num_queries;
+
+		if ( SAVEQUERIES ) {
+			$this->queries[] = array( $query, $this->timer_stop(), $this->get_caller() );
+		}
+
+		// If there is an error then take note of it..
+		if ( $this->last_error = mysql_error( $dbh ) ) {
+			return $this->print_error( $this->last_error );
+		}
+
+		if ( preg_match( "/^\\s*(insert|delete|update|replace|alter) /i", $query ) ) {
+			$this->rows_affected = mysql_affected_rows( $dbh );
+			// Take note of the insert_id
+			if ( preg_match( "/^\\s*(insert|replace) /i", $query ) ) {
+				$this->insert_id = mysql_insert_id( $dbh );
+			}
+			// Return number of rows affected
+			$return_val = $this->rows_affected;
+		} else {
+			$i = 0;
+			while ( $i < @mysql_num_fields( $this->result ) ) {
+				$this->col_info[$i] = @mysql_fetch_field( $this->result );
+				$i++;
+			}
+			$num_rows = 0;
+			while ( $row = @mysql_fetch_object( $this->result ) ) {
+				$this->last_result[$num_rows] = $row;
+				$num_rows++;
+			}
+
+			@mysql_free_result( $this->result );
+
+			// Log number of rows the query returned
+			$this->num_rows = $num_rows;
+
+			// Return number of rows selected
+			$return_val = $this->num_rows;
+		}
+
+		return $return_val;
+	}
+
+	/**
+	 * Insert a row into a table.
+	 *
+	 * <code>
+	 * wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) )
+	 * </code>
+	 *
+	 * @since 1.0
+	 * @see bpdb::prepare()
+	 *
+	 * @param string $table table name
+	 * @param array $data Data to insert (in column => value pairs).  Both $data columns and $data values should be "raw" (neither should be SQL escaped).
+	 * @param array|string $format (optional) An array of formats to be mapped to each of the value in $data.  If string, that format will be used for all of the values in $data.  A format is one of '%d', '%s' (decimal number, string).  If omitted, all values in $data will be treated as strings.
+	 * @return int|false The number of rows inserted, or false on error.
+	 */
+	function insert( $table, $data, $format = null )
+	{
+		$formats = $format = (array) $format;
+		$fields = array_keys( $data );
+		$formatted_fields = array();
+		foreach ( $fields as $field ) {
+			if ( !empty( $format ) ) {
+				$form = ( $form = array_shift( $formats ) ) ? $form : $format[0];
+			} elseif ( isset( $this->field_types[$field] ) ) {
+				$form = $this->field_types[$field];
+			} elseif ( is_null( $data[$field] ) ) {
+				$form = 'NULL';
+				unset( $data[$field] );
+			} else {
+				$form = '%s';
+			}
+			$formatted_fields[] = $form;
+		}
+		$sql = "INSERT INTO `$table` (`" . implode( '`,`', $fields ) . "`) VALUES (" . implode( ",", $formatted_fields ) . ")";
+		return $this->query( $this->prepare( $sql, $data ) );
+	}
+
+	/**
+	 * Update a row in the table
+	 *
+	 * <code>
+	 * wpdb::update( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( 'ID' => 1 ), array( '%s', '%d' ), array( '%d' ) )
+	 * </code>
+	 *
+	 * @since 1.0
+	 * @see bpdb::prepare()
+	 *
+	 * @param string $table table name
+	 * @param array $data Data to update (in column => value pairs).  Both $data columns and $data values should be "raw" (neither should be SQL escaped).
+	 * @param array $where A named array of WHERE clauses (in column => value pairs).  Multiple clauses will be joined with ANDs.  Both $where columns and $where values should be "raw".
+	 * @param array|string $format (optional) An array of formats to be mapped to each of the values in $data.  If string, that format will be used for all of the values in $data.  A format is one of '%d', '%s' (decimal number, string).  If omitted, all values in $data will be treated as strings.
+	 * @param array|string $format_where (optional) An array of formats to be mapped to each of the values in $where.  If string, that format will be used for all of  the items in $where.  A format is one of '%d', '%s' (decimal number, string).  If omitted, all values in $where will be treated as strings.
+	 * @return int|false The number of rows updated, or false on error.
+	 */
+	function update( $table, $data, $where, $format = null, $where_format = null )
+	{
+		if ( !is_array( $where ) ) {
+			return false;
+		}
+
+		$formats = $format = (array) $format;
+		$bits = $wheres = array();
+		foreach ( (array) array_keys( $data ) as $field ) {
+			if ( !empty( $format ) ) {
+				$form = ( $form = array_shift( $formats ) ) ? $form : $format[0];
+			} elseif ( isset( $this->field_types[$field] ) ) {
+				$form = $this->field_types[$field];
+			} elseif ( is_null( $data[$field] ) ) {
+				$form = 'NULL';
+				unset( $data[$field] );
+			} else {
+				$form = '%s';
+			}
+			$bits[] = "`$field` = {$form}";
+		}
+
+		$where_formats = $where_format = (array) $where_format;
+		foreach ( (array) array_keys( $where ) as $field ) {
+			if ( !empty( $where_format ) ) {
+				$form = ( $form = array_shift( $where_formats ) ) ? $form : $where_format[0];
+			} elseif ( isset( $this->field_types[$field] ) ) {
+				$form = $this->field_types[$field];
+			} elseif ( is_null( $where[$field] ) ) {
+				unset( $where[$field] );
+				$wheres[] = "`$field` IS NULL";
+				continue;
+			} else {
+				$form = '%s';
+			}
+			$wheres[] = "`$field` = {$form}";
+		}
+
+		$sql = "UPDATE `$table` SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres );
+		return $this->query( $this->prepare( $sql, array_merge( array_values( $data ), array_values( $where ) ) ) );
+	}
+
+	/**
+	 * Retrieve one variable from the database.
+	 *
+	 * Executes a SQL query and returns the value from the SQL result.
+	 * If the SQL result contains more than one column and/or more than one row, this function returns the value in the column and row specified.
+	 * If $query is null, this function returns the value in the specified column and row from the previous SQL result.
+	 *
+	 * @since 1.0
+	 *
+	 * @param string|null $query SQL query.  If null, use the result from the previous query.
+	 * @param int $x (optional) Column of value to return.  Indexed from 0.
+	 * @param int $y (optional) Row of value to return.  Indexed from 0.
+	 * @return string Database query result
+	 */
+	function get_var( $query=null, $x = 0, $y = 0 )
+	{
+		$this->func_call = "\$db->get_var(\"$query\",$x,$y)";
+		if ( $query ) {
+			$this->query( $query );
+		}
+
+		// Extract var out of cached results based x,y vals
+		if ( !empty( $this->last_result[$y] ) ) {
+			$values = array_values( get_object_vars( $this->last_result[$y] ) );
+		}
+
+		// If there is a value return it else return null
+		return ( isset($values[$x]) && $values[$x]!=='' ) ? $values[$x] : null;
+	}
+
+	/**
+	 * Retrieve one row from the database.
+	 *
+	 * Executes a SQL query and returns the row from the SQL result.
+	 *
+	 * @since 1.0
+	 *
+	 * @param string|null $query SQL query.
+	 * @param string $output (optional) one of ARRAY_A | ARRAY_N | OBJECT constants.  Return an associative array (column => value, ...), a numerically indexed array (0 => value, ...) or an object ( ->column = value ), respectively.
+	 * @param int $y (optional) Row to return.  Indexed from 0.
+	 * @return mixed Database query result in format specifed by $output
+	 */
+	function get_row( $query = null, $output = OBJECT, $y = 0 )
+	{
+		$this->func_call = "\$db->get_row(\"$query\",$output,$y)";
+		if ( $query ) {
+			$this->query( $query );
+		} else {
+			return null;
+		}
+
+		if ( !isset( $this->last_result[$y] ) ) {
+			return null;
+		}
+
+		if ( $output == OBJECT ) {
+			return $this->last_result[$y] ? $this->last_result[$y] : null;
+		} elseif ( $output == ARRAY_A ) {
+			return $this->last_result[$y] ? get_object_vars( $this->last_result[$y] ) : null;
+		} elseif ( $output == ARRAY_N ) {
+			return $this->last_result[$y] ? array_values( get_object_vars( $this->last_result[$y] ) ) : null;
+		} else {
+			$this->print_error( " \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N" );
+		}
+	}
+
+	/**
+	 * Retrieve one column from the database.
+	 *
+	 * Executes a SQL query and returns the column from the SQL result.
+	 * If the SQL result contains more than one column, this function returns the column specified.
+	 * If $query is null, this function returns the specified column from the previous SQL result.
+	 *
+	 * @since 1.0
+	 *
+	 * @param string|null $query SQL query.  If null, use the result from the previous query.
+	 * @param int $x Column to return.  Indexed from 0.
+	 * @return array Database query result.  Array indexed from 0 by SQL result row number.
+	 */
+	function get_col( $query = null , $x = 0 )
+	{
+		if ( $query ) {
+			$this->query( $query );
+		}
+
+		$new_array = array();
+		// Extract the column values
+		for ( $i=0; $i < count( $this->last_result ); $i++ ) {
+			$new_array[$i] = $this->get_var( null, $x, $i );
+		}
+		return $new_array;
+	}
+
+	/**
+	 * Retrieve an entire SQL result set from the database (i.e., many rows)
+	 *
+	 * Executes a SQL query and returns the entire SQL result.
+	 *
+	 * @since 1.0
+	 *
+	 * @param string $query SQL query.
+	 * @param string $output (optional) ane of ARRAY_A | ARRAY_N | OBJECT | OBJECT_K | ARRAY_K constants.  With one of the first three, return an array of rows indexed from 0 by SQL result row number.  Each row is an associative array (column => value, ...), a numerically indexed array (0 => value, ...), or an object. ( ->column = value ), respectively.  With OBJECT_K and ARRAY_K, return an associative array of row objects keyed by the value of each row's first column's value.  Duplicate keys are discarded.
+	 * @return mixed Database query results
+	 */
+	function get_results( $query = null, $output = OBJECT ) 
+	{
+		$this->func_call = "\$db->get_results(\"$query\", $output)";
+
+		if ( $query ) {
+			$this->query($query);
+		} else {
+			return null;
+		}
+
+		if ( $output == OBJECT ) {
+			// Return an integer-keyed array of row objects
+			return $this->last_result;
+		} elseif ( $output == OBJECT_K || $output == ARRAY_K ) {
+			// Return an array of row objects with keys from column 1
+			// (Duplicates are discarded)
+			$key = $this->col_info[0]->name;
+			foreach ( $this->last_result as $row ) {
+				if ( !isset( $new_array[ $row->$key ] ) ) {
+					$new_array[ $row->$key ] = $row;
+				}
+			}
+			if ( $output == ARRAY_K ) {
+				return array_map( 'get_object_vars', $new_array );
+			}
+			return $new_array;
+		} elseif ( $output == ARRAY_A || $output == ARRAY_N ) {
+			// Return an integer-keyed array of...
+			if ( $this->last_result ) {
+				$i = 0;
+				foreach( $this->last_result as $row ) {
+					if ( $output == ARRAY_N ) {
+						// ...integer-keyed row arrays
+						$new_array[$i] = array_values( get_object_vars( $row ) );
+					} else {
+						// ...column name-keyed row arrays
+						$new_array[$i] = get_object_vars( $row );
+					}
+					++$i;
+				}
+				return $new_array;
+			}
+		}
+	}
+
+	/**
+	 * Retrieve column metadata from the last query.
+	 *
+	 * @since 1.0
+	 *
+	 * @param string $info_type one of name, table, def, max_length, not_null, primary_key, multiple_key, unique_key, numeric, blob, type, unsigned, zerofill
+	 * @param int $col_offset 0: col name. 1: which table the col's in. 2: col's max length. 3: if the col is numeric. 4: col's type
+	 * @return mixed Column Results
+	 */
+	function get_col_info( $info_type = 'name', $col_offset = -1 )
+	{
+		if ( $this->col_info ) {
+			if ( $col_offset == -1 ) {
+				$i = 0;
+				foreach( (array) $this->col_info as $col ) {
+					$new_array[$i] = $col->{$info_type};
+					$i++;
+				}
+				return $new_array;
+			} else {
+				return $this->col_info[$col_offset]->{$info_type};
+			}
+		}
+	}
+
+	/**
+	 * Starts the timer, for debugging purposes.
+	 *
+	 * @since 1.0
+	 *
+	 * @return true
+	 */
+	function timer_start()
+	{
+		$mtime = microtime();
+		$mtime = explode( ' ', $mtime );
+		$this->time_start = $mtime[1] + $mtime[0];
+		return true;
+	}
+
+	/**
+	 * Stops the debugging timer.
+	 *
+	 * @since 1.0
+	 *
+	 * @return int Total time spent on the query, in milliseconds
+	 */
+	function timer_stop()
+	{
+		$mtime = microtime();
+		$mtime = explode( ' ', $mtime );
+		$time_end = $mtime[1] + $mtime[0];
+		$time_total = $time_end - $this->time_start;
+		return $time_total;
+	}
+
+	/**
+	 * Wraps errors in a nice header and footer and dies.
+	 *
+	 * Will not die if bpdb::$show_errors is true
+	 *
+	 * @since 1.0
+	 *
+	 * @param string $message
+	 * @return false|void
+	 */
+	function bail( $message )
+	{
+		if ( !$this->show_errors ) {
+			if ( class_exists( 'WP_Error' ) )
+				$this->error = new WP_Error( '500', $message );
+			else
+				$this->error = $message;
+			return false;
+		}
+		backpress_die( $message );
+	}
+
+	/**
+	 * Whether or not MySQL database is at least the required minimum version.
+	 *
+	 * @since 1.0
+	 *
+	 * @return WP_Error
+	 */
+	function check_database_version( $dbh_or_table = false )
+	{
+		// Make sure the server has MySQL 4.0
+		if ( version_compare( $this->db_version( $dbh_or_table ), '4.0.0', '<' ) ) {
+			return new WP_Error( 'database_version', BPDB__DB_VERSION_ERROR );
+		}
+	}
+
+	/**
+	 * Whether of not the database supports collation.
+	 *
+	 * Called when BackPress is generating the table scheme.
+	 *
+	 * @since 1.0
+	 *
+	 * @return bool True if collation is supported, false if version does not
+	 */
+	function supports_collation()
+	{
+		return $this->has_cap( 'collation' );
+	}
+
+	/**
+	 * Generic function to determine if a database supports a particular feature
+	 *
+	 * @since 1.0
+	 *
+	 * @param string $db_cap the feature
+	 * @param false|string|resource $dbh_or_table Which database to test.  False = the currently selected database, string = the database containing the specified table, resource = the database corresponding to the specified mysql resource.
+	 * @return bool
+	 */
+	function has_cap( $db_cap, $dbh_or_table = false )
+	{
+		$version = $this->db_version( $dbh_or_table );
+
+		switch ( strtolower( $db_cap ) ) {
+			case 'collation' :
+			case 'group_concat' :
+			case 'subqueries' :
+				return version_compare( $version, '4.1', '>=' );
+				break;
+
+			case 'index_hint_for_join' :
+				return version_compare( $version, '5.0', '>=' );
+				break;
+
+			case 'index_hint_lists' :
+			case 'index_hint_for_any' :
+				return version_compare( $version, '5.1', '>=' );
+				break;
+		}
+
+		return false;
+	}
+
+	/**
+	 * The database version number
+	 *
+	 * @since 1.0
+	 *
+	 * @param false|string|resource $dbh_or_table Which database to test. False = the currently selected database, string = the database containing the specified table, resource = the database corresponding to the specified mysql resource.
+	 * @return false|string false on failure, version number on success
+	 */
+	function db_version( $dbh_or_table = false )
+	{
+		if ( !$dbh_or_table ) {
+			$dbh =& $this->dbh;
+		} elseif ( is_resource( $dbh_or_table ) ) {
+			$dbh =& $dbh_or_table;
+		} else {
+			$dbh = $this->db_connect( "DESCRIBE $dbh_or_table" );
+		}
+
+		if ( $dbh ) {
+			return preg_replace( '|[^0-9\.]|', '', mysql_get_server_info( $dbh ) );
+		}
+		return false;
+	}
+
+	/**
+	 * Retrieve the name of the function that called bpdb.
+	 *
+	 * Requires PHP 4.3 and searches up the list of functions until it reaches
+	 * the one that would most logically had called this method.
+	 *
+	 * @since 1.0
+	 *
+	 * @return string The name of the calling function
+	 */
+	function get_caller()
+	{
+		// requires PHP 4.3+
+		if ( !is_callable( 'debug_backtrace' ) ) {
+			return '';
+		}
+
+		$bt = debug_backtrace();
+		$caller = array();
+
+		$bt = array_reverse( $bt );
+		foreach ( (array) $bt as $call ) {
+			if ( @$call['class'] == __CLASS__ ) {
+				continue;
+			}
+			$function = $call['function'];
+			if ( isset( $call['class'] ) ) {
+				$function = $call['class'] . "->$function";
+			}
+			$caller[] = $function;
+		}
+		$caller = join( ', ', $caller );
+
+		return $caller;
+	}
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.ixr.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.ixr.php
new file mode 100644
index 0000000000000000000000000000000000000000..86d62372c0183d9fa97f932cd41060be93355f2f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.ixr.php
@@ -0,0 +1,900 @@
+<?php
+// Last sync [WP11537]
+
+/**
+ * IXR - The Inutio XML-RPC Library
+ *
+ * @package IXR
+ * @since 1.5
+ *
+ * @copyright Incutio Ltd 2002-2005
+ * @version 1.7 (beta) 23rd May 2005
+ * @author Simon Willison
+ * @link http://scripts.incutio.com/xmlrpc/ Site
+ * @link http://scripts.incutio.com/xmlrpc/manual.php Manual
+ * @license BSD License http://www.opensource.org/licenses/bsd-license.php
+ */
+
+/**
+ * IXR_Value
+ *
+ * @package IXR
+ * @since 1.5
+ */
+class IXR_Value {
+    var $data;
+    var $type;
+
+    function IXR_Value ($data, $type = false) {
+        $this->data = $data;
+        if (!$type) {
+            $type = $this->calculateType();
+        }
+        $this->type = $type;
+        if ($type == 'struct') {
+            /* Turn all the values in the array in to new IXR_Value objects */
+            foreach ($this->data as $key => $value) {
+                $this->data[$key] = new IXR_Value($value);
+            }
+        }
+        if ($type == 'array') {
+            for ($i = 0, $j = count($this->data); $i < $j; $i++) {
+                $this->data[$i] = new IXR_Value($this->data[$i]);
+            }
+        }
+    }
+
+    function calculateType() {
+        if ($this->data === true || $this->data === false) {
+            return 'boolean';
+        }
+        if (is_integer($this->data)) {
+            return 'int';
+        }
+        if (is_double($this->data)) {
+            return 'double';
+        }
+        // Deal with IXR object types base64 and date
+        if (is_object($this->data) && is_a($this->data, 'IXR_Date')) {
+            return 'date';
+        }
+        if (is_object($this->data) && is_a($this->data, 'IXR_Base64')) {
+            return 'base64';
+        }
+        // If it is a normal PHP object convert it in to a struct
+        if (is_object($this->data)) {
+
+            $this->data = get_object_vars($this->data);
+            return 'struct';
+        }
+        if (!is_array($this->data)) {
+            return 'string';
+        }
+        /* We have an array - is it an array or a struct ? */
+        if ($this->isStruct($this->data)) {
+            return 'struct';
+        } else {
+            return 'array';
+        }
+    }
+
+    function getXml() {
+        /* Return XML for this value */
+        switch ($this->type) {
+            case 'boolean':
+                return '<boolean>'.(($this->data) ? '1' : '0').'</boolean>';
+                break;
+            case 'int':
+                return '<int>'.$this->data.'</int>';
+                break;
+            case 'double':
+                return '<double>'.$this->data.'</double>';
+                break;
+            case 'string':
+                return '<string>'.htmlspecialchars($this->data).'</string>';
+                break;
+            case 'array':
+                $return = '<array><data>'."\n";
+                foreach ($this->data as $item) {
+                    $return .= '  <value>'.$item->getXml()."</value>\n";
+                }
+                $return .= '</data></array>';
+                return $return;
+                break;
+            case 'struct':
+                $return = '<struct>'."\n";
+                foreach ($this->data as $name => $value) {
+					$name = htmlspecialchars($name);
+                    $return .= "  <member><name>$name</name><value>";
+                    $return .= $value->getXml()."</value></member>\n";
+                }
+                $return .= '</struct>';
+                return $return;
+                break;
+            case 'date':
+            case 'base64':
+                return $this->data->getXml();
+                break;
+        }
+        return false;
+    }
+
+    function isStruct($array) {
+        /* Nasty function to check if an array is a struct or not */
+        $expected = 0;
+        foreach ($array as $key => $value) {
+            if ((string)$key != (string)$expected) {
+                return true;
+            }
+            $expected++;
+        }
+        return false;
+    }
+}
+
+/**
+ * IXR_Message
+ *
+ * @package IXR
+ * @since 1.5
+ */
+class IXR_Message {
+    var $message;
+    var $messageType;  // methodCall / methodResponse / fault
+    var $faultCode;
+    var $faultString;
+    var $methodName;
+    var $params;
+    // Current variable stacks
+    var $_arraystructs = array();   // The stack used to keep track of the current array/struct
+    var $_arraystructstypes = array(); // Stack keeping track of if things are structs or array
+    var $_currentStructName = array();  // A stack as well
+    var $_param;
+    var $_value;
+    var $_currentTag;
+    var $_currentTagContents;
+    // The XML parser
+    var $_parser;
+    function IXR_Message ($message) {
+        $this->message = $message;
+    }
+    function parse() {
+        // first remove the XML declaration
+        $this->message = preg_replace('/<\?xml.*?\?'.'>/', '', $this->message);
+        if (trim($this->message) == '') {
+            return false;
+        }
+        $this->_parser = xml_parser_create();
+        // Set XML parser to take the case of tags in to account
+        xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, false);
+        // Set XML parser callback functions
+        xml_set_object($this->_parser, $this);
+        xml_set_element_handler($this->_parser, 'tag_open', 'tag_close');
+        xml_set_character_data_handler($this->_parser, 'cdata');
+        if (!xml_parse($this->_parser, $this->message)) {
+            /* die(sprintf('XML error: %s at line %d',
+                xml_error_string(xml_get_error_code($this->_parser)),
+                xml_get_current_line_number($this->_parser))); */
+            return false;
+        }
+        xml_parser_free($this->_parser);
+        // Grab the error messages, if any
+        if ($this->messageType == 'fault') {
+            $this->faultCode = $this->params[0]['faultCode'];
+            $this->faultString = $this->params[0]['faultString'];
+        }
+        return true;
+    }
+    function tag_open($parser, $tag, $attr) {
+        $this->_currentTagContents = '';
+        $this->currentTag = $tag;
+        switch($tag) {
+            case 'methodCall':
+            case 'methodResponse':
+            case 'fault':
+                $this->messageType = $tag;
+                break;
+            /* Deal with stacks of arrays and structs */
+            case 'data':    // data is to all intents and puposes more interesting than array
+                $this->_arraystructstypes[] = 'array';
+                $this->_arraystructs[] = array();
+                break;
+            case 'struct':
+                $this->_arraystructstypes[] = 'struct';
+                $this->_arraystructs[] = array();
+                break;
+        }
+    }
+    function cdata($parser, $cdata) {
+        $this->_currentTagContents .= $cdata;
+    }
+    function tag_close($parser, $tag) {
+        $valueFlag = false;
+        switch($tag) {
+            case 'int':
+            case 'i4':
+                $value = (int) trim($this->_currentTagContents);
+                $valueFlag = true;
+                break;
+            case 'double':
+                $value = (double) trim($this->_currentTagContents);
+                $valueFlag = true;
+                break;
+            case 'string':
+                $value = $this->_currentTagContents;
+                $valueFlag = true;
+                break;
+            case 'dateTime.iso8601':
+                $value = new IXR_Date(trim($this->_currentTagContents));
+                // $value = $iso->getTimestamp();
+                $valueFlag = true;
+                break;
+            case 'value':
+                // "If no type is indicated, the type is string."
+                if (trim($this->_currentTagContents) != '') {
+                    $value = (string)$this->_currentTagContents;
+                    $valueFlag = true;
+                }
+                break;
+            case 'boolean':
+                $value = (boolean) trim($this->_currentTagContents);
+                $valueFlag = true;
+                break;
+            case 'base64':
+                $value = base64_decode( trim( $this->_currentTagContents ) );
+                $valueFlag = true;
+                break;
+            /* Deal with stacks of arrays and structs */
+            case 'data':
+            case 'struct':
+                $value = array_pop($this->_arraystructs);
+                array_pop($this->_arraystructstypes);
+                $valueFlag = true;
+                break;
+            case 'member':
+                array_pop($this->_currentStructName);
+                break;
+            case 'name':
+                $this->_currentStructName[] = trim($this->_currentTagContents);
+                break;
+            case 'methodName':
+                $this->methodName = trim($this->_currentTagContents);
+                break;
+        }
+        if ($valueFlag) {
+            if (count($this->_arraystructs) > 0) {
+                // Add value to struct or array
+                if ($this->_arraystructstypes[count($this->_arraystructstypes)-1] == 'struct') {
+                    // Add to struct
+                    $this->_arraystructs[count($this->_arraystructs)-1][$this->_currentStructName[count($this->_currentStructName)-1]] = $value;
+                } else {
+                    // Add to array
+                    $this->_arraystructs[count($this->_arraystructs)-1][] = $value;
+                }
+            } else {
+                // Just add as a paramater
+                $this->params[] = $value;
+            }
+        }
+        $this->_currentTagContents = '';
+    }
+}
+
+/**
+ * IXR_Server
+ *
+ * @package IXR
+ * @since 1.5
+ */
+class IXR_Server {
+    var $data;
+    var $callbacks = array();
+    var $message;
+    var $capabilities;
+    function IXR_Server($callbacks = false, $data = false) {
+        $this->setCapabilities();
+        if ($callbacks) {
+            $this->callbacks = $callbacks;
+        }
+        $this->setCallbacks();
+        $this->serve($data);
+    }
+    function serve($data = false) {
+        if (!$data) {
+            global $HTTP_RAW_POST_DATA;
+            if (!$HTTP_RAW_POST_DATA) {
+               header( 'Content-Type: text/plain' );
+               die('XML-RPC server accepts POST requests only.');
+            }
+            $data = $HTTP_RAW_POST_DATA;
+        }
+        $this->message = new IXR_Message($data);
+        if (!$this->message->parse()) {
+            $this->error(-32700, 'parse error. not well formed');
+        }
+        if ($this->message->messageType != 'methodCall') {
+            $this->error(-32600, 'server error. invalid xml-rpc. not conforming to spec. Request must be a methodCall');
+        }
+        $result = $this->call($this->message->methodName, $this->message->params);
+        // Is the result an error?
+        if (is_a($result, 'IXR_Error')) {
+            $this->error($result);
+        }
+        // Encode the result
+        $r = new IXR_Value($result);
+        $resultxml = $r->getXml();
+        // Create the XML
+        $xml = <<<EOD
+<methodResponse>
+  <params>
+    <param>
+      <value>
+        $resultxml
+      </value>
+    </param>
+  </params>
+</methodResponse>
+
+EOD;
+        // Send it
+        $this->output($xml);
+    }
+    function call($methodname, $args) {
+        if (!$this->hasMethod($methodname)) {
+            return new IXR_Error(-32601, 'server error. requested method '.
+                $methodname.' does not exist.');
+        }
+        $method = $this->callbacks[$methodname];
+        // Perform the callback and send the response
+        if (count($args) == 1) {
+            // If only one paramater just send that instead of the whole array
+            $args = $args[0];
+        }
+        // Are we dealing with a function or a method?
+        if (substr($method, 0, 5) == 'this:') {
+            // It's a class method - check it exists
+            $method = substr($method, 5);
+            if (!method_exists($this, $method)) {
+                return new IXR_Error(-32601, 'server error. requested class method "'.
+                    $method.'" does not exist.');
+            }
+            // Call the method
+            $result = $this->$method($args);
+        } else {
+            // It's a function - does it exist?
+            if (is_array($method)) {
+                if (!method_exists($method[0], $method[1])) {
+                    return new IXR_Error(-32601, 'server error. requested object method "'.
+                        $method[1].'" does not exist.');
+                }
+            } else if (!function_exists($method)) {
+                return new IXR_Error(-32601, 'server error. requested function "'.
+                    $method.'" does not exist.');
+            }
+            // Call the function
+            $result = call_user_func($method, $args);
+        }
+        return $result;
+    }
+
+    function error($error, $message = false) {
+        // Accepts either an error object or an error code and message
+        if ($message && !is_object($error)) {
+            $error = new IXR_Error($error, $message);
+        }
+        $this->output($error->getXml());
+    }
+    function output($xml) {
+        $xml = '<?xml version="1.0"?>'."\n".$xml;
+        $length = strlen($xml);
+        header('Connection: close');
+        header('Content-Length: '.$length);
+        header('Content-Type: text/xml');
+        header('Date: '.date('r'));
+        echo $xml;
+        exit;
+    }
+    function hasMethod($method) {
+        return in_array($method, array_keys($this->callbacks));
+    }
+    function setCapabilities() {
+        // Initialises capabilities array
+        $this->capabilities = array(
+            'xmlrpc' => array(
+                'specUrl' => 'http://www.xmlrpc.com/spec',
+                'specVersion' => 1
+            ),
+            'faults_interop' => array(
+                'specUrl' => 'http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php',
+                'specVersion' => 20010516
+            ),
+            'system.multicall' => array(
+                'specUrl' => 'http://www.xmlrpc.com/discuss/msgReader$1208',
+                'specVersion' => 1
+            ),
+        );
+    }
+    function getCapabilities($args) {
+        return $this->capabilities;
+    }
+    function setCallbacks() {
+        $this->callbacks['system.getCapabilities'] = 'this:getCapabilities';
+        $this->callbacks['system.listMethods'] = 'this:listMethods';
+        $this->callbacks['system.multicall'] = 'this:multiCall';
+    }
+    function listMethods($args) {
+        // Returns a list of methods - uses array_reverse to ensure user defined
+        // methods are listed before server defined methods
+        return array_reverse(array_keys($this->callbacks));
+    }
+    function multiCall($methodcalls) {
+        // See http://www.xmlrpc.com/discuss/msgReader$1208
+        $return = array();
+        foreach ($methodcalls as $call) {
+            $method = $call['methodName'];
+            $params = $call['params'];
+            if ($method == 'system.multicall') {
+                $result = new IXR_Error(-32600, 'Recursive calls to system.multicall are forbidden');
+            } else {
+                $result = $this->call($method, $params);
+            }
+            if (is_a($result, 'IXR_Error')) {
+                $return[] = array(
+                    'faultCode' => $result->code,
+                    'faultString' => $result->message
+                );
+            } else {
+                $return[] = array($result);
+            }
+        }
+        return $return;
+    }
+}
+
+/**
+ * IXR_Request
+ *
+ * @package IXR
+ * @since 1.5
+ */
+class IXR_Request {
+    var $method;
+    var $args;
+    var $xml;
+    function IXR_Request($method, $args) {
+        $this->method = $method;
+        $this->args = $args;
+        $this->xml = <<<EOD
+<?xml version="1.0"?>
+<methodCall>
+<methodName>{$this->method}</methodName>
+<params>
+
+EOD;
+        foreach ($this->args as $arg) {
+            $this->xml .= '<param><value>';
+            $v = new IXR_Value($arg);
+            $this->xml .= $v->getXml();
+            $this->xml .= "</value></param>\n";
+        }
+        $this->xml .= '</params></methodCall>';
+    }
+    function getLength() {
+        return strlen($this->xml);
+    }
+    function getXml() {
+        return $this->xml;
+    }
+}
+
+/**
+ * IXR_Client
+ *
+ * @package IXR
+ * @since 1.5
+ */
+class IXR_Client {
+    var $server;
+    var $port;
+    var $path;
+    var $useragent;
+	var $headers;
+    var $response;
+    var $message = false;
+    var $debug = false;
+    var $timeout;
+    // Storage place for an error message
+    var $error = false;
+    function IXR_Client($server, $path = false, $port = 80, $timeout = false) {
+        if (!$path) {
+            // Assume we have been given a URL instead
+            $bits = parse_url($server);
+            $this->server = $bits['host'];
+            $this->port = isset($bits['port']) ? $bits['port'] : 80;
+            $this->path = isset($bits['path']) ? $bits['path'] : '/';
+            // Make absolutely sure we have a path
+            if (!$this->path) {
+                $this->path = '/';
+            }
+        } else {
+            $this->server = $server;
+            $this->path = $path;
+            $this->port = $port;
+        }
+        $this->useragent = 'The Incutio XML-RPC PHP Library';
+        $this->timeout = $timeout;
+    }
+    function query() {
+        $args = func_get_args();
+        $method = array_shift($args);
+        $request = new IXR_Request($method, $args);
+        $length = $request->getLength();
+        $xml = $request->getXml();
+        $r = "\r\n";
+        $request  = "POST {$this->path} HTTP/1.0$r";
+
+		$this->headers['Host']			= $this->server;
+		$this->headers['Content-Type']	= 'text/xml';
+		$this->headers['User-Agent']	= $this->useragent;
+		$this->headers['Content-Length']= $length;
+
+		foreach( $this->headers as $header => $value ) {
+			$request .= "{$header}: {$value}{$r}";
+		}
+		$request .= $r;
+
+        $request .= $xml;
+        // Now send the request
+        if ($this->debug) {
+            echo '<pre class="ixr_request">'.htmlspecialchars($request)."\n</pre>\n\n";
+        }
+        if ($this->timeout) {
+            $fp = @fsockopen($this->server, $this->port, $errno, $errstr, $this->timeout);
+        } else {
+            $fp = @fsockopen($this->server, $this->port, $errno, $errstr);
+        }
+        if (!$fp) {
+            $this->error = new IXR_Error(-32300, "transport error - could not open socket: $errno $errstr");
+            return false;
+        }
+        fputs($fp, $request);
+        $contents = '';
+        $debug_contents = '';
+        $gotFirstLine = false;
+        $gettingHeaders = true;
+        while (!feof($fp)) {
+            $line = fgets($fp, 4096);
+            if (!$gotFirstLine) {
+                // Check line for '200'
+                if (strstr($line, '200') === false) {
+                    $this->error = new IXR_Error(-32301, 'transport error - HTTP status code was not 200');
+                    return false;
+                }
+                $gotFirstLine = true;
+            }
+            if (trim($line) == '') {
+                $gettingHeaders = false;
+            }
+            if (!$gettingHeaders) {
+                $contents .= trim($line);
+            }
+            if ($this->debug) {
+                $debug_contents .= $line;
+            }
+        }
+        if ($this->debug) {
+            echo '<pre class="ixr_response">'.htmlspecialchars($debug_contents)."\n</pre>\n\n";
+        }
+        // Now parse what we've got back
+        $this->message = new IXR_Message($contents);
+        if (!$this->message->parse()) {
+            // XML error
+            $this->error = new IXR_Error(-32700, 'parse error. not well formed');
+            return false;
+        }
+        // Is the message a fault?
+        if ($this->message->messageType == 'fault') {
+            $this->error = new IXR_Error($this->message->faultCode, $this->message->faultString);
+            return false;
+        }
+        // Message must be OK
+        return true;
+    }
+    function getResponse() {
+        // methodResponses can only have one param - return that
+        return $this->message->params[0];
+    }
+    function isError() {
+        return (is_object($this->error));
+    }
+    function getErrorCode() {
+        return $this->error->code;
+    }
+    function getErrorMessage() {
+        return $this->error->message;
+    }
+}
+
+/**
+ * IXR_Error
+ *
+ * @package IXR
+ * @since 1.5
+ */
+class IXR_Error {
+    var $code;
+    var $message;
+    function IXR_Error($code, $message) {
+        $this->code = $code;
+        // WP adds htmlspecialchars(). See #5666
+        $this->message = htmlspecialchars($message);
+    }
+    function getXml() {
+        $xml = <<<EOD
+<methodResponse>
+  <fault>
+    <value>
+      <struct>
+        <member>
+          <name>faultCode</name>
+          <value><int>{$this->code}</int></value>
+        </member>
+        <member>
+          <name>faultString</name>
+          <value><string>{$this->message}</string></value>
+        </member>
+      </struct>
+    </value>
+  </fault>
+</methodResponse>
+
+EOD;
+        return $xml;
+    }
+}
+
+/**
+ * IXR_Date
+ *
+ * @package IXR
+ * @since 1.5
+ */
+class IXR_Date {
+    var $year;
+    var $month;
+    var $day;
+    var $hour;
+    var $minute;
+    var $second;
+    var $timezone;
+    function IXR_Date($time) {
+        // $time can be a PHP timestamp or an ISO one
+        if (is_numeric($time)) {
+            $this->parseTimestamp($time);
+        } else {
+            $this->parseIso($time);
+        }
+    }
+    function parseTimestamp($timestamp) {
+        $this->year = date('Y', $timestamp);
+        $this->month = date('m', $timestamp);
+        $this->day = date('d', $timestamp);
+        $this->hour = date('H', $timestamp);
+        $this->minute = date('i', $timestamp);
+        $this->second = date('s', $timestamp);
+        // WP adds timezone. See #2036
+        $this->timezone = '';
+    }
+    function parseIso($iso) {
+        $this->year = substr($iso, 0, 4);
+        $this->month = substr($iso, 4, 2);
+        $this->day = substr($iso, 6, 2);
+        $this->hour = substr($iso, 9, 2);
+        $this->minute = substr($iso, 12, 2);
+        $this->second = substr($iso, 15, 2);
+        // WP adds timezone. See #2036
+        $this->timezone = substr($iso, 17);
+    }
+    function getIso() {
+    	// WP adds timezone. See #2036
+        return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second.$this->timezone;
+    }
+    function getXml() {
+        return '<dateTime.iso8601>'.$this->getIso().'</dateTime.iso8601>';
+    }
+    function getTimestamp() {
+        return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year);
+    }
+}
+
+/**
+ * IXR_Base64
+ *
+ * @package IXR
+ * @since 1.5
+ */
+class IXR_Base64 {
+    var $data;
+    function IXR_Base64($data) {
+        $this->data = $data;
+    }
+    function getXml() {
+        return '<base64>'.base64_encode($this->data).'</base64>';
+    }
+}
+
+/**
+ * IXR_IntrospectionServer
+ *
+ * @package IXR
+ * @since 1.5
+ */
+class IXR_IntrospectionServer extends IXR_Server {
+    var $signatures;
+    var $help;
+    function IXR_IntrospectionServer() {
+        $this->setCallbacks();
+        $this->setCapabilities();
+        $this->capabilities['introspection'] = array(
+            'specUrl' => 'http://xmlrpc.usefulinc.com/doc/reserved.html',
+            'specVersion' => 1
+        );
+        $this->addCallback(
+            'system.methodSignature',
+            'this:methodSignature',
+            array('array', 'string'),
+            'Returns an array describing the return type and required parameters of a method'
+        );
+        $this->addCallback(
+            'system.getCapabilities',
+            'this:getCapabilities',
+            array('struct'),
+            'Returns a struct describing the XML-RPC specifications supported by this server'
+        );
+        $this->addCallback(
+            'system.listMethods',
+            'this:listMethods',
+            array('array'),
+            'Returns an array of available methods on this server'
+        );
+        $this->addCallback(
+            'system.methodHelp',
+            'this:methodHelp',
+            array('string', 'string'),
+            'Returns a documentation string for the specified method'
+        );
+    }
+    function addCallback($method, $callback, $args, $help) {
+        $this->callbacks[$method] = $callback;
+        $this->signatures[$method] = $args;
+        $this->help[$method] = $help;
+    }
+    function call($methodname, $args) {
+        // Make sure it's in an array
+        if ($args && !is_array($args)) {
+            $args = array($args);
+        }
+        // Over-rides default call method, adds signature check
+        if (!$this->hasMethod($methodname)) {
+            return new IXR_Error(-32601, 'server error. requested method "'.$this->message->methodName.'" not specified.');
+        }
+        $method = $this->callbacks[$methodname];
+        $signature = $this->signatures[$methodname];
+        $returnType = array_shift($signature);
+        // Check the number of arguments
+        if (count($args) != count($signature)) {
+            return new IXR_Error(-32602, 'server error. wrong number of method parameters');
+        }
+        // Check the argument types
+        $ok = true;
+        $argsbackup = $args;
+        for ($i = 0, $j = count($args); $i < $j; $i++) {
+            $arg = array_shift($args);
+            $type = array_shift($signature);
+            switch ($type) {
+                case 'int':
+                case 'i4':
+                    if (is_array($arg) || !is_int($arg)) {
+                        $ok = false;
+                    }
+                    break;
+                case 'base64':
+                case 'string':
+                    if (!is_string($arg)) {
+                        $ok = false;
+                    }
+                    break;
+                case 'boolean':
+                    if ($arg !== false && $arg !== true) {
+                        $ok = false;
+                    }
+                    break;
+                case 'float':
+                case 'double':
+                    if (!is_float($arg)) {
+                        $ok = false;
+                    }
+                    break;
+                case 'date':
+                case 'dateTime.iso8601':
+                    if (!is_a($arg, 'IXR_Date')) {
+                        $ok = false;
+                    }
+                    break;
+            }
+            if (!$ok) {
+                return new IXR_Error(-32602, 'server error. invalid method parameters');
+            }
+        }
+        // It passed the test - run the "real" method call
+        return parent::call($methodname, $argsbackup);
+    }
+    function methodSignature($method) {
+        if (!$this->hasMethod($method)) {
+            return new IXR_Error(-32601, 'server error. requested method "'.$method.'" not specified.');
+        }
+        // We should be returning an array of types
+        $types = $this->signatures[$method];
+        $return = array();
+        foreach ($types as $type) {
+            switch ($type) {
+                case 'string':
+                    $return[] = 'string';
+                    break;
+                case 'int':
+                case 'i4':
+                    $return[] = 42;
+                    break;
+                case 'double':
+                    $return[] = 3.1415;
+                    break;
+                case 'dateTime.iso8601':
+                    $return[] = new IXR_Date(time());
+                    break;
+                case 'boolean':
+                    $return[] = true;
+                    break;
+                case 'base64':
+                    $return[] = new IXR_Base64('base64');
+                    break;
+                case 'array':
+                    $return[] = array('array');
+                    break;
+                case 'struct':
+                    $return[] = array('struct' => 'struct');
+                    break;
+            }
+        }
+        return $return;
+    }
+    function methodHelp($method) {
+        return $this->help[$method];
+    }
+}
+
+/**
+ * IXR_ClientMulticall
+ *
+ * @package IXR
+ * @since 1.5
+ */
+class IXR_ClientMulticall extends IXR_Client {
+    var $calls = array();
+    function IXR_ClientMulticall($server, $path = false, $port = 80) {
+        parent::IXR_Client($server, $path, $port);
+        $this->useragent = 'The Incutio XML-RPC PHP Library (multicall client)';
+    }
+    function addCall() {
+        $args = func_get_args();
+        $methodName = array_shift($args);
+        $struct = array(
+            'methodName' => $methodName,
+            'params' => $args
+        );
+        $this->calls[] = $struct;
+    }
+    function query() {
+        // Prepare multicall, then call the parent::query() method
+        return parent::query('system.multicall', $this->calls);
+    }
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.mailer-smtp.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.mailer-smtp.php
new file mode 100644
index 0000000000000000000000000000000000000000..2dde26db3a154ee3e8a3b66b236c4889b242a0bb
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.mailer-smtp.php
@@ -0,0 +1,1061 @@
+<?php
+// Last sync [WP11537]
+
+/*~ class.smtp.php
+.---------------------------------------------------------------------------.
+|  Software: PHPMailer - PHP email class                                    |
+|   Version: 2.0.4                                                          |
+|   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
+|      Info: http://phpmailer.sourceforge.net                               |
+|   Support: http://sourceforge.net/projects/phpmailer/                     |
+| ------------------------------------------------------------------------- |
+|    Author: Andy Prevost (project admininistrator)                         |
+|    Author: Brent R. Matzelle (original founder)                           |
+| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved.               |
+| Copyright (c) 2001-2003, Brent R. Matzelle                                |
+| ------------------------------------------------------------------------- |
+|   License: Distributed under the Lesser General Public License (LGPL)     |
+|            http://www.gnu.org/copyleft/lesser.html                        |
+| This program is distributed in the hope that it will be useful - WITHOUT  |
+| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     |
+| FITNESS FOR A PARTICULAR PURPOSE.                                         |
+| ------------------------------------------------------------------------- |
+| We offer a number of paid services (www.codeworxtech.com):                |
+| - Web Hosting on highly optimized fast and secure servers                 |
+| - Technology Consulting                                                   |
+| - Oursourcing (highly qualified programmers and graphic designers)        |
+'---------------------------------------------------------------------------'
+ */
+/**
+ * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
+ * commands except TURN which will always return a not implemented
+ * error. SMTP also provides some utility methods for sending mail
+ * to an SMTP server.
+ * @package PHPMailer
+ * @author Chris Ryan
+ */
+
+class SMTP
+{
+  /**
+   *  SMTP server port
+   *  @var int
+   */
+  var $SMTP_PORT = 25;
+
+  /**
+   *  SMTP reply line ending
+   *  @var string
+   */
+  var $CRLF = "\r\n";
+
+  /**
+   *  Sets whether debugging is turned on
+   *  @var bool
+   */
+  var $do_debug;       # the level of debug to perform
+
+  /**
+   *  Sets VERP use on/off (default is off)
+   *  @var bool
+   */
+  var $do_verp = false;
+
+  /**#@+
+   * @access private
+   */
+  var $smtp_conn;      # the socket to the server
+  var $error;          # error if any on the last call
+  var $helo_rply;      # the reply the server sent to us for HELO
+  /**#@-*/
+
+  /**
+   * Initialize the class so that the data is in a known state.
+   * @access public
+   * @return void
+   */
+  function SMTP() {
+    $this->smtp_conn = 0;
+    $this->error = null;
+    $this->helo_rply = null;
+
+    $this->do_debug = 0;
+  }
+
+  /*************************************************************
+   *                    CONNECTION FUNCTIONS                  *
+   ***********************************************************/
+
+  /**
+   * Connect to the server specified on the port specified.
+   * If the port is not specified use the default SMTP_PORT.
+   * If tval is specified then a connection will try and be
+   * established with the server for that number of seconds.
+   * If tval is not specified the default is 30 seconds to
+   * try on the connection.
+   *
+   * SMTP CODE SUCCESS: 220
+   * SMTP CODE FAILURE: 421
+   * @access public
+   * @return bool
+   */
+  function Connect($host,$port=0,$tval=30) {
+    # set the error val to null so there is no confusion
+    $this->error = null;
+
+    # make sure we are __not__ connected
+    if($this->connected()) {
+      # ok we are connected! what should we do?
+      # for now we will just give an error saying we
+      # are already connected
+      $this->error = array("error" => "Already connected to a server");
+      return false;
+    }
+
+    if(empty($port)) {
+      $port = $this->SMTP_PORT;
+    }
+
+    #connect to the smtp server
+    $this->smtp_conn = fsockopen($host,    # the host of the server
+                                 $port,    # the port to use
+                                 $errno,   # error number if any
+                                 $errstr,  # error message if any
+                                 $tval);   # give up after ? secs
+    # verify we connected properly
+    if(empty($this->smtp_conn)) {
+      $this->error = array("error" => "Failed to connect to server",
+                           "errno" => $errno,
+                           "errstr" => $errstr);
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": $errstr ($errno)" . $this->CRLF;
+      }
+      return false;
+    }
+
+    # sometimes the SMTP server takes a little longer to respond
+    # so we will give it a longer timeout for the first read
+    // Windows still does not have support for this timeout function
+    if(substr(PHP_OS, 0, 3) != "WIN")
+     socket_set_timeout($this->smtp_conn, $tval, 0);
+
+    # get any announcement stuff
+    $announce = $this->get_lines();
+
+    # set the timeout  of any socket functions at 1/10 of a second
+    //if(function_exists("socket_set_timeout"))
+    //   socket_set_timeout($this->smtp_conn, 0, 100000);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
+    }
+
+    return true;
+  }
+
+  /**
+   * Performs SMTP authentication.  Must be run after running the
+   * Hello() method.  Returns true if successfully authenticated.
+   * @access public
+   * @return bool
+   */
+  function Authenticate($username, $password) {
+    // Start authentication
+    fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($code != 334) {
+      $this->error =
+        array("error" => "AUTH not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+
+    // Send encoded username
+    fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($code != 334) {
+      $this->error =
+        array("error" => "Username not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+
+    // Send encoded password
+    fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($code != 235) {
+      $this->error =
+        array("error" => "Password not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+
+    return true;
+  }
+
+  /**
+   * Returns true if connected to a server otherwise false
+   * @access private
+   * @return bool
+   */
+  function Connected() {
+    if(!empty($this->smtp_conn)) {
+      $sock_status = socket_get_status($this->smtp_conn);
+      if($sock_status["eof"]) {
+        # hmm this is an odd situation... the socket is
+        # valid but we are not connected anymore
+        if($this->do_debug >= 1) {
+            echo "SMTP -> NOTICE:" . $this->CRLF .
+                 "EOF caught while checking if connected";
+        }
+        $this->Close();
+        return false;
+      }
+      return true; # everything looks good
+    }
+    return false;
+  }
+
+  /**
+   * Closes the socket and cleans up the state of the class.
+   * It is not considered good to use this function without
+   * first trying to use QUIT.
+   * @access public
+   * @return void
+   */
+  function Close() {
+    $this->error = null; # so there is no confusion
+    $this->helo_rply = null;
+    if(!empty($this->smtp_conn)) {
+      # close the connection and cleanup
+      fclose($this->smtp_conn);
+      $this->smtp_conn = 0;
+    }
+  }
+
+  /***************************************************************
+   *                        SMTP COMMANDS                       *
+   *************************************************************/
+
+  /**
+   * Issues a data command and sends the msg_data to the server
+   * finializing the mail transaction. $msg_data is the message
+   * that is to be send with the headers. Each header needs to be
+   * on a single line followed by a <CRLF> with the message headers
+   * and the message body being seperated by and additional <CRLF>.
+   *
+   * Implements rfc 821: DATA <CRLF>
+   *
+   * SMTP CODE INTERMEDIATE: 354
+   *     [data]
+   *     <CRLF>.<CRLF>
+   *     SMTP CODE SUCCESS: 250
+   *     SMTP CODE FAILURE: 552,554,451,452
+   * SMTP CODE FAILURE: 451,554
+   * SMTP CODE ERROR  : 500,501,503,421
+   * @access public
+   * @return bool
+   */
+  function Data($msg_data) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Data() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"DATA" . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 354) {
+      $this->error =
+        array("error" => "DATA command not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+
+    # the server is ready to accept data!
+    # according to rfc 821 we should not send more than 1000
+    # including the CRLF
+    # characters on a single line so we will break the data up
+    # into lines by \r and/or \n then if needed we will break
+    # each of those into smaller lines to fit within the limit.
+    # in addition we will be looking for lines that start with
+    # a period '.' and append and additional period '.' to that
+    # line. NOTE: this does not count towards are limit.
+
+    # normalize the line breaks so we know the explode works
+    $msg_data = str_replace("\r\n","\n",$msg_data);
+    $msg_data = str_replace("\r","\n",$msg_data);
+    $lines = explode("\n",$msg_data);
+
+    # we need to find a good way to determine is headers are
+    # in the msg_data or if it is a straight msg body
+    # currently I am assuming rfc 822 definitions of msg headers
+    # and if the first field of the first line (':' sperated)
+    # does not contain a space then it _should_ be a header
+    # and we can process all lines before a blank "" line as
+    # headers.
+    $field = substr($lines[0],0,strpos($lines[0],":"));
+    $in_headers = false;
+    if(!empty($field) && !strstr($field," ")) {
+      $in_headers = true;
+    }
+
+    $max_line_length = 998; # used below; set here for ease in change
+
+    while(list(,$line) = @each($lines)) {
+      $lines_out = null;
+      if($line == "" && $in_headers) {
+        $in_headers = false;
+      }
+      # ok we need to break this line up into several
+      # smaller lines
+      while(strlen($line) > $max_line_length) {
+        $pos = strrpos(substr($line,0,$max_line_length)," ");
+
+        # Patch to fix DOS attack
+        if(!$pos) {
+          $pos = $max_line_length - 1;
+        }
+
+        $lines_out[] = substr($line,0,$pos);
+        $line = substr($line,$pos + 1);
+        # if we are processing headers we need to
+        # add a LWSP-char to the front of the new line
+        # rfc 822 on long msg headers
+        if($in_headers) {
+          $line = "\t" . $line;
+        }
+      }
+      $lines_out[] = $line;
+
+      # now send the lines to the server
+      while(list(,$line_out) = @each($lines_out)) {
+        if(strlen($line_out) > 0)
+        {
+          if(substr($line_out, 0, 1) == ".") {
+            $line_out = "." . $line_out;
+          }
+        }
+        fputs($this->smtp_conn,$line_out . $this->CRLF);
+      }
+    }
+
+    # ok all the message data has been sent so lets get this
+    # over with aleady
+    fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "DATA not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Expand takes the name and asks the server to list all the
+   * people who are members of the _list_. Expand will return
+   * back and array of the result or false if an error occurs.
+   * Each value in the array returned has the format of:
+   *     [ <full-name> <sp> ] <path>
+   * The definition of <path> is defined in rfc 821
+   *
+   * Implements rfc 821: EXPN <SP> <string> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE FAILURE: 550
+   * SMTP CODE ERROR  : 500,501,502,504,421
+   * @access public
+   * @return string array
+   */
+  function Expand($name) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+            "error" => "Called Expand() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "EXPN not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+
+    # parse the reply and place in our array to return to user
+    $entries = explode($this->CRLF,$rply);
+    while(list(,$l) = @each($entries)) {
+      $list[] = substr($l,4);
+    }
+
+    return $list;
+  }
+
+  /**
+   * Sends the HELO command to the smtp server.
+   * This makes sure that we and the server are in
+   * the same known state.
+   *
+   * Implements from rfc 821: HELO <SP> <domain> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE ERROR  : 500, 501, 504, 421
+   * @access public
+   * @return bool
+   */
+  function Hello($host="") {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+            "error" => "Called Hello() without being connected");
+      return false;
+    }
+
+    # if a hostname for the HELO was not specified determine
+    # a suitable one to send
+    if(empty($host)) {
+      # we need to determine some sort of appopiate default
+      # to send to the server
+      $host = "localhost";
+    }
+
+    // Send extended hello first (RFC 2821)
+    if(!$this->SendHello("EHLO", $host))
+    {
+      if(!$this->SendHello("HELO", $host))
+          return false;
+    }
+
+    return true;
+  }
+
+  /**
+   * Sends a HELO/EHLO command.
+   * @access private
+   * @return bool
+   */
+  function SendHello($hello, $host) {
+    fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => $hello . " not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+
+    $this->helo_rply = $rply;
+
+    return true;
+  }
+
+  /**
+   * Gets help information on the keyword specified. If the keyword
+   * is not specified then returns generic help, ussually contianing
+   * A list of keywords that help is available on. This function
+   * returns the results back to the user. It is up to the user to
+   * handle the returned data. If an error occurs then false is
+   * returned with $this->error set appropiately.
+   *
+   * Implements rfc 821: HELP [ <SP> <string> ] <CRLF>
+   *
+   * SMTP CODE SUCCESS: 211,214
+   * SMTP CODE ERROR  : 500,501,502,504,421
+   * @access public
+   * @return string
+   */
+  function Help($keyword="") {
+    $this->error = null; # to avoid confusion
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Help() without being connected");
+      return false;
+    }
+
+    $extra = "";
+    if(!empty($keyword)) {
+      $extra = " " . $keyword;
+    }
+
+    fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 211 && $code != 214) {
+      $this->error =
+        array("error" => "HELP not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+
+    return $rply;
+  }
+
+  /**
+   * Starts a mail transaction from the email address specified in
+   * $from. Returns true if successful or false otherwise. If True
+   * the mail transaction is started and then one or more Recipient
+   * commands may be called followed by a Data command.
+   *
+   * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE SUCCESS: 552,451,452
+   * SMTP CODE SUCCESS: 500,501,421
+   * @access public
+   * @return bool
+   */
+  function Mail($from) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Mail() without being connected");
+      return false;
+    }
+
+    $useVerp = ($this->do_verp ? "XVERP" : "");
+    fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "MAIL not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Sends the command NOOP to the SMTP server.
+   *
+   * Implements from rfc 821: NOOP <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE ERROR  : 500, 421
+   * @access public
+   * @return bool
+   */
+  function Noop() {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Noop() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"NOOP" . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "NOOP not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Sends the quit command to the server and then closes the socket
+   * if there is no error or the $close_on_error argument is true.
+   *
+   * Implements from rfc 821: QUIT <CRLF>
+   *
+   * SMTP CODE SUCCESS: 221
+   * SMTP CODE ERROR  : 500
+   * @access public
+   * @return bool
+   */
+  function Quit($close_on_error=true) {
+    $this->error = null; # so there is no confusion
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Quit() without being connected");
+      return false;
+    }
+
+    # send the quit command to the server
+    fputs($this->smtp_conn,"quit" . $this->CRLF);
+
+    # get any good-bye messages
+    $byemsg = $this->get_lines();
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
+    }
+
+    $rval = true;
+    $e = null;
+
+    $code = substr($byemsg,0,3);
+    if($code != 221) {
+      # use e as a tmp var cause Close will overwrite $this->error
+      $e = array("error" => "SMTP server rejected quit command",
+                 "smtp_code" => $code,
+                 "smtp_rply" => substr($byemsg,4));
+      $rval = false;
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $e["error"] . ": " .
+                 $byemsg . $this->CRLF;
+      }
+    }
+
+    if(empty($e) || $close_on_error) {
+      $this->Close();
+    }
+
+    return $rval;
+  }
+
+  /**
+   * Sends the command RCPT to the SMTP server with the TO: argument of $to.
+   * Returns true if the recipient was accepted false if it was rejected.
+   *
+   * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250,251
+   * SMTP CODE FAILURE: 550,551,552,553,450,451,452
+   * SMTP CODE ERROR  : 500,501,503,421
+   * @access public
+   * @return bool
+   */
+  function Recipient($to) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Recipient() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250 && $code != 251) {
+      $this->error =
+        array("error" => "RCPT not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Sends the RSET command to abort and transaction that is
+   * currently in progress. Returns true if successful false
+   * otherwise.
+   *
+   * Implements rfc 821: RSET <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE ERROR  : 500,501,504,421
+   * @access public
+   * @return bool
+   */
+  function Reset() {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Reset() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"RSET" . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "RSET failed",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+
+    return true;
+  }
+
+  /**
+   * Starts a mail transaction from the email address specified in
+   * $from. Returns true if successful or false otherwise. If True
+   * the mail transaction is started and then one or more Recipient
+   * commands may be called followed by a Data command. This command
+   * will send the message to the users terminal if they are logged
+   * in.
+   *
+   * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE SUCCESS: 552,451,452
+   * SMTP CODE SUCCESS: 500,501,502,421
+   * @access public
+   * @return bool
+   */
+  function Send($from) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Send() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "SEND not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Starts a mail transaction from the email address specified in
+   * $from. Returns true if successful or false otherwise. If True
+   * the mail transaction is started and then one or more Recipient
+   * commands may be called followed by a Data command. This command
+   * will send the message to the users terminal if they are logged
+   * in and send them an email.
+   *
+   * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE SUCCESS: 552,451,452
+   * SMTP CODE SUCCESS: 500,501,502,421
+   * @access public
+   * @return bool
+   */
+  function SendAndMail($from) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+          "error" => "Called SendAndMail() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "SAML not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Starts a mail transaction from the email address specified in
+   * $from. Returns true if successful or false otherwise. If True
+   * the mail transaction is started and then one or more Recipient
+   * commands may be called followed by a Data command. This command
+   * will send the message to the users terminal if they are logged
+   * in or mail it to them if they are not.
+   *
+   * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE SUCCESS: 552,451,452
+   * SMTP CODE SUCCESS: 500,501,502,421
+   * @access public
+   * @return bool
+   */
+  function SendOrMail($from) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+          "error" => "Called SendOrMail() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "SOML not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * This is an optional command for SMTP that this class does not
+   * support. This method is here to make the RFC821 Definition
+   * complete for this class and __may__ be implimented in the future
+   *
+   * Implements from rfc 821: TURN <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE FAILURE: 502
+   * SMTP CODE ERROR  : 500, 503
+   * @access public
+   * @return bool
+   */
+  function Turn() {
+    $this->error = array("error" => "This method, TURN, of the SMTP ".
+                                    "is not implemented");
+    if($this->do_debug >= 1) {
+      echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
+    }
+    return false;
+  }
+
+  /**
+   * Verifies that the name is recognized by the server.
+   * Returns false if the name could not be verified otherwise
+   * the response from the server is returned.
+   *
+   * Implements rfc 821: VRFY <SP> <string> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250,251
+   * SMTP CODE FAILURE: 550,551,553
+   * SMTP CODE ERROR  : 500,501,502,421
+   * @access public
+   * @return int
+   */
+  function Verify($name) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Verify() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250 && $code != 251) {
+      $this->error =
+        array("error" => "VRFY failed on name '$name'",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return $rply;
+  }
+
+  /*******************************************************************
+   *                       INTERNAL FUNCTIONS                       *
+   ******************************************************************/
+
+  /**
+   * Read in as many lines as possible
+   * either before eof or socket timeout occurs on the operation.
+   * With SMTP we can tell if we have more lines to read if the
+   * 4th character is '-' symbol. If it is a space then we don't
+   * need to read anything else.
+   * @access private
+   * @return string
+   */
+  function get_lines() {
+    $data = "";
+    while($str = @fgets($this->smtp_conn,515)) {
+      if($this->do_debug >= 4) {
+        echo "SMTP -> get_lines(): \$data was \"$data\"" .
+                 $this->CRLF;
+        echo "SMTP -> get_lines(): \$str is \"$str\"" .
+                 $this->CRLF;
+      }
+      $data .= $str;
+      if($this->do_debug >= 4) {
+        echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
+      }
+      # if the 4th character is a space then we are done reading
+      # so just break the loop
+      if(substr($str,3,1) == " ") { break; }
+    }
+    return $data;
+  }
+
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.mailer.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.mailer.php
new file mode 100644
index 0000000000000000000000000000000000000000..9ad6d4f52ba0c7de3760accd1c2f47a22983837d
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.mailer.php
@@ -0,0 +1,1921 @@
+<?php
+// Last sync [WP11537]
+
+/*~ class.phpmailer.php
+.---------------------------------------------------------------------------.
+|  Software: PHPMailer - PHP email class                                    |
+|   Version: 2.0.4                                                          |
+|   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
+|      Info: http://phpmailer.sourceforge.net                               |
+|   Support: http://sourceforge.net/projects/phpmailer/                     |
+| ------------------------------------------------------------------------- |
+|    Author: Andy Prevost (project admininistrator)                         |
+|    Author: Brent R. Matzelle (original founder)                           |
+| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved.               |
+| Copyright (c) 2001-2003, Brent R. Matzelle                                |
+| ------------------------------------------------------------------------- |
+|   License: Distributed under the Lesser General Public License (LGPL)     |
+|            http://www.gnu.org/copyleft/lesser.html                        |
+| This program is distributed in the hope that it will be useful - WITHOUT  |
+| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     |
+| FITNESS FOR A PARTICULAR PURPOSE.                                         |
+| ------------------------------------------------------------------------- |
+| We offer a number of paid services (www.codeworxtech.com):                |
+| - Web Hosting on highly optimized fast and secure servers                 |
+| - Technology Consulting                                                   |
+| - Oursourcing (highly qualified programmers and graphic designers)        |
+'---------------------------------------------------------------------------'
+ */
+/**
+ * PHPMailer - PHP email transport class
+ * @package PHPMailer
+ * @author Andy Prevost
+ * @copyright 2004 - 2009 Andy Prevost
+ */
+
+class PHPMailer {
+
+  /////////////////////////////////////////////////
+  // PROPERTIES, PUBLIC
+  /////////////////////////////////////////////////
+
+  /**
+   * Email priority (1 = High, 3 = Normal, 5 = low).
+   * @var int
+   */
+  var $Priority          = 3;
+
+  /**
+   * Sets the CharSet of the message.
+   * @var string
+   */
+  var $CharSet           = 'iso-8859-1';
+
+  /**
+   * Sets the Content-type of the message.
+   * @var string
+   */
+  var $ContentType        = 'text/plain';
+
+  /**
+   * Sets the Encoding of the message. Options for this are "8bit",
+   * "7bit", "binary", "base64", and "quoted-printable".
+   * @var string
+   */
+  var $Encoding          = '8bit';
+
+  /**
+   * Holds the most recent mailer error message.
+   * @var string
+   */
+  var $ErrorInfo         = '';
+
+  /**
+   * Sets the From email address for the message.
+   * @var string
+   */
+  var $From              = 'root@localhost';
+
+  /**
+   * Sets the From name of the message.
+   * @var string
+   */
+  var $FromName          = 'Root User';
+
+  /**
+   * Sets the Sender email (Return-Path) of the message.  If not empty,
+   * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
+   * @var string
+   */
+  var $Sender            = '';
+
+  /**
+   * Sets the Subject of the message.
+   * @var string
+   */
+  var $Subject           = '';
+
+  /**
+   * Sets the Body of the message.  This can be either an HTML or text body.
+   * If HTML then run IsHTML(true).
+   * @var string
+   */
+  var $Body              = '';
+
+  /**
+   * Sets the text-only body of the message.  This automatically sets the
+   * email to multipart/alternative.  This body can be read by mail
+   * clients that do not have HTML email capability such as mutt. Clients
+   * that can read HTML will view the normal Body.
+   * @var string
+   */
+  var $AltBody           = '';
+
+  /**
+   * Sets word wrapping on the body of the message to a given number of
+   * characters.
+   * @var int
+   */
+  var $WordWrap          = 0;
+
+  /**
+   * Method to send mail: ("mail", "sendmail", or "smtp").
+   * @var string
+   */
+  var $Mailer            = 'mail';
+
+  /**
+   * Sets the path of the sendmail program.
+   * @var string
+   */
+  var $Sendmail          = '/usr/sbin/sendmail';
+
+  /**
+   * Path to PHPMailer plugins.  This is now only useful if the SMTP class
+   * is in a different directory than the PHP include path.
+   * @var string
+   */
+  var $PluginDir         = '';
+
+  /**
+   * Holds PHPMailer version.
+   * @var string
+   */
+  var $Version           = "2.0.4";
+
+  /**
+   * Sets the email address that a reading confirmation will be sent.
+   * @var string
+   */
+  var $ConfirmReadingTo  = '';
+
+  /**
+   * Sets the hostname to use in Message-Id and Received headers
+   * and as default HELO string. If empty, the value returned
+   * by SERVER_NAME is used or 'localhost.localdomain'.
+   * @var string
+   */
+  var $Hostname          = '';
+
+  /**
+   * Sets the message ID to be used in the Message-Id header.
+   * If empty, a unique id will be generated.
+   * @var string
+   */
+  var $MessageID         = '';
+
+  /////////////////////////////////////////////////
+  // PROPERTIES FOR SMTP
+  /////////////////////////////////////////////////
+
+  /**
+   * Sets the SMTP hosts.  All hosts must be separated by a
+   * semicolon.  You can also specify a different port
+   * for each host by using this format: [hostname:port]
+   * (e.g. "smtp1.example.com:25;smtp2.example.com").
+   * Hosts will be tried in order.
+   * @var string
+   */
+  var $Host        = 'localhost';
+
+  /**
+   * Sets the default SMTP server port.
+   * @var int
+   */
+  var $Port        = 25;
+
+  /**
+   * Sets the SMTP HELO of the message (Default is $Hostname).
+   * @var string
+   */
+  var $Helo        = '';
+
+  /**
+   * Sets connection prefix.
+   * Options are "", "ssl" or "tls"
+   * @var string
+   */
+  var $SMTPSecure = "";
+
+  /**
+   * Sets SMTP authentication. Utilizes the Username and Password variables.
+   * @var bool
+   */
+  var $SMTPAuth     = false;
+
+  /**
+   * Sets SMTP username.
+   * @var string
+   */
+  var $Username     = '';
+
+  /**
+   * Sets SMTP password.
+   * @var string
+   */
+  var $Password     = '';
+
+  /**
+   * Sets the SMTP server timeout in seconds. This function will not
+   * work with the win32 version.
+   * @var int
+   */
+  var $Timeout      = 10;
+
+  /**
+   * Sets SMTP class debugging on or off.
+   * @var bool
+   */
+  var $SMTPDebug    = false;
+
+  /**
+   * Prevents the SMTP connection from being closed after each mail
+   * sending.  If this is set to true then to close the connection
+   * requires an explicit call to SmtpClose().
+   * @var bool
+   */
+  var $SMTPKeepAlive = false;
+
+  /**
+   * Provides the ability to have the TO field process individual
+   * emails, instead of sending to entire TO addresses
+   * @var bool
+   */
+  var $SingleTo = false;
+
+  /////////////////////////////////////////////////
+  // PROPERTIES, PRIVATE
+  /////////////////////////////////////////////////
+
+  var $smtp            = NULL;
+  var $to              = array();
+  var $cc              = array();
+  var $bcc             = array();
+  var $ReplyTo         = array();
+  var $attachment      = array();
+  var $CustomHeader    = array();
+  var $message_type    = '';
+  var $boundary        = array();
+  var $language        = array();
+  var $error_count     = 0;
+  var $LE              = "\n";
+  var $sign_cert_file  = "";
+  var $sign_key_file   = "";
+  var $sign_key_pass   = "";
+
+  /////////////////////////////////////////////////
+  // METHODS, VARIABLES
+  /////////////////////////////////////////////////
+
+  /**
+   * Sets message type to HTML.
+   * @param bool $bool
+   * @return void
+   */
+  function IsHTML($bool) {
+    if($bool == true) {
+      $this->ContentType = 'text/html';
+    } else {
+      $this->ContentType = 'text/plain';
+    }
+  }
+
+  /**
+   * Sets Mailer to send message using SMTP.
+   * @return void
+   */
+  function IsSMTP() {
+    $this->Mailer = 'smtp';
+  }
+
+  /**
+   * Sets Mailer to send message using PHP mail() function.
+   * @return void
+   */
+  function IsMail() {
+    $this->Mailer = 'mail';
+  }
+
+  /**
+   * Sets Mailer to send message using the $Sendmail program.
+   * @return void
+   */
+  function IsSendmail() {
+    $this->Mailer = 'sendmail';
+  }
+
+  /**
+   * Sets Mailer to send message using the qmail MTA.
+   * @return void
+   */
+  function IsQmail() {
+    $this->Sendmail = '/var/qmail/bin/sendmail';
+    $this->Mailer = 'sendmail';
+  }
+
+  /////////////////////////////////////////////////
+  // METHODS, RECIPIENTS
+  /////////////////////////////////////////////////
+
+  /**
+   * Adds a "To" address.
+   * @param string $address
+   * @param string $name
+   * @return void
+   */
+  function AddAddress($address, $name = '') {
+    $cur = count($this->to);
+    $this->to[$cur][0] = trim($address);
+    $this->to[$cur][1] = $name;
+  }
+
+  /**
+   * Adds a "Cc" address. Note: this function works
+   * with the SMTP mailer on win32, not with the "mail"
+   * mailer.
+   * @param string $address
+   * @param string $name
+   * @return void
+   */
+  function AddCC($address, $name = '') {
+    $cur = count($this->cc);
+    $this->cc[$cur][0] = trim($address);
+    $this->cc[$cur][1] = $name;
+  }
+
+  /**
+   * Adds a "Bcc" address. Note: this function works
+   * with the SMTP mailer on win32, not with the "mail"
+   * mailer.
+   * @param string $address
+   * @param string $name
+   * @return void
+   */
+  function AddBCC($address, $name = '') {
+    $cur = count($this->bcc);
+    $this->bcc[$cur][0] = trim($address);
+    $this->bcc[$cur][1] = $name;
+  }
+
+  /**
+   * Adds a "Reply-To" address.
+   * @param string $address
+   * @param string $name
+   * @return void
+   */
+  function AddReplyTo($address, $name = '') {
+    $cur = count($this->ReplyTo);
+    $this->ReplyTo[$cur][0] = trim($address);
+    $this->ReplyTo[$cur][1] = $name;
+  }
+
+  /////////////////////////////////////////////////
+  // METHODS, MAIL SENDING
+  /////////////////////////////////////////////////
+
+  /**
+   * Creates message and assigns Mailer. If the message is
+   * not sent successfully then it returns false.  Use the ErrorInfo
+   * variable to view description of the error.
+   * @return bool
+   */
+  function Send() {
+    $header = '';
+    $body = '';
+    $result = true;
+
+    if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
+      $this->SetError($this->Lang('provide_address'));
+      return false;
+    }
+
+    /* Set whether the message is multipart/alternative */
+    if(!empty($this->AltBody)) {
+      $this->ContentType = 'multipart/alternative';
+    }
+
+    $this->error_count = 0; // reset errors
+    $this->SetMessageType();
+    $header .= $this->CreateHeader();
+    $body = $this->CreateBody();
+
+    if($body == '') {
+      return false;
+    }
+
+    /* Choose the mailer */
+    switch($this->Mailer) {
+      case 'sendmail':
+        $result = $this->SendmailSend($header, $body);
+        break;
+      case 'smtp':
+        $result = $this->SmtpSend($header, $body);
+        break;
+      case 'mail':
+        $result = $this->MailSend($header, $body);
+        break;
+      default:
+        $result = $this->MailSend($header, $body);
+        break;
+        //$this->SetError($this->Mailer . $this->Lang('mailer_not_supported'));
+        //$result = false;
+        //break;
+    }
+
+    return $result;
+  }
+
+  /**
+   * Sends mail using the $Sendmail program.
+   * @access private
+   * @return bool
+   */
+  function SendmailSend($header, $body) {
+    if ($this->Sender != '') {
+      $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
+    } else {
+      $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
+    }
+
+    if(!@$mail = popen($sendmail, 'w')) {
+      $this->SetError($this->Lang('execute') . $this->Sendmail);
+      return false;
+    }
+
+    fputs($mail, $header);
+    fputs($mail, $body);
+
+    $result = pclose($mail);
+    if (version_compare(phpversion(), '4.2.3') == -1) {
+      $result = $result >> 8 & 0xFF;
+    }
+    if($result != 0) {
+      $this->SetError($this->Lang('execute') . $this->Sendmail);
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Sends mail using the PHP mail() function.
+   * @access private
+   * @return bool
+   */
+  function MailSend($header, $body) {
+
+    $to = '';
+    for($i = 0; $i < count($this->to); $i++) {
+      if($i != 0) { $to .= ', '; }
+      $to .= $this->AddrFormat($this->to[$i]);
+    }
+
+    $toArr = split(',', $to);
+
+    $params = sprintf("-oi -f %s", $this->Sender);
+    if ($this->Sender != '' && strlen(ini_get('safe_mode')) < 1) {
+      $old_from = ini_get('sendmail_from');
+      ini_set('sendmail_from', $this->Sender);
+      if ($this->SingleTo === true && count($toArr) > 1) {
+        foreach ($toArr as $key => $val) {
+          $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
+        }
+      } else {
+        $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
+      }
+    } else {
+      if ($this->SingleTo === true && count($toArr) > 1) {
+        foreach ($toArr as $key => $val) {
+          $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
+        }
+      } else {
+        $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
+      }
+    }
+
+    if (isset($old_from)) {
+      ini_set('sendmail_from', $old_from);
+    }
+
+    if(!$rt) {
+      $this->SetError($this->Lang('instantiate'));
+      return false;
+    }
+
+    return true;
+  }
+
+  /**
+   * Sends mail via SMTP using PhpSMTP (Author:
+   * Chris Ryan).  Returns bool.  Returns false if there is a
+   * bad MAIL FROM, RCPT, or DATA input.
+   * @access private
+   * @return bool
+   */
+  function SmtpSend($header, $body) {
+    include_once('class.mailer-smtp.php');
+    $error = '';
+    $bad_rcpt = array();
+
+    if(!$this->SmtpConnect()) {
+      return false;
+    }
+
+    $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
+    if(!$this->smtp->Mail($smtp_from)) {
+      $error = $this->Lang('from_failed') . $smtp_from;
+      $this->SetError($error);
+      $this->smtp->Reset();
+      return false;
+    }
+
+    /* Attempt to send attach all recipients */
+    for($i = 0; $i < count($this->to); $i++) {
+      if(!$this->smtp->Recipient($this->to[$i][0])) {
+        $bad_rcpt[] = $this->to[$i][0];
+      }
+    }
+    for($i = 0; $i < count($this->cc); $i++) {
+      if(!$this->smtp->Recipient($this->cc[$i][0])) {
+        $bad_rcpt[] = $this->cc[$i][0];
+      }
+    }
+    for($i = 0; $i < count($this->bcc); $i++) {
+      if(!$this->smtp->Recipient($this->bcc[$i][0])) {
+        $bad_rcpt[] = $this->bcc[$i][0];
+      }
+    }
+
+    if(count($bad_rcpt) > 0) { // Create error message
+      for($i = 0; $i < count($bad_rcpt); $i++) {
+        if($i != 0) {
+          $error .= ', ';
+        }
+        $error .= $bad_rcpt[$i];
+      }
+      $error = $this->Lang('recipients_failed') . $error;
+      $this->SetError($error);
+      $this->smtp->Reset();
+      return false;
+    }
+
+    if(!$this->smtp->Data($header . $body)) {
+      $this->SetError($this->Lang('data_not_accepted'));
+      $this->smtp->Reset();
+      return false;
+    }
+    if($this->SMTPKeepAlive == true) {
+      $this->smtp->Reset();
+    } else {
+      $this->SmtpClose();
+    }
+
+    return true;
+  }
+
+  /**
+   * Initiates a connection to an SMTP server.  Returns false if the
+   * operation failed.
+   * @access private
+   * @return bool
+   */
+  function SmtpConnect() {
+    if($this->smtp == NULL) {
+      $this->smtp = new SMTP();
+    }
+
+    $this->smtp->do_debug = $this->SMTPDebug;
+    $hosts = explode(';', $this->Host);
+    $index = 0;
+    $connection = ($this->smtp->Connected());
+
+    /* Retry while there is no connection */
+    while($index < count($hosts) && $connection == false) {
+      $hostinfo = array();
+      if(eregi('^(.+):([0-9]+)$', $hosts[$index], $hostinfo)) {
+        $host = $hostinfo[1];
+        $port = $hostinfo[2];
+      } else {
+        $host = $hosts[$index];
+        $port = $this->Port;
+      }
+
+      if($this->smtp->Connect(((!empty($this->SMTPSecure))?$this->SMTPSecure.'://':'').$host, $port, $this->Timeout)) {
+        if ($this->Helo != '') {
+          $this->smtp->Hello($this->Helo);
+        } else {
+          $this->smtp->Hello($this->ServerHostname());
+        }
+
+        $connection = true;
+        if($this->SMTPAuth) {
+          if(!$this->smtp->Authenticate($this->Username, $this->Password)) {
+            $this->SetError($this->Lang('authenticate'));
+            $this->smtp->Reset();
+            $connection = false;
+          }
+        }
+      }
+      $index++;
+    }
+    if(!$connection) {
+      $this->SetError($this->Lang('connect_host'));
+    }
+
+    return $connection;
+  }
+
+  /**
+   * Closes the active SMTP session if one exists.
+   * @return void
+   */
+  function SmtpClose() {
+    if($this->smtp != NULL) {
+      if($this->smtp->Connected()) {
+        $this->smtp->Quit();
+        $this->smtp->Close();
+      }
+    }
+  }
+
+  /**
+   * Sets the language for all class error messages.  Returns false
+   * if it cannot load the language file.  The default language type
+   * is English.
+   * @param string $lang_type Type of language (e.g. Portuguese: "br")
+   * @param string $lang_path Path to the language file directory
+   * @access public
+   * @return bool
+   */
+  function SetLanguage($lang_type, $lang_path = 'language/') {
+    if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) {
+      include($lang_path.'phpmailer.lang-'.$lang_type.'.php');
+    } elseif (file_exists($lang_path.'phpmailer.lang-en.php')) {
+      include($lang_path.'phpmailer.lang-en.php');
+    } else {
+      $PHPMAILER_LANG = array();
+      $PHPMAILER_LANG["provide_address"]      = 'You must provide at least one ' .
+      $PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';
+      $PHPMAILER_LANG["execute"]              = 'Could not execute: ';
+      $PHPMAILER_LANG["instantiate"]          = 'Could not instantiate mail function.';
+      $PHPMAILER_LANG["authenticate"]         = 'SMTP Error: Could not authenticate.';
+      $PHPMAILER_LANG["from_failed"]          = 'The following From address failed: ';
+      $PHPMAILER_LANG["recipients_failed"]    = 'SMTP Error: The following ' .
+      $PHPMAILER_LANG["data_not_accepted"]    = 'SMTP Error: Data not accepted.';
+      $PHPMAILER_LANG["connect_host"]         = 'SMTP Error: Could not connect to SMTP host.';
+      $PHPMAILER_LANG["file_access"]          = 'Could not access file: ';
+      $PHPMAILER_LANG["file_open"]            = 'File Error: Could not open file: ';
+      $PHPMAILER_LANG["encoding"]             = 'Unknown encoding: ';
+      $PHPMAILER_LANG["signing"]              = 'Signing Error: ';
+    }
+    $this->language = $PHPMAILER_LANG;
+
+    return true;
+  }
+
+  /////////////////////////////////////////////////
+  // METHODS, MESSAGE CREATION
+  /////////////////////////////////////////////////
+
+  /**
+   * Creates recipient headers.
+   * @access private
+   * @return string
+   */
+  function AddrAppend($type, $addr) {
+    $addr_str = $type . ': ';
+    $addr_str .= $this->AddrFormat($addr[0]);
+    if(count($addr) > 1) {
+      for($i = 1; $i < count($addr); $i++) {
+        $addr_str .= ', ' . $this->AddrFormat($addr[$i]);
+      }
+    }
+    $addr_str .= $this->LE;
+
+    return $addr_str;
+  }
+
+  /**
+   * Formats an address correctly.
+   * @access private
+   * @return string
+   */
+  function AddrFormat($addr) {
+    if(empty($addr[1])) {
+      $formatted = $this->SecureHeader($addr[0]);
+    } else {
+      $formatted = $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
+    }
+
+    return $formatted;
+  }
+
+  /**
+   * Wraps message for use with mailers that do not
+   * automatically perform wrapping and for quoted-printable.
+   * Original written by philippe.
+   * @access private
+   * @return string
+   */
+  function WrapText($message, $length, $qp_mode = false) {
+    $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
+    // If utf-8 encoding is used, we will need to make sure we don't
+    // split multibyte characters when we wrap
+    $is_utf8 = (strtolower($this->CharSet) == "utf-8");
+
+    $message = $this->FixEOL($message);
+    if (substr($message, -1) == $this->LE) {
+      $message = substr($message, 0, -1);
+    }
+
+    $line = explode($this->LE, $message);
+    $message = '';
+    for ($i=0 ;$i < count($line); $i++) {
+      $line_part = explode(' ', $line[$i]);
+      $buf = '';
+      for ($e = 0; $e<count($line_part); $e++) {
+        $word = $line_part[$e];
+        if ($qp_mode and (strlen($word) > $length)) {
+          $space_left = $length - strlen($buf) - 1;
+          if ($e != 0) {
+            if ($space_left > 20) {
+              $len = $space_left;
+              if ($is_utf8) {
+                $len = $this->UTF8CharBoundary($word, $len);
+              } elseif (substr($word, $len - 1, 1) == "=") {
+                $len--;
+              } elseif (substr($word, $len - 2, 1) == "=") {
+                $len -= 2;
+              }
+              $part = substr($word, 0, $len);
+              $word = substr($word, $len);
+              $buf .= ' ' . $part;
+              $message .= $buf . sprintf("=%s", $this->LE);
+            } else {
+              $message .= $buf . $soft_break;
+            }
+            $buf = '';
+          }
+          while (strlen($word) > 0) {
+            $len = $length;
+            if ($is_utf8) {
+              $len = $this->UTF8CharBoundary($word, $len);
+            } elseif (substr($word, $len - 1, 1) == "=") {
+              $len--;
+            } elseif (substr($word, $len - 2, 1) == "=") {
+              $len -= 2;
+            }
+            $part = substr($word, 0, $len);
+            $word = substr($word, $len);
+
+            if (strlen($word) > 0) {
+              $message .= $part . sprintf("=%s", $this->LE);
+            } else {
+              $buf = $part;
+            }
+          }
+        } else {
+          $buf_o = $buf;
+          $buf .= ($e == 0) ? $word : (' ' . $word);
+
+          if (strlen($buf) > $length and $buf_o != '') {
+            $message .= $buf_o . $soft_break;
+            $buf = $word;
+          }
+        }
+      }
+      $message .= $buf . $this->LE;
+    }
+
+    return $message;
+  }
+
+  /**
+   * Finds last character boundary prior to maxLength in a utf-8
+   * quoted (printable) encoded string.
+   * Original written by Colin Brown.
+   * @access private
+   * @param string $encodedText utf-8 QP text
+   * @param int    $maxLength   find last character boundary prior to this length
+   * @return int
+   */
+  function UTF8CharBoundary($encodedText, $maxLength) {
+    $foundSplitPos = false;
+    $lookBack = 3;
+    while (!$foundSplitPos) {
+      $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
+      $encodedCharPos = strpos($lastChunk, "=");
+      if ($encodedCharPos !== false) {
+        // Found start of encoded character byte within $lookBack block.
+        // Check the encoded byte value (the 2 chars after the '=')
+        $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
+        $dec = hexdec($hex);
+        if ($dec < 128) { // Single byte character.
+          // If the encoded char was found at pos 0, it will fit
+          // otherwise reduce maxLength to start of the encoded char
+          $maxLength = ($encodedCharPos == 0) ? $maxLength :
+          $maxLength - ($lookBack - $encodedCharPos);
+          $foundSplitPos = true;
+        } elseif ($dec >= 192) { // First byte of a multi byte character
+          // Reduce maxLength to split at start of character
+          $maxLength = $maxLength - ($lookBack - $encodedCharPos);
+          $foundSplitPos = true;
+        } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
+          $lookBack += 3;
+        }
+      } else {
+        // No encoded character found
+        $foundSplitPos = true;
+      }
+    }
+    return $maxLength;
+  }
+
+  /**
+   * Set the body wrapping.
+   * @access private
+   * @return void
+   */
+  function SetWordWrap() {
+    if($this->WordWrap < 1) {
+      return;
+    }
+
+    switch($this->message_type) {
+      case 'alt':
+        /* fall through */
+      case 'alt_attachments':
+        $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
+        break;
+      default:
+        $this->Body = $this->WrapText($this->Body, $this->WordWrap);
+        break;
+    }
+  }
+
+  /**
+   * Assembles message header.
+   * @access private
+   * @return string
+   */
+  function CreateHeader() {
+    $result = '';
+
+    /* Set the boundaries */
+    $uniq_id = md5(uniqid(time()));
+    $this->boundary[1] = 'b1_' . $uniq_id;
+    $this->boundary[2] = 'b2_' . $uniq_id;
+
+    $result .= $this->HeaderLine('Date', $this->RFCDate());
+    if($this->Sender == '') {
+      $result .= $this->HeaderLine('Return-Path', trim($this->From));
+    } else {
+      $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
+    }
+
+    /* To be created automatically by mail() */
+    if($this->Mailer != 'mail') {
+      if(count($this->to) > 0) {
+        $result .= $this->AddrAppend('To', $this->to);
+      } elseif (count($this->cc) == 0) {
+        $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
+      }
+    }
+
+    $from = array();
+    $from[0][0] = trim($this->From);
+    $from[0][1] = $this->FromName;
+    $result .= $this->AddrAppend('From', $from);
+
+    /* sendmail and mail() extract Cc from the header before sending */
+    if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->cc) > 0)) {
+      $result .= $this->AddrAppend('Cc', $this->cc);
+    }
+
+    /* sendmail and mail() extract Bcc from the header before sending */
+    if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
+      $result .= $this->AddrAppend('Bcc', $this->bcc);
+    }
+
+    if(count($this->ReplyTo) > 0) {
+      $result .= $this->AddrAppend('Reply-To', $this->ReplyTo);
+    }
+
+    /* mail() sets the subject itself */
+    if($this->Mailer != 'mail') {
+      $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
+    }
+
+    if($this->MessageID != '') {
+      $result .= $this->HeaderLine('Message-ID',$this->MessageID);
+    } else {
+      $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
+    }
+    $result .= $this->HeaderLine('X-Priority', $this->Priority);
+    $result .= $this->HeaderLine('X-Mailer', 'PHPMailer (phpmailer.sourceforge.net) [version ' . $this->Version . ']');
+
+    if($this->ConfirmReadingTo != '') {
+      $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
+    }
+
+    // Add custom headers
+    for($index = 0; $index < count($this->CustomHeader); $index++) {
+      $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
+    }
+    if (!$this->sign_key_file) {
+      $result .= $this->HeaderLine('MIME-Version', '1.0');
+      $result .= $this->GetMailMIME();
+    }
+
+    return $result;
+  }
+
+  /**
+   * Returns the message MIME.
+   * @access private
+   * @return string
+   */
+  function GetMailMIME() {
+    $result = '';
+    switch($this->message_type) {
+      case 'plain':
+        $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
+        $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
+        break;
+      case 'attachments':
+        /* fall through */
+      case 'alt_attachments':
+        if($this->InlineImageExists()){
+          $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
+        } else {
+          $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
+          $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
+        }
+        break;
+      case 'alt':
+        $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
+        $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
+        break;
+    }
+
+    if($this->Mailer != 'mail') {
+      $result .= $this->LE.$this->LE;
+    }
+
+    return $result;
+  }
+
+  /**
+   * Assembles the message body.  Returns an empty string on failure.
+   * @access private
+   * @return string
+   */
+  function CreateBody() {
+    $result = '';
+    if ($this->sign_key_file) {
+      $result .= $this->GetMailMIME();
+    }
+
+    $this->SetWordWrap();
+
+    switch($this->message_type) {
+      case 'alt':
+        $result .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
+        $result .= $this->EncodeString($this->AltBody, $this->Encoding);
+        $result .= $this->LE.$this->LE;
+        $result .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');
+        $result .= $this->EncodeString($this->Body, $this->Encoding);
+        $result .= $this->LE.$this->LE;
+        $result .= $this->EndBoundary($this->boundary[1]);
+        break;
+      case 'plain':
+        $result .= $this->EncodeString($this->Body, $this->Encoding);
+        break;
+      case 'attachments':
+        $result .= $this->GetBoundary($this->boundary[1], '', '', '');
+        $result .= $this->EncodeString($this->Body, $this->Encoding);
+        $result .= $this->LE;
+        $result .= $this->AttachAll();
+        break;
+      case 'alt_attachments':
+        $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
+        $result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
+        $result .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
+        $result .= $this->EncodeString($this->AltBody, $this->Encoding);
+        $result .= $this->LE.$this->LE;
+        $result .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body
+        $result .= $this->EncodeString($this->Body, $this->Encoding);
+        $result .= $this->LE.$this->LE;
+        $result .= $this->EndBoundary($this->boundary[2]);
+        $result .= $this->AttachAll();
+        break;
+    }
+
+    if($this->IsError()) {
+      $result = '';
+    } else if ($this->sign_key_file) {
+      $file = tempnam("", "mail");
+      $fp = fopen($file, "w");
+      fwrite($fp, $result);
+      fclose($fp);
+      $signed = tempnam("", "signed");
+
+      if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {
+        $fp = fopen($signed, "r");
+        $result = fread($fp, filesize($this->sign_key_file));
+        $result = '';
+        while(!feof($fp)){
+          $result = $result . fread($fp, 1024);
+        }
+        fclose($fp);
+      } else {
+        $this->SetError($this->Lang("signing").openssl_error_string());
+        $result = '';
+      }
+
+      unlink($file);
+      unlink($signed);
+    }
+
+    return $result;
+  }
+
+  /**
+   * Returns the start of a message boundary.
+   * @access private
+   */
+  function GetBoundary($boundary, $charSet, $contentType, $encoding) {
+    $result = '';
+    if($charSet == '') {
+      $charSet = $this->CharSet;
+    }
+    if($contentType == '') {
+      $contentType = $this->ContentType;
+    }
+    if($encoding == '') {
+      $encoding = $this->Encoding;
+    }
+    $result .= $this->TextLine('--' . $boundary);
+    $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
+    $result .= $this->LE;
+    $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
+    $result .= $this->LE;
+
+    return $result;
+  }
+
+  /**
+   * Returns the end of a message boundary.
+   * @access private
+   */
+  function EndBoundary($boundary) {
+    return $this->LE . '--' . $boundary . '--' . $this->LE;
+  }
+
+  /**
+   * Sets the message type.
+   * @access private
+   * @return void
+   */
+  function SetMessageType() {
+    if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
+      $this->message_type = 'plain';
+    } else {
+      if(count($this->attachment) > 0) {
+        $this->message_type = 'attachments';
+      }
+      if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
+        $this->message_type = 'alt';
+      }
+      if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
+        $this->message_type = 'alt_attachments';
+      }
+    }
+  }
+
+  /* Returns a formatted header line.
+   * @access private
+   * @return string
+   */
+  function HeaderLine($name, $value) {
+    return $name . ': ' . $value . $this->LE;
+  }
+
+  /**
+   * Returns a formatted mail line.
+   * @access private
+   * @return string
+   */
+  function TextLine($value) {
+    return $value . $this->LE;
+  }
+
+  /////////////////////////////////////////////////
+  // CLASS METHODS, ATTACHMENTS
+  /////////////////////////////////////////////////
+
+  /**
+   * Adds an attachment from a path on the filesystem.
+   * Returns false if the file could not be found
+   * or accessed.
+   * @param string $path Path to the attachment.
+   * @param string $name Overrides the attachment name.
+   * @param string $encoding File encoding (see $Encoding).
+   * @param string $type File extension (MIME) type.
+   * @return bool
+   */
+  function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
+    if(!@is_file($path)) {
+      $this->SetError($this->Lang('file_access') . $path);
+      return false;
+    }
+
+    $filename = basename($path);
+    if($name == '') {
+      $name = $filename;
+    }
+
+    $cur = count($this->attachment);
+    $this->attachment[$cur][0] = $path;
+    $this->attachment[$cur][1] = $filename;
+    $this->attachment[$cur][2] = $name;
+    $this->attachment[$cur][3] = $encoding;
+    $this->attachment[$cur][4] = $type;
+    $this->attachment[$cur][5] = false; // isStringAttachment
+    $this->attachment[$cur][6] = 'attachment';
+    $this->attachment[$cur][7] = 0;
+
+    return true;
+  }
+
+  /**
+   * Attaches all fs, string, and binary attachments to the message.
+   * Returns an empty string on failure.
+   * @access private
+   * @return string
+   */
+  function AttachAll() {
+    /* Return text of body */
+    $mime = array();
+
+    /* Add all attachments */
+    for($i = 0; $i < count($this->attachment); $i++) {
+      /* Check for string attachment */
+      $bString = $this->attachment[$i][5];
+      if ($bString) {
+        $string = $this->attachment[$i][0];
+      } else {
+        $path = $this->attachment[$i][0];
+      }
+
+      $filename    = $this->attachment[$i][1];
+      $name        = $this->attachment[$i][2];
+      $encoding    = $this->attachment[$i][3];
+      $type        = $this->attachment[$i][4];
+      $disposition = $this->attachment[$i][6];
+      $cid         = $this->attachment[$i][7];
+
+      $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
+      $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
+      $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
+
+      if($disposition == 'inline') {
+        $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
+      }
+
+      $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
+
+      /* Encode as string attachment */
+      if($bString) {
+        $mime[] = $this->EncodeString($string, $encoding);
+        if($this->IsError()) {
+          return '';
+        }
+        $mime[] = $this->LE.$this->LE;
+      } else {
+        $mime[] = $this->EncodeFile($path, $encoding);
+        if($this->IsError()) {
+          return '';
+        }
+        $mime[] = $this->LE.$this->LE;
+      }
+    }
+
+    $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
+
+    return join('', $mime);
+  }
+
+  /**
+   * Encodes attachment in requested format.  Returns an
+   * empty string on failure.
+   * @access private
+   * @return string
+   */
+  function EncodeFile ($path, $encoding = 'base64') {
+    if(!@$fd = fopen($path, 'rb')) {
+      $this->SetError($this->Lang('file_open') . $path);
+      return '';
+    }
+    $magic_quotes = get_magic_quotes_runtime();
+    set_magic_quotes_runtime(0);
+    $file_buffer = fread($fd, filesize($path));
+    $file_buffer = $this->EncodeString($file_buffer, $encoding);
+    fclose($fd);
+    set_magic_quotes_runtime($magic_quotes);
+
+    return $file_buffer;
+  }
+
+  /**
+   * Encodes string to requested format. Returns an
+   * empty string on failure.
+   * @access private
+   * @return string
+   */
+  function EncodeString ($str, $encoding = 'base64') {
+    $encoded = '';
+    switch(strtolower($encoding)) {
+      case 'base64':
+        /* chunk_split is found in PHP >= 3.0.6 */
+        $encoded = chunk_split(base64_encode($str), 76, $this->LE);
+        break;
+      case '7bit':
+      case '8bit':
+        $encoded = $this->FixEOL($str);
+        if (substr($encoded, -(strlen($this->LE))) != $this->LE)
+          $encoded .= $this->LE;
+        break;
+      case 'binary':
+        $encoded = $str;
+        break;
+      case 'quoted-printable':
+        $encoded = $this->EncodeQP($str);
+        break;
+      default:
+        $this->SetError($this->Lang('encoding') . $encoding);
+        break;
+    }
+    return $encoded;
+  }
+
+  /**
+   * Encode a header string to best of Q, B, quoted or none.
+   * @access private
+   * @return string
+   */
+  function EncodeHeader ($str, $position = 'text') {
+    $x = 0;
+
+    switch (strtolower($position)) {
+      case 'phrase':
+        if (!preg_match('/[\200-\377]/', $str)) {
+          /* Can't use addslashes as we don't know what value has magic_quotes_sybase. */
+          $encoded = addcslashes($str, "\0..\37\177\\\"");
+          if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
+            return ($encoded);
+          } else {
+            return ("\"$encoded\"");
+          }
+        }
+        $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
+        break;
+      case 'comment':
+        $x = preg_match_all('/[()"]/', $str, $matches);
+        /* Fall-through */
+      case 'text':
+      default:
+        $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
+        break;
+    }
+
+    if ($x == 0) {
+      return ($str);
+    }
+
+    $maxlen = 75 - 7 - strlen($this->CharSet);
+    /* Try to select the encoding which should produce the shortest output */
+    if (strlen($str)/3 < $x) {
+      $encoding = 'B';
+      if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
+     // Use a custom function which correctly encodes and wraps long
+     // multibyte strings without breaking lines within a character
+        $encoded = $this->Base64EncodeWrapMB($str);
+      } else {
+        $encoded = base64_encode($str);
+        $maxlen -= $maxlen % 4;
+        $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
+      }
+    } else {
+      $encoding = 'Q';
+      $encoded = $this->EncodeQ($str, $position);
+      $encoded = $this->WrapText($encoded, $maxlen, true);
+      $encoded = str_replace('='.$this->LE, "\n", trim($encoded));
+    }
+
+    $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
+    $encoded = trim(str_replace("\n", $this->LE, $encoded));
+
+    return $encoded;
+  }
+
+  /**
+   * Checks if a string contains multibyte characters.
+   * @access private
+   * @param string $str multi-byte text to wrap encode
+   * @return bool
+   */
+  function HasMultiBytes($str) {
+    if (function_exists('mb_strlen')) {
+      return (strlen($str) > mb_strlen($str, $this->CharSet));
+    } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
+      return False;
+    }
+  }
+
+  /**
+   * Correctly encodes and wraps long multibyte strings for mail headers
+   * without breaking lines within a character.
+   * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
+   * @access private
+   * @param string $str multi-byte text to wrap encode
+   * @return string
+   */
+  function Base64EncodeWrapMB($str) {
+    $start = "=?".$this->CharSet."?B?";
+    $end = "?=";
+    $encoded = "";
+
+    $mb_length = mb_strlen($str, $this->CharSet);
+    // Each line must have length <= 75, including $start and $end
+    $length = 75 - strlen($start) - strlen($end);
+    // Average multi-byte ratio
+    $ratio = $mb_length / strlen($str);
+    // Base64 has a 4:3 ratio
+    $offset = $avgLength = floor($length * $ratio * .75);
+
+    for ($i = 0; $i < $mb_length; $i += $offset) {
+      $lookBack = 0;
+
+      do {
+        $offset = $avgLength - $lookBack;
+        $chunk = mb_substr($str, $i, $offset, $this->CharSet);
+        $chunk = base64_encode($chunk);
+        $lookBack++;
+      }
+      while (strlen($chunk) > $length);
+
+      $encoded .= $chunk . $this->LE;
+    }
+
+    // Chomp the last linefeed
+    $encoded = substr($encoded, 0, -strlen($this->LE));
+    return $encoded;
+  }
+
+  /**
+   * Encode string to quoted-printable.
+   * @access private
+   * @return string
+   */
+  function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {
+    $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
+    $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
+    $eol = "\r\n";
+    $escape = '=';
+    $output = '';
+    while( list(, $line) = each($lines) ) {
+      $linlen = strlen($line);
+      $newline = '';
+      for($i = 0; $i < $linlen; $i++) {
+        $c = substr( $line, $i, 1 );
+        $dec = ord( $c );
+        if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E
+          $c = '=2E';
+        }
+        if ( $dec == 32 ) {
+          if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
+            $c = '=20';
+          } else if ( $space_conv ) {
+            $c = '=20';
+          }
+        } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
+          $h2 = floor($dec/16);
+          $h1 = floor($dec%16);
+          $c = $escape.$hex[$h2].$hex[$h1];
+        }
+        if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
+          $output .= $newline.$escape.$eol; //  soft line break; " =\r\n" is okay
+          $newline = '';
+          // check if newline first character will be point or not
+          if ( $dec == 46 ) {
+            $c = '=2E';
+          }
+        }
+        $newline .= $c;
+      } // end of for
+      $output .= $newline.$eol;
+    } // end of while
+    return $output;
+  }
+
+  /**
+   * Callback for converting to "=XX".
+   * @access private
+   * @return string
+   */
+  function EncodeQ_callback ($matches) {
+    return sprintf('=%02X', ord($matches[1]));
+  }
+
+  /**
+   * Encode string to q encoding.
+   * @access private
+   * @return string
+   */
+  function EncodeQ ($str, $position = 'text') {
+    /* There should not be any EOL in the string */
+    $encoded = preg_replace("/[\r\n]/", '', $str);
+
+    switch (strtolower($position)) {
+      case 'phrase':
+        $encoded = preg_replace_callback("/([^A-Za-z0-9!*+\/ -])/",
+                                         array('PHPMailer', 'EncodeQ_callback'), $encoded);
+        break;
+      case 'comment':
+        $encoded = preg_replace_callback("/([\(\)\"])/",
+                                         array('PHPMailer', 'EncodeQ_callback'), $encoded);
+        break;
+      case 'text':
+      default:
+        /* Replace every high ascii, control =, ? and _ characters */
+        $encoded = preg_replace_callback('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/',
+                                         array('PHPMailer', 'EncodeQ_callback'), $encoded);
+        break;
+    }
+
+    /* Replace every spaces to _ (more readable than =20) */
+    $encoded = str_replace(' ', '_', $encoded);
+
+    return $encoded;
+  }
+
+  /**
+   * Adds a string or binary attachment (non-filesystem) to the list.
+   * This method can be used to attach ascii or binary data,
+   * such as a BLOB record from a database.
+   * @param string $string String attachment data.
+   * @param string $filename Name of the attachment.
+   * @param string $encoding File encoding (see $Encoding).
+   * @param string $type File extension (MIME) type.
+   * @return void
+   */
+  function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') {
+    /* Append to $attachment array */
+    $cur = count($this->attachment);
+    $this->attachment[$cur][0] = $string;
+    $this->attachment[$cur][1] = $filename;
+    $this->attachment[$cur][2] = $filename;
+    $this->attachment[$cur][3] = $encoding;
+    $this->attachment[$cur][4] = $type;
+    $this->attachment[$cur][5] = true; // isString
+    $this->attachment[$cur][6] = 'attachment';
+    $this->attachment[$cur][7] = 0;
+  }
+
+  /**
+   * Adds an embedded attachment.  This can include images, sounds, and
+   * just about any other document.  Make sure to set the $type to an
+   * image type.  For JPEG images use "image/jpeg" and for GIF images
+   * use "image/gif".
+   * @param string $path Path to the attachment.
+   * @param string $cid Content ID of the attachment.  Use this to identify
+   *        the Id for accessing the image in an HTML form.
+   * @param string $name Overrides the attachment name.
+   * @param string $encoding File encoding (see $Encoding).
+   * @param string $type File extension (MIME) type.
+   * @return bool
+   */
+  function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
+
+    if(!@is_file($path)) {
+      $this->SetError($this->Lang('file_access') . $path);
+      return false;
+    }
+
+    $filename = basename($path);
+    if($name == '') {
+      $name = $filename;
+    }
+
+    /* Append to $attachment array */
+    $cur = count($this->attachment);
+    $this->attachment[$cur][0] = $path;
+    $this->attachment[$cur][1] = $filename;
+    $this->attachment[$cur][2] = $name;
+    $this->attachment[$cur][3] = $encoding;
+    $this->attachment[$cur][4] = $type;
+    $this->attachment[$cur][5] = false;
+    $this->attachment[$cur][6] = 'inline';
+    $this->attachment[$cur][7] = $cid;
+
+    return true;
+  }
+
+  /**
+   * Returns true if an inline attachment is present.
+   * @access private
+   * @return bool
+   */
+  function InlineImageExists() {
+    $result = false;
+    for($i = 0; $i < count($this->attachment); $i++) {
+      if($this->attachment[$i][6] == 'inline') {
+        $result = true;
+        break;
+      }
+    }
+
+    return $result;
+  }
+
+  /////////////////////////////////////////////////
+  // CLASS METHODS, MESSAGE RESET
+  /////////////////////////////////////////////////
+
+  /**
+   * Clears all recipients assigned in the TO array.  Returns void.
+   * @return void
+   */
+  function ClearAddresses() {
+    $this->to = array();
+  }
+
+  /**
+   * Clears all recipients assigned in the CC array.  Returns void.
+   * @return void
+   */
+  function ClearCCs() {
+    $this->cc = array();
+  }
+
+  /**
+   * Clears all recipients assigned in the BCC array.  Returns void.
+   * @return void
+   */
+  function ClearBCCs() {
+    $this->bcc = array();
+  }
+
+  /**
+   * Clears all recipients assigned in the ReplyTo array.  Returns void.
+   * @return void
+   */
+  function ClearReplyTos() {
+    $this->ReplyTo = array();
+  }
+
+  /**
+   * Clears all recipients assigned in the TO, CC and BCC
+   * array.  Returns void.
+   * @return void
+   */
+  function ClearAllRecipients() {
+    $this->to = array();
+    $this->cc = array();
+    $this->bcc = array();
+  }
+
+  /**
+   * Clears all previously set filesystem, string, and binary
+   * attachments.  Returns void.
+   * @return void
+   */
+  function ClearAttachments() {
+    $this->attachment = array();
+  }
+
+  /**
+   * Clears all custom headers.  Returns void.
+   * @return void
+   */
+  function ClearCustomHeaders() {
+    $this->CustomHeader = array();
+  }
+
+  /////////////////////////////////////////////////
+  // CLASS METHODS, MISCELLANEOUS
+  /////////////////////////////////////////////////
+
+  /**
+   * Adds the error message to the error container.
+   * Returns void.
+   * @access private
+   * @return void
+   */
+  function SetError($msg) {
+    $this->error_count++;
+    $this->ErrorInfo = $msg;
+  }
+
+  /**
+   * Returns the proper RFC 822 formatted date.
+   * @access private
+   * @return string
+   */
+  function RFCDate() {
+    $tz = date('Z');
+    $tzs = ($tz < 0) ? '-' : '+';
+    $tz = abs($tz);
+    $tz = (int)($tz/3600)*100 + ($tz%3600)/60;
+    $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
+
+    return $result;
+  }
+
+  /**
+   * Returns the appropriate server variable.  Should work with both
+   * PHP 4.1.0+ as well as older versions.  Returns an empty string
+   * if nothing is found.
+   * @access private
+   * @return mixed
+   */
+  function ServerVar($varName) {
+    global $HTTP_SERVER_VARS;
+    global $HTTP_ENV_VARS;
+
+    if(!isset($_SERVER)) {
+      $_SERVER = $HTTP_SERVER_VARS;
+      if(!isset($_SERVER['REMOTE_ADDR'])) {
+        $_SERVER = $HTTP_ENV_VARS; // must be Apache
+      }
+    }
+
+    if(isset($_SERVER[$varName])) {
+      return $_SERVER[$varName];
+    } else {
+      return '';
+    }
+  }
+
+  /**
+   * Returns the server hostname or 'localhost.localdomain' if unknown.
+   * @access private
+   * @return string
+   */
+  function ServerHostname() {
+    if ($this->Hostname != '') {
+      $result = $this->Hostname;
+    } elseif ($this->ServerVar('SERVER_NAME') != '') {
+      $result = $this->ServerVar('SERVER_NAME');
+    } else {
+      $result = 'localhost.localdomain';
+    }
+
+    return $result;
+  }
+
+  /**
+   * Returns a message in the appropriate language.
+   * @access private
+   * @return string
+   */
+  function Lang($key) {
+    if(count($this->language) < 1) {
+      $this->SetLanguage('en'); // set the default language
+    }
+
+    if(isset($this->language[$key])) {
+      return $this->language[$key];
+    } else {
+      return 'Language string failed to load: ' . $key;
+    }
+  }
+
+  /**
+   * Returns true if an error occurred.
+   * @return bool
+   */
+  function IsError() {
+    return ($this->error_count > 0);
+  }
+
+  /**
+   * Changes every end of line from CR or LF to CRLF.
+   * @access private
+   * @return string
+   */
+  function FixEOL($str) {
+    $str = str_replace("\r\n", "\n", $str);
+    $str = str_replace("\r", "\n", $str);
+    $str = str_replace("\n", $this->LE, $str);
+    return $str;
+  }
+
+  /**
+   * Adds a custom header.
+   * @return void
+   */
+  function AddCustomHeader($custom_header) {
+    $this->CustomHeader[] = explode(':', $custom_header, 2);
+  }
+
+  /**
+   * Evaluates the message and returns modifications for inline images and backgrounds
+   * @access public
+   * @return $message
+   */
+  function MsgHTML($message,$basedir='') {
+    preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
+    if(isset($images[2])) {
+      foreach($images[2] as $i => $url) {
+        // do not change urls for absolute images (thanks to corvuscorax)
+        if (!preg_match('/^[A-z][A-z]*:\/\//',$url)) {
+          $filename = basename($url);
+          $directory = dirname($url);
+          ($directory == '.')?$directory='':'';
+          $cid = 'cid:' . md5($filename);
+          $fileParts = split("\.", $filename);
+          $ext = $fileParts[1];
+          $mimeType = $this->_mime_types($ext);
+          if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
+          if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }
+          if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
+            $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
+          }
+        }
+      }
+    }
+    $this->IsHTML(true);
+    $this->Body = $message;
+    $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
+    if ( !empty($textMsg) && empty($this->AltBody) ) {
+      $this->AltBody = html_entity_decode($textMsg);
+    }
+    if ( empty($this->AltBody) ) {
+      $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
+    }
+  }
+
+  /**
+   * Gets the mime type of the embedded or inline image
+   * @access private
+   * @return mime type of ext
+   */
+  function _mime_types($ext = '') {
+    $mimes = array(
+      'ai'    =>  'application/postscript',
+      'aif'   =>  'audio/x-aiff',
+      'aifc'  =>  'audio/x-aiff',
+      'aiff'  =>  'audio/x-aiff',
+      'avi'   =>  'video/x-msvideo',
+      'bin'   =>  'application/macbinary',
+      'bmp'   =>  'image/bmp',
+      'class' =>  'application/octet-stream',
+      'cpt'   =>  'application/mac-compactpro',
+      'css'   =>  'text/css',
+      'dcr'   =>  'application/x-director',
+      'dir'   =>  'application/x-director',
+      'dll'   =>  'application/octet-stream',
+      'dms'   =>  'application/octet-stream',
+      'doc'   =>  'application/msword',
+      'dvi'   =>  'application/x-dvi',
+      'dxr'   =>  'application/x-director',
+      'eml'   =>  'message/rfc822',
+      'eps'   =>  'application/postscript',
+      'exe'   =>  'application/octet-stream',
+      'gif'   =>  'image/gif',
+      'gtar'  =>  'application/x-gtar',
+      'htm'   =>  'text/html',
+      'html'  =>  'text/html',
+      'jpe'   =>  'image/jpeg',
+      'jpeg'  =>  'image/jpeg',
+      'jpg'   =>  'image/jpeg',
+      'hqx'   =>  'application/mac-binhex40',
+      'js'    =>  'application/x-javascript',
+      'lha'   =>  'application/octet-stream',
+      'log'   =>  'text/plain',
+      'lzh'   =>  'application/octet-stream',
+      'mid'   =>  'audio/midi',
+      'midi'  =>  'audio/midi',
+      'mif'   =>  'application/vnd.mif',
+      'mov'   =>  'video/quicktime',
+      'movie' =>  'video/x-sgi-movie',
+      'mp2'   =>  'audio/mpeg',
+      'mp3'   =>  'audio/mpeg',
+      'mpe'   =>  'video/mpeg',
+      'mpeg'  =>  'video/mpeg',
+      'mpg'   =>  'video/mpeg',
+      'mpga'  =>  'audio/mpeg',
+      'oda'   =>  'application/oda',
+      'pdf'   =>  'application/pdf',
+      'php'   =>  'application/x-httpd-php',
+      'php3'  =>  'application/x-httpd-php',
+      'php4'  =>  'application/x-httpd-php',
+      'phps'  =>  'application/x-httpd-php-source',
+      'phtml' =>  'application/x-httpd-php',
+      'png'   =>  'image/png',
+      'ppt'   =>  'application/vnd.ms-powerpoint',
+      'ps'    =>  'application/postscript',
+      'psd'   =>  'application/octet-stream',
+      'qt'    =>  'video/quicktime',
+      'ra'    =>  'audio/x-realaudio',
+      'ram'   =>  'audio/x-pn-realaudio',
+      'rm'    =>  'audio/x-pn-realaudio',
+      'rpm'   =>  'audio/x-pn-realaudio-plugin',
+      'rtf'   =>  'text/rtf',
+      'rtx'   =>  'text/richtext',
+      'rv'    =>  'video/vnd.rn-realvideo',
+      'sea'   =>  'application/octet-stream',
+      'shtml' =>  'text/html',
+      'sit'   =>  'application/x-stuffit',
+      'so'    =>  'application/octet-stream',
+      'smi'   =>  'application/smil',
+      'smil'  =>  'application/smil',
+      'swf'   =>  'application/x-shockwave-flash',
+      'tar'   =>  'application/x-tar',
+      'text'  =>  'text/plain',
+      'txt'   =>  'text/plain',
+      'tgz'   =>  'application/x-tar',
+      'tif'   =>  'image/tiff',
+      'tiff'  =>  'image/tiff',
+      'wav'   =>  'audio/x-wav',
+      'wbxml' =>  'application/vnd.wap.wbxml',
+      'wmlc'  =>  'application/vnd.wap.wmlc',
+      'word'  =>  'application/msword',
+      'xht'   =>  'application/xhtml+xml',
+      'xhtml' =>  'application/xhtml+xml',
+      'xl'    =>  'application/excel',
+      'xls'   =>  'application/vnd.ms-excel',
+      'xml'   =>  'text/xml',
+      'xsl'   =>  'text/xml',
+      'zip'   =>  'application/zip'
+    );
+    return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
+  }
+
+  /**
+   * Set (or reset) Class Objects (variables)
+   *
+   * Usage Example:
+   * $page->set('X-Priority', '3');
+   *
+   * @access public
+   * @param string $name Parameter Name
+   * @param mixed $value Parameter Value
+   * NOTE: will not work with arrays, there are no arrays to set/reset
+   */
+  function set ( $name, $value = '' ) {
+    if ( isset($this->$name) ) {
+      $this->$name = $value;
+    } else {
+      $this->SetError('Cannot set or reset variable ' . $name);
+      return false;
+    }
+  }
+
+  /**
+   * Read a file from a supplied filename and return it.
+   *
+   * @access public
+   * @param string $filename Parameter File Name
+   */
+  function getFile($filename) {
+    $return = '';
+    if ($fp = fopen($filename, 'rb')) {
+      while (!feof($fp)) {
+        $return .= fread($fp, 1024);
+      }
+      fclose($fp);
+      return $return;
+    } else {
+      return false;
+    }
+  }
+
+  /**
+   * Strips newlines to prevent header injection.
+   * @access private
+   * @param string $str String
+   * @return string
+   */
+  function SecureHeader($str) {
+    $str = trim($str);
+    $str = str_replace("\r", "", $str);
+    $str = str_replace("\n", "", $str);
+    return $str;
+  }
+
+  /**
+   * Set the private key file and password to sign the message.
+   *
+   * @access public
+   * @param string $key_filename Parameter File Name
+   * @param string $key_pass Password for private key
+   */
+  function Sign($cert_filename, $key_filename, $key_pass) {
+    $this->sign_cert_file = $cert_filename;
+    $this->sign_key_file = $key_filename;
+    $this->sign_key_pass = $key_pass;
+  }
+
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.passwordhash.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.passwordhash.php
new file mode 100644
index 0000000000000000000000000000000000000000..1f851058e701e0069d6bc91f4e07c2b24a604bd5
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.passwordhash.php
@@ -0,0 +1,258 @@
+<?php
+// Last sync [WP11537]
+
+/**
+ * Portable PHP password hashing framework.
+ * @package phpass
+ * @since 2.5
+ * @version 0.1
+ * @link http://www.openwall.com/phpass/
+ */
+
+#
+# Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in
+# the public domain.
+#
+# There's absolutely no warranty.
+#
+# Please be sure to update the Version line if you edit this file in any way.
+# It is suggested that you leave the main version number intact, but indicate
+# your project name (after the slash) and add your own revision information.
+#
+# Please do not change the "private" password hashing method implemented in
+# here, thereby making your hashes incompatible.  However, if you must, please
+# change the hash type identifier (the "$P$") to something different.
+#
+# Obviously, since this code is in the public domain, the above are not
+# requirements (there can be none), but merely suggestions.
+#
+
+/**
+ * Portable PHP password hashing framework.
+ *
+ * @package phpass
+ * @version 0.1 / genuine
+ * @link http://www.openwall.com/phpass/
+ * @since 2.5
+ */
+class PasswordHash {
+	var $itoa64;
+	var $iteration_count_log2;
+	var $portable_hashes;
+	var $random_state;
+
+	function PasswordHash($iteration_count_log2, $portable_hashes)
+	{
+		$this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
+
+		if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
+			$iteration_count_log2 = 8;
+		$this->iteration_count_log2 = $iteration_count_log2;
+
+		$this->portable_hashes = $portable_hashes;
+
+		$this->random_state = microtime() . (function_exists('getmypid') ? getmypid() : '') . uniqid(rand(), TRUE);
+
+	}
+
+	function get_random_bytes($count)
+	{
+		$output = '';
+		if (($fh = @fopen('/dev/urandom', 'rb'))) {
+			$output = fread($fh, $count);
+			fclose($fh);
+		}
+
+		if (strlen($output) < $count) {
+			$output = '';
+			for ($i = 0; $i < $count; $i += 16) {
+				$this->random_state =
+				    md5(microtime() . $this->random_state);
+				$output .=
+				    pack('H*', md5($this->random_state));
+			}
+			$output = substr($output, 0, $count);
+		}
+
+		return $output;
+	}
+
+	function encode64($input, $count)
+	{
+		$output = '';
+		$i = 0;
+		do {
+			$value = ord($input[$i++]);
+			$output .= $this->itoa64[$value & 0x3f];
+			if ($i < $count)
+				$value |= ord($input[$i]) << 8;
+			$output .= $this->itoa64[($value >> 6) & 0x3f];
+			if ($i++ >= $count)
+				break;
+			if ($i < $count)
+				$value |= ord($input[$i]) << 16;
+			$output .= $this->itoa64[($value >> 12) & 0x3f];
+			if ($i++ >= $count)
+				break;
+			$output .= $this->itoa64[($value >> 18) & 0x3f];
+		} while ($i < $count);
+
+		return $output;
+	}
+
+	function gensalt_private($input)
+	{
+		$output = '$P$';
+		$output .= $this->itoa64[min($this->iteration_count_log2 +
+			((PHP_VERSION >= '5') ? 5 : 3), 30)];
+		$output .= $this->encode64($input, 6);
+
+		return $output;
+	}
+
+	function crypt_private($password, $setting)
+	{
+		$output = '*0';
+		if (substr($setting, 0, 2) == $output)
+			$output = '*1';
+
+		if (substr($setting, 0, 3) != '$P$')
+			return $output;
+
+		$count_log2 = strpos($this->itoa64, $setting[3]);
+		if ($count_log2 < 7 || $count_log2 > 30)
+			return $output;
+
+		$count = 1 << $count_log2;
+
+		$salt = substr($setting, 4, 8);
+		if (strlen($salt) != 8)
+			return $output;
+
+		# We're kind of forced to use MD5 here since it's the only
+		# cryptographic primitive available in all versions of PHP
+		# currently in use.  To implement our own low-level crypto
+		# in PHP would result in much worse performance and
+		# consequently in lower iteration counts and hashes that are
+		# quicker to crack (by non-PHP code).
+		if (PHP_VERSION >= '5') {
+			$hash = md5($salt . $password, TRUE);
+			do {
+				$hash = md5($hash . $password, TRUE);
+			} while (--$count);
+		} else {
+			$hash = pack('H*', md5($salt . $password));
+			do {
+				$hash = pack('H*', md5($hash . $password));
+			} while (--$count);
+		}
+
+		$output = substr($setting, 0, 12);
+		$output .= $this->encode64($hash, 16);
+
+		return $output;
+	}
+
+	function gensalt_extended($input)
+	{
+		$count_log2 = min($this->iteration_count_log2 + 8, 24);
+		# This should be odd to not reveal weak DES keys, and the
+		# maximum valid value is (2**24 - 1) which is odd anyway.
+		$count = (1 << $count_log2) - 1;
+
+		$output = '_';
+		$output .= $this->itoa64[$count & 0x3f];
+		$output .= $this->itoa64[($count >> 6) & 0x3f];
+		$output .= $this->itoa64[($count >> 12) & 0x3f];
+		$output .= $this->itoa64[($count >> 18) & 0x3f];
+
+		$output .= $this->encode64($input, 3);
+
+		return $output;
+	}
+
+	function gensalt_blowfish($input)
+	{
+		# This one needs to use a different order of characters and a
+		# different encoding scheme from the one in encode64() above.
+		# We care because the last character in our encoded string will
+		# only represent 2 bits.  While two known implementations of
+		# bcrypt will happily accept and correct a salt string which
+		# has the 4 unused bits set to non-zero, we do not want to take
+		# chances and we also do not want to waste an additional byte
+		# of entropy.
+		$itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
+
+		$output = '$2a$';
+		$output .= chr(ord('0') + $this->iteration_count_log2 / 10);
+		$output .= chr(ord('0') + $this->iteration_count_log2 % 10);
+		$output .= '$';
+
+		$i = 0;
+		do {
+			$c1 = ord($input[$i++]);
+			$output .= $itoa64[$c1 >> 2];
+			$c1 = ($c1 & 0x03) << 4;
+			if ($i >= 16) {
+				$output .= $itoa64[$c1];
+				break;
+			}
+
+			$c2 = ord($input[$i++]);
+			$c1 |= $c2 >> 4;
+			$output .= $itoa64[$c1];
+			$c1 = ($c2 & 0x0f) << 2;
+
+			$c2 = ord($input[$i++]);
+			$c1 |= $c2 >> 6;
+			$output .= $itoa64[$c1];
+			$output .= $itoa64[$c2 & 0x3f];
+		} while (1);
+
+		return $output;
+	}
+
+	function HashPassword($password)
+	{
+		$random = '';
+
+		if (CRYPT_BLOWFISH == 1 && !$this->portable_hashes) {
+			$random = $this->get_random_bytes(16);
+			$hash =
+			    crypt($password, $this->gensalt_blowfish($random));
+			if (strlen($hash) == 60)
+				return $hash;
+		}
+
+		if (CRYPT_EXT_DES == 1 && !$this->portable_hashes) {
+			if (strlen($random) < 3)
+				$random = $this->get_random_bytes(3);
+			$hash =
+			    crypt($password, $this->gensalt_extended($random));
+			if (strlen($hash) == 20)
+				return $hash;
+		}
+
+		if (strlen($random) < 6)
+			$random = $this->get_random_bytes(6);
+		$hash =
+		    $this->crypt_private($password,
+		    $this->gensalt_private($random));
+		if (strlen($hash) == 34)
+			return $hash;
+
+		# Returning '*' on error is safe here, but would _not_ be safe
+		# in a crypt(3)-like function used _both_ for generating new
+		# hashes and for validating passwords against existing hashes.
+		return '*';
+	}
+
+	function CheckPassword($password, $stored_hash)
+	{
+		$hash = $this->crypt_private($password, $stored_hash);
+		if ($hash[0] == '*')
+			$hash = crypt($password, $stored_hash);
+
+		return $hash == $stored_hash;
+	}
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-ajax-response.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-ajax-response.php
new file mode 100644
index 0000000000000000000000000000000000000000..b1fbd56af40f918366ad869c1ce2a70641951806
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-ajax-response.php
@@ -0,0 +1,138 @@
+<?php
+// Last sync [WP11537]
+
+/**
+ * Send XML response back to AJAX request.
+ *
+ * @package WordPress
+ * @since 2.1.0
+ */
+class WP_Ajax_Response {
+	/**
+	 * Store XML responses to send.
+	 *
+	 * @since 2.1.0
+	 * @var array
+	 * @access private
+	 */
+	var $responses = array();
+
+	/**
+	 * PHP4 Constructor - Passes args to {@link WP_Ajax_Response::add()}.
+	 *
+	 * @since 2.1.0
+	 * @see WP_Ajax_Response::add()
+	 *
+	 * @param string|array $args Optional. Will be passed to add() method.
+	 * @return WP_Ajax_Response
+	 */
+	function WP_Ajax_Response( $args = '' ) {
+		if ( !empty($args) )
+			$this->add($args);
+	}
+
+	/**
+	 * Append to XML response based on given arguments.
+	 *
+	 * The arguments that can be passed in the $args parameter are below. It is
+	 * also possible to pass a WP_Error object in either the 'id' or 'data'
+	 * argument. The parameter isn't actually optional, content should be given
+	 * in order to send the correct response.
+	 *
+	 * 'what' argument is a string that is the XMLRPC response type.
+	 * 'action' argument is a boolean or string that acts like a nonce.
+	 * 'id' argument can be WP_Error or an integer.
+	 * 'old_id' argument is false by default or an integer of the previous ID.
+	 * 'position' argument is an integer or a string with -1 = top, 1 = bottom,
+	 * html ID = after, -html ID = before.
+	 * 'data' argument is a string with the content or message.
+	 * 'supplemental' argument is an array of strings that will be children of
+	 * the supplemental element.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string|array $args Override defaults.
+	 * @return string XML response.
+	 */
+	function add( $args = '' ) {
+		$defaults = array(
+			'what' => 'object', 'action' => false,
+			'id' => '0', 'old_id' => false,
+			'position' => 1,
+			'data' => '', 'supplemental' => array()
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+		$position = preg_replace( '/[^a-z0-9:_-]/i', '', $position );
+
+		if ( is_wp_error($id) ) {
+			$data = $id;
+			$id = 0;
+		}
+
+		$response = '';
+		if ( is_wp_error($data) ) {
+			foreach ( (array) $data->get_error_codes() as $code ) {
+				$response .= "<wp_error code='$code'><![CDATA[" . $data->get_error_message($code) . "]]></wp_error>";
+				if ( !$error_data = $data->get_error_data($code) )
+					continue;
+				$class = '';
+				if ( is_object($error_data) ) {
+					$class = ' class="' . get_class($error_data) . '"';
+					$error_data = get_object_vars($error_data);
+				}
+
+				$response .= "<wp_error_data code='$code'$class>";
+
+				if ( is_scalar($error_data) ) {
+					$response .= "<![CDATA[$error_data]]>";
+				} elseif ( is_array($error_data) ) {
+					foreach ( $error_data as $k => $v )
+						$response .= "<$k><![CDATA[$v]]></$k>";
+				}
+
+				$response .= "</wp_error_data>";
+			}
+		} else {
+			$response = "<response_data><![CDATA[$data]]></response_data>";
+		}
+
+		$s = '';
+		if ( is_array($supplemental) ) {
+			foreach ( $supplemental as $k => $v )
+				$s .= "<$k><![CDATA[$v]]></$k>";
+			$s = "<supplemental>$s</supplemental>";
+		}
+
+		if ( false === $action )
+			$action = $_POST['action'];
+
+		$x = '';
+		$x .= "<response action='{$action}_$id'>"; // The action attribute in the xml output is formatted like a nonce action
+		$x .=	"<$what id='$id' " . ( false === $old_id ? '' : "old_id='$old_id' " ) . "position='$position'>";
+		$x .=		$response;
+		$x .=		$s;
+		$x .=	"</$what>";
+		$x .= "</response>";
+
+		$this->responses[] = $x;
+		return $x;
+	}
+
+	/**
+	 * Display XML formatted responses.
+	 *
+	 * Sets the content type header to text/xml.
+	 *
+	 * @since 2.1.0
+	 */
+	function send() {
+		header('Content-Type: text/xml');
+		echo "<?xml version='1.0' standalone='yes'?><wp_ajax>";
+		foreach ( (array) $this->responses as $response )
+			echo $response;
+		echo '</wp_ajax>';
+		die();
+	}
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-auth.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-auth.php
new file mode 100644
index 0000000000000000000000000000000000000000..d23143e82fe3fc84554c01ae37f85751adac87c2
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-auth.php
@@ -0,0 +1,298 @@
+<?php
+class WP_Auth
+{
+	var $db; // BBPDB object
+	var $users; // WP_Users object
+
+	var $cookies;
+
+	var $current = 0;
+
+	function WP_Auth( &$db, &$users, $cookies )
+	{
+		$this->__construct( $db, $users, $cookies );
+	}
+
+	/**
+	 * @param array $cookies Array indexed by internal name of cookie.  Values are arrays of array defining cookie parameters.
+	 * $cookies = array(
+	 *	'auth' => array(
+	 *		0 => array(
+	 *			'domain' => (string) cookie domain
+	 *			'path' => (string) cookie path
+	 *			'name' => (string) cookie name
+	 *			'secure' => (bool) restrict cookie to HTTPS only
+	 *		)
+	 *	)
+	 * );
+	 *
+	 * At least one cookie is required.  Give it an internal name of 'auth'.
+	 *
+	 * Suggested cookie structure:
+	 * 	logged_in: whether or not a user is logged in.  Send everywhere.
+	 *	auth: used to authorize user's actions.  Send only to domains/paths that need it (e.g. wp-admin/)
+	 *	secure_auth: used to authorize user's actions.  Send only to domains/paths that need it and only over HTTPS
+	 */
+	function __construct( &$db, &$users, $cookies )
+	{
+		$this->db =& $db;
+		$this->users =& $users;
+		
+		$cookies = wp_parse_args( $cookies, array( 'auth' => null ) );
+		$_cookies = array();
+		foreach ( $cookies as $_scheme => $_scheme_cookies ) {
+			foreach ( $_scheme_cookies as $_scheme_cookie ) {
+				$_cookies[$_scheme][] = wp_parse_args( $_scheme_cookie, array( 'domain' => null, 'path' => null, 'name' => '' ) );
+			}
+			unset( $_scheme_cookie );
+		}
+		unset( $_scheme, $_scheme_cookies );
+		$this->cookies = $_cookies;
+		unset( $_cookies );
+	}
+
+	/**
+	 * Changes the current user by ID or name
+	 *
+	 * Set $id to null and specify a name if you do not know a user's ID
+	 *
+	 * Some WordPress functionality is based on the current user and
+	 * not based on the signed in user. Therefore, it opens the ability
+	 * to edit and perform actions on users who aren't signed in.
+	 *
+	 * @since 2.0.4
+	 * @uses do_action() Calls 'set_current_user' hook after setting the current user.
+	 *
+	 * @param int $id User ID
+	 * @param string $name User's username
+	 * @return BP_User Current user User object
+	 */
+	function set_current_user( $user_id )
+	{
+		$user = $this->users->get_user( $user_id );
+		if ( !$user || is_wp_error( $user ) ) {
+			$this->current = 0;
+			return $this->current;
+		}
+
+		$user_id = $user->ID;
+
+		if ( isset( $this->current->ID ) && $user_id == $this->current->ID ) {
+			return $this->current;
+		}
+
+		if ( class_exists( 'BP_User' ) ) {
+			$this->current = new BP_User( $user_id );
+		} else {
+			$this->current =& $user;
+		}
+
+		// WP add_action( 'set_current_user', 'setup_userdata', 1 );
+
+		do_action( 'set_current_user', $user_id );
+
+		return $this->current;
+	}
+
+	/**
+	 * Populate variables with information about the currently logged in user
+	 *
+	 * Will set the current user, if the current user is not set. The current
+	 * user will be set to the logged in person. If no user is logged in, then
+	 * it will set the current user to 0, which is invalid and won't have any
+	 * permissions.
+ 	 *
+	 * @since 0.71
+ 	 * @uses $current_user Checks if the current user is set
+ 	 * @uses wp_validate_auth_cookie() Retrieves current logged in user.
+ 	 *
+ 	 * @return bool|null False on XMLRPC Request and invalid auth cookie. Null when current user set
+ 	 */
+	function get_current_user()
+	{
+		if ( !empty( $this->current ) ) {
+			return $this->current;
+		}
+
+		if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
+			$this->set_current_user( 0 );
+		} elseif ( $user_id = $this->validate_auth_cookie( null, 'logged_in' ) ) {
+			$this->set_current_user( $user_id );
+		} else {
+			$this->set_current_user( 0 );
+		}
+
+		return $this->current;
+	}
+
+	/**
+	 * Validates authentication cookie
+	 *
+	 * The checks include making sure that the authentication cookie
+	 * is set and pulling in the contents (if $cookie is not used).
+	 *
+	 * Makes sure the cookie is not expired. Verifies the hash in
+	 * cookie is what is should be and compares the two.
+	 *
+	 * @since 2.5
+	 *
+	 * @param string $cookie Optional. If used, will validate contents instead of cookie's
+	 * @return bool|int False if invalid cookie, User ID if valid.
+	 */
+	function validate_auth_cookie( $cookie = null, $scheme = 'auth' )
+	{
+		if ( empty( $cookie ) ) {
+			foreach ( $this->cookies[$scheme] as $_scheme_cookie ) {
+				// Take the first cookie of type scheme that exists
+				if ( !empty( $_COOKIE[$_scheme_cookie['name']] ) ) {
+					$cookie = $_COOKIE[$_scheme_cookie['name']];
+					break;
+				}
+			}
+		}
+		
+		if ( !$cookie ) {
+			return false;
+		}
+
+		$cookie_elements = explode( '|', $cookie );
+		if ( count( $cookie_elements ) != 3 ) {
+			do_action( 'auth_cookie_malformed', $cookie, $scheme );
+			return false;
+		}
+
+		list( $username, $expiration, $hmac ) = $cookie_elements;
+
+		$expired = $expiration;
+
+		// Allow a grace period for POST and AJAX requests
+		if ( defined( 'DOING_AJAX' ) || 'POST' == $_SERVER['REQUEST_METHOD'] ) {
+			$expired += 3600;
+		}
+
+		if ( $expired < time() ) {
+			do_action( 'auth_cookie_expired', $cookie_elements );
+			return false;
+		}
+
+		$user = $this->users->get_user( $username, array( 'by' => 'login' ) );
+		if ( !$user || is_wp_error( $user ) ) {
+			do_action( 'auth_cookie_bad_username', $cookie_elements );
+			return $user;
+		}
+
+		$pass_frag = '';
+		if ( 1 < WP_AUTH_COOKIE_VERSION ) {
+			$pass_frag = substr( $user->user_pass, 8, 4 );
+		}
+
+		$key  = call_user_func( backpress_get_option( 'hash_function_name' ), $username . $pass_frag . '|' . $expiration, $scheme );
+		$hash = hash_hmac( 'md5', $username . '|' . $expiration, $key );
+	
+		if ( $hmac != $hash ) {
+			do_action( 'auth_cookie_bad_hash', $cookie_elements );
+			return false;
+		}
+
+		do_action( 'auth_cookie_valid', $cookie_elements, $user );
+
+		return $user->ID;
+	}
+
+	/**
+	 * Generate authentication cookie contents
+	 *
+	 * @since 2.5
+	 * @uses apply_filters() Calls 'auth_cookie' hook on $cookie contents, User ID
+	 *		and expiration of cookie.
+	 *
+	 * @param int $user_id User ID
+	 * @param int $expiration Cookie expiration in seconds
+	 * @return string Authentication cookie contents
+	 */
+	function generate_auth_cookie( $user_id, $expiration, $scheme = 'auth' )
+	{
+		$user = $this->users->get_user( $user_id );
+		if ( !$user || is_wp_error( $user ) ) {
+			return $user;
+		}
+
+		$pass_frag = '';
+		if ( 1 < WP_AUTH_COOKIE_VERSION ) {
+			$pass_frag = substr( $user->user_pass, 8, 4 );
+		}
+
+		$key  = call_user_func( backpress_get_option( 'hash_function_name' ), $user->user_login . $pass_frag . '|' . $expiration, $scheme );
+		$hash = hash_hmac('md5', $user->user_login . '|' . $expiration, $key);
+
+		$cookie = $user->user_login . '|' . $expiration . '|' . $hash;
+
+		return apply_filters( 'auth_cookie', $cookie, $user_id, $expiration, $scheme );
+	}
+
+	/**
+	 * Sets the authentication cookies based User ID
+	 *
+	 * The $remember parameter increases the time that the cookie will
+	 * be kept. The default the cookie is kept without remembering is
+	 * two days. When $remember is set, the cookies will be kept for
+	 * 14 days or two weeks.
+	 *
+	 * @since 2.5
+	 *
+	 * @param int $user_id User ID
+	 * @param int $expiration the UNIX time after which the cookie's authentication token is no longer valid
+	 * @param int $expire the UNIX time at which the cookie expires
+	 * @param int $scheme name of the 
+	 */
+	function set_auth_cookie( $user_id, $expiration = 0, $expire = 0, $scheme = 'auth' )
+	{
+		if ( !isset( $this->cookies[$scheme] ) ) {
+			return;
+		}
+
+		if ( !$expiration = absint( $expiration ) ) {
+			$expiration = time() + 172800; // 2 days
+		}
+
+		$expire = absint( $expire );
+
+		foreach ( $this->cookies[$scheme] as $_cookie ) {
+			$cookie = $this->generate_auth_cookie( $user_id, $expiration, $scheme );
+			if ( is_wp_error( $cookie ) ) {
+				return $cookie;
+			}
+
+			do_action( 'set_' . $scheme . '_cookie', $cookie, $expire, $expiration, $user_id, $scheme );
+
+			$domain = $_cookie['domain'];
+			$secure = isset($_cookie['secure']) ? (bool) $_cookie['secure'] : false;
+
+			// Set httponly if the php version is >= 5.2.0
+			if ( version_compare( phpversion(), '5.2.0', 'ge' ) ) {
+				setcookie( $_cookie['name'], $cookie, $expire, $_cookie['path'], $domain, $secure, true );
+			} else {
+				$domain = ( empty( $domain ) ) ? $domain : $domain . '; HttpOnly';
+				setcookie( $_cookie['name'], $cookie, $expire, $_cookie['path'], $domain, $secure );
+			}
+		}
+		unset( $_cookie );
+	}
+
+	/**
+	 * Deletes all of the cookies associated with authentication
+	 *
+	 * @since 2.5
+	 */
+	function clear_auth_cookie()
+	{
+		do_action( 'clear_auth_cookie' );
+		foreach ( $this->cookies as $_scheme => $_scheme_cookies ) {
+			foreach ( $_scheme_cookies as $_cookie ) {
+				setcookie( $_cookie['name'], ' ', time() - 31536000, $_cookie['path'], $_cookie['domain'] );
+			}
+			unset( $_cookie );
+		}
+		unset( $_scheme, $_scheme_cookies );
+	}
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-dependencies.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-dependencies.php
new file mode 100644
index 0000000000000000000000000000000000000000..af3808b8c7e05ae9c25211f02ebac35b7ead684b
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-dependencies.php
@@ -0,0 +1,239 @@
+<?php
+/**
+ * BackPress Scripts enqueue.
+ *
+ * These classes were refactored from the WordPress WP_Scripts and WordPress
+ * script enqueue API.
+ *
+ * @package BackPress
+ * @since r74
+ */
+
+/**
+ * BackPress enqueued dependiences class.
+ *
+ * @package BackPress
+ * @uses _WP_Dependency
+ * @since r74
+ */
+class WP_Dependencies {
+	var $registered = array();
+	var $queue = array();
+	var $to_do = array();
+	var $done = array();
+	var $args = array();
+	var $groups = array();
+	var $group = 0;
+
+	function WP_Dependencies() {
+		$args = func_get_args();
+		call_user_func_array( array(&$this, '__construct'), $args );
+	}
+
+	function __construct() {}
+
+	/**
+	 * Do the dependencies
+	 *
+	 * Process the items passed to it or the queue.  Processes all dependencies.
+	 *
+	 * @param mixed handles (optional) items to be processed.  (void) processes queue, (string) process that item, (array of strings) process those items
+	 * @return array Items that have been processed
+	 */
+	function do_items( $handles = false, $group = false ) {
+		// Print the queue if nothing is passed.  If a string is passed, print that script.  If an array is passed, print those scripts.
+		$handles = false === $handles ? $this->queue : (array) $handles;
+		$this->all_deps( $handles );
+
+		foreach( $this->to_do as $key => $handle ) {
+			if ( !in_array($handle, $this->done) && isset($this->registered[$handle]) ) {
+
+				if ( ! $this->registered[$handle]->src ) { // Defines a group.
+					$this->done[] = $handle;
+					continue;
+				}
+
+				if ( $this->do_item( $handle, $group ) )
+					$this->done[] = $handle;
+
+				unset( $this->to_do[$key] );
+			}
+		}
+
+		return $this->done;
+	}
+
+	function do_item( $handle ) {
+		return isset($this->registered[$handle]);
+	}
+
+	/**
+	 * Determines dependencies
+	 *
+	 * Recursively builds array of items to process taking dependencies into account.  Does NOT catch infinite loops.
+	 *
+
+	 * @param mixed handles Accepts (string) dep name or (array of strings) dep names
+	 * @param bool recursion Used internally when function calls itself
+	 */
+	function all_deps( $handles, $recursion = false, $group = false ) {
+		if ( !$handles = (array) $handles )
+			return false;
+
+		foreach ( $handles as $handle ) {
+			$handle_parts = explode('?', $handle);
+			$handle = $handle_parts[0];
+			$queued = in_array($handle, $this->to_do, true);
+
+			if ( in_array($handle, $this->done, true) ) // Already done
+				continue;
+
+			$moved = $this->set_group( $handle, $recursion, $group );
+
+			if ( $queued && !$moved ) // already queued and in the right group
+				continue;
+
+			$keep_going = true;
+			if ( !isset($this->registered[$handle]) )
+				$keep_going = false; // Script doesn't exist
+			elseif ( $this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)) )
+				$keep_going = false; // Script requires deps which don't exist (not a necessary check.  efficiency?)
+			elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true, $group ) )
+				$keep_going = false; // Script requires deps which don't exist
+
+			if ( !$keep_going ) { // Either script or its deps don't exist.
+				if ( $recursion )
+					return false; // Abort this branch.
+				else
+					continue; // We're at the top level.  Move on to the next one.
+			}
+
+			if ( $queued ) // Already grobbed it and its deps
+				continue;
+
+			if ( isset($handle_parts[1]) )
+				$this->args[$handle] = $handle_parts[1];
+
+			$this->to_do[] = $handle;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Adds item
+	 *
+	 * Adds the item only if no item of that name already exists
+	 *
+	 * @param string handle Script name
+	 * @param string src Script url
+	 * @param array deps (optional) Array of script names on which this script depends
+	 * @param string ver (optional) Script version (used for cache busting)
+	 * @return array Hierarchical array of dependencies
+	 */
+	function add( $handle, $src, $deps = array(), $ver = false, $args = null ) {
+		if ( isset($this->registered[$handle]) )
+			return false;
+		$this->registered[$handle] = new _WP_Dependency( $handle, $src, $deps, $ver, $args );
+		return true;
+	}
+
+	/**
+	 * Adds extra data
+	 *
+	 * Adds data only if script has already been added
+	 *
+	 * @param string handle Script name
+	 * @param string data_name Name of object in which to store extra data
+	 * @param array data Array of extra data
+	 * @return bool success
+	 */
+	function add_data( $handle, $data_name, $data ) {
+		if ( !isset($this->registered[$handle]) )
+			return false;
+		return $this->registered[$handle]->add_data( $data_name, $data );
+	}
+
+	function remove( $handles ) {
+		foreach ( (array) $handles as $handle )
+			unset($this->registered[$handle]);
+	}
+
+	function enqueue( $handles ) {
+		foreach ( (array) $handles as $handle ) {
+			$handle = explode('?', $handle);
+			if ( !in_array($handle[0], $this->queue) && isset($this->registered[$handle[0]]) ) {
+				$this->queue[] = $handle[0];
+				if ( isset($handle[1]) )
+					$this->args[$handle[0]] = $handle[1];
+			}
+		}
+	}
+
+	function dequeue( $handles ) {
+		foreach ( (array) $handles as $handle )
+			unset( $this->queue[$handle] );
+	}
+
+	function query( $handle, $list = 'registered' ) { // registered, queue, done, to_do
+		switch ( $list ) :
+		case 'registered':
+		case 'scripts': // back compat
+			if ( isset($this->registered[$handle]) )
+				return $this->registered[$handle];
+			break;
+		case 'to_print': // back compat
+		case 'printed': // back compat
+			if ( 'to_print' == $list )
+				$list = 'to_do';
+			else
+				$list = 'printed';
+		default:
+			if ( in_array($handle, $this->$list) )
+				return true;
+			break;
+		endswitch;
+		return false;
+	}
+
+	function set_group( $handle, $recursion, $group ) {
+		$group = (int) $group;
+
+		if ( $recursion )
+			$group = min($this->group, $group);
+		else
+			$this->group = $group;
+
+		if ( isset($this->groups[$handle]) && $this->groups[$handle] <= $group )
+			return false;
+
+		$this->groups[$handle] = $group;
+		return true;
+	}
+
+}
+
+class _WP_Dependency {
+	var $handle;
+	var $src;
+	var $deps = array();
+	var $ver = false;
+	var $args = null;
+
+	var $extra = array();
+
+	function _WP_Dependency() {
+		@list($this->handle, $this->src, $this->deps, $this->ver, $this->args) = func_get_args();
+		if ( !is_array($this->deps) )
+			$this->deps = array();
+		if ( !$this->ver )
+			$this->ver = false;
+	}
+
+	function add_data( $name, $data ) {
+		if ( !is_scalar($name) )
+			return false;
+		$this->extra[$name] = $data;
+		return true;
+	}
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-error.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-error.php
new file mode 100644
index 0000000000000000000000000000000000000000..bcba3830cc9dff03bab15bca92b184877bbea4bc
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-error.php
@@ -0,0 +1,204 @@
+<?php
+// Last sync [WP11537]
+
+/**
+ * WordPress Error class.
+ *
+ * Container for checking for WordPress errors and error messages. Return
+ * WP_Error and use {@link is_wp_error()} to check if this class is returned.
+ * Many core WordPress functions pass this class in the event of an error and
+ * if not handled properly will result in code errors.
+ *
+ * @package WordPress
+ * @since 2.1.0
+ */
+class WP_Error {
+	/**
+	 * Stores the list of errors.
+	 *
+	 * @since 2.1.0
+	 * @var array
+	 * @access private
+	 */
+	var $errors = array();
+
+	/**
+	 * Stores the list of data for error codes.
+	 *
+	 * @since 2.1.0
+	 * @var array
+	 * @access private
+	 */
+	var $error_data = array();
+
+	/**
+	 * PHP4 Constructor - Sets up error message.
+	 *
+	 * If code parameter is empty then nothing will be done. It is possible to
+	 * add multiple messages to the same code, but with other methods in the
+	 * class.
+	 *
+	 * All parameters are optional, but if the code parameter is set, then the
+	 * data parameter is optional.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string|int $code Error code
+	 * @param string $message Error message
+	 * @param mixed $data Optional. Error data.
+	 * @return WP_Error
+	 */
+	function WP_Error($code = '', $message = '', $data = '') {
+		if ( empty($code) )
+			return;
+
+		$this->errors[$code][] = $message;
+
+		if ( ! empty($data) )
+			$this->error_data[$code] = $data;
+	}
+
+	/**
+	 * Retrieve all error codes.
+	 *
+	 * @since 2.1.0
+	 * @access public
+	 *
+	 * @return array List of error codes, if avaiable.
+	 */
+	function get_error_codes() {
+		if ( empty($this->errors) )
+			return array();
+
+		return array_keys($this->errors);
+	}
+
+	/**
+	 * Retrieve first error code available.
+	 *
+	 * @since 2.1.0
+	 * @access public
+	 *
+	 * @return string|int Empty string, if no error codes.
+	 */
+	function get_error_code() {
+		$codes = $this->get_error_codes();
+
+		if ( empty($codes) )
+			return '';
+
+		return $codes[0];
+	}
+
+	/**
+	 * Retrieve all error messages or error messages matching code.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string|int $code Optional. Retrieve messages matching code, if exists.
+	 * @return array Error strings on success, or empty array on failure (if using codee parameter).
+	 */
+	function get_error_messages($code = '') {
+		// Return all messages if no code specified.
+		if ( empty($code) ) {
+			$all_messages = array();
+			foreach ( (array) $this->errors as $code => $messages )
+				$all_messages = array_merge($all_messages, $messages);
+
+			return $all_messages;
+		}
+
+		if ( isset($this->errors[$code]) )
+			return $this->errors[$code];
+		else
+			return array();
+	}
+
+	/**
+	 * Get single error message.
+	 *
+	 * This will get the first message available for the code. If no code is
+	 * given then the first code available will be used.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string|int $code Optional. Error code to retrieve message.
+	 * @return string
+	 */
+	function get_error_message($code = '') {
+		if ( empty($code) )
+			$code = $this->get_error_code();
+		$messages = $this->get_error_messages($code);
+		if ( empty($messages) )
+			return '';
+		return $messages[0];
+	}
+
+	/**
+	 * Retrieve error data for error code.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string|int $code Optional. Error code.
+	 * @return mixed Null, if no errors.
+	 */
+	function get_error_data($code = '') {
+		if ( empty($code) )
+			$code = $this->get_error_code();
+
+		if ( isset($this->error_data[$code]) )
+			return $this->error_data[$code];
+		return null;
+	}
+
+	/**
+	 * Append more error messages to list of error messages.
+	 *
+	 * @since 2.1.0
+	 * @access public
+	 *
+	 * @param string|int $code Error code.
+	 * @param string $message Error message.
+	 * @param mixed $data Optional. Error data.
+	 */
+	function add($code, $message, $data = '') {
+		$this->errors[$code][] = $message;
+		if ( ! empty($data) )
+			$this->error_data[$code] = $data;
+	}
+
+	/**
+	 * Add data for error code.
+	 *
+	 * The error code can only contain one error data.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param mixed $data Error data.
+	 * @param string|int $code Error code.
+	 */
+	function add_data($data, $code = '') {
+		if ( empty($code) )
+			$code = $this->get_error_code();
+
+		$this->error_data[$code] = $data;
+	}
+}
+
+/**
+ * Check whether variable is a WordPress Error.
+ *
+ * Looks at the object and if a WP_Error class. Does not check to see if the
+ * parent is also WP_Error, so can't inherit WP_Error and still use this
+ * function.
+ *
+ * @since 2.1.0
+ *
+ * @param mixed $thing Check if unknown variable is WordPress Error object.
+ * @return bool True, if WP_Error. False, if not WP_Error.
+ */
+function is_wp_error($thing) {
+	if ( is_object($thing) && is_a($thing, 'WP_Error') )
+		return true;
+	return false;
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-http.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-http.php
new file mode 100644
index 0000000000000000000000000000000000000000..6916afbc34e7da9b992bbc667023701f126b5863
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-http.php
@@ -0,0 +1,2052 @@
+<?php
+// Last sync [WP11537]
+
+/**
+ * Simple and uniform HTTP request API.
+ *
+ * Will eventually replace and standardize the WordPress HTTP requests made.
+ *
+ * @link http://trac.wordpress.org/ticket/4779 HTTP API Proposal
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7.0
+ * @author Jacob Santos <wordpress@santosj.name>
+ */
+
+/**
+ * WordPress HTTP Class for managing HTTP Transports and making HTTP requests.
+ *
+ * This class is called for the functionality of making HTTP requests and should replace Snoopy
+ * functionality, eventually. There is no available functionality to add HTTP transport
+ * implementations, since most of the HTTP transports are added and available for use.
+ *
+ * The exception is that cURL is not available as a transport and lacking an implementation. It will
+ * be added later and should be a patch on the WordPress Trac.
+ *
+ * There are no properties, because none are needed and for performance reasons. Some of the
+ * functions are static and while they do have some overhead over functions in PHP4, the purpose is
+ * maintainability. When PHP5 is finally the requirement, it will be easy to add the static keyword
+ * to the code. It is not as easy to convert a function to a method after enough code uses the old
+ * way.
+ *
+ * Debugging includes several actions, which pass different variables for debugging the HTTP API.
+ *
+ * <strong>http_transport_get_debug</strong> - gives working, nonblocking, and blocking transports.
+ *
+ * <strong>http_transport_post_debug</strong> - gives working, nonblocking, and blocking transports.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7.0
+ */
+class WP_Http {
+
+	/**
+	 * PHP4 style Constructor - Calls PHP5 Style Constructor
+	 *
+	 * @since 2.7.0
+	 * @return WP_Http
+	 */
+	function WP_Http() {
+		$this->__construct();
+	}
+
+	/**
+	 * PHP5 style Constructor - Setup available transport if not available.
+	 *
+	 * PHP4 does not have the 'self' keyword and since WordPress supports PHP4,
+	 * the class needs to be used for the static call.
+	 *
+	 * The transport are setup to save time. This should only be called once, so
+	 * the overhead should be fine.
+	 *
+	 * @since 2.7.0
+	 * @return WP_Http
+	 */
+	function __construct() {
+		WP_Http::_getTransport();
+		WP_Http::_postTransport();
+	}
+
+	/**
+	 * Tests the WordPress HTTP objects for an object to use and returns it.
+	 *
+	 * Tests all of the objects and returns the object that passes. Also caches
+	 * that object to be used later.
+	 *
+	 * The order for the GET/HEAD requests are HTTP Extension, FSockopen Streams, 
+	 * Fopen, and finally cURL. Whilst Fsockopen has the highest overhead, Its
+	 * used 2nd due to high compatibility with most hosts, The HTTP Extension is
+	 * tested first due to hosts which have it enabled, are likely to work
+	 * correctly with it.
+	 *
+	 * There are currently issues with "localhost" not resolving correctly with
+	 * DNS. This may cause an error "failed to open stream: A connection attempt
+	 * failed because the connected party did not properly respond after a
+	 * period of time, or established connection failed because connected host
+	 * has failed to respond."
+	 *
+	 * @since 2.7.0
+	 * @access private
+	 *
+	 * @param array $args Request args, default us an empty array
+	 * @return object|null Null if no transports are available, HTTP transport object.
+	 */
+	function &_getTransport( $args = array() ) {
+		static $working_transport, $blocking_transport, $nonblocking_transport;
+
+		if ( is_null($working_transport) ) {
+			if ( true === WP_Http_ExtHttp::test($args) ) {
+				$working_transport['exthttp'] = new WP_Http_ExtHttp();
+				$blocking_transport[] = &$working_transport['exthttp'];
+			} else if ( true === WP_Http_Fsockopen::test($args) ) {
+				$working_transport['fsockopen'] = new WP_Http_Fsockopen();
+				$blocking_transport[] = &$working_transport['fsockopen'];
+			} else if ( true === WP_Http_Streams::test($args) ) {
+				$working_transport['streams'] = new WP_Http_Streams();
+				$blocking_transport[] = &$working_transport['streams'];
+			} else if ( true === WP_Http_Fopen::test($args) ) {
+				$working_transport['fopen'] = new WP_Http_Fopen();
+				$blocking_transport[] = &$working_transport['fopen'];
+			} else if ( true === WP_Http_Curl::test($args) ) {
+				$working_transport['curl'] = new WP_Http_Curl();
+				$blocking_transport[] = &$working_transport['curl'];
+			}
+
+			foreach ( array('curl', 'streams', 'fopen', 'fsockopen', 'exthttp') as $transport ) {
+				if ( isset($working_transport[$transport]) )
+					$nonblocking_transport[] = &$working_transport[$transport];
+			}
+		}
+
+		if ( has_filter('http_transport_get_debug') )
+			do_action('http_transport_get_debug', $working_transport, $blocking_transport, $nonblocking_transport);
+
+		if ( isset($args['blocking']) && !$args['blocking'] )
+			return $nonblocking_transport;
+		else
+			return $blocking_transport;
+	}
+
+	/**
+	 * Tests the WordPress HTTP objects for an object to use and returns it.
+	 *
+	 * Tests all of the objects and returns the object that passes. Also caches
+	 * that object to be used later. This is for posting content to a URL and
+	 * is used when there is a body. The plain Fopen Transport can not be used
+	 * to send content, but the streams transport can. This is a limitation that
+	 * is addressed here, by just not including that transport.
+	 *
+	 * @since 2.7.0
+	 * @access private
+	 *
+	 * @param array $args Request args, default us an empty array
+	 * @return object|null Null if no transports are available, HTTP transport object.
+	 */
+	function &_postTransport( $args = array() ) {
+		static $working_transport, $blocking_transport, $nonblocking_transport;
+
+		if ( is_null($working_transport) ) {
+			if ( true === WP_Http_ExtHttp::test($args) ) {
+				$working_transport['exthttp'] = new WP_Http_ExtHttp();
+				$blocking_transport[] = &$working_transport['exthttp'];
+			} else if ( true === WP_Http_Fsockopen::test($args) ) {
+				$working_transport['fsockopen'] = new WP_Http_Fsockopen();
+				$blocking_transport[] = &$working_transport['fsockopen'];
+			} else if ( true === WP_Http_Streams::test($args) ) {
+				$working_transport['streams'] = new WP_Http_Streams();
+				$blocking_transport[] = &$working_transport['streams'];
+			} else if ( true === WP_Http_Curl::test($args) ) {
+				$working_transport['curl'] = new WP_Http_Curl();
+				$blocking_transport[] = &$working_transport['curl'];
+			}
+
+			foreach ( array('curl', 'streams', 'fsockopen', 'exthttp') as $transport ) {
+				if ( isset($working_transport[$transport]) )
+					$nonblocking_transport[] = &$working_transport[$transport];
+			}
+		}
+
+		if ( has_filter('http_transport_post_debug') )
+			do_action('http_transport_post_debug', $working_transport, $blocking_transport, $nonblocking_transport);
+
+		if ( isset($args['blocking']) && !$args['blocking'] )
+			return $nonblocking_transport;
+		else
+			return $blocking_transport;
+	}
+
+	/**
+	 * Send a HTTP request to a URI.
+	 *
+	 * The body and headers are part of the arguments. The 'body' argument is for the body and will
+	 * accept either a string or an array. The 'headers' argument should be an array, but a string
+	 * is acceptable. If the 'body' argument is an array, then it will automatically be escaped
+	 * using http_build_query().
+	 *
+	 * The only URI that are supported in the HTTP Transport implementation are the HTTP and HTTPS
+	 * protocols. HTTP and HTTPS are assumed so the server might not know how to handle the send
+	 * headers. Other protocols are unsupported and most likely will fail.
+	 *
+	 * The defaults are 'method', 'timeout', 'redirection', 'httpversion', 'blocking' and
+	 * 'user-agent'.
+	 *
+	 * Accepted 'method' values are 'GET', 'POST', and 'HEAD', some transports technically allow
+	 * others, but should not be assumed. The 'timeout' is used to sent how long the connection
+	 * should stay open before failing when no response. 'redirection' is used to track how many
+	 * redirects were taken and used to sent the amount for other transports, but not all transports
+	 * accept setting that value.
+	 *
+	 * The 'httpversion' option is used to sent the HTTP version and accepted values are '1.0', and
+	 * '1.1' and should be a string. Version 1.1 is not supported, because of chunk response. The
+	 * 'user-agent' option is the user-agent and is used to replace the default user-agent, which is
+	 * 'WordPress/WP_Version', where WP_Version is the value from $wp_version.
+	 *
+	 * 'blocking' is the default, which is used to tell the transport, whether it should halt PHP
+	 * while it performs the request or continue regardless. Actually, that isn't entirely correct.
+	 * Blocking mode really just means whether the fread should just pull what it can whenever it
+	 * gets bytes or if it should wait until it has enough in the buffer to read or finishes reading
+	 * the entire content. It doesn't actually always mean that PHP will continue going after making
+	 * the request.
+	 *
+	 * @access public
+	 * @since 2.7.0
+	 *
+	 * @param string $url URI resource.
+	 * @param str|array $args Optional. Override the defaults.
+	 * @return array containing 'headers', 'body', 'response', 'cookies'
+	 */
+	function request( $url, $args = array() ) {
+		$defaults = array(
+			'method' => 'GET',
+			'timeout' => apply_filters( 'http_request_timeout', 5),
+			'redirection' => apply_filters( 'http_request_redirection_count', 5),
+			'httpversion' => apply_filters( 'http_request_version', '1.0'),
+			'user-agent' => apply_filters( 'http_headers_useragent', backpress_get_option( 'wp_http_version' ) ),
+			'blocking' => true,
+			'headers' => array(),
+			'cookies' => array(),
+			'body' => null,
+			'compress' => false,
+			'decompress' => true,
+			'sslverify' => true
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		$r = apply_filters( 'http_request_args', $r, $url );
+
+		$arrURL = parse_url($url);
+
+		if ( $this->block_request( $url ) )
+			return new WP_Error('http_request_failed', 'User has blocked requests through HTTP.');
+
+		// Determine if this is a https call and pass that on to the transport functions
+		// so that we can blacklist the transports that do not support ssl verification
+		$r['ssl'] = $arrURL['scheme'] == 'https' || $arrURL['scheme'] == 'ssl';
+
+		// Determine if this request is to OUR install of WordPress
+		$homeURL = parse_url( backpress_get_option( 'application_uri' ) );
+		$r['local'] = $homeURL['host'] == $arrURL['host'] || 'localhost' == $arrURL['host'];
+		unset($homeURL);
+
+		if ( is_null( $r['headers'] ) )
+			$r['headers'] = array();
+
+		if ( ! is_array($r['headers']) ) {
+			$processedHeaders = WP_Http::processHeaders($r['headers']);
+			$r['headers'] = $processedHeaders['headers'];
+		}
+
+		if ( isset($r['headers']['User-Agent']) ) {
+			$r['user-agent'] = $r['headers']['User-Agent'];
+			unset($r['headers']['User-Agent']);
+		}
+
+		if ( isset($r['headers']['user-agent']) ) {
+			$r['user-agent'] = $r['headers']['user-agent'];
+			unset($r['headers']['user-agent']);
+		}
+
+		// Construct Cookie: header if any cookies are set
+		WP_Http::buildCookieHeader( $r );
+
+		if ( WP_Http_Encoding::is_available() )
+			$r['headers']['Accept-Encoding'] = WP_Http_Encoding::accept_encoding();
+
+		if ( is_null($r['body']) ) {
+			// Some servers fail when sending content without the content-length
+			// header being set.
+			$r['headers']['Content-Length'] = 0;
+			$transports = WP_Http::_getTransport($r);
+		} else {
+			if ( is_array( $r['body'] ) || is_object( $r['body'] ) ) {
+				if ( ! version_compare(phpversion(), '5.1.2', '>=') )
+					$r['body'] = _http_build_query($r['body'], null, '&');
+				else
+					$r['body'] = http_build_query($r['body'], null, '&');
+				$r['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=' . backpress_get_option( 'charset' );
+				$r['headers']['Content-Length'] = strlen($r['body']);
+			}
+
+			if ( ! isset( $r['headers']['Content-Length'] ) && ! isset( $r['headers']['content-length'] ) )
+				$r['headers']['Content-Length'] = strlen($r['body']);
+
+			$transports = WP_Http::_postTransport($r);
+		}
+
+		if ( has_action('http_api_debug') )
+			do_action('http_api_debug', $transports, 'transports_list');
+
+		$response = array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
+		foreach ( (array) $transports as $transport ) {
+			$response = $transport->request($url, $r);
+
+			if ( has_action('http_api_debug') )
+				do_action( 'http_api_debug', $response, 'response', get_class($transport) );
+
+			if ( ! is_wp_error($response) )
+				return $response;
+		}
+
+		return $response;
+	}
+
+	/**
+	 * Uses the POST HTTP method.
+	 *
+	 * Used for sending data that is expected to be in the body.
+	 *
+	 * @access public
+	 * @since 2.7.0
+	 *
+	 * @param string $url URI resource.
+	 * @param str|array $args Optional. Override the defaults.
+	 * @return boolean
+	 */
+	function post($url, $args = array()) {
+		$defaults = array('method' => 'POST');
+		$r = wp_parse_args( $args, $defaults );
+		return $this->request($url, $r);
+	}
+
+	/**
+	 * Uses the GET HTTP method.
+	 *
+	 * Used for sending data that is expected to be in the body.
+	 *
+	 * @access public
+	 * @since 2.7.0
+	 *
+	 * @param string $url URI resource.
+	 * @param str|array $args Optional. Override the defaults.
+	 * @return boolean
+	 */
+	function get($url, $args = array()) {
+		$defaults = array('method' => 'GET');
+		$r = wp_parse_args( $args, $defaults );
+		return $this->request($url, $r);
+	}
+
+	/**
+	 * Uses the HEAD HTTP method.
+	 *
+	 * Used for sending data that is expected to be in the body.
+	 *
+	 * @access public
+	 * @since 2.7.0
+	 *
+	 * @param string $url URI resource.
+	 * @param str|array $args Optional. Override the defaults.
+	 * @return boolean
+	 */
+	function head($url, $args = array()) {
+		$defaults = array('method' => 'HEAD');
+		$r = wp_parse_args( $args, $defaults );
+		return $this->request($url, $r);
+	}
+
+	/**
+	 * Parses the responses and splits the parts into headers and body.
+	 *
+	 * @access public
+	 * @static
+	 * @since 2.7.0
+	 *
+	 * @param string $strResponse The full response string
+	 * @return array Array with 'headers' and 'body' keys.
+	 */
+	function processResponse($strResponse) {
+		list($theHeaders, $theBody) = explode("\r\n\r\n", $strResponse, 2);
+		return array('headers' => $theHeaders, 'body' => $theBody);
+	}
+
+	/**
+	 * Transform header string into an array.
+	 *
+	 * If an array is given then it is assumed to be raw header data with numeric keys with the
+	 * headers as the values. No headers must be passed that were already processed.
+	 *
+	 * @access public
+	 * @static
+	 * @since 2.7.0
+	 *
+	 * @param string|array $headers
+	 * @return array Processed string headers. If duplicate headers are encountered,
+	 * 					Then a numbered array is returned as the value of that header-key.
+	 */
+	function processHeaders($headers) {
+		// split headers, one per array element
+		if ( is_string($headers) ) {
+			// tolerate line terminator: CRLF = LF (RFC 2616 19.3)
+			$headers = str_replace("\r\n", "\n", $headers);
+			// unfold folded header fields. LWS = [CRLF] 1*( SP | HT ) <US-ASCII SP, space (32)>, <US-ASCII HT, horizontal-tab (9)> (RFC 2616 2.2)
+			$headers = preg_replace('/\n[ \t]/', ' ', $headers);
+			// create the headers array
+			$headers = explode("\n", $headers);
+		}
+
+		$response = array('code' => 0, 'message' => '');
+
+		$cookies = array();
+		$newheaders = array();
+		foreach ( $headers as $tempheader ) {
+			if ( empty($tempheader) )
+				continue;
+
+			if ( false === strpos($tempheader, ':') ) {
+				list( , $iResponseCode, $strResponseMsg) = explode(' ', $tempheader, 3);
+				$response['code'] = $iResponseCode;
+				$response['message'] = $strResponseMsg;
+				continue;
+			}
+
+			list($key, $value) = explode(':', $tempheader, 2);
+
+			if ( !empty( $value ) ) {
+				$key = strtolower( $key );
+				if ( isset( $newheaders[$key] ) ) {
+					$newheaders[$key] = array( $newheaders[$key], trim( $value ) );
+				} else {
+					$newheaders[$key] = trim( $value );
+				}
+				if ( 'set-cookie' == strtolower( $key ) )
+					$cookies[] = new WP_Http_Cookie( $value );
+			}
+		}
+
+		return array('response' => $response, 'headers' => $newheaders, 'cookies' => $cookies);
+	}
+
+	/**
+	 * Takes the arguments for a ::request() and checks for the cookie array.
+	 *
+	 * If it's found, then it's assumed to contain WP_Http_Cookie objects, which are each parsed
+	 * into strings and added to the Cookie: header (within the arguments array). Edits the array by
+	 * reference.
+	 *
+	 * @access public
+	 * @version 2.8.0
+	 * @static
+	 *
+	 * @param array $r Full array of args passed into ::request()
+	 */
+	function buildCookieHeader( &$r ) {
+		if ( ! empty($r['cookies']) ) {
+			$cookies_header = '';
+			foreach ( (array) $r['cookies'] as $cookie ) {
+				$cookies_header .= $cookie->getHeaderValue() . '; ';
+			}
+			$cookies_header = substr( $cookies_header, 0, -2 );
+			$r['headers']['cookie'] = $cookies_header;
+		}
+	}
+
+	/**
+	 * Decodes chunk transfer-encoding, based off the HTTP 1.1 specification.
+	 *
+	 * Based off the HTTP http_encoding_dechunk function. Does not support UTF-8. Does not support
+	 * returning footer headers. Shouldn't be too difficult to support it though.
+	 *
+	 * @todo Add support for footer chunked headers.
+	 * @access public
+	 * @since 2.7.0
+	 * @static
+	 *
+	 * @param string $body Body content
+	 * @return string Chunked decoded body on success or raw body on failure.
+	 */
+	function chunkTransferDecode($body) {
+		$body = str_replace(array("\r\n", "\r"), "\n", $body);
+		// The body is not chunked encoding or is malformed.
+		if ( ! preg_match( '/^[0-9a-f]+(\s|\n)+/mi', trim($body) ) )
+			return $body;
+
+		$parsedBody = '';
+		//$parsedHeaders = array(); Unsupported
+
+		while ( true ) {
+			$hasChunk = (bool) preg_match( '/^([0-9a-f]+)(\s|\n)+/mi', $body, $match );
+
+			if ( $hasChunk ) {
+				if ( empty( $match[1] ) )
+					return $body;
+
+				$length = hexdec( $match[1] );
+				$chunkLength = strlen( $match[0] );
+
+				$strBody = substr($body, $chunkLength, $length);
+				$parsedBody .= $strBody;
+
+				$body = ltrim(str_replace(array($match[0], $strBody), '', $body), "\n");
+
+				if ( "0" == trim($body) )
+					return $parsedBody; // Ignore footer headers.
+			} else {
+				return $body;
+			}
+		}
+	}
+
+	/**
+	 * Block requests through the proxy.
+	 *
+	 * Those who are behind a proxy and want to prevent access to certain hosts may do so. This will
+	 * prevent plugins from working and core functionality, if you don't include api.wordpress.org.
+	 *
+	 * You block external URL requests by defining WP_HTTP_BLOCK_EXTERNAL in your wp-config.php file
+	 * and this will only allow localhost and your blog to make requests. The constant
+	 * WP_ACCESSIBLE_HOSTS will allow additional hosts to go through for requests. The format of the
+	 * WP_ACCESSIBLE_HOSTS constant is a comma separated list of hostnames to allow.
+	 *
+	 * @since 2.8.0
+	 * @link http://core.trac.wordpress.org/ticket/8927 Allow preventing external requests.
+	 *
+	 * @param string $uri URI of url.
+	 * @return bool True to block, false to allow.
+	 */
+	function block_request($uri) {
+		// We don't need to block requests, because nothing is blocked.
+		if ( ! defined('WP_HTTP_BLOCK_EXTERNAL') || ( defined('WP_HTTP_BLOCK_EXTERNAL') && WP_HTTP_BLOCK_EXTERNAL == false ) )
+			return false;
+
+		// parse_url() only handles http, https type URLs, and will emit E_WARNING on failure.
+		// This will be displayed on blogs, which is not reasonable.
+		$check = @parse_url($uri);
+
+		/* Malformed URL, can not process, but this could mean ssl, so let through anyway.
+		 *
+		 * This isn't very security sound. There are instances where a hacker might attempt
+		 * to bypass the proxy and this check. However, the reason for this behavior is that
+		 * WordPress does not do any checking currently for non-proxy requests, so it is keeps with
+		 * the default unsecure nature of the HTTP request.
+		 */
+		if ( $check === false )
+			return false;
+
+		$home = parse_url( backpress_get_option( 'application_uri' ) );
+
+		// Don't block requests back to ourselves by default
+		if ( $check['host'] == 'localhost' || $check['host'] == $home['host'] )
+			return apply_filters('block_local_requests', false);
+
+		if ( !defined('WP_ACCESSIBLE_HOSTS') )
+			return true;
+
+		static $accessible_hosts;
+		if ( null == $accessible_hosts )
+			$accessible_hosts = preg_split('|,\s*|', WP_ACCESSIBLE_HOSTS);
+
+		return !in_array( $check['host'], $accessible_hosts ); //Inverse logic, If its in the array, then we can't access it.
+	}
+}
+
+/**
+ * HTTP request method uses fsockopen function to retrieve the url.
+ *
+ * This would be the preferred method, but the fsockopen implementation has the most overhead of all
+ * the HTTP transport implementations.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7.0
+ */
+class WP_Http_Fsockopen {
+	/**
+	 * Send a HTTP request to a URI using fsockopen().
+	 *
+	 * Does not support non-blocking mode.
+	 *
+	 * @see WP_Http::request For default options descriptions.
+	 *
+	 * @since 2.7
+	 * @access public
+	 * @param string $url URI resource.
+	 * @param str|array $args Optional. Override the defaults.
+	 * @return array 'headers', 'body', 'cookies' and 'response' keys.
+	 */
+	function request($url, $args = array()) {
+		$defaults = array(
+			'method' => 'GET', 'timeout' => 5,
+			'redirection' => 5, 'httpversion' => '1.0',
+			'blocking' => true,
+			'headers' => array(), 'body' => null, 'cookies' => array()
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+
+		if ( isset($r['headers']['User-Agent']) ) {
+			$r['user-agent'] = $r['headers']['User-Agent'];
+			unset($r['headers']['User-Agent']);
+		} else if( isset($r['headers']['user-agent']) ) {
+			$r['user-agent'] = $r['headers']['user-agent'];
+			unset($r['headers']['user-agent']);
+		}
+
+		// Construct Cookie: header if any cookies are set
+		WP_Http::buildCookieHeader( $r );
+
+		$iError = null; // Store error number
+		$strError = null; // Store error string
+
+		$arrURL = parse_url($url);
+
+		$fsockopen_host = $arrURL['host'];
+
+		$secure_transport = false;
+
+		if ( ! isset( $arrURL['port'] ) ) {
+			if ( ( $arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https' ) && extension_loaded('openssl') ) {
+				$fsockopen_host = "ssl://$fsockopen_host";
+				$arrURL['port'] = 443;
+				$secure_transport = true;
+			} else {
+				$arrURL['port'] = 80;
+			}
+		}
+
+		// There are issues with the HTTPS and SSL protocols that cause errors that can be safely
+		// ignored and should be ignored.
+		if ( true === $secure_transport )
+			$error_reporting = error_reporting(0);
+
+		$startDelay = time();
+
+		$proxy = new WP_HTTP_Proxy();
+
+		if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) ) {
+			if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
+				$handle = @fsockopen( $proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] );
+			else
+				$handle = @fsockopen( $fsockopen_host, $arrURL['port'], $iError, $strError, $r['timeout'] );
+		} else {
+			if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
+				$handle = fsockopen( $proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] );
+			else
+				$handle = fsockopen( $fsockopen_host, $arrURL['port'], $iError, $strError, $r['timeout'] );
+		}
+
+		$endDelay = time();
+
+		// If the delay is greater than the timeout then fsockopen should't be used, because it will
+		// cause a long delay.
+		$elapseDelay = ($endDelay-$startDelay) > $r['timeout'];
+		if ( true === $elapseDelay )
+			backpress_add_option( 'disable_fsockopen', $endDelay, null, true );
+
+		if ( false === $handle )
+			return new WP_Error('http_request_failed', $iError . ': ' . $strError);
+
+		stream_set_timeout($handle, $r['timeout'] );
+
+		if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) //Some proxies require full URL in this field.
+			$requestPath = $url;
+		else
+			$requestPath = $arrURL['path'] . ( isset($arrURL['query']) ? '?' . $arrURL['query'] : '' );
+
+		if ( empty($requestPath) )
+			$requestPath .= '/';
+
+		$strHeaders = strtoupper($r['method']) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n";
+
+		if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
+			$strHeaders .= 'Host: ' . $arrURL['host'] . ':' . $arrURL['port'] . "\r\n";
+		else
+			$strHeaders .= 'Host: ' . $arrURL['host'] . "\r\n";
+
+		if ( isset($r['user-agent']) )
+			$strHeaders .= 'User-agent: ' . $r['user-agent'] . "\r\n";
+
+		if ( is_array($r['headers']) ) {
+			foreach ( (array) $r['headers'] as $header => $headerValue )
+				$strHeaders .= $header . ': ' . $headerValue . "\r\n";
+		} else {
+			$strHeaders .= $r['headers'];
+		}
+
+		if ( $proxy->use_authentication() )
+			$strHeaders .= $proxy->authentication_header() . "\r\n";
+
+		$strHeaders .= "\r\n";
+
+		if ( ! is_null($r['body']) )
+			$strHeaders .= $r['body'];
+
+		fwrite($handle, $strHeaders);
+
+		if ( ! $r['blocking'] ) {
+			fclose($handle);
+			return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
+		}
+
+		$strResponse = '';
+		while ( ! feof($handle) )
+			$strResponse .= fread($handle, 4096);
+
+		fclose($handle);
+
+		if ( true === $secure_transport )
+			error_reporting($error_reporting);
+
+		$process = WP_Http::processResponse($strResponse);
+		$arrHeaders = WP_Http::processHeaders($process['headers']);
+
+		// Is the response code within the 400 range?
+		if ( (int) $arrHeaders['response']['code'] >= 400 && (int) $arrHeaders['response']['code'] < 500 )
+			return new WP_Error('http_request_failed', $arrHeaders['response']['code'] . ': ' . $arrHeaders['response']['message']);
+
+		// If location is found, then assume redirect and redirect to location.
+		if ( isset($arrHeaders['headers']['location']) ) {
+			if ( $r['redirection']-- > 0 ) {
+				return $this->request($arrHeaders['headers']['location'], $r);
+			} else {
+				return new WP_Error('http_request_failed', __('Too many redirects.'));
+			}
+		}
+
+		// If the body was chunk encoded, then decode it.
+		if ( ! empty( $process['body'] ) && isset( $arrHeaders['headers']['transfer-encoding'] ) && 'chunked' == $arrHeaders['headers']['transfer-encoding'] )
+			$process['body'] = WP_Http::chunkTransferDecode($process['body']);
+
+		if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($arrHeaders['headers']) )
+			$process['body'] = WP_Http_Encoding::decompress( $process['body'] );
+
+		return array('headers' => $arrHeaders['headers'], 'body' => $process['body'], 'response' => $arrHeaders['response'], 'cookies' => $arrHeaders['cookies']);
+	}
+
+	/**
+	 * Whether this class can be used for retrieving an URL.
+	 *
+	 * @since 2.7.0
+	 * @static
+	 * @return boolean False means this class can not be used, true means it can.
+	 */
+	function test( $args = array() ) {
+		if ( false !== ($option = backpress_get_option( 'disable_fsockopen' )) && time()-$option < 43200 ) // 12 hours
+			return false;
+
+		$is_ssl = isset($args['ssl']) && $args['ssl'];
+
+		if ( ! $is_ssl && function_exists( 'fsockopen' ) )
+			$use = true;
+		elseif ( $is_ssl && extension_loaded('openssl') && function_exists( 'fsockopen' ) )
+			$use = true;
+		else
+			$use = false;
+
+		return apply_filters('use_fsockopen_transport', $use, $args);
+	}
+}
+
+/**
+ * HTTP request method uses fopen function to retrieve the url.
+ *
+ * Requires PHP version greater than 4.3.0 for stream support. Does not allow for $context support,
+ * but should still be okay, to write the headers, before getting the response. Also requires that
+ * 'allow_url_fopen' to be enabled.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7.0
+ */
+class WP_Http_Fopen {
+	/**
+	 * Send a HTTP request to a URI using fopen().
+	 *
+	 * This transport does not support sending of headers and body, therefore should not be used in
+	 * the instances, where there is a body and headers.
+	 *
+	 * Notes: Does not support non-blocking mode. Ignores 'redirection' option.
+	 *
+	 * @see WP_Http::retrieve For default options descriptions.
+	 *
+	 * @access public
+	 * @since 2.7.0
+	 *
+	 * @param string $url URI resource.
+	 * @param str|array $args Optional. Override the defaults.
+	 * @return array 'headers', 'body', 'cookies' and 'response' keys.
+	 */
+	function request($url, $args = array()) {
+		$defaults = array(
+			'method' => 'GET', 'timeout' => 5,
+			'redirection' => 5, 'httpversion' => '1.0',
+			'blocking' => true,
+			'headers' => array(), 'body' => null, 'cookies' => array()
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+
+		$arrURL = parse_url($url);
+
+		if ( false === $arrURL )
+			return new WP_Error('http_request_failed', sprintf(__('Malformed URL: %s'), $url));
+
+		if ( 'http' != $arrURL['scheme'] && 'https' != $arrURL['scheme'] )
+			$url = str_replace($arrURL['scheme'], 'http', $url);
+
+		if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) )
+			$handle = @fopen($url, 'r');
+		else
+			$handle = fopen($url, 'r');
+
+		if (! $handle)
+			return new WP_Error('http_request_failed', sprintf(__('Could not open handle for fopen() to %s'), $url));
+
+		stream_set_timeout($handle, $r['timeout'] );
+
+		if ( ! $r['blocking'] ) {
+			fclose($handle);
+			return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
+		}
+
+		$strResponse = '';
+		while ( ! feof($handle) )
+			$strResponse .= fread($handle, 4096);
+
+		if ( function_exists('stream_get_meta_data') ) {
+			$meta = stream_get_meta_data($handle);
+			$theHeaders = $meta['wrapper_data'];
+			if ( isset( $meta['wrapper_data']['headers'] ) )
+				$theHeaders = $meta['wrapper_data']['headers'];
+		} else {
+			//$http_response_header is a PHP reserved variable which is set in the current-scope when using the HTTP Wrapper
+			//see http://php.oregonstate.edu/manual/en/reserved.variables.httpresponseheader.php
+			$theHeaders = $http_response_header;
+		}
+
+		fclose($handle);
+
+		$processedHeaders = WP_Http::processHeaders($theHeaders);
+
+		if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] )
+			$strResponse = WP_Http::chunkTransferDecode($strResponse);
+
+		if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($processedHeaders['headers']) )
+			$strResponse = WP_Http_Encoding::decompress( $strResponse );
+
+		return array('headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response'], 'cookies' => $processedHeaders['cookies']);
+	}
+
+	/**
+	 * Whether this class can be used for retrieving an URL.
+	 *
+	 * @since 2.7.0
+	 * @static
+	 * @return boolean False means this class can not be used, true means it can.
+	 */
+	function test($args = array()) {
+		if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) )
+			return false;
+
+		$use = true;
+
+		//PHP does not verify SSL certs, We can only make a request via this transports if SSL Verification is turned off.
+		$is_ssl = isset($args['ssl']) && $args['ssl'];
+		if ( $is_ssl ) {
+			$is_local = isset($args['local']) && $args['local'];
+			$ssl_verify = isset($args['sslverify']) && $args['sslverify'];
+			if ( $is_local && true != apply_filters('https_local_ssl_verify', true) )
+				$use = true;
+			elseif ( !$is_local && true != apply_filters('https_ssl_verify', true) )
+				$use = true;
+			elseif ( !$ssl_verify )
+				$use = true;
+			else
+				$use = false;
+		}
+
+		return apply_filters('use_fopen_transport', $use, $args);
+	}
+}
+
+/**
+ * HTTP request method uses Streams to retrieve the url.
+ *
+ * Requires PHP 5.0+ and uses fopen with stream context. Requires that 'allow_url_fopen' PHP setting
+ * to be enabled.
+ *
+ * Second preferred method for getting the URL, for PHP 5.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7.0
+ */
+class WP_Http_Streams {
+	/**
+	 * Send a HTTP request to a URI using streams with fopen().
+	 *
+	 * @access public
+	 * @since 2.7.0
+	 *
+	 * @param string $url
+	 * @param str|array $args Optional. Override the defaults.
+	 * @return array 'headers', 'body', 'cookies' and 'response' keys.
+	 */
+	function request($url, $args = array()) {
+		$defaults = array(
+			'method' => 'GET', 'timeout' => 5,
+			'redirection' => 5, 'httpversion' => '1.0',
+			'blocking' => true,
+			'headers' => array(), 'body' => null, 'cookies' => array()
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+
+		if ( isset($r['headers']['User-Agent']) ) {
+			$r['user-agent'] = $r['headers']['User-Agent'];
+			unset($r['headers']['User-Agent']);
+		} else if( isset($r['headers']['user-agent']) ) {
+			$r['user-agent'] = $r['headers']['user-agent'];
+			unset($r['headers']['user-agent']);
+		}
+
+		// Construct Cookie: header if any cookies are set
+		WP_Http::buildCookieHeader( $r );
+
+		$arrURL = parse_url($url);
+
+		if ( false === $arrURL )
+			return new WP_Error('http_request_failed', sprintf(__('Malformed URL: %s'), $url));
+
+		if ( 'http' != $arrURL['scheme'] && 'https' != $arrURL['scheme'] )
+			$url = preg_replace('|^' . preg_quote($arrURL['scheme'], '|') . '|', 'http', $url);
+
+		// Convert Header array to string.
+		$strHeaders = '';
+		if ( is_array( $r['headers'] ) )
+			foreach ( $r['headers'] as $name => $value )
+				$strHeaders .= "{$name}: $value\r\n";
+		else if ( is_string( $r['headers'] ) )
+			$strHeaders = $r['headers'];
+
+		$is_local = isset($args['local']) && $args['local'];
+		$ssl_verify = isset($args['sslverify']) && $args['sslverify'];
+		if ( $is_local )
+			$ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify);
+		elseif ( ! $is_local )
+			$ssl_verify = apply_filters('https_ssl_verify', $ssl_verify);
+
+		$arrContext = array('http' =>
+			array(
+				'method' => strtoupper($r['method']),
+				'user_agent' => $r['user-agent'],
+				'max_redirects' => $r['redirection'],
+				'protocol_version' => (float) $r['httpversion'],
+				'header' => $strHeaders,
+				'timeout' => $r['timeout'],
+				'ssl' => array(
+						'verify_peer' => $ssl_verify,
+						'verify_host' => $ssl_verify
+				)
+			)
+		);
+
+		$proxy = new WP_HTTP_Proxy();
+
+		if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
+			$arrContext['http']['proxy'] = 'tcp://' . $proxy->host() . ':' . $proxy->port();
+			$arrContext['http']['request_fulluri'] = true;
+
+			// We only support Basic authentication so this will only work if that is what your proxy supports.
+			if ( $proxy->use_authentication() )
+				$arrContext['http']['header'] .= $proxy->authentication_header() . "\r\n";
+		}
+
+		if ( ! is_null($r['body']) && ! empty($r['body'] ) )
+			$arrContext['http']['content'] = $r['body'];
+
+		$context = stream_context_create($arrContext);
+
+		if ( ! defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) )
+			$handle = @fopen($url, 'r', false, $context);
+		else
+			$handle = fopen($url, 'r', false, $context);
+
+		if ( ! $handle)
+			return new WP_Error('http_request_failed', sprintf(__('Could not open handle for fopen() to %s'), $url));
+
+		// WordPress supports PHP 4.3, which has this function. Removed sanity checking for
+		// performance reasons.
+		stream_set_timeout($handle, $r['timeout'] );
+
+		if ( ! $r['blocking'] ) {
+			stream_set_blocking($handle, 0);
+			fclose($handle);
+			return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
+		}
+
+		$strResponse = stream_get_contents($handle);
+		$meta = stream_get_meta_data($handle);
+
+		fclose($handle);
+
+		$processedHeaders = array();
+		if ( isset( $meta['wrapper_data']['headers'] ) )
+			$processedHeaders = WP_Http::processHeaders($meta['wrapper_data']['headers']);
+		else
+			$processedHeaders = WP_Http::processHeaders($meta['wrapper_data']);
+
+		if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] )
+			$strResponse = WP_Http::chunkTransferDecode($strResponse);
+
+		if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($processedHeaders['headers']) )
+			$strResponse = WP_Http_Encoding::decompress( $strResponse );
+
+		return array('headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response'], 'cookies' => $processedHeaders['cookies']);
+	}
+
+	/**
+	 * Whether this class can be used for retrieving an URL.
+	 *
+	 * @static
+	 * @access public
+	 * @since 2.7.0
+	 *
+	 * @return boolean False means this class can not be used, true means it can.
+	 */
+	function test($args = array()) {
+		if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) )
+			return false;
+
+		if ( version_compare(PHP_VERSION, '5.0', '<') )
+			return false;
+
+		//HTTPS via Proxy was added in 5.1.0
+		$is_ssl = isset($args['ssl']) && $args['ssl'];
+		if ( $is_ssl && version_compare(PHP_VERSION, '5.1.0', '<') ) {
+			$proxy = new WP_HTTP_Proxy();
+			/**
+			 * No URL check, as its not currently passed to the ::test() function
+			 * In the case where a Proxy is in use, Just bypass this transport for HTTPS.
+			 */
+			if ( $proxy->is_enabled() )
+				return false;
+		}
+
+		return apply_filters('use_streams_transport', true, $args);
+	}
+}
+
+/**
+ * HTTP request method uses HTTP extension to retrieve the url.
+ *
+ * Requires the HTTP extension to be installed. This would be the preferred transport since it can
+ * handle a lot of the problems that forces the others to use the HTTP version 1.0. Even if PHP 5.2+
+ * is being used, it doesn't mean that the HTTP extension will be enabled.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7.0
+ */
+class WP_Http_ExtHTTP {
+	/**
+	 * Send a HTTP request to a URI using HTTP extension.
+	 *
+	 * Does not support non-blocking.
+	 *
+	 * @access public
+	 * @since 2.7
+	 *
+	 * @param string $url
+	 * @param str|array $args Optional. Override the defaults.
+	 * @return array 'headers', 'body', 'cookies' and 'response' keys.
+	 */
+	function request($url, $args = array()) {
+		$defaults = array(
+			'method' => 'GET', 'timeout' => 5,
+			'redirection' => 5, 'httpversion' => '1.0',
+			'blocking' => true,
+			'headers' => array(), 'body' => null, 'cookies' => array()
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+
+		if ( isset($r['headers']['User-Agent']) ) {
+			$r['user-agent'] = $r['headers']['User-Agent'];
+			unset($r['headers']['User-Agent']);
+		} else if( isset($r['headers']['user-agent']) ) {
+			$r['user-agent'] = $r['headers']['user-agent'];
+			unset($r['headers']['user-agent']);
+		}
+
+		// Construct Cookie: header if any cookies are set
+		WP_Http::buildCookieHeader( $r );
+
+		switch ( $r['method'] ) {
+			case 'POST':
+				$r['method'] = HTTP_METH_POST;
+				break;
+			case 'HEAD':
+				$r['method'] = HTTP_METH_HEAD;
+				break;
+			case 'GET':
+			default:
+				$r['method'] = HTTP_METH_GET;
+		}
+
+		$arrURL = parse_url($url);
+
+		if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] )
+			$url = preg_replace('|^' . preg_quote($arrURL['scheme'], '|') . '|', 'http', $url);
+
+		$is_local = isset($args['local']) && $args['local'];
+		$ssl_verify = isset($args['sslverify']) && $args['sslverify'];
+		if ( $is_local )
+			$ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify);
+		elseif ( ! $is_local )
+			$ssl_verify = apply_filters('https_ssl_verify', $ssl_verify);
+
+		$options = array(
+			'timeout' => $r['timeout'],
+			'connecttimeout' => $r['timeout'],
+			'redirect' => $r['redirection'],
+			'useragent' => $r['user-agent'],
+			'headers' => $r['headers'],
+			'ssl' => array(
+				'verifypeer' => $ssl_verify,
+				'verifyhost' => $ssl_verify
+			)
+		);
+
+		// The HTTP extensions offers really easy proxy support.
+		$proxy = new WP_HTTP_Proxy();
+
+		if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
+			$options['proxyhost'] = $proxy->host();
+			$options['proxyport'] = $proxy->port();
+			$options['proxytype'] = HTTP_PROXY_HTTP;
+
+			if ( $proxy->use_authentication() ) {
+				$options['proxyauth'] = $proxy->authentication();
+				$options['proxyauthtype'] = HTTP_AUTH_BASIC;
+			}
+		}
+
+		if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) ) //Emits warning level notices for max redirects and timeouts
+			$strResponse = @http_request($r['method'], $url, $r['body'], $options, $info);
+		else
+			$strResponse = http_request($r['method'], $url, $r['body'], $options, $info); //Emits warning level notices for max redirects and timeouts
+
+		// Error may still be set, Response may return headers or partial document, and error
+		// contains a reason the request was aborted, eg, timeout expired or max-redirects reached.
+		if ( false === $strResponse || ! empty($info['error']) )
+			return new WP_Error('http_request_failed', $info['response_code'] . ': ' . $info['error']);
+
+		if ( ! $r['blocking'] )
+			return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
+
+		list($theHeaders, $theBody) = explode("\r\n\r\n", $strResponse, 2);
+		$theHeaders = WP_Http::processHeaders($theHeaders);
+
+		if ( ! empty( $theBody ) && isset( $theHeaders['headers']['transfer-encoding'] ) && 'chunked' == $theHeaders['headers']['transfer-encoding'] ) {
+			if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) )
+				$theBody = @http_chunked_decode($theBody);
+			else
+				$theBody = http_chunked_decode($theBody);
+		}
+
+		if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']) )
+			$theBody = http_inflate( $theBody );
+
+		$theResponse = array();
+		$theResponse['code'] = $info['response_code'];
+		$theResponse['message'] = get_status_header_desc($info['response_code']);
+
+		return array('headers' => $theHeaders['headers'], 'body' => $theBody, 'response' => $theResponse, 'cookies' => $theHeaders['cookies']);
+	}
+
+	/**
+	 * Whether this class can be used for retrieving an URL.
+	 *
+	 * @static
+	 * @since 2.7.0
+	 *
+	 * @return boolean False means this class can not be used, true means it can.
+	 */
+	function test($args = array()) {
+		return apply_filters('use_http_extension_transport', function_exists('http_request'), $args );
+	}
+}
+
+/**
+ * HTTP request method uses Curl extension to retrieve the url.
+ *
+ * Requires the Curl extension to be installed.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7
+ */
+class WP_Http_Curl {
+
+	/**
+	 * Send a HTTP request to a URI using cURL extension.
+	 *
+	 * @access public
+	 * @since 2.7.0
+	 *
+	 * @param string $url
+	 * @param str|array $args Optional. Override the defaults.
+	 * @return array 'headers', 'body', 'cookies' and 'response' keys.
+	 */
+	function request($url, $args = array()) {
+		$defaults = array(
+			'method' => 'GET', 'timeout' => 5,
+			'redirection' => 5, 'httpversion' => '1.0',
+			'blocking' => true,
+			'headers' => array(), 'body' => null, 'cookies' => array()
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+
+		if ( isset($r['headers']['User-Agent']) ) {
+			$r['user-agent'] = $r['headers']['User-Agent'];
+			unset($r['headers']['User-Agent']);
+		} else if( isset($r['headers']['user-agent']) ) {
+			$r['user-agent'] = $r['headers']['user-agent'];
+			unset($r['headers']['user-agent']);
+		}
+
+		// Construct Cookie: header if any cookies are set.
+		WP_Http::buildCookieHeader( $r );
+
+		// cURL extension will sometimes fail when the timeout is less than 1 as it may round down
+		// to 0, which gives it unlimited timeout.
+		if ( $r['timeout'] > 0 && $r['timeout'] < 1 )
+			$r['timeout'] = 1;
+
+		$handle = curl_init();
+
+		// cURL offers really easy proxy support.
+		$proxy = new WP_HTTP_Proxy();
+
+		if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
+
+			$isPHP5 = version_compare(PHP_VERSION, '5.0.0', '>=');
+
+			if ( $isPHP5 ) {
+				curl_setopt( $handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP );
+				curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() );
+				curl_setopt( $handle, CURLOPT_PROXYPORT, $proxy->port() );
+			} else {
+				curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() .':'. $proxy->port() );
+			}
+
+			if ( $proxy->use_authentication() ) {
+				if ( $isPHP5 )
+					curl_setopt( $handle, CURLOPT_PROXYAUTH, CURLAUTH_BASIC );
+
+				curl_setopt( $handle, CURLOPT_PROXYUSERPWD, $proxy->authentication() );
+			}
+		}
+
+		$is_local = isset($args['local']) && $args['local'];
+		$ssl_verify = isset($args['sslverify']) && $args['sslverify'];
+		if ( $is_local )
+			$ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify);
+		elseif ( ! $is_local )
+			$ssl_verify = apply_filters('https_ssl_verify', $ssl_verify);
+
+		curl_setopt( $handle, CURLOPT_URL, $url);
+		curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true );
+		curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, $ssl_verify );
+		curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify );
+		curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] );
+		curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $r['timeout'] );
+		curl_setopt( $handle, CURLOPT_TIMEOUT, $r['timeout'] );
+		curl_setopt( $handle, CURLOPT_MAXREDIRS, $r['redirection'] );
+
+		switch ( $r['method'] ) {
+			case 'HEAD':
+				curl_setopt( $handle, CURLOPT_NOBODY, true );
+				break;
+			case 'POST':
+				curl_setopt( $handle, CURLOPT_POST, true );
+				curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] );
+				break;
+		}
+
+		if ( true === $r['blocking'] )
+			curl_setopt( $handle, CURLOPT_HEADER, true );
+		else
+			curl_setopt( $handle, CURLOPT_HEADER, false );
+
+		// The option doesn't work with safe mode or when open_basedir is set.
+		if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
+			curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, true );
+
+		if ( !empty( $r['headers'] ) ) {
+			// cURL expects full header strings in each element
+			$headers = array();
+			foreach ( $r['headers'] as $name => $value ) {
+				$headers[] = "{$name}: $value";
+			}
+			curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers );
+		}
+
+		if ( $r['httpversion'] == '1.0' )
+			curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
+		else
+			curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
+
+		// Cookies are not handled by the HTTP API currently. Allow for plugin authors to handle it
+		// themselves... Although, it is somewhat pointless without some reference.
+		do_action_ref_array( 'http_api_curl', array(&$handle) );
+
+		// We don't need to return the body, so don't. Just execute request and return.
+		if ( ! $r['blocking'] ) {
+			curl_exec( $handle );
+			curl_close( $handle );
+			return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
+		}
+
+		$theResponse = curl_exec( $handle );
+
+		if ( !empty($theResponse) ) {
+			$parts = explode("\r\n\r\n", $theResponse);
+
+			$headerLength = curl_getinfo($handle, CURLINFO_HEADER_SIZE);
+			$theHeaders = trim( substr($theResponse, 0, $headerLength) );
+			$theBody = substr( $theResponse, $headerLength );
+			if ( false !== strrpos($theHeaders, "\r\n\r\n") ) {
+				$headerParts = explode("\r\n\r\n", $theHeaders);
+				$theHeaders = $headerParts[ count($headerParts) -1 ];
+			}
+			$theHeaders = WP_Http::processHeaders($theHeaders);
+		} else {
+			if ( $curl_error = curl_error($handle) )
+				return new WP_Error('http_request_failed', $curl_error);
+			if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array(301, 302) ) )
+				return new WP_Error('http_request_failed', __('Too many redirects.'));
+
+			$theHeaders = array( 'headers' => array(), 'cookies' => array() );
+			$theBody = '';
+		}
+
+		$response = array();
+		$response['code'] = curl_getinfo( $handle, CURLINFO_HTTP_CODE );
+		$response['message'] = get_status_header_desc($response['code']);
+
+		curl_close( $handle );
+
+		if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']) )
+			$theBody = WP_Http_Encoding::decompress( $theBody );
+
+		return array('headers' => $theHeaders['headers'], 'body' => $theBody, 'response' => $response, 'cookies' => $theHeaders['cookies']);
+	}
+
+	/**
+	 * Whether this class can be used for retrieving an URL.
+	 *
+	 * @static
+	 * @since 2.7.0
+	 *
+	 * @return boolean False means this class can not be used, true means it can.
+	 */
+	function test($args = array()) {
+		if ( function_exists('curl_init') && function_exists('curl_exec') )
+			return apply_filters('use_curl_transport', true, $args);
+
+		return false;
+	}
+}
+
+/**
+ * Adds Proxy support to the WordPress HTTP API.
+ *
+ * There are caveats to proxy support. It requires that defines be made in the wp-config.php file to
+ * enable proxy support. There are also a few filters that plugins can hook into for some of the
+ * constants.
+ *
+ * The constants are as follows:
+ * <ol>
+ * <li>WP_PROXY_HOST - Enable proxy support and host for connecting.</li>
+ * <li>WP_PROXY_PORT - Proxy port for connection. No default, must be defined.</li>
+ * <li>WP_PROXY_USERNAME - Proxy username, if it requires authentication.</li>
+ * <li>WP_PROXY_PASSWORD - Proxy password, if it requires authentication.</li>
+ * <li>WP_PROXY_BYPASS_HOSTS - Will prevent the hosts in this list from going through the proxy.
+ * You do not need to have localhost and the blog host in this list, because they will not be passed
+ * through the proxy. The list should be presented in a comma separated list</li>
+ * </ol>
+ *
+ * An example can be as seen below.
+ * <code>
+ * define('WP_PROXY_HOST', '192.168.84.101');
+ * define('WP_PROXY_PORT', '8080');
+ * define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com');
+ * </code>
+ *
+ * @link http://core.trac.wordpress.org/ticket/4011 Proxy support ticket in WordPress.
+ * @since 2.8
+ */
+class WP_HTTP_Proxy {
+
+	/**
+	 * Whether proxy connection should be used.
+	 *
+	 * @since 2.8
+	 * @use WP_PROXY_HOST
+	 * @use WP_PROXY_PORT
+	 *
+	 * @return bool
+	 */
+	function is_enabled() {
+		return defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT');
+	}
+
+	/**
+	 * Whether authentication should be used.
+	 *
+	 * @since 2.8
+	 * @use WP_PROXY_USERNAME
+	 * @use WP_PROXY_PASSWORD
+	 *
+	 * @return bool
+	 */
+	function use_authentication() {
+		return defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD');
+	}
+
+	/**
+	 * Retrieve the host for the proxy server.
+	 *
+	 * @since 2.8
+	 *
+	 * @return string
+	 */
+	function host() {
+		if ( defined('WP_PROXY_HOST') )
+			return WP_PROXY_HOST;
+
+		return '';
+	}
+
+	/**
+	 * Retrieve the port for the proxy server.
+	 *
+	 * @since 2.8
+	 *
+	 * @return string
+	 */
+	function port() {
+		if ( defined('WP_PROXY_PORT') )
+			return WP_PROXY_PORT;
+
+		return '';
+	}
+
+	/**
+	 * Retrieve the username for proxy authentication.
+	 *
+	 * @since 2.8
+	 *
+	 * @return string
+	 */
+	function username() {
+		if ( defined('WP_PROXY_USERNAME') )
+			return WP_PROXY_USERNAME;
+
+		return '';
+	}
+
+	/**
+	 * Retrieve the password for proxy authentication.
+	 *
+	 * @since 2.8
+	 *
+	 * @return string
+	 */
+	function password() {
+		if ( defined('WP_PROXY_PASSWORD') )
+			return WP_PROXY_PASSWORD;
+
+		return '';
+	}
+
+	/**
+	 * Retrieve authentication string for proxy authentication.
+	 *
+	 * @since 2.8
+	 *
+	 * @return string
+	 */
+	function authentication() {
+		return $this->username() . ':' . $this->password();
+	}
+
+	/**
+	 * Retrieve header string for proxy authentication.
+	 *
+	 * @since 2.8
+	 *
+	 * @return string
+	 */
+	function authentication_header() {
+		return 'Proxy-Authentication: Basic ' . base64_encode( $this->authentication() );
+	}
+
+	/**
+	 * Whether URL should be sent through the proxy server.
+	 *
+	 * We want to keep localhost and the blog URL from being sent through the proxy server, because
+	 * some proxies can not handle this. We also have the constant available for defining other
+	 * hosts that won't be sent through the proxy.
+	 *
+	 * @uses WP_PROXY_BYPASS_HOSTS
+	 * @since unknown
+	 *
+	 * @param string $uri URI to check.
+	 * @return bool True, to send through the proxy and false if, the proxy should not be used.
+	 */
+	function send_through_proxy( $uri ) {
+		// parse_url() only handles http, https type URLs, and will emit E_WARNING on failure.
+		// This will be displayed on blogs, which is not reasonable.
+		$check = @parse_url($uri);
+
+		// Malformed URL, can not process, but this could mean ssl, so let through anyway.
+		if ( $check === false )
+			return true;
+
+		$home = parse_url( backpress_get_option( 'application_uri' ) );
+
+		if ( $check['host'] == 'localhost' || $check['host'] == $home['host'] )
+			return false;
+
+		if ( !defined('WP_PROXY_BYPASS_HOSTS') )
+			return true;
+
+		static $bypass_hosts;
+		if ( null == $bypass_hosts )
+			$bypass_hosts = preg_split('|,\s*|', WP_PROXY_BYPASS_HOSTS);
+
+		return !in_array( $check['host'], $bypass_hosts );
+	}
+}
+/**
+ * Internal representation of a single cookie.
+ *
+ * Returned cookies are represented using this class, and when cookies are set, if they are not
+ * already a WP_Http_Cookie() object, then they are turned into one.
+ *
+ * @todo The WordPress convention is to use underscores instead of camelCase for function and method
+ * names. Need to switch to use underscores instead for the methods.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.8.0
+ * @author Beau Lebens
+ */
+class WP_Http_Cookie {
+
+	/**
+	 * Cookie name.
+	 *
+	 * @since 2.8.0
+	 * @var string
+	 */
+	var $name;
+
+	/**
+	 * Cookie value.
+	 *
+	 * @since 2.8.0
+	 * @var string
+	 */
+	var $value;
+
+	/**
+	 * When the cookie expires.
+	 *
+	 * @since 2.8.0
+	 * @var string
+	 */
+	var $expires;
+
+	/**
+	 * Cookie URL path.
+	 *
+	 * @since 2.8.0
+	 * @var string
+	 */
+	var $path;
+
+	/**
+	 * Cookie Domain.
+	 *
+	 * @since 2.8.0
+	 * @var string
+	 */
+	var $domain;
+
+	/**
+	 * PHP4 style Constructor - Calls PHP5 Style Constructor.
+	 *
+	 * @access public
+	 * @since 2.8.0
+	 * @param string|array $data Raw cookie data.
+	 */
+	function WP_Http_Cookie( $data ) {
+		$this->__construct( $data );
+	}
+
+	/**
+	 * Sets up this cookie object.
+	 *
+	 * The parameter $data should be either an associative array containing the indices names below
+	 * or a header string detailing it.
+	 *
+	 * If it's an array, it should include the following elements:
+	 * <ol>
+	 * <li>Name</li>
+	 * <li>Value - should NOT be urlencoded already.</li>
+	 * <li>Expires - (optional) String or int (UNIX timestamp).</li>
+	 * <li>Path (optional)</li>
+	 * <li>Domain (optional)</li>
+	 * </ol>
+	 *
+	 * @access public
+	 * @since 2.8.0
+	 *
+	 * @param string|array $data Raw cookie data.
+	 */
+	function __construct( $data ) {
+		if ( is_string( $data ) ) {
+			// Assume it's a header string direct from a previous request
+			$pairs = explode( ';', $data );
+
+			// Special handling for first pair; name=value. Also be careful of "=" in value
+			$name  = trim( substr( $pairs[0], 0, strpos( $pairs[0], '=' ) ) );
+			$value = substr( $pairs[0], strpos( $pairs[0], '=' ) + 1 );
+			$this->name  = $name;
+			$this->value = urldecode( $value );
+			array_shift( $pairs ); //Removes name=value from items.
+
+			// Set everything else as a property
+			foreach ( $pairs as $pair ) {
+				if ( empty($pair) ) //Handles the cookie ending in ; which results in a empty final pair
+					continue;
+
+				list( $key, $val ) = explode( '=', $pair );
+				$key = strtolower( trim( $key ) );
+				if ( 'expires' == $key )
+					$val = strtotime( $val );
+				$this->$key = $val;
+			}
+		} else {
+			if ( !isset( $data['name'] ) )
+				return false;
+
+			// Set properties based directly on parameters
+			$this->name   = $data['name'];
+			$this->value  = isset( $data['value'] ) ? $data['value'] : '';
+			$this->path   = isset( $data['path'] ) ? $data['path'] : '';
+			$this->domain = isset( $data['domain'] ) ? $data['domain'] : '';
+
+			if ( isset( $data['expires'] ) )
+				$this->expires = is_int( $data['expires'] ) ? $data['expires'] : strtotime( $data['expires'] );
+			else
+				$this->expires = null;
+		}
+	}
+
+	/**
+	 * Confirms that it's OK to send this cookie to the URL checked against.
+	 *
+	 * Decision is based on RFC 2109/2965, so look there for details on validity.
+	 *
+	 * @access public
+	 * @since 2.8.0
+	 *
+	 * @param string $url URL you intend to send this cookie to
+	 * @return boolean TRUE if allowed, FALSE otherwise.
+	 */
+	function test( $url ) {
+		// Expires - if expired then nothing else matters
+		if ( time() > $this->expires )
+			return false;
+
+		// Get details on the URL we're thinking about sending to
+		$url = parse_url( $url );
+		$url['port'] = isset( $url['port'] ) ? $url['port'] : 80;
+		$url['path'] = isset( $url['path'] ) ? $url['path'] : '/';
+
+		// Values to use for comparison against the URL
+		$path   = isset( $this->path )   ? $this->path   : '/';
+		$port   = isset( $this->port )   ? $this->port   : 80;
+		$domain = isset( $this->domain ) ? strtolower( $this->domain ) : strtolower( $url['host'] );
+		if ( false === stripos( $domain, '.' ) )
+			$domain .= '.local';
+
+		// Host - very basic check that the request URL ends with the domain restriction (minus leading dot)
+		$domain = substr( $domain, 0, 1 ) == '.' ? substr( $domain, 1 ) : $domain;
+		if ( substr( $url['host'], -strlen( $domain ) ) != $domain )
+			return false;
+
+		// Port - supports "port-lists" in the format: "80,8000,8080"
+		if ( !in_array( $url['port'], explode( ',', $port) ) )
+			return false;
+
+		// Path - request path must start with path restriction
+		if ( substr( $url['path'], 0, strlen( $path ) ) != $path )
+			return false;
+
+		return true;
+	}
+
+	/**
+	 * Convert cookie name and value back to header string.
+	 *
+	 * @access public
+	 * @since 2.8.0
+	 *
+	 * @return string Header encoded cookie name and value.
+	 */
+	function getHeaderValue() {
+		if ( empty( $this->name ) || empty( $this->value ) )
+			return '';
+
+		return $this->name . '=' . urlencode( $this->value );
+	}
+
+	/**
+	 * Retrieve cookie header for usage in the rest of the WordPress HTTP API.
+	 *
+	 * @access public
+	 * @since 2.8.0
+	 *
+	 * @return string
+	 */
+	function getFullHeader() {
+		return 'Cookie: ' . $this->getHeaderValue();
+	}
+}
+
+/**
+ * Implementation for deflate and gzip transfer encodings.
+ *
+ * Includes RFC 1950, RFC 1951, and RFC 1952.
+ *
+ * @since 2.8
+ * @package WordPress
+ * @subpackage HTTP
+ */
+class WP_Http_Encoding {
+
+	/**
+	 * Compress raw string using the deflate format.
+	 *
+	 * Supports the RFC 1951 standard.
+	 *
+	 * @since 2.8
+	 *
+	 * @param string $raw String to compress.
+	 * @param int $level Optional, default is 9. Compression level, 9 is highest.
+	 * @param string $supports Optional, not used. When implemented it will choose the right compression based on what the server supports.
+	 * @return string|bool False on failure.
+	 */
+	function compress( $raw, $level = 9, $supports = null ) {
+		return gzdeflate( $raw, $level );
+	}
+
+	/**
+	 * Decompression of deflated string.
+	 *
+	 * Will attempt to decompress using the RFC 1950 standard, and if that fails
+	 * then the RFC 1951 standard deflate will be attempted. Finally, the RFC
+	 * 1952 standard gzip decode will be attempted. If all fail, then the
+	 * original compressed string will be returned.
+	 *
+	 * @since 2.8
+	 *
+	 * @param string $compressed String to decompress.
+	 * @param int $length The optional length of the compressed data.
+	 * @return string|bool False on failure.
+	 */
+	function decompress( $compressed, $length = null ) {
+		$decompressed = gzinflate( $compressed );
+
+		if ( false !== $decompressed )
+			return $decompressed;
+
+		$decompressed = gzuncompress( $compressed );
+
+		if ( false !== $decompressed )
+			return $decompressed;
+
+		if ( function_exists('gzdecode') ) {
+			$decompressed = gzdecode( $compressed );
+
+			if ( false !== $decompressed )
+				return $decompressed;
+		}
+
+		return $compressed;
+	}
+
+	/**
+	 * What encoding types to accept and their priority values.
+	 *
+	 * @since 2.8
+	 *
+	 * @return string Types of encoding to accept.
+	 */
+	function accept_encoding() {
+		$type = array();
+		if ( function_exists( 'gzinflate' ) )
+			$type[] = 'deflate;q=1.0';
+
+		if ( function_exists( 'gzuncompress' ) )
+			$type[] = 'compress;q=0.5';
+
+		if ( function_exists( 'gzdecode' ) )
+			$type[] = 'gzip;q=0.5';
+
+		return implode(', ', $type);
+	}
+
+	/**
+	 * What enconding the content used when it was compressed to send in the headers.
+	 *
+	 * @since 2.8
+	 *
+	 * @return string Content-Encoding string to send in the header.
+	 */
+	function content_encoding() {
+		return 'deflate';
+	}
+
+	/**
+	 * Whether the content be decoded based on the headers.
+	 *
+	 * @since 2.8
+	 *
+	 * @param array|string $headers All of the available headers.
+	 * @return bool
+	 */
+	function should_decode($headers) {
+		if ( is_array( $headers ) ) {
+			if ( array_key_exists('content-encoding', $headers) && ! empty( $headers['content-encoding'] ) )
+				return true;
+		} else if( is_string( $headers ) ) {
+			return ( stripos($headers, 'content-encoding:') !== false );
+		}
+
+		return false;
+	}
+
+	/**
+	 * Whether decompression and compression are supported by the PHP version.
+	 *
+	 * Each function is tested instead of checking for the zlib extension, to
+	 * ensure that the functions all exist in the PHP version and aren't
+	 * disabled.
+	 *
+	 * @since 2.8
+	 *
+	 * @return bool
+	 */
+	function is_available() {
+		return ( function_exists('gzuncompress') || function_exists('gzdeflate') || function_exists('gzinflate') );
+	}
+}
+
+/**
+ * Returns the initialized WP_Http Object
+ *
+ * @since 2.7.0
+ * @access private
+ *
+ * @return WP_Http HTTP Transport object.
+ */
+function &_wp_http_get_object() {
+	static $http;
+
+	if ( is_null($http) )
+		$http = new WP_Http();
+
+	return $http;
+}
+
+/**
+ * Retrieve the raw response from the HTTP request.
+ *
+ * The array structure is a little complex.
+ *
+ * <code>
+ * $res = array( 'headers' => array(), 'response' => array('code' => int, 'message' => string) );
+ * </code>
+ *
+ * All of the headers in $res['headers'] are with the name as the key and the
+ * value as the value. So to get the User-Agent, you would do the following.
+ *
+ * <code>
+ * $user_agent = $res['headers']['user-agent'];
+ * </code>
+ *
+ * The body is the raw response content and can be retrieved from $res['body'].
+ *
+ * This function is called first to make the request and there are other API
+ * functions to abstract out the above convoluted setup.
+ *
+ * @since 2.7.0
+ *
+ * @param string $url Site URL to retrieve.
+ * @param array $args Optional. Override the defaults.
+ * @return WP_Error|array The response or WP_Error on failure.
+ */
+function wp_remote_request($url, $args = array()) {
+	$objFetchSite = _wp_http_get_object();
+	return $objFetchSite->request($url, $args);
+}
+
+/**
+ * Retrieve the raw response from the HTTP request using the GET method.
+ *
+ * @see wp_remote_request() For more information on the response array format.
+ *
+ * @since 2.7.0
+ *
+ * @param string $url Site URL to retrieve.
+ * @param array $args Optional. Override the defaults.
+ * @return WP_Error|array The response or WP_Error on failure.
+ */
+function wp_remote_get($url, $args = array()) {
+	$objFetchSite = _wp_http_get_object();
+	return $objFetchSite->get($url, $args);
+}
+
+/**
+ * Retrieve the raw response from the HTTP request using the POST method.
+ *
+ * @see wp_remote_request() For more information on the response array format.
+ *
+ * @since 2.7.0
+ *
+ * @param string $url Site URL to retrieve.
+ * @param array $args Optional. Override the defaults.
+ * @return WP_Error|array The response or WP_Error on failure.
+ */
+function wp_remote_post($url, $args = array()) {
+	$objFetchSite = _wp_http_get_object();
+	return $objFetchSite->post($url, $args);
+}
+
+/**
+ * Retrieve the raw response from the HTTP request using the HEAD method.
+ *
+ * @see wp_remote_request() For more information on the response array format.
+ *
+ * @since 2.7.0
+ *
+ * @param string $url Site URL to retrieve.
+ * @param array $args Optional. Override the defaults.
+ * @return WP_Error|array The response or WP_Error on failure.
+ */
+function wp_remote_head($url, $args = array()) {
+	$objFetchSite = _wp_http_get_object();
+	return $objFetchSite->head($url, $args);
+}
+
+/**
+ * Retrieve only the headers from the raw response.
+ *
+ * @since 2.7.0
+ *
+ * @param array $response HTTP response.
+ * @return array The headers of the response. Empty array if incorrect parameter given.
+ */
+function wp_remote_retrieve_headers(&$response) {
+	if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers']))
+		return array();
+
+	return $response['headers'];
+}
+
+/**
+ * Retrieve a single header by name from the raw response.
+ *
+ * @since 2.7.0
+ *
+ * @param array $response
+ * @param string $header Header name to retrieve value from.
+ * @return string The header value. Empty string on if incorrect parameter given, or if the header doesnt exist.
+ */
+function wp_remote_retrieve_header(&$response, $header) {
+	if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers']))
+		return '';
+
+	if ( array_key_exists($header, $response['headers']) )
+		return $response['headers'][$header];
+
+	return '';
+}
+
+/**
+ * Retrieve only the response code from the raw response.
+ *
+ * Will return an empty array if incorrect parameter value is given.
+ *
+ * @since 2.7.0
+ *
+ * @param array $response HTTP response.
+ * @return string the response code. Empty string on incorrect parameter given.
+ */
+function wp_remote_retrieve_response_code(&$response) {
+	if ( is_wp_error($response) || ! isset($response['response']) || ! is_array($response['response']))
+		return '';
+
+	return $response['response']['code'];
+}
+
+/**
+ * Retrieve only the response message from the raw response.
+ *
+ * Will return an empty array if incorrect parameter value is given.
+ *
+ * @since 2.7.0
+ *
+ * @param array $response HTTP response.
+ * @return string The response message. Empty string on incorrect parameter given.
+ */
+function wp_remote_retrieve_response_message(&$response) {
+	if ( is_wp_error($response) || ! isset($response['response']) || ! is_array($response['response']))
+		return '';
+
+	return $response['response']['message'];
+}
+
+/**
+ * Retrieve only the body from the raw response.
+ *
+ * @since 2.7.0
+ *
+ * @param array $response HTTP response.
+ * @return string The body of the response. Empty string if no body or incorrect parameter given.
+ */
+function wp_remote_retrieve_body(&$response) {
+	if ( is_wp_error($response) || ! isset($response['body']) )
+		return '';
+
+	return $response['body'];
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-object-cache-memcached.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-object-cache-memcached.php
new file mode 100644
index 0000000000000000000000000000000000000000..0a1961178271b1d1cd966f3ca9be4143d626d653
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-object-cache-memcached.php
@@ -0,0 +1,463 @@
+<?php
+
+class WP_Object_Cache
+{
+	// WordPress would need to be initialised with this:
+	// wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss' ) );
+	var $global_groups = array (
+		'_cache_keys'
+	);
+
+	// WordPress would need to be initialised with this:
+	// wp_cache_add_non_persistent_groups( array( 'comment', 'counts' ) );
+	var $no_mc_groups = array();
+
+	var $cache = array();
+	var $mc = array();
+	var $stats = array();
+	var $group_ops = array();
+
+	var $default_expiration = 0;
+
+	function WP_Object_Cache()
+	{
+		global $memcached_servers;
+
+		if ( isset( $memcached_servers ) ) {
+			$buckets = $memcached_servers;
+		} else {
+			$buckets = array('default' => array('127.0.0.1:11211'));
+		}
+
+		foreach ( $buckets as $bucket => $servers ) {
+			$this->mc[$bucket] = new Memcache();
+			foreach ( $servers as $server ) {
+				list ( $node, $port ) = explode( ':', $server );
+				$this->mc[$bucket]->addServer( $node, $port, true, 1, 1, 15, true, array( $this, 'failure_callback' ) );
+				$this->mc[$bucket]->setCompressThreshold( 20000, 0.2 );
+			}
+		}
+	}
+
+	function &get_mc( $group )
+	{
+		if ( isset( $this->mc[$group] ) ) {
+			return $this->mc[$group];
+		}
+		return $this->mc['default'];
+	}
+
+	function failure_callback( $host, $port )
+	{
+		//error_log( "Connection failure for $host:$port\n", 3, '/tmp/memcached.txt' );
+	}
+
+	function close()
+	{
+		foreach ( $this->mc as $bucket => $mc ) {
+			$mc->close();
+		}
+	}
+
+	function add_global_groups( $groups )
+	{
+		if ( !is_array( $groups ) ) {
+			$groups = (array) $groups;
+		}
+
+		$this->global_groups = array_merge( $this->global_groups, $groups );
+		$this->global_groups = array_unique( $this->global_groups );
+	}
+
+	function add_non_persistent_groups( $groups )
+	{
+		if ( !is_array( $groups ) ) {
+			$groups = (array) $groups;
+		}
+
+		$this->no_mc_groups = array_merge( $this->no_mc_groups, $groups );
+		$this->no_mc_groups = array_unique( $this->no_mc_groups );
+	}
+
+	function key( $key, $group )
+	{
+		if ( empty( $group ) ) {
+			$group = 'default';
+		}
+
+		if ( false !== array_search( $group, $this->global_groups ) ) {
+			$prefix = '';
+		} else {
+			$prefix = backpress_get_option( 'application_id' ) . ':';
+		}
+
+		return preg_replace( '/\s+/', '', $prefix . $group . ':' . $key );
+	}
+
+	function get( $id, $group = 'default' )
+	{
+		$key = $this->key( $id, $group );
+		$mc =& $this->get_mc( $group );
+
+		if ( isset( $this->cache[$key] ) ) {
+			$value = $this->cache[$key];
+		} elseif ( in_array( $group, $this->no_mc_groups ) ) {
+			$value = false;
+		} else {
+			$value = $mc->get($key);
+		}
+
+		@ ++$this->stats['get'];
+		$this->group_ops[$group][] = "get $id";
+
+		if ( NULL === $value ) {
+			$value = false;
+		}
+
+		$this->cache[$key] = $value;
+
+		if ( 'checkthedatabaseplease' == $value ) {
+			$value = false;
+		}
+
+		return $value;
+	}
+
+	/*
+	format: $get['group-name'] = array( 'key1', 'key2' );
+	*/
+	function get_multi( $groups )
+	{
+		$return = array();
+		foreach ( $groups as $group => $ids ) {
+			$mc =& $this->get_mc( $group );
+			foreach ( $ids as $id ) {
+				$key = $this->key( $id, $group );
+				if ( isset( $this->cache[$key] ) ) {
+					$return[$key] = $this->cache[$key];
+					continue;
+				} elseif ( in_array( $group, $this->no_mc_groups ) ) {
+					$return[$key] = false;
+					continue;
+				} else {
+					$return[$key] = $mc->get( $key );
+				}
+			}
+			if ( $to_get ) {
+				$vals = $mc->get_multi( $to_get );
+				$return = array_merge( $return, $vals );
+			}
+		}
+
+		@ ++$this->stats['get_multi'];
+		$this->group_ops[$group][] = "get_multi $id";
+
+		$this->cache = array_merge( $this->cache, $return );
+
+		return $return;
+	}
+
+	function add( $id, $data, $group = 'default', $expire = 0 )
+	{
+		$key = $this->key( $id, $group );
+
+		if ( in_array( $group, $this->no_mc_groups ) ) {
+			$this->cache[$key] = $data;
+			return true;
+		}
+
+		$mc =& $this->get_mc( $group );
+		$expire = ( $expire == 0 ) ? $this->default_expiration : $expire;
+		$result = $mc->add( $key, $data, false, $expire );
+
+		@ ++$this->stats['add'];
+		$this->group_ops[$group][] = "add $id";
+
+		if ( false !== $result ) {
+			$this->cache[$key] = $data;
+			$this->add_key_to_group_keys_cache( $key, $group );
+		}
+
+		return $result;
+	}
+
+	function set( $id, $data, $group = 'default', $expire = 0 )
+	{
+		$key = $this->key($id, $group);
+
+		if ( isset( $this->cache[$key] ) && 'checkthedatabaseplease' == $this->cache[$key] ) {
+			return false;
+		}
+		$this->cache[$key] = $data;
+
+		if ( in_array( $group, $this->no_mc_groups ) ) {
+			return true;
+		}
+
+		$expire = ( $expire == 0 ) ? $this->default_expiration : $expire;
+		$mc =& $this->get_mc( $group );
+		$result = $mc->set( $key, $data, false, $expire );
+
+		if ( false !== $result ) {
+			$this->add_key_to_group_keys_cache($key, $group);
+		}
+
+		return $result;
+	}
+
+	function replace($id, $data, $group = 'default', $expire = 0) {
+		$key = $this->key($id, $group);
+		$expire = ($expire == 0) ? $this->default_expiration : $expire;
+		$mc =& $this->get_mc($group);
+		$result = $mc->replace($key, $data, false, $expire);
+		if ( false !== $result ) {
+			$this->cache[$key] = $data;
+			$this->add_key_to_group_keys_cache( $key, $group );
+		}
+		return $result;
+	}
+
+	function delete( $id, $group = 'default' )
+	{
+		$key = $this->key( $id, $group );
+
+		if ( in_array( $group, $this->no_mc_groups ) ) {
+			unset( $this->cache[$key] );
+			return true;
+		}
+
+		$mc =& $this->get_mc( $group );
+
+		$result = $mc->delete( $key );
+
+		@ ++$this->stats['delete'];
+		$this->group_ops[$group][] = "delete $id";
+
+		if ( false !== $result ) {
+			unset( $this->cache[$key] );
+			$this->remove_key_from_group_keys_cache( $key, $group );
+		}
+
+		return $result; 
+	}
+
+	function flush( $group = null )
+	{
+		// Get all the group keys
+		if ( !$_groups = $this->get( 1, '_group_keys' ) ) {
+			return true;
+		}
+
+		if ( !is_array( $_groups ) || !count( $_groups ) ) {
+			return $this->delete( 1, '_group_keys' );
+		}
+
+		if ( is_null( $group ) ) {
+			$results = array();
+			foreach ( $_groups as $_group => $_keys ) {
+				$results[] = $this->delete_all_keys_in_group_key_cache( $_group );
+			}
+			if ( in_array( false, $results ) ) {
+				return false;
+			}
+			return true;
+		}
+
+		return $this->delete_all_keys_in_group_key_cache( $group );
+	}
+
+	// Update the cache of group keys or add a new cache if it isn't there
+	function add_key_to_group_keys_cache( $key, $group )
+	{
+		if ( '_group_keys' === $group ) {
+			return;
+		}
+
+		//error_log( 'Adding key ' . $key . ' to group ' . $group );
+
+		// Get all the group keys
+		if ( !$_groups = $this->get( 1, '_group_keys' ) ) {
+			$_groups = array( $group => array( $key ) );
+			return $this->add( 1, $_groups, '_group_keys' );
+		}
+
+		// Don't blow up if it isn't an array
+		if ( !is_array( $_groups ) ) {
+			$_groups = array();
+		}
+
+		// If this group isn't in there, then insert it
+		if ( !isset( $_groups[$group] ) || !is_array( $_groups[$group] ) ) {
+			$_groups[$group] = array();
+		}
+
+		// If it's already there then do nothing
+		if ( in_array( $key, $_groups[$group] ) ) {
+			return true;
+		}
+
+		$_groups[$group][] = $key;
+
+		// Remove duplicates
+		$_groups[$group] = array_unique( $_groups[$group] );
+
+		return $this->replace( 1, $_groups, '_group_keys' );
+	}
+
+	// Remove the key from the cache of group keys, delete the cache if it is emptied
+	function remove_key_from_group_keys_cache( $key, $group )
+	{
+		if ( '_group_keys' === $group ) {
+			return;
+		}
+
+		//error_log( 'Removing key ' . $key . ' from group ' . $group );
+
+		// Get all the group keys
+		if ( !$_groups = $this->get( 1, '_group_keys' ) ) {
+			return true;
+		}
+
+		// If group keys are somehow borked delete it all
+		if ( !is_array( $_groups ) ) {
+			return $this->delete( 1, '_group_keys' );
+		}
+
+		// If it's not there, we're good
+		if (
+			!isset( $_groups[$group] ) ||
+			!is_array( $_groups[$group] ) ||
+			!in_array( $key, $_groups[$group] )
+		) {
+			return true;
+		}
+
+		// Remove duplicates
+		$_groups[$group] = array_unique( $_groups[$group] );
+
+		// If there is only one key or no keys in the group then delete the group
+		if ( 2 > count( $_groups[$group] ) ) {
+			unset( $_groups[$group] );
+			return $this->replace( 1, $_groups, '_group_keys' );
+		}
+
+		// array_unique() made sure there is only one
+		if ( $_key = array_search( $key, $_groups[$group] ) ) {
+			unset( $_groups[$group][$_key] );
+		}
+
+		return $this->replace( 1, $_groups, '_group_keys' );
+	}
+
+	function delete_all_keys_in_group_key_cache( $group )
+	{
+		if ( '_group_keys' === $group ) {
+			return;
+		}
+
+		//error_log( 'Deleting all keys in group ' . $group );
+
+		// Get all the group keys
+		if ( !$_groups = $this->get( 1, '_group_keys' ) ) {
+			//error_log( '--> !!!! No groups' );
+			return true;
+		}
+
+		// Check that what we want to loop over is there
+		if ( !is_array( $_groups ) ) {
+			//error_log( '--> !!!! Groups is not an array, delete whole key' );
+			return $this->delete( 1, '_group_keys' );
+		}
+
+		// Check that what we want to loop over is there
+		if (
+			!isset( $_groups[$group] ) ||
+			!is_array( $_groups[$group] )
+		) {
+			//error_log( '--> !!!! No specific group' );
+			return true;
+		}
+
+		$_groups[$group] = array_unique( $_groups[$group] );
+
+		$_remaining_keys = array();
+		$mc =& $this->get_mc($group);
+		foreach ( $_groups[$group] as $_key ) {
+			//error_log( '--> Deleting key ' . $_key );
+			if ( false !== $mc->delete( $_key ) ) {
+				//error_log( '--> Deleted key ' . $_key );
+				unset( $this->cache[$_key] );
+			}
+		}
+
+		unset( $_groups[$group] );
+		if ( count( $_groups ) ) {
+			//error_log( '--> Remove single group' );
+			return $this->replace( 1, $_groups, '_group_keys' );
+		}
+
+		//error_log( '--> No groups left, delete whole key' );
+		return $this->delete( 1, '_group_keys' );
+	}
+
+	function incr( $id, $n, $group )
+	{
+		$key = $this->key( $id, $group );
+		$mc =& $this->get_mc( $group );
+
+		return $mc->increment( $key, $n );
+	}
+
+	function decr( $id, $n, $group )
+	{
+		$key = $this->key( $id, $group );
+		$mc =& $this->get_mc( $group );
+
+		return $mc->decrement( $key, $n );
+	}
+
+	function colorize_debug_line( $line )
+	{
+		$colors = array(
+			'get' => 'green',
+			'set' => 'purple',
+			'add' => 'blue',
+			'delete' => 'red'
+		);
+
+		$cmd = substr( $line, 0, strpos( $line, ' ' ) );
+
+		$cmd2 = "<span style='color:{$colors[$cmd]}'>$cmd</span>";
+
+		return $cmd2 . substr( $line, strlen( $cmd ) ) . "\n";
+	}
+
+	function stats()
+	{
+		echo "<p>\n";
+		foreach ( $this->stats as $stat => $n ) {
+			echo "<strong>$stat</strong> $n";
+			echo "<br/>\n";
+		}
+		echo "</p>\n";
+		echo "<h3>Memcached:</h3>";
+		foreach ( $this->group_ops as $group => $ops ) {
+			if ( !isset( $_GET['debug_queries'] ) && 500 < count( $ops ) ) { 
+				$ops = array_slice( $ops, 0, 500 ); 
+				echo "<big>Too many to show! <a href='" . add_query_arg( 'debug_queries', 'true' ) . "'>Show them anyway</a>.</big>\n";
+			} 
+			echo "<h4>$group commands</h4>";
+			echo "<pre>\n";
+			$lines = array();
+			foreach ( $ops as $op ) {
+				$lines[] = $this->colorize_debug_line( $op ); 
+			}
+			print_r( $lines );
+			echo "</pre>\n";
+		}
+
+		if ( $this->debug ) {
+			var_dump( $this->memcache_debug );
+		}
+	}
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-object-cache.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-object-cache.php
new file mode 100644
index 0000000000000000000000000000000000000000..5c6975d17462753a051c1490d9d505a680c3b2c8
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-object-cache.php
@@ -0,0 +1,305 @@
+<?php
+// Last sync [WP11537]
+
+/**
+ * WordPress Object Cache
+ *
+ * The WordPress Object Cache is used to save on trips to the database. The
+ * Object Cache stores all of the cache data to memory and makes the cache
+ * contents available by using a key, which is used to name and later retrieve
+ * the cache contents.
+ *
+ * The Object Cache can be replaced by other caching mechanisms by placing files
+ * in the wp-content folder which is looked at in wp-settings. If that file
+ * exists, then this file will not be included.
+ *
+ * @package WordPress
+ * @subpackage Cache
+ * @since 2.0
+ */
+class WP_Object_Cache {
+
+	/**
+	 * Holds the cached objects
+	 *
+	 * @var array
+	 * @access private
+	 * @since 2.0.0
+	 */
+	var $cache = array ();
+
+	/**
+	 * Cache objects that do not exist in the cache
+	 *
+	 * @var array
+	 * @access private
+	 * @since 2.0.0
+	 */
+	var $non_existant_objects = array ();
+
+	/**
+	 * The amount of times the cache data was already stored in the cache.
+	 *
+	 * @since 2.5.0
+	 * @access private
+	 * @var int
+	 */
+	var $cache_hits = 0;
+
+	/**
+	 * Amount of times the cache did not have the request in cache
+	 *
+	 * @var int
+	 * @access public
+	 * @since 2.0.0
+	 */
+	var $cache_misses = 0;
+
+	/**
+	 * Adds data to the cache if it doesn't already exist.
+	 *
+	 * @uses WP_Object_Cache::get Checks to see if the cache already has data.
+	 * @uses WP_Object_Cache::set Sets the data after the checking the cache
+	 *		contents existance.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param int|string $id What to call the contents in the cache
+	 * @param mixed $data The contents to store in the cache
+	 * @param string $group Where to group the cache contents
+	 * @param int $expire When to expire the cache contents
+	 * @return bool False if cache ID and group already exists, true on success
+	 */
+	function add($id, $data, $group = 'default', $expire = '') {
+		if (empty ($group))
+			$group = 'default';
+
+		if (false !== $this->get($id, $group, false))
+			return false;
+
+		return $this->set($id, $data, $group, $expire);
+	}
+
+	/**
+	 * Remove the contents of the cache ID in the group
+	 *
+	 * If the cache ID does not exist in the group and $force parameter is set
+	 * to false, then nothing will happen. The $force parameter is set to false
+	 * by default.
+	 *
+	 * On success the group and the id will be added to the
+	 * $non_existant_objects property in the class.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param int|string $id What the contents in the cache are called
+	 * @param string $group Where the cache contents are grouped
+	 * @param bool $force Optional. Whether to force the unsetting of the cache
+	 *		ID in the group
+	 * @return bool False if the contents weren't deleted and true on success
+	 */
+	function delete($id, $group = 'default', $force = false) {
+		if (empty ($group))
+			$group = 'default';
+
+		if (!$force && false === $this->get($id, $group, false))
+			return false;
+
+		unset ($this->cache[$group][$id]);
+		$this->non_existant_objects[$group][$id] = true;
+		return true;
+	}
+
+	/**
+	 * Clears the object cache of all data
+	 *
+	 * @since 2.0.0
+	 *
+	 * @return bool Always returns true
+	 */
+	function flush( $group = null ) {
+		// WP does not support group flushing
+		if ( is_null($group) ) {
+			$this->cache = array();
+			$this->non_existant_objects = array();
+			return true;
+		}
+
+		if ( isset($this->cache[$group]) )
+			$this->cache[$group] = array();
+		if ( isset($this->non_existant_objects[$group]) )
+			$this->non_existant_objects[$group] = array();
+	}
+
+	/**
+	 * Retrieves the cache contents, if it exists
+	 *
+	 * The contents will be first attempted to be retrieved by searching by the
+	 * ID in the cache group. If the cache is hit (success) then the contents
+	 * are returned.
+	 *
+	 * On failure, the $non_existant_objects property is checked and if the
+	 * cache group and ID exist in there the cache misses will not be
+	 * incremented. If not in the nonexistant objects property, then the cache
+	 * misses will be incremented and the cache group and ID will be added to
+	 * the nonexistant objects.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param int|string $id What the contents in the cache are called
+	 * @param string $group Where the cache contents are grouped
+	 * @return bool|mixed False on failure to retrieve contents or the cache
+	 *		contents on success
+	 */
+	function get($id, $group = 'default') {
+		if (empty ($group))
+			$group = 'default';
+
+		if (isset ($this->cache[$group][$id])) {
+			$this->cache_hits += 1;
+			if ( is_object($this->cache[$group][$id]) )
+				return wp_clone($this->cache[$group][$id]);
+			else
+				return $this->cache[$group][$id];
+		}
+
+		if ( isset ($this->non_existant_objects[$group][$id]) )
+			return false;
+
+		$this->non_existant_objects[$group][$id] = true;
+		$this->cache_misses += 1;
+		return false;
+	}
+
+	/**
+	 * Replace the contents in the cache, if contents already exist
+	 *
+	 * @since 2.0.0
+	 * @see WP_Object_Cache::set()
+	 *
+	 * @param int|string $id What to call the contents in the cache
+	 * @param mixed $data The contents to store in the cache
+	 * @param string $group Where to group the cache contents
+	 * @param int $expire When to expire the cache contents
+	 * @return bool False if not exists, true if contents were replaced
+	 */
+	function replace($id, $data, $group = 'default', $expire = '') {
+		if (empty ($group))
+			$group = 'default';
+
+		if (false === $this->get($id, $group, false))
+			return false;
+
+		return $this->set($id, $data, $group, $expire);
+	}
+
+	/**
+	 * Sets the data contents into the cache
+	 *
+	 * The cache contents is grouped by the $group parameter followed by the
+	 * $id. This allows for duplicate ids in unique groups. Therefore, naming of
+	 * the group should be used with care and should follow normal function
+	 * naming guidelines outside of core WordPress usage.
+	 *
+	 * The $expire parameter is not used, because the cache will automatically
+	 * expire for each time a page is accessed and PHP finishes. The method is
+	 * more for cache plugins which use files.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param int|string $id What to call the contents in the cache
+	 * @param mixed $data The contents to store in the cache
+	 * @param string $group Where to group the cache contents
+	 * @param int $expire Not Used
+	 * @return bool Always returns true
+	 */
+	function set($id, $data, $group = 'default', $expire = '') {
+		if (empty ($group))
+			$group = 'default';
+
+		if (NULL === $data)
+			$data = '';
+
+		if ( is_object($data) )
+			$data = wp_clone($data);
+
+		$this->cache[$group][$id] = $data;
+
+		if(isset($this->non_existant_objects[$group][$id]))
+			unset ($this->non_existant_objects[$group][$id]);
+
+		return true;
+	}
+
+	/**
+	 * Echos the stats of the caching.
+	 *
+	 * Gives the cache hits, and cache misses. Also prints every cached group,
+	 * key and the data.
+	 *
+	 * @since 2.0.0
+	 */
+	function stats() {
+		echo "<p>";
+		echo "<strong>Cache Hits:</strong> {$this->cache_hits}<br />";
+		echo "<strong>Cache Misses:</strong> {$this->cache_misses}<br />";
+		echo "</p>";
+
+		foreach ($this->cache as $group => $cache) {
+			echo "<p>";
+			echo "<strong>Group:</strong> $group<br />";
+			echo "<strong>Cache:</strong>";
+			echo "<pre>";
+			print_r($cache);
+			echo "</pre>";
+		}
+	}
+
+	function add_global_groups( $groups )
+	{
+		return true;
+	}
+
+	function add_non_persistent_groups( $groups )
+	{
+		return true;
+	}
+
+	/**
+	 * PHP4 constructor; Calls PHP 5 style constructor
+	 *
+	 * @since 2.0.0
+	 *
+	 * @return WP_Object_Cache
+	 */
+	function WP_Object_Cache() {
+		return $this->__construct();
+	}
+
+	/**
+	 * Sets up object properties; PHP 5 style constructor
+	 *
+	 * @since 2.0.8
+	 * @return null|WP_Object_Cache If cache is disabled, returns null.
+	 */
+	function __construct() {
+		/**
+		 * @todo This should be moved to the PHP4 style constructor, PHP5
+		 * already calls __destruct()
+		 */
+		register_shutdown_function(array(&$this, "__destruct"));
+	}
+
+	/**
+	 * Will save the object cache before object is completely destroyed.
+	 *
+	 * Called upon object destruction, which should be when PHP ends.
+	 *
+	 * @since  2.0.8
+	 *
+	 * @return bool True value. Won't be used by PHP
+	 */
+	function __destruct() {
+		return true;
+	}
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-pass.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-pass.php
new file mode 100644
index 0000000000000000000000000000000000000000..c24aca4a117f107dca3927df4323e664ad7c2f0a
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-pass.php
@@ -0,0 +1,141 @@
+<?php
+// Last sync [WP10712]
+
+class WP_Pass {
+	/**
+	 * Create a hash (encrypt) of a plain text password.
+	 *
+	 * For integration with other applications, this function can be overwritten to
+	 * instead use the other package password checking algorithm.
+	 *
+	 * @since WP 2.5
+	 * @global object $wp_hasher PHPass object
+	 * @uses PasswordHash::HashPassword
+	 *
+	 * @param string $password Plain text user password to hash
+	 * @return string The hash string of the password
+	 */
+	function hash_password($password) {
+		global $wp_hasher;
+
+		if ( empty($wp_hasher) ) {
+			require_once( BACKPRESS_PATH . 'class.passwordhash.php');
+			// By default, use the portable hash from phpass
+			$wp_hasher = new PasswordHash(8, TRUE);
+		}
+
+		return $wp_hasher->HashPassword($password);
+	}
+
+	/**
+	 * Checks the plaintext password against the encrypted Password.
+	 *
+	 * Maintains compatibility between old version and the new cookie authentication
+	 * protocol using PHPass library. The $hash parameter is the encrypted password
+	 * and the function compares the plain text password when encypted similarly
+	 * against the already encrypted password to see if they match.
+	 *
+	 * For integration with other applications, this function can be overwritten to
+	 * instead use the other package password checking algorithm.
+	 *
+	 * @since WP 2.5
+	 * @global object $wp_hasher PHPass object used for checking the password
+	 *	against the $hash + $password
+	 * @uses PasswordHash::CheckPassword
+	 *
+	 * @param string $password Plaintext user's password
+	 * @param string $hash Hash of the user's password to check against.
+	 * @return bool False, if the $password does not match the hashed password
+	 */
+	function check_password($password, $hash, $user_id = '') {
+		global $wp_hasher, $wp_users_object;
+
+		list($hash, $broken) = array_pad( explode( '---', $hash ), 2, '' );
+
+		// If the hash is still md5...
+		if ( strlen($hash) <= 32 ) {
+			$check = ( $hash == md5($password) );
+			if ( $check && $user_id && !$broken ) {
+				// Rehash using new hash.
+				$wp_users_object->set_password($password, $user_id);
+				$hash = WP_Pass::hash_password($password);
+			}
+
+			return apply_filters('check_password', $check, $password, $hash, $user_id);
+		}
+
+		// If the stored hash is longer than an MD5, presume the
+		// new style phpass portable hash.
+		if ( empty($wp_hasher) ) {
+			require_once( BACKPRESS_PATH . 'class.passwordhash.php');
+			// By default, use the portable hash from phpass
+			$wp_hasher = new PasswordHash(8, TRUE);
+		}
+
+		$check = $wp_hasher->CheckPassword($password, $hash);
+
+		return apply_filters('check_password', $check, $password, $hash, $user_id);
+	}
+
+	/**
+	 * Generates a random password drawn from the defined set of characters
+	 *
+	 * @since WP 2.5
+	 *
+	 * @param int $length The length of password to generate
+	 * @param bool $special_chars Whether to include standard special characters 
+	 * @return string The random password
+	 */
+	function generate_password($length = 12, $special_chars = true) {
+		$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
+		if ( $special_chars )
+			$chars .= '!@#$%^&*()';
+
+		$password = '';
+		for ( $i = 0; $i < $length; $i++ )
+			$password .= substr($chars, WP_Pass::rand(0, strlen($chars) - 1), 1);
+		return $password;
+	}
+
+	/**
+	 * Generates a random number
+	 *
+	 * Not verbatim WordPress, keeps seed value in backpress options.
+	 *
+	 * @since WP 2.6.2
+	 *
+	 * @param int $min Lower limit for the generated number (optional, default is 0)
+	 * @param int $max Upper limit for the generated number (optional, default is 4294967295)
+	 * @return int A random number between min and max
+	 */
+	function rand( $min = 0, $max = 0 ) {
+		global $rnd_value;
+
+		$seed = backpress_get_transient('random_seed');
+
+		// Reset $rnd_value after 14 uses
+		// 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value
+		if ( strlen($rnd_value) < 8 ) {
+			$rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $seed );
+			$rnd_value .= sha1($rnd_value);
+			$rnd_value .= sha1($rnd_value . $seed);
+			$seed = md5($seed . $rnd_value);
+			backpress_set_transient('random_seed', $seed);
+		}
+
+		// Take the first 8 digits for our value
+		$value = substr($rnd_value, 0, 8);
+
+		// Strip the first eight, leaving the remainder for the next call to wp_rand().
+		$rnd_value = substr($rnd_value, 8);
+
+		$value = abs(hexdec($value));
+
+		// Reduce the value to be within the min - max range
+		// 4294967295 = 0xffffffff = max random number
+		if ( $max != 0 )
+			$value = $min + (($max - $min + 1) * ($value / (4294967295 + 1)));
+
+		return abs(intval($value));
+	}
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-scripts.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-scripts.php
new file mode 100644
index 0000000000000000000000000000000000000000..9fa96e9d020d5d22e3cb9039cecd9eeab7feaa84
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-scripts.php
@@ -0,0 +1,197 @@
+<?php
+/**
+ * BackPress Scripts enqueue.
+ *
+ * These classes were refactored from the WordPress WP_Scripts and WordPress
+ * script enqueue API.
+ *
+ * @package BackPress
+ * @since r16
+ */
+
+/**
+ * BackPress Scripts enqueue class.
+ *
+ * @package BackPress
+ * @uses WP_Dependencies
+ * @since r16
+ */
+class WP_Scripts extends WP_Dependencies {
+	var $base_url; // Full URL with trailing slash
+	var $content_url;
+	var $default_version;
+	var $in_footer = array();
+	var $concat = '';
+	var $concat_version = '';
+	var $do_concat = false;
+	var $print_html = '';
+	var $print_code = '';
+	var $ext_handles = '';
+	var $ext_version = '';
+	var $default_dirs;
+
+	function __construct() {
+		do_action_ref_array( 'wp_default_scripts', array(&$this) );
+	}
+
+	/**
+	 * Prints scripts
+	 *
+	 * Prints the scripts passed to it or the print queue.  Also prints all necessary dependencies.
+	 *
+	 * @param mixed handles (optional) Scripts to be printed.  (void) prints queue, (string) prints that script, (array of strings) prints those scripts.
+	 * @param int group (optional) If scripts were queued in groups prints this group number.
+	 * @return array Scripts that have been printed
+	 */
+	function print_scripts( $handles = false, $group = false ) {
+		return $this->do_items( $handles, $group );
+	}
+
+	function print_scripts_l10n( $handle, $echo = true ) {
+		if ( empty($this->registered[$handle]->extra['l10n']) || empty($this->registered[$handle]->extra['l10n'][0]) || !is_array($this->registered[$handle]->extra['l10n'][1]) )
+			return false;
+
+		$object_name = $this->registered[$handle]->extra['l10n'][0];
+
+		$data = "var $object_name = {\n";
+		$eol = '';
+		foreach ( $this->registered[$handle]->extra['l10n'][1] as $var => $val ) {
+			if ( 'l10n_print_after' == $var ) {
+				$after = $val;
+				continue;
+			}
+			$data .= "$eol\t$var: \"" . esc_js( $val ) . '"';
+			$eol = ",\n";
+		}
+		$data .= "\n};\n";
+		$data .= isset($after) ? "$after\n" : '';
+
+		if ( $echo ) {
+			echo "<script type='text/javascript'>\n";
+			echo "/* <![CDATA[ */\n";
+			echo $data;
+			echo "/* ]]> */\n";
+			echo "</script>\n";
+			return true;
+		} else {
+			return $data;
+		}
+	}
+
+	function do_item( $handle, $group = false ) {
+		if ( !parent::do_item($handle) )
+			return false;
+
+		if ( 0 === $group && $this->groups[$handle] > 0 ) {
+			$this->in_footer[] = $handle;
+			return false;
+		}
+
+		if ( false === $group && in_array($handle, $this->in_footer, true) )
+			$this->in_footer = array_diff( $this->in_footer, (array) $handle );
+
+		$ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
+		if ( isset($this->args[$handle]) )
+			$ver .= '&amp;' . $this->args[$handle];
+
+		$src = $this->registered[$handle]->src;
+
+		if ( $this->do_concat ) {
+			$srce = apply_filters( 'script_loader_src', $src, $handle );
+			if ( $this->in_default_dir($srce) ) {
+				$this->print_code .= $this->print_scripts_l10n( $handle, false );
+				$this->concat .= "$handle,";
+				$this->concat_version .= "$handle$ver";
+				return true;
+			} else {
+				$this->ext_handles .= "$handle,";
+				$this->ext_version .= "$handle$ver";
+			}
+		}
+
+		$this->print_scripts_l10n( $handle );
+		if ( !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
+			$src = $this->base_url . $src;
+		}
+
+		$src = add_query_arg('ver', $ver, $src);
+		$src = esc_url(apply_filters( 'script_loader_src', $src, $handle ));
+
+		if ( $this->do_concat )
+			$this->print_html .= "<script type='text/javascript' src='$src'></script>\n";
+		else
+			echo "<script type='text/javascript' src='$src'></script>\n";
+
+		return true;
+	}
+
+	/**
+	 * Localizes a script
+	 *
+	 * Localizes only if script has already been added
+	 *
+	 * @param string handle Script name
+	 * @param string object_name Name of JS object to hold l10n info
+	 * @param array l10n Array of JS var name => localized string
+	 * @return bool Successful localization
+	 */
+	function localize( $handle, $object_name, $l10n ) {
+		if ( !$object_name || !$l10n )
+			return false;
+		return $this->add_data( $handle, 'l10n', array( $object_name, $l10n ) );
+	}
+
+	function set_group( $handle, $recursion, $group = false ) {
+		$grp = isset($this->registered[$handle]->extra['group']) ? (int) $this->registered[$handle]->extra['group'] : 0;
+		if ( false !== $group && $grp > $group )
+			$grp = $group;
+
+		return parent::set_group( $handle, $recursion, $grp );
+	}
+
+	function all_deps( $handles, $recursion = false, $group = false ) {
+		$r = parent::all_deps( $handles, $recursion );
+		if ( !$recursion )
+			$this->to_do = apply_filters( 'print_scripts_array', $this->to_do );
+		return $r;
+	}
+
+	function do_head_items() {
+		$this->do_items(false, 0);
+		return $this->done;
+	}
+
+	function do_footer_items() {
+		if ( !empty($this->in_footer) ) {
+			foreach( $this->in_footer as $key => $handle ) {
+				if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) {
+					$this->do_item($handle);
+					$this->done[] = $handle;
+					unset( $this->in_footer[$key] );
+				}
+			}
+		}
+		return $this->done;
+	}
+
+	function in_default_dir($src) {
+		if ( ! $this->default_dirs )
+			return true;
+
+		foreach ( (array) $this->default_dirs as $test ) {
+			if ( 0 === strpos($src, $test) )
+				return true;
+		}
+		return false;
+	}
+
+	function reset() {
+		$this->do_concat = false;
+		$this->print_code = '';
+		$this->concat = '';
+		$this->concat_version = '';
+		$this->print_html = '';
+		$this->ext_version = '';
+		$this->ext_handles = '';
+	}
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-styles.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-styles.php
new file mode 100644
index 0000000000000000000000000000000000000000..731ae39cf47a6fcd6ecc9edffb16fee0739a185a
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-styles.php
@@ -0,0 +1,119 @@
+<?php
+/**
+ * BackPress Styles enqueue.
+ *
+ * These classes were refactored from the WordPress WP_Scripts and WordPress
+ * script enqueue API.
+ *
+ * @package BackPress
+ * @since r74
+ */
+
+/**
+ * BackPress Styles enqueue class.
+ *
+ * @package BackPress
+ * @uses WP_Dependencies
+ * @since r74
+ */
+class WP_Styles extends WP_Dependencies {
+	var $base_url;
+	var $content_url;
+	var $default_version;
+	var $text_direction = 'ltr';
+	var $concat = '';
+	var $concat_version = '';
+	var $do_concat = false;
+	var $print_html = '';
+	var $default_dirs;
+
+	function __construct() {
+		do_action_ref_array( 'wp_default_styles', array(&$this) );
+	}
+
+	function do_item( $handle ) {
+		if ( !parent::do_item($handle) )
+			return false;
+
+		$ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
+		if ( isset($this->args[$handle]) )
+			$ver .= '&amp;' . $this->args[$handle];
+
+		if ( $this->do_concat ) {
+			if ( $this->in_default_dir($this->registered[$handle]->src) && !isset($this->registered[$handle]->extra['conditional']) && !isset($this->registered[$handle]->extra['alt']) ) {
+				$this->concat .= "$handle,";
+				$this->concat_version .= "$handle$ver";
+				return true;
+			}
+		}
+
+		if ( isset($this->registered[$handle]->args) )
+			$media = esc_attr( $this->registered[$handle]->args );
+		else
+			$media = 'all';
+
+		$href = $this->_css_href( $this->registered[$handle]->src, $ver, $handle );
+		$rel = isset($this->registered[$handle]->extra['alt']) && $this->registered[$handle]->extra['alt'] ? 'alternate stylesheet' : 'stylesheet';
+		$title = isset($this->registered[$handle]->extra['title']) ? "title='" . esc_attr( $this->registered[$handle]->extra['title'] ) . "'" : '';
+
+		$end_cond = $tag = '';
+		if ( isset($this->registered[$handle]->extra['conditional']) && $this->registered[$handle]->extra['conditional'] ) {
+			$tag .= "<!--[if {$this->registered[$handle]->extra['conditional']}]>\n";
+			$end_cond = "<![endif]-->\n";
+		}
+
+		$tag .= apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n", $handle );
+		if ( 'rtl' === $this->text_direction && isset($this->registered[$handle]->extra['rtl']) && $this->registered[$handle]->extra['rtl'] ) {
+			if ( is_bool( $this->registered[$handle]->extra['rtl'] ) )
+				$rtl_href = str_replace( '.css', '-rtl.css', $this->_css_href( $this->registered[$handle]->src , $ver, "$handle-rtl" ));
+			else
+				$rtl_href = $this->_css_href( $this->registered[$handle]->extra['rtl'], $ver, "$handle-rtl" );
+
+			$tag .= apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-rtl-css' $title href='$rtl_href' type='text/css' media='$media' />\n", $handle );
+		}
+
+		$tag .= $end_cond;
+
+		if ( $this->do_concat )
+			$this->print_html .= $tag;
+		else
+			echo $tag;
+
+		// Could do something with $this->registered[$handle]->extra here to print out extra CSS rules
+//		echo "<style type='text/css'>\n";
+//		echo "/* <![CDATA[ */\n";
+//		echo "/* ]]> */\n";
+//		echo "</style>\n";
+
+		return true;
+	}
+
+	function all_deps( $handles, $recursion = false, $group = false ) {
+		$r = parent::all_deps( $handles, $recursion );
+		if ( !$recursion )
+			$this->to_do = apply_filters( 'print_styles_array', $this->to_do );
+		return $r;
+	}
+
+	function _css_href( $src, $ver, $handle ) {
+		if ( !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
+			$src = $this->base_url . $src;
+		}
+
+		$src = add_query_arg('ver', $ver, $src);
+		$src = apply_filters( 'style_loader_src', $src, $handle );
+		return esc_url( $src );
+	}
+
+	function in_default_dir($src) {
+		if ( ! $this->default_dirs )
+			return true;
+
+		foreach ( (array) $this->default_dirs as $test ) {
+			if ( 0 === strpos($src, $test) )
+				return true;
+		}
+		return false;
+	}
+
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-taxonomy.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-taxonomy.php
new file mode 100644
index 0000000000000000000000000000000000000000..167277500868a733ef42e7bfe8fa8f9826ec64ae
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-taxonomy.php
@@ -0,0 +1,2072 @@
+<?php
+// Last sync [WP11537]
+
+/**
+ * Taxonomy API
+ *
+ * @package WordPress
+ * @subpackage Taxonomy
+ * @since 2.3.0
+ */
+
+/**
+ * WordPress Taxonomy based off of WordPress revision 8782.
+ *
+ * @since 2.3.0
+ */
+class WP_Taxonomy {
+	/**
+	 * Stores the database.
+	 *
+	 * @var unknown_type
+	 */
+	var $db;
+	var $taxonomies = array();
+
+	function WP_Taxonomy( &$db ) {
+		$this->__construct( $db );
+		register_shutdown_function( array(&$this, '__destruct') );
+	}
+
+	/**
+	 * PHP5 constructor - Assigns the database to an attribute of the class.
+	 *
+	 * @param unknown_type $db
+	 */
+	function __construct( &$db ) {
+		$this->db =& $db;
+	}
+
+	/**
+	 * Does nothing.
+	 *
+	 * @package BackPress
+	 * @subpackage Taxonomy
+	 */
+	function __destruct() {
+	}
+
+	/**
+	 * Return all of the taxonomy names that are of $object_type.
+	 *
+	 * It appears that this function can be used to find all of the names inside of
+	 * $this->taxonomies variable.
+	 *
+	 * <code><?php $taxonomies = $this->get_object_taxonomies('post'); ?></code> Should
+	 * result in <code>Array('category', 'post_tag')</code>
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @uses $this->taxonomies
+	 *
+	 * @param array|string|object $object_type Name of the type of taxonomy object, or an object (row from posts)
+	 * @return array The names of all taxonomy of $object_type.
+	 */
+	function get_object_taxonomies($object_type) {
+		$object_type = (array) $object_type;
+
+		// WP DIFF
+		$taxonomies = array();
+		foreach ( (array) $this->taxonomies as $taxonomy ) {
+			if ( array_intersect($object_type, (array) $taxonomy->object_type) )
+				$taxonomies[] = $taxonomy->name;
+		}
+
+		return $taxonomies;
+	}
+
+	/**
+	 * Retrieves the taxonomy object of $taxonomy.
+	 *
+	 * The get_taxonomy function will first check that the parameter string given
+	 * is a taxonomy object and if it is, it will return it.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @uses $this->taxonomies
+	 * @uses $this->is_taxonomy() Checks whether taxonomy exists
+	 *
+	 * @param string $taxonomy Name of taxonomy object to return
+	 * @return object|bool The Taxonomy Object or false if $taxonomy doesn't exist
+	 */
+	function get_taxonomy( $taxonomy ) {
+		if ( !$this->is_taxonomy($taxonomy) )
+			return false;
+
+		return $this->taxonomies[$taxonomy];
+	}
+
+	/**
+	 * Checks that the taxonomy name exists.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 * 
+	 * @uses $this->taxonomies
+	 *
+	 * @param string $taxonomy Name of taxonomy object
+	 * @return bool Whether the taxonomy exists or not.
+	 */
+	function is_taxonomy( $taxonomy ) {
+		return isset($this->taxonomies[$taxonomy]);
+	}
+
+	/**
+	 * Whether the taxonomy object is hierarchical.
+	 *
+	 * Checks to make sure that the taxonomy is an object first. Then Gets the
+	 * object, and finally returns the hierarchical value in the object.
+	 *
+	 * A false return value might also mean that the taxonomy does not exist.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @uses $this->is_taxonomy() Checks whether taxonomy exists
+	 * @uses $this->get_taxonomy() Used to get the taxonomy object
+	 *
+	 * @param string $taxonomy Name of taxonomy object
+	 * @return bool Whether the taxonomy is hierarchical
+	 */
+	function is_taxonomy_hierarchical($taxonomy) {
+		if ( !$this->is_taxonomy($taxonomy) )
+			return false;
+
+		$taxonomy = $this->get_taxonomy($taxonomy);
+		return $taxonomy->hierarchical;
+	}
+
+	/**
+	 * Create or modify a taxonomy object. Do not use before init.
+	 *
+	 * A simple function for creating or modifying a taxonomy object based on the
+	 * parameters given. The function will accept an array (third optional
+	 * parameter), along with strings for the taxonomy name and another string for
+	 * the object type.
+	 *
+	 * The function keeps a default set, allowing for the $args to be optional but
+	 * allow the other functions to still work. It is possible to overwrite the
+	 * default set, which contains two keys: hierarchical and update_count_callback.
+	 *
+	 * Nothing is returned, so expect error maybe or use is_taxonomy() to check
+	 * whether taxonomy exists.
+	 *
+	 * Optional $args contents:
+	 *
+	 * hierarachical - has some defined purpose at other parts of the API and is a
+	 * boolean value.
+	 *
+	 * update_count_callback - works much like a hook, in that it will be called
+	 * when the count is updated.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 * @uses $this->taxonomies Inserts new taxonomy object into the list
+	 * 
+	 * @param string $taxonomy Name of taxonomy object
+	 * @param string $object_type Name of the object type for the taxonomy object.
+	 * @param array|string $args See above description for the two keys values.
+	 */
+	function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
+		$defaults = array('hierarchical' => false, 'update_count_callback' => '');
+		$args = wp_parse_args($args, $defaults);
+
+		$args['name'] = $taxonomy;
+		$args['object_type'] = $object_type;
+		$this->taxonomies[$taxonomy] = (object) $args;
+	}
+
+	//
+	// Term API
+	//
+
+	/**
+	 * Retrieve object_ids of valid taxonomy and term.
+	 *
+	 * The strings of $taxonomies must exist before this function will continue. On
+	 * failure of finding a valid taxonomy, it will return an WP_Error class, kind
+	 * of like Exceptions in PHP 5, except you can't catch them. Even so, you can
+	 * still test for the WP_Error class and get the error message.
+	 *
+	 * The $terms aren't checked the same as $taxonomies, but still need to exist
+	 * for $object_ids to be returned.
+	 *
+	 * It is possible to change the order that object_ids is returned by either
+	 * using PHP sort family functions or using the database by using $args with
+	 * either ASC or DESC array. The value should be in the key named 'order'.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @uses wp_parse_args() Creates an array from string $args.
+	 *
+	 * @param string|array $terms String of term or array of string values of terms that will be used
+	 * @param string|array $taxonomies String of taxonomy name or Array of string values of taxonomy names
+	 * @param array|string $args Change the order of the object_ids, either ASC or DESC
+	 * @return WP_Error|array If the taxonomy does not exist, then WP_Error will be returned. On success
+	 *	the array can be empty meaning that there are no $object_ids found or it will return the $object_ids found.
+	 */
+	function get_objects_in_term( $terms, $taxonomies, $args = null ) {
+		if ( !is_array($terms) )
+			$terms = array($terms);
+
+		if ( !is_array($taxonomies) )
+			$taxonomies = array($taxonomies);
+
+		foreach ( (array) $taxonomies as $taxonomy ) {
+			if ( !$this->is_taxonomy($taxonomy) )
+				return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
+		}
+
+		$defaults = array('order' => 'ASC', 'field' => 'term_id');
+		$args = wp_parse_args( $args, $defaults );
+		extract($args, EXTR_SKIP);
+
+		if ( 'tt_id' == $field )
+			$field = 'tt.term_taxonomy_id';
+		else
+			$field = 'tt.term_id';
+
+		$order = ( 'desc' == strtolower($order) ) ? 'DESC' : 'ASC';
+
+		$terms = array_map('intval', $terms);
+
+		$taxonomies = "'" . implode("', '", $taxonomies) . "'";
+		$terms = "'" . implode("', '", $terms) . "'";
+
+		$object_ids = $this->db->get_col("SELECT tr.object_id FROM {$this->db->term_relationships} AS tr INNER JOIN {$this->db->term_taxonomy} AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND $field IN ($terms) ORDER BY tr.object_id $order");
+
+		if ( ! $object_ids )
+			return array();
+
+		return $object_ids;
+	}
+
+	/**
+	 * Get all Term data from database by Term ID.
+	 *
+	 * The usage of the get_term function is to apply filters to a term object. It
+	 * is possible to get a term object from the database before applying the
+	 * filters.
+	 *
+	 * $term ID must be part of $taxonomy, to get from the database. Failure, might
+	 * be able to be captured by the hooks. Failure would be the same value as $this->db
+	 * returns for the get_row method.
+	 *
+	 * There are two hooks, one is specifically for each term, named 'get_term', and
+	 * the second is for the taxonomy name, 'term_$taxonomy'. Both hooks gets the
+	 * term object, and the taxonomy name as parameters. Both hooks are expected to
+	 * return a Term object.
+	 *
+	 * 'get_term' hook - Takes two parameters the term Object and the taxonomy name.
+	 * Must return term object. Used in get_term() as a catch-all filter for every
+	 * $term.
+	 *
+	 * 'get_$taxonomy' hook - Takes two parameters the term Object and the taxonomy
+	 * name. Must return term object. $taxonomy will be the taxonomy name, so for
+	 * example, if 'category', it would be 'get_category' as the filter name. Useful
+	 * for custom taxonomies or plugging into default taxonomies.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @uses $this->sanitize_term() Cleanses the term based on $filter context before returning.
+	 * @see $this->sanitize_term_field() The $context param lists the available values for get_term_by() $filter param.
+	 *
+	 * @param int|object $term If integer, will get from database. If object will apply filters and return $term.
+	 * @param string $taxonomy Taxonomy name that $term is part of.
+	 * @param string $output Constant OBJECT, ARRAY_A, or ARRAY_N
+	 * @param string $filter Optional, default is raw or no WordPress defined filter will applied.
+	 * @return mixed|null|WP_Error Term Row from database. Will return null if $term is empty. If taxonomy does not
+	 * exist then WP_Error will be returned.
+	 */
+	function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
+		if ( empty($term) ) {
+			$error = new WP_Error('invalid_term', __('Empty Term'));
+			return $error;
+		}
+
+		if ( !$this->is_taxonomy($taxonomy) ) {
+			$error = new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
+			return $error;
+		}
+
+		if ( is_object($term) ) {
+			wp_cache_add($term->term_id, $term, $taxonomy);
+			$_term = $term;
+		} else {
+			$term = (int) $term;
+			if ( ! $_term = wp_cache_get($term, $taxonomy) ) {
+				$_term = $this->db->get_row( $this->db->prepare( "SELECT t.*, tt.* FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND t.term_id = %s LIMIT 1", $taxonomy, $term) );
+				wp_cache_add($term, $_term, $taxonomy);
+			}
+		}
+
+		$_term = apply_filters('get_term', $_term, $taxonomy);
+		$_term = apply_filters("get_$taxonomy", $_term, $taxonomy);
+		$_term = $this->sanitize_term($_term, $taxonomy, $filter);
+
+		backpress_convert_object( $_term, $output );
+
+		return $_term;
+	}
+
+	/**
+	 * Get all Term data from database by Term field and data.
+	 *
+	 * Warning: $value is not escaped for 'name' $field. You must do it yourself, if
+	 * required.
+	 *
+	 * The default $field is 'id', therefore it is possible to also use null for
+	 * field, but not recommended that you do so.
+	 *
+	 * If $value does not exist, the return value will be false. If $taxonomy exists
+	 * and $field and $value combinations exist, the Term will be returned.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @uses $this->sanitize_term() Cleanses the term based on $filter context before returning.
+	 * @see $this->sanitize_term_field() The $context param lists the available values for get_term_by() $filter param.
+	 *
+	 * @param string $field Either 'slug', 'name', 'id', or 'tt_id'
+	 * @param string|int $value Search for this term value
+	 * @param string $taxonomy Taxonomy Name
+	 * @param string $output Constant OBJECT, ARRAY_A, or ARRAY_N
+	 * @param string $filter Optional, default is raw or no WordPress defined filter will applied.
+	 * @return mixed Term Row from database. Will return false if $taxonomy does not exist or $term was not found.
+	 */
+	function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw') {
+		if ( !$this->is_taxonomy($taxonomy) )
+			return false;
+
+		if ( 'slug' == $field ) {
+			$field = 't.slug';
+			$value = $this->sanitize_term_slug($value, $taxonomy);
+			if ( empty($value) )
+				return false;
+		} else if ( 'name' == $field ) {
+			// Assume already escaped
+			$field = 't.name';
+		} else if ( 'tt_id' == $field ) {
+			$field = 'tt.term_taxonomy_id';
+			$value = (int) $value;
+		} else {
+			$field = 't.term_id';
+			$value = (int) $value;
+		}
+
+		$term = $this->db->get_row( $this->db->prepare( "SELECT t.*, tt.* FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND $field = %s LIMIT 1", $taxonomy, $value) );
+		if ( !$term )
+			return false;
+
+		wp_cache_add($term->term_id, $term, $taxonomy);
+
+		$term = $this->sanitize_term($term, $taxonomy, $filter);
+
+		backpress_convert_object( $term, $output );
+
+		return $term;
+	}
+
+	/**
+	 * Merge all term children into a single array of their IDs.
+	 *
+	 * This recursive function will merge all of the children of $term into the same
+	 * array of term IDs. Only useful for taxonomies which are hierarchical.
+	 *
+	 * Will return an empty array if $term does not exist in $taxonomy.
+	 * 
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @uses $this->_get_term_hierarchy()
+	 * @uses $this->get_term_children() Used to get the children of both $taxonomy and the parent $term
+	 *
+	 * @param string $term ID of Term to get children
+	 * @param string $taxonomy Taxonomy Name
+	 * @return array|WP_Error List of Term Objects. WP_Error returned if $taxonomy does not exist
+	 */
+	function get_term_children( $term_id, $taxonomy ) {
+		if ( !$this->is_taxonomy($taxonomy) )
+			return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
+
+		$term_id = intval( $term_id );
+
+		$terms = $this->_get_term_hierarchy($taxonomy);
+
+		if ( ! isset($terms[$term_id]) )
+			return array();
+
+		$children = $terms[$term_id];
+
+		foreach ( (array) $terms[$term_id] as $child ) {
+			if ( isset($terms[$child]) )
+				$children = array_merge($children, $this->get_term_children($child, $taxonomy));
+		}
+
+		return $children;
+	}
+
+	/**
+	 * Get sanitized Term field.
+	 *
+	 * Does checks for $term, based on the $taxonomy. The function is for contextual
+	 * reasons and for simplicity of usage. See sanitize_term_field() for more
+	 * information.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @uses $this->sanitize_term_field() Passes the return value in sanitize_term_field on success.
+	 *
+	 * @param string $field Term field to fetch
+	 * @param int $term Term ID
+	 * @param string $taxonomy Taxonomy Name
+	 * @param string $context Optional, default is display. Look at sanitize_term_field() for available options.
+	 * @return mixed Will return an empty string if $term is not an object or if $field is not set in $term.
+	 */
+	function get_term_field( $field, $term, $taxonomy, $context = 'display' ) {
+		$term = (int) $term;
+		$term = $this->get_term( $term, $taxonomy );
+		if ( is_wp_error($term) )
+			return $term;
+
+		if ( !is_object($term) )
+			return '';
+
+		if ( !isset($term->$field) )
+			return '';
+
+		return $this->sanitize_term_field($field, $term->$field, $term->term_id, $taxonomy, $context);
+	}
+
+	/**
+	 * Sanitizes Term for editing.
+	 *
+	 * Return value is sanitize_term() and usage is for sanitizing the term for
+	 * editing. Function is for contextual and simplicity.
+	 * 
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @uses $this->sanitize_term() Passes the return value on success
+	 *
+	 * @param int|object $id Term ID or Object
+	 * @param string $taxonomy Taxonomy Name
+	 * @return mixed|null|WP_Error Will return empty string if $term is not an object.
+	 */
+	function get_term_to_edit( $id, $taxonomy ) {
+		$term = $this->get_term( $id, $taxonomy );
+
+		if ( is_wp_error($term) )
+			return $term;
+
+		if ( !is_object($term) )
+			return '';
+
+		return $this->sanitize_term($term, $taxonomy, 'edit');
+	}
+
+	/**
+	 * Retrieve the terms in a given taxonomy or list of taxonomies.
+	 *
+	 * You can fully inject any customizations to the query before it is sent, as
+	 * well as control the output with a filter.
+	 *
+	 * The 'get_terms' filter will be called when the cache has the term and will
+	 * pass the found term along with the array of $taxonomies and array of $args.
+	 * This filter is also called before the array of terms is passed and will pass
+	 * the array of terms, along with the $taxonomies and $args.
+	 *
+	 * The 'list_terms_exclusions' filter passes the compiled exclusions along with
+	 * the $args.
+	 *
+	 * The 'get_terms_orderby' filter passes the ORDER BY clause for the query
+	 * along with the $args array.
+	 *
+	 * The 'get_terms_fields' filter passes the fields for the SELECT query
+	 * along with the $args array.
+	 *
+	 * The list of arguments that $args can contain, which will overwrite the defaults:
+	 *
+	 * orderby - Default is 'name'. Can be name, count, term_group, slug or nothing
+	 * (will use term_id), Passing a custom value other than these will cause it to
+	 * order based on the custom value.
+	 *
+	 * order - Default is ASC. Can use DESC.
+	 *
+	 * hide_empty - Default is true. Will not return empty terms, which means
+	 * terms whose count is 0 according to the given taxonomy.
+	 *
+	 * exclude - Default is an empty string.  A comma- or space-delimited string
+	 * of term ids to exclude from the return array.  If 'include' is non-empty,
+	 * 'exclude' is ignored.
+	 *
+	 * include - Default is an empty string.  A comma- or space-delimited string
+	 * of term ids to include in the return array.
+	 *
+	 * number - The maximum number of terms to return.  Default is empty.
+	 *
+	 * offset - The number by which to offset the terms query.
+	 *
+	 * fields - Default is 'all', which returns an array of term objects.
+	 * If 'fields' is 'ids' or 'names', returns an array of
+	 * integers or strings, respectively.
+	 *
+	 * slug - Returns terms whose "slug" matches this value. Default is empty string.
+	 *
+	 * hierarchical - Whether to include terms that have non-empty descendants
+	 * (even if 'hide_empty' is set to true).
+	 *
+	 * search - Returned terms' names will contain the value of 'search',
+	 * case-insensitive.  Default is an empty string.
+	 *
+	 * name__like - Returned terms' names will begin with the value of 'name__like',
+	 * case-insensitive. Default is empty string.
+	 *
+	 * The argument 'pad_counts', if set to true will include the quantity of a term's
+	 * children in the quantity of each term's "count" object variable.
+	 *
+	 * The 'get' argument, if set to 'all' instead of its default empty string,
+	 * returns terms regardless of ancestry or whether the terms are empty.
+	 *
+	 * The 'child_of' argument, when used, should be set to the integer of a term ID.  Its default
+	 * is 0.  If set to a non-zero value, all returned terms will be descendants
+	 * of that term according to the given taxonomy.  Hence 'child_of' is set to 0
+	 * if more than one taxonomy is passed in $taxonomies, because multiple taxonomies
+	 * make term ancestry ambiguous.
+	 *
+	 * The 'parent' argument, when used, should be set to the integer of a term ID.  Its default is
+	 * the empty string '', which has a different meaning from the integer 0.
+	 * If set to an integer value, all returned terms will have as an immediate
+	 * ancestor the term whose ID is specified by that integer according to the given taxonomy.
+	 * The 'parent' argument is different from 'child_of' in that a term X is considered a 'parent'
+	 * of term Y only if term X is the father of term Y, not its grandfather or great-grandfather, etc.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @uses wp_parse_args() Merges the defaults with those defined by $args and allows for strings.
+	 *
+	 * @param string|array Taxonomy name or list of Taxonomy names
+	 * @param string|array $args The values of what to search for when returning terms
+	 * @return array|WP_Error List of Term Objects and their children. Will return WP_Error, if any of $taxonomies do not exist.
+	 */
+	function &get_terms($taxonomies, $args = '') {
+		$empty_array = array();
+
+		$single_taxonomy = false;
+		if ( !is_array($taxonomies) ) {
+			$single_taxonomy = true;
+			$taxonomies = array($taxonomies);
+		}
+
+		foreach ( (array) $taxonomies as $taxonomy ) {
+			if ( ! $this->is_taxonomy($taxonomy) ) {
+				$error = & new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
+				return $error;
+			}
+		}
+
+		$in_taxonomies = "'" . implode("', '", $taxonomies) . "'";
+
+		$defaults = array('orderby' => 'name', 'order' => 'ASC',
+			'hide_empty' => true, 'exclude' => '', 'exclude_tree' => '', 'include' => '',
+			'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '',
+			'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '',
+			'pad_counts' => false, 'offset' => '', 'search' => '');
+		$args = wp_parse_args( $args, $defaults );
+		$args['number'] = absint( $args['number'] );
+		$args['offset'] = absint( $args['offset'] );
+		if ( !$single_taxonomy || !$this->is_taxonomy_hierarchical($taxonomies[0]) ||
+			'' !== $args['parent'] ) {
+			$args['child_of'] = 0;
+			$args['hierarchical'] = false;
+			$args['pad_counts'] = false;
+		}
+
+		if ( 'all' == $args['get'] ) {
+			$args['child_of'] = 0;
+			$args['hide_empty'] = 0;
+			$args['hierarchical'] = false;
+			$args['pad_counts'] = false;
+		}
+		extract($args, EXTR_SKIP);
+
+		if ( $child_of ) {
+			$hierarchy = $this->_get_term_hierarchy($taxonomies[0]);
+			if ( !isset($hierarchy[$child_of]) )
+				return $empty_array;
+		}
+
+		if ( $parent ) {
+			$hierarchy = $this->_get_term_hierarchy($taxonomies[0]);
+			if ( !isset($hierarchy[$parent]) )
+				return $empty_array;
+		}
+
+		// $args can be whatever, only use the args defined in defaults to compute the key
+		$filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : '';
+		$key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key );
+		$last_changed = wp_cache_get('last_changed', 'terms');
+		if ( !$last_changed ) {
+			$last_changed = time();
+			wp_cache_set('last_changed', $last_changed, 'terms');
+		}
+		$cache_key = "get_terms:$key:$last_changed";
+		$cache = wp_cache_get( $cache_key, 'terms' );
+		if ( false !== $cache ) {
+			$cache = apply_filters('get_terms', $cache, $taxonomies, $args);
+			return $cache;
+		}
+
+		$_orderby = strtolower($orderby);
+		if ( 'count' == $_orderby )
+			$orderby = 'tt.count';
+		else if ( 'name' == $_orderby )
+			$orderby = 't.name';
+		else if ( 'slug' == $_orderby )
+			$orderby = 't.slug';
+		else if ( 'term_group' == $_orderby )
+			$orderby = 't.term_group';
+		elseif ( empty($_orderby) || 'id' == $_orderby )
+			$orderby = 't.term_id';
+
+		$orderby = apply_filters( 'get_terms_orderby', $orderby, $args );
+
+		$where = '';
+		$inclusions = '';
+		if ( !empty($include) ) {
+			$exclude = '';
+			$exclude_tree = '';
+			$interms = preg_split('/[\s,]+/',$include);
+			if ( count($interms) ) {
+				foreach ( (array) $interms as $interm ) {
+					if (empty($inclusions))
+						$inclusions = ' AND ( t.term_id = ' . intval($interm) . ' ';
+					else
+						$inclusions .= ' OR t.term_id = ' . intval($interm) . ' ';
+				}
+			}
+		}
+
+		if ( !empty($inclusions) )
+			$inclusions .= ')';
+		$where .= $inclusions;
+
+		$exclusions = '';
+		if ( ! empty( $exclude_tree ) ) {
+			$excluded_trunks = preg_split('/[\s,]+/',$exclude_tree);
+			foreach( (array) $excluded_trunks as $extrunk ) {
+				$excluded_children = (array) $this->get_terms($taxonomies[0], array('child_of' => intval($extrunk), 'fields' => 'ids'));
+				$excluded_children[] = $extrunk;
+				foreach( (array) $excluded_children as $exterm ) {
+					if ( empty($exclusions) )
+						$exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
+					else
+						$exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';
+
+				}
+			}
+		}
+		if ( !empty($exclude) ) {
+			$exterms = preg_split('/[\s,]+/',$exclude);
+			if ( count($exterms) ) {
+				foreach ( (array) $exterms as $exterm ) {
+					if ( empty($exclusions) )
+						$exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
+					else
+						$exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';
+				}
+			}
+		}
+
+		if ( !empty($exclusions) )
+			$exclusions .= ')';
+		$exclusions = apply_filters('list_terms_exclusions', $exclusions, $args );
+		$where .= $exclusions;
+
+		if ( !empty($slug) ) {
+			$slug =  $this->sanitize_term_slug($slug);
+			$where .= " AND t.slug = '$slug'";
+		}
+
+		if ( !empty($name__like) )
+			$where .= " AND t.name LIKE '{$name__like}%'";
+
+		if ( '' !== $parent ) {
+			$parent = (int) $parent;
+			$where .= " AND tt.parent = '$parent'";
+		}
+
+		if ( $hide_empty && !$hierarchical )
+			$where .= ' AND tt.count > 0';
+
+		// don't limit the query results when we have to descend the family tree
+		if ( ! empty($number) && ! $hierarchical && empty( $child_of ) && '' === $parent ) {
+			if( $offset )
+				$limit = 'LIMIT ' . $offset . ',' . $number;
+			else
+				$limit = 'LIMIT ' . $number;
+
+		} else
+			$limit = '';
+
+		if ( !empty($search) ) {
+			$search = like_escape($search);
+			$where .= " AND (t.name LIKE '%$search%')";
+		}
+
+		if ( !in_array( $fields, array( 'all', 'ids', 'names', 'tt_ids' ) ) )
+			$fields = 'all';
+
+		$selects = array();
+		if ( 'all' == $fields )
+			$selects = array('t.*', 'tt.*');
+		else if ( 'ids' == $fields )
+			$selects = array('t.term_id', 'tt.parent', 'tt.count');
+		else if ( 'names' == $fields )
+			$selects = array('t.term_id', 'tt.parent', 'tt.count', 't.name');
+	        $select_this = implode(', ', apply_filters( 'get_terms_fields', $selects, $args ));
+
+		$query = "SELECT $select_this FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where ORDER BY $orderby $order $limit";
+
+		$terms = $this->db->get_results($query);
+		if ( 'all' == $fields ) {
+			$this->update_term_cache($terms);
+		}
+
+		if ( empty($terms) ) {
+			wp_cache_add( $cache_key, array(), 'terms' );
+			$terms = apply_filters('get_terms', array(), $taxonomies, $args);
+			return $terms;
+		}
+
+		if ( $child_of || $hierarchical ) {
+			$children = $this->_get_term_hierarchy($taxonomies[0]);
+			if ( ! empty($children) )
+				$terms = & $this->_get_term_children($child_of, $terms, $taxonomies[0]);
+		}
+
+		// Update term counts to include children.
+		if ( $pad_counts )
+			$this->_pad_term_counts($terms, $taxonomies[0]);
+
+		// Make sure we show empty categories that have children.
+		if ( $hierarchical && $hide_empty && is_array($terms) ) {
+			foreach ( $terms as $k => $term ) {
+				if ( ! $term->count ) {
+					$children = $this->_get_term_children($term->term_id, $terms, $taxonomies[0]);
+					if( is_array($children) )
+						foreach ( $children as $child )
+							if ( $child->count )
+								continue 2;
+
+					// It really is empty
+					unset($terms[$k]);
+				}
+			}
+		}
+		reset ( $terms );
+
+		$_terms = array();
+		if ( 'ids' == $fields ) {
+			while ( $term = array_shift($terms) )
+				$_terms[] = $term->term_id;
+			$terms = $_terms;
+		} elseif ( 'names' == $fields ) {
+			while ( $term = array_shift($terms) )
+				$_terms[] = $term->name;
+			$terms = $_terms;
+		}
+
+		if ( 0 < $number && intval(@count($terms)) > $number ) {
+			$terms = array_slice($terms, $offset, $number);
+		}
+
+		wp_cache_add( $cache_key, $terms, 'terms' );
+
+		$terms = apply_filters('get_terms', $terms, $taxonomies, $args);
+		return $terms;
+	}
+
+	/**
+	 * Check if Term exists.
+	 *
+	 * Returns the index of a defined term, or 0 (false) if the term doesn't exist.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @param int|string $term The term to check
+	 * @param string $taxonomy The taxonomy name to use
+	 * @param int $parent ID of parent term under which to confine the exists search.
+	 * @return mixed Get the term id or Term Object, if exists.
+	 */
+	function is_term($term, $taxonomy = '', $parent = 0) {
+		$select = "SELECT term_id FROM {$this->db->terms} as t WHERE ";
+		$tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} as tt ON tt.term_id = t.term_id WHERE ";
+		
+		if ( is_int($term) ) {
+			if ( 0 == $term )
+				return 0;
+			$where = 't.term_id = %d';
+			if ( !empty($taxonomy) )
+				return $this->db->get_row( $this->db->prepare( $tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy ), ARRAY_A );
+			else
+				return $this->db->get_var( $this->db->prepare( $select . $where, $term ) );
+		}
+
+		$term = trim( stripslashes( $term ) );
+
+		if ( '' === $slug = $this->sanitize_term_slug($term) )
+			return 0;
+
+		$where = 't.slug = %s';
+		$else_where = 't.name = %s';
+		$where_fields = array($slug);
+		$else_where_fields = array($term);
+		if ( !empty($taxonomy) ) {
+			$parent = (int) $parent;
+			if ( $parent > 0 ) {
+				$where_fields[] = $parent;
+				$else_where_fields[] = $parent;
+				$where .= ' AND tt.parent = %d';
+				$else_where .= ' AND tt.parent = %d';
+			}
+
+			$where_fields[] = $taxonomy;
+			$else_where_fields[] = $taxonomy;
+
+			if ( $result = $this->db->get_row( $this->db->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A) )
+				return $result;
+
+			return $this->db->get_row( $this->db->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} as tt ON tt.term_id = t.term_id WHERE $else_where AND tt.taxonomy = %s", $else_where_fields), ARRAY_A);
+		}
+
+		if ( $result = $this->db->get_var( $this->db->prepare("SELECT term_id FROM {$this->db->terms} as t WHERE $where", $where_fields) ) )
+			return $result;
+
+		return $this->db->get_var( $this->db->prepare("SELECT term_id FROM {$this->db->terms} as t WHERE $else_where", $else_where_fields) );
+	}
+
+	function sanitize_term_slug( $title, $taxonomy = '', $term_id = 0 ) {
+		return apply_filters( 'pre_term_slug', $title, $taxonomy, $term_id );
+	}
+
+	function format_to_edit( $text ) {
+		return format_to_edit( $text );
+	}
+
+	/**
+	 * Sanitize Term all fields
+	 *
+	 * Relies on sanitize_term_field() to sanitize the term. The difference
+	 * is that this function will sanitize <strong>all</strong> fields. The
+	 * context is based on sanitize_term_field().
+	 *
+	 * The $term is expected to be either an array or an object.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @uses $this->sanitize_term_field Used to sanitize all fields in a term
+	 *
+	 * @param array|object $term The term to check
+	 * @param string $taxonomy The taxonomy name to use
+	 * @param string $context Default is 'display'.
+	 * @return array|object Term with all fields sanitized
+	 */
+	function sanitize_term($term, $taxonomy, $context = 'display') {
+
+		if ( 'raw' == $context )
+			return $term;
+
+		$fields = array('term_id', 'name', 'description', 'slug', 'count', 'parent', 'term_group');
+
+		$do_object = false;
+		if ( is_object($term) )
+			$do_object = true;
+
+		$term_id = $do_object ? $term->term_id : (isset($term['term_id']) ? $term['term_id'] : 0);
+
+		foreach ( (array) $fields as $field ) {
+			if ( $do_object ) {
+				if ( isset($term->$field) )
+					$term->$field = $this->sanitize_term_field($field, $term->$field, $term_id, $taxonomy, $context);
+			} else {
+				if ( isset($term[$field]) )
+					$term[$field] = $this->sanitize_term_field($field, $term[$field], $term_id, $taxonomy, $context);
+			}
+		}
+
+		if ( $do_object )
+			$term->filter = $context;
+		else
+			$term['filter'] = $context;
+
+		return $term;
+	}
+
+	/**
+	 * Cleanse the field value in the term based on the context.
+	 *
+	 * Passing a term field value through the function should be assumed to have
+	 * cleansed the value for whatever context the term field is going to be used.
+	 *
+	 * If no context or an unsupported context is given, then default filters will
+	 * be applied.
+	 *
+	 * There are enough filters for each context to support a custom filtering
+	 * without creating your own filter function. Simply create a function that
+	 * hooks into the filter you need.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @param string $field Term field to sanitize
+	 * @param string $value Search for this term value
+	 * @param int $term_id Term ID
+	 * @param string $taxonomy Taxonomy Name
+	 * @param string $context Either edit, db, display, attribute, or js.
+	 * @return mixed sanitized field
+	 */
+	function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
+		if ( 'parent' == $field  || 'term_id' == $field || 'count' == $field || 'term_group' == $field ) {
+			$value = (int) $value;
+			if ( $value < 0 )
+				$value = 0;
+		}
+
+		if ( 'raw' == $context )
+			return $value;
+
+		if ( 'edit' == $context ) {
+			$value = apply_filters("edit_term_$field", $value, $term_id, $taxonomy);
+			$value = apply_filters("edit_${taxonomy}_$field", $value, $term_id);
+			if ( 'description' == $field )
+				$value = $this->format_to_edit($value);
+			else
+				$value = esc_attr($value);
+		} else if ( 'db' == $context ) {
+			$value = apply_filters("pre_term_$field", $value, $taxonomy);
+			$value = apply_filters("pre_${taxonomy}_$field", $value);
+			// WP DIFF
+		} else if ( 'rss' == $context ) {
+			$value = apply_filters("term_${field}_rss", $value, $taxonomy);
+			$value = apply_filters("${taxonomy}_${field}_rss", $value);
+		} else {
+			// Use display filters by default.
+			$value = apply_filters("term_$field", $value, $term_id, $taxonomy, $context);
+			$value = apply_filters("${taxonomy}_$field", $value, $term_id, $context);
+		}
+
+		if ( 'attribute' == $context )
+			$value = esc_attr($value);
+		else if ( 'js' == $context )
+			$value = esc_js($value);
+
+		return $value;
+	}
+
+	/**
+	 * Count how many terms are in Taxonomy.
+	 *
+	 * Default $args is 'ignore_empty' which can be <code>'ignore_empty=true'</code>
+	 * or <code>array('ignore_empty' => true);</code>.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @uses wp_parse_args() Turns strings into arrays and merges defaults into an array.
+	 *
+	 * @param string $taxonomy Taxonomy name
+	 * @param array|string $args Overwrite defaults
+	 * @return int How many terms are in $taxonomy
+	 */
+	function count_terms( $taxonomy, $args = array() ) {
+		$defaults = array('ignore_empty' => false);
+		$args = wp_parse_args($args, $defaults);
+		extract($args, EXTR_SKIP);
+
+		$where = '';
+		if ( $ignore_empty )
+			$where = 'AND count > 0';
+
+		return $this->db->get_var( $this->db->prepare( "SELECT COUNT(*) FROM {$this->db->term_taxonomy} WHERE taxonomy = %s $where", $taxonomy ) );
+	}
+
+	/**
+	 * Will unlink the term from the taxonomy.
+	 *
+	 * Will remove the term's relationship to the taxonomy, not the term or taxonomy
+	 * itself. The term and taxonomy will still exist. Will require the term's
+	 * object ID to perform the operation.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @param int $object_id The term Object Id that refers to the term
+	 * @param string|array $taxonomy List of Taxonomy Names or single Taxonomy name.
+	 */
+	function delete_object_term_relationships( $object_id, $taxonomies ) {
+		$object_id = (int) $object_id;
+
+		if ( !is_array($taxonomies) )
+			$taxonomies = array($taxonomies);
+
+		foreach ( (array) $taxonomies as $taxonomy ) {
+			$terms = $this->get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids'));
+			$in_terms = "'" . implode("', '", $terms) . "'";
+			$this->db->query( $this->db->prepare( "DELETE FROM {$this->db->term_relationships} WHERE object_id = %d AND term_taxonomy_id IN ($in_terms)", $object_id ) );
+			$this->update_term_count($terms, $taxonomy);
+		}
+	}
+
+	/**
+	 * Removes a term from the database.
+	 *
+	 * If the term is a parent of other terms, then the children will be updated to
+	 * that term's parent.
+	 *
+	 * The $args 'default' will only override the terms found, if there is only one
+	 * term found. Any other and the found terms are used.
+	 *
+	 * The $args 'force_default' will force the term supplied as default to be
+	 * assigned even if the object was not going to be termless
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @uses do_action() Calls both 'delete_term' and 'delete_$taxonomy' action
+	 *  hooks, passing term object, term id. 'delete_term' gets an additional
+	 *  parameter with the $taxonomy parameter.
+	 *
+	 * @param int $term Term ID
+	 * @param string $taxonomy Taxonomy Name
+	 * @param array|string $args Optional. Change 'default' term id and override found term ids.
+	 * @return bool|WP_Error Returns false if not term; true if completes delete action.
+	 */
+	function delete_term( $term, $taxonomy, $args = array() ) {
+		$term = (int) $term;
+
+		if ( ! $ids = $this->is_term($term, $taxonomy) )
+			return false;
+		if ( is_wp_error( $ids ) )
+			return $ids;
+
+		$tt_id = $ids['term_taxonomy_id'];
+
+		$defaults = array();
+		$args = wp_parse_args($args, $defaults);
+		extract($args, EXTR_SKIP);
+
+		if ( isset($default) ) {
+			$default = (int) $default;
+			if ( !$this->is_term($default, $taxonomy) )
+				unset($default);
+		}
+
+		// Update children to point to new parent
+		if ( $this->is_taxonomy_hierarchical($taxonomy) ) {
+			$term_obj = $this->get_term($term, $taxonomy);
+			if ( is_wp_error( $term_obj ) )
+				return $term_obj;
+			$parent = $term_obj->parent;
+
+			$this->db->update( $this->db->term_taxonomy, compact( 'parent' ), array( 'parent' => $term_obj->term_id ) + compact( 'taxonomy' ) );
+		}
+
+		$objects = $this->db->get_col( $this->db->prepare( "SELECT object_id FROM {$this->db->term_relationships} WHERE term_taxonomy_id = %d", $tt_id ) );
+
+		foreach ( (array) $objects as $object ) {
+			$terms = $this->get_object_terms($object, $taxonomy, array('fields' => 'ids', 'orderby' => 'none'));
+			if ( 1 == count($terms) && isset($default) ) {
+				$terms = array($default);
+			} else {
+				$terms = array_diff($terms, array($term));
+				if (isset($default) && isset($force_default) && $force_default)
+					$terms = array_merge($terms, array($default));
+			}
+			$terms = array_map('intval', $terms);
+			$this->set_object_terms($object, $terms, $taxonomy);
+		}
+
+		$this->db->query( $this->db->prepare( "DELETE FROM {$this->db->term_taxonomy} WHERE term_taxonomy_id = %d", $tt_id ) );
+
+		// Delete the term if no taxonomies use it.
+		if ( !$this->db->get_var( $this->db->prepare( "SELECT COUNT(*) FROM {$this->db->term_taxonomy} WHERE term_id = %d", $term) ) )
+			$this->db->query( $this->db->prepare( "DELETE FROM {$this->db->terms} WHERE term_id = %d", $term) );
+
+		$this->clean_term_cache($term, $taxonomy);
+
+		do_action('delete_term', $term, $tt_id, $taxonomy);
+		do_action("delete_$taxonomy", $term, $tt_id);
+
+		return true;
+	}
+
+	/**
+	 * Retrieves the terms associated with the given object(s), in the supplied taxonomies.
+	 *
+	 * The following information has to do the $args parameter and for what can be
+	 * contained in the string or array of that parameter, if it exists.
+	 *
+	 * The first argument is called, 'orderby' and has the default value of 'name'.
+	 * The other value that is supported is 'count'.
+	 *
+	 * The second argument is called, 'order' and has the default value of 'ASC'.
+	 * The only other value that will be acceptable is 'DESC'.
+	 *
+	 * The final argument supported is called, 'fields' and has the default value of
+	 * 'all'. There are multiple other options that can be used instead. Supported
+	 * values are as follows: 'all', 'ids', 'names', and finally
+	 * 'all_with_object_id'.
+	 *
+	 * The fields argument also decides what will be returned. If 'all' or
+	 * 'all_with_object_id' is choosen or the default kept intact, then all matching
+	 * terms objects will be returned. If either 'ids' or 'names' is used, then an
+	 * array of all matching term ids or term names will be returned respectively.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @param int|array $object_id The id of the object(s) to retrieve.
+	 * @param string|array $taxonomies The taxonomies to retrieve terms from.
+	 * @param array|string $args Change what is returned
+	 * @return array|WP_Error The requested term data or empty array if no terms found. WP_Error if $taxonomy does not exist.
+	 */
+	function get_object_terms($object_ids, $taxonomies, $args = array()) {
+		if ( !is_array($taxonomies) )
+			$taxonomies = array($taxonomies);
+
+		foreach ( (array) $taxonomies as $taxonomy ) {
+			if ( !$this->is_taxonomy($taxonomy) )
+				return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
+		}
+
+		if ( !is_array($object_ids) )
+			$object_ids = array($object_ids);
+		$object_ids = array_map('intval', $object_ids);
+
+		$defaults = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all');
+		$args = wp_parse_args( $args, $defaults );
+
+		$terms = array();
+		if ( count($taxonomies) > 1 ) {
+			foreach ( $taxonomies as $index => $taxonomy ) {
+				$t = $this->get_taxonomy($taxonomy);
+				if ( isset($t->args) && is_array($t->args) && $args != array_merge($args, $t->args) ) {
+					unset($taxonomies[$index]);
+					$terms = array_merge($terms, $this->get_object_terms($object_ids, $taxonomy, array_merge($args, $t->args)));
+				}
+			}
+		} else {
+			$t = $this->get_taxonomy($taxonomies[0]);
+			if ( isset($t->args) && is_array($t->args) )
+				$args = array_merge($args, $t->args);
+		}
+
+		extract($args, EXTR_SKIP);
+
+		if ( 'count' == $orderby )
+			$orderby = 'tt.count';
+		else if ( 'name' == $orderby )
+			$orderby = 't.name';
+		else if ( 'slug' == $orderby )
+			$orderby = 't.slug';
+		else if ( 'term_group' == $orderby )
+			$orderby = 't.term_group';
+		else if ( 'term_order' == $orderby )
+			$orderby = 'tr.term_order';
+		else if ( 'none' == $orderby ) {
+			$orderby = '';
+			$order = '';
+		} else {
+			$orderby = 't.term_id';
+		}
+
+		// tt_ids queries can only be none or tr.term_taxonomy_id
+		if ( ('tt_ids' == $fields) && !empty($orderby) )
+			$orderby = 'tr.term_taxonomy_id';
+
+		if ( !empty($orderby) )
+			$orderby = "ORDER BY $orderby";
+
+		$taxonomies = "'" . implode("', '", $taxonomies) . "'";
+		$object_ids = implode(', ', $object_ids);
+
+		$select_this = '';
+		if ( 'all' == $fields )
+			$select_this = 't.*, tt.*';
+		else if ( 'ids' == $fields )
+			$select_this = 't.term_id';
+		else if ( 'names' == $fields )
+			$select_this = 't.name';
+		else if ( 'all_with_object_id' == $fields )
+			$select_this = 't.*, tt.*, tr.object_id';
+
+		$query = "SELECT $select_this FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} AS tt ON tt.term_id = t.term_id INNER JOIN {$this->db->term_relationships} AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids) $orderby $order";
+
+		if ( 'all' == $fields || 'all_with_object_id' == $fields ) {
+			$terms = array_merge($terms, $this->db->get_results($query));
+			$this->update_term_cache($terms);
+		} else if ( 'ids' == $fields || 'names' == $fields ) {
+			$terms = array_merge($terms, $this->db->get_col($query));
+		} else if ( 'tt_ids' == $fields ) {
+			$terms = $this->db->get_col("SELECT tr.term_taxonomy_id FROM {$this->db->term_relationships} AS tr INNER JOIN {$this->db->term_taxonomy} AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN ($object_ids) AND tt.taxonomy IN ($taxonomies) $orderby $order");
+		}
+
+		if ( ! $terms )
+			$terms = array();
+
+		return apply_filters('wp_get_object_terms', $terms, $object_ids, $taxonomies, $args);
+	}
+
+	/**
+	 * Adds a new term to the database. Optionally marks it as an alias of an existing term.
+	 *
+	 * Error handling is assigned for the nonexistance of the $taxonomy and $term
+	 * parameters before inserting. If both the term id and taxonomy exist
+	 * previously, then an array will be returned that contains the term id and the
+	 * contents of what is returned. The keys of the array are 'term_id' and
+	 * 'term_taxonomy_id' containing numeric values.
+	 *
+	 * It is assumed that the term does not yet exist or the above will apply. The
+	 * term will be first added to the term table and then related to the taxonomy
+	 * if everything is well. If everything is correct, then several actions will be
+	 * run prior to a filter and then several actions will be run after the filter
+	 * is run.
+	 *
+	 * The arguments decide how the term is handled based on the $args parameter.
+	 * The following is a list of the available overrides and the defaults.
+	 *
+	 * 'alias_of'. There is no default, but if added, expected is the slug that the
+	 * term will be an alias of. Expected to be a string.
+	 *
+	 * 'description'. There is no default. If exists, will be added to the database
+	 * along with the term. Expected to be a string.
+	 *
+	 * 'parent'. Expected to be numeric and default is 0 (zero). Will assign value
+	 * of 'parent' to the term.
+	 *
+	 * 'slug'. Expected to be a string. There is no default.
+	 *
+	 * If 'slug' argument exists then the slug will be checked to see if it is not
+	 * a valid term. If that check succeeds (it is not a valid term), then it is
+	 * added and the term id is given. If it fails, then a check is made to whether
+	 * the taxonomy is hierarchical and the parent argument is not empty. If the
+	 * second check succeeds, the term will be inserted and the term id will be
+	 * given.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @uses do_action() Calls 'create_term' hook with the term id and taxonomy id as parameters.
+	 * @uses do_action() Calls 'create_$taxonomy' hook with term id and taxonomy id as parameters.
+	 * @uses apply_filters() Calls 'term_id_filter' hook with term id and taxonomy id as parameters.
+	 * @uses do_action() Calls 'created_term' hook with the term id and taxonomy id as parameters.
+	 * @uses do_action() Calls 'created_$taxonomy' hook with term id and taxonomy id as parameters.
+	 *
+	 * @param int|string $term The term to add or update.
+	 * @param string $taxonomy The taxonomy to which to add the term
+	 * @param array|string $args Change the values of the inserted term
+	 * @return array|WP_Error The Term ID and Term Taxonomy ID
+	 */
+	function insert_term( $term, $taxonomy, $args = array() ) {
+		if ( !$this->is_taxonomy($taxonomy) )
+			return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
+
+		if ( is_int($term) && 0 == $term )
+			return new WP_Error('invalid_term_id', __('Invalid term ID'));
+
+		if ( '' == trim($term) )
+			return new WP_Error('empty_term_name', __('A name is required for this term'));
+
+		$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
+		$args = wp_parse_args($args, $defaults);
+		$args['name'] = $term;
+		$args['taxonomy'] = $taxonomy;
+		$args = $this->sanitize_term($args, $taxonomy, 'db');
+		extract($args, EXTR_SKIP);
+
+		// expected_slashed ($name)
+		$name = stripslashes($name);
+		$description = stripslashes($description);
+
+		if ( empty($slug) )
+			$slug = $this->sanitize_term_slug($name, $taxonomy);
+
+		$term_group = 0;
+		if ( $alias_of ) {
+			$alias = $this->db->get_row( $this->db->prepare( "SELECT term_id, term_group FROM {$this->db->terms} WHERE slug = %s", $alias_of) );
+			if ( $alias->term_group ) {
+				// The alias we want is already in a group, so let's use that one.
+				$term_group = $alias->term_group;
+			} else {
+				// The alias isn't in a group, so let's create a new one and firstly add the alias term to it.
+				$term_group = $this->db->get_var("SELECT MAX(term_group) FROM {$this->db->terms}") + 1;
+				$this->db->query( $this->db->prepare( "UPDATE {$this->db->terms} SET term_group = %d WHERE term_id = %d", $term_group, $alias->term_id ) );
+			}
+		}
+
+		if ( ! $term_id = $this->is_term($slug) ) {
+			if ( false === $this->db->insert( $this->db->terms, compact( 'name', 'slug', 'term_group' ) ) )
+				return new WP_Error('db_insert_error', __('Could not insert term into the database'), $this->db->last_error);
+			$term_id = (int) $this->db->insert_id;
+		} else if ( $this->is_taxonomy_hierarchical($taxonomy) && !empty($parent) ) {
+			// If the taxonomy supports hierarchy and the term has a parent, make the slug unique
+			// by incorporating parent slugs.
+			$slug = $this->unique_term_slug($slug, (object) $args);
+			if ( false === $this->db->insert( $this->db->terms, compact( 'name', 'slug', 'term_group' ) ) )
+				return new WP_Error('db_insert_error', __('Could not insert term into the database'), $this->db->last_error);
+			$term_id = (int) $this->db->insert_id;
+		}
+
+		if ( empty($slug) ) {
+			$slug = $this->sanitize_term_slug($slug, $taxonomy, $term_id);
+			$this->db->update( $this->db->terms, compact( 'slug' ), compact( 'term_id' ) );
+		}
+
+		$tt_id = $this->db->get_var( $this->db->prepare( "SELECT tt.term_taxonomy_id FROM {$this->db->term_taxonomy} AS tt INNER JOIN {$this->db->terms} AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id ) );
+
+		if ( !empty($tt_id) )
+			return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
+
+		$this->db->insert( $this->db->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent') + array( 'count' => 0 ) );
+		$tt_id = (int) $this->db->insert_id;
+
+		do_action("create_term", $term_id, $tt_id);
+		do_action("create_$taxonomy", $term_id, $tt_id);
+
+		$term_id = apply_filters('term_id_filter', $term_id, $tt_id);
+
+		$this->clean_term_cache($term_id, $taxonomy);
+
+		do_action("created_term", $term_id, $tt_id);
+		do_action("created_$taxonomy", $term_id, $tt_id);
+
+		return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
+	}
+
+	/**
+	 * Create Term and Taxonomy Relationships.
+	 *
+	 * Relates an object (post, link etc) to a term and taxonomy type. Creates the
+	 * term and taxonomy relationship if it doesn't already exist. Creates a term if
+	 * it doesn't exist (using the slug).
+	 *
+	 * A relationship means that the term is grouped in or belongs to the taxonomy.
+	 * A term has no meaning until it is given context by defining which taxonomy it
+	 * exists under.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @param int $object_id The object to relate to.
+	 * @param array|int|string $term The slug or id of the term, will replace all existing
+	 * related terms in this taxonomy.
+	 * @param array|string $taxonomy The context in which to relate the term to the object.
+	 * @param bool $append If false will delete difference of terms.
+	 * @return array|WP_Error Affected Term IDs
+	 */
+	function set_object_terms($object_id, $terms, $taxonomy, $append = false) {
+		$object_id = (int) $object_id;
+
+		if ( !$this->is_taxonomy($taxonomy) )
+			return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
+
+		if ( !is_array($terms) )
+			$terms = array($terms);
+
+		if ( ! $append )
+			$old_tt_ids = $this->get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids', 'orderby' => 'none'));
+
+		$tt_ids = array();
+		$term_ids = array();
+
+		foreach ( (array) $terms as $term ) {
+			if ( !strlen(trim($term)) )
+				continue;
+
+			if ( !$id = $this->is_term($term, $taxonomy) )
+				$id = $this->insert_term($term, $taxonomy);
+			if ( is_wp_error($id) )
+				return $id;
+			$term_ids[] = $id['term_id'];
+			$id = $id['term_taxonomy_id'];
+			$tt_ids[] = $id;
+
+			if ( $this->db->get_var( $this->db->prepare( "SELECT term_taxonomy_id FROM {$this->db->term_relationships} WHERE object_id = %d AND term_taxonomy_id = %d", $object_id, $id ) ) )
+				continue;
+			$this->db->insert( $this->db->term_relationships, array( 'object_id' => $object_id, 'term_taxonomy_id' => $id ) );
+		}
+
+		$this->update_term_count($tt_ids, $taxonomy);
+
+		if ( ! $append ) {
+			$delete_terms = array_diff($old_tt_ids, $tt_ids);
+			if ( $delete_terms ) {
+				$in_delete_terms = "'" . implode("', '", $delete_terms) . "'";
+				$this->db->query( $this->db->prepare("DELETE FROM {$this->db->term_relationships} WHERE object_id = %d AND term_taxonomy_id IN ($in_delete_terms)", $object_id) );
+				$this->update_term_count($delete_terms, $taxonomy);
+			}
+		}
+
+		$t = $this->get_taxonomy($taxonomy);
+		if ( ! $append && isset($t->sort) && $t->sort ) {
+			$values = array();
+			$term_order = 0;
+			$final_tt_ids = $this->get_object_terms($object_id, $taxonomy, 'fields=tt_ids');
+			foreach ( $tt_ids as $tt_id )
+				if ( in_array($tt_id, $final_tt_ids) )
+					$values[] = $this->db->prepare( "(%d, %d, %d)", $object_id, $tt_id, ++$term_order);
+			if ( $values )
+				$this->db->query("INSERT INTO {$this->db->term_relationships} (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");
+		}
+
+		do_action('set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append);
+		return $tt_ids;
+	}
+
+	/**
+	 * Will make slug unique, if it isn't already.
+	 *
+	 * The $slug has to be unique global to every taxonomy, meaning that one
+	 * taxonomy term can't have a matching slug with another taxonomy term. Each
+	 * slug has to be globally unique for every taxonomy.
+	 *
+	 * The way this works is that if the taxonomy that the term belongs to is
+	 * heirarchical and has a parent, it will append that parent to the $slug.
+	 *
+	 * If that still doesn't return an unique slug, then it try to append a number
+	 * until it finds a number that is truely unique.
+	 *
+	 * The only purpose for $term is for appending a parent, if one exists.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @param string $slug The string that will be tried for a unique slug
+	 * @param object $term The term object that the $slug will belong too
+	 * @return string Will return a true unique slug.
+	 */
+	function unique_term_slug($slug, $term) {
+		// If the taxonomy supports hierarchy and the term has a parent, make the slug unique
+		// by incorporating parent slugs.
+		if ( $this->is_taxonomy_hierarchical($term->taxonomy) && !empty($term->parent) ) {
+			$the_parent = $term->parent;
+			while ( ! empty($the_parent) ) {
+				$parent_term = $this->get_term($the_parent, $term->taxonomy);
+				if ( is_wp_error($parent_term) || empty($parent_term) )
+					break;
+					$slug .= '-' . $parent_term->slug;
+				if ( empty($parent_term->parent) )
+					break;
+				$the_parent = $parent_term->parent;
+			}
+		}
+
+		// If we didn't get a unique slug, try appending a number to make it unique.
+		if ( !empty($args['term_id']) )
+			$query = $this->db->prepare( "SELECT slug FROM {$this->db->terms} WHERE slug = %s AND term_id != %d", $slug, $args['term_id'] );
+		else
+			$query = $this->db->prepare( "SELECT slug FROM {$this->db->terms} WHERE slug = %s", $slug );
+
+		if ( $this->db->get_var( $query ) ) {
+			$num = 2;
+			do {
+				$alt_slug = $slug . "-$num";
+				$num++;
+				$slug_check = $this->db->get_var( $this->db->prepare( "SELECT slug FROM {$this->db->terms} WHERE slug = %s", $alt_slug ) );
+			} while ( $slug_check );
+			$slug = $alt_slug;
+		}
+
+		return $slug;
+	}
+
+	/**
+	 * Update term based on arguments provided.
+	 *
+	 * The $args will indiscriminately override all values with the same field name.
+	 * Care must be taken to not override important information need to update or
+	 * update will fail (or perhaps create a new term, neither would be acceptable).
+	 *
+	 * Defaults will set 'alias_of', 'description', 'parent', and 'slug' if not
+	 * defined in $args already.
+	 *
+	 * 'alias_of' will create a term group, if it doesn't already exist, and update
+	 * it for the $term.
+	 *
+	 * If the 'slug' argument in $args is missing, then the 'name' in $args will be
+	 * used. It should also be noted that if you set 'slug' and it isn't unique then
+	 * a WP_Error will be passed back. If you don't pass any slug, then a unique one
+	 * will be created for you.
+	 *
+	 * For what can be overrode in $args, check the term scheme can contain and stay
+	 * away from the term keys.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @uses do_action() Will call both 'edit_term' and 'edit_$taxonomy' twice.
+	 * @uses apply_filters() Will call the 'term_id_filter' filter and pass the term
+	 *  id and taxonomy id.
+	 *
+	 * @param int $term_id The ID of the term
+	 * @param string $taxonomy The context in which to relate the term to the object.
+	 * @param array|string $args Overwrite term field values
+	 * @return array|WP_Error Returns Term ID and Taxonomy Term ID
+	 */
+	function update_term( $term_id, $taxonomy, $args = array() ) {
+		if ( !$this->is_taxonomy($taxonomy) )
+			return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
+
+		$term_id = (int) $term_id;
+
+		// First, get all of the original args
+		$term = $this->get_term($term_id, $taxonomy, ARRAY_A);
+
+		if ( is_wp_error( $term ) )
+			return $term;
+
+		// Merge old and new args with new args overwriting old ones.
+		$args = array_merge($term, $args);
+
+		$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
+		$args = wp_parse_args($args, $defaults);
+		$args = $this->sanitize_term($args, $taxonomy, 'db');
+		extract($args, EXTR_SKIP);
+
+		// expected_slashed ($name)
+		$name = stripslashes($name);
+		$description = stripslashes($description);
+
+		if ( '' == trim($name) )
+			return new WP_Error('empty_term_name', __('A name is required for this term'));
+
+		$empty_slug = false;
+		if ( empty($slug) ) {
+			$empty_slug = true;
+			$slug = $this->sanitize_term_slug($name, $taxonomy, $term_id);
+		}
+
+		if ( $alias_of ) {
+			$alias = $this->db->get_row( $this->db->prepare( "SELECT term_id, term_group FROM {$this->db->terms} WHERE slug = %s", $alias_of) );
+			if ( $alias->term_group ) {
+				// The alias we want is already in a group, so let's use that one.
+				$term_group = $alias->term_group;
+			} else {
+				// The alias isn't in a group, so let's create a new one and firstly add the alias term to it.
+				$term_group = $this->db->get_var("SELECT MAX(term_group) FROM {$this->db->terms}") + 1;
+				$this->db->update( $this->db->terms, compact('term_group'), array( 'term_id' => $alias->term_id ) );
+			}
+		}
+
+		// Check for duplicate slug
+		$id = $this->db->get_var( $this->db->prepare( "SELECT term_id FROM {$this->db->terms} WHERE slug = %s", $slug ) );
+		if ( $id && ($id != $term_id) ) {
+			// If an empty slug was passed or the parent changed, reset the slug to something unique.
+			// Otherwise, bail.
+			if ( $empty_slug || ( $parent != $term->parent) )
+				$slug = $this->unique_term_slug($slug, (object) $args);
+			else
+				return new WP_Error('duplicate_term_slug', sprintf(__('The slug &#8220;%s&#8221; is already in use by another term'), $slug));
+		}
+
+		$this->db->update($this->db->terms, compact( 'name', 'slug', 'term_group' ), compact( 'term_id' ) );
+
+		if ( empty($slug) ) {
+			$slug = $this->sanitize_term_slug($name, $taxonomy, $term_id);
+			$this->db->update( $this->db->terms, compact( 'slug' ), compact( 'term_id' ) );
+		}
+
+		$tt_id = $this->db->get_var( $this->db->prepare( "SELECT tt.term_taxonomy_id FROM {$this->db->term_taxonomy} AS tt INNER JOIN {$this->db->terms} AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id) );
+
+		$this->db->update( $this->db->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) );
+
+		do_action("edit_term", $term_id, $tt_id);
+		do_action("edit_$taxonomy", $term_id, $tt_id);
+
+		$term_id = apply_filters('term_id_filter', $term_id, $tt_id);
+
+		$this->clean_term_cache($term_id, $taxonomy);
+
+		do_action("edited_term", $term_id, $tt_id);
+		do_action("edited_$taxonomy", $term_id, $tt_id);
+
+		return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
+	}
+
+	/**
+	 * Enable or disable term counting.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param bool $defer Optional. Enable if true, disable if false.
+	 * @return bool Whether term counting is enabled or disabled.
+	 */
+	function defer_term_counting($defer=NULL) {
+		static $_defer = false;
+
+		if ( is_bool($defer) ) {
+			$_defer = $defer;
+			// flush any deferred counts
+			if ( !$defer )
+				$this->update_term_count( NULL, NULL, true );
+		}
+
+		return $_defer;
+	}
+
+	/**
+	 * Updates the amount of terms in taxonomy.
+	 *
+	 * If there is a taxonomy callback applied, then it will be called for updating
+	 * the count.
+	 *
+	 * The default action is to count what the amount of terms have the relationship
+	 * of term ID. Once that is done, then update the database.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 * @uses $this->db
+	 *
+	 * @param int|array $terms The ID of the terms
+	 * @param string $taxonomy The context of the term.
+	 * @return bool If no terms will return false, and if successful will return true.
+	 */
+	function update_term_count( $terms, $taxonomy, $do_deferred=false ) {
+		static $_deferred = array();
+
+		if ( $do_deferred ) {
+			foreach ( (array) array_keys($_deferred) as $tax ) {
+				$this->update_term_count_now( $_deferred[$tax], $tax );
+				unset( $_deferred[$tax] );
+			}
+		}
+
+		if ( empty($terms) )
+			return false;
+
+		if ( !is_array($terms) )
+			$terms = array($terms);
+
+		if ( $this->defer_term_counting() ) {
+			if ( !isset($_deferred[$taxonomy]) )
+				$_deferred[$taxonomy] = array();
+			$_deferred[$taxonomy] = array_unique( array_merge($_deferred[$taxonomy], $terms) );
+			return true;
+		}
+
+		return $this->update_term_count_now( $terms, $taxonomy );
+	}
+
+	/**
+	 * Perform term count update immediately.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param array $terms The term_taxonomy_id of terms to update.
+	 * @param string $taxonomy The context of the term.
+	 * @return bool Always true when complete.
+	 */
+	function update_term_count_now( $terms, $taxonomy ) {
+		$terms = array_map('intval', $terms);
+
+		$taxonomy = $this->get_taxonomy($taxonomy);
+		if ( !empty($taxonomy->update_count_callback) ) {
+			call_user_func($taxonomy->update_count_callback, $terms);
+		} else {
+			// Default count updater
+			foreach ( (array) $terms as $term ) {
+				$count = $this->db->get_var( $this->db->prepare( "SELECT COUNT(*) FROM {$this->db->term_relationships} WHERE term_taxonomy_id = %d", $term) );
+				$this->db->update( $this->db->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
+			}
+
+		}
+
+		$this->clean_term_cache($terms);
+
+		return true;
+	}
+
+	//
+	// Cache
+	//
+
+	/**
+	 * Removes the taxonomy relationship to terms from the cache.
+	 *
+	 * Will remove the entire taxonomy relationship containing term $object_id. The
+	 * term IDs have to exist within the taxonomy $object_type for the deletion to
+	 * take place.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3
+	 *
+	 * @see $this->get_object_taxonomies() for more on $object_type
+	 * @uses do_action() Will call action hook named, 'clean_object_term_cache' after completion.
+	 *	Passes, function params in same order.
+	 *
+	 * @param int|array $object_ids Single or list of term object ID(s)
+	 * @param string $object_type The taxonomy object type
+	 */
+	function clean_object_term_cache($object_ids, $object_type) {
+		if ( !is_array($object_ids) )
+			$object_ids = array($object_ids);
+
+		foreach ( $object_ids as $id )
+			foreach ( $this->get_object_taxonomies($object_type) as $taxonomy )
+				wp_cache_delete($id, "{$taxonomy}_relationships");
+
+		do_action('clean_object_term_cache', $object_ids, $object_type);
+	}
+
+	/**
+	 * Will remove all of the term ids from the cache.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @param int|array $ids Single or list of Term IDs
+	 * @param string $taxonomy Can be empty and will assume tt_ids, else will use for context.
+	 */
+	function clean_term_cache($ids, $taxonomy = '') {
+		static $cleaned = array();
+
+		if ( !is_array($ids) )
+			$ids = array($ids);
+
+		$taxonomies = array();
+		// If no taxonomy, assume tt_ids.
+		if ( empty($taxonomy) ) {
+			$tt_ids = implode(', ', $ids);
+			$terms = $this->db->get_results("SELECT term_id, taxonomy FROM {$this->db->term_taxonomy} WHERE term_taxonomy_id IN ($tt_ids)");
+			foreach ( (array) $terms as $term ) {
+				$taxonomies[] = $term->taxonomy;
+				wp_cache_delete($term->term_id, $term->taxonomy);
+			}
+			$taxonomies = array_unique($taxonomies);
+		} else {
+			foreach ( $ids as $id ) {
+				wp_cache_delete($id, $taxonomy);
+			}
+			$taxonomies = array($taxonomy);
+		}
+
+		foreach ( $taxonomies as $taxonomy ) {
+			if ( isset($cleaned[$taxonomy]) )
+				continue;
+			$cleaned[$taxonomy] = true;
+			wp_cache_delete('all_ids', $taxonomy);
+			wp_cache_delete('get', $taxonomy);
+			$this->delete_children_cache($taxonomy);
+		}
+
+		wp_cache_delete('get_terms', 'terms');
+
+		do_action('clean_term_cache', $ids, $taxonomy);
+	}
+
+	/**
+	 * Retrieves the taxonomy relationship to the term object id.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @uses wp_cache_get() Retrieves taxonomy relationship from cache
+	 *
+	 * @param int|array $id Term object ID
+	 * @param string $taxonomy Taxonomy Name
+	 * @return bool|array Empty array if $terms found, but not $taxonomy. False if nothing is in cache for $taxonomy and $id.
+	 */
+	function &get_object_term_cache($id, $taxonomy) {
+		$cache = wp_cache_get($id, "{$taxonomy}_relationships");
+		return $cache;
+	}
+
+	/**
+	 * Updates the cache for Term ID(s).
+	 *
+	 * Will only update the cache for terms not already cached.
+	 *
+	 * The $object_ids expects that the ids be separated by commas, if it is a
+	 * string.
+	 *
+	 * It should be noted that update_object_term_cache() is very time extensive. It
+	 * is advised that the function is not called very often or at least not for a
+	 * lot of terms that exist in a lot of taxonomies. The amount of time increases
+	 * for each term and it also increases for each taxonomy the term belongs to.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 * @uses $this->get_object_terms() Used to get terms from the database to update
+	 *
+	 * @param string|array $object_ids Single or list of term object ID(s)
+	 * @param string $object_type The taxonomy object type
+	 * @return null|bool Null value is given with empty $object_ids. False if 
+	 */
+	function update_object_term_cache($object_ids, $object_type) {
+		if ( empty($object_ids) )
+			return;
+
+		if ( !is_array($object_ids) )
+			$object_ids = explode(',', $object_ids);
+
+		$object_ids = array_map('intval', $object_ids);
+
+		$taxonomies = $this->get_object_taxonomies($object_type);
+
+		$ids = array();
+		foreach ( (array) $object_ids as $id ) {
+			foreach ( $taxonomies as $taxonomy ) {
+				if ( false === wp_cache_get($id, "{$taxonomy}_relationships") ) {
+					$ids[] = $id;
+					break;
+				}
+			}
+		}
+
+		if ( empty( $ids ) )
+			return false;
+
+		$terms = $this->get_object_terms($ids, $taxonomies, 'fields=all_with_object_id');
+
+		$object_terms = array();
+		foreach ( (array) $terms as $term )
+			$object_terms[$term->object_id][$term->taxonomy][$term->term_id] = $term;
+
+		foreach ( $ids as $id ) {
+			foreach ( $taxonomies  as $taxonomy ) {
+				if ( ! isset($object_terms[$id][$taxonomy]) ) {
+					if ( !isset($object_terms[$id]) )
+						$object_terms[$id] = array();
+					$object_terms[$id][$taxonomy] = array();
+				}
+			}
+		}
+
+		foreach ( $object_terms as $id => $value ) {
+			foreach ( $value as $taxonomy => $terms ) {
+				wp_cache_set($id, $terms, "{$taxonomy}_relationships");
+			}
+		}
+	}
+
+	/**
+	 * Updates Terms to Taxonomy in cache.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @since 2.3.0
+	 *
+	 * @param array $terms List of Term objects to change
+	 * @param string $taxonomy Optional. Update Term to this taxonomy in cache
+	 */
+	function update_term_cache($terms, $taxonomy = '') {
+		foreach ( (array) $terms as $term ) {
+			$term_taxonomy = $taxonomy;
+			if ( empty($term_taxonomy) )
+				$term_taxonomy = $term->taxonomy;
+
+			wp_cache_add($term->term_id, $term, $term_taxonomy);
+		}
+	}
+
+	//
+	// Private
+	//
+
+	/**
+	 * Retrieves children of taxonomy as Term IDs.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @access private
+	 * @since 2.3.0
+	 *
+	 * @uses backpress_update_option() Stores all of the children in "$taxonomy_children"
+	 *  option. That is the name of the taxonomy, immediately followed by '_children'.
+	 *
+	 * @param string $taxonomy Taxonomy Name
+	 * @return array Empty if $taxonomy isn't hierarachical or returns children as Term IDs.
+	 */
+	function _get_term_hierarchy($taxonomy) {
+		if ( !$this->is_taxonomy_hierarchical($taxonomy) )
+			return array();
+		$children = $this->get_children_cache($taxonomy);
+		if ( is_array($children) )
+			return $children;
+
+		$children = array();
+		$terms = $this->get_terms($taxonomy, 'get=all');
+		foreach ( $terms as $term ) {
+			if ( $term->parent > 0 )
+				$children[$term->parent][] = $term->term_id;
+		}
+		$this->set_children_cache($taxonomy, $children);
+
+		return $children;
+	}
+
+	/**
+	 * Get the subset of $terms that are descendants of $term_id.
+	 *
+	 * If $terms is an array of objects, then _get_term_children returns an array of objects.
+	 * If $terms is an array of IDs, then _get_term_children returns an array of IDs.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @access private
+	 * @since 2.3.0
+	 *
+	 * @param int $term_id The ancestor term: all returned terms should be descendants of $term_id.
+	 * @param array $terms The set of terms---either an array of term objects or term IDs---from which those that are descendants of $term_id will be chosen.
+	 * @param string $taxonomy The taxonomy which determines the hierarchy of the terms.
+	 * @return array The subset of $terms that are descendants of $term_id.
+	 */
+	function &_get_term_children($term_id, $terms, $taxonomy) {
+		$empty_array = array();
+		if ( empty($terms) )
+			return $empty_array;
+
+		$term_list = array();
+		$has_children = $this->_get_term_hierarchy($taxonomy);
+
+		if  ( ( 0 != $term_id ) && ! isset($has_children[$term_id]) )
+			return $empty_array;
+
+		foreach ( (array) $terms as $term ) {
+			$use_id = false;
+			if ( !is_object($term) ) {
+				$term = $this->get_term($term, $taxonomy);
+				if ( is_wp_error( $term ) )
+					return $term;
+				$use_id = true;
+			}
+
+			if ( $term->term_id == $term_id )
+				continue;
+
+			if ( $term->parent == $term_id ) {
+				if ( $use_id )
+					$term_list[] = $term->term_id;
+				else
+					$term_list[] = $term;
+
+				if ( !isset($has_children[$term->term_id]) )
+					continue;
+
+				if ( $children = $this->_get_term_children($term->term_id, $terms, $taxonomy) )
+					$term_list = array_merge($term_list, $children);
+			}
+		}
+
+		return $term_list;
+	}
+
+	/**
+	 * Add count of children to parent count.
+	 *
+	 * Recalculates term counts by including items from child terms. Assumes all
+	 * relevant children are already in the $terms argument.
+	 *
+	 * @package WordPress
+	 * @subpackage Taxonomy
+	 * @access private
+	 * @since 2.3
+	 *
+	 * @param array $terms List of Term IDs
+	 * @param string $taxonomy Term Context
+	 * @return null Will break from function if conditions are not met.
+	 */
+	function _pad_term_counts(&$terms, $taxonomy) {
+		return;
+	}
+
+	/**
+	 * Determine if the given object is associated with any of the given terms.
+	 *
+	 * The given terms are checked against the object's terms' term_ids, names and slugs.
+	 * Terms given as integers will only be checked against the object's terms' term_ids.
+	 * If no terms are given, determines if object is associated with any terms in the given taxonomy.
+	 *
+	 * @since 2.7.0
+	 * @uses WP_Taxonomy::get_object_term_cache()
+	 * @uses WP_Taxonomy::get_object_terms()
+	 *
+	 * @param int $object_id.  ID of the object (post ID, link ID, ...)
+	 * @param string $taxonomy.  Single taxonomy name
+	 * @param int|string|array $terms Optional.  Term term_id, name, slug or array of said
+	 * @return bool|WP_Error. WP_Error on input error.
+	 */
+	function is_object_in_term( $object_id, $taxonomy, $terms = null ) {
+		if ( !$object_id = (int) $object_id )
+			return new WP_Error( 'invalid_object', __( 'Invalid object ID' ) );
+
+		$object_terms = $this->get_object_term_cache( $object_id, $taxonomy );
+		if ( empty( $object_terms ) )
+			 $object_terms = $this->get_object_terms( $object_id, $taxonomy );
+
+		if ( is_wp_error( $object_terms ) )
+			return $object_terms;
+		if ( empty( $object_terms ) )
+			return false;
+		if ( empty( $terms ) )
+			return ( !empty( $object_terms ) );
+
+		$terms = (array) $terms;
+
+		if ( $ints = array_filter( $terms, 'is_int' ) )
+			$strs = array_diff( $terms, $ints );
+		else
+			$strs =& $terms;
+
+		foreach ( $object_terms as $object_term ) {
+			if ( $ints && in_array( $object_term->term_id, $ints ) ) return true; // If int, check against term_id
+			if ( $strs ) {
+				if ( in_array( $object_term->term_id, $strs ) ) return true;
+				if ( in_array( $object_term->name, $strs ) )    return true;
+				if ( in_array( $object_term->slug, $strs ) )    return true;
+			}
+		}
+
+		return false;
+	}
+
+	function get_children_cache( $taxonomy ) { return false; }
+	function set_children_cache( $taxonomy, $children ) {}
+	function delete_children_cache( $taxonomy ) {}
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-users.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-users.php
new file mode 100644
index 0000000000000000000000000000000000000000..3382060466588fd276502d27d9c6e9305aad3193
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-users.php
@@ -0,0 +1,575 @@
+<?php
+
+class WP_Users {
+	var $db;
+
+	function WP_Users( &$db ) {
+		$this->__construct( $db );
+//		register_shutdown_function( array(&$this, '__destruct') );
+	}
+
+	function __construct( &$db ) {
+		$this->db =& $db;
+	}
+
+//	function __destruct() {
+//	}
+
+	function _put_user( $args = null ) {
+		$defaults = array(
+			'ID' => false,
+			'user_login' => '',
+			'user_nicename' => '',
+			'user_email' => '',
+			'user_url' => '',
+			'user_pass' => false,
+			'user_registered' => time(),
+			'display_name' => '',
+			'user_status' => 0,
+			'strict_user_login' => true
+		);
+
+		$fields = array_keys( wp_parse_args( $args ) );
+		$args = wp_parse_args( $args, $defaults );
+		unset($defaults['strict_user_login']);
+
+		if ( isset($args['ID']) && $args['ID'] ) {
+			unset($defaults['ID']);
+			$fields = array_intersect( $fields, array_keys( $defaults ) );
+		} else {
+			$fields = array_keys( $defaults );
+		}
+
+		extract( $args, EXTR_SKIP );
+
+		$ID = (int) $ID;
+
+		if ( !$ID || in_array( 'user_login', $fields ) ) {
+			$user_login = $this->sanitize_user( $user_login, $strict_user_login );
+
+			if ( !$user_login )
+				return new WP_Error( 'user_login', __('Invalid login name') );
+			if ( !$ID && $this->get_user( $user_login, array( 'by' => 'login' ) ) )
+				return new WP_Error( 'user_login', __('Name already exists') );
+		}
+
+		if ( !$ID || in_array( 'user_nicename', $fields ) ) {
+			if ( !$user_nicename = $this->sanitize_nicename( $user_nicename ? $user_nicename : $user_login ) )
+				return new WP_Error( 'user_nicename', __('Invalid nicename') );
+			if ( !$ID && $this->get_user( $user_nicename, array( 'by' => 'nicename' ) ) )
+				return new WP_Error( 'user_nicename', __('Nicename already exists') );
+		}
+
+		if ( !$ID || in_array( 'user_email', $fields ) ) {
+			if ( !$this->is_email( $user_email ) )
+				return new WP_Error( 'user_email', __('Invalid email address') );
+
+			if ( $already_email = $this->get_user( $user_email, array( 'by' => 'email' ) ) ) {
+				// if new user, or if multiple users with that email, or if only one user with that email, but it's not the user being updated
+				if ( !$ID || is_wp_error( $already_email ) || $already_email->ID != $ID )
+					return new WP_Error( 'user_email', __('Email already exists') );
+			}
+		}
+
+		if ( !$ID || in_array( 'user_url', $fields ) ) {
+			$user_url = esc_url( $user_url );
+		}
+
+		if ( !$ID || in_array( 'user_pass', $fields ) ) {
+			if ( !$user_pass )
+				$user_pass = WP_Pass::generate_password();
+			$plain_pass = $user_pass;
+			$user_pass  = WP_Pass::hash_password( $user_pass );
+		}
+
+		if ( !$ID || in_array( 'user_registered', $fields ) ) {
+			if ( !is_numeric($user_registered) )
+				$user_registered = backpress_gmt_strtotime( $user_registered );
+
+			if ( !$user_registered || $user_registered < 0 )
+				return new WP_Error( 'user_registered', __('Invalid registration time') );
+
+			if ( !$user_registered = @gmdate('Y-m-d H:i:s', $user_registered) )
+				return new WP_Error( 'user_registered', __('Invalid registration timestamp') );
+		}
+
+		if ( !$ID || in_array( 'user_display', $fields ) ) {
+			if ( !$display_name )
+				$display_name = $user_login;
+		}
+
+		$db_return = NULL;
+		if ( $ID ) {
+			$db_return = $this->db->update( $this->db->users, compact( $fields ), compact('ID') );
+		} else {
+			$db_return = $this->db->insert( $this->db->users, compact( $fields ) );
+			$ID = $this->db->insert_id;
+		}
+
+		if ( !$db_return )
+			return new WP_Error( 'WP_Users::_put_user', __('Query failed') );
+
+		// Cache the result
+		if ( $ID ) {
+			wp_cache_delete( $ID, 'users' );
+			$this->get_user( $ID, array( 'from_cache' => false ) );
+		}
+
+		$args = compact( array_keys($args) );
+		$args['plain_pass'] = $plain_pass;
+
+		do_action( __CLASS__ . '::' . __FUNCTION__, $args );
+
+		return $args;
+	}
+
+	function new_user( $args = null ) {
+		$args = wp_parse_args( $args );
+		$args['ID'] = false;
+
+		$r = $this->_put_user( $args );
+
+		if ( is_wp_error($r) )
+			return $r;
+
+		do_action( __CLASS__ . '::' . __FUNCTION__, $r, $args );
+
+		return $r;
+	}
+
+	function update_user( $ID, $args = null ) {
+		$args = wp_parse_args( $args );
+
+		$args['output'] = OBJECT;
+		$user = $this->get_user( $ID, $args );
+		if ( !$user || is_wp_error( $user ) )
+			return $user;
+
+		$args['ID'] = $user->ID;
+
+		$r = $this->_put_user( $args );
+
+		if ( is_wp_error($r) )
+			return $r;
+
+		do_action( __CLASS__ . '::' . __FUNCTION__, $r, $args );
+
+		return $r;
+	}
+
+	/**
+	 * set_password() - Updates the user's password with a new encrypted one
+	 *
+	 * For integration with other applications, this function can be
+	 * overwritten to instead use the other package password checking
+	 * algorithm.
+	 *
+	 * @since 2.5
+	 * @uses WP_Pass::hash_password() Used to encrypt the user's password before passing to the database
+	 *
+	 * @param string $password The plaintext new user password
+	 * @param int $user_id User ID
+	 */
+	function set_password( $password, $user_id ) {
+		$user = $this->get_user( $user_id );
+		if ( !$user || is_wp_error( $user ) )
+			return $user;
+
+		$user_id = $user->ID;
+		$hash = WP_Pass::hash_password($password);
+		$this->update_user( $user->ID, array( 'user_pass' => $password ) );
+	}
+
+	// $user_id can be user ID#, user_login, user_email (by specifying by = email)
+	function get_user( $user_id = 0, $args = null ) {
+		$defaults = array( 'output' => OBJECT, 'by' => false, 'from_cache' => true, 'append_meta' => true );
+		$args = wp_parse_args( $args, $defaults );
+		extract( $args, EXTR_SKIP );
+
+		if ( !$user_id ) {
+			return false;
+		}
+
+		// Let's just deal with arrays
+		$user_ids = (array) $user_id;
+
+		if ( !count( $user_ids ) ) {
+			return false;
+		}
+
+		// Validate passed ids
+		$safe_user_ids = array();
+		foreach ( $user_ids as $_user_id ) {
+			switch ( $by ) {
+				case 'login':
+					$safe_user_ids[] = $this->sanitize_user( $_user_id, true );
+					break;
+				case 'email':
+					if ( $this->is_email( $_user_id ) ) {
+						$safe_user_ids[] = $_user_id;
+					}
+					break;
+				case 'nicename':
+					$safe_user_ids[] = $this->sanitize_nicename( $_user_id );
+					break;
+				default:
+					if ( is_numeric( $_user_id ) ) {
+						$safe_user_ids[] = (int) $_user_id;
+					}
+					break;
+			}
+		}
+
+		// No soup for you!
+		if ( !count( $safe_user_ids ) ) {
+			return false;
+		}
+
+		// Name the cache storing non-existant ids and the SQL field to query by
+		switch ( $by ) {
+			case 'login':
+				$non_existant_cache = 'userlogins';
+				$sql_field = 'user_login';
+				break;
+			case 'email':
+				$non_existant_cache = 'useremail';
+				$sql_field = 'user_email';
+				break;
+			case 'nicename':
+				$non_existant_cache = 'usernicename';
+				$sql_field = 'user_nicename';
+				break;
+			default:
+				$non_existant_cache = 'users';
+				$sql_field = 'ID';
+				break;
+		}
+		
+		// Check if the numeric user IDs exist from caches
+		$cached_users = array();
+		if ( $from_cache ) {
+			$existant_user_ids = array();
+			$maybe_existant_user_ids = array();
+			
+			switch ( $by ) {
+				case 'login':
+				case 'email':
+				case 'nicename':
+					foreach ( $safe_user_ids as $_safe_user_id ) {
+						$ID = wp_cache_get( $_safe_user_id, $non_existant_cache );
+						if ( false === $ID ) {
+							$maybe_existant_user_ids[] = $_safe_user_id;
+						} elseif ( 0 !== $ID ) {
+							$existant_user_ids[] = $ID;
+						}
+					}
+					if ( count( $existant_user_ids ) ) {
+						// We need to run again using numeric ids
+						$args['by'] = false;
+						$cached_users = $this->get_user( $existant_user_ids, $args );
+					}
+					break;
+				default:
+					foreach ( $safe_user_ids as $_safe_user_id ) {
+						$user = wp_cache_get( $_safe_user_id, 'users' );
+						if ( false === $user ) {
+							$maybe_existant_user_ids[] = $_safe_user_id;
+						} elseif ( 0 !== $user ) {
+							$cached_users[] = $user;
+						}
+					}
+					break;
+			}
+
+			// No maybes? Then it's definite.
+			if ( !count( $maybe_existant_user_ids ) ) {
+				if ( !count( $cached_users ) ) {
+					// Nothing there sorry
+					return false;
+				}
+
+				// Deal with the case where one record was requested but multiple records are returned
+				if ( !is_array( $user_id ) && $user_id ) {
+					if ( 1 < count( $cached_users ) ) {
+						if ( 'user_email' == $sql_field ) {
+							$err = __( 'Multiple email matches.  Log in with your username.' );
+						} else {
+							$err = sprintf( __( 'Multiple %s matches' ), $sql_field );
+						}
+						return new WP_Error( $sql_field, $err, $args + array( 'user_id' => $user_id, 'unique' => false ) );
+					}
+
+					// If one item was requested, it expects a single user object back
+					$cached_users = array_shift( $cached_users );
+				}
+
+				backpress_convert_object( $cached_users, $output );
+				return $cached_users;
+			}
+
+			// If we get this far, there are some maybes so try and grab them
+		} else {
+			$maybe_existant_user_ids = $safe_user_ids;
+		}
+
+		// Escape the ids for the SQL query
+		$maybe_existant_user_ids = $this->db->escape_deep( $maybe_existant_user_ids );
+
+		// Sort the ids so the MySQL will more consistently cache the query
+		sort( $maybe_existant_user_ids );
+
+		// Get the users from the database
+		$sql = "SELECT * FROM `{$this->db->users}` WHERE `$sql_field` in ('" . join( "','", $maybe_existant_user_ids ) . "');";
+		$db_users = $this->db->get_results( $sql );
+
+		// Merge in the cached users if available
+		if ( count( $cached_users ) ) {
+			// Create a convenient array of database fetched user ids
+			$db_user_ids = array();
+			foreach ( $db_users as $_db_user ) {
+				$db_user_ids[] = $_db_user->ID;
+			}
+			$users = array_merge( $cached_users, $db_users );
+		} else {
+			$users = $db_users;
+		}
+
+		// Deal with the case where one record was requested but multiple records are returned
+		if ( !is_array( $user_id ) && $user_id ) {
+			if ( 1 < count( $users ) ) {
+				if ( 'user_email' == $sql_field ) {
+					$err = __( 'Multiple email matches.  Log in with your username.' );
+				} else {
+					$err = sprintf( __( 'Multiple %s matches' ), $sql_field );
+				}
+				return new WP_Error( $sql_field, $err, $args + array( 'user_id' => $user_id, 'unique' => false ) );
+			}
+		}
+
+		// Create a convenient array of final user ids
+		$final_user_ids = array();
+		foreach ( $users as $_user ) {
+			$final_user_ids[] = $_user->$sql_field;
+		}
+
+		foreach ( $safe_user_ids as $_safe_user_id ) {
+			if ( !in_array( $_safe_user_id, $final_user_ids ) ) {
+				wp_cache_add( $_safe_user_id, 0, $non_existant_cache );
+			}
+		}
+
+		if ( !count( $users ) ) {
+			return false;
+		}
+
+		// Add display names
+		$final_users = array();
+		foreach ( $users as $_user ) {
+			// Make sure there is a display_name set
+			if ( !$_user->display_name ) {
+				$_user->display_name = $_user->user_login;
+			}
+
+			$final_users[] = $_user;
+		}
+
+		// append_meta() does the user object, useremail, userlogins caching
+		if ( $append_meta ) {
+			if ( count( $cached_users ) ) {
+				$db_final_users =array();
+				$cached_final_users = array();
+				foreach ( $final_users as $final_user ) {
+					if ( in_array( $final_user->ID, $db_user_ids ) ) {
+						$db_final_users[] = $final_user;
+					} else {
+						$cached_final_users[] = $final_user;
+					}
+				}
+				$db_final_users = $this->append_meta( $db_final_users );
+				$final_users = array_merge( $cached_final_users, $db_final_users );
+			} else {
+				$final_users = $this->append_meta( $final_users );
+			}
+		}
+
+		// If one item was requested, it expects a single user object back
+		if ( !is_array( $user_id ) && $user_id ) {
+			$final_users = array_shift( $final_users );
+		}
+
+		backpress_convert_object( $final_users, $output );
+		return $final_users;
+	}
+
+	function delete_user( $user_id ) {
+		$user = $this->get_user( $user_id );
+
+		if ( !$user || is_wp_error( $user ) )
+			return $user;
+
+		do_action( 'pre_' . __CLASS__ . '::' . __FUNCTION__, $user->ID );
+
+		$r = $this->db->query( $this->db->prepare( "DELETE FROM {$this->db->users} WHERE ID = %d", $user->ID ) );
+		$this->db->query( $this->db->prepare( "DELETE FROM {$this->db->usermeta} WHERE user_id = %d", $user->ID ) );
+
+		wp_cache_delete( $user->ID, 'users' );
+		wp_cache_delete( $user->user_nicename, 'usernicename' );
+		wp_cache_delete( $user->user_email, 'useremail' );
+		wp_cache_delete( $user->user_login, 'userlogins' );
+
+		do_action( __CLASS__ . '::' . __FUNCTION__, $user->ID );
+
+		return $r;
+	}
+
+	// Used for user meta, but can be used for other meta data (such as bbPress' topic meta)
+	// Should this be in the class or should it be it's own special function?
+	function append_meta( $object, $args = null ) {
+		$defaults = array( 'meta_table' => 'usermeta', 'meta_field' => 'user_id', 'id_field' => 'ID', 'cache_group' => 'users' );
+		$args = wp_parse_args( $args, $defaults );
+		extract( $args, EXTR_SKIP );
+
+		if ( is_array($object) ) {
+			$trans = array();
+			foreach ( array_keys($object) as $i )
+				$trans[$object[$i]->$id_field] =& $object[$i];
+			$ids = join(',', array_keys($trans));
+			if ( $ids && $metas = $this->db->get_results("SELECT $meta_field, meta_key, meta_value FROM {$this->db->$meta_table} WHERE $meta_field IN ($ids) /* WP_Users::append_meta */") ) {
+				usort( $metas, array(&$this, '_append_meta_sort') );
+				foreach ( $metas as $meta ) {
+					if ( empty( $meta->meta_key ) )
+						continue;
+					$trans[$meta->$meta_field]->{$meta->meta_key} = maybe_unserialize( $meta->meta_value );
+					if ( strpos($meta->meta_key, $this->db->prefix) === 0 )
+						$trans[$meta->$meta_field]->{substr($meta->meta_key, strlen($this->db->prefix))} = maybe_unserialize( $meta->meta_value );
+				}
+			}
+			foreach ( array_keys($trans) as $i ) {
+				wp_cache_set( $i, $trans[$i], $cache_group );
+				if ( 'users' == $cache_group ) {
+					wp_cache_set( $trans[$i]->user_login, $i, 'userlogins' );
+					wp_cache_set( $trans[$i]->user_email, $i, 'useremail' );
+					wp_cache_set( $trans[$i]->user_nicename, $i, 'usernicename' );
+				}
+			}
+			return $object;
+		} elseif ( $object ) {
+			if ( $metas = $this->db->get_results("SELECT meta_key, meta_value FROM {$this->db->$meta_table} WHERE $meta_field = '{$object->$id_field}' /* WP_Users::append_meta */") ) {
+				usort( $metas, array(&$this, '_append_meta_sort') );
+				foreach ( $metas as $meta ) {
+					if ( empty( $meta->meta_key ) )
+						continue;
+					$object->{$meta->meta_key} = maybe_unserialize( $meta->meta_value );
+					if ( strpos($meta->meta_key, $this->db->prefix) === 0 )
+						$object->{substr($meta->meta_key, strlen($this->db->prefix))} = maybe_unserialize( $meta->meta_value );
+				}
+			}
+			wp_cache_set( $object->$id_field, $object, $cache_group );
+			if ( 'users' == $cache_group ) {
+				wp_cache_set($object->user_login, $object->ID, 'userlogins');
+				wp_cache_set($object->user_email, $object->ID, 'useremail');
+				wp_cache_set($object->user_nicename, $object->ID, 'usernicename');
+			}
+			return $object;
+		}
+	}
+	
+	/** 
+	 * _append_meta_sort() - sorts meta keys by length to ensure $appended_object->{$bbdb->prefix}key overwrites $appended_object->key as desired
+	 *
+	 * @internal
+	 */
+	function _append_meta_sort( $a, $b ) {
+		return strlen( $a->meta_key ) - strlen( $b->meta_key );
+	}
+
+	function update_meta( $args = null ) {
+		$defaults = array( 'id' => 0, 'meta_key' => null, 'meta_value' => null, 'meta_table' => 'usermeta', 'meta_field' => 'user_id', 'cache_group' => 'users' );
+		$args = wp_parse_args( $args, $defaults );
+		extract( $args, EXTR_SKIP );
+
+		$user = $this->get_user( $id );
+		if ( !$user || is_wp_error($user) )
+			return $user;
+
+		$id = (int) $user->ID;
+
+		if ( is_null($meta_key) || is_null($meta_value) )
+			return false;
+
+		$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
+		if ( 'usermeta' == $meta_table && 'capabilities' == $meta_key )
+			$meta_key = $this->db->prefix . 'capabilities';
+
+		$meta_tuple = compact('id', 'meta_key', 'meta_value', 'meta_table');
+		$meta_tuple = apply_filters( __CLASS__ . '::' . __FUNCTION__, $meta_tuple );
+		extract($meta_tuple, EXTR_OVERWRITE);
+
+		$_meta_value = maybe_serialize( $meta_value );
+
+		$cur = $this->db->get_row( $this->db->prepare( "SELECT * FROM {$this->db->$meta_table} WHERE $meta_field = %d AND meta_key = %s", $id, $meta_key ) );
+
+		if ( !$cur ) {
+			$this->db->insert( $this->db->$meta_table, array( $meta_field => $id, 'meta_key' => $meta_key, 'meta_value' => $_meta_value ) );
+		} elseif ( $cur->meta_value != $meta_value ) {
+			$this->db->update( $this->db->$meta_table, array( 'meta_value' => $_meta_value ), array( $meta_field => $id, 'meta_key' => $meta_key ) );
+		}
+
+
+		wp_cache_delete( $id, $cache_group );
+
+		return true;
+	}
+
+	function delete_meta( $args = null ) {
+		$defaults = array( 'id' => 0, 'meta_key' => null, 'meta_value' => null, 'meta_table' => 'usermeta', 'meta_field' => 'user_id', 'meta_id_field' => 'umeta_id', 'cache_group' => 'users' );
+		$args = wp_parse_args( $args, $defaults );
+		extract( $args, EXTR_SKIP );
+
+		if ( is_numeric($id) )
+			return false;
+
+		$id = (int) $id;
+
+		if ( is_null($meta_key) )
+			return false;
+
+		$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
+
+		$meta_tuple = compact('id', 'meta_key', 'meta_value', 'meta_table');
+		$meta_tuple = apply_filters( __CLASS__ . '::' . __FUNCTION__, $meta_tuple );
+		extract($meta_tuple, EXTR_OVERWRITE);
+
+		$_meta_value = is_null($meta_value) ? null : maybe_serialize( $meta_value );
+
+		if ( is_null($_meta_value) )
+			$meta_id = $this->db->get_var( $this->db->prepare( "SELECT $meta_id_field FROM {$this->db->$meta_table} WHERE $meta_field = %d AND meta_key = %s", $id, $meta_key ) );
+		else
+			$meta_id = $this->db->get_var( $this->db->prepare( "SELECT $meta_id_field FROM {$this->db->$meta_table} WHERE $meta_field = %d AND meta_key = %s AND meta_value = %s", $id, $meta_key, $_meta_value ) );
+
+		if ( !$meta_id )
+			return false;
+
+		if ( is_null($_meta_value) )
+			$this->db->query( $this->db->prepare( "DELETE FROM {$this->db->$meta_table} WHERE $meta_field = %d AND meta_key = %s", $id, $meta_key ) );
+		else
+			$this->db->query( $this->db->prepare( "DELETE FROM {$this->db->$meta_table} WHERE $meta_id_field = %d", $meta_id ) );
+
+		wp_cache_delete( $id, $cache_group );
+
+		return true;
+	}
+
+	function sanitize_user( $user_login, $strict = false ) {
+		return sanitize_user( $user_login, $strict );
+	}
+
+	function sanitize_nicename( $slug ) {
+		return sanitize_title( $slug );
+	}
+
+	function is_email( $email ) {
+		return is_email( $email );
+	}
+
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.bp-options.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.bp-options.php
new file mode 100644
index 0000000000000000000000000000000000000000..75a3fd1ab5b1716204e2adb27fc312ff6fff9fb2
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.bp-options.php
@@ -0,0 +1,64 @@
+<?php
+
+function backpress_get_option( $option )
+{
+	if ( !class_exists('BP_Options') ) {
+		return;
+	}
+
+	return BP_Options::get( $option );
+}
+
+function backpress_add_option( $option, $value )
+{
+	if ( !class_exists('BP_Options') ) {
+		return;
+	}
+
+	return BP_Options::add( $option, $value );
+}
+
+function backpress_update_option( $option, $value )
+{
+	if ( !class_exists('BP_Options') ) {
+		return;
+	}
+
+	return BP_Options::update( $option, $value );
+}
+
+function backpress_delete_option( $option )
+{
+	if ( !class_exists('BP_Options') ) {
+		return;
+	}
+
+	return BP_Options::delete( $option );
+}
+
+function backpress_get_transient( $transient )
+{
+	if ( !class_exists('BP_Transients') ) {
+		return;
+	}
+
+	return BP_Transients::get( $transient );
+}
+
+function backpress_set_transient( $transient, $value, $expiration = 0 )
+{
+	if ( !class_exists('BP_Transients') ) {
+		return;
+	}
+
+	return BP_Transients::set( $transient, $value, $expiration );
+}
+
+function backpress_delete_transient( $transient )
+{
+	if ( !class_exists('BP_Transients') ) {
+		return;
+	}
+
+	return BP_Transients::delete( $transient );
+}
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.compat.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.compat.php
new file mode 100644
index 0000000000000000000000000000000000000000..ad50a97c6e009b76cdda950471a99a90ecae3057
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.compat.php
@@ -0,0 +1,140 @@
+<?php
+// Last sync [WP11537]
+
+/**
+ * BackPress implementation for PHP functions missing from older PHP versions.
+ *
+ * @package PHP
+ * @access private
+ */
+
+if ( !function_exists( 'http_build_query' ) ) {
+	// Added in PHP 5.0.0
+	function http_build_query( $data, $prefix = null, $sep = null )
+	{
+		return _http_build_query( $data, $prefix, $sep );
+	}
+}
+
+if ( !function_exists( '_http_build_query' ) ) {
+	// from php.net (modified by Mark Jaquith to behave like the native PHP5 function)
+	function _http_build_query($data, $prefix = null, $sep = null, $key = '', $urlencode = true)
+	{
+		$ret = array();
+
+		foreach ( (array) $data as $k => $v ) {
+			if ( $urlencode) {
+				$k = urlencode( $k );
+			}
+			if ( is_int( $k ) && $prefix != null ) {
+				$k = $prefix.$k;
+			}
+			if ( !empty( $key ) ) {
+				$k = $key . '%5B' . $k . '%5D';
+			}
+			if ( $v === NULL ) {
+				continue;
+			} elseif ( $v === FALSE ) {
+				$v = '0';
+			}
+
+			if ( is_array( $v ) || is_object( $v ) ) {
+				array_push( $ret, _http_build_query( $v, '', $sep, $k, $urlencode ) );
+			} elseif ( $urlencode ) {
+				array_push( $ret, $k . '=' . urlencode( $v ) );
+			} else {
+				array_push( $ret, $k . '=' . $v );
+			}
+		}
+
+		if ( NULL === $sep ) {
+			$sep = ini_get( 'arg_separator.output' );
+		}
+
+		return implode( $sep, $ret );
+	}
+}
+
+if ( !function_exists( '_' ) ) {
+	// Alias of gettext() - requires l10n functions
+	function _( $string )
+	{
+		return $string;
+	}
+}
+
+if ( !function_exists( 'stripos' ) ) {
+	// Added in PHP 5.0.0
+	function stripos( $haystack, $needle, $offset = 0 )
+	{
+		return strpos( strtolower( $haystack ), strtolower( $needle ), $offset );
+	}
+}
+
+if ( !function_exists( 'hash_hmac' ) ) {
+	// Added in PHP 5.1.2
+	function hash_hmac( $algo, $data, $key, $raw_output = false )
+	{
+		$packs = array( 'md5' => 'H32', 'sha1' => 'H40' );
+
+		if ( !isset( $packs[$algo] ) ) {
+			return false;
+		}
+
+		$pack = $packs[$algo];
+
+		if ( strlen( $key ) > 64 ) {
+			$key = pack( $pack, $algo( $key ) );
+		} elseif ( strlen($key) < 64 ) {
+			$key = str_pad( $key, 64, chr( 0 ) );
+		}
+
+		$ipad = ( substr( $key, 0, 64 ) ^ str_repeat( chr( 0x36 ), 64 ) );
+		$opad = ( substr( $key, 0, 64 ) ^ str_repeat( chr( 0x5C ), 64 ) );
+
+		return $algo( $opad . pack( $pack, $algo ( $ipad . $data ) ) );
+	}
+}
+
+if ( !function_exists( 'mb_substr' ) ) {
+	// Requires multi-byte support in PHP
+	function mb_substr( $str, $start, $length = null, $encoding = null )
+	{
+		return _mb_substr( $str, $start, $length, $encoding );
+	}
+}
+
+if ( !function_exists( '_mb_substr' ) ) {
+	function _mb_substr( $str, $start, $length = null, $encoding = null )
+	{
+		// the solution below, works only for utf-8, so in case of a different
+		// charset, just use built-in substr
+		$charset = backpress_get_option( 'charset' );
+		if ( !in_array( $charset, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
+			return is_null( $length )? substr( $str, $start ) : substr( $str, $start, $length);
+		}
+		// use the regex unicode support to separate the UTF-8 characters into an array
+		preg_match_all( '/./us', $str, $match );
+		$chars = is_null( $length )? array_slice( $match[0], $start ) : array_slice( $match[0], $start, $length );
+		return implode( '', $chars );
+	}
+}
+
+if ( !function_exists( 'htmlspecialchars_decode' ) ) {
+	// Added in PHP 5.1.0
+	// Error checks from PEAR::PHP_Compat
+	function htmlspecialchars_decode( $str, $quote_style = ENT_COMPAT )
+	{
+		if ( !is_scalar( $string ) ) {
+			trigger_error( 'htmlspecialchars_decode() expects parameter 1 to be string, ' . gettype( $string ) . ' given', E_USER_WARNING );
+			return;
+		}
+
+		if ( !is_int( $quote_style ) && $quote_style !== null ) {
+			trigger_error( 'htmlspecialchars_decode() expects parameter 2 to be integer, ' . gettype( $quote_style ) . ' given', E_USER_WARNING );
+			return;
+		}
+
+		return wp_specialchars_decode( $str, $quote_style );
+	}
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.core.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.core.php
new file mode 100644
index 0000000000000000000000000000000000000000..564222f5972dd8ddbbbad18914a83a832b21b92f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.core.php
@@ -0,0 +1,1237 @@
+<?php
+// Last sync [WP11544]
+
+/**
+ * From WP wp-includes/functions.php
+ *
+ * Missing functions are indicated in comments
+ */
+
+/**
+ * Main BackPress API
+ *
+ * @package BackPress
+ */
+
+// ! function mysql2date()
+
+if ( !function_exists('current_time') ) :
+/**
+ * Retrieve the current time based on specified type.
+ *
+ * The 'mysql' type will return the time in the format for MySQL DATETIME field.
+ * The 'timestamp' type will return the current timestamp.
+ *
+ * If $gmt is set to either '1' or 'true', then both types will use GMT time.
+ * if $gmt is false, the output is adjusted with the GMT offset in the WordPress option.
+ *
+ * @since 1.0.0
+ *
+ * @param string $type Either 'mysql' or 'timestamp'.
+ * @param int|bool $gmt Optional. Whether to use GMT timezone. Default is false.
+ * @return int|string String if $type is 'gmt', int if $type is 'timestamp'.
+ */
+function current_time( $type, $gmt = 0 ) {
+	switch ( $type ) {
+		case 'mysql':
+			return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : gmdate( 'Y-m-d H:i:s', ( time() + ( backpress_get_option( 'gmt_offset' ) * 3600 ) ) );
+			break;
+		case 'timestamp':
+			return ( $gmt ) ? time() : time() + ( backpress_get_option( 'gmt_offset' ) * 3600 );
+			break;
+	}
+}
+endif;
+
+// ! function date_i18n()
+// ! function number_format_i18n()
+// ! function size_format()
+// ! function get_weekstartend()
+
+if ( !function_exists('maybe_unserialize') ) :
+/**
+ * Unserialize value only if it was serialized.
+ *
+ * @since 2.0.0
+ *
+ * @param string $original Maybe unserialized original, if is needed.
+ * @return mixed Unserialized data can be any type.
+ */
+function maybe_unserialize( $original ) {
+	if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
+		return @unserialize( $original );
+	return $original;
+}
+endif;
+
+if ( !function_exists('is_serialized') ) :
+/**
+ * Check value to find if it was serialized.
+ *
+ * If $data is not an string, then returned value will always be false.
+ * Serialized data is always a string.
+ *
+ * @since 2.0.5
+ *
+ * @param mixed $data Value to check to see if was serialized.
+ * @return bool False if not serialized and true if it was.
+ */
+function is_serialized( $data ) {
+	// if it isn't a string, it isn't serialized
+	if ( !is_string( $data ) )
+		return false;
+	$data = trim( $data );
+	if ( 'N;' == $data )
+		return true;
+	if ( !preg_match( '/^([adObis]):/', $data, $badions ) )
+		return false;
+	switch ( $badions[1] ) {
+		case 'a' :
+		case 'O' :
+		case 's' :
+			if ( preg_match( "/^{$badions[1]}:[0-9]+:.*[;}]\$/s", $data ) )
+				return true;
+			break;
+		case 'b' :
+		case 'i' :
+		case 'd' :
+			if ( preg_match( "/^{$badions[1]}:[0-9.E-]+;\$/", $data ) )
+				return true;
+			break;
+	}
+	return false;
+}
+endif;
+
+if ( !function_exists('is_serialized_string') ) :
+/**
+ * Check whether serialized data is of string type.
+ *
+ * @since 2.0.5
+ *
+ * @param mixed $data Serialized data
+ * @return bool False if not a serialized string, true if it is.
+ */
+function is_serialized_string( $data ) {
+	// if it isn't a string, it isn't a serialized string
+	if ( !is_string( $data ) )
+		return false;
+	$data = trim( $data );
+	if ( preg_match( '/^s:[0-9]+:.*;$/s', $data ) ) // this should fetch all serialized strings
+		return true;
+	return false;
+}
+endif;
+
+// ! function get_option()
+// ! function wp_protect_special_option()
+// ! function form_option()
+// ! function get_alloptions()
+// ! function wp_load_alloptions()
+// ! function update_option()
+// ! function add_option()
+// ! function delete_option()
+// ! function delete_transient()
+// ! function get_transient()
+// ! function set_transient()
+// ! function wp_user_settings()
+// ! function get_user_setting()
+// ! function set_user_setting()
+// ! function delete_user_setting()
+// ! function get_all_user_settings()
+// ! function wp_set_all_user_settings()
+// ! function delete_all_user_settings()
+
+if ( !function_exists('maybe_serialize') ) :
+/**
+ * Serialize data, if needed.
+ *
+ * @since 2.0.5
+ *
+ * @param mixed $data Data that might be serialized.
+ * @return mixed A scalar data
+ */
+function maybe_serialize( $data ) {
+	if ( is_array( $data ) || is_object( $data ) )
+		return serialize( $data );
+
+	if ( is_serialized( $data ) )
+		return serialize( $data );
+
+	return $data;
+}
+endif;
+
+// ! function make_url_footnote()
+// ! function xmlrpc_getposttitle()
+// ! function xmlrpc_getpostcategory()
+// ! function xmlrpc_removepostdata()
+// ! function debug_fopen()
+// ! function debug_fwrite()
+// ! function debug_fclose()
+// ! function do_enclose()
+// ! function wp_get_http()
+// ! function wp_get_http_headers()
+// ! function is_new_day()
+
+if ( !function_exists( 'build_query' ) ) :
+/**
+ * Build URL query based on an associative and, or indexed array.
+ *
+ * This is a convenient function for easily building url queries. It sets the
+ * separator to '&' and uses _http_build_query() function.
+ *
+ * @see _http_build_query() Used to build the query
+ * @link http://us2.php.net/manual/en/function.http-build-query.php more on what
+ *		http_build_query() does.
+ *
+ * @since 2.3.0
+ *
+ * @param array $data URL-encode key/value pairs.
+ * @return string URL encoded string
+ */
+function build_query( $data ) {
+	return _http_build_query( $data, null, '&', '', false );
+}
+endif;
+
+if ( !function_exists( 'add_query_arg' ) ) :
+/**
+ * Retrieve a modified URL query string.
+ *
+ * You can rebuild the URL and append a new query variable to the URL query by
+ * using this function. You can also retrieve the full URL with query data.
+ *
+ * Adding a single key & value or an associative array. Setting a key value to
+ * emptystring removes the key. Omitting oldquery_or_uri uses the $_SERVER
+ * value.
+ *
+ * @since 1.5.0
+ *
+ * @param mixed $param1 Either newkey or an associative_array
+ * @param mixed $param2 Either newvalue or oldquery or uri
+ * @param mixed $param3 Optional. Old query or uri
+ * @return string New URL query string.
+ */
+function add_query_arg() {
+	$ret = '';
+	if ( is_array( func_get_arg(0) ) ) {
+		if ( @func_num_args() < 2 || false === @func_get_arg( 1 ) )
+			$uri = $_SERVER['REQUEST_URI'];
+		else
+			$uri = @func_get_arg( 1 );
+	} else {
+		if ( @func_num_args() < 3 || false === @func_get_arg( 2 ) )
+			$uri = $_SERVER['REQUEST_URI'];
+		else
+			$uri = @func_get_arg( 2 );
+	}
+
+	if ( $frag = strstr( $uri, '#' ) )
+		$uri = substr( $uri, 0, -strlen( $frag ) );
+	else
+		$frag = '';
+
+	if ( preg_match( '|^https?://|i', $uri, $matches ) ) {
+		$protocol = $matches[0];
+		$uri = substr( $uri, strlen( $protocol ) );
+	} else {
+		$protocol = '';
+	}
+
+	if ( strpos( $uri, '?' ) !== false ) {
+		$parts = explode( '?', $uri, 2 );
+		if ( 1 == count( $parts ) ) {
+			$base = '?';
+			$query = $parts[0];
+		} else {
+			$base = $parts[0] . '?';
+			$query = $parts[1];
+		}
+	} elseif ( !empty( $protocol ) || strpos( $uri, '=' ) === false ) {
+		$base = $uri . '?';
+		$query = '';
+	} else {
+		$base = '';
+		$query = $uri;
+	}
+
+	wp_parse_str( $query, $qs );
+	$qs = urlencode_deep( $qs ); // this re-URL-encodes things that were already in the query string
+	if ( is_array( func_get_arg( 0 ) ) ) {
+		$kayvees = func_get_arg( 0 );
+		$qs = array_merge( $qs, $kayvees );
+	} else {
+		$qs[func_get_arg( 0 )] = func_get_arg( 1 );
+	}
+
+	foreach ( (array) $qs as $k => $v ) {
+		if ( $v === false )
+			unset( $qs[$k] );
+	}
+
+	$ret = build_query( $qs );
+	$ret = trim( $ret, '?' );
+	$ret = preg_replace( '#=(&|$)#', '$1', $ret );
+	$ret = $protocol . $base . $ret . $frag;
+	$ret = rtrim( $ret, '?' );
+	return $ret;
+}
+endif;
+
+if ( !function_exists( 'remove_query_arg' ) ) :
+/**
+ * Removes an item or list from the query string.
+ *
+ * @since 1.5.0
+ *
+ * @param string|array $key Query key or keys to remove.
+ * @param bool $query When false uses the $_SERVER value.
+ * @return string New URL query string.
+ */
+function remove_query_arg( $key, $query=false ) {
+	if ( is_array( $key ) ) { // removing multiple keys
+		foreach ( $key as $k )
+			$query = add_query_arg( $k, false, $query );
+		return $query;
+	}
+	return add_query_arg( $key, false, $query );
+}
+endif;
+
+// ! function add_magic_quotes()
+
+if ( !function_exists( 'wp_remote_fopen' ) ) :
+/**
+ * HTTP request for URI to retrieve content.
+ *
+ * @since 1.5.1
+ * @uses wp_remote_get()
+ *
+ * @param string $uri URI/URL of web page to retrieve.
+ * @return bool|string HTTP content. False on failure.
+ */
+function wp_remote_fopen( $uri ) {
+	$parsed_url = @parse_url( $uri );
+
+	if ( !$parsed_url || !is_array( $parsed_url ) )
+		return false;
+
+	$options = array();
+	$options['timeout'] = 10;
+
+	$response = wp_remote_get( $uri, $options );
+
+	if ( is_wp_error( $response ) )
+		return false;
+
+	return $response['body'];
+}
+endif;
+
+// ! function wp()
+
+if ( !function_exists( 'get_status_header_desc' ) ) :
+/**
+ * Retrieve the description for the HTTP status.
+ *
+ * @since 2.3.0
+ *
+ * @param int $code HTTP status code.
+ * @return string Empty string if not found, or description if found.
+ */
+function get_status_header_desc( $code ) {
+	global $wp_header_to_desc;
+
+	$code = absint( $code );
+
+	if ( !isset( $wp_header_to_desc ) ) {
+		$wp_header_to_desc = array(
+			100 => 'Continue',
+			101 => 'Switching Protocols',
+			102 => 'Processing',
+
+			200 => 'OK',
+			201 => 'Created',
+			202 => 'Accepted',
+			203 => 'Non-Authoritative Information',
+			204 => 'No Content',
+			205 => 'Reset Content',
+			206 => 'Partial Content',
+			207 => 'Multi-Status',
+			226 => 'IM Used',
+
+			300 => 'Multiple Choices',
+			301 => 'Moved Permanently',
+			302 => 'Found',
+			303 => 'See Other',
+			304 => 'Not Modified',
+			305 => 'Use Proxy',
+			306 => 'Reserved',
+			307 => 'Temporary Redirect',
+
+			400 => 'Bad Request',
+			401 => 'Unauthorized',
+			402 => 'Payment Required',
+			403 => 'Forbidden',
+			404 => 'Not Found',
+			405 => 'Method Not Allowed',
+			406 => 'Not Acceptable',
+			407 => 'Proxy Authentication Required',
+			408 => 'Request Timeout',
+			409 => 'Conflict',
+			410 => 'Gone',
+			411 => 'Length Required',
+			412 => 'Precondition Failed',
+			413 => 'Request Entity Too Large',
+			414 => 'Request-URI Too Long',
+			415 => 'Unsupported Media Type',
+			416 => 'Requested Range Not Satisfiable',
+			417 => 'Expectation Failed',
+			422 => 'Unprocessable Entity',
+			423 => 'Locked',
+			424 => 'Failed Dependency',
+			426 => 'Upgrade Required',
+
+			500 => 'Internal Server Error',
+			501 => 'Not Implemented',
+			502 => 'Bad Gateway',
+			503 => 'Service Unavailable',
+			504 => 'Gateway Timeout',
+			505 => 'HTTP Version Not Supported',
+			506 => 'Variant Also Negotiates',
+			507 => 'Insufficient Storage',
+			510 => 'Not Extended'
+		);
+	}
+
+	if ( isset( $wp_header_to_desc[$code] ) )
+		return $wp_header_to_desc[$code];
+	else
+		return '';
+}
+endif;
+
+if ( !function_exists( 'status_header' ) ) :
+/**
+ * Set HTTP status header.
+ *
+ * @since 2.0.0
+ * @uses apply_filters() Calls 'status_header' on status header string, HTTP
+ *		HTTP code, HTTP code description, and protocol string as separate
+ *		parameters.
+ *
+ * @param int $header HTTP status code
+ * @return null Does not return anything.
+ */
+function status_header( $header ) {
+	$text = get_status_header_desc( $header );
+
+	if ( empty( $text ) )
+		return false;
+
+	$protocol = $_SERVER["SERVER_PROTOCOL"];
+	if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
+		$protocol = 'HTTP/1.0';
+	$status_header = "$protocol $header $text";
+	if ( function_exists( 'apply_filters' ) )
+		$status_header = apply_filters( 'status_header', $status_header, $header, $text, $protocol );
+
+	return @header( $status_header, true, $header );
+}
+endif;
+
+if ( !function_exists( 'wp_get_nocache_headers' ) ) :
+/**
+ * Gets the header information to prevent caching.
+ *
+ * The several different headers cover the different ways cache prevention is handled
+ * by different browsers
+ *
+ * @since 2.8
+ *
+ * @uses apply_filters()
+ * @return array The associative array of header names and field values.
+ */
+function wp_get_nocache_headers() {
+	$headers = array(
+		'Expires' => 'Wed, 11 Jan 1984 05:00:00 GMT',
+		'Last-Modified' => gmdate( 'D, d M Y H:i:s' ) . ' GMT',
+		'Cache-Control' => 'no-cache, must-revalidate, max-age=0',
+		'Pragma' => 'no-cache',
+	);
+
+	if ( function_exists('apply_filters') ) {
+		$headers = apply_filters('nocache_headers', $headers);
+	}
+	return $headers;
+}
+endif;
+
+if ( !function_exists( 'nocache_headers' ) ) :
+/**
+ * Sets the headers to prevent caching for the different browsers.
+ *
+ * Different browsers support different nocache headers, so several headers must
+ * be sent so that all of them get the point that no caching should occur.
+ *
+ * @since 2.0.0
+ * @uses wp_get_nocache_headers()
+ */
+function nocache_headers() {
+	$headers = wp_get_nocache_headers();
+	foreach( (array) $headers as $name => $field_value )
+		@header("{$name}: {$field_value}");
+}
+endif;
+
+if ( !function_exists( 'cache_javascript_headers' ) ) :
+/**
+ * Set the headers for caching for 10 days with JavaScript content type.
+ *
+ * @since 2.1.0
+ */
+function cache_javascript_headers() {
+	$expiresOffset = 864000; // 10 days
+	header( "Content-Type: text/javascript; charset=" . backpress_get_option( 'charset' ) );
+	header( "Vary: Accept-Encoding" ); // Handle proxies
+	header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $expiresOffset ) . " GMT" );
+}
+endif;
+
+// ! function get_num_queries()
+// ! function bool_from_yn()
+// ! function do_feed()
+// ! function do_feed_rdf()
+// ! function do_feed_rss()
+// ! function do_feed_rss2()
+// ! function do_feed_atom()
+// ! function do_robots()
+// ! function is_blog_installed()
+// ! function wp_nonce_url()
+// ! function wp_nonce_field()
+
+if ( !function_exists( 'wp_referer_field' ) ) :
+/**
+ * Retrieve or display referer hidden field for forms.
+ *
+ * The referer link is the current Request URI from the server super global. The
+ * input name is '_wp_http_referer', in case you wanted to check manually.
+ *
+ * @package WordPress
+ * @subpackage Security
+ * @since 2.0.4
+ *
+ * @param bool $echo Whether to echo or return the referer field.
+ * @return string Referer field.
+ */
+function wp_referer_field( $echo = true) {
+	$ref = esc_attr( $_SERVER['REQUEST_URI'] );
+	$referer_field = '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />';
+
+	if ( $echo )
+		echo $referer_field;
+	return $referer_field;
+}
+endif;
+
+if ( !function_exists( 'wp_original_referer_field' ) ) :
+/**
+ * Retrieve or display original referer hidden field for forms.
+ *
+ * The input name is '_wp_original_http_referer' and will be either the same
+ * value of {@link wp_referer_field()}, if that was posted already or it will
+ * be the current page, if it doesn't exist.
+ *
+ * @package WordPress
+ * @subpackage Security
+ * @since 2.0.4
+ *
+ * @param bool $echo Whether to echo the original http referer
+ * @param string $jump_back_to Optional, default is 'current'. Can be 'previous' or page you want to jump back to.
+ * @return string Original referer field.
+ */
+function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
+	$jump_back_to = ( 'previous' == $jump_back_to ) ? wp_get_referer() : $_SERVER['REQUEST_URI'];
+	$ref = ( wp_get_original_referer() ) ? wp_get_original_referer() : $jump_back_to;
+	$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( stripslashes( $ref ) ) . '" />';
+	if ( $echo )
+		echo $orig_referer_field;
+	return $orig_referer_field;
+}
+endif;
+
+if ( !function_exists( 'wp_get_referer' ) ) :
+/**
+ * Retrieve referer from '_wp_http_referer', HTTP referer, or current page respectively.
+ *
+ * @package WordPress
+ * @subpackage Security
+ * @since 2.0.4
+ *
+ * @return string|bool False on failure. Referer URL on success.
+ */
+function wp_get_referer() {
+	$ref = '';
+	if ( ! empty( $_REQUEST['_wp_http_referer'] ) )
+		$ref = $_REQUEST['_wp_http_referer'];
+	else if ( ! empty( $_SERVER['HTTP_REFERER'] ) )
+		$ref = $_SERVER['HTTP_REFERER'];
+
+	if ( $ref !== $_SERVER['REQUEST_URI'] )
+		return $ref;
+	return false;
+}
+endif;
+
+if ( !function_exists( 'wp_get_original_referer' ) ) :
+/**
+ * Retrieve original referer that was posted, if it exists.
+ *
+ * @package WordPress
+ * @subpackage Security
+ * @since 2.0.4
+ *
+ * @return string|bool False if no original referer or original referer if set.
+ */
+function wp_get_original_referer() {
+	if ( !empty( $_REQUEST['_wp_original_http_referer'] ) )
+		return $_REQUEST['_wp_original_http_referer'];
+	return false;
+}
+endif;
+
+// ! function wp_mkdir_p()
+// ! function path_is_absolute()
+// ! function path_join()
+// ! function wp_upload_dir()
+// ! function wp_unique_filename()
+// ! function wp_upload_bits()
+// ! function wp_ext2type()
+// ! function wp_check_filetype()
+// ! function wp_explain_nonce()
+// ! function wp_nonce_ays()
+// ! function wp_die()
+// ! function _config_wp_home()
+// ! function _config_wp_siteurl()
+// ! function _mce_set_direction()
+// ! function smilies_init()
+
+if ( !function_exists('wp_parse_args') ) :
+/**
+ * Merge user defined arguments into defaults array.
+ *
+ * This function is used throughout WordPress to allow for both string or array
+ * to be merged into another array.
+ *
+ * @since 2.2.0
+ *
+ * @param string|array $args Value to merge with $defaults
+ * @param array $defaults Array that serves as the defaults.
+ * @return array Merged user defined values with defaults.
+ */
+function wp_parse_args( $args, $defaults = '' ) {
+	if ( is_object( $args ) )
+		$r = get_object_vars( $args );
+	elseif ( is_array( $args ) )
+		$r =& $args;
+	else
+		wp_parse_str( $args, $r );
+
+	if ( is_array( $defaults ) )
+		return array_merge( $defaults, $r );
+	return $r;
+}
+endif;
+
+// ! function wp_maybe_load_widgets()
+// ! function wp_widgets_add_menu()
+// ! function wp_ob_end_flush_all()
+// ! function require_wp_db()
+// ! function dead_db()
+
+if ( !function_exists('absint') ) :
+/**
+ * Converts value to nonnegative integer.
+ *
+ * @since 2.5.0
+ *
+ * @param mixed $maybeint Data you wish to have convered to an nonnegative integer
+ * @return int An nonnegative integer
+ */
+function absint( $maybeint ) {
+	return abs( intval( $maybeint ) );
+}
+endif;
+
+// ! function url_is_accessable_via_ssl()
+// ! function atom_service_url_filter()
+// ! function _deprecated_function()
+// ! function _deprecated_file()
+
+if ( !function_exists('is_lighttpd_before_150') ) :
+/**
+ * Is the server running earlier than 1.5.0 version of lighttpd
+ *
+ * @since 2.5.0
+ *
+ * @return bool Whether the server is running lighttpd < 1.5.0
+ */
+function is_lighttpd_before_150() {
+	$server_parts = explode( '/', isset( $_SERVER['SERVER_SOFTWARE'] )? $_SERVER['SERVER_SOFTWARE'] : '' );
+	$server_parts[1] = isset( $server_parts[1] )? $server_parts[1] : '';
+	return  'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' );
+}
+endif;
+
+if ( !function_exists('apache_mod_loaded') ) :
+/**
+ * Does the specified module exist in the apache config?
+ *
+ * @since 2.5.0
+ *
+ * @param string $mod e.g. mod_rewrite
+ * @param bool $default The default return value if the module is not found
+ * @return bool
+ */
+function apache_mod_loaded($mod, $default = false) {
+	global $is_apache;
+
+	if ( !$is_apache )
+		return false;
+
+	if ( function_exists('apache_get_modules') ) {
+		$mods = apache_get_modules();
+		if ( in_array($mod, $mods) )
+			return true;
+	} elseif ( function_exists('phpinfo') ) {
+			ob_start();
+			phpinfo(8);
+			$phpinfo = ob_get_clean();
+			if ( false !== strpos($phpinfo, $mod) )
+				return true;
+	}
+	return $default;
+}
+endif;
+
+if ( !function_exists('validate_file') ) :
+/**
+ * File validates against allowed set of defined rules.
+ *
+ * A return value of '1' means that the $file contains either '..' or './'. A
+ * return value of '2' means that the $file contains ':' after the first
+ * character. A return value of '3' means that the file is not in the allowed
+ * files list.
+ *
+ * @since 1.2.0
+ *
+ * @param string $file File path.
+ * @param array $allowed_files List of allowed files.
+ * @return int 0 means nothing is wrong, greater than 0 means something was wrong.
+ */
+function validate_file( $file, $allowed_files = '' ) {
+	if ( false !== strpos( $file, '..' ))
+		return 1;
+
+	if ( false !== strpos( $file, './' ))
+		return 1;
+
+	if (':' == substr( $file, 1, 1 ))
+		return 2;
+
+	if (!empty ( $allowed_files ) && (!in_array( $file, $allowed_files ) ) )
+		return 3;
+
+	return 0;
+}
+endif;
+
+if ( !function_exists('is_ssl') ) :
+/**
+ * Determine if SSL is used.
+ *
+ * @since 2.6.0
+ *
+ * @return bool True if SSL, false if not used.
+ */
+function is_ssl() {
+	if ( isset($_SERVER['HTTPS']) ) {
+		if ( 'on' == strtolower($_SERVER['HTTPS']) )
+			return true;
+		if ( '1' == $_SERVER['HTTPS'] )
+			return true;
+	} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
+		return true;
+	}
+	return false;
+}
+endif;
+
+if ( !function_exists('force_ssl_login') ) :
+/**
+ * Whether SSL login should be forced.
+ *
+ * @since 2.6.0
+ *
+ * @param string|bool $force Optional.
+ * @return bool True if forced, false if not forced.
+ */
+function force_ssl_login($force = '') {
+	static $forced;
+
+	if ( '' != $force ) {
+		$old_forced = $forced;
+		$forced = $force;
+		return $old_forced;
+	}
+
+	return $forced;
+}
+endif;
+
+if ( !function_exists('force_ssl_admin') ) :
+/**
+ * Whether to force SSL used for the Administration Panels.
+ *
+ * @since 2.6.0
+ *
+ * @param string|bool $force
+ * @return bool True if forced, false if not forced.
+ */
+function force_ssl_admin($force = '') {
+	static $forced;
+
+	if ( '' != $force ) {
+		$old_forced = $forced;
+		$forced = $force;
+		return $old_forced;
+	}
+
+	return $forced;
+}
+endif;
+
+// ! function wp_guess_url()
+// ! function wp_suspend_cache_invalidation()
+// ! function get_site_option()
+// ! function add_site_option()
+// ! function update_site_option()
+
+if ( !function_exists('wp_timezone_override_offset') ) :
+/**
+ * gmt_offset modification for smart timezone handling
+ *
+ * Overrides the gmt_offset option if we have a timezone_string available
+ */
+function wp_timezone_override_offset() {
+	if ( !wp_timezone_supported() ) {
+		return false;
+	}
+	if ( !$timezone_string = backpress_get_option( 'timezone_string' ) ) {
+		return false;
+	}
+
+	@date_default_timezone_set( $timezone_string );
+	$timezone_object = timezone_open( $timezone_string );
+	$datetime_object = date_create();
+	if ( false === $timezone_object || false === $datetime_object ) {
+		return false;
+	}
+	return round( timezone_offset_get( $timezone_object, $datetime_object ) / 3600, 2 );
+}
+endif;
+
+if ( !function_exists('wp_timezone_supported') ) :
+/**
+ * Check for PHP timezone support
+ */
+function wp_timezone_supported() {
+	$support = false;
+	if (
+		function_exists( 'date_default_timezone_set' ) &&
+		function_exists( 'timezone_identifiers_list' ) &&
+		function_exists( 'timezone_open' ) &&
+		function_exists( 'timezone_offset_get' )
+	) {
+		$support = true;
+	}
+	return apply_filters( 'timezone_support', $support );
+}
+endif;
+
+if ( !function_exists('_wp_timezone_choice_usort_callback') ) :
+function _wp_timezone_choice_usort_callback( $a, $b ) {
+	// Don't use translated versions of Etc
+	if ( 'Etc' === $a['continent'] && 'Etc' === $b['continent'] ) {
+		// Make the order of these more like the old dropdown
+		if ( 'GMT+' === substr( $a['city'], 0, 4 ) && 'GMT+' === substr( $b['city'], 0, 4 ) ) {
+			return -1 * ( strnatcasecmp( $a['city'], $b['city'] ) );
+		}
+		if ( 'UTC' === $a['city'] ) {
+			if ( 'GMT+' === substr( $b['city'], 0, 4 ) ) {
+				return 1;
+			}
+			return -1;
+		}
+		if ( 'UTC' === $b['city'] ) {
+			if ( 'GMT+' === substr( $a['city'], 0, 4 ) ) {
+				return -1;
+			}
+			return 1;
+		}
+		return strnatcasecmp( $a['city'], $b['city'] );
+	}
+	if ( $a['t_continent'] == $b['t_continent'] ) {
+		if ( $a['t_city'] == $b['t_city'] ) {
+			return strnatcasecmp( $a['t_subcity'], $b['t_subcity'] );
+		}
+		return strnatcasecmp( $a['t_city'], $b['t_city'] );
+	} else {
+		// Force Etc to the bottom of the list
+		if ( 'Etc' === $a['continent'] ) {
+			return 1;
+		}
+		if ( 'Etc' === $b['continent'] ) {
+			return -1;
+		}
+		return strnatcasecmp( $a['t_continent'], $b['t_continent'] );
+	}
+}
+endif;
+
+if ( !function_exists('wp_timezone_choice') ) :
+/**
+ * Gives a nicely formatted list of timezone strings // temporary! Not in final
+ *
+ * @param string $selectedzone - which zone should be the selected one
+ *
+ */
+function wp_timezone_choice( $selected_zone ) {
+	static $mo_loaded = false;
+
+	$continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific', 'Etc' );
+
+	// Load translations for continents and cities
+	if ( !$mo_loaded ) {
+		$locale = backpress_get_option( 'language_locale' );
+		$mofile = backpress_get_option( 'language_directory' ) . 'continents-cities-' . $locale . '.mo';
+		load_textdomain( 'continents-cities', $mofile );
+		$mo_loaded = true;
+	}
+
+	$zonen = array();
+	foreach ( timezone_identifiers_list() as $zone ) {
+		$zone = explode( '/', $zone );
+		if ( !in_array( $zone[0], $continents ) ) {
+			continue;
+		}
+		if ( 'Etc' === $zone[0] && in_array( $zone[1], array( 'UCT', 'GMT', 'GMT0', 'GMT+0', 'GMT-0', 'Greenwich', 'Universal', 'Zulu' ) ) ) {
+			continue;
+		}
+
+		// This determines what gets set and translated - we don't translate Etc/* strings here, they are done later
+		$exists = array(
+			0 => ( isset( $zone[0] ) && $zone[0] ) ? true : false,
+			1 => ( isset( $zone[1] ) && $zone[1] ) ? true : false,
+			2 => ( isset( $zone[2] ) && $zone[2] ) ? true : false
+		);
+		$exists[3] = ( $exists[0] && 'Etc' !== $zone[0] ) ? true : false;
+		$exists[4] = ( $exists[1] && $exists[3] ) ? true : false;
+		$exists[5] = ( $exists[2] && $exists[3] ) ? true : false;
+
+		$zonen[] = array(
+			'continent'   => ( $exists[0] ? $zone[0] : '' ),
+			'city'        => ( $exists[1] ? $zone[1] : '' ),
+			'subcity'     => ( $exists[2] ? $zone[2] : '' ),
+			't_continent' => ( $exists[3] ? translate( str_replace( '_', ' ', $zone[0] ), 'continents-cities' ) : '' ),
+			't_city'      => ( $exists[4] ? translate( str_replace( '_', ' ', $zone[1] ), 'continents-cities' ) : '' ),
+			't_subcity'   => ( $exists[5] ? translate( str_replace( '_', ' ', $zone[2] ), 'continents-cities' ) : '' )
+		);
+	}
+	usort( $zonen, '_wp_timezone_choice_usort_callback' );
+
+	$structure = array();
+
+	if ( empty( $selected_zone ) ) {
+		$structure[] = '<option selected="selected" value="">' . __( 'Select a city' ) . '</option>';
+	}
+
+	foreach ( $zonen as $key => $zone ) {
+		// Build value in an array to join later
+		$value = array( $zone['continent'] );
+
+		if ( empty( $zone['city'] ) ) {
+			// It's at the continent level (generally won't happen)
+			$display = $zone['t_continent'];
+		} else {
+			// It's inside a continent group
+			
+			// Continent optgroup
+			if ( !isset( $zonen[$key - 1] ) || $zonen[$key - 1]['continent'] !== $zone['continent'] ) {
+				$label = ( 'Etc' === $zone['continent'] ) ? __( 'Manual offsets' ) : $zone['t_continent'];
+				$structure[] = '<optgroup label="'. esc_attr( $label ) .'">';
+			}
+			
+			// Add the city to the value
+			$value[] = $zone['city'];
+			if ( 'Etc' === $zone['continent'] ) {
+				if ( 'UTC' === $zone['city'] ) {
+					$display = '';
+				} else {
+					$display = str_replace( 'GMT', '', $zone['city'] );
+					$display = strtr( $display, '+-', '-+' ) . ':00';
+				}
+				$display = '&nbsp;&nbsp;&nbsp;' . sprintf( __( 'UTC %s' ), $display );
+			} else {
+				$display = '&nbsp;&nbsp;&nbsp;' . $zone['t_city'];
+				if ( !empty( $zone['subcity'] ) ) {
+					// Add the subcity to the value
+					$value[] = $zone['subcity'];
+					$display .= ' - ' . $zone['t_subcity'];
+				}
+			}
+		}
+
+		// Build the value
+		$value = join( '/', $value );
+		$selected = '';
+		if ( $value === $selected_zone ) {
+			$selected = 'selected="selected" ';
+		}
+		$structure[] = '<option ' . $selected . 'value="' . esc_attr( $value ) . '">' . esc_html( $display ) . "</option>";
+		
+		// Close continent optgroup
+		if ( !empty( $zone['city'] ) && isset( $zonen[$key + 1] ) && $zonen[$key + 1]['continent'] !== $zone['continent'] ) {
+			$structure[] = '</optgroup>';
+		}
+	}
+
+	return join( "\n", $structure );
+}
+endif;
+
+if ( !function_exists('_cleanup_header_comment') ) :
+/**
+ * Strip close comment and close php tags from file headers used by WP
+ * See http://core.trac.wordpress.org/ticket/8497
+ *
+ * @since 2.8
+ */
+function _cleanup_header_comment($str) {
+	return trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $str));
+}
+endif;
+
+
+
+/**
+ * From WP wp-settings.php
+ */
+
+if ( !function_exists( 'wp_clone' ) ) :
+/**
+ * Copy an object.
+ *
+ * Returns a cloned copy of an object.
+ *
+ * @since 2.7.0
+ *
+ * @param object $object The object to clone
+ * @return object The cloned object
+ */
+function wp_clone( $object ) {
+	static $can_clone;
+	if ( !isset( $can_clone ) ) {
+		$can_clone = version_compare( phpversion(), '5.0', '>=' );
+	}
+	return $can_clone ? clone( $object ) : $object;
+}
+endif;
+
+
+
+/**
+ * BackPress only below
+ */
+
+if ( !function_exists('backpress_gmt_strtotime') ) :
+function backpress_gmt_strtotime( $string ) {
+	if ( is_numeric($string) )
+		return $string;
+	if ( !is_string($string) )
+		return -1;
+
+	if ( stristr($string, 'utc') || stristr($string, 'gmt') || stristr($string, '+0000') )
+		return strtotime($string);
+
+	if ( -1 == $time = strtotime($string . ' +0000') )
+		return strtotime($string);
+
+	return $time;
+}
+endif;
+
+if ( !function_exists('backpress_convert_object') ) :
+function backpress_convert_object( &$object, $output ) {
+	if ( is_array( $object ) ) {
+		foreach ( array_keys( $object ) as $key )
+			backpress_convert_object( $object[$key], $output );
+	} else {
+		switch ( $output ) {
+			case OBJECT  : break;
+			case ARRAY_A : $object = get_object_vars($object); break;
+			case ARRAY_N : $object = array_values(get_object_vars($object)); break;
+		}
+	}
+}
+endif;
+
+if ( !function_exists('backpress_die') ) :
+/**
+ * Kill BackPress execution and display HTML message with error message.
+ *
+ * This function calls the die() PHP function. The difference is that a message
+ * in HTML will be displayed to the user. It is recommended to use this function
+ * only when the execution should not continue any further. It is not
+ * recommended to call this function very often and normally you should try to
+ * handle as many errors as possible silently.
+ *
+ * @param string $message Error message.
+ * @param string $title Error title.
+ * @param string|array $args Optional arguments to control behaviour.
+ */
+function backpress_die( $message, $title = '', $args = array() )
+{
+	$defaults = array( 'response' => 500, 'language' => 'en-US', 'text_direction' => 'ltr' );
+	$r = wp_parse_args( $args, $defaults );
+
+	if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
+		if ( empty( $title ) ) {
+			$error_data = $message->get_error_data();
+			if ( is_array( $error_data ) && isset( $error_data['title'] ) ) {
+				$title = $error_data['title'];
+			}
+		}
+		$errors = $message->get_error_messages();
+		switch ( count( $errors ) ) {
+			case 0:
+				$message = '';
+				break;
+			case 1:
+				$message = '<p>' . $errors[0] . '</p>';
+				break;
+			default:
+				$message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $errors ) . "</li>\n\t</ul>";
+				break;
+		}
+	} elseif ( is_string( $message ) ) {
+		$message = '<p>' . $message . '</p>';
+	}
+
+	if ( !headers_sent() ) {
+		status_header( $r['response'] );
+		nocache_headers();
+		header( 'Content-Type: text/html; charset=utf-8' );
+	}
+
+	if ( empty( $title ) ) {
+		if ( function_exists( '__' ) ) {
+			$title = __( 'BackPress &rsaquo; Error' );
+		} else {
+			$title = 'BackPress &rsaquo; Error';
+		}
+	}
+
+	if ( $r['text_direction'] ) {
+		$language_attributes = ' dir="' . $r['text_direction'] . '"';
+	}
+
+	if ( $r['language'] ) {
+		// Always XHTML 1.1 style
+		$language_attributes .= ' lang="' . $r['language'] . '"';
+	}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"<?php echo $language_attributes; ?>>
+<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<title><?php echo $title ?></title>
+	<style type="text/css" media="screen">
+		html { background: #f7f7f7; }
+
+		body {
+			background: #fff;
+			color: #333;
+			font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
+			margin: 2em auto 0 auto;
+			width: 700px;
+			padding: 1em 2em;
+			-moz-border-radius: 11px;
+			-khtml-border-radius: 11px;
+			-webkit-border-radius: 11px;
+			border-radius: 11px;
+			border: 1px solid #dfdfdf;
+		}
+
+		a { color: #2583ad; text-decoration: none; }
+
+		a:hover { color: #d54e21; }
+
+		h1 {
+			border-bottom: 1px solid #dadada;
+			clear: both;
+			color: #666;
+			font: 24px Georgia, "Times New Roman", Times, serif;
+			margin: 5px 0 0 -4px;
+			padding: 0;
+			padding-bottom: 7px;
+		}
+
+		h2 { font-size: 16px; }
+
+		p, li {
+			padding-bottom: 2px;
+			font-size: 12px;
+			line-height: 18px;
+		}
+
+		code { font-size: 13px; }
+
+		ul, ol { padding: 5px 5px 5px 22px; }
+
+		#error-page { margin-top: 50px; }
+
+		#error-page p {
+			font-size: 12px;
+			line-height: 18px;
+			margin: 25px 0 20px;
+		}
+
+		#error-page code { font-family: Consolas, Monaco, Courier, monospace; }
+<?php
+	if ( $r['text_direction'] === 'rtl') {
+?>
+		body {
+			font-family: Tahoma, "Times New Roman";
+		}
+
+		h1 {
+			font-family: Tahoma, "Times New Roman";
+			margin: 5px -4px 0 0;
+		}
+
+		ul, ol { padding: 5px 22px 5px 5px; }
+<?php
+	}
+?>
+	</style>
+</head>
+<body id="error-page">
+	<?php echo $message; ?>
+</body>
+</html>
+<?php
+	die();
+}
+endif;
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.formatting.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.formatting.php
new file mode 100644
index 0000000000000000000000000000000000000000..7f60ae2d7b303c223f1d8deb871910e006deee9e
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.formatting.php
@@ -0,0 +1,1795 @@
+<?php
+// Last sync [WP11616]
+
+/**
+ * From WP wp-includes/formatting.php
+ *
+ * Missing functions are indicated in comments
+ */
+
+/**
+ * Main BackPress Formatting API.
+ *
+ * Handles many functions for formatting output.
+ *
+ * @package BackPress
+ **/
+
+if ( !function_exists( 'wptexturize' ) ) :
+/**
+ * Replaces common plain text characters into formatted entities
+ *
+ * As an example,
+ * <code>
+ * 'cause today's effort makes it worth tomorrow's "holiday"...
+ * </code>
+ * Becomes:
+ * <code>
+ * &#8217;cause today&#8217;s effort makes it worth tomorrow&#8217;s &#8220;holiday&#8221;&#8230;
+ * </code>
+ * Code within certain html blocks are skipped.
+ *
+ * @since 0.71
+ * @uses $wp_cockneyreplace Array of formatted entities for certain common phrases
+ *
+ * @param string $text The text to be formatted
+ * @return string The string replaced with html entities
+ */
+function wptexturize($text) {
+	global $wp_cockneyreplace;
+	$output = '';
+	$curl = '';
+	$textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
+	$stop = count($textarr);
+	
+	/* translators: opening curly quote */
+	$opening_quote = _x('&#8220;', 'opening curly quote');
+	/* translators: closing curly quote */
+	$closing_quote = _x('&#8221;', 'closing curly quote');
+	
+	$no_texturize_tags = apply_filters('no_texturize_tags', array('pre', 'code', 'kbd', 'style', 'script', 'tt'));
+	$no_texturize_shortcodes = apply_filters('no_texturize_shortcodes', array('code'));
+	$no_texturize_tags_stack = array();
+	$no_texturize_shortcodes_stack = array();
+
+	// if a plugin has provided an autocorrect array, use it
+	if ( isset($wp_cockneyreplace) ) {
+		$cockney = array_keys($wp_cockneyreplace);
+		$cockneyreplace = array_values($wp_cockneyreplace);
+	} else {
+		$cockney = array("'tain't","'twere","'twas","'tis","'twill","'til","'bout","'nuff","'round","'cause");
+		$cockneyreplace = array("&#8217;tain&#8217;t","&#8217;twere","&#8217;twas","&#8217;tis","&#8217;twill","&#8217;til","&#8217;bout","&#8217;nuff","&#8217;round","&#8217;cause");
+	}
+
+	$static_characters = array_merge(array('---', ' -- ', '--', ' - ', 'xn&#8211;', '...', '``', '\'s', '\'\'', ' (tm)'), $cockney);
+	$static_replacements = array_merge(array('&#8212;', ' &#8212; ', '&#8211;', ' &#8211; ', 'xn--', '&#8230;', $opening_quote, '&#8217;s', $closing_quote, ' &#8482;'), $cockneyreplace);
+
+	$dynamic_characters = array('/\'(\d\d(?:&#8217;|\')?s)/', '/(\s|\A|")\'/', '/(\d+)"/', '/(\d+)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A)"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/(\d+)x(\d+)/');
+	$dynamic_replacements = array('&#8217;$1','$1&#8216;', '$1&#8243;', '$1&#8242;', '$1&#8217;$2', '$1' . $opening_quote . '$2', $closing_quote . '$1', '&#8217;$1', '$1&#215;$2');
+
+	for ( $i = 0; $i < $stop; $i++ ) {
+		$curl = $textarr[$i];
+
+		if ( !empty($curl) && '<' != $curl{0} && '[' != $curl{0}
+				&& empty($no_texturize_shortcodes_stack) && empty($no_texturize_tags_stack)) { // If it's not a tag
+			// static strings
+			$curl = str_replace($static_characters, $static_replacements, $curl);
+			// regular expressions
+			$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
+		} else {
+			wptexturize_pushpop_element($curl, $no_texturize_tags_stack, $no_texturize_tags, '<', '>');
+			wptexturize_pushpop_element($curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes, '[', ']');
+		}
+
+		$curl = preg_replace('/&([^#])(?![a-zA-Z1-4]{1,8};)/', '&#038;$1', $curl);
+		$output .= $curl;
+	}
+
+	return $output;
+}
+endif;
+
+if ( !function_exists( 'wptexturize_pushpop_element' ) ) :
+function wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>') {
+	$o = preg_quote($opening);
+	$c = preg_quote($closing);
+	foreach($disabled_elements as $element) {
+		if (preg_match('/^'.$o.$element.'\b/', $text)) array_push($stack, $element);
+		if (preg_match('/^'.$o.'\/'.$element.$c.'/', $text)) {
+			$last = array_pop($stack);
+			// disable texturize until we find a closing tag of our type (e.g. <pre>)
+			// even if there was invalid nesting before that
+			// Example: in the case <pre>sadsadasd</code>"baba"</pre> "baba" won't be texturized
+			if ($last != $element) array_push($stack, $last);
+		}
+	}
+}
+endif;
+
+if ( !function_exists( 'clean_pre' ) ) :
+/**
+ * Accepts matches array from preg_replace_callback in wpautop() or a string.
+ *
+ * Ensures that the contents of a <<pre>>...<</pre>> HTML block are not
+ * converted into paragraphs or line-breaks.
+ *
+ * @since 1.2.0
+ *
+ * @param array|string $matches The array or string
+ * @return string The pre block without paragraph/line-break conversion.
+ */
+function clean_pre($matches) {
+	if ( is_array($matches) )
+		$text = $matches[1] . $matches[2] . "</pre>";
+	else
+		$text = $matches;
+
+	$text = str_replace('<br />', '', $text);
+	$text = str_replace('<p>', "\n", $text);
+	$text = str_replace('</p>', '', $text);
+
+	return $text;
+}
+endif;
+
+// ! function wpautop()
+
+if ( !function_exists('seems_utf8') ) :
+/**
+ * Checks to see if a string is utf8 encoded.
+ *
+ * NOTE: This function checks for 5-Byte sequences, UTF8
+ *       has Bytes Sequences with a maximum length of 4.
+ *
+ * @author bmorel at ssi dot fr (modified)
+ * @since 1.2.1
+ *
+ * @param string $str The string to be checked
+ * @return bool True if $str fits a UTF-8 model, false otherwise.
+ */
+function seems_utf8($str) {
+	$length = strlen($str);
+	for ($i=0; $i < $length; $i++) {
+		$c = ord($str[$i]);
+		if ($c < 0x80) $n = 0; # 0bbbbbbb
+		elseif (($c & 0xE0) == 0xC0) $n=1; # 110bbbbb
+		elseif (($c & 0xF0) == 0xE0) $n=2; # 1110bbbb
+		elseif (($c & 0xF8) == 0xF0) $n=3; # 11110bbb
+		elseif (($c & 0xFC) == 0xF8) $n=4; # 111110bb
+		elseif (($c & 0xFE) == 0xFC) $n=5; # 1111110b
+		else return false; # Does not match any model
+		for ($j=0; $j<$n; $j++) { # n bytes matching 10bbbbbb follow ?
+			if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80))
+				return false;
+		}
+	}
+	return true;
+}
+endif;
+
+
+
+if ( !function_exists('_wp_specialchars') ) :
+/**
+ * Converts a number of special characters into their HTML entities.
+ *
+ * Specifically deals with: &, <, >, ", and '.
+ *
+ * $quote_style can be set to ENT_COMPAT to encode " to
+ * &quot;, or ENT_QUOTES to do both. Default is ENT_NOQUOTES where no quotes are encoded.
+ *
+ * @since 1.2.2
+ *
+ * @param string $string The text which is to be encoded.
+ * @param mixed $quote_style Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES.
+ * @param string $charset Optional. The character encoding of the string. Default is false.
+ * @param boolean $double_encode Optional. Whether or not to encode existing html entities. Default is false.
+ * @return string The encoded text with HTML entities.
+ */
+function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
+	$string = (string) $string;
+
+	if ( 0 === strlen( $string ) ) {
+		return '';
+	}
+
+	// Don't bother if there are no specialchars - saves some processing
+	if ( !preg_match( '/[&<>"\']/', $string ) ) {
+		return $string;
+	}
+
+	// Account for the previous behaviour of the function when the $quote_style is not an accepted value
+	if ( empty( $quote_style ) ) {
+		$quote_style = ENT_NOQUOTES;
+	} elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
+		$quote_style = ENT_QUOTES;
+	}
+
+	// Store the site charset as a static to avoid multiple calls to backpress_get_option()
+	if ( !$charset ) {
+		static $_charset;
+		if ( !isset( $_charset ) ) {
+			$_charset = backpress_get_option( 'charset' );
+		}
+		$charset = $_charset;
+	}
+	if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) ) {
+		$charset = 'UTF-8';
+	}
+
+	$_quote_style = $quote_style;
+
+	if ( $quote_style === 'double' ) {
+		$quote_style = ENT_COMPAT;
+		$_quote_style = ENT_COMPAT;
+	} elseif ( $quote_style === 'single' ) {
+		$quote_style = ENT_NOQUOTES;
+	}
+
+	// Handle double encoding ourselves
+	if ( !$double_encode ) {
+		$string = wp_specialchars_decode( $string, $_quote_style );
+		$string = preg_replace( '/&(#?x?[0-9a-z]+);/i', '|wp_entity|$1|/wp_entity|', $string );
+	}
+
+	$string = @htmlspecialchars( $string, $quote_style, $charset );
+
+	// Handle double encoding ourselves
+	if ( !$double_encode ) {
+		$string = str_replace( array( '|wp_entity|', '|/wp_entity|' ), array( '&', ';' ), $string );
+	}
+
+	// Backwards compatibility
+	if ( 'single' === $_quote_style ) {
+		$string = str_replace( "'", '&#039;', $string );
+	}
+
+	return $string;
+}
+endif;
+
+if ( !function_exists( 'wp_specialchars_decode' ) ) :
+/**
+ * Converts a number of HTML entities into their special characters.
+ *
+ * Specifically deals with: &, <, >, ", and '.
+ *
+ * $quote_style can be set to ENT_COMPAT to decode " entities,
+ * or ENT_QUOTES to do both " and '. Default is ENT_NOQUOTES where no quotes are decoded.
+ *
+ * @since 2.8
+ *
+ * @param string $string The text which is to be decoded.
+ * @param mixed $quote_style Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old _wp_specialchars() values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES.
+ * @return string The decoded text without HTML entities.
+ */
+function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES ) {
+	$string = (string) $string;
+
+	if ( 0 === strlen( $string ) ) {
+		return '';
+	}
+
+	// Don't bother if there are no entities - saves a lot of processing
+	if ( strpos( $string, '&' ) === false ) {
+		return $string;
+	}
+
+	// Match the previous behaviour of _wp_specialchars() when the $quote_style is not an accepted value
+	if ( empty( $quote_style ) ) {
+		$quote_style = ENT_NOQUOTES;
+	} elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
+		$quote_style = ENT_QUOTES;
+	}
+
+	// More complete than get_html_translation_table( HTML_SPECIALCHARS )
+	$single = array( '&#039;'  => '\'', '&#x27;' => '\'' );
+	$single_preg = array( '/&#0*39;/'  => '&#039;', '/&#x0*27;/i' => '&#x27;' );
+	$double = array( '&quot;' => '"', '&#034;'  => '"', '&#x22;' => '"' );
+	$double_preg = array( '/&#0*34;/'  => '&#034;', '/&#x0*22;/i' => '&#x22;' );
+	$others = array( '&lt;'   => '<', '&#060;'  => '<', '&gt;'   => '>', '&#062;'  => '>', '&amp;'  => '&', '&#038;'  => '&', '&#x26;' => '&' );
+	$others_preg = array( '/&#0*60;/'  => '&#060;', '/&#0*62;/'  => '&#062;', '/&#0*38;/'  => '&#038;', '/&#x0*26;/i' => '&#x26;' );
+
+	if ( $quote_style === ENT_QUOTES ) {
+		$translation = array_merge( $single, $double, $others );
+		$translation_preg = array_merge( $single_preg, $double_preg, $others_preg );
+	} elseif ( $quote_style === ENT_COMPAT || $quote_style === 'double' ) {
+		$translation = array_merge( $double, $others );
+		$translation_preg = array_merge( $double_preg, $others_preg );
+	} elseif ( $quote_style === 'single' ) {
+		$translation = array_merge( $single, $others );
+		$translation_preg = array_merge( $single_preg, $others_preg );
+	} elseif ( $quote_style === ENT_NOQUOTES ) {
+		$translation = $others;
+		$translation_preg = $others_preg;
+	}
+
+	// Remove zero padding on numeric entities
+	$string = preg_replace( array_keys( $translation_preg ), array_values( $translation_preg ), $string );
+
+	// Replace characters according to translation table
+	return strtr( $string, $translation );
+}
+endif;
+
+if ( !function_exists( 'wp_check_invalid_utf8' ) ) :
+/**
+ * Checks for invalid UTF8 in a string.
+ *
+ * @since 2.8
+ *
+ * @param string $string The text which is to be checked.
+ * @param boolean $strip Optional. Whether to attempt to strip out invalid UTF8. Default is false.
+ * @return string The checked text.
+ */
+function wp_check_invalid_utf8( $string, $strip = false ) {
+	$string = (string) $string;
+
+	if ( 0 === strlen( $string ) ) {
+		return '';
+	}
+
+	// Store the site charset as a static to avoid multiple calls to backpress_get_option()
+	static $is_utf8;
+	if ( !isset( $is_utf8 ) ) {
+		$is_utf8 = in_array( backpress_get_option( 'charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) );
+	}
+	if ( !$is_utf8 ) {
+		return $string;
+	}
+
+	// Check for support for utf8 in the installed PCRE library once and store the result in a static
+	static $utf8_pcre;
+	if ( !isset( $utf8_pcre ) ) {
+		$utf8_pcre = @preg_match( '/^./u', 'a' );
+	}
+	// We can't demand utf8 in the PCRE installation, so just return the string in those cases
+	if ( !$utf8_pcre ) {
+		return $string;
+	}
+
+	// preg_match fails when it encounters invalid UTF8 in $string
+	if ( 1 === @preg_match( '/^./us', $string ) ) {
+		return $string;
+	}
+
+	// Attempt to strip the bad chars if requested (not recommended)
+	if ( $strip && function_exists( 'iconv' ) ) {
+		return iconv( 'utf-8', 'utf-8', $string );
+	}
+
+	return '';
+}
+endif;
+
+if ( !function_exists('utf8_uri_encode') ) :
+/**
+ * Encode the Unicode values to be used in the URI.
+ *
+ * @since 1.5.0
+ *
+ * @param string $utf8_string
+ * @param int $length Max length of the string
+ * @return string String with Unicode encoded for URI.
+ */
+function utf8_uri_encode( $utf8_string, $length = 0 ) {
+	$unicode = '';
+	$values = array();
+	$num_octets = 1;
+	$unicode_length = 0;
+
+	$string_length = strlen( $utf8_string );
+	for ($i = 0; $i < $string_length; $i++ ) {
+
+		$value = ord( $utf8_string[ $i ] );
+
+		if ( $value < 128 ) {
+			if ( $length && ( $unicode_length >= $length ) )
+				break;
+			$unicode .= chr($value);
+			$unicode_length++;
+		} else {
+			if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
+
+			$values[] = $value;
+
+			if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length )
+				break;
+			if ( count( $values ) == $num_octets ) {
+				if ($num_octets == 3) {
+					$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]);
+					$unicode_length += 9;
+				} else {
+					$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
+					$unicode_length += 6;
+				}
+
+				$values = array();
+				$num_octets = 1;
+			}
+		}
+	}
+
+	return $unicode;
+}
+endif;
+
+if ( !function_exists('remove_accents') ) :
+/**
+ * Converts all accent characters to ASCII characters.
+ *
+ * If there are no accent characters, then the string given is just returned.
+ *
+ * @since 1.2.1
+ *
+ * @param string $string Text that might have accent characters
+ * @return string Filtered string with replaced "nice" characters.
+ */
+function remove_accents($string) {
+	if ( !preg_match('/[\x80-\xff]/', $string) )
+		return $string;
+
+	if (seems_utf8($string)) {
+		$chars = array(
+		// Decompositions for Latin-1 Supplement
+		chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
+		chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
+		chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
+		chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
+		chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
+		chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
+		chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
+		chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
+		chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
+		chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
+		chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
+		chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
+		chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
+		chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
+		chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
+		chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
+		chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
+		chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
+		chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
+		chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
+		chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
+		chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
+		chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
+		chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
+		chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
+		chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
+		chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
+		chr(195).chr(191) => 'y',
+		// Decompositions for Latin Extended-A
+		chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
+		chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
+		chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
+		chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
+		chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
+		chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
+		chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
+		chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
+		chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
+		chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
+		chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
+		chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
+		chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
+		chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
+		chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
+		chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
+		chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
+		chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
+		chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
+		chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
+		chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
+		chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
+		chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
+		chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
+		chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
+		chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
+		chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
+		chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
+		chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
+		chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
+		chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
+		chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
+		chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
+		chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
+		chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
+		chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
+		chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
+		chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
+		chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
+		chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
+		chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
+		chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
+		chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
+		chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
+		chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
+		chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
+		chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
+		chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
+		chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
+		chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
+		chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
+		chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
+		chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
+		chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
+		chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
+		chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
+		chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
+		chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
+		chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
+		chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
+		chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
+		chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
+		chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
+		chr(197).chr(190) => 'z', chr(197).chr(191) => 's',
+		// Euro Sign
+		chr(226).chr(130).chr(172) => 'E',
+		// GBP (Pound) Sign
+		chr(194).chr(163) => '');
+
+		$string = strtr($string, $chars);
+	} else {
+		// Assume ISO-8859-1 if not UTF-8
+		$chars['in'] = chr(128).chr(131).chr(138).chr(142).chr(154).chr(158)
+			.chr(159).chr(162).chr(165).chr(181).chr(192).chr(193).chr(194)
+			.chr(195).chr(196).chr(197).chr(199).chr(200).chr(201).chr(202)
+			.chr(203).chr(204).chr(205).chr(206).chr(207).chr(209).chr(210)
+			.chr(211).chr(212).chr(213).chr(214).chr(216).chr(217).chr(218)
+			.chr(219).chr(220).chr(221).chr(224).chr(225).chr(226).chr(227)
+			.chr(228).chr(229).chr(231).chr(232).chr(233).chr(234).chr(235)
+			.chr(236).chr(237).chr(238).chr(239).chr(241).chr(242).chr(243)
+			.chr(244).chr(245).chr(246).chr(248).chr(249).chr(250).chr(251)
+			.chr(252).chr(253).chr(255);
+
+		$chars['out'] = "EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy";
+
+		$string = strtr($string, $chars['in'], $chars['out']);
+		$double_chars['in'] = array(chr(140), chr(156), chr(198), chr(208), chr(222), chr(223), chr(230), chr(240), chr(254));
+		$double_chars['out'] = array('OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th');
+		$string = str_replace($double_chars['in'], $double_chars['out'], $string);
+	}
+
+	return $string;
+}
+endif;
+
+// ! function sanitize_file_name()
+
+if ( !function_exists('sanitize_user') ) :
+/**
+ * Sanitize username stripping out unsafe characters.
+ *
+ * If $strict is true, only alphanumeric characters (as well as _, space, ., -,
+ * @) are returned.
+ * Removes tags, octets, entities, and if strict is enabled, will remove all
+ * non-ASCII characters. After sanitizing, it passes the username, raw username
+ * (the username in the parameter), and the strict parameter as parameters for
+ * the filter.
+ *
+ * @since 2.0.0
+ * @uses apply_filters() Calls 'sanitize_user' hook on username, raw username,
+ *		and $strict parameter.
+ *
+ * @param string $username The username to be sanitized.
+ * @param bool $strict If set limits $username to specific characters. Default false.
+ * @return string The sanitized username, after passing through filters.
+ */
+function sanitize_user( $username, $strict = false ) {
+	$raw_username = $username;
+	$username = strip_tags($username);
+	// Kill octets
+	$username = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $username);
+	$username = preg_replace('/&.+?;/', '', $username); // Kill entities
+
+	// If strict, reduce to ASCII for max portability.
+	if ( $strict )
+		$username = preg_replace('|[^a-z0-9 _.\-@]|i', '', $username);
+
+	// Consolidate contiguous whitespace
+	$username = preg_replace('|\s+|', ' ', $username);
+
+	return apply_filters('sanitize_user', $username, $raw_username, $strict);
+}
+endif;
+
+if ( !function_exists('sanitize_title') ) :
+/**
+ * Sanitizes title or use fallback title.
+ *
+ * Specifically, HTML and PHP tags are stripped. Further actions can be added
+ * via the plugin API. If $title is empty and $fallback_title is set, the latter
+ * will be used.
+ *
+ * @since 1.0.0
+ *
+ * @param string $title The string to be sanitized.
+ * @param string $fallback_title Optional. A title to use if $title is empty.
+ * @return string The sanitized string.
+ */
+function sanitize_title($title, $fallback_title = '') {
+	$raw_title = $title;
+	$title = strip_tags($title);
+	$title = apply_filters('sanitize_title', $title, $raw_title);
+
+	if ( '' === $title || false === $title )
+		$title = $fallback_title;
+
+	return $title;
+}
+endif;
+
+if ( !function_exists('sanitize_title_with_dashes') ) :
+/**
+ * Sanitizes title, replacing whitespace with dashes.
+ *
+ * Limits the output to alphanumeric characters, underscore (_) and dash (-).
+ * Whitespace becomes a dash.
+ *
+ * @since 1.2.0
+ *
+ * @param string $title The title to be sanitized.
+ * @return string The sanitized title.
+ */
+function sanitize_title_with_dashes($title) {
+	$title = strip_tags($title);
+	// Preserve escaped octets.
+	$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
+	// Remove percent signs that are not part of an octet.
+	$title = str_replace('%', '', $title);
+	// Restore octets.
+	$title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
+
+	$title = remove_accents($title);
+	if (seems_utf8($title)) {
+		if (function_exists('mb_strtolower')) {
+			$title = mb_strtolower($title, 'UTF-8');
+		}
+		$title = utf8_uri_encode($title, 200);
+	}
+
+	$title = strtolower($title);
+	$title = preg_replace('/&.+?;/', '', $title); // kill entities
+	$title = str_replace('.', '-', $title);
+	$title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
+	$title = preg_replace('/\s+/', '-', $title);
+	$title = preg_replace('|-+|', '-', $title);
+	$title = trim($title, '-');
+
+	return $title;
+}
+endif;
+
+// ! function sanitize_sql_orderby()
+// ! function sanitize_html_class()
+// ! function convert_chars()
+// ! function funky_javascript_callback()
+// ! function funky_javascript_fix()
+// ! function balanceTags()
+
+if ( !function_exists( 'force_balance_tags' ) ) :
+/**
+ * Balances tags of string using a modified stack.
+ *
+ * @since 2.0.4
+ *
+ * @author Leonard Lin <leonard@acm.org>
+ * @license GPL v2.0
+ * @copyright November 4, 2001
+ * @version 1.1
+ * @todo Make better - change loop condition to $text in 1.2
+ * @internal Modified by Scott Reilly (coffee2code) 02 Aug 2004
+ *		1.1  Fixed handling of append/stack pop order of end text
+ *			 Added Cleaning Hooks
+ *		1.0  First Version
+ *
+ * @param string $text Text to be balanced.
+ * @return string Balanced text.
+ */
+function force_balance_tags( $text ) {
+	$tagstack = array(); $stacksize = 0; $tagqueue = ''; $newtext = '';
+	$single_tags = array('br', 'hr', 'img', 'input'); //Known single-entity/self-closing tags
+	$nestable_tags = array('blockquote', 'div', 'span'); //Tags that can be immediately nested within themselves
+
+	# WP bug fix for comments - in case you REALLY meant to type '< !--'
+	$text = str_replace('< !--', '<    !--', $text);
+	# WP bug fix for LOVE <3 (and other situations with '<' before a number)
+	$text = preg_replace('#<([0-9]{1})#', '&lt;$1', $text);
+
+	while (preg_match("/<(\/?\w*)\s*([^>]*)>/",$text,$regex)) {
+		$newtext .= $tagqueue;
+
+		$i = strpos($text,$regex[0]);
+		$l = strlen($regex[0]);
+
+		// clear the shifter
+		$tagqueue = '';
+		// Pop or Push
+		if ( isset($regex[1][0]) && '/' == $regex[1][0] ) { // End Tag
+			$tag = strtolower(substr($regex[1],1));
+			// if too many closing tags
+			if($stacksize <= 0) {
+				$tag = '';
+				//or close to be safe $tag = '/' . $tag;
+			}
+			// if stacktop value = tag close value then pop
+			else if ($tagstack[$stacksize - 1] == $tag) { // found closing tag
+				$tag = '</' . $tag . '>'; // Close Tag
+				// Pop
+				array_pop ($tagstack);
+				$stacksize--;
+			} else { // closing tag not at top, search for it
+				for ($j=$stacksize-1;$j>=0;$j--) {
+					if ($tagstack[$j] == $tag) {
+					// add tag to tagqueue
+						for ($k=$stacksize-1;$k>=$j;$k--){
+							$tagqueue .= '</' . array_pop ($tagstack) . '>';
+							$stacksize--;
+						}
+						break;
+					}
+				}
+				$tag = '';
+			}
+		} else { // Begin Tag
+			$tag = strtolower($regex[1]);
+
+			// Tag Cleaning
+
+			// If self-closing or '', don't do anything.
+			if((substr($regex[2],-1) == '/') || ($tag == '')) {
+			}
+			// ElseIf it's a known single-entity tag but it doesn't close itself, do so
+			elseif ( in_array($tag, $single_tags) ) {
+				$regex[2] .= '/';
+			} else {	// Push the tag onto the stack
+				// If the top of the stack is the same as the tag we want to push, close previous tag
+				if (($stacksize > 0) && !in_array($tag, $nestable_tags) && ($tagstack[$stacksize - 1] == $tag)) {
+					$tagqueue = '</' . array_pop ($tagstack) . '>';
+					$stacksize--;
+				}
+				$stacksize = array_push ($tagstack, $tag);
+			}
+
+			// Attributes
+			$attributes = $regex[2];
+			if($attributes) {
+				$attributes = ' '.$attributes;
+			}
+			$tag = '<'.$tag.$attributes.'>';
+			//If already queuing a close tag, then put this tag on, too
+			if ($tagqueue) {
+				$tagqueue .= $tag;
+				$tag = '';
+			}
+		}
+		$newtext .= substr($text,0,$i) . $tag;
+		$text = substr($text,$i+$l);
+	}
+
+	// Clear Tag Queue
+	$newtext .= $tagqueue;
+
+	// Add Remaining text
+	$newtext .= $text;
+
+	// Empty Stack
+	while($x = array_pop($tagstack)) {
+		$newtext .= '</' . $x . '>'; // Add remaining tags to close
+	}
+
+	// WP fix for the bug with HTML comments
+	$newtext = str_replace("< !--","<!--",$newtext);
+	$newtext = str_replace("<    !--","< !--",$newtext);
+
+	return $newtext;
+}
+endif;
+
+if ( !function_exists('format_to_edit') ) :
+/**
+ * Acts on text which is about to be edited.
+ *
+ * Unless $richedit is set, it is simply a holder for the 'format_to_edit'
+ * filter. If $richedit is set true htmlspecialchars() will be run on the
+ * content, converting special characters to HTMl entities.
+ *
+ * @since 0.71
+ *
+ * @param string $content The text about to be edited.
+ * @param bool $richedit Whether or not the $content should pass through htmlspecialchars(). Default false.
+ * @return string The text after the filter (and possibly htmlspecialchars()) has been run.
+ */
+function format_to_edit($content, $richedit = false) {
+	$content = apply_filters('format_to_edit', $content);
+	if (! $richedit )
+		$content = htmlspecialchars($content);
+	return $content;
+}
+endif;
+
+// !format_to_post()
+
+if ( !function_exists( 'zeroise' ) ) :
+/**
+ * Add leading zeros when necessary.
+ *
+ * If you set the threshold to '4' and the number is '10', then you will get
+ * back '0010'. If you set the number to '4' and the number is '5000', then you
+ * will get back '5000'.
+ *
+ * Uses sprintf to append the amount of zeros based on the $threshold parameter
+ * and the size of the number. If the number is large enough, then no zeros will
+ * be appended.
+ *
+ * @since 0.71
+ *
+ * @param mixed $number Number to append zeros to if not greater than threshold.
+ * @param int $threshold Digit places number needs to be to not have zeros added.
+ * @return string Adds leading zeros to number if needed.
+ */
+function zeroise($number, $threshold) {
+	return sprintf('%0'.$threshold.'s', $number);
+}
+endif;
+
+if ( !function_exists( 'backslashit' ) ) :
+/**
+ * Adds backslashes before letters and before a number at the start of a string.
+ *
+ * @since 0.71
+ *
+ * @param string $string Value to which backslashes will be added.
+ * @return string String with backslashes inserted.
+ */
+function backslashit($string) {
+	$string = preg_replace('/^([0-9])/', '\\\\\\\\\1', $string);
+	$string = preg_replace('/([a-z])/i', '\\\\\1', $string);
+	return $string;
+}
+endif;
+
+if ( !function_exists( 'trailingslashit' ) ) :
+/**
+ * Appends a trailing slash.
+ *
+ * Will remove trailing slash if it exists already before adding a trailing
+ * slash. This prevents double slashing a string or path.
+ *
+ * The primary use of this is for paths and thus should be used for paths. It is
+ * not restricted to paths and offers no specific path support.
+ *
+ * @since 1.2.0
+ * @uses untrailingslashit() Unslashes string if it was slashed already.
+ *
+ * @param string $string What to add the trailing slash to.
+ * @return string String with trailing slash added.
+ */
+function trailingslashit($string) {
+	return untrailingslashit($string) . '/';
+}
+endif;
+
+if ( !function_exists( 'untrailingslashit' ) ) :
+/**
+ * Removes trailing slash if it exists.
+ *
+ * The primary use of this is for paths and thus should be used for paths. It is
+ * not restricted to paths and offers no specific path support.
+ *
+ * @since 2.2.0
+ *
+ * @param string $string What to remove the trailing slash from.
+ * @return string String without the trailing slash.
+ */
+function untrailingslashit($string) {
+	return rtrim($string, '/');
+}
+endif;
+
+// ! function addslashes_gpc()
+
+if ( !function_exists('stripslashes_deep') ) :
+/**
+ * Navigates through an array and removes slashes from the values.
+ *
+ * If an array is passed, the array_map() function causes a callback to pass the
+ * value back to the function. The slashes from this value will removed.
+ *
+ * @since 2.0.0
+ *
+ * @param array|string $value The array or string to be striped.
+ * @return array|string Stripped array (or string in the callback).
+ */
+function stripslashes_deep($value) {
+	$value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
+	return $value;
+}
+endif;
+
+if ( !function_exists( 'urlencode_deep' ) ) :
+/**
+ * Navigates through an array and encodes the values to be used in a URL.
+ *
+ * Uses a callback to pass the value of the array back to the function as a
+ * string.
+ *
+ * @since 2.2.0
+ *
+ * @param array|string $value The array or string to be encoded.
+ * @return array|string $value The encoded array (or string from the callback).
+ */
+function urlencode_deep($value) {
+	$value = is_array($value) ? array_map('urlencode_deep', $value) : urlencode($value);
+	return $value;
+}
+endif;
+
+// ! function antispambot()
+
+if ( !function_exists( '_make_url_clickable_cb' ) ) :
+/**
+ * Callback to convert URI match to HTML A element.
+ *
+ * This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link
+ * make_clickable()}.
+ *
+ * @since 2.3.2
+ * @access private
+ *
+ * @param array $matches Single Regex Match.
+ * @return string HTML A element with URI address.
+ */
+function _make_url_clickable_cb($matches) {
+	$url = $matches[2];
+	$url = esc_url($url);
+	if ( empty($url) )
+		return $matches[0];
+	return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>";
+}
+endif;
+
+if ( !function_exists( '_make_web_ftp_clickable_cb' ) ) :
+/**
+ * Callback to convert URL match to HTML A element.
+ *
+ * This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link
+ * make_clickable()}.
+ *
+ * @since 2.3.2
+ * @access private
+ *
+ * @param array $matches Single Regex Match.
+ * @return string HTML A element with URL address.
+ */
+function _make_web_ftp_clickable_cb($matches) {
+	$ret = '';
+	$dest = $matches[2];
+	$dest = 'http://' . $dest;
+	$dest = esc_url($dest);
+	if ( empty($dest) )
+		return $matches[0];
+	// removed trailing [,;:] from URL
+	if ( in_array(substr($dest, -1), array('.', ',', ';', ':')) === true ) {
+		$ret = substr($dest, -1);
+		$dest = substr($dest, 0, strlen($dest)-1);
+	}
+	return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>" . $ret;
+}
+endif;
+
+if ( !function_exists( '_make_email_clickable_cb' ) ) :
+/**
+ * Callback to convert email address match to HTML A element.
+ *
+ * This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link
+ * make_clickable()}.
+ *
+ * @since 2.3.2
+ * @access private
+ *
+ * @param array $matches Single Regex Match.
+ * @return string HTML A element with email address.
+ */
+function _make_email_clickable_cb($matches) {
+	$email = $matches[2] . '@' . $matches[3];
+	return $matches[1] . "<a href=\"mailto:$email\">$email</a>";
+}
+endif;
+
+if ( !function_exists( 'make_clickable' ) ) :
+/**
+ * Convert plaintext URI to HTML links.
+ *
+ * Converts URI, www and ftp, and email addresses. Finishes by fixing links
+ * within links.
+ *
+ * @since 0.71
+ *
+ * @param string $ret Content to convert URIs.
+ * @return string Content with converted URIs.
+ */
+function make_clickable($ret) {
+	$ret = ' ' . $ret;
+	// in testing, using arrays here was found to be faster
+	$ret = preg_replace_callback('#(?<=[\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#$%&~/\-=?@\[\](+]|[.,;:](?![\s<])|(?(1)\)(?![\s<])|\)))+)#is', '_make_url_clickable_cb', $ret);
+	$ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret);
+	$ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret);
+	// this one is not in an array because we need it to run last, for cleanup of accidental links within links
+	$ret = preg_replace("#(<a( [^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i", "$1$3</a>", $ret);
+	$ret = trim($ret);
+	return $ret;
+}
+endif;
+
+// ! function wp_rel_nofollow()
+// ! function wp_rel_nofollow_callback()
+// ! function translate_smiley()
+// ! function convert_smilies()
+
+if ( !function_exists('is_email') ) :
+/**
+ * Verifies that an email is valid.
+ *
+ * Does not grok i18n domains. Not RFC compliant.
+ *
+ * @since 0.71
+ *
+ * @param string $email Email address to verify.
+ * @param boolean $check_dns Whether to check the DNS for the domain using checkdnsrr().
+ * @return string|bool Either false or the valid email address.
+ */
+function is_email( $email, $check_dns = false ) {
+	// Test for the minimum length the email can be
+	if ( strlen( $email ) < 3 ) {
+		return apply_filters( 'is_email', false, $email, 'email_too_short' );
+	}
+
+	// Test for an @ character after the first position
+	if ( strpos( $email, '@', 1 ) === false ) {
+		return apply_filters( 'is_email', false, $email, 'email_no_at' );
+	}
+
+	// Split out the local and domain parts
+	list( $local, $domain ) = explode( '@', $email, 2 );
+
+	// LOCAL PART
+	// Test for invalid characters
+	if ( !preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) {
+		return apply_filters( 'is_email', false, $email, 'local_invalid_chars' );
+	}
+
+	// DOMAIN PART
+	// Test for sequences of periods
+	if ( preg_match( '/\.{2,}/', $domain ) ) {
+		return apply_filters( 'is_email', false, $email, 'domain_period_sequence' );
+	}
+
+	// Test for leading and trailing periods and whitespace
+	if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) {
+		return apply_filters( 'is_email', false, $email, 'domain_period_limits' );
+	}
+
+	// Split the domain into subs
+	$subs = explode( '.', $domain );
+
+	// Assume the domain will have at least two subs
+	if ( 2 > count( $subs ) ) {
+		return apply_filters( 'is_email', false, $email, 'domain_no_periods' );
+	}
+
+	// Loop through each sub
+	foreach ( $subs as $sub ) {
+		// Test for leading and trailing hyphens and whitespace
+		if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub ) {
+			return apply_filters( 'is_email', false, $email, 'sub_hyphen_limits' );
+		}
+
+		// Test for invalid characters
+		if ( !preg_match('/^[a-z0-9-]+$/i', $sub ) ) {
+			return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' );
+		}
+	}
+
+	// DNS
+	// Check the domain has a valid MX and A resource record
+	if ( $check_dns && function_exists( 'checkdnsrr' ) && !( checkdnsrr( $domain . '.', 'MX' ) || checkdnsrr( $domain . '.', 'A' ) ) ) {
+		return apply_filters( 'is_email', false, $email, 'dns_no_rr' );
+	}
+
+	// Congratulations your email made it!
+	return apply_filters( 'is_email', $email, $email, null );
+}
+endif;
+
+// ! function wp_iso_descrambler()
+// ! function get_gmt_from_date()
+// ! function get_date_from_gmt()
+// ! function iso8601_timezone_to_offset()
+// ! function iso8601_to_datetime()
+// ! popuplinks()
+
+if ( !function_exists('sanitize_email') ) :
+/**
+ * Strips out all characters that are not allowable in an email.
+ *
+ * @since 1.5.0
+ *
+ * @param string $email Email address to filter.
+ * @return string Filtered email address.
+ */
+function sanitize_email( $email ) {
+	// Test for the minimum length the email can be
+	if ( strlen( $email ) < 3 ) {
+		return apply_filters( 'sanitize_email', '', $email, 'email_too_short' );
+	}
+
+	// Test for an @ character after the first position
+	if ( strpos( $email, '@', 1 ) === false ) {
+		return apply_filters( 'sanitize_email', '', $email, 'email_no_at' );
+	}
+
+	// Split out the local and domain parts
+	list( $local, $domain ) = explode( '@', $email, 2 );
+
+	// LOCAL PART
+	// Test for invalid characters
+	$local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local );
+	if ( '' === $local ) {
+		return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' );
+	}
+
+	// DOMAIN PART
+	// Test for sequences of periods
+	$domain = preg_replace( '/\.{2,}/', '', $domain );
+	if ( '' === $domain ) {
+		return apply_filters( 'sanitize_email', '', $email, 'domain_period_sequence' );
+	}
+
+	// Test for leading and trailing periods and whitespace
+	$domain = trim( $domain, " \t\n\r\0\x0B." );
+	if ( '' === $domain ) {
+		return apply_filters( 'sanitize_email', '', $email, 'domain_period_limits' );
+	}
+
+	// Split the domain into subs
+	$subs = explode( '.', $domain );
+
+	// Assume the domain will have at least two subs
+	if ( 2 > count( $subs ) ) {
+		return apply_filters( 'sanitize_email', '', $email, 'domain_no_periods' );
+	}
+
+	// Create an array that will contain valid subs
+	$new_subs = array();
+
+	// Loop through each sub
+	foreach ( $subs as $sub ) {
+		// Test for leading and trailing hyphens
+		$sub = trim( $sub, " \t\n\r\0\x0B-" );
+
+		// Test for invalid characters
+		$sub = preg_replace( '/^[^a-z0-9-]+$/i', '', $sub );
+
+		// If there's anything left, add it to the valid subs
+		if ( '' !== $sub ) {
+			$new_subs[] = $sub;
+		}
+	}
+
+	// If there aren't 2 or more valid subs
+	if ( 2 > count( $new_subs ) ) {
+		return apply_filters( 'sanitize_email', '', $email, 'domain_no_valid_subs' );
+	}
+
+	// Join valid subs into the new domain
+	$domain = join( '.', $new_subs );
+
+	// Put the email back together
+	$email = $local . '@' . $domain;
+
+	// Congratulations your email made it!
+	return apply_filters( 'sanitize_email', $email, $email, null );
+}
+endif;
+
+// ! function human_time_diff()
+// ! function wp_trim_excerpt()
+
+if ( !function_exists( 'ent2ncr' ) ) : // Current at [WP9840]
+/**
+ * Converts named entities into numbered entities.
+ *
+ * @since 1.5.1
+ *
+ * @param string $text The text within which entities will be converted.
+ * @return string Text with converted entities.
+ */
+function ent2ncr($text) {
+	$to_ncr = array(
+		'&quot;' => '&#34;',
+		'&amp;' => '&#38;',
+		'&frasl;' => '&#47;',
+		'&lt;' => '&#60;',
+		'&gt;' => '&#62;',
+		'|' => '&#124;',
+		'&nbsp;' => '&#160;',
+		'&iexcl;' => '&#161;',
+		'&cent;' => '&#162;',
+		'&pound;' => '&#163;',
+		'&curren;' => '&#164;',
+		'&yen;' => '&#165;',
+		'&brvbar;' => '&#166;',
+		'&brkbar;' => '&#166;',
+		'&sect;' => '&#167;',
+		'&uml;' => '&#168;',
+		'&die;' => '&#168;',
+		'&copy;' => '&#169;',
+		'&ordf;' => '&#170;',
+		'&laquo;' => '&#171;',
+		'&not;' => '&#172;',
+		'&shy;' => '&#173;',
+		'&reg;' => '&#174;',
+		'&macr;' => '&#175;',
+		'&hibar;' => '&#175;',
+		'&deg;' => '&#176;',
+		'&plusmn;' => '&#177;',
+		'&sup2;' => '&#178;',
+		'&sup3;' => '&#179;',
+		'&acute;' => '&#180;',
+		'&micro;' => '&#181;',
+		'&para;' => '&#182;',
+		'&middot;' => '&#183;',
+		'&cedil;' => '&#184;',
+		'&sup1;' => '&#185;',
+		'&ordm;' => '&#186;',
+		'&raquo;' => '&#187;',
+		'&frac14;' => '&#188;',
+		'&frac12;' => '&#189;',
+		'&frac34;' => '&#190;',
+		'&iquest;' => '&#191;',
+		'&Agrave;' => '&#192;',
+		'&Aacute;' => '&#193;',
+		'&Acirc;' => '&#194;',
+		'&Atilde;' => '&#195;',
+		'&Auml;' => '&#196;',
+		'&Aring;' => '&#197;',
+		'&AElig;' => '&#198;',
+		'&Ccedil;' => '&#199;',
+		'&Egrave;' => '&#200;',
+		'&Eacute;' => '&#201;',
+		'&Ecirc;' => '&#202;',
+		'&Euml;' => '&#203;',
+		'&Igrave;' => '&#204;',
+		'&Iacute;' => '&#205;',
+		'&Icirc;' => '&#206;',
+		'&Iuml;' => '&#207;',
+		'&ETH;' => '&#208;',
+		'&Ntilde;' => '&#209;',
+		'&Ograve;' => '&#210;',
+		'&Oacute;' => '&#211;',
+		'&Ocirc;' => '&#212;',
+		'&Otilde;' => '&#213;',
+		'&Ouml;' => '&#214;',
+		'&times;' => '&#215;',
+		'&Oslash;' => '&#216;',
+		'&Ugrave;' => '&#217;',
+		'&Uacute;' => '&#218;',
+		'&Ucirc;' => '&#219;',
+		'&Uuml;' => '&#220;',
+		'&Yacute;' => '&#221;',
+		'&THORN;' => '&#222;',
+		'&szlig;' => '&#223;',
+		'&agrave;' => '&#224;',
+		'&aacute;' => '&#225;',
+		'&acirc;' => '&#226;',
+		'&atilde;' => '&#227;',
+		'&auml;' => '&#228;',
+		'&aring;' => '&#229;',
+		'&aelig;' => '&#230;',
+		'&ccedil;' => '&#231;',
+		'&egrave;' => '&#232;',
+		'&eacute;' => '&#233;',
+		'&ecirc;' => '&#234;',
+		'&euml;' => '&#235;',
+		'&igrave;' => '&#236;',
+		'&iacute;' => '&#237;',
+		'&icirc;' => '&#238;',
+		'&iuml;' => '&#239;',
+		'&eth;' => '&#240;',
+		'&ntilde;' => '&#241;',
+		'&ograve;' => '&#242;',
+		'&oacute;' => '&#243;',
+		'&ocirc;' => '&#244;',
+		'&otilde;' => '&#245;',
+		'&ouml;' => '&#246;',
+		'&divide;' => '&#247;',
+		'&oslash;' => '&#248;',
+		'&ugrave;' => '&#249;',
+		'&uacute;' => '&#250;',
+		'&ucirc;' => '&#251;',
+		'&uuml;' => '&#252;',
+		'&yacute;' => '&#253;',
+		'&thorn;' => '&#254;',
+		'&yuml;' => '&#255;',
+		'&OElig;' => '&#338;',
+		'&oelig;' => '&#339;',
+		'&Scaron;' => '&#352;',
+		'&scaron;' => '&#353;',
+		'&Yuml;' => '&#376;',
+		'&fnof;' => '&#402;',
+		'&circ;' => '&#710;',
+		'&tilde;' => '&#732;',
+		'&Alpha;' => '&#913;',
+		'&Beta;' => '&#914;',
+		'&Gamma;' => '&#915;',
+		'&Delta;' => '&#916;',
+		'&Epsilon;' => '&#917;',
+		'&Zeta;' => '&#918;',
+		'&Eta;' => '&#919;',
+		'&Theta;' => '&#920;',
+		'&Iota;' => '&#921;',
+		'&Kappa;' => '&#922;',
+		'&Lambda;' => '&#923;',
+		'&Mu;' => '&#924;',
+		'&Nu;' => '&#925;',
+		'&Xi;' => '&#926;',
+		'&Omicron;' => '&#927;',
+		'&Pi;' => '&#928;',
+		'&Rho;' => '&#929;',
+		'&Sigma;' => '&#931;',
+		'&Tau;' => '&#932;',
+		'&Upsilon;' => '&#933;',
+		'&Phi;' => '&#934;',
+		'&Chi;' => '&#935;',
+		'&Psi;' => '&#936;',
+		'&Omega;' => '&#937;',
+		'&alpha;' => '&#945;',
+		'&beta;' => '&#946;',
+		'&gamma;' => '&#947;',
+		'&delta;' => '&#948;',
+		'&epsilon;' => '&#949;',
+		'&zeta;' => '&#950;',
+		'&eta;' => '&#951;',
+		'&theta;' => '&#952;',
+		'&iota;' => '&#953;',
+		'&kappa;' => '&#954;',
+		'&lambda;' => '&#955;',
+		'&mu;' => '&#956;',
+		'&nu;' => '&#957;',
+		'&xi;' => '&#958;',
+		'&omicron;' => '&#959;',
+		'&pi;' => '&#960;',
+		'&rho;' => '&#961;',
+		'&sigmaf;' => '&#962;',
+		'&sigma;' => '&#963;',
+		'&tau;' => '&#964;',
+		'&upsilon;' => '&#965;',
+		'&phi;' => '&#966;',
+		'&chi;' => '&#967;',
+		'&psi;' => '&#968;',
+		'&omega;' => '&#969;',
+		'&thetasym;' => '&#977;',
+		'&upsih;' => '&#978;',
+		'&piv;' => '&#982;',
+		'&ensp;' => '&#8194;',
+		'&emsp;' => '&#8195;',
+		'&thinsp;' => '&#8201;',
+		'&zwnj;' => '&#8204;',
+		'&zwj;' => '&#8205;',
+		'&lrm;' => '&#8206;',
+		'&rlm;' => '&#8207;',
+		'&ndash;' => '&#8211;',
+		'&mdash;' => '&#8212;',
+		'&lsquo;' => '&#8216;',
+		'&rsquo;' => '&#8217;',
+		'&sbquo;' => '&#8218;',
+		'&ldquo;' => '&#8220;',
+		'&rdquo;' => '&#8221;',
+		'&bdquo;' => '&#8222;',
+		'&dagger;' => '&#8224;',
+		'&Dagger;' => '&#8225;',
+		'&bull;' => '&#8226;',
+		'&hellip;' => '&#8230;',
+		'&permil;' => '&#8240;',
+		'&prime;' => '&#8242;',
+		'&Prime;' => '&#8243;',
+		'&lsaquo;' => '&#8249;',
+		'&rsaquo;' => '&#8250;',
+		'&oline;' => '&#8254;',
+		'&frasl;' => '&#8260;',
+		'&euro;' => '&#8364;',
+		'&image;' => '&#8465;',
+		'&weierp;' => '&#8472;',
+		'&real;' => '&#8476;',
+		'&trade;' => '&#8482;',
+		'&alefsym;' => '&#8501;',
+		'&crarr;' => '&#8629;',
+		'&lArr;' => '&#8656;',
+		'&uArr;' => '&#8657;',
+		'&rArr;' => '&#8658;',
+		'&dArr;' => '&#8659;',
+		'&hArr;' => '&#8660;',
+		'&forall;' => '&#8704;',
+		'&part;' => '&#8706;',
+		'&exist;' => '&#8707;',
+		'&empty;' => '&#8709;',
+		'&nabla;' => '&#8711;',
+		'&isin;' => '&#8712;',
+		'&notin;' => '&#8713;',
+		'&ni;' => '&#8715;',
+		'&prod;' => '&#8719;',
+		'&sum;' => '&#8721;',
+		'&minus;' => '&#8722;',
+		'&lowast;' => '&#8727;',
+		'&radic;' => '&#8730;',
+		'&prop;' => '&#8733;',
+		'&infin;' => '&#8734;',
+		'&ang;' => '&#8736;',
+		'&and;' => '&#8743;',
+		'&or;' => '&#8744;',
+		'&cap;' => '&#8745;',
+		'&cup;' => '&#8746;',
+		'&int;' => '&#8747;',
+		'&there4;' => '&#8756;',
+		'&sim;' => '&#8764;',
+		'&cong;' => '&#8773;',
+		'&asymp;' => '&#8776;',
+		'&ne;' => '&#8800;',
+		'&equiv;' => '&#8801;',
+		'&le;' => '&#8804;',
+		'&ge;' => '&#8805;',
+		'&sub;' => '&#8834;',
+		'&sup;' => '&#8835;',
+		'&nsub;' => '&#8836;',
+		'&sube;' => '&#8838;',
+		'&supe;' => '&#8839;',
+		'&oplus;' => '&#8853;',
+		'&otimes;' => '&#8855;',
+		'&perp;' => '&#8869;',
+		'&sdot;' => '&#8901;',
+		'&lceil;' => '&#8968;',
+		'&rceil;' => '&#8969;',
+		'&lfloor;' => '&#8970;',
+		'&rfloor;' => '&#8971;',
+		'&lang;' => '&#9001;',
+		'&rang;' => '&#9002;',
+		'&larr;' => '&#8592;',
+		'&uarr;' => '&#8593;',
+		'&rarr;' => '&#8594;',
+		'&darr;' => '&#8595;',
+		'&harr;' => '&#8596;',
+		'&loz;' => '&#9674;',
+		'&spades;' => '&#9824;',
+		'&clubs;' => '&#9827;',
+		'&hearts;' => '&#9829;',
+		'&diams;' => '&#9830;'
+	);
+
+	return str_replace( array_keys($to_ncr), array_values($to_ncr), $text );
+}
+endif;
+
+// ! function wp_richedit_pre()
+// ! function wp_htmledit_pre()
+
+if ( !function_exists('clean_url') ) :
+/**
+ * Checks and cleans a URL.
+ *
+ * A number of characters are removed from the URL. If the URL is for displaying
+ * (the default behaviour) amperstands are also replaced. The 'esc_url' filter
+ * is applied to the returned cleaned URL.
+ *
+ * @since 1.2.0
+ * @uses wp_kses_bad_protocol() To only permit protocols in the URL set
+ *		via $protocols or the common ones set in the function.
+ *
+ * @param string $url The URL to be cleaned.
+ * @param array $protocols Optional. An array of acceptable protocols.
+ *		Defaults to 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet' if not set.
+ * @param string $context Optional. How the URL will be used. Default is 'display'.
+ * @return string The cleaned $url after the 'cleaned_url' filter is applied.
+ */
+function clean_url( $url, $protocols = null, $context = 'display' ) {
+	$original_url = $url;
+
+	if ('' == $url) return $url;
+	$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
+	$strip = array('%0d', '%0a', '%0D', '%0A');
+	$url = _deep_replace($strip, $url);
+	$url = str_replace(';//', '://', $url);
+	/* If the URL doesn't appear to contain a scheme, we
+	 * presume it needs http:// appended (unless a relative
+	 * link starting with / or a php file).
+	 */
+	if ( strpos($url, ':') === false &&
+		substr( $url, 0, 1 ) != '/' && substr( $url, 0, 1 ) != '#' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) )
+		$url = 'http://' . $url;
+
+	// Replace ampersands and single quotes only when displaying.
+	if ( 'display' == $context ) {
+		$url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&#038;$1', $url);
+		$url = str_replace( "'", '&#039;', $url );
+	}
+
+	if ( !is_array($protocols) )
+		$protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet');
+	if ( wp_kses_bad_protocol( $url, $protocols ) != $url )
+		return '';
+
+	return apply_filters('clean_url', $url, $original_url, $context);
+}
+endif;
+
+if ( !function_exists( '_deep_replace' ) ) :
+/**
+ * Perform a deep string replace operation to ensure the values in $search are no longer present
+ * 
+ * Repeats the replacement operation until it no longer replaces anything so as to remove "nested" values
+ * e.g. $subject = '%0%0%0DDD', $search ='%0D', $result ='' rather than the '%0%0DD' that
+ * str_replace would return
+ * 
+ * @since 2.8.1
+ * @access private
+ * 
+ * @param string|array $search
+ * @param string $subject
+ * @return string The processed string
+ */
+function _deep_replace($search, $subject){
+	$found = true;
+	while($found) {
+		$found = false;
+		foreach( (array) $search as $val ) {
+			while(strpos($subject, $val) !== false) {
+				$found = true;
+				$subject = str_replace($val, '', $subject);
+			}
+		}
+	}
+	
+	return $subject;
+}
+endif;
+
+if ( !function_exists( 'esc_sql' ) ) :
+/**
+ * Escapes data for use in a MySQL query
+ *
+ * This is just a handy shortcut for $bpdb->escape(), for completeness' sake
+ *
+ * @since 2.8.0
+ * @param string $sql Unescaped SQL data
+ * @return string The cleaned $sql
+ */
+function esc_sql( $sql ) {
+	global $bpdb;
+	return $bpdb->escape( $sql );
+}
+endif;
+
+if ( !function_exists( 'esc_url' ) ) :
+/**
+ * Checks and cleans a URL.
+ *
+ * A number of characters are removed from the URL. If the URL is for displaying
+ * (the default behaviour) amperstands are also replaced. The 'esc_url' filter
+ * is applied to the returned cleaned URL.
+ *
+ * @since 2.8.0
+ * @uses esc_url()
+ * @uses wp_kses_bad_protocol() To only permit protocols in the URL set
+ *		via $protocols or the common ones set in the function.
+ *
+ * @param string $url The URL to be cleaned.
+ * @param array $protocols Optional. An array of acceptable protocols.
+ *		Defaults to 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet' if not set.
+ * @return string The cleaned $url after the 'cleaned_url' filter is applied.
+ */
+function esc_url( $url, $protocols = null ) {
+	return clean_url( $url, $protocols, 'display' );
+}
+endif;
+
+if ( !function_exists( 'esc_url_raw' ) ) :
+/**
+ * Performs esc_url() for database usage.
+ *
+ * @see esc_url()
+ * @see esc_url()
+ *
+ * @since 2.8.0
+ *
+ * @param string $url The URL to be cleaned.
+ * @param array $protocols An array of acceptable protocols.
+ * @return string The cleaned URL.
+ */
+function esc_url_raw( $url, $protocols = null ) {
+	return clean_url( $url, $protocols, 'db' );
+}
+endif;
+
+// ! function sanitize_url()
+// ! function htmlentities2()
+
+if ( !function_exists( 'esc_js' ) ) :
+/**
+ * Escape single quotes, specialchar double quotes, and fix line endings.
+ *
+ * The filter 'js_escape' is also applied here.
+ *
+ * @since 2.8.0
+ *
+ * @param string $text The text to be escaped.
+ * @return string Escaped text.
+ */
+function esc_js( $text ) {
+	$safe_text = wp_check_invalid_utf8( $text );
+	$safe_text = _wp_specialchars( $safe_text, ENT_COMPAT );
+	$safe_text = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes( $safe_text ) );
+	$safe_text = preg_replace( "/\r?\n/", "\\n", addslashes( $safe_text ) );
+	return apply_filters( 'js_escape', $safe_text, $text );
+}
+endif;
+
+if ( !function_exists( 'js_escape' ) ) :
+/**
+ * Escape single quotes, specialchar double quotes, and fix line endings.
+ *
+ * The filter 'js_escape' is also applied by esc_js()
+ *
+ * @since 2.0.4
+ *
+ * @deprecated 2.8.0
+ * @see esc_js()
+ *
+ * @param string $text The text to be escaped.
+ * @return string Escaped text.
+ */
+function js_escape( $text ) {
+	return esc_js( $text );
+}
+endif;
+
+if ( !function_exists( 'esc_html' ) ) :
+/**
+ * Escaping for HTML blocks.
+ *
+ * @since 2.8.0
+ *
+ * @param string $text
+ * @return string
+ */
+function esc_html( $text ) {
+	$safe_text = wp_check_invalid_utf8( $text );
+	$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
+	return apply_filters( 'esc_html', $safe_text, $text );
+	return $text;
+}
+endif;
+
+if ( !function_exists( 'wp_specialchars' ) ) :
+/**
+ * Escaping for HTML blocks
+ * @deprecated 2.8.0
+ * @see esc_html()
+ */
+function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
+	if ( func_num_args() > 1 ) { // Maintain backwards compat for people passing additional args
+		$args = func_get_args();
+		return call_user_func_array( '_wp_specialchars', $args );
+	} else {
+		return esc_html( $string );
+	}
+}
+endif;
+
+if ( !function_exists( 'esc_attr' ) ) :
+/**
+ * Escaping for HTML attributes.
+ *
+ * @since 2.8.0
+ *
+ * @param string $text
+ * @return string
+ */
+function esc_attr( $text ) {
+	$safe_text = wp_check_invalid_utf8( $text );
+	$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
+	return apply_filters( 'attribute_escape', $safe_text, $text );
+}
+endif;
+
+if ( !function_exists( 'attribute_escape' ) ) :
+/**
+ * Escaping for HTML attributes.
+ *
+ * @since 2.0.6
+ *
+ * @deprecated 2.8.0
+ * @see esc_attr()
+ *
+ * @param string $text
+ * @return string
+ */
+function attribute_escape( $text ) {
+	return esc_attr( $text );
+}
+endif;
+
+// ! function tag_escape()
+
+if ( !function_exists('like_escape') ) :
+/**
+ * Escapes text for SQL LIKE special characters % and _.
+ *
+ * @since 2.5.0
+ *
+ * @param string $text The text to be escaped.
+ * @return string text, safe for inclusion in LIKE query.
+ */
+function like_escape($text) {
+	return str_replace(array("%", "_"), array("\\%", "\\_"), $text);
+}
+endif;
+
+// ! function wp_make_link_relative()
+// ! function sanitize_option()
+
+if ( !function_exists('wp_parse_str') ) :
+/**
+ * Parses a string into variables to be stored in an array.
+ *
+ * Uses {@link http://www.php.net/parse_str parse_str()} and stripslashes if
+ * {@link http://www.php.net/magic_quotes magic_quotes_gpc} is on.
+ *
+ * @since 2.2.1
+ * @uses apply_filters() for the 'wp_parse_str' filter.
+ *
+ * @param string $string The string to be parsed.
+ * @param array $array Variables will be stored in this array.
+ */
+function wp_parse_str( $string, &$array ) {
+	parse_str( $string, $array );
+	if ( get_magic_quotes_gpc() )
+		$array = stripslashes_deep( $array );
+	$array = apply_filters( 'wp_parse_str', $array );
+}
+endif;
+
+// ! function wp_pre_kses_less_than()
+// ! function wp_pre_kses_less_than_callback()
+// ! function wp_sprintf()
+// ! function wp_sprintf_l()
+
+if ( !function_exists('wp_html_excerpt') ) :
+/**
+ * Safely extracts not more than the first $count characters from html string.
+ *
+ * UTF-8, tags and entities safe prefix extraction. Entities inside will *NOT*
+ * be counted as one character. For example &amp; will be counted as 4, &lt; as
+ * 3, etc.
+ *
+ * @since 2.5.0
+ *
+ * @param integer $str String to get the excerpt from.
+ * @param integer $count Maximum number of characters to take.
+ * @return string The excerpt.
+ */
+function wp_html_excerpt( $str, $count ) {
+	$str = strip_tags( $str );
+	$str = mb_substr( $str, 0, $count );
+	// remove part of an entity at the end
+	$str = preg_replace( '/&[^;\s]{0,6}$/', '', $str );
+	return $str;
+}
+endif;
+
+// ! function links_add_base_url()
+// ! function _links_add_base()
+// ! function links_add_target()
+// ! function _links_add_target()
+// ! function normalize_whitespace()
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.kses.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.kses.php
new file mode 100644
index 0000000000000000000000000000000000000000..1755657b893fbf7cf7641d747528f61ba1d16c44
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.kses.php
@@ -0,0 +1,712 @@
+<?php
+// Last sync [WP11537]
+
+/**
+ * HTML/XHTML filter that only allows some elements and attributes
+ *
+ * Added wp_ prefix to avoid conflicts with existing kses users
+ *
+ * @version 0.2.2
+ * @copyright (C) 2002, 2003, 2005
+ * @author Ulf Harnhammar <metaur@users.sourceforge.net>
+ *
+ * @package External
+ * @subpackage KSES
+ *
+ * @internal
+ * *** CONTACT INFORMATION ***
+ * E-mail:      metaur at users dot sourceforge dot net
+ * Web page:    http://sourceforge.net/projects/kses
+ * Paper mail:  Ulf Harnhammar
+ *              Ymergatan 17 C
+ *              753 25  Uppsala
+ *              SWEDEN
+ *
+ * [kses strips evil scripts!]
+ */
+
+
+/**
+ * Filters content and keeps only allowable HTML elements.
+ *
+ * This function makes sure that only the allowed HTML element names, attribute
+ * names and attribute values plus only sane HTML entities will occur in
+ * $string. You have to remove any slashes from PHP's magic quotes before you
+ * call this function.
+ *
+ * The default allowed protocols are 'http', 'https', 'ftp', 'mailto', 'news',
+ * 'irc', 'gopher', 'nntp', 'feed', and finally 'telnet. This covers all common
+ * link protocols, except for 'javascript' which should not be allowed for
+ * untrusted users.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string Content to filter through kses
+ * @param array $allowed_html List of allowed HTML elements
+ * @param array $allowed_protocols Optional. Allowed protocol in links.
+ * @return string Filtered content with only allowed HTML elements
+ */
+function wp_kses($string, $allowed_html, $allowed_protocols = array ('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet')) {
+	$string = wp_kses_no_null($string);
+	$string = wp_kses_js_entities($string);
+	$string = wp_kses_normalize_entities($string);
+	$allowed_html_fixed = wp_kses_array_lc($allowed_html);
+	$string = wp_kses_hook($string, $allowed_html_fixed, $allowed_protocols); // WP changed the order of these funcs and added args to wp_kses_hook
+	return wp_kses_split($string, $allowed_html_fixed, $allowed_protocols);
+}
+
+/**
+ * You add any kses hooks here.
+ *
+ * There is currently only one kses WordPress hook and it is called here. All
+ * parameters are passed to the hooks and expected to recieve a string.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string Content to filter through kses
+ * @param array $allowed_html List of allowed HTML elements
+ * @param array $allowed_protocols Allowed protocol in links
+ * @return string Filtered content through 'pre_kses' hook
+ */
+function wp_kses_hook($string, $allowed_html, $allowed_protocols) {
+	$string = apply_filters('pre_kses', $string, $allowed_html, $allowed_protocols);
+	return $string;
+}
+
+/**
+ * This function returns kses' version number.
+ *
+ * @since 1.0.0
+ *
+ * @return string KSES Version Number
+ */
+function wp_kses_version() {
+	return '0.2.2';
+}
+
+/**
+ * Searches for HTML tags, no matter how malformed.
+ *
+ * It also matches stray ">" characters.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string Content to filter
+ * @param array $allowed_html Allowed HTML elements
+ * @param array $allowed_protocols Allowed protocols to keep
+ * @return string Content with fixed HTML tags
+ */
+function wp_kses_split($string, $allowed_html, $allowed_protocols) {
+	global $pass_allowed_html, $pass_allowed_protocols;
+	$pass_allowed_html = $allowed_html;
+	$pass_allowed_protocols = $allowed_protocols;
+	return preg_replace_callback('%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%',
+		create_function('$match', 'global $pass_allowed_html, $pass_allowed_protocols; return wp_kses_split2($match[1], $pass_allowed_html, $pass_allowed_protocols);'), $string);
+}
+
+/**
+ * Callback for wp_kses_split for fixing malformed HTML tags.
+ *
+ * This function does a lot of work. It rejects some very malformed things like
+ * <:::>. It returns an empty string, if the element isn't allowed (look ma, no
+ * strip_tags()!). Otherwise it splits the tag into an element and an attribute
+ * list.
+ *
+ * After the tag is split into an element and an attribute list, it is run
+ * through another filter which will remove illegal attributes and once that is
+ * completed, will be returned.
+ *
+ * @access private
+ * @since 1.0.0
+ * @uses wp_kses_attr()
+ *
+ * @param string $string Content to filter
+ * @param array $allowed_html Allowed HTML elements
+ * @param array $allowed_protocols Allowed protocols to keep
+ * @return string Fixed HTML element
+ */
+function wp_kses_split2($string, $allowed_html, $allowed_protocols) {
+	$string = wp_kses_stripslashes($string);
+
+	if (substr($string, 0, 1) != '<')
+		return '&gt;';
+	# It matched a ">" character
+
+	if (preg_match('%^<!--(.*?)(-->)?$%', $string, $matches)) {
+		$string = str_replace(array('<!--', '-->'), '', $matches[1]);
+		while ( $string != $newstring = wp_kses($string, $allowed_html, $allowed_protocols) )
+			$string = $newstring;
+		if ( $string == '' )
+			return '';
+		// prevent multiple dashes in comments
+		$string = preg_replace('/--+/', '-', $string);
+		// prevent three dashes closing a comment
+		$string = preg_replace('/-$/', '', $string);
+		return "<!--{$string}-->";
+	}
+	# Allow HTML comments
+
+	if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches))
+		return '';
+	# It's seriously malformed
+
+	$slash = trim($matches[1]);
+	$elem = $matches[2];
+	$attrlist = $matches[3];
+
+	if (!@isset($allowed_html[strtolower($elem)]))
+		return '';
+	# They are using a not allowed HTML element
+
+	if ($slash != '')
+		return "<$slash$elem>";
+	# No attributes are allowed for closing elements
+
+	return wp_kses_attr("$slash$elem", $attrlist, $allowed_html, $allowed_protocols);
+}
+
+/**
+ * Removes all attributes, if none are allowed for this element.
+ *
+ * If some are allowed it calls wp_kses_hair() to split them further, and then
+ * it builds up new HTML code from the data that kses_hair() returns. It also
+ * removes "<" and ">" characters, if there are any left. One more thing it does
+ * is to check if the tag has a closing XHTML slash, and if it does, it puts one
+ * in the returned code as well.
+ *
+ * @since 1.0.0
+ *
+ * @param string $element HTML element/tag
+ * @param string $attr HTML attributes from HTML element to closing HTML element tag
+ * @param array $allowed_html Allowed HTML elements
+ * @param array $allowed_protocols Allowed protocols to keep
+ * @return string Sanitized HTML element
+ */
+function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) {
+	# Is there a closing XHTML slash at the end of the attributes?
+
+	$xhtml_slash = '';
+	if (preg_match('%\s/\s*$%', $attr))
+		$xhtml_slash = ' /';
+
+	# Are any attributes allowed at all for this element?
+
+	if (@ count($allowed_html[strtolower($element)]) == 0)
+		return "<$element$xhtml_slash>";
+
+	# Split it
+
+	$attrarr = wp_kses_hair($attr, $allowed_protocols);
+
+	# Go through $attrarr, and save the allowed attributes for this element
+	# in $attr2
+
+	$attr2 = '';
+
+	foreach ($attrarr as $arreach) {
+		if (!@ isset ($allowed_html[strtolower($element)][strtolower($arreach['name'])]))
+			continue; # the attribute is not allowed
+
+		$current = $allowed_html[strtolower($element)][strtolower($arreach['name'])];
+		if ($current == '')
+			continue; # the attribute is not allowed
+
+		if (!is_array($current))
+			$attr2 .= ' '.$arreach['whole'];
+		# there are no checks
+
+		else {
+			# there are some checks
+			$ok = true;
+			foreach ($current as $currkey => $currval)
+				if (!wp_kses_check_attr_val($arreach['value'], $arreach['vless'], $currkey, $currval)) {
+					$ok = false;
+					break;
+				}
+
+			if ($ok)
+				$attr2 .= ' '.$arreach['whole']; # it passed them
+		} # if !is_array($current)
+	} # foreach
+
+	# Remove any "<" or ">" characters
+
+	$attr2 = preg_replace('/[<>]/', '', $attr2);
+
+	return "<$element$attr2$xhtml_slash>";
+}
+
+/**
+ * Builds an attribute list from string containing attributes.
+ *
+ * This function does a lot of work. It parses an attribute list into an array
+ * with attribute data, and tries to do the right thing even if it gets weird
+ * input. It will add quotes around attribute values that don't have any quotes
+ * or apostrophes around them, to make it easier to produce HTML code that will
+ * conform to W3C's HTML specification. It will also remove bad URL protocols
+ * from attribute values.  It also reduces duplicate attributes by using the
+ * attribute defined first (foo='bar' foo='baz' will result in foo='bar').
+ *
+ * @since 1.0.0
+ *
+ * @param string $attr Attribute list from HTML element to closing HTML element tag
+ * @param array $allowed_protocols Allowed protocols to keep
+ * @return array List of attributes after parsing
+ */
+function wp_kses_hair($attr, $allowed_protocols) {
+	$attrarr = array ();
+	$mode = 0;
+	$attrname = '';
+	$uris = array('xmlns', 'profile', 'href', 'src', 'cite', 'classid', 'codebase', 'data', 'usemap', 'longdesc', 'action');
+
+	# Loop through the whole attribute list
+
+	while (strlen($attr) != 0) {
+		$working = 0; # Was the last operation successful?
+
+		switch ($mode) {
+			case 0 : # attribute name, href for instance
+
+				if (preg_match('/^([-a-zA-Z]+)/', $attr, $match)) {
+					$attrname = $match[1];
+					$working = $mode = 1;
+					$attr = preg_replace('/^[-a-zA-Z]+/', '', $attr);
+				}
+
+				break;
+
+			case 1 : # equals sign or valueless ("selected")
+
+				if (preg_match('/^\s*=\s*/', $attr)) # equals sign
+					{
+					$working = 1;
+					$mode = 2;
+					$attr = preg_replace('/^\s*=\s*/', '', $attr);
+					break;
+				}
+
+				if (preg_match('/^\s+/', $attr)) # valueless
+					{
+					$working = 1;
+					$mode = 0;
+					if(FALSE === array_key_exists($attrname, $attrarr)) {
+						$attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y');
+					}
+					$attr = preg_replace('/^\s+/', '', $attr);
+				}
+
+				break;
+
+			case 2 : # attribute value, a URL after href= for instance
+
+				if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match))
+					# "value"
+					{
+					$thisval = $match[1];
+					if ( in_array($attrname, $uris) )
+						$thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
+
+					if(FALSE === array_key_exists($attrname, $attrarr)) {
+						$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
+					}
+					$working = 1;
+					$mode = 0;
+					$attr = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr);
+					break;
+				}
+
+				if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match))
+					# 'value'
+					{
+					$thisval = $match[1];
+					if ( in_array($attrname, $uris) )
+						$thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
+
+					if(FALSE === array_key_exists($attrname, $attrarr)) {
+						$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n');
+					}
+					$working = 1;
+					$mode = 0;
+					$attr = preg_replace("/^'[^']*'(\s+|$)/", '', $attr);
+					break;
+				}
+
+				if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match))
+					# value
+					{
+					$thisval = $match[1];
+					if ( in_array($attrname, $uris) )
+						$thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
+
+					if(FALSE === array_key_exists($attrname, $attrarr)) {
+						$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
+					}
+					# We add quotes to conform to W3C's HTML spec.
+					$working = 1;
+					$mode = 0;
+					$attr = preg_replace("%^[^\s\"']+(\s+|$)%", '', $attr);
+				}
+
+				break;
+		} # switch
+
+		if ($working == 0) # not well formed, remove and try again
+		{
+			$attr = wp_kses_html_error($attr);
+			$mode = 0;
+		}
+	} # while
+
+	if ($mode == 1 && FALSE === array_key_exists($attrname, $attrarr))
+		# special case, for when the attribute list ends with a valueless
+		# attribute like "selected"
+		$attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y');
+
+	return $attrarr;
+}
+
+/**
+ * Performs different checks for attribute values.
+ *
+ * The currently implemented checks are "maxlen", "minlen", "maxval", "minval"
+ * and "valueless" with even more checks to come soon.
+ *
+ * @since 1.0.0
+ *
+ * @param string $value Attribute value
+ * @param string $vless Whether the value is valueless or not. Use 'y' or 'n'
+ * @param string $checkname What $checkvalue is checking for.
+ * @param mixed $checkvalue What constraint the value should pass
+ * @return bool Whether check passes (true) or not (false)
+ */
+function wp_kses_check_attr_val($value, $vless, $checkname, $checkvalue) {
+	$ok = true;
+
+	switch (strtolower($checkname)) {
+		case 'maxlen' :
+			# The maxlen check makes sure that the attribute value has a length not
+			# greater than the given value. This can be used to avoid Buffer Overflows
+			# in WWW clients and various Internet servers.
+
+			if (strlen($value) > $checkvalue)
+				$ok = false;
+			break;
+
+		case 'minlen' :
+			# The minlen check makes sure that the attribute value has a length not
+			# smaller than the given value.
+
+			if (strlen($value) < $checkvalue)
+				$ok = false;
+			break;
+
+		case 'maxval' :
+			# The maxval check does two things: it checks that the attribute value is
+			# an integer from 0 and up, without an excessive amount of zeroes or
+			# whitespace (to avoid Buffer Overflows). It also checks that the attribute
+			# value is not greater than the given value.
+			# This check can be used to avoid Denial of Service attacks.
+
+			if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value))
+				$ok = false;
+			if ($value > $checkvalue)
+				$ok = false;
+			break;
+
+		case 'minval' :
+			# The minval check checks that the attribute value is a positive integer,
+			# and that it is not smaller than the given value.
+
+			if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value))
+				$ok = false;
+			if ($value < $checkvalue)
+				$ok = false;
+			break;
+
+		case 'valueless' :
+			# The valueless check checks if the attribute has a value
+			# (like <a href="blah">) or not (<option selected>). If the given value
+			# is a "y" or a "Y", the attribute must not have a value.
+			# If the given value is an "n" or an "N", the attribute must have one.
+
+			if (strtolower($checkvalue) != $vless)
+				$ok = false;
+			break;
+	} # switch
+
+	return $ok;
+}
+
+/**
+ * Sanitize string from bad protocols.
+ *
+ * This function removes all non-allowed protocols from the beginning of
+ * $string. It ignores whitespace and the case of the letters, and it does
+ * understand HTML entities. It does its work in a while loop, so it won't be
+ * fooled by a string like "javascript:javascript:alert(57)".
+ *
+ * @since 1.0.0
+ *
+ * @param string $string Content to filter bad protocols from
+ * @param array $allowed_protocols Allowed protocols to keep
+ * @return string Filtered content
+ */
+function wp_kses_bad_protocol($string, $allowed_protocols) {
+	$string = wp_kses_no_null($string);
+	$string = preg_replace('/\xad+/', '', $string); # deals with Opera "feature"
+	$string2 = $string.'a';
+
+	while ($string != $string2) {
+		$string2 = $string;
+		$string = wp_kses_bad_protocol_once($string, $allowed_protocols);
+	} # while
+
+	return $string;
+}
+
+/**
+ * Removes any NULL characters in $string.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string
+ * @return string
+ */
+function wp_kses_no_null($string) {
+	$string = preg_replace('/\0+/', '', $string);
+	$string = preg_replace('/(\\\\0)+/', '', $string);
+
+	return $string;
+}
+
+/**
+ * Strips slashes from in front of quotes.
+ *
+ * This function changes the character sequence  \"  to just  ". It leaves all
+ * other slashes alone. It's really weird, but the quoting from
+ * preg_replace(//e) seems to require this.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string String to strip slashes
+ * @return string Fixed strings with quoted slashes
+ */
+function wp_kses_stripslashes($string) {
+	return preg_replace('%\\\\"%', '"', $string);
+}
+
+/**
+ * Goes through an array and changes the keys to all lower case.
+ *
+ * @since 1.0.0
+ *
+ * @param array $inarray Unfiltered array
+ * @return array Fixed array with all lowercase keys
+ */
+function wp_kses_array_lc($inarray) {
+	$outarray = array ();
+
+	foreach ( (array) $inarray as $inkey => $inval) {
+		$outkey = strtolower($inkey);
+		$outarray[$outkey] = array ();
+
+		foreach ( (array) $inval as $inkey2 => $inval2) {
+			$outkey2 = strtolower($inkey2);
+			$outarray[$outkey][$outkey2] = $inval2;
+		} # foreach $inval
+	} # foreach $inarray
+
+	return $outarray;
+}
+
+/**
+ * Removes the HTML JavaScript entities found in early versions of Netscape 4.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string
+ * @return string
+ */
+function wp_kses_js_entities($string) {
+	return preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string);
+}
+
+/**
+ * Handles parsing errors in wp_kses_hair().
+ *
+ * The general plan is to remove everything to and including some whitespace,
+ * but it deals with quotes and apostrophes as well.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string
+ * @return string
+ */
+function wp_kses_html_error($string) {
+	return preg_replace('/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string);
+}
+
+/**
+ * Sanitizes content from bad protocols and other characters.
+ *
+ * This function searches for URL protocols at the beginning of $string, while
+ * handling whitespace and HTML entities.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string Content to check for bad protocols
+ * @param string $allowed_protocols Allowed protocols
+ * @return string Sanitized content
+ */
+function wp_kses_bad_protocol_once($string, $allowed_protocols) {
+	global $_kses_allowed_protocols;
+	$_kses_allowed_protocols = $allowed_protocols;
+
+	$string2 = preg_split('/:|&#58;|&#x3a;/i', $string, 2);
+	if ( isset($string2[1]) && !preg_match('%/\?%', $string2[0]) )
+		$string = wp_kses_bad_protocol_once2($string2[0]) . trim($string2[1]);
+	else
+		$string = preg_replace_callback('/^((&[^;]*;|[\sA-Za-z0-9])*)'.'(:|&#58;|&#[Xx]3[Aa];)\s*/', 'wp_kses_bad_protocol_once2', $string);
+
+	return $string;
+}
+
+/**
+ * Callback for wp_kses_bad_protocol_once() regular expression.
+ *
+ * This function processes URL protocols, checks to see if they're in the
+ * white-list or not, and returns different data depending on the answer.
+ *
+ * @access private
+ * @since 1.0.0
+ *
+ * @param mixed $matches string or preg_replace_callback() matches array to check for bad protocols
+ * @return string Sanitized content
+ */
+function wp_kses_bad_protocol_once2($matches) {
+	global $_kses_allowed_protocols;
+
+	if ( is_array($matches) ) {
+		if ( ! isset($matches[1]) || empty($matches[1]) )
+			return '';
+
+		$string = $matches[1];
+	} else {
+		$string = $matches;
+	}
+
+	$string2 = wp_kses_decode_entities($string);
+	$string2 = preg_replace('/\s/', '', $string2);
+	$string2 = wp_kses_no_null($string2);
+	$string2 = preg_replace('/\xad+/', '', $string2);
+	# deals with Opera "feature"
+	$string2 = strtolower($string2);
+
+	$allowed = false;
+	foreach ( (array) $_kses_allowed_protocols as $one_protocol)
+		if (strtolower($one_protocol) == $string2) {
+			$allowed = true;
+			break;
+		}
+
+	if ($allowed)
+		return "$string2:";
+	else
+		return '';
+}
+
+/**
+ * Converts and fixes HTML entities.
+ *
+ * This function normalizes HTML entities. It will convert "AT&T" to the correct
+ * "AT&amp;T", "&#00058;" to "&#58;", "&#XYZZY;" to "&amp;#XYZZY;" and so on.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string Content to normalize entities
+ * @return string Content with normalized entities
+ */
+function wp_kses_normalize_entities($string) {
+	# Disarm all entities by converting & to &amp;
+
+	$string = str_replace('&', '&amp;', $string);
+
+	# Change back the allowed entities in our entity whitelist
+
+	$string = preg_replace('/&amp;([A-Za-z][A-Za-z0-9]{0,19});/', '&\\1;', $string);
+	$string = preg_replace_callback('/&amp;#0*([0-9]{1,5});/', 'wp_kses_normalize_entities2', $string);
+	$string = preg_replace_callback('/&amp;#([Xx])0*(([0-9A-Fa-f]{2}){1,2});/', 'wp_kses_normalize_entities3', $string);
+
+	return $string;
+}
+
+/**
+ * Callback for wp_kses_normalize_entities() regular expression.
+ *
+ * This function helps wp_kses_normalize_entities() to only accept 16 bit values
+ * and nothing more for &#number; entities.
+ *
+ * @access private
+ * @since 1.0.0
+ *
+ * @param array $matches preg_replace_callback() matches array
+ * @return string Correctly encoded entity
+ */
+function wp_kses_normalize_entities2($matches) {
+	if ( ! isset($matches[1]) || empty($matches[1]) )
+		return '';
+
+	$i = $matches[1];
+	return ( ( ! valid_unicode($i) ) || ($i > 65535) ? "&amp;#$i;" : "&#$i;" );
+}
+
+/**
+ * Callback for wp_kses_normalize_entities() for regular expression.
+ *
+ * This function helps wp_kses_normalize_entities() to only accept valid Unicode
+ * numeric entities in hex form.
+ *
+ * @access private
+ *
+ * @param array $matches preg_replace_callback() matches array
+ * @return string Correctly encoded entity
+ */
+function wp_kses_normalize_entities3($matches) {
+	if ( ! isset($matches[2]) || empty($matches[2]) )
+		return '';
+
+	$hexchars = $matches[2];
+	return ( ( ! valid_unicode(hexdec($hexchars)) ) ? "&amp;#x$hexchars;" : "&#x$hexchars;" );
+}
+
+/**
+ * Helper function to determine if a Unicode value is valid.
+ *
+ * @param int $i Unicode value
+ * @return bool true if the value was a valid Unicode number
+ */
+function valid_unicode($i) {
+	return ( $i == 0x9 || $i == 0xa || $i == 0xd ||
+			($i >= 0x20 && $i <= 0xd7ff) ||
+			($i >= 0xe000 && $i <= 0xfffd) ||
+			($i >= 0x10000 && $i <= 0x10ffff) );
+}
+
+/**
+ * Convert all entities to their character counterparts.
+ *
+ * This function decodes numeric HTML entities (&#65; and &#x41;). It doesn't do
+ * anything with other entities like &auml;, but we don't need them in the URL
+ * protocol whitelisting system anyway.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string Content to change entities
+ * @return string Content after decoded entities
+ */
+function wp_kses_decode_entities($string) {
+	$string = preg_replace_callback('/&#([0-9]+);/', create_function('$match', 'return chr($match[1]);'), $string);
+	$string = preg_replace_callback('/&#[Xx]([0-9A-Fa-f]+);/', create_function('$match', 'return chr(hexdec($match[1]));'), $string);
+
+	return $string;
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.plugin-api.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.plugin-api.php
new file mode 100644
index 0000000000000000000000000000000000000000..787a02bb4364d3bdf40c9b11c82c5c5670642660
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.plugin-api.php
@@ -0,0 +1,697 @@
+<?php
+// Last sync [WP11537]
+
+/**
+ * The plugin API is located in this file, which allows for creating actions
+ * and filters and hooking functions, and methods. The functions or methods will
+ * then be run when the action or filter is called.
+ *
+ * The API callback examples reference functions, but can be methods of classes.
+ * To hook methods, you'll need to pass an array one of two ways.
+ *
+ * Any of the syntaxes explained in the PHP documentation for the
+ * {@link http://us2.php.net/manual/en/language.pseudo-types.php#language.types.callback 'callback'}
+ * type are valid.
+ *
+ * Also see the {@link http://codex.wordpress.org/Plugin_API Plugin API} for
+ * more information and examples on how to use a lot of these functions.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 1.5
+ */
+
+/**
+ * Hooks a function or method to a specific filter action.
+ *
+ * Filters are the hooks that WordPress launches to modify text of various types
+ * before adding it to the database or sending it to the browser screen. Plugins
+ * can specify that one or more of its PHP functions is executed to
+ * modify specific types of text at these times, using the Filter API.
+ *
+ * To use the API, the following code should be used to bind a callback to the
+ * filter.
+ *
+ * <code>
+ * function example_hook($example) { echo $example; }
+ * add_filter('example_filter', 'example_hook');
+ * </code>
+ *
+ * In WordPress 1.5.1+, hooked functions can take extra arguments that are set
+ * when the matching do_action() or apply_filters() call is run. The
+ * $accepted_args allow for calling functions only when the number of args
+ * match. Hooked functions can take extra arguments that are set when the
+ * matching do_action() or apply_filters() call is run. For example, the action
+ * comment_id_not_found will pass any functions that hook onto it the ID of the
+ * requested comment.
+ *
+ * <strong>Note:</strong> the function will return true no matter if the
+ * function was hooked fails or not. There are no checks for whether the
+ * function exists beforehand and no checks to whether the <tt>$function_to_add
+ * is even a string. It is up to you to take care and this is done for
+ * optimization purposes, so everything is as quick as possible.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 0.71
+ * @global array $wp_filter Stores all of the filters added in the form of
+ *	wp_filter['tag']['array of priorities']['array of functions serialized']['array of ['array (functions, accepted_args)]']
+ * @global array $merged_filters Tracks the tags that need to be merged for later. If the hook is added, it doesn't need to run through that process.
+ *
+ * @param string $tag The name of the filter to hook the $function_to_add to.
+ * @param callback $function_to_add The name of the function to be called when the filter is applied.
+ * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
+ * @param int $accepted_args optional. The number of arguments the function accept (default 1).
+ * @return boolean true
+ */
+function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
+	global $wp_filter, $merged_filters;
+
+	$idx = _wp_filter_build_unique_id($tag, $function_to_add, $priority);
+	$wp_filter[$tag][$priority][$idx] = array('function' => $function_to_add, 'accepted_args' => $accepted_args);
+	unset( $merged_filters[ $tag ] );
+	return true;
+}
+
+/**
+ * Check if any filter has been registered for a hook.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 2.5
+ * @global array $wp_filter Stores all of the filters
+ *
+ * @param string $tag The name of the filter hook.
+ * @param callback $function_to_check optional.  If specified, return the priority of that function on this hook or false if not attached.
+ * @return int|boolean Optionally returns the priority on that hook for the specified function.
+ */
+function has_filter($tag, $function_to_check = false) {
+	global $wp_filter;
+
+	$has = !empty($wp_filter[$tag]);
+	if ( false === $function_to_check || false == $has )
+		return $has;
+
+	if ( !$idx = _wp_filter_build_unique_id($tag, $function_to_check, false) )
+		return false;
+
+	foreach ( (array) array_keys($wp_filter[$tag]) as $priority ) {
+		if ( isset($wp_filter[$tag][$priority][$idx]) )
+			return $priority;
+	}
+
+	return false;
+}
+
+/**
+ * Call the functions added to a filter hook.
+ *
+ * The callback functions attached to filter hook $tag are invoked by calling
+ * this function. This function can be used to create a new filter hook by
+ * simply calling this function with the name of the new hook specified using
+ * the $tag parameter.
+ *
+ * The function allows for additional arguments to be added and passed to hooks.
+ * <code>
+ * function example_hook($string, $arg1, $arg2)
+ * {
+ *		//Do stuff
+ *		return $string;
+ * }
+ * $value = apply_filters('example_filter', 'filter me', 'arg1', 'arg2');
+ * </code>
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 0.71
+ * @global array $wp_filter Stores all of the filters
+ * @global array $merged_filters Merges the filter hooks using this function.
+ * @global array $wp_current_filter stores the list of current filters with the current one last
+ *
+ * @param string $tag The name of the filter hook.
+ * @param mixed $value The value on which the filters hooked to <tt>$tag</tt> are applied on.
+ * @param mixed $var,... Additional variables passed to the functions hooked to <tt>$tag</tt>.
+ * @return mixed The filtered value after all hooked functions are applied to it.
+ */
+function apply_filters($tag, $value) {
+	global $wp_filter, $merged_filters, $wp_current_filter;
+
+	$args = array();
+	$wp_current_filter[] = $tag;
+
+	// Do 'all' actions first
+	if ( isset($wp_filter['all']) ) {
+		$args = func_get_args();
+		_wp_call_all_hook($args);
+	}
+
+	if ( !isset($wp_filter[$tag]) ) {
+		array_pop($wp_current_filter);
+		return $value;
+	}
+
+	// Sort
+	if ( !isset( $merged_filters[ $tag ] ) ) {
+		ksort($wp_filter[$tag]);
+		$merged_filters[ $tag ] = true;
+	}
+
+	reset( $wp_filter[ $tag ] );
+
+	if ( empty($args) )
+		$args = func_get_args();
+
+	do {
+		foreach( (array) current($wp_filter[$tag]) as $the_ )
+			if ( !is_null($the_['function']) ){
+				$args[1] = $value;
+				$value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));
+			}
+
+	} while ( next($wp_filter[$tag]) !== false );
+
+	array_pop( $wp_current_filter );
+
+	return $value;
+}
+
+/**
+ * Removes a function from a specified filter hook.
+ *
+ * This function removes a function attached to a specified filter hook. This
+ * method can be used to remove default functions attached to a specific filter
+ * hook and possibly replace them with a substitute.
+ *
+ * To remove a hook, the $function_to_remove and $priority arguments must match
+ * when the hook was added. This goes for both filters and actions. No warning
+ * will be given on removal failure.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 1.2
+ *
+ * @param string $tag The filter hook to which the function to be removed is hooked.
+ * @param callback $function_to_remove The name of the function which should be removed.
+ * @param int $priority optional. The priority of the function (default: 10).
+ * @param int $accepted_args optional. The number of arguments the function accpets (default: 1).
+ * @return boolean Whether the function existed before it was removed.
+ */
+function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
+	$function_to_remove = _wp_filter_build_unique_id($tag, $function_to_remove, $priority);
+
+	$r = isset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]);
+
+	if ( true === $r) {
+		unset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]);
+		if ( empty($GLOBALS['wp_filter'][$tag][$priority]) )
+			unset($GLOBALS['wp_filter'][$tag][$priority]);
+		unset($GLOBALS['merged_filters'][$tag]);
+	}
+
+	return $r;
+}
+
+/**
+ * Remove all of the hooks from a filter.
+ *
+ * @since 2.7
+ *
+ * @param string $tag The filter to remove hooks from.
+ * @param int $priority The priority number to remove.
+ * @return bool True when finished.
+ */
+function remove_all_filters($tag, $priority = false) {
+	global $wp_filter, $merged_filters;
+
+	if( isset($wp_filter[$tag]) ) {
+		if( false !== $priority && isset($$wp_filter[$tag][$priority]) )
+			unset($wp_filter[$tag][$priority]);
+		else
+			unset($wp_filter[$tag]);
+	}
+
+	if( isset($merged_filters[$tag]) )
+		unset($merged_filters[$tag]);
+
+	return true;
+}
+
+/**
+ * Retrieve the name of the current filter or action.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 2.5
+ *
+ * @return string Hook name of the current filter or action.
+ */
+function current_filter() {
+	global $wp_current_filter;
+	return end( $wp_current_filter );
+}
+
+
+/**
+ * Hooks a function on to a specific action.
+ *
+ * Actions are the hooks that the WordPress core launches at specific points
+ * during execution, or when specific events occur. Plugins can specify that
+ * one or more of its PHP functions are executed at these points, using the
+ * Action API.
+ *
+ * @uses add_filter() Adds an action. Parameter list and functionality are the same.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 1.2
+ *
+ * @param string $tag The name of the action to which the $function_to_add is hooked.
+ * @param callback $function_to_add The name of the function you wish to be called.
+ * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
+ * @param int $accepted_args optional. The number of arguments the function accept (default 1).
+ */
+function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
+	return add_filter($tag, $function_to_add, $priority, $accepted_args);
+}
+
+
+/**
+ * Execute functions hooked on a specific action hook.
+ *
+ * This function invokes all functions attached to action hook $tag. It is
+ * possible to create new action hooks by simply calling this function,
+ * specifying the name of the new hook using the <tt>$tag</tt> parameter.
+ *
+ * You can pass extra arguments to the hooks, much like you can with
+ * apply_filters().
+ *
+ * @see apply_filters() This function works similar with the exception that
+ * nothing is returned and only the functions or methods are called.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 1.2
+ * @global array $wp_filter Stores all of the filters
+ * @global array $wp_actions Increments the amount of times action was triggered.
+ *
+ * @param string $tag The name of the action to be executed.
+ * @param mixed $arg,... Optional additional arguments which are passed on to the functions hooked to the action.
+ * @return null Will return null if $tag does not exist in $wp_filter array
+ */
+function do_action($tag, $arg = '') {
+	global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
+
+	if ( is_array($wp_actions) )
+		$wp_actions[] = $tag;
+	else
+		$wp_actions = array($tag);
+
+	$wp_current_filter[] = $tag;
+
+	// Do 'all' actions first
+	if ( isset($wp_filter['all']) ) {
+		$all_args = func_get_args();
+		_wp_call_all_hook($all_args);
+	}
+
+	if ( !isset($wp_filter[$tag]) ) {
+		array_pop($wp_current_filter);
+		return;
+	}
+
+	$args = array();
+	if ( is_array($arg) && 1 == count($arg) && is_object($arg[0]) ) // array(&$this)
+		$args[] =& $arg[0];
+	else
+		$args[] = $arg;
+	for ( $a = 2; $a < func_num_args(); $a++ )
+		$args[] = func_get_arg($a);
+
+	// Sort
+	if ( !isset( $merged_filters[ $tag ] ) ) {
+		ksort($wp_filter[$tag]);
+		$merged_filters[ $tag ] = true;
+	}
+
+	reset( $wp_filter[ $tag ] );
+
+	do {
+		foreach ( (array) current($wp_filter[$tag]) as $the_ )
+			if ( !is_null($the_['function']) )
+				call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
+
+	} while ( next($wp_filter[$tag]) !== false );
+
+	array_pop($wp_current_filter);
+}
+
+/**
+ * Retrieve the number times an action is fired.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 2.1
+ * @global array $wp_actions Increments the amount of times action was triggered.
+ *
+ * @param string $tag The name of the action hook.
+ * @return int The number of times action hook <tt>$tag</tt> is fired
+ */
+function did_action($tag) {
+	global $wp_actions;
+
+	if ( empty($wp_actions) )
+		return 0;
+
+	return count(array_keys($wp_actions, $tag));
+}
+
+/**
+ * Execute functions hooked on a specific action hook, specifying arguments in an array.
+ *
+ * @see do_action() This function is identical, but the arguments passed to the
+ * functions hooked to <tt>$tag</tt> are supplied using an array.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 2.1
+ * @global array $wp_filter Stores all of the filters
+ * @global array $wp_actions Increments the amount of times action was triggered.
+ *
+ * @param string $tag The name of the action to be executed.
+ * @param array $args The arguments supplied to the functions hooked to <tt>$tag</tt>
+ * @return null Will return null if $tag does not exist in $wp_filter array
+ */
+function do_action_ref_array($tag, $args) {
+	global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
+
+	if ( !is_array($wp_actions) )
+		$wp_actions = array($tag);
+	else
+		$wp_actions[] = $tag;
+
+	$wp_current_filter[] = $tag;
+
+	// Do 'all' actions first
+	if ( isset($wp_filter['all']) ) {
+		$all_args = func_get_args();
+		_wp_call_all_hook($all_args);
+	}
+
+	if ( !isset($wp_filter[$tag]) ) {
+		array_pop($wp_current_filter);
+		return;
+	}
+
+	// Sort
+	if ( !isset( $merged_filters[ $tag ] ) ) {
+		ksort($wp_filter[$tag]);
+		$merged_filters[ $tag ] = true;
+	}
+
+	reset( $wp_filter[ $tag ] );
+
+	do {
+		foreach( (array) current($wp_filter[$tag]) as $the_ )
+			if ( !is_null($the_['function']) )
+				call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
+
+	} while ( next($wp_filter[$tag]) !== false );
+
+	array_pop($wp_current_filter);
+}
+
+/**
+ * Check if any action has been registered for a hook.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 2.5
+ * @see has_filter() has_action() is an alias of has_filter().
+ *
+ * @param string $tag The name of the action hook.
+ * @param callback $function_to_check optional.  If specified, return the priority of that function on this hook or false if not attached.
+ * @return int|boolean Optionally returns the priority on that hook for the specified function.
+ */
+function has_action($tag, $function_to_check = false) {
+	return has_filter($tag, $function_to_check);
+}
+
+/**
+ * Removes a function from a specified action hook.
+ *
+ * This function removes a function attached to a specified action hook. This
+ * method can be used to remove default functions attached to a specific filter
+ * hook and possibly replace them with a substitute.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 1.2
+ *
+ * @param string $tag The action hook to which the function to be removed is hooked.
+ * @param callback $function_to_remove The name of the function which should be removed.
+ * @param int $priority optional The priority of the function (default: 10).
+ * @param int $accepted_args optional. The number of arguments the function accpets (default: 1).
+ * @return boolean Whether the function is removed.
+ */
+function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
+	return remove_filter($tag, $function_to_remove, $priority, $accepted_args);
+}
+
+/**
+ * Remove all of the hooks from an action.
+ *
+ * @since 2.7
+ *
+ * @param string $tag The action to remove hooks from.
+ * @param int $priority The priority number to remove them from.
+ * @return bool True when finished.
+ */
+function remove_all_actions($tag, $priority = false) {
+	return remove_all_filters($tag, $priority);
+}
+
+//
+// Functions for handling plugins.
+//
+
+/**
+ * Gets the basename of a plugin.
+ *
+ * This method extracts the name of a plugin from its filename.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 1.5
+ *
+ * @access private
+ *
+ * @param string $file The filename of plugin.
+ * @return string The name of a plugin.
+ * @uses WP_PLUGIN_DIR
+ */
+function plugin_basename($file) {
+	$file = str_replace('\\','/',$file); // sanitize for Win32 installs
+	$file = preg_replace('|/+|','/', $file); // remove any duplicate slash
+	$plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs
+	$plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash
+	$mu_plugin_dir = str_replace('\\','/',WPMU_PLUGIN_DIR); // sanitize for Win32 installs
+	$mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash
+	$file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir
+	return $file;
+}
+
+/**
+ * Gets the filesystem directory path (with trailing slash) for the plugin __FILE__ passed in
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 2.8
+ *
+ * @param string $file The filename of the plugin (__FILE__)
+ * @return string the filesystem path of the directory that contains the plugin
+ */
+function plugin_dir_path( $file ) {
+	return trailingslashit( dirname( $file ) );
+}
+
+/**
+ * Gets the URL directory path (with trailing slash) for the plugin __FILE__ passed in
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 2.8
+ *
+ * @param string $file The filename of the plugin (__FILE__)
+ * @return string the URL path of the directory that contains the plugin
+ */
+function plugin_dir_url( $file ) {
+	return trailingslashit( plugins_url( '', $file ) );
+}
+
+/**
+ * Set the activation hook for a plugin.
+ *
+ * When a plugin is activated, the action 'activate_PLUGINNAME' hook is
+ * activated. In the name of this hook, PLUGINNAME is replaced with the name of
+ * the plugin, including the optional subdirectory. For example, when the plugin
+ * is located in wp-content/plugin/sampleplugin/sample.php, then the name of
+ * this hook will become 'activate_sampleplugin/sample.php'. When the plugin
+ * consists of only one file and is (as by default) located at
+ * wp-content/plugin/sample.php the name of this hook will be
+ * 'activate_sample.php'.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 2.0
+ *
+ * @param string $file The filename of the plugin including the path.
+ * @param callback $function the function hooked to the 'activate_PLUGIN' action.
+ */
+function register_activation_hook($file, $function) {
+	$file = plugin_basename($file);
+	add_action('activate_' . $file, $function);
+}
+
+/**
+ * Set the deactivation hook for a plugin.
+ *
+ * When a plugin is deactivated, the action 'deactivate_PLUGINNAME' hook is
+ * deactivated. In the name of this hook, PLUGINNAME is replaced with the name
+ * of the plugin, including the optional subdirectory. For example, when the
+ * plugin is located in wp-content/plugin/sampleplugin/sample.php, then
+ * the name of this hook will become 'activate_sampleplugin/sample.php'.
+ *
+ * When the plugin consists of only one file and is (as by default) located at
+ * wp-content/plugin/sample.php the name of this hook will be
+ * 'activate_sample.php'.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 2.0
+ *
+ * @param string $file The filename of the plugin including the path.
+ * @param callback $function the function hooked to the 'activate_PLUGIN' action.
+ */
+function register_deactivation_hook($file, $function) {
+	$file = plugin_basename($file);
+	add_action('deactivate_' . $file, $function);
+}
+
+/**
+ * Set the uninstallation hook for a plugin.
+ *
+ * Registers the uninstall hook that will be called when the user clicks on the
+ * uninstall link that calls for the plugin to uninstall itself. The link won't
+ * be active unless the plugin hooks into the action.
+ *
+ * The plugin should not run arbitrary code outside of functions, when
+ * registering the uninstall hook. In order to run using the hook, the plugin
+ * will have to be included, which means that any code laying outside of a
+ * function will be run during the uninstall process. The plugin should not
+ * hinder the uninstall process.
+ *
+ * If the plugin can not be written without running code within the plugin, then
+ * the plugin should create a file named 'uninstall.php' in the base plugin
+ * folder. This file will be called, if it exists, during the uninstall process
+ * bypassing the uninstall hook. The plugin, when using the 'uninstall.php'
+ * should always check for the 'WP_UNINSTALL_PLUGIN' constant, before
+ * executing.
+ *
+ * @since 2.7
+ *
+ * @param string $file
+ * @param callback $callback The callback to run when the hook is called.
+ */
+function register_uninstall_hook($file, $callback) {
+	// The option should not be autoloaded, because it is not needed in most
+	// cases. Emphasis should be put on using the 'uninstall.php' way of
+	// uninstalling the plugin.
+	$uninstallable_plugins = (array) backpress_get_option('uninstall_plugins');
+	$uninstallable_plugins[plugin_basename($file)] = $callback;
+	backpress_update_option('uninstall_plugins', $uninstallable_plugins);
+}
+
+/**
+ * Calls the 'all' hook, which will process the functions hooked into it.
+ *
+ * The 'all' hook passes all of the arguments or parameters that were used for
+ * the hook, which this function was called for.
+ *
+ * This function is used internally for apply_filters(), do_action(), and
+ * do_action_ref_array() and is not meant to be used from outside those
+ * functions. This function does not check for the existence of the all hook, so
+ * it will fail unless the all hook exists prior to this function call.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 2.5
+ * @access private
+ *
+ * @uses $wp_filter Used to process all of the functions in the 'all' hook
+ *
+ * @param array $args The collected parameters from the hook that was called.
+ * @param string $hook Optional. The hook name that was used to call the 'all' hook.
+ */
+function _wp_call_all_hook($args) {
+	global $wp_filter;
+
+	reset( $wp_filter['all'] );
+	do {
+		foreach( (array) current($wp_filter['all']) as $the_ )
+			if ( !is_null($the_['function']) )
+				call_user_func_array($the_['function'], $args);
+
+	} while ( next($wp_filter['all']) !== false );
+}
+
+/**
+ * Build Unique ID for storage and retrieval.
+ *
+ * The old way to serialize the callback caused issues and this function is the
+ * solution. It works by checking for objects and creating an a new property in
+ * the class to keep track of the object and new objects of the same class that
+ * need to be added.
+ *
+ * It also allows for the removal of actions and filters for objects after they
+ * change class properties. It is possible to include the property $wp_filter_id
+ * in your class and set it to "null" or a number to bypass the workaround.
+ * However this will prevent you from adding new classes and any new classes
+ * will overwrite the previous hook by the same class.
+ *
+ * Functions and static method callbacks are just returned as strings and
+ * shouldn't have any speed penalty.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @access private
+ * @since 2.2.3
+ * @link http://trac.wordpress.org/ticket/3875
+ *
+ * @global array $wp_filter Storage for all of the filters and actions
+ * @param string $tag Used in counting how many hooks were applied
+ * @param callback $function Used for creating unique id
+ * @param int|bool $priority Used in counting how many hooks were applied.  If === false and $function is an object reference, we return the unique id only if it already has one, false otherwise.
+ * @param string $type filter or action
+ * @return string|bool Unique ID for usage as array key or false if $priority === false and $function is an object reference, and it does not already have a uniqe id.
+ */
+function _wp_filter_build_unique_id($tag, $function, $priority) {
+	global $wp_filter;
+	static $filter_id_count = 0;
+
+	// If function then just skip all of the tests and not overwrite the following.
+	if ( is_string($function) )
+		return $function;
+	// Object Class Calling
+	else if (is_object($function[0]) ) {
+		$obj_idx = get_class($function[0]).$function[1];
+		if ( !isset($function[0]->wp_filter_id) ) {
+			if ( false === $priority )
+				return false;
+			$obj_idx .= isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : 0;
+			$function[0]->wp_filter_id = $filter_id_count++;
+		} else
+			$obj_idx .= $function[0]->wp_filter_id;
+		return $obj_idx;
+	}
+	// Static Calling
+	else if ( is_string($function[0]) )
+		return $function[0].$function[1];
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.shortcodes.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.shortcodes.php
new file mode 100644
index 0000000000000000000000000000000000000000..d3cf27f881af8e8250fe96a2b3cadb5159cd2f18
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.shortcodes.php
@@ -0,0 +1,295 @@
+<?php
+// Last sync [WP11537]
+
+/**
+ * WordPress API for creating bbcode like tags or what WordPress calls
+ * "shortcodes." The tag and attribute parsing or regular expression code is
+ * based on the Textpattern tag parser.
+ *
+ * A few examples are below:
+ *
+ * [shortcode /]
+ * [shortcode foo="bar" baz="bing" /]
+ * [shortcode foo="bar"]content[/shortcode]
+ *
+ * Shortcode tags support attributes and enclosed content, but does not entirely
+ * support inline shortcodes in other shortcodes. You will have to call the
+ * shortcode parser in your function to account for that.
+ *
+ * {@internal
+ * Please be aware that the above note was made during the beta of WordPress 2.6
+ * and in the future may not be accurate. Please update the note when it is no
+ * longer the case.}}
+ *
+ * To apply shortcode tags to content:
+ *
+ * <code>
+ * $out = do_shortcode($content);
+ * </code>
+ *
+ * @link http://codex.wordpress.org/Shortcode_API
+ *
+ * @package WordPress
+ * @subpackage Shortcodes
+ * @since 2.5
+ */
+
+/**
+ * Container for storing shortcode tags and their hook to call for the shortcode
+ *
+ * @since 2.5
+ * @name $shortcode_tags
+ * @var array
+ * @global array $shortcode_tags
+ */
+$shortcode_tags = array();
+
+/**
+ * Add hook for shortcode tag.
+ *
+ * There can only be one hook for each shortcode. Which means that if another
+ * plugin has a similar shortcode, it will override yours or yours will override
+ * theirs depending on which order the plugins are included and/or ran.
+ *
+ * Simplest example of a shortcode tag using the API:
+ *
+ * <code>
+ * // [footag foo="bar"]
+ * function footag_func($atts) {
+ * 	return "foo = {$atts[foo]}";
+ * }
+ * add_shortcode('footag', 'footag_func');
+ * </code>
+ *
+ * Example with nice attribute defaults:
+ *
+ * <code>
+ * // [bartag foo="bar"]
+ * function bartag_func($atts) {
+ * 	extract(shortcode_atts(array(
+ * 		'foo' => 'no foo',
+ * 		'baz' => 'default baz',
+ * 	), $atts));
+ *
+ * 	return "foo = {$foo}";
+ * }
+ * add_shortcode('bartag', 'bartag_func');
+ * </code>
+ *
+ * Example with enclosed content:
+ *
+ * <code>
+ * // [baztag]content[/baztag]
+ * function baztag_func($atts, $content='') {
+ * 	return "content = $content";
+ * }
+ * add_shortcode('baztag', 'baztag_func');
+ * </code>
+ *
+ * @since 2.5
+ * @uses $shortcode_tags
+ *
+ * @param string $tag Shortcode tag to be searched in post content.
+ * @param callable $func Hook to run when shortcode is found.
+ */
+function add_shortcode($tag, $func) {
+	global $shortcode_tags;
+
+	if ( is_callable($func) )
+		$shortcode_tags[$tag] = $func;
+}
+
+/**
+ * Removes hook for shortcode.
+ *
+ * @since 2.5
+ * @uses $shortcode_tags
+ *
+ * @param string $tag shortcode tag to remove hook for.
+ */
+function remove_shortcode($tag) {
+	global $shortcode_tags;
+
+	unset($shortcode_tags[$tag]);
+}
+
+/**
+ * Clear all shortcodes.
+ *
+ * This function is simple, it clears all of the shortcode tags by replacing the
+ * shortcodes global by a empty array. This is actually a very efficient method
+ * for removing all shortcodes.
+ *
+ * @since 2.5
+ * @uses $shortcode_tags
+ */
+function remove_all_shortcodes() {
+	global $shortcode_tags;
+
+	$shortcode_tags = array();
+}
+
+/**
+ * Search content for shortcodes and filter shortcodes through their hooks.
+ *
+ * If there are no shortcode tags defined, then the content will be returned
+ * without any filtering. This might cause issues when plugins are disabled but
+ * the shortcode will still show up in the post or content.
+ *
+ * @since 2.5
+ * @uses $shortcode_tags
+ * @uses get_shortcode_regex() Gets the search pattern for searching shortcodes.
+ *
+ * @param string $content Content to search for shortcodes
+ * @return string Content with shortcodes filtered out.
+ */
+function do_shortcode($content) {
+	global $shortcode_tags;
+
+	if (empty($shortcode_tags) || !is_array($shortcode_tags))
+		return $content;
+
+	$pattern = get_shortcode_regex();
+	return preg_replace_callback('/'.$pattern.'/s', 'do_shortcode_tag', $content);
+}
+
+/**
+ * Retrieve the shortcode regular expression for searching.
+ *
+ * The regular expression combines the shortcode tags in the regular expression
+ * in a regex class.
+ *
+ * The regular expresion contains 6 different sub matches to help with parsing.
+ *
+ * 1/6 - An extra [ or ] to allow for escaping shortcodes with double [[]]
+ * 2 - The shortcode name
+ * 3 - The shortcode argument list
+ * 4 - The self closing /
+ * 5 - The content of a shortcode when it wraps some content.
+ *
+ * @since 2.5
+ * @uses $shortcode_tags
+ *
+ * @return string The shortcode search regular expression
+ */
+function get_shortcode_regex() {
+	global $shortcode_tags;
+	$tagnames = array_keys($shortcode_tags);
+	$tagregexp = join( '|', array_map('preg_quote', $tagnames) );
+
+	return '(.?)\[('.$tagregexp.')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)';
+}
+
+/**
+ * Regular Expression callable for do_shortcode() for calling shortcode hook.
+ * @see get_shortcode_regex for details of the match array contents.
+ *
+ * @since 2.5
+ * @access private
+ * @uses $shortcode_tags
+ *
+ * @param array $m Regular expression match array
+ * @return mixed False on failure.
+ */
+function do_shortcode_tag($m) {
+	global $shortcode_tags;
+
+	// allow [[foo]] syntax for escaping a tag
+	if ($m[1] == '[' && $m[6] == ']') {
+		return substr($m[0], 1, -1);
+	}
+
+	$tag = $m[2];
+	$attr = shortcode_parse_atts($m[3]);
+
+	if ( isset($m[5]) ) {
+		// enclosing tag - extra parameter
+		return $m[1] . call_user_func($shortcode_tags[$tag], $attr, $m[5], $m[2]) . $m[6];
+	} else {
+		// self-closing tag
+		return $m[1] . call_user_func($shortcode_tags[$tag], $attr, NULL, $m[2]) . $m[6];
+	}
+}
+
+/**
+ * Retrieve all attributes from the shortcodes tag.
+ *
+ * The attributes list has the attribute name as the key and the value of the
+ * attribute as the value in the key/value pair. This allows for easier
+ * retrieval of the attributes, since all attributes have to be known.
+ *
+ * @since 2.5
+ *
+ * @param string $text
+ * @return array List of attributes and their value.
+ */
+function shortcode_parse_atts($text) {
+	$atts = array();
+	$pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';
+	$text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text);
+	if ( preg_match_all($pattern, $text, $match, PREG_SET_ORDER) ) {
+		foreach ($match as $m) {
+			if (!empty($m[1]))
+				$atts[strtolower($m[1])] = stripcslashes($m[2]);
+			elseif (!empty($m[3]))
+				$atts[strtolower($m[3])] = stripcslashes($m[4]);
+			elseif (!empty($m[5]))
+				$atts[strtolower($m[5])] = stripcslashes($m[6]);
+			elseif (isset($m[7]) and strlen($m[7]))
+				$atts[] = stripcslashes($m[7]);
+			elseif (isset($m[8]))
+				$atts[] = stripcslashes($m[8]);
+		}
+	} else {
+		$atts = ltrim($text);
+	}
+	return $atts;
+}
+
+/**
+ * Combine user attributes with known attributes and fill in defaults when needed.
+ *
+ * The pairs should be considered to be all of the attributes which are
+ * supported by the caller and given as a list. The returned attributes will
+ * only contain the attributes in the $pairs list.
+ *
+ * If the $atts list has unsupported attributes, then they will be ignored and
+ * removed from the final returned list.
+ *
+ * @since 2.5
+ *
+ * @param array $pairs Entire list of supported attributes and their defaults.
+ * @param array $atts User defined attributes in shortcode tag.
+ * @return array Combined and filtered attribute list.
+ */
+function shortcode_atts($pairs, $atts) {
+	$atts = (array)$atts;
+	$out = array();
+	foreach($pairs as $name => $default) {
+		if ( array_key_exists($name, $atts) )
+			$out[$name] = $atts[$name];
+		else
+			$out[$name] = $default;
+	}
+	return $out;
+}
+
+/**
+ * Remove all shortcode tags from the given content.
+ *
+ * @since 2.5
+ * @uses $shortcode_tags
+ *
+ * @param string $content Content to remove shortcode tags.
+ * @return string Content without shortcode tags.
+ */
+function strip_shortcodes( $content ) {
+	global $shortcode_tags;
+
+	if (empty($shortcode_tags) || !is_array($shortcode_tags))
+		return $content;
+
+	$pattern = get_shortcode_regex();
+
+	return preg_replace('/'.$pattern.'/s', '', $content);
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.wp-cron.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.wp-cron.php
new file mode 100644
index 0000000000000000000000000000000000000000..1b9b980b46b3db5e828d4fb49591286bd3d8acea
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.wp-cron.php
@@ -0,0 +1,399 @@
+<?php
+// Last sync [WP11537]
+
+/**
+ * WordPress CRON API
+ *
+ * @package WordPress
+ */
+
+/**
+ * Schedules a hook to run only once.
+ *
+ * Schedules a hook which will be executed once by the Wordpress actions core at
+ * a time which you specify. The action will fire off when someone visits your
+ * WordPress site, if the schedule time has passed.
+ *
+ * @since 2.1.0
+ * @link http://codex.wordpress.org/Function_Reference/wp_schedule_single_event
+ *
+ * @param int $timestamp Timestamp for when to run the event.
+ * @param string $hook Action hook to execute when cron is run.
+ * @param array $args Optional. Arguments to pass to the hook's callback function.
+ */
+function wp_schedule_single_event( $timestamp, $hook, $args = array()) {
+	// don't schedule a duplicate if there's already an identical event due in the next 10 minutes
+	$next = wp_next_scheduled($hook, $args);
+	if ( $next && $next <= $timestamp + 600 )
+		return;
+
+	$crons = _get_cron_array();
+	$key = md5(serialize($args));
+	$crons[$timestamp][$hook][$key] = array( 'schedule' => false, 'args' => $args );
+	uksort( $crons, "strnatcasecmp" );
+	_set_cron_array( $crons );
+}
+
+/**
+ * Schedule a periodic event.
+ *
+ * Schedules a hook which will be executed by the WordPress actions core on a
+ * specific interval, specified by you. The action will trigger when someone
+ * visits your WordPress site, if the scheduled time has passed.
+ *
+ * Valid values for the recurrence are hourly, daily and twicedaily.  These can
+ * be extended using the cron_schedules filter in wp_get_schedules().
+ *
+ * @since 2.1.0
+ *
+ * @param int $timestamp Timestamp for when to run the event.
+ * @param string $recurrence How often the event should recur.
+ * @param string $hook Action hook to execute when cron is run.
+ * @param array $args Optional. Arguments to pass to the hook's callback function.
+ * @return bool|null False on failure, null when complete with scheduling event.
+ */
+function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array()) {
+	$crons = _get_cron_array();
+	$schedules = wp_get_schedules();
+	$key = md5(serialize($args));
+	if ( !isset( $schedules[$recurrence] ) )
+		return false;
+	$crons[$timestamp][$hook][$key] = array( 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval'] );
+	uksort( $crons, "strnatcasecmp" );
+	_set_cron_array( $crons );
+}
+
+/**
+ * Reschedule a recurring event.
+ *
+ * @since 2.1.0
+ *
+ * @param int $timestamp Timestamp for when to run the event.
+ * @param string $recurrence How often the event should recur.
+ * @param string $hook Action hook to execute when cron is run.
+ * @param array $args Optional. Arguments to pass to the hook's callback function.
+ * @return bool|null False on failure. Null when event is rescheduled.
+ */
+function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array()) {
+	$crons = _get_cron_array();
+	$schedules = wp_get_schedules();
+	$key = md5(serialize($args));
+	$interval = 0;
+
+	// First we try to get it from the schedule
+	if ( 0 == $interval )
+		$interval = $schedules[$recurrence]['interval'];
+	// Now we try to get it from the saved interval in case the schedule disappears
+	if ( 0 == $interval )
+		$interval = $crons[$timestamp][$hook][$key]['interval'];
+	// Now we assume something is wrong and fail to schedule
+	if ( 0 == $interval )
+		return false;
+
+	$now = time();
+
+    if ( $timestamp >= $now )
+        $timestamp = $now + $interval;
+    else
+        $timestamp = $now + ($interval - (($now - $timestamp) % $interval));
+
+	wp_schedule_event( $timestamp, $recurrence, $hook, $args );
+}
+
+/**
+ * Unschedule a previously scheduled cron job.
+ *
+ * The $timestamp and $hook parameters are required, so that the event can be
+ * identified.
+ *
+ * @since 2.1.0
+ *
+ * @param int $timestamp Timestamp for when to run the event.
+ * @param string $hook Action hook, the execution of which will be unscheduled.
+ * @param array $args Arguments to pass to the hook's callback function.
+ * Although not passed to a callback function, these arguments are used
+ * to uniquely identify the scheduled event, so they should be the same
+ * as those used when originally scheduling the event.
+ */
+function wp_unschedule_event( $timestamp, $hook, $args = array() ) {
+	$crons = _get_cron_array();
+	$key = md5(serialize($args));
+	unset( $crons[$timestamp][$hook][$key] );
+	if ( empty($crons[$timestamp][$hook]) )
+		unset( $crons[$timestamp][$hook] );
+	if ( empty($crons[$timestamp]) )
+		unset( $crons[$timestamp] );
+	_set_cron_array( $crons );
+}
+
+/**
+ * Unschedule all cron jobs attached to a specific hook.
+ *
+ * @since 2.1.0
+ *
+ * @param string $hook Action hook, the execution of which will be unscheduled.
+ * @param mixed $args,... Optional. Event arguments.
+ */
+function wp_clear_scheduled_hook( $hook ) {
+	$args = array_slice( func_get_args(), 1 );
+
+	while ( $timestamp = wp_next_scheduled( $hook, $args ) )
+		wp_unschedule_event( $timestamp, $hook, $args );
+}
+
+/**
+ * Retrieve the next timestamp for a cron event.
+ *
+ * @since 2.1.0
+ *
+ * @param string $hook Action hook to execute when cron is run.
+ * @param array $args Optional. Arguments to pass to the hook's callback function.
+ * @return bool|int The UNIX timestamp of the next time the scheduled event will occur.
+ */
+function wp_next_scheduled( $hook, $args = array() ) {
+	$crons = _get_cron_array();
+	$key = md5(serialize($args));
+	if ( empty($crons) )
+		return false;
+	foreach ( $crons as $timestamp => $cron ) {
+		if ( isset( $cron[$hook][$key] ) )
+			return $timestamp;
+	}
+	return false;
+}
+
+/**
+ * Send request to run cron through HTTP request that doesn't halt page loading.
+ *
+ * @since 2.1.0
+ *
+ * @return null Cron could not be spawned, because it is not needed to run.
+ */
+function spawn_cron( $local_time = 0 ) {
+
+	if ( !$local_time )
+		$local_time = time();
+
+	if ( defined('DOING_CRON') || isset($_GET['doing_wp_cron']) )
+		return;
+
+	/*
+	 * do not even start the cron if local server timer has drifted
+	 * such as due to power failure, or misconfiguration
+	 */
+	$timer_accurate = check_server_timer( $local_time );
+	if ( !$timer_accurate )
+		return;
+
+	/*
+	* multiple processes on multiple web servers can run this code concurrently
+	* try to make this as atomic as possible by setting doing_cron switch
+	*/
+	$flag = backpress_get_transient('doing_cron');
+
+	if ( $flag > $local_time + 10*60 )
+		$flag = 0;
+
+	// don't run if another process is currently running it or more than once every 60 sec.
+	if ( $flag + 60 > $local_time )
+		return;
+
+	//sanity check
+	$crons = _get_cron_array();
+	if ( !is_array($crons) )
+		return;
+
+	$keys = array_keys( $crons );
+	if ( isset($keys[0]) && $keys[0] > $local_time )
+		return;
+
+	if ( defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON ) {
+		if ( !empty($_POST) || defined('DOING_AJAX') )
+			return;
+
+		backpress_set_transient( 'doing_cron', $local_time );
+
+		ob_start();
+		wp_redirect( add_query_arg('doing_wp_cron', '', stripslashes($_SERVER['REQUEST_URI'])) );
+		echo ' ';
+
+		// flush any buffers and send the headers
+		while ( @ob_end_flush() );
+		flush();
+
+		@include_once(ABSPATH . 'wp-cron.php');
+		return;
+	}
+
+	backpress_set_transient( 'doing_cron', $local_time );
+
+	$cron_url = remove_query_arg( 'check', backpress_get_option( 'cron_uri' ) );
+	$cron_url = add_query_arg( 'doing_wp_cron', '', $cron_url );
+	wp_remote_post( $cron_url, array('timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters('https_local_ssl_verify', true)) );
+}
+
+/**
+ * Run scheduled callbacks or spawn cron for all scheduled events.
+ *
+ * @since 2.1.0
+ *
+ * @return null When doesn't need to run Cron.
+ */
+function wp_cron() {
+	// Prevent infinite loops caused by cron page requesting itself
+	$cron_uri = parse_url( backpress_get_option( 'cron_uri' ) );
+
+	if ( strpos($_SERVER['REQUEST_URI'], $cron_uri['path'] ) !== false || ( defined('DISABLE_WP_CRON') && DISABLE_WP_CRON ) )
+		return;
+
+	if ( false === $crons = _get_cron_array() )
+		return;
+
+	$local_time = time();
+	$keys = array_keys( $crons );
+	if ( isset($keys[0]) && $keys[0] > $local_time )
+		return;
+
+	$schedules = wp_get_schedules();
+	foreach ( $crons as $timestamp => $cronhooks ) {
+		if ( $timestamp > $local_time ) break;
+		foreach ( (array) $cronhooks as $hook => $args ) {
+			if ( isset($schedules[$hook]['callback']) && !call_user_func( $schedules[$hook]['callback'] ) )
+				continue;
+			spawn_cron( $local_time );
+			break 2;
+		}
+	}
+}
+
+/**
+ * Retrieve supported and filtered Cron recurrences.
+ *
+ * The supported recurrences are 'hourly' and 'daily'. A plugin may add more by
+ * hooking into the 'cron_schedules' filter. The filter accepts an array of
+ * arrays. The outer array has a key that is the name of the schedule or for
+ * example 'weekly'. The value is an array with two keys, one is 'interval' and
+ * the other is 'display'.
+ *
+ * The 'interval' is a number in seconds of when the cron job should run. So for
+ * 'hourly', the time is 3600 or 60*60. For weekly, the value would be
+ * 60*60*24*7 or 604800. The value of 'interval' would then be 604800.
+ *
+ * The 'display' is the description. For the 'weekly' key, the 'display' would
+ * be <code>__('Once Weekly')</code>.
+ *
+ * For your plugin, you will be passed an array. you can easily add your
+ * schedule by doing the following.
+ * <code>
+ * // filter parameter variable name is 'array'
+ *	$array['weekly'] = array(
+ *		'interval' => 604800,
+ *		'display' => __('Once Weekly')
+ *	);
+ * </code>
+ *
+ * @since 2.1.0
+ *
+ * @return array
+ */
+function wp_get_schedules() {
+	$schedules = array(
+		'hourly' => array( 'interval' => 3600, 'display' => __('Once Hourly') ),
+		'twicedaily' => array( 'interval' => 43200, 'display' => __('Twice Daily') ),
+		'daily' => array( 'interval' => 86400, 'display' => __('Once Daily') ),
+	);
+	return array_merge( apply_filters( 'cron_schedules', array() ), $schedules );
+}
+
+/**
+ * Retrieve Cron schedule for hook with arguments.
+ *
+ * @since 2.1.0
+ *
+ * @param string $hook Action hook to execute when cron is run.
+ * @param array $args Optional. Arguments to pass to the hook's callback function.
+ * @return string|bool False, if no schedule. Schedule on success.
+ */
+function wp_get_schedule($hook, $args = array()) {
+	$crons = _get_cron_array();
+	$key = md5(serialize($args));
+	if ( empty($crons) )
+		return false;
+	foreach ( $crons as $timestamp => $cron ) {
+		if ( isset( $cron[$hook][$key] ) )
+			return $cron[$hook][$key]['schedule'];
+	}
+	return false;
+}
+
+//
+// Private functions
+//
+
+/**
+ * Retrieve cron info array option.
+ *
+ * @since 2.1.0
+ * @access private
+ *
+ * @return array CRON info array.
+ */
+function _get_cron_array()  {
+	$cron = backpress_get_option('cron');
+	if ( ! is_array($cron) )
+		return false;
+
+	if ( !isset($cron['version']) )
+		$cron = _upgrade_cron_array($cron);
+
+	unset($cron['version']);
+
+	return $cron;
+}
+
+/**
+ * Updates the CRON option with the new CRON array.
+ *
+ * @since 2.1.0
+ * @access private
+ *
+ * @param array $cron Cron info array from {@link _get_cron_array()}.
+ */
+function _set_cron_array($cron) {
+	$cron['version'] = 2;
+	backpress_update_option( 'cron', $cron );
+}
+
+/**
+ * Upgrade a Cron info array.
+ *
+ * This function upgrades the Cron info array to version 2.
+ *
+ * @since 2.1.0
+ * @access private
+ *
+ * @param array $cron Cron info array from {@link _get_cron_array()}.
+ * @return array An upgraded Cron info array.
+ */
+function _upgrade_cron_array($cron) {
+	if ( isset($cron['version']) && 2 == $cron['version'])
+		return $cron;
+
+	$new_cron = array();
+
+	foreach ( (array) $cron as $timestamp => $hooks) {
+		foreach ( (array) $hooks as $hook => $args ) {
+			$key = md5(serialize($args['args']));
+			$new_cron[$timestamp][$hook][$key] = $args;
+		}
+	}
+
+	$new_cron['version'] = 2;
+	backpress_update_option( 'cron', $new_cron );
+	return $new_cron;
+}
+
+// stub for checking server timer accuracy, using outside standard time sources
+function check_server_timer( $local_time ) {
+	return true;
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.wp-object-cache.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.wp-object-cache.php
new file mode 100644
index 0000000000000000000000000000000000000000..3dc10de9b348e825c9cf7279eb79d1ae28645c00
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.wp-object-cache.php
@@ -0,0 +1,173 @@
+<?php
+// Last sync [WP11537]
+
+/**
+ * Object Cache API
+ *
+ * @link http://codex.wordpress.org/Function_Reference/WP_Cache
+ *
+ * @package WordPress
+ * @subpackage Cache
+ */
+
+
+
+/**
+ * Adds data to the cache, if the cache key doesn't aleady exist.
+ *
+ * @since 2.0.0
+ * @uses $wp_object_cache Object Cache Class
+ * @see WP_Object_Cache::add()
+ *
+ * @param int|string $key The cache ID to use for retrieval later
+ * @param mixed $data The data to add to the cache store
+ * @param string $flag The group to add the cache to
+ * @param int $expire When the cache data should be expired
+ * @return unknown
+ */
+function wp_cache_add($key, $data, $flag = '', $expire = 0) {
+	global $wp_object_cache;
+
+	return $wp_object_cache->add($key, $data, $flag, $expire);
+}
+
+/**
+ * Closes the cache.
+ *
+ * This function has ceased to do anything since WordPress 2.5. The
+ * functionality was removed along with the rest of the persistent cache. This
+ * does not mean that plugins can't implement this function when they need to
+ * make sure that the cache is cleaned up after WordPress no longer needs it.
+ *
+ * @since 2.0.0
+ *
+ * @return bool Always returns True
+ */
+function wp_cache_close() {
+	return true;
+}
+
+/**
+ * Removes the cache contents matching ID and flag.
+ *
+ * @since 2.0.0
+ * @uses $wp_object_cache Object Cache Class
+ * @see WP_Object_Cache::delete()
+ *
+ * @param int|string $id What the contents in the cache are called
+ * @param string $flag Where the cache contents are grouped
+ * @return bool True on successful removal, false on failure
+ */
+function wp_cache_delete($id, $flag = '') {
+	global $wp_object_cache;
+
+	return $wp_object_cache->delete($id, $flag);
+}
+
+/**
+ * Removes all cache items.
+ *
+ * @since 2.0.0
+ * @uses $wp_object_cache Object Cache Class
+ * @see WP_Object_Cache::flush()
+ *
+ * @return bool Always returns true
+ */
+function wp_cache_flush( $group = null ) {
+	// WP does not support group flushing
+	global $wp_object_cache;
+
+	return $wp_object_cache->flush( $group );
+}
+
+/**
+ * Retrieves the cache contents from the cache by ID and flag.
+ *
+ * @since 2.0.0
+ * @uses $wp_object_cache Object Cache Class
+ * @see WP_Object_Cache::get()
+ *
+ * @param int|string $id What the contents in the cache are called
+ * @param string $flag Where the cache contents are grouped
+ * @return bool|mixed False on failure to retrieve contents or the cache
+ *		contents on success
+ */
+function wp_cache_get($id, $flag = '') {
+	global $wp_object_cache;
+
+	return $wp_object_cache->get($id, $flag);
+}
+
+/**
+ * Sets up Object Cache Global and assigns it.
+ *
+ * @since 2.0.0
+ * @global WP_Object_Cache $wp_object_cache WordPress Object Cache
+ */
+function wp_cache_init() {
+	$GLOBALS['wp_object_cache'] =& new WP_Object_Cache();
+}
+
+/**
+ * Replaces the contents of the cache with new data.
+ *
+ * @since 2.0.0
+ * @uses $wp_object_cache Object Cache Class
+ * @see WP_Object_Cache::replace()
+ *
+ * @param int|string $id What to call the contents in the cache
+ * @param mixed $data The contents to store in the cache
+ * @param string $flag Where to group the cache contents
+ * @param int $expire When to expire the cache contents
+ * @return bool False if cache ID and group already exists, true on success
+ */
+function wp_cache_replace($key, $data, $flag = '', $expire = 0) {
+	global $wp_object_cache;
+
+	return $wp_object_cache->replace($key, $data, $flag, $expire);
+}
+
+/**
+ * Saves the data to the cache.
+ *
+ * @since 2.0
+ * @uses $wp_object_cache Object Cache Class
+ * @see WP_Object_Cache::set()
+ *
+ * @param int|string $id What to call the contents in the cache
+ * @param mixed $data The contents to store in the cache
+ * @param string $flag Where to group the cache contents
+ * @param int $expire When to expire the cache contents
+ * @return bool False if cache ID and group already exists, true on success
+ */
+function wp_cache_set($key, $data, $flag = '', $expire = 0) {
+	global $wp_object_cache;
+
+	return $wp_object_cache->set($key, $data, $flag, $expire);
+}
+
+/**
+ * Adds a group or set of groups to the list of global groups.
+ *
+ * @since 2.6.0
+ *
+ * @param string|array $groups A group or an array of groups to add
+ */
+function wp_cache_add_global_groups( $groups ) {
+	global $wp_object_cache;
+
+	return $wp_object_cache->add_global_groups( $groups );
+}
+
+/**
+ * Adds a group or set of groups to the list of non-persistent groups.
+ *
+ * @since 2.6.0
+ *
+ * @param string|array $groups A group or an array of groups to add
+ */
+function wp_cache_add_non_persistent_groups( $groups ) {
+	global $wp_object_cache;
+
+	return $wp_object_cache->add_non_persistent_groups( $groups );
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.wp-scripts.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.wp-scripts.php
new file mode 100644
index 0000000000000000000000000000000000000000..0a60c96878c85fa2c798ef543c8dc5931304d797
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.wp-scripts.php
@@ -0,0 +1,128 @@
+<?php
+/**
+ * BackPress script procedural API.
+ *
+ * @package BackPress
+ * @since r16
+ */
+
+/**
+ * Prints script tags in document head.
+ *
+ * Called by admin-header.php and by wp_head hook. Since it is called by wp_head
+ * on every page load, the function does not instantiate the WP_Scripts object
+ * unless script names are explicitly passed. Does make use of already
+ * instantiated $wp_scripts if present. Use provided wp_print_scripts hook to
+ * register/enqueue new scripts.
+ *
+ * @since r16
+ * @see WP_Dependencies::print_scripts()
+ */
+function wp_print_scripts( $handles = false ) {
+	do_action( 'wp_print_scripts' );
+	if ( '' === $handles ) // for wp_head
+		$handles = false;
+
+	global $wp_scripts;
+	if ( !is_a($wp_scripts, 'WP_Scripts') ) {
+		if ( !$handles )
+			return array(); // No need to instantiate if nothing's there.
+		else
+			$wp_scripts = new WP_Scripts();
+	}
+
+	return $wp_scripts->do_items( $handles );
+}
+
+/**
+ * Register new JavaScript file.
+ *
+ * @since r16
+ * @see WP_Dependencies::add() For parameter information.
+ */
+function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
+	global $wp_scripts;
+	if ( !is_a($wp_scripts, 'WP_Scripts') )
+		$wp_scripts = new WP_Scripts();
+
+	$wp_scripts->add( $handle, $src, $deps, $ver );
+	if ( $in_footer )
+		$wp_scripts->add_data( $handle, 'group', 1 );
+}
+
+/**
+ * Localizes a script.
+ *
+ * Localizes only if script has already been added.
+ *
+ * @since r16
+ * @see WP_Script::localize()
+ */
+function wp_localize_script( $handle, $object_name, $l10n ) {
+	global $wp_scripts;
+	if ( !is_a($wp_scripts, 'WP_Scripts') )
+		return false;
+
+	return $wp_scripts->localize( $handle, $object_name, $l10n );
+}
+
+/**
+ * Remove a registered script.
+ *
+ * @since r16
+ * @see WP_Scripts::remove() For parameter information.
+ */
+function wp_deregister_script( $handle ) {
+	global $wp_scripts;
+	if ( !is_a($wp_scripts, 'WP_Scripts') )
+		$wp_scripts = new WP_Scripts();
+
+	$wp_scripts->remove( $handle );
+}
+
+/**
+ * Enqueues script.
+ *
+ * Registers the script if src provided (does NOT overwrite) and enqueues.
+ *
+ * @since r16
+ * @see WP_Script::add(), WP_Script::enqueue()
+*/
+function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false ) {
+	global $wp_scripts;
+	if ( !is_a($wp_scripts, 'WP_Scripts') )
+		$wp_scripts = new WP_Scripts();
+
+	if ( $src ) {
+		$_handle = explode('?', $handle);
+		$wp_scripts->add( $_handle[0], $src, $deps, $ver );
+		if ( $in_footer )
+			$wp_scripts->add_data( $_handle[0], 'group', 1 );
+	}
+	$wp_scripts->enqueue( $handle );
+}
+
+/**
+ * Check whether script has been added to WordPress Scripts.
+ *
+ * The values for list defaults to 'queue', which is the same as enqueue for
+ * scripts.
+ *
+ * @since WP unknown; BP unknown
+ *
+ * @param string $handle Handle used to add script.
+ * @param string $list Optional, defaults to 'queue'. Others values are 'registered', 'queue', 'done', 'to_do'
+ * @return bool
+ */
+function wp_script_is( $handle, $list = 'queue' ) {
+	global $wp_scripts;
+	if ( !is_a($wp_scripts, 'WP_Scripts') )
+		$wp_scripts = new WP_Scripts();
+
+	$query = $wp_scripts->query( $handle, $list );
+
+	if ( is_object( $query ) )
+		return true;
+
+	return $query;
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.wp-styles.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.wp-styles.php
new file mode 100644
index 0000000000000000000000000000000000000000..22d1e160d5d83827c99eed2142f5c0127f7318d0
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.wp-styles.php
@@ -0,0 +1,104 @@
+<?php
+/**
+ * BackPress styles procedural API.
+ *
+ * @package BackPress
+ * @since r79
+ */
+
+/**
+ * Display styles that are in the queue or part of $handles.
+ *
+ * @since r79
+ * @uses do_action() Calls 'wp_print_styles' hook.
+ * @global object $wp_styles The WP_Styles object for printing styles.
+ *
+ * @param array $handles (optional) Styles to be printed.  (void) prints queue, (string) prints that style, (array of strings) prints those styles.
+ * @return bool True on success, false on failure.
+ */
+function wp_print_styles( $handles = false ) {
+	do_action( 'wp_print_styles' );
+	if ( '' === $handles ) // for wp_head
+		$handles = false;
+
+	global $wp_styles;
+	if ( !is_a($wp_styles, 'WP_Styles') ) {
+		if ( !$handles )
+			return array(); // No need to instantiate if nothing's there.
+		else
+			$wp_styles = new WP_Styles();
+	}
+
+	return $wp_styles->do_items( $handles );
+}
+
+/**
+ * Register CSS style file.
+ *
+ * @since r79
+ * @see WP_Styles::add() For parameter and additional information.
+ */
+function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
+	global $wp_styles;
+	if ( !is_a($wp_styles, 'WP_Styles') )
+		$wp_styles = new WP_Styles();
+
+	$wp_styles->add( $handle, $src, $deps, $ver, $media );
+}
+
+/**
+ * Remove a registered CSS file.
+ *
+ * @since r79
+ * @see WP_Styles::remove() For parameter and additional information.
+ */
+function wp_deregister_style( $handle ) {
+	global $wp_styles;
+	if ( !is_a($wp_styles, 'WP_Styles') )
+		$wp_styles = new WP_Styles();
+
+	$wp_styles->remove( $handle );
+}
+
+/**
+ * Enqueue a CSS style file.
+ *
+ * @since r79
+ * @see WP_Styles::add(), WP_Styles::enqueue()
+ */
+function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = false ) {
+	global $wp_styles;
+	if ( !is_a($wp_styles, 'WP_Styles') )
+		$wp_styles = new WP_Styles();
+
+	if ( $src ) {
+		$_handle = explode('?', $handle);
+		$wp_styles->add( $_handle[0], $src, $deps, $ver, $media );
+	}
+	$wp_styles->enqueue( $handle );
+}
+
+/**
+ * Check whether style has been added to WordPress Styles.
+ *
+ * The values for list defaults to 'queue', which is the same as enqueue for
+ * styles.
+ *
+ * @since WP unknown; BP unknown
+ *
+ * @param string $handle Handle used to add style.
+ * @param string $list Optional, defaults to 'queue'. Others values are 'registered', 'queue', 'done', 'to_do'
+ * @return bool
+ */
+function wp_style_is( $handle, $list = 'queue' ) {
+	global $wp_styles;
+	if ( !is_a($wp_styles, 'WP_Scripts') )
+		$wp_styles = new WP_Styles();
+
+	$query = $wp_styles->query( $handle, $list );
+
+	if ( is_object( $query ) )
+		return true;
+
+	return $query;
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.wp-taxonomy.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.wp-taxonomy.php
new file mode 100644
index 0000000000000000000000000000000000000000..f39297b3ee318f471f5f670315b03772c710105d
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/functions.wp-taxonomy.php
@@ -0,0 +1,185 @@
+<?php
+// Last sync [WP11537]
+
+/**
+ * Taxonomy API
+ *
+ * @package WordPress
+ * @subpackage Taxonomy
+ * @since 2.3.0
+ */
+
+function get_object_taxonomies($object_type) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->get_object_taxonomies($object_type);
+}
+
+function get_taxonomy( $taxonomy ) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->get_taxonomy( $taxonomy );
+}
+
+function is_taxonomy( $taxonomy ) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->is_taxonomy( $taxonomy );
+}
+
+function is_taxonomy_hierarchical($taxonomy) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->is_taxonomy_hierarchical($taxonomy);
+}
+
+function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->register_taxonomy( $taxonomy, $object_type, $args );
+}
+
+function get_objects_in_term( $terms, $taxonomies, $args = array() ) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->get_objects_in_term( $terms, $taxonomies, $args );
+}
+
+function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->get_term($term, $taxonomy, $output, $filter);
+}
+
+function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw') {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->get_term_by($field, $value, $taxonomy, $output, $filter);
+}
+
+function get_term_children( $term, $taxonomy ) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->get_term_children( $term, $taxonomy );
+}
+
+function get_term_field( $field, $term, $taxonomy, $context = 'display' ) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->get_term_field( $field, $term, $taxonomy, $context );
+}
+
+function get_term_to_edit( $id, $taxonomy ) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->get_term_to_edit( $id, $taxonomy );
+}
+
+function &get_terms($taxonomies, $args = '') {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->get_terms($taxonomies, $args);
+}
+
+function is_term($term, $taxonomy = '') {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->is_term($term, $taxonomy );
+}
+
+function sanitize_term($term, $taxonomy, $context = 'display') {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->sanitize_term($term, $taxonomy, $context );
+}
+
+function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->sanitize_term_field($field, $value, $term_id, $taxonomy, $context);
+}
+
+function wp_count_terms( $taxonomy, $args = array() ) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->count_terms( $taxonomy, $args );
+}
+
+function wp_delete_object_term_relationships( $object_id, $taxonomies ) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->delete_object_term_relationships( $object_id, $taxonomies );
+}
+
+function wp_delete_term( $term, $taxonomy, $args = array() ) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->delete_term( $term, $taxonomy, $args );
+}
+
+function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->get_object_terms($object_ids, $taxonomies, $args );
+}
+
+function wp_insert_term( $term, $taxonomy, $args = array() ) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->insert_term( $term, $taxonomy, $args );
+}
+
+function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->set_object_terms($object_id, $terms, $taxonomy, $append);
+}
+
+function wp_unique_term_slug($slug, $term) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->unique_term_slug($slug, $term);
+}
+
+function wp_update_term( $term, $taxonomy, $args = array() ) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->update_term( $term, $taxonomy, $args );
+}
+
+function wp_defer_term_counting($defer=NULL) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->defer_term_counting($defer);
+}
+
+function wp_update_term_count( $terms, $taxonomy, $do_deferred=false ) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->update_term_count( $terms, $taxonomy, $do_deferred );
+}
+
+function wp_update_term_count_now( $terms, $taxonomy ) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->update_term_count_now( $terms, $taxonomy );
+}
+
+function clean_object_term_cache($object_ids, $object_type) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->clean_object_term_cache($object_ids, $object_type);
+}
+
+function clean_term_cache($ids, $taxonomy = '') {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->clean_term_cache($ids, $taxonomy);
+}
+
+function &get_object_term_cache($id, $taxonomy) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->get_object_term_cache($id, $taxonomy);
+}
+
+function update_object_term_cache($object_ids, $object_type) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->update_object_term_cache($object_ids, $object_type);
+}
+
+function update_term_cache($terms, $taxonomy = '') {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->update_term_cache($terms, $taxonomy);
+}
+
+function _get_term_hierarchy($taxonomy) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->_get_term_hierarchy($taxonomy);
+}
+
+function &_get_term_children($term_id, $terms, $taxonomy) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->_get_term_children($term_id, $terms, $taxonomy);
+}
+
+function _pad_term_counts(&$terms, $taxonomy) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->_pad_term_counts(&$terms, $taxonomy);
+}
+
+function is_object_in_term($object_id, $taxonomy, $terms = null) {
+	global $wp_taxonomy_object;
+	return $wp_taxonomy_object->is_object_in_term($object_id, $taxonomy, $terms);
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/interface.bp-options.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/interface.bp-options.php
new file mode 100644
index 0000000000000000000000000000000000000000..9e77e4a1a1dd0c0be363482fa34a42b3a6437a17
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/interface.bp-options.php
@@ -0,0 +1,129 @@
+<?php
+/**
+ * BackPress Options API.
+ *
+ * This is in place for the multiple projects that use BackPress to have options
+ * and transients but not rely on the WordPress options API.
+ *
+ * @since r132
+ */
+
+/**
+ * Interface for BP_Options;
+ *
+ * A BP_Options class must be implemented by the host application for
+ * BackPress to operate. This interface supplies a boilerplate for that
+ * class but can only be implemented in PHP 5 environments.
+ *
+ * @since r132
+ * @package BackPress
+ */
+interface BP_Options_Interface
+{
+	/**
+	 * Retrieve the prefix to be appended to the beginning of the option key.
+	 *
+	 * @since r132
+	 */
+	function prefix();
+
+	/**
+	 * Retrieve the value of the option.
+	 *
+	 * Here is a minimum set of values required (from bbPress)
+	 * - application_id     : An id for the application, use this when running multiple applications from the same code
+	 * - application_uri    : The base URI of the application
+	 * - cron_uri           : The URI that processes cron jobs
+	 * - cron_check         : A unique hash to check that the cron call is valid
+	 * - wp_http_version    : This is the version sent when making remote HTTP requests
+	 * - hash_function_name : The function used to create unique hashes ( see wp_hash() )
+	 * - language_locale    : The current locale
+	 * - language_directory : The directory containing language (po, mo) files
+	 * - charset            : The charset to use when appropriate (usually UTF-8)
+	 * - gmt_offset         : The GMT offset as a positive or negative float
+	 * - timezone_string    : The timezone in Zoneinfo format
+	 *
+	 * @since r132
+	 *
+	 * @param string $option Option name.
+	 */
+	function get( $option );
+
+	/**
+	 * Adds an option with given value.
+	 *
+	 * @since r132
+	 *
+	 * @param string $option Option name.
+	 * @param mixed $value Option value.
+	 */
+	function add( $option, $value );
+
+	/**
+	 * Updates an existing option with a given value.
+	 *
+	 * @since r132
+	 *
+	 * @param string $option Option name.
+	 * @param mixed $value Option value.
+	 */
+	function update( $option, $value );
+
+	/**
+	 * Deletes an existing option.
+	 *
+	 * @since r132
+	 *
+	 * @param string $option Option name.
+	 */
+	function delete( $option );
+} // END interface BP_Options_Interface
+
+/**
+ * Interface for BP_Transients;
+ *
+ * A BP_Transients class must be implemented by the host application for
+ * BackPress to operate. This interface supplies a boilerplate for that
+ * class but can only be implemented in PHP 5 environments.
+ *
+ * @since r205
+ * @package BackPress
+ */
+interface BP_Transients_Interface
+{
+	/**
+	 * Retrieve the prefix to be appended to the beginning of the transient key.
+	 *
+	 * @since r205
+	 */
+	function prefix();
+
+	/**
+	 * Retrieve the value of the transient.
+	 *
+	 * @since r205
+	 *
+	 * @param string $transient Transient name.
+	 */
+	function get( $transient );
+
+	/**
+	 * Sets the value of a transient with a given value.
+	 *
+	 * @since r205
+	 *
+	 * @param string $transient Transient name.
+	 * @param mixed $value Transient value.
+	 * @param integer $expiration The time in seconds the transient will be held for. Default is 0, meaning it is held indefinitely.
+	 */
+	function set( $transient, $value, $expiration = 0 );
+
+	/**
+	 * Deletes an existing transient.
+	 *
+	 * @since r205
+	 *
+	 * @param string $transient Transient name.
+	 */
+	function delete( $transient );
+} // END Interface BP_Transients
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/loader.wp-object-cache-memcached.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/loader.wp-object-cache-memcached.php
new file mode 100644
index 0000000000000000000000000000000000000000..ae005a008a6f6a075bda03844edcf9ba7a62c9e6
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/loader.wp-object-cache-memcached.php
@@ -0,0 +1,4 @@
+<?php
+
+require_once( 'class.wp-object-cache-memcached.php' );
+require_once( 'functions.wp-object-cache.php' );
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/loader.wp-object-cache.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/loader.wp-object-cache.php
new file mode 100644
index 0000000000000000000000000000000000000000..2ba33f72aea793824207f8620b698a568527b933
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/loader.wp-object-cache.php
@@ -0,0 +1,4 @@
+<?php
+
+require_once( 'class.wp-object-cache.php' );
+require_once( 'functions.wp-object-cache.php' );
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/entry.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/entry.php
new file mode 100644
index 0000000000000000000000000000000000000000..feb5b34cf2fa474883e110c9c76b168b30aad1c0
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/entry.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Contains Translation_Entry class
+ *
+ * @version $Id: entry.php 115 2009-05-11 18:56:15Z nbachiyski $
+ * @package pomo
+ * @subpackage entry
+ */
+
+
+/**
+ * Translation_Entry class encapsulates a translatable string
+ */
+class Translation_Entry {
+
+	/**
+	 * Whether the entry contains a string and its plural form, default is false
+	 *
+	 * @var boolean
+	 */
+	var $is_plural = false;
+
+	var $context = null;
+	var $singular = null;
+	var $plural = null;
+	var $translations = array();
+	var $translator_comments = '';
+	var $extracted_comments = '';
+	var $references = array();
+	var $flags = array();
+
+	/**
+	 * @param array $args associative array, support following keys:
+	 * 	- singular (string) -- the string to translate, if omitted and empty entry will be created
+	 * 	- plural (string) -- the plural form of the string, setting this will set {@link $is_plural} to true
+	 * 	- translations (array) -- translations of the string and possibly -- its plural forms
+	 * 	- context (string) -- a string differentiating two equal strings used in different contexts
+	 * 	- translator_comments (string) -- comments left by translators
+	 * 	- extracted_comments (string) -- comments left by developers
+	 * 	- references (array) -- places in the code this strings is used, in relative_to_root_path/file.php:linenum form
+	 * 	- flags (array) -- flags like php-format
+	 */
+	function Translation_Entry($args=array()) {
+		// if no singular -- empty object
+		if (!isset($args['singular'])) {
+			return;
+		}
+		// get member variable values from args hash
+		$object_varnames = array_keys(get_object_vars($this));
+		foreach ($args as $varname => $value) {
+			$this->$varname = $value;
+		}
+		if (isset($args['plural'])) $this->is_plural = true;
+		if (!is_array($this->translations)) $this->translations = array();
+		if (!is_array($this->references)) $this->references = array();
+		if (!is_array($this->flags)) $this->flags = array();
+	}
+
+	/**
+	 * Generates a unique key for this entry
+	 *
+	 * @return string|bool the key or false if the entry is empty
+	 */
+	function key() {
+		if (is_null($this->singular)) return false;
+		// prepend context and EOT, like in MO files
+		return is_null($this->context)? $this->singular : $this->context.chr(4).$this->singular;
+	}
+}
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/mo.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/mo.php
new file mode 100644
index 0000000000000000000000000000000000000000..0630ef285e21f51e10d2fd53d082b1b088daad02
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/mo.php
@@ -0,0 +1,185 @@
+<?php
+/**
+ * Class for working with MO files
+ *
+ * @version $Id: mo.php 106 2009-04-23 19:48:22Z nbachiyski $
+ * @package pomo
+ * @subpackage mo
+ */
+
+require_once dirname(__FILE__) . '/translations.php';
+require_once dirname(__FILE__) . '/streams.php';
+
+class MO extends Gettext_Translations {
+
+	var $_nplurals = 2;
+
+	/**
+	 * Fills up with the entries from MO file $filename
+	 *
+	 * @param string $filename MO file to load
+	 */
+	function import_from_file($filename) {
+		$reader = new POMO_CachedIntFileReader($filename);
+		if (isset($reader->error)) {
+			return false;
+		}
+		return $this->import_from_reader($reader);
+	}
+	
+	function export_to_file($filename) {
+		$fh = fopen($filename, 'wb');
+		if ( !$fh ) return false;
+		$entries = array_filter($this->entries, create_function('$e', 'return !empty($e->translations);'));
+		ksort($entries);
+		$magic = 0x950412de;
+		$revision = 0;
+		$total = count($entries) + 1; // all the headers are one entry
+		$originals_lenghts_addr = 28;
+		$translations_lenghts_addr = $originals_lenghts_addr + 8 * $total;
+		$size_of_hash = 0;
+		$hash_addr = $translations_lenghts_addr + 8 * $total;
+		$current_addr = $hash_addr;
+		fwrite($fh, pack('V*', $magic, $revision, $total, $originals_lenghts_addr,
+			$translations_lenghts_addr, $size_of_hash, $hash_addr));
+		fseek($fh, $originals_lenghts_addr);
+		
+		// headers' msgid is an empty string
+		fwrite($fh, pack('VV', 0, $current_addr));
+		$current_addr++;
+		$originals_table = chr(0);
+
+		foreach($entries as $entry) {
+			$originals_table .= $this->export_original($entry) . chr(0);
+			$length = strlen($this->export_original($entry));
+			fwrite($fh, pack('VV', $length, $current_addr));
+			$current_addr += $length + 1; // account for the NULL byte after
+		}
+		
+		$exported_headers = $this->export_headers();
+		fwrite($fh, pack('VV', strlen($exported_headers), $current_addr));
+		$current_addr += strlen($exported_headers) + 1;
+		$translations_table = $exported_headers . chr(0);
+		
+		foreach($entries as $entry) {
+			$translations_table .= $this->export_translations($entry) . chr(0);
+			$length = strlen($this->export_translations($entry));
+			fwrite($fh, pack('VV', $length, $current_addr));
+			$current_addr += $length + 1;
+		}
+		
+		fwrite($fh, $originals_table);
+		fwrite($fh, $translations_table);
+		fclose($fh);
+	}
+	
+	function export_original($entry) {
+		//TODO: warnings for control characters
+		$exported = $entry->singular;
+		if ($entry->is_plural) $exported .= chr(0).$entry->plural;
+		if (!is_null($entry->context)) $exported = $entry->context . chr(4) . $exported;
+		return $exported;
+	}
+	
+	function export_translations($entry) {
+		//TODO: warnings for control characters
+		return implode(chr(0), $entry->translations);
+	}
+	
+	function export_headers() {
+		$exported = '';
+		foreach($this->headers as $header => $value) {
+			$exported.= "$header: $value\n";
+		}
+		return $exported;
+	}
+
+	function get_byteorder($magic) {
+
+		// The magic is 0x950412de
+
+		// bug in PHP 5.0.2, see https://savannah.nongnu.org/bugs/?func=detailitem&item_id=10565
+		$magic_little = (int) - 1794895138;
+		$magic_little_64 = (int) 2500072158;
+		// 0xde120495
+		$magic_big = ((int) - 569244523) && 0xFFFFFFFF;
+		
+		if ($magic_little == $magic || $magic_little_64 == $magic) {
+			return 'little';
+		} else if ($magic_big == $magic) {
+			return 'big';
+		} else {
+			return false;
+		}
+	}
+
+	function import_from_reader($reader) {
+		$reader->setEndian('little');
+		$endian = MO::get_byteorder($reader->readint32());
+		if (false === $endian) {
+			return false;
+		}
+		$reader->setEndian($endian);
+
+		$revision = $reader->readint32();
+		$total = $reader->readint32();
+		// get addresses of array of lenghts and offsets for original string and translations
+		$originals_lenghts_addr = $reader->readint32();
+		$translations_lenghts_addr = $reader->readint32();
+
+		$reader->seekto($originals_lenghts_addr);
+		$originals_lenghts = $reader->readint32array($total * 2); // each of 
+		$reader->seekto($translations_lenghts_addr);
+		$translations_lenghts = $reader->readint32array($total * 2);
+
+		$length = create_function('$i', 'return $i * 2 + 1;');
+		$offset = create_function('$i', 'return $i * 2 + 2;');
+
+		for ($i = 0; $i < $total; ++$i) {
+			$reader->seekto($originals_lenghts[$offset($i)]);
+			$original = $reader->read($originals_lenghts[$length($i)]);
+			$reader->seekto($translations_lenghts[$offset($i)]);
+			$translation = $reader->read($translations_lenghts[$length($i)]);
+			if ('' == $original) {
+				$this->set_headers($this->make_headers($translation));
+			} else {
+				$this->add_entry($this->make_entry($original, $translation));
+			}
+		}
+		return true;
+	}
+
+	/**
+	 * @static
+	 */
+	function &make_entry($original, $translation) {
+		$args = array();
+		// look for context
+		$parts = explode(chr(4), $original);
+		if (isset($parts[1])) {
+			$original = $parts[1];
+			$args['context'] = $parts[0];
+		}
+		// look for plural original
+		$parts = explode(chr(0), $original);
+		$args['singular'] = $parts[0];
+		if (isset($parts[1])) {
+			$args['plural'] = $parts[1];
+		}
+		// plural translations are also separated by \0
+		$args['translations'] = explode(chr(0), $translation);
+		$entry = & new Translation_Entry($args);
+		return $entry;
+	}
+
+	function select_plural_form($count) {
+		return $this->gettext_select_plural_form($count);
+	}
+
+	function get_plural_forms_count() {
+		return $this->_nplurals;
+	}
+
+
+}
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/po.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/po.php
new file mode 100644
index 0000000000000000000000000000000000000000..6c40c5a4eee44ea7e9c9324ee32a4a2ab79d6a20
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/po.php
@@ -0,0 +1,360 @@
+<?php
+/**
+ * Class for working with PO files
+ *
+ * @version $Id: po.php 123 2009-05-13 19:35:43Z nbachiyski $
+ * @package pomo
+ * @subpackage po
+ */
+
+require_once dirname(__FILE__) . '/translations.php';
+
+define('PO_MAX_LINE_LEN', 79);
+
+ini_set('auto_detect_line_endings', 1);
+
+/**
+ * Routines for working with PO files
+ */
+class PO extends Gettext_Translations {
+	
+
+	/**
+	 * Exports headers to a PO entry
+	 *
+	 * @return string msgid/msgstr PO entry for this PO file headers, doesn't contain newline at the end
+	 */
+	function export_headers() {
+		$header_string = '';
+		foreach($this->headers as $header => $value) {
+			$header_string.= "$header: $value\n";
+		}
+		$poified = PO::poify($header_string);
+		return rtrim("msgid \"\"\nmsgstr $poified");
+	}
+
+	/**
+	 * Exports all entries to PO format
+	 *
+	 * @return string sequence of mgsgid/msgstr PO strings, doesn't containt newline at the end
+	 */
+	function export_entries() {
+		//TODO sorting
+		return implode("\n\n", array_map(array('PO', 'export_entry'), $this->entries));
+	}
+
+	/**
+	 * Exports the whole PO file as a string
+	 *
+	 * @param bool $include_headers whether to include the headers in the export
+	 * @return string ready for inclusion in PO file string for headers and all the enrtries
+	 */
+	function export($include_headers = true) {
+		$res = '';
+		if ($include_headers) {
+			$res .= $this->export_headers();
+			$res .= "\n\n";
+		}
+		$res .= $this->export_entries();
+		return $res;
+	}
+
+	/**
+	 * Same as {@link export}, but writes the result to a file
+	 *
+	 * @param string $filename where to write the PO string
+	 * @param bool $include_headers whether to include tje headers in the export
+	 * @return bool true on success, false on error
+	 */
+	function export_to_file($filename, $include_headers = true) {
+		$fh = fopen($filename, 'w');
+		if (false === $fh) return false;
+		$export = $this->export($include_headers);
+		$res = fwrite($fh, $export);
+		if (false === $res) return false;
+		return fclose($fh);
+	}
+
+	/**
+	 * Formats a string in PO-style
+	 *
+	 * @static
+	 * @param string $string the string to format
+	 * @return string the poified string
+	 */
+	function poify($string) {
+		$quote = '"';
+		$slash = '\\';
+		$newline = "\n";
+
+		$replaces = array(
+			"$slash" 	=> "$slash$slash",
+			"$quote"	=> "$slash$quote",
+			"\t" 		=> '\t',
+		);
+
+		$string = str_replace(array_keys($replaces), array_values($replaces), $string);
+
+		$po = $quote.implode("${slash}n$quote$newline$quote", explode($newline, $string)).$quote;
+		// add empty string on first line for readbility
+		if (false !== strpos($string, $newline) &&
+				(substr_count($string, $newline) > 1 || !($newline === substr($string, -strlen($newline))))) {
+			$po = "$quote$quote$newline$po";
+		}
+		// remove empty strings
+		$po = str_replace("$newline$quote$quote", '', $po);
+		return $po;
+	}
+	
+	/**
+	 * Gives back the original string from a PO-formatted string
+	 * 
+	 * @static
+	 * @param string $string PO-formatted string
+	 * @return string enascaped string
+	 */
+	function unpoify($string) {
+		$escapes = array('t' => "\t", 'n' => "\n", '\\' => '\\');
+		$lines = array_map('trim', explode("\n", $string));
+		$lines = array_map(array('PO', 'trim_quotes'), $lines);
+		$unpoified = '';
+		$previous_is_backslash = false;
+		foreach($lines as $line) {
+			preg_match_all('/./u', $line, $chars);
+			$chars = $chars[0];
+			foreach($chars as $char) {
+				if (!$previous_is_backslash) {
+					if ('\\' == $char)
+						$previous_is_backslash = true;
+					else
+						$unpoified .= $char;
+				} else {
+					$previous_is_backslash = false;
+					$unpoified .= isset($escapes[$char])? $escapes[$char] : $char;
+				}
+			}
+		}
+		return $unpoified;
+	}
+
+	/**
+	 * Inserts $with in the beginning of every new line of $string and 
+	 * returns the modified string
+	 *
+	 * @static
+	 * @param string $string prepend lines in this string
+	 * @param string $with prepend lines with this string
+	 */
+	function prepend_each_line($string, $with) {
+		$php_with = var_export($with, true);
+		$lines = explode("\n", $string);
+		// do not prepend the string on the last empty line, artefact by explode
+		if ("\n" == substr($string, -1)) unset($lines[count($lines) - 1]);
+		$res = implode("\n", array_map(create_function('$x', "return $php_with.\$x;"), $lines));
+		// give back the empty line, we ignored above
+		if ("\n" == substr($string, -1)) $res .= "\n";
+		return $res;
+	}
+
+	/**
+	 * Prepare a text as a comment -- wraps the lines and prepends #
+	 * and a special character to each line
+	 *
+	 * @access private
+	 * @param string $text the comment text
+	 * @param string $char character to denote a special PO comment,
+	 * 	like :, default is a space
+	 */
+	function comment_block($text, $char=' ') {
+		$text = wordwrap($text, PO_MAX_LINE_LEN - 3);
+		return PO::prepend_each_line($text, "#$char ");
+	}
+
+	/**
+	 * Builds a string from the entry for inclusion in PO file
+	 *
+	 * @static
+	 * @param object &$entry the entry to convert to po string
+	 * @return string|bool PO-style formatted string for the entry or
+	 * 	false if the entry is empty
+	 */
+	function export_entry(&$entry) {
+		if (is_null($entry->singular)) return false;
+		$po = array();
+		if (!empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments);
+		if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.');
+		if (!empty($entry->references)) $po[] = PO::comment_block(implode(' ', $entry->references), ':');
+		if (!empty($entry->flags)) $po[] = PO::comment_block(implode(", ", $entry->flags), ',');
+		if (!is_null($entry->context)) $po[] = 'msgctxt '.PO::poify($entry->context);
+		$po[] = 'msgid '.PO::poify($entry->singular);
+		if (!$entry->is_plural) {
+			$translation = empty($entry->translations)? '' : $entry->translations[0];
+			$po[] = 'msgstr '.PO::poify($translation);
+		} else {
+			$po[] = 'msgid_plural '.PO::poify($entry->plural);
+			$translations = empty($entry->translations)? array('', '') : $entry->translations;
+			foreach($translations as $i => $translation) {
+				$po[] = "msgstr[$i] ".PO::poify($translation);
+			}
+		}
+		return implode("\n", $po);
+	}
+
+	function import_from_file($filename) {
+		$f = fopen($filename, 'r');
+		if (!$f) return false;
+		$lineno = 0;
+		while (true) {
+			$res = $this->read_entry($f, $lineno);
+			if (!$res) break;
+			if ($res['entry']->singular == '') {
+				$this->set_headers($this->make_headers($res['entry']->translations[0]));
+			} else {
+				$this->add_entry($res['entry']);
+			}
+		}
+		PO::read_line($f, 'clear');
+		return $res !== false;
+	}
+	
+	function read_entry($f, $lineno = 0) {
+		$entry = new Translation_Entry();
+		// where were we in the last step
+		// can be: comment, msgctxt, msgid, msgid_plural, msgstr, msgstr_plural
+		$context = '';
+		$msgstr_index = 0;
+		$is_final = create_function('$context', 'return $context == "msgstr" || $context == "msgstr_plural";');
+		while (true) {
+			$lineno++;
+			$line = PO::read_line($f);
+			if (!$line)  {
+				if (feof($f)) {
+					if ($is_final($context))
+						break;
+					elseif (!$context) // we haven't read a line and eof came
+						return null;
+					else
+						return false;
+				} else {
+					return false;
+				}
+			}
+			if ($line == "\n") continue;
+			$line = trim($line);
+			if (preg_match('/^#/', $line, $m)) {
+				// the comment is the start of a new entry
+				if ($is_final($context)) {
+					PO::read_line($f, 'put-back');
+					$lineno--;
+					break;
+				}
+				// comments have to be at the beginning
+				if ($context && $context != 'comment') {
+					return false;
+				}
+				// add comment
+				$this->add_comment_to_entry($entry, $line);;
+			} elseif (preg_match('/^msgctxt\s+(".*")/', $line, $m)) {
+				if ($is_final($context)) {
+					PO::read_line($f, 'put-back');
+					$lineno--;
+					break;
+				}
+				if ($context && $context != 'comment') {
+					return false;
+				}
+				$context = 'msgctxt';
+				$entry->context .= PO::unpoify($m[1]);
+			} elseif (preg_match('/^msgid\s+(".*")/', $line, $m)) {
+				if ($is_final($context)) {
+					PO::read_line($f, 'put-back');
+					$lineno--;
+					break;
+				}
+				if ($context && $context != 'msgctxt' && $context != 'comment') {
+					return false;
+				}
+				$context = 'msgid';
+				$entry->singular .= PO::unpoify($m[1]);
+			} elseif (preg_match('/^msgid_plural\s+(".*")/', $line, $m)) {
+				if ($context != 'msgid') {
+					return false;
+				}
+				$context = 'msgid_plural';
+				$entry->is_plural = true;
+				$entry->plural .= PO::unpoify($m[1]);
+			} elseif (preg_match('/^msgstr\s+(".*")/', $line, $m)) {
+				if ($context != 'msgid') {
+					return false;
+				}
+				$context = 'msgstr';
+				$entry->translations = array(PO::unpoify($m[1]));
+			} elseif (preg_match('/^msgstr\[(\d+)\]\s+(".*")/', $line, $m)) {
+				if ($context != 'msgid_plural' && $context != 'msgstr_plural') {
+					return false;
+				}
+				$context = 'msgstr_plural';
+				$msgstr_index = $m[1];
+				$entry->translations[$m[1]] = PO::unpoify($m[2]);
+			} elseif (preg_match('/^".*"$/', $line)) {
+				$unpoified = PO::unpoify($line);
+				switch ($context) {
+					case 'msgid':
+						$entry->singular .= $unpoified; break;
+					case 'msgctxt':
+						$entry->context .= $unpoified; break;
+					case 'msgid_plural':
+						$entry->plural .= $unpoified; break;
+					case 'msgstr':
+						$entry->translations[0] .= $unpoified; break;
+					case 'msgstr_plural':
+						$entry->translations[$msgstr_index] .= $unpoified; break;
+					default:
+						return false;
+				}
+			} else {
+				return false;
+			}
+		}
+		if (array() == array_filter($entry->translations)) $entry->translations = array();
+		return array('entry' => $entry, 'lineno' => $lineno);
+	}
+	
+	function read_line($f, $action = 'read') {
+		static $last_line = '';
+		static $use_last_line = false;
+		if ('clear' == $action) {
+			$last_line = '';
+			return true;
+		}
+		if ('put-back' == $action) {
+			$use_last_line = true;
+			return true;
+		}
+		$line = $use_last_line? $last_line : fgets($f);
+		$last_line = $line;
+		$use_last_line = false;
+		return $line;
+	}
+	
+	function add_comment_to_entry(&$entry, $po_comment_line) {
+		$first_two = substr($po_comment_line, 0, 2);
+		$comment = trim(substr($po_comment_line, 2));
+		if ('#:' == $first_two) {
+			$entry->references = array_merge($entry->references, preg_split('/\s+/', $comment));
+		} elseif ('#.' == $first_two) {
+			$entry->extracted_comments = trim($entry->extracted_comments . "\n" . $comment);
+		} elseif ('#,' == $first_two) {
+			$entry->flags = array_merge($entry->flags, preg_split('/,\s*/', $comment));
+		} else {
+			$entry->translator_comments = trim($entry->translator_comments . "\n" . $comment);
+		}
+	}
+	
+	function trim_quotes($s) {
+		if ( substr($s, 0, 1) == '"') $s = substr($s, 1);
+		if ( substr($s, -1, 1) == '"') $s = substr($s, 0, -1);
+		return $s;
+	}
+}
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/app.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/app.php
new file mode 100644
index 0000000000000000000000000000000000000000..e0a0bf7a389e051f816ded23a860f3b4227d3af2
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/app.php
@@ -0,0 +1,63 @@
+<?php
+
+require_once '../translations.php';
+require_once '../mo.php';
+
+
+function __($text, $domain = 'default') {
+	$translations = &get_translations($domain);
+	return $translations->translate($text);
+}
+
+function _e($text, $domain = 'default') {
+	$translations = &get_translations($domain);
+	echo $translations->translate($text);
+}
+
+function __n($singular, $plural, $count, $domain = 'default') {
+	$translations = &get_translations($domain);
+	return $translations->translate_plural($singular, $plural, $count);
+}
+
+function &load_translations($mo_filename) {
+	if (is_readable($mo_filename)) {
+		$translations = new MO();
+		$translations->import_from_file($mo_filename);
+	} else {
+		$translations = new Translations();
+	}
+	return $translations;
+}
+
+// get the locale from somewhere: subomain, config, GET var, etc.
+// it can be safely empty
+$locale = 'bg';
+$translations = array();
+$empty_translations = & new Translations();
+
+function load_textdomain($domain, $mofile) {
+	global $translations;
+	$translations[$domain] = &load_translations($mofile);
+}
+
+function &get_translations($domain) {
+	global $translations, $empty_translations;
+	return isset($translations[$domain])? $translations[$domain] : $empty_translations;
+}
+
+// load the translations
+load_textdomain('default', "languages/$locale.mo");
+load_textdomain('side', "languages/$locale-side.mo");
+
+//here comes the real app
+$user = 'apok';
+$messages = rand(0, 2);
+
+printf(__('Welcome %s!')."\n", $user);
+
+printf(__n('You have one new message.', 'You have %s new messages.', $messages)."\n", $messages);
+
+echo __("A string with low priority!", 'side')."\n";
+
+_e("Bye\n");
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/app-side.pot b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/app-side.pot
new file mode 100644
index 0000000000000000000000000000000000000000..19998d730da556a6ea5ee4b0c2ee0b9128b184f8
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/app-side.pot
@@ -0,0 +1,21 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: wp-polyglots@lists.automattic.com\n"
+"POT-Creation-Date: 2008-06-06 23:10+0300\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+msgid "A string with low priority!"
+msgstr ""
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/app.pot b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/app.pot
new file mode 100644
index 0000000000000000000000000000000000000000..51d1fa1bb5684958dd15f40aeadb82bfe76ce02d
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/app.pot
@@ -0,0 +1,34 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: wp-polyglots@lists.automattic.com\n"
+"POT-Creation-Date: 2008-06-06 23:10+0300\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: app.php:46
+#, php-format
+msgid "Welcome %s!"
+msgstr ""
+
+#: app.php:48
+#, php-format
+msgid "You have one new message."
+msgid_plural "You have %s new messages."
+msgstr[0] ""
+msgstr[1] ""
+
+#: app.php:50
+msgid "Bye\n"
+msgstr ""
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/bg-side.mo b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/bg-side.mo
new file mode 100644
index 0000000000000000000000000000000000000000..0cb44df63cb01dd9b0bc25f83667dbcd8b514bfc
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/bg-side.mo differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/bg-side.po b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/bg-side.po
new file mode 100644
index 0000000000000000000000000000000000000000..a02bd2596f43e64de9afb3ea04adb9e98c22d1ea
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/bg-side.po
@@ -0,0 +1,19 @@
+# Bulgarian translations for PACKAGE package.
+# Copyright (C) 2008 THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# Nikolay Bachiyski <nb@nikolay.bg>, 2008.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: wp-polyglots@lists.automattic.com\n"
+"POT-Creation-Date: 2008-06-06 23:10+0300\n"
+"PO-Revision-Date: 2008-06-06 22:54+0300\n"
+"Last-Translator: Nikolay Bachiyski <nb@nikolay.bg>\n"
+"Language-Team: Bulgarian\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid "A string with low priority!"
+msgstr "Смотан низ!"
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/bg.mo b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/bg.mo
new file mode 100644
index 0000000000000000000000000000000000000000..97abf08995f7a394ede72a346d2b07512d1115f1
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/bg.mo differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/bg.po b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/bg.po
new file mode 100644
index 0000000000000000000000000000000000000000..e0c3ce6039d86b4ba9eee7845eba90760c67024f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/sample/languages/bg.po
@@ -0,0 +1,32 @@
+# Bulgarian translations for PACKAGE package.
+# Copyright (C) 2008 THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# Nikolay Bachiyski <nb@nikolay.bg>, 2008.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: wp-polyglots@lists.automattic.com\n"
+"POT-Creation-Date: 2008-06-06 23:10+0300\n"
+"PO-Revision-Date: 2008-06-06 22:54+0300\n"
+"Last-Translator: Nikolay Bachiyski <nb@nikolay.bg>\n"
+"Language-Team: Bulgarian\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: app.php:46
+#, php-format
+msgid "Welcome %s!"
+msgstr "Добре дошъл, %s!"
+
+#: app.php:48
+#, php-format
+msgid "You have one new message."
+msgid_plural "You have %s new messages."
+msgstr[0] "Имате едно ново съобщение."
+msgstr[1] "Имате %s нови съобщения."
+
+#: app.php:50
+msgid "Bye\n"
+msgstr "Чао\n"
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/streams.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/streams.php
new file mode 100644
index 0000000000000000000000000000000000000000..6710746e8fbeb1f76507e5f36136ee97b2b0bb03
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/streams.php
@@ -0,0 +1,137 @@
+<?php
+/**
+ * Classes, which help reading streams of data from files.
+ * Based on the classes from Danilo Segan <danilo@kvota.net>
+ *
+ * @version $Id: streams.php 138 2009-06-23 13:22:09Z nbachiyski $
+ * @package pomo
+ * @subpackage streams
+ */
+
+
+/**
+ * Provides file-like methods for manipulating a string instead
+ * of a physical file.
+ */
+class POMO_StringReader {
+  var $_pos;
+  var $_str;
+
+	function POMO_StringReader($str = '') {
+		$this->_str = $str;
+		$this->_pos = 0;
+		$this->is_overloaded = ((ini_get("mbstring.func_overload") & 2) != 0) && function_exists('mb_substr');
+	}
+
+	function _substr($string, $start, $length) {
+		if ($this->is_overloaded) {
+			return mb_substr($string,$start,$length,'ascii');
+		} else {
+			return substr($string,$start,$length);
+		}
+	}
+	
+	function _strlen($string) {
+		if ($this->is_overloaded) {
+			return mb_strlen($string,'ascii');
+		} else {
+			return strlen($string);
+		}
+	}
+
+	function read($bytes) {
+		$data = $this->_substr($this->_str, $this->_pos, $bytes);
+		$this->_pos += $bytes;
+		if ($this->_strlen($this->_str) < $this->_pos) $this->_pos = $this->_strlen($this->_str);
+		return $data;
+	}
+
+	function seekto($pos) {
+		$this->_pos = $pos;
+		if ($this->_strlen($this->_str) < $this->_pos) $this->_pos = $this->_strlen($this->_str);
+		return $this->_pos;
+	}
+
+	function pos() {
+		return $this->_pos;
+	}
+
+	function length() {
+		return $this->_strlen($this->_str);
+	}
+
+}
+
+/**
+ * Reads the contents of the file in the beginning.
+ */
+class POMO_CachedFileReader extends POMO_StringReader {
+	function POMO_CachedFileReader($filename) {
+		parent::POMO_StringReader();
+		$this->_str = file_get_contents($filename);
+		if (false === $this->_str)
+			return false;
+		$this->_pos = 0;
+	}
+}
+
+/**
+ * Allows reading integers from a file.
+ */
+class POMO_CachedIntFileReader extends POMO_CachedFileReader {
+
+	var $endian = 'little';
+
+	/**
+	 * Opens a file and caches it.
+	 *
+	 * @param $filename string name of the file to be opened
+	 * @param $endian string endianness of the words in the file, allowed
+	 * 	values are 'little' or 'big'. Default value is 'little'
+	 */
+	function POMO_CachedIntFileReader($filename, $endian = 'little') {
+		$this->endian = $endian;
+		parent::POMO_CachedFileReader($filename);
+	}
+
+	/**
+	 * Sets the endianness of the file.
+	 *
+	 * @param $endian string 'big' or 'little'
+	 */
+	function setEndian($endian) {
+		$this->endian = $endian;
+	}
+
+	/**
+	 * Reads a 32bit Integer from the Stream
+	 *
+	 * @return mixed The integer, corresponding to the next 32 bits from
+	 * 	the stream of false if there are not enough bytes or on error
+	 */
+	function readint32() {
+		$bytes = $this->read(4);
+		if (4 != $this->_strlen($bytes))
+			return false;
+		$endian_letter = ('big' == $this->endian)? 'N' : 'V';
+		$int = unpack($endian_letter, $bytes);
+		return array_shift($int);
+	}
+
+	/**
+	 * Reads an array of 32-bit Integers from the Stream
+	 *
+	 * @param integer count How many elements should be read
+	 * @return mixed Array of integers or false if there isn't
+	 * 	enough data or on error
+	 */
+	function readint32array($count) {
+		$bytes = $this->read(4 * $count);
+		if (4*$count != $this->_strlen($bytes))
+			return false;
+		$endian_letter = ('big' == $this->endian)? 'N' : 'V';
+		return unpack($endian_letter.$count, $bytes);
+	}
+}
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/translations.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/translations.php
new file mode 100644
index 0000000000000000000000000000000000000000..a05ae6ceb2016110f932f57d06e09e61469625ff
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/backpress/pomo/translations.php
@@ -0,0 +1,199 @@
+<?php
+/**
+ * Class for a set of entries for translation and their associated headers
+ *
+ * @version $Id: translations.php 114 2009-05-11 17:30:38Z nbachiyski $
+ * @package pomo
+ * @subpackage translations
+ */
+
+require_once dirname(__FILE__) . '/entry.php';
+
+class Translations {
+	var $entries = array();
+	var $headers = array();
+
+	/**
+	 * Add entry to the PO structure
+	 *
+	 * @param object &$entry
+	 * @return bool true on success, false if the entry doesn't have a key
+	 */
+	function add_entry($entry) {
+		if (is_array($entry)) {
+			$entry = new Translation_Entry($entry);
+		}
+		$key = $entry->key();
+		if (false === $key) return false;
+		$this->entries[$key] = $entry;
+		return true;
+	}
+
+	/**
+	 * Sets $header PO header to $value
+	 *
+	 * If the header already exists, it will be overwritten
+	 *
+	 * TODO: this should be out of this class, it is gettext specific
+	 *
+	 * @param string $header header name, without trailing :
+	 * @param string $value header value, without trailing \n
+	 */
+	function set_header($header, $value) {
+		$this->headers[$header] = $value;
+	}
+
+	function set_headers(&$headers) {
+		foreach($headers as $header => $value) {
+			$this->set_header($header, $value);
+		}
+	}
+
+	function get_header($header) {
+		return isset($this->headers[$header])? $this->headers[$header] : false;
+	}
+
+	function translate_entry(&$entry) {
+		$key = $entry->key();
+		return isset($this->entries[$key])? $this->entries[$key] : false;
+	}
+
+	function translate($singular, $context=null) {
+		$entry = new Translation_Entry(array('singular' => $singular, 'context' => $context));
+		$translated = $this->translate_entry($entry);
+		return ($translated && !empty($translated->translations))? $translated->translations[0] : $singular;
+	}
+
+	/**
+	 * Given the number of items, returns the 0-based index of the plural form to use
+	 *
+	 * Here, in the base Translations class, the commong logic for English is implmented:
+	 * 	0 if there is one element, 1 otherwise
+	 *
+	 * This function should be overrided by the sub-classes. For example MO/PO can derive the logic
+	 * from their headers.
+	 *
+	 * @param integer $count number of items
+	 */
+	function select_plural_form($count) {
+		return 1 == $count? 0 : 1;
+	}
+
+	function get_plural_forms_count() {
+		return 2;
+	}
+
+	function translate_plural($singular, $plural, $count, $context = null) {
+		$entry = new Translation_Entry(array('singular' => $singular, 'plural' => $plural, 'context' => $context));
+		$translated = $this->translate_entry($entry);
+		$index = $this->select_plural_form($count);
+		$total_plural_forms = $this->get_plural_forms_count();
+		if ($translated && 0 <= $index && $index < $total_plural_forms &&
+				is_array($translated->translations) &&
+				isset($translated->translations[$index]))
+			return $translated->translations[$index];
+		else
+			return 1 == $count? $singular : $plural;
+	}
+
+	/**
+	 * Merge $other in the current object.
+	 *
+	 * @param Object &$other Another Translation object, whose translations will be merged in this one
+	 * @return void
+	 **/
+	function merge_with(&$other) {
+		$this->entries = array_merge($this->entries, $other->entries);
+	}
+}
+
+class Gettext_Translations extends Translations {
+	/**
+	 * The gettext implmentation of select_plural_form.
+	 *
+	 * It lives in this class, because there are more than one descendand, which will use it and
+	 * they can't share it effectively.
+	 *
+	 */
+	function gettext_select_plural_form($count) {
+		if (!isset($this->_gettext_select_plural_form) || is_null($this->_gettext_select_plural_form)) {
+			$plural_header = $this->get_header('Plural-Forms');
+			$this->_gettext_select_plural_form = $this->_make_gettext_select_plural_form($plural_header);
+		}
+		return call_user_func($this->_gettext_select_plural_form, $count);
+	}
+
+	/**
+	 * Makes a function, which will return the right translation index, according to the
+	 * plural forms header
+	 */
+	function _make_gettext_select_plural_form($plural_header) {
+		$res = create_function('$count', 'return 1 == $count? 0 : 1;');
+		if ($plural_header && (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $plural_header, $matches))) {
+			$nplurals = (int)$matches[1];
+			$this->_nplurals = $nplurals;
+			$plural_expr = trim($this->_parenthesize_plural_exression($matches[2]));
+			$plural_expr = str_replace('n', '$n', $plural_expr);
+			$func_body = "
+				\$index = (int)($plural_expr);
+				return (\$index < $nplurals)? \$index : $nplurals - 1;";
+			$res = create_function('$n', $func_body);
+		}
+		return $res;
+	}
+
+	/**
+	 * Adds parantheses to the inner parts of ternary operators in
+	 * plural expressions, because PHP evaluates ternary oerators from left to right
+	 * 
+	 * @param string $expression the expression without parentheses
+	 * @return string the expression with parentheses added
+	 */
+	function _parenthesize_plural_exression($expression) {
+		$expression .= ';';
+		$res = '';
+		$depth = 0;
+		for ($i = 0; $i < strlen($expression); ++$i) {
+			$char = $expression[$i];
+			switch ($char) {
+				case '?':
+					$res .= ' ? (';
+					$depth++;
+					break;
+				case ':':
+					$res .= ') : (';
+					break;
+				case ';':
+					$res .= str_repeat(')', $depth) . ';';
+					$depth= 0;
+					break;
+				default:
+					$res .= $char;
+			}
+		}
+		return rtrim($res, ';');
+	}
+	
+	function make_headers($translation) {
+		$headers = array();
+		// sometimes \ns are used instead of real new lines
+		$translation = str_replace('\n', "\n", $translation);
+		$lines = explode("\n", $translation);
+		foreach($lines as $line) {
+			$parts = explode(':', $line, 2);
+			if (!isset($parts[1])) continue;
+			$headers[trim($parts[0])] = trim($parts[1]);
+		}
+		return $headers;
+	}
+
+	function set_header($header, $value) {
+		parent::set_header($header, $value);
+		if ('Plural-Forms' == $header)
+			$this->_gettext_select_plural_form = $this->_make_gettext_select_plural_form($value);
+	}
+
+	
+}
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-dir-map.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-dir-map.php
new file mode 100644
index 0000000000000000000000000000000000000000..4f28bcf988b876a0bbc26fa45d01f276d03806b3
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-dir-map.php
@@ -0,0 +1,105 @@
+<?php
+
+class BB_Dir_Map {
+	var $root;
+	var $callback;
+	var $callback_args;
+	var $keep_empty;
+	var $apply_to;
+	var $recurse;
+	var $dots;
+	var $flat = array();
+	var $error = false;
+
+	var $_current_root;
+	var $_current_file;
+
+	function BB_Dir_Map( $root, $args = '' ) {
+		if ( !is_dir( $root ) ) {
+			$this->error = new WP_Error( 'bb_dir_map', __('Not a valid directory') );
+			return;
+		}
+
+		$this->parse_args( $args );
+		if ( is_null($this->apply_to) || is_null($this->dots) ) {
+			$this->error = new WP_Error( 'bb_dir_map', __('Invalid arguments') );
+			return;
+		}
+		$this->_current_root = $this->root = rtrim($root, '/\\');
+		$this->map();
+	}
+
+	function parse_args( $args ) {
+		// callback: should be callable
+		// callback_args: additional args to pass to callback
+		// apply_to: all, files, dirs
+		// keep_empty: (bool)
+		// recurse: (int) depth, -1 = infinite
+		// dots: true (everything), false (nothing), nosvn
+		$defaults = array( 'callback' => false, 'callback_args' => false, 'keep_empty' => false, 'apply_to' => 'files', 'recurse' => -1, 'dots' => false );
+		$this->callback = is_array($args) && isset($args['callback']) ? $args['callback'] : false;
+		$args = wp_parse_args( $args, $defaults );
+
+		foreach ( array('callback', 'keep_empty', 'dots') as $a )
+			if ( 'false' == $args[$a] )
+				$args[$a] = false;
+			elseif ( 'true' == $args[$a] )
+				$args[$a] = true;
+
+		if ( !isset($this->callback) )
+			$this->callback = $args['callback'];
+		if ( !is_callable($this->callback) )
+			$this->callback = false;
+		$this->callback_args = is_array($args['callback_args']) ? $args['callback_args'] : array();
+
+		$this->keep_empty = (bool) $args['keep_empty'];
+
+		$_apply_to = array( 'files' => 1, 'dirs' => 2, 'all' => 3 ); // This begs to be bitwise
+		$this->apply_to = @$_apply_to[$args['apply_to']];
+
+		$this->recurse = (int) $args['recurse'];
+
+		$_dots = array( 1 => 3, 0 => 0, 'nosvn' => 1 ); // bitwise here is a little silly
+		$this->dots = @$_dots[$args['dots']];
+	}
+
+	function map( $root = false ) {
+		$return = array();
+		$_dir = dir($root ? $root : $this->_current_root);
+		while ( false !== ( $this->_current_file = $_dir->read() ) ) {
+			if ( in_array($this->_current_file, array('.', '..')) )
+				continue;
+			if ( !$this->dots && '.' == $this->_current_file{0} )
+				continue;
+
+			$item = $_dir->path . DIRECTORY_SEPARATOR . $this->_current_file;
+			$_item = substr( $item, strlen($this->root) + 1 );
+			$_callback_args = $this->callback_args;
+			array_push( $_callback_args, $item, $_item ); // $item, $_item will be last two args
+			if ( is_dir($item) )  { // dir stuff
+				if ( 1 & $this->dots && in_array($this->_current_file, array('.svn', 'CVS')) )
+					continue;
+				if ( 2 & $this->apply_to ) {
+					$result = $this->callback ? call_user_func_array($this->callback, $_callback_args) : true;
+					if ( $result || $this->keep_empty )
+						$this->flat[$_item] = $result;
+				}
+				if ( 0 > $this->recurse || $this->recurse ) {
+					$this->recurse--;
+					$this->map( $item );
+					$this->recurse++;
+				}
+			} else { // file stuff
+				if ( !(1 & $this->apply_to) )
+					continue;
+				$result = $this->callback ? call_user_func_array($this->callback, $_callback_args) : true;
+				if ( $result || $this->keep_empty )
+					$this->flat[$_item] = $result;
+			}
+		}
+	}
+
+	function get_results() {
+		return is_wp_error( $this->error ) ? $this->error : $this->flat;
+	}
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-locale.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-locale.php
new file mode 100644
index 0000000000000000000000000000000000000000..7c5bd4292b758d21031865e6ce34b2857de49939
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-locale.php
@@ -0,0 +1,449 @@
+<?php
+// Last sync [WP11537]
+
+/**
+ * Date and Time Locale object
+ *
+ * @package bbPress
+ * @subpackage i18n
+ */
+
+/**
+ * Class that loads the calendar locale.
+ */
+class BB_Locale {
+	/**
+	 * Stores the translated strings for the full weekday names.
+	 *
+	 * @var array
+	 * @access private
+	 */
+	var $weekday;
+
+	/**
+	 * Stores the translated strings for the one character weekday names.
+	 *
+	 * There is a hack to make sure that Tuesday and Thursday, as well
+	 * as Sunday and Saturday don't conflict. See init() method for more.
+	 *
+	 * @see BB_Locale::init() for how to handle the hack.
+	 *
+	 * @var array
+	 * @access private
+	 */
+	var $weekday_initial;
+
+	/**
+	 * Stores the translated strings for the abbreviated weekday names.
+	 *
+	 * @var array
+	 * @access private
+	 */
+	var $weekday_abbrev;
+
+	/**
+	 * Stores the translated strings for the full month names.
+	 *
+	 * @var array
+	 * @access private
+	 */
+	var $month;
+
+	/**
+	 * Stores the translated strings for the abbreviated month names.
+	 *
+	 * @var array
+	 * @access private
+	 */
+	var $month_abbrev;
+
+	/**
+	 * Stores the translated strings for 'am' and 'pm'.
+	 *
+	 * Also the capitalized versions.
+	 *
+	 * @var array
+	 * @access private
+	 */
+	var $meridiem;
+
+	/**
+	 * Stores number formatting rules.
+	 *
+	 * @var array
+	 * @access public
+	 */
+	var $number_format;
+
+	/**
+	 * Stores date and time formatting strings.
+	 *
+	 * @var array
+	 * @access public
+	 */
+	var $datetime_formatstring;
+
+	/**
+	 * The text direction of the locale language.
+	 *
+	 * Default is left to right 'ltr'.
+	 *
+	 * @var string
+	 * @access private
+	 */
+	var $text_direction = '';
+
+	/**
+	 * Imports the global version to the class property.
+	 *
+	 * @var array
+	 * @access private
+	 */
+	var $locale_vars = array('text_direction');
+
+	/**
+	 * Sets up the translated strings and object properties.
+	 *
+	 * The method creates the translatable strings for various
+	 * calendar elements. Which allows for specifying locale
+	 * specific calendar names and text direction.
+	 *
+	 * @access private
+	 */
+	function init() {
+		// The Weekdays
+		$this->weekday[0] = __('Sunday');
+		$this->weekday[1] = __('Monday');
+		$this->weekday[2] = __('Tuesday');
+		$this->weekday[3] = __('Wednesday');
+		$this->weekday[4] = __('Thursday');
+		$this->weekday[5] = __('Friday');
+		$this->weekday[6] = __('Saturday');
+
+		// The first letter of each day.  The _%day%_initial suffix is a hack to make
+		// sure the day initials are unique.
+		$this->weekday_initial[__('Sunday')]    = __('S_Sunday_initial');
+		$this->weekday_initial[__('Monday')]    = __('M_Monday_initial');
+		$this->weekday_initial[__('Tuesday')]   = __('T_Tuesday_initial');
+		$this->weekday_initial[__('Wednesday')] = __('W_Wednesday_initial');
+		$this->weekday_initial[__('Thursday')]  = __('T_Thursday_initial');
+		$this->weekday_initial[__('Friday')]    = __('F_Friday_initial');
+		$this->weekday_initial[__('Saturday')]  = __('S_Saturday_initial');
+
+		foreach ($this->weekday_initial as $weekday_ => $weekday_initial_) {
+			$this->weekday_initial[$weekday_] = preg_replace('/_.+_initial$/', '', $weekday_initial_);
+		}
+
+		// Abbreviations for each day.
+		$this->weekday_abbrev[__('Sunday')]    = __('Sun');
+		$this->weekday_abbrev[__('Monday')]    = __('Mon');
+		$this->weekday_abbrev[__('Tuesday')]   = __('Tue');
+		$this->weekday_abbrev[__('Wednesday')] = __('Wed');
+		$this->weekday_abbrev[__('Thursday')]  = __('Thu');
+		$this->weekday_abbrev[__('Friday')]    = __('Fri');
+		$this->weekday_abbrev[__('Saturday')]  = __('Sat');
+
+		// The Months
+		$this->month['01'] = __('January');
+		$this->month['02'] = __('February');
+		$this->month['03'] = __('March');
+		$this->month['04'] = __('April');
+		$this->month['05'] = __('May');
+		$this->month['06'] = __('June');
+		$this->month['07'] = __('July');
+		$this->month['08'] = __('August');
+		$this->month['09'] = __('September');
+		$this->month['10'] = __('October');
+		$this->month['11'] = __('November');
+		$this->month['12'] = __('December');
+
+		// Abbreviations for each month. Uses the same hack as above to get around the
+		// 'May' duplication.
+		$this->month_abbrev[__('January')] = __('Jan_January_abbreviation');
+		$this->month_abbrev[__('February')] = __('Feb_February_abbreviation');
+		$this->month_abbrev[__('March')] = __('Mar_March_abbreviation');
+		$this->month_abbrev[__('April')] = __('Apr_April_abbreviation');
+		$this->month_abbrev[__('May')] = __('May_May_abbreviation');
+		$this->month_abbrev[__('June')] = __('Jun_June_abbreviation');
+		$this->month_abbrev[__('July')] = __('Jul_July_abbreviation');
+		$this->month_abbrev[__('August')] = __('Aug_August_abbreviation');
+		$this->month_abbrev[__('September')] = __('Sep_September_abbreviation');
+		$this->month_abbrev[__('October')] = __('Oct_October_abbreviation');
+		$this->month_abbrev[__('November')] = __('Nov_November_abbreviation');
+		$this->month_abbrev[__('December')] = __('Dec_December_abbreviation');
+
+		foreach ($this->month_abbrev as $month_ => $month_abbrev_) {
+			$this->month_abbrev[$month_] = preg_replace('/_.+_abbreviation$/', '', $month_abbrev_);
+		}
+
+		// The Meridiems
+		$this->meridiem['am'] = __('am');
+		$this->meridiem['pm'] = __('pm');
+		$this->meridiem['AM'] = __('AM');
+		$this->meridiem['PM'] = __('PM');
+
+		// Numbers formatting
+		// See http://php.net/number_format
+
+		/* translators: $decimals argument for http://php.net/number_format, default is 0 */
+		$trans = __('number_format_decimals');
+		$this->number_format['decimals'] = ('number_format_decimals' == $trans) ? 0 : $trans;
+
+		/* translators: $dec_point argument for http://php.net/number_format, default is . */
+		$trans = __('number_format_decimal_point');
+		$this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans;
+
+		/* translators: $thousands_sep argument for http://php.net/number_format, default is , */
+		$trans = __('number_format_thousands_sep');
+		$this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans;
+		
+		// Date/Time formatting
+		$this->datetime_formatstring['datetime'] = __('F j, Y - h:i A');
+		$this->datetime_formatstring['date'] = __('F j, Y');
+		$this->datetime_formatstring['time'] = __('h:i A');
+		
+		$this->_load_locale_data();
+	}
+
+	/**
+	 * Imports global locale vars set during inclusion of $locale.php.
+	 *
+	 * @access private
+	 */
+	function _load_locale_data() {
+		$locale = bb_get_locale();
+		$locale_file = BB_LANG_DIR . $locale . '.php';
+		if ( !is_file( $locale_file ) ) {
+			return;
+		}
+
+		include( $locale_file );
+
+		foreach ( $this->locale_vars as $var ) {
+			$this->$var = $$var;
+		}
+	}
+
+	/**
+	 * Retrieve the full translated weekday word.
+	 *
+	 * Week starts on translated Sunday and can be fetched
+	 * by using 0 (zero). So the week starts with 0 (zero)
+	 * and ends on Saturday with is fetched by using 6 (six).
+	 *
+	 * @access public
+	 *
+	 * @param int $weekday_number 0 for Sunday through 6 Saturday
+	 * @return string Full translated weekday
+	 */
+	function get_weekday($weekday_number) {
+		return $this->weekday[$weekday_number];
+	}
+
+	/**
+	 * Retrieve the translated weekday initial.
+	 *
+	 * The weekday initial is retrieved by the translated
+	 * full weekday word. When translating the weekday initial
+	 * pay attention to make sure that the starting letter does
+	 * not conflict.
+	 *
+	 * @access public
+	 *
+	 * @param string $weekday_name
+	 * @return string
+	 */
+	function get_weekday_initial($weekday_name) {
+		return $this->weekday_initial[$weekday_name];
+	}
+
+	/**
+	 * Retrieve the translated weekday abbreviation.
+	 *
+	 * The weekday abbreviation is retrieved by the translated
+	 * full weekday word.
+	 *
+	 * @access public
+	 *
+	 * @param string $weekday_name Full translated weekday word
+	 * @return string Translated weekday abbreviation
+	 */
+	function get_weekday_abbrev($weekday_name) {
+		return $this->weekday_abbrev[$weekday_name];
+	}
+
+	/**
+	 * Retrieve the full translated month by month number.
+	 *
+	 * The $month_number parameter has to be a string
+	 * because it must have the '0' in front of any number
+	 * that is less than 10. Starts from '01' and ends at
+	 * '12'.
+	 *
+	 * You can use an integer instead and it will add the
+	 * '0' before the numbers less than 10 for you.
+	 *
+	 * @access public
+	 *
+	 * @param string|int $month_number '01' through '12'
+	 * @return string Translated full month name
+	 */
+	function get_month($month_number) {
+		return $this->month[zeroise($month_number, 2)];
+	}
+
+	function get_month_initial($month_name) {
+		return $this->month_initial[$month_name];
+	}
+
+	/**
+	 * Retrieve translated version of month abbreviation string.
+	 *
+	 * The $month_name parameter is expected to be the translated or
+	 * translatable version of the month.
+	 *
+	 * @access public
+	 *
+	 * @param string $month_name Translated month to get abbreviated version
+	 * @return string Translated abbreviated month
+	 */
+	function get_month_abbrev($month_name) {
+		return $this->month_abbrev[$month_name];
+	}
+
+	/**
+	 * Retrieve translated version of meridiem string.
+	 *
+	 * The $meridiem parameter is expected to not be translated.
+	 *
+	 * @access public
+	 *
+	 * @param string $meridiem Either 'am', 'pm', 'AM', or 'PM'. Not translated version.
+	 * @return string Translated version
+	 */
+	function get_meridiem($meridiem) {
+		return $this->meridiem[$meridiem];
+	}
+
+	function get_datetime_formatstring($type = 'datetime') {
+		return $this->datetime_formatstring[$type];
+	}
+
+	/**
+	 * Global variables are deprecated. For backwards compatibility only.
+	 *
+	 * @deprecated For backwards compatibility only.
+	 * @access private
+	 */
+	function register_globals() {
+		$GLOBALS['weekday']         = $this->weekday;
+		$GLOBALS['weekday_initial'] = $this->weekday_initial;
+		$GLOBALS['weekday_abbrev']  = $this->weekday_abbrev;
+		$GLOBALS['month']           = $this->month;
+		$GLOBALS['month_abbrev']    = $this->month_abbrev;
+	}
+
+	/**
+	 * PHP4 style constructor which calls helper methods to set up object variables
+	 *
+	 * @uses BB_Locale::init()
+	 * @uses BB_Locale::register_globals()
+	 *
+	 * @return BB_Locale
+	 */
+	function BB_Locale() {
+		$this->init();
+		$this->register_globals();
+	}
+}
+
+/**
+ * Retrieve the date in localized format, based on timestamp.
+ *
+ * If the locale specifies the locale month and weekday, then the locale will
+ * take over the format for the date. If it isn't, then the date format string
+ * will be used instead.
+ *
+ * @param string $dateformatstring Format to display the date.
+ * @param int $unixtimestamp Optional. Unix timestamp.
+ * @param bool $gmt Optional, default is true. Whether to convert to GMT for time.
+ * @return string The date, translated if locale specifies it.
+ */
+function bb_gmdate_i18n( $dateformatstring, $unixtimestamp = false, $gmt = true ) {
+	global $bb_locale;
+	$i = $unixtimestamp;
+	// Sanity check for PHP 5.1.0-
+	if ( false === $i || intval($i) < 0 ) {
+		if ( ! $gmt )
+			$i = current_time( 'timestamp' );
+		else
+			$i = time();
+		// we should not let date() interfere with our
+		// specially computed timestamp
+		$gmt = true;
+	}
+
+	// store original value for language with untypical grammars
+	// see http://core.trac.wordpress.org/ticket/9396
+	$req_format = $dateformatstring;
+
+	$datefunc = $gmt? 'gmdate' : 'date';
+
+	if ( ( !empty( $bb_locale->month ) ) && ( !empty( $bb_locale->weekday ) ) ) {
+		$datemonth = $bb_locale->get_month( $datefunc( 'm', $i ) );
+		$datemonth_abbrev = $bb_locale->get_month_abbrev( $datemonth );
+		$dateweekday = $bb_locale->get_weekday( $datefunc( 'w', $i ) );
+		$dateweekday_abbrev = $bb_locale->get_weekday_abbrev( $dateweekday );
+		$datemeridiem = $bb_locale->get_meridiem( $datefunc( 'a', $i ) );
+		$datemeridiem_capital = $bb_locale->get_meridiem( $datefunc( 'A', $i ) );
+		$dateformatstring = ' '.$dateformatstring;
+		$dateformatstring = preg_replace( "/([^\\\])D/", "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring );
+		$dateformatstring = preg_replace( "/([^\\\])F/", "\\1" . backslashit( $datemonth ), $dateformatstring );
+		$dateformatstring = preg_replace( "/([^\\\])l/", "\\1" . backslashit( $dateweekday ), $dateformatstring );
+		$dateformatstring = preg_replace( "/([^\\\])M/", "\\1" . backslashit( $datemonth_abbrev ), $dateformatstring );
+		$dateformatstring = preg_replace( "/([^\\\])a/", "\\1" . backslashit( $datemeridiem ), $dateformatstring );
+		$dateformatstring = preg_replace( "/([^\\\])A/", "\\1" . backslashit( $datemeridiem_capital ), $dateformatstring );
+
+		$dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
+	}
+	$j = @$datefunc( $dateformatstring, $i );
+	// allow plugins to redo this entirely for languages with untypical grammars
+	$j = apply_filters('bb_gmdate_i18n', $j, $req_format, $i, $gmt);
+	return $j;
+}
+
+function bb_get_datetime_formatstring_i18n( $type = 'datetime' ) {
+	$formatstring = bb_get_option( $type . '_format' );
+	if ( empty($formatstring) ) {
+		global $bb_locale;
+		$formatstring = $bb_locale->get_datetime_formatstring( $type );
+	}
+	return $formatstring;
+}
+
+function bb_datetime_format_i18n( $unixtimestamp, $type = 'datetime', $formatstring = '', $gmt = true ) {
+	if ( empty($formatstring) ) {
+		$formatstring = bb_get_datetime_formatstring_i18n( $type );
+	}
+	return bb_gmdate_i18n( $formatstring, bb_offset_time( $unixtimestamp ), $gmt );
+}
+
+/**
+ * Convert number to format based on the locale.
+ *
+ * @since 2.3.0
+ *
+ * @param mixed $number The number to convert based on locale.
+ * @param int $decimals Precision of the number of decimal places.
+ * @return string Converted number in string format.
+ */
+function bb_number_format_i18n( $number, $decimals = null ) {
+	global $bb_locale;
+	// let the user override the precision only
+	$decimals = ( is_null( $decimals ) ) ? $bb_locale->number_format['decimals'] : intval( $decimals );
+
+	$num = number_format( $number, $decimals, $bb_locale->number_format['decimal_point'], $bb_locale->number_format['thousands_sep'] );
+
+	// let the user translate digits from latin to localized language
+	return apply_filters( 'bb_number_format_i18n', $num );
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-pingbacks.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-pingbacks.php
new file mode 100644
index 0000000000000000000000000000000000000000..2114dd1b626eb015e1535499d46f228170f5c534
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-pingbacks.php
@@ -0,0 +1,204 @@
+<?php
+/**
+ * bbPress class to handle pinging
+ *
+ * @package bbPress
+ */
+class BB_Pingbacks
+{
+	/**
+	 * Gets the Pingback endpoint URI provided by a web page specified by URL
+	 *
+	 * @return string|boolean Returns the Pingback endpoint URI if found or false
+	 */
+	function get_endpoint_uri( $url )
+	{
+		// First check for an X-pingback header
+		if ( !$response = wp_remote_head( $url ) ) {
+			return false;
+		}
+		if ( !$content_type = wp_remote_retrieve_header( $response, 'content-type' ) ) {
+			return false;
+		}
+		if ( preg_match( '#(image|audio|video|model)/#is', $content_type ) ) {
+			return false;
+		}
+		if ( $x_pingback = wp_remote_retrieve_header( $response, 'x-pingback' ) ) {
+			return trim( $x_pingback );
+		}
+
+		// Fall back to extracting it from the HTML link
+		if ( !$response = wp_remote_get( $url ) ) {
+			return false;
+		}
+		if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
+			return false;
+		}
+		if ( '' === $response_body = wp_remote_retrieve_body( $response ) ) {
+			return false;
+		}
+		if ( !preg_match_all( '@<link([^>]+)>@im', $response_body, $response_links ) ) {
+			return false;
+		}
+
+		foreach ( $response_links[1] as $response_link_attributes ) {
+			$_link = array( 'rel' => false, 'href' => false );
+			$response_link_attributes = preg_split( '@\s+@im', $response_link_attributes, -1, PREG_SPLIT_NO_EMPTY );
+			foreach ( $response_link_attributes as $response_link_attribute ) {
+				if ( $_link['rel'] == 'pingback' && $_link['href'] ) {
+					return $_link['href'];
+				}
+				if ( strpos( $response_link_attribute, '=', 1 ) !== false ) {
+					list( $_key, $_value ) = explode( '=', $response_link_attribute, 2 );
+					$_link[strtolower( $_key )] = trim( $_value, "'\"" );
+				}
+			}
+		}
+
+		// Fail
+		return false;
+	}
+
+	/**
+	 * Sends all pingbacks and other ping like requests
+	 *
+	 * At the moment only sends normal pingbacks, but may be
+	 * expanded in the future.
+	 *
+	 * @return integer The number of pings sent
+	 */
+	function send_all()
+	{
+		$pings = BB_Pingbacks::send_all_pingbacks();
+
+		return $pings;
+	}
+
+	/**
+	 * Sends all pingbacks
+	 *
+	 * @return integer The number of pings sent
+	 */
+	function send_all_pingbacks()
+	{
+		global $bbdb;
+
+		$posts = $bbdb->get_results(
+			"SELECT
+				{$bbdb->posts}.post_id,
+				{$bbdb->posts}.topic_id,
+				{$bbdb->posts}.post_text
+			FROM {$bbdb->posts}, {$bbdb->meta}
+			WHERE {$bbdb->posts}.post_id = {$bbdb->meta}.object_id
+				AND {$bbdb->meta}.object_type = 'bb_post'
+				AND {$bbdb->meta}.meta_key = 'pingback_queued';"
+		);
+
+		$pings = 0;
+		foreach ( $posts as $post ) {
+			if ( $sent = BB_Pingbacks::send_pingback( $post->topic_id, $post->post_text ) ) {
+				$pings += $sent;
+				bb_delete_postmeta( $post->post_id, 'pingback_queued' );
+			}
+		}
+
+		return $pings;
+	}
+
+	/**
+	 * Sends a single pingback if a link is found
+	 *
+	 * @return integer The number of pingbacks sent
+	 */
+	function send_pingback( $topic_id, $post_text )
+	{
+		if ( !$topic_id || !$post_text ) {
+			return 0;
+		}
+
+		// Get all links in the text and add them to an array
+		if ( !preg_match_all( '@<a ([^>]+)>@im', make_clickable( $post_text ), $post_links ) ) {
+			return 0;
+		}
+
+		$_links = array();
+		foreach ( $post_links[1] as $post_link_attributes ) {
+			$post_link_attributes = preg_split( '@\s+@im', $post_link_attributes, -1, PREG_SPLIT_NO_EMPTY );
+			foreach ( $post_link_attributes as $post_link_attribute ) {
+				if ( strpos( $post_link_attribute, '=', 1 ) !== false ) {
+					list( $_key, $_value ) = explode( '=', $post_link_attribute, 2 );
+					if ( strtolower( $_key ) === 'href' ) {
+						$_links[] = trim( $_value, "'\"" );
+					}
+				}
+			}
+		}
+
+		// Get pingbacks which have already been performed from this topic
+		$past_pingbacks = bb_get_topicmeta( $topic_id, 'pingback_performed' );
+		$new_pingbacks = array();
+
+		foreach ( $_links as $_link ) {
+			// If it's already been pingbacked, then skip it
+			if ( $past_pingbacks && in_array( $_link, $past_pingbacks ) ) {
+				continue;
+			}
+
+			// If it's trying to ping itself, then skip it
+			if ( $topic = bb_get_topic_from_uri( $_link ) ) {
+				if ( $topic->topic_id === $topic_id ) {
+					continue;
+				}
+			}
+
+			// Make sure it's a page on a site and not the root
+			if ( !$_url = parse_url( $_link ) ) {
+				continue;
+			}
+			if ( !isset( $_url['query'] ) ) {
+				if ( $_url['path'] == '' || $_url['path'] == '/' ) {
+					continue;
+				}
+			}
+
+			// Add the URL to the array of those to be pingbacked
+			$new_pingbacks[] = $_link;
+		}
+
+		include_once( BACKPRESS_PATH . '/class.ixr.php' );
+
+		$count = 0;
+		foreach ( $new_pingbacks as $pingback_to_url ) {
+			if ( !$pingback_endpoint_uri = BB_Pingbacks::get_endpoint_uri( $pingback_to_url ) ) {
+				continue;
+			}
+
+			// Stop this nonsense after 60 seconds
+			@set_time_limit( 60 );
+
+			// Get the URL to pingback from
+			$pingback_from_url = get_topic_link( $topic_id );
+
+			// Using a timeout of 3 seconds should be enough to cover slow servers
+			$client = new IXR_Client( $pingback_endpoint_uri );
+			$client->timeout = 3;
+			$client->useragent .= ' -- bbPress/' . bb_get_option( 'version' );
+
+			// When set to true, this outputs debug messages by itself
+			$client->debug = false;
+
+			// If successful or the ping already exists then add to the pingbacked list
+			if (
+				$client->query( 'pingback.ping', $pingback_from_url, $pingback_to_url ) ||
+				( isset( $client->error->code ) && 48 == $client->error->code )
+			) {
+				$count++;
+				$past_pingbacks[] = $pingback_to_url;
+			}
+		}
+
+		bb_update_topicmeta( $topic_id, 'pingback_performed', $past_pingbacks );
+
+		return $count;
+	}
+} // END class BB_Pingbacks
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-query.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-query.php
new file mode 100644
index 0000000000000000000000000000000000000000..50209fda845ec8d0824e128600f7f387c6123c96
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-query.php
@@ -0,0 +1,1029 @@
+<?php
+
+class BB_Query {
+	var $type;
+	var $query;
+	var $query_id;
+
+	var $query_vars = array();
+	var $not_set = array();
+	var $request;
+	var $match_query = false;
+
+	var $results;
+	var $errors;
+	var $count = 0;
+	var $found_rows = false;
+
+	// Can optionally pass unique id string to help out filters
+	function BB_Query( $type = 'topic', $query = '', $id = '' ) {
+		$this->init( $type, $query, $id );
+
+		if ( !empty($this->query) )
+			$this->query();
+	}
+
+	function init( $type = null, $query = null, $id = null ) {
+		if ( !is_null($type) || !isset($this->type) )
+			$this->type = is_null($type) ? 'topic' : $type;
+		if ( !is_null($query) || !isset($this->query) )
+			$this->query = $query;
+		if ( !is_null($id) || !isset($this->query_id) )
+			$this->query_id = $id;
+
+		$this->query_vars = array();
+		$this->not_set = array();
+		unset($this->request);
+		$this->match_query = false;
+
+		unset($this->results, $this->errors);
+		$this->count = 0;
+		$this->found_rows = false;
+	}
+
+	function &query() {
+		global $bbdb;
+
+		if ( $args = func_get_args() )
+			call_user_func_array( array(&$this, 'init'), $args );
+
+		if ( !$this->generate_query() )
+			return;
+
+		do_action_ref_array( 'bb_query', array(&$this) );
+
+		$key = md5( $this->request );
+		if ( false === $cached_ids = wp_cache_get( $key, 'bb_query' ) ) {
+			if ( 'post' == $this->type ) {
+				$this->results = bb_cache_posts( $this->request ); // This always appends meta
+				$_the_id = 'post_id';
+				$this->query_vars['append_meta'] = false;
+			} else {
+				$this->results = $bbdb->get_results( $this->request );
+				$_the_id = 'topic_id';
+			}
+			$cached_ids = array();
+			if ( is_array($this->results) )
+				foreach ( $this->results as $object )
+					$cached_ids[] = $object->$_the_id;
+			wp_cache_set( $key, $cached_ids, 'bb_query' );
+		} else {
+			if ( 'post' == $this->type ) {
+				$_query_ids = array();
+				$_cached_posts = array();
+				foreach ( $cached_ids as $_cached_id ) {
+					if ( false !== $_post = wp_cache_get( $_cached_id, 'bb_post' ) ) {
+						$_cached_posts[$_post->post_id] = $_post;
+					} else {
+						$_query_ids[] = $_cached_id;
+					}
+				}
+				if ( count( $_query_ids ) ) {
+					$_query_ids = join( ',', array_map( 'intval', $_query_ids ) );
+					$results = $bbdb->get_results( "SELECT * FROM $bbdb->posts WHERE post_id IN($_query_ids)" );
+					$results = array_merge( $results, $_cached_posts );
+				} else {
+					$results = $_cached_posts;
+				}
+				$_the_id = 'post_id';
+			} else {
+				$_query_ids = array();
+				$_cached_topics = array();
+				foreach ( $cached_ids as $_cached_id ) {
+					if ( false !== $_topic = wp_cache_get( $_cached_id, 'bb_topic' ) ) {
+						$_cached_topics[$_topic->topic_id] = $_topic;
+					} else {
+						$_query_ids[] = $_cached_id;
+					}
+				}
+				if ( count( $_query_ids ) ) {
+					$_query_ids = join( ',', array_map( 'intval', $_query_ids ) );
+					$results = $bbdb->get_results( "SELECT * FROM $bbdb->topics WHERE topic_id IN($_query_ids)" );
+					$results = array_merge( $results, $_cached_topics );
+				} else {
+					$results = $_cached_topics;
+				}
+				$_the_id = 'topic_id';
+			}
+
+			$this->results = array();
+			$trans = array();
+
+			foreach ( $results as $object )
+				$trans[$object->$_the_id] = $object;
+			foreach ( $cached_ids as $cached_id )
+				$this->results[] = $trans[$cached_id];
+		}
+
+		$this->count = count( $this->results );
+
+		if ( false === $this->found_rows && $this->query_vars['count'] ) // handles FOUND_ROWS() or COUNT(*)
+			$this->found_rows = bb_count_last_query( $this->request );
+		if ( 'post' == $this->type ) {
+			if ( $this->query_vars['append_meta'] )
+				$this->results = bb_append_meta( $this->results, 'post' );
+			if ( $this->query_vars['cache_users'] )
+				bb_post_author_cache( $this->results );
+			if ( $this->query_vars['cache_topics'] )
+				bb_cache_post_topics( $this->results );
+		} else {
+			if ( $this->query_vars['append_meta'] )
+				$this->results = bb_append_meta( $this->results, 'topic' );
+		}
+
+		return $this->results;
+	}
+
+	function generate_query() {
+		if ( $args = func_get_args() )
+			call_user_func_array( array(&$this, 'init'), $args );
+
+		$this->parse_query();
+
+		// Allow filter to abort query
+		if ( false === $this->query_vars )
+			return false;
+
+		if ( 'post' == $this->type )
+			$this->generate_post_sql();
+		else
+			$this->generate_topic_sql();
+
+		return $this->request;
+	}
+
+	// $defaults = vars to use if not set in GET, POST or allowed
+	// $allowed = array( key_name => value, key_name, key_name, key_name => value );
+	// 	key_name => value pairs override anything from defaults, GET, POST
+	//	Lone key_names are a whitelist.  Only those can be set by defaults, GET, POST
+	//	If there are no lone key_names, allow everything but still override with key_name => value pairs
+	//	Ex: $allowed = array( 'topic_status' => 0, 'post_status' => 0, 'topic_author', 'started' );
+	//		Will only take topic_author and started values from defaults, GET, POST and will query with topic_status = 0 and post_status = 0
+	function &query_from_env( $type = 'topic', $defaults = null, $allowed = null, $id = '' ) {
+		$this->init_from_env( $type, $defaults, $allowed, $id );
+		return $this->query();
+	}
+
+	function init_from_env( $type = 'topic', $defaults = null, $allowed = null, $id = '' ) {
+		$vars = $this->fill_query_vars( array() );
+
+		$defaults  = wp_parse_args($defaults);
+		$get_vars  = stripslashes_deep( $_GET );
+		$post_vars = stripslashes_deep( $_POST );
+		$allowed   = wp_parse_args($allowed);
+
+		$_allowed = array();
+		foreach ( array_keys($allowed) as $k ) {
+			if ( is_numeric($k) ) {
+				$_allowed[] = $allowed[$k];
+				unset($allowed[$k]);
+			} elseif ( !isset($$k) ) {
+				$$k = $allowed[$k];
+			}
+		}
+
+		extract($post_vars, EXTR_SKIP);
+		extract($get_vars, EXTR_SKIP);
+		extract($defaults, EXTR_SKIP);
+
+		$vars = $_allowed ? compact($_allowed, array_keys($allowed)) : compact(array_keys($vars));
+
+		$this->init( $type, $vars, $id );
+	}
+
+	function fill_query_vars( $array ) {
+		// Should use 0, '' for empty values
+		// Function should return false iff not set
+
+		// parameters commented out are handled farther down
+
+		$ints = array(
+//			'page',		// Defaults to global or number in URI
+//			'per_page',	// Defaults to page_topics
+			'tag_id',	// one tag ID
+			'favorites'	// one user ID
+		);
+
+		$parse_ints = array(
+			// Both
+			'post_id',
+			'topic_id',
+			'forum_id',
+
+			// Topics
+			'topic_author_id',
+			'post_count',
+			'tag_count',
+
+			// Posts
+			'post_author_id',
+			'position'
+		);
+
+		$dates = array(
+			'started',	// topic
+			'updated',	// topic
+			'posted'	// post
+		);
+
+		$others = array(
+			// Both
+			'topic',	// one topic name
+			'forum',	// one forum name
+			'tag',		// one tag name
+
+			// Topics
+			'topic_author',	// one username
+			'topic_status',	// *normal, deleted, all, parse_int ( and - )
+			'open',			// *all, yes = open, no = closed, parse_int ( and - )
+			'sticky',		// *all, no = normal, forum, super = front, parse_int ( and - )
+			'meta_key',		// one meta_key ( and - )
+			'meta_value',	// range
+			'topic_title',	// LIKE search.  Understands "doublequoted strings"
+			'search',		// generic search: topic_title OR post_text
+							// Can ONLY be used in a topic query
+							// Returns additional search_score and (concatenated) post_text columns
+
+			// Posts
+			'post_author',	// one username
+			'post_status',	// *noraml, deleted, all, parse_int ( and - )
+			'post_text',	// FULLTEXT search
+							// Returns additional search_score column (and (concatenated) post_text column if topic query)
+			'poster_ip',	// one IPv4 address
+
+			// SQL
+			'index_hint',	// A full index hint using valid index hint syntax, can be multiple hints an array
+			'order_by',		// fieldname
+			'order',		// *DESC, ASC
+			'count',		// *false = none, true = COUNT(*), found_rows = FOUND_ROWS()
+			'_join_type',	// not implemented: For benchmarking only.  Will disappear. join (1 query), in (2 queries)
+
+			// Utility
+//			'append_meta',	// *true, false: topics only
+//			'cache_users',	// *true, false
+//			'cache_topics,	// *true, false: posts only
+			'cache_posts'	// not implemented: none, first, last
+		);
+
+		foreach ( $ints as $key )
+			if ( ( false === $array[$key] = isset($array[$key]) ? (int) $array[$key] : false ) && isset($this) )
+				$this->not_set[] = $key;
+
+		foreach ( $parse_ints as $key )
+			if ( ( false === $array[$key] = isset($array[$key]) ? preg_replace( '/[^<=>0-9,-]/', '', $array[$key] ) : false ) && isset($this) )
+				$this->not_set[] = $key;
+
+		foreach ( $dates as $key )
+			if ( ( false === $array[$key] = isset($array[$key]) ? preg_replace( '/[^<>0-9-]/', '', $array[$key] ) : false ) && isset($this) )
+				$this->not_set[] = $key;
+
+		foreach ( $others as $key ) {
+			if ( !isset($array[$key]) )
+				$array[$key] = false;
+			if ( isset($this) && false === $array[$key] )
+				$this->not_set[] = $key;
+		}
+
+		// Both
+		if ( isset($array['page']) )
+			$array['page'] = (int) $array['page'];
+		elseif ( isset($GLOBALS['page']) )
+			$array['page'] = (int) $GLOBALS['page'];
+		else
+			$array['page'] = bb_get_uri_page();
+
+		if ( $array['page'] < 1 )
+			$array['page'] = 1;
+
+		$array['per_page'] = isset($array['per_page']) ? (int) $array['per_page'] : 0;
+		if ( $array['per_page'] < -1 )
+			$array['per_page'] = 1;
+
+		// Posts
+		if ( ( !$array['poster_ip'] = isset($array['poster_ip']) ? preg_replace("@[^0-9a-f:.]@i", '', $array['poster_ip']) : false ) && isset($this) ) {
+			$this->not_set[] = 'poster_ip';
+			$array['poster_ip'] = false;
+		}
+
+		// Utility
+		$array['append_meta']  = isset($array['append_meta'])  ? (int) (bool) $array['append_meta']  : 1;
+		$array['cache_users']  = isset($array['cache_users'])  ? (int) (bool) $array['cache_users']  : 1;
+		$array['cache_topics'] = isset($array['cache_topics']) ? (int) (bool) $array['cache_topics'] : 1;
+
+		// Only one FULLTEXT search per query please
+		if ( $array['search'] )
+			$array['post_text'] = false;
+
+		return $array;
+	}
+
+	// Parse a query string and set query flag booleans.
+	function parse_query() {
+		if ( $args = func_get_args() )
+			call_user_func_array( array(&$this, 'init'), $args );
+
+		if ( is_array($this->query) )
+			$this->query_vars = $this->query;
+		else
+			wp_parse_str($this->query, $this->query_vars);
+
+		do_action_ref_array('bb_parse_query', array(&$this));
+
+		if ( false === $this->query_vars )
+			return;
+
+		$this->query_vars = $this->fill_query_vars($this->query_vars);
+	}
+
+	function get($query_var) {
+		return isset($this->query_vars[$query_var]) ? $this->query_vars[$query_var] : null;
+	}
+
+	function set($query_var, $value) {
+		$this->query_vars[$query_var] = $value;
+	}
+
+	function generate_topic_sql( $_part_of_post_query = false ) {
+		global $bbdb;
+
+		$q =& $this->query_vars;
+		$distinct = '';
+		$sql_calc_found_rows = 'found_rows' === $q['count'] ? 'SQL_CALC_FOUND_ROWS' : ''; // unfiltered
+		$fields = 't.*';
+		$index_hint = '';
+		$join = '';
+		$where = '';
+		$group_by = '';
+		$having = '';
+		$order_by = '';
+
+		$post_where = '';
+		$post_queries = array('post_author_id', 'post_author', 'posted', 'post_status', 'position', 'post_text', 'poster_ip');
+
+		if ( !$_part_of_post_query && ( $q['search'] || array_diff($post_queries, $this->not_set) ) ) :
+			$join .= " JOIN $bbdb->posts as p ON ( t.topic_id = p.topic_id )";
+			$post_where = $this->generate_post_sql( true );
+			if ( $q['search'] ) {
+				$post_where .= ' AND ( ';
+				$post_where .= $this->generate_topic_title_sql( $q['search'] );
+				$post_where .= ' OR ';
+				$post_where .= $this->generate_post_text_sql( $q['search'] );
+				$post_where .= ' )';
+			}
+
+			$group_by = 't.topic_id';
+
+			$fields .= ", MIN(p.post_id) as post_id";
+
+			if ( $bbdb->has_cap( 'GROUP_CONCAT', $bbdb->posts ) )
+				$fields .= ", GROUP_CONCAT(p.post_text SEPARATOR ' ') AS post_text";
+			else
+				$fields .= ", p.post_text";
+
+			if ( $this->match_query ) {
+				$fields .= ", AVG($this->match_query) AS search_score";
+				if ( !$q['order_by'] )
+					$q['order_by'] = 'search_score';
+			} elseif ( $q['search'] || $q['post_text'] ) {
+				$fields .= ", 0 AS search_score";
+			}
+		endif;
+
+		if ( !$_part_of_post_query ) :
+			if ( $q['post_id'] ) :
+				$post_topics = $post_topics_no = array();
+				$op = substr($q['post_id'], 0, 1);
+				if ( in_array($op, array('>','<')) ) :
+					$post_topics = $bbdb->get_col( "SELECT DISTINCT topic_id FROM $bbdb->posts WHERE post_id $op '" . (int) substr($q['post_id'], 1) . "'" );
+				else :
+					$posts = explode(',', $q['post_id']);
+					$get_posts = array();
+					foreach ( $posts as $post_id ) {
+						$post_id = (int) $post_id;
+						$_post_id = abs($post_id);
+						$get_posts[] = $_post_id;
+					}
+					bb_cache_posts( $get_posts );
+
+					foreach ( $posts as $post_id ) :
+						$post = bb_get_post( abs($post_id) );
+						if ( $post_id < 0 )
+							$post_topics_no[] = $post->topic_id;
+						else
+							$post_topics[] = $post->topic_id;
+					endforeach;
+				endif;
+				if ( $post_topics )
+					$where .= " AND t.topic_id IN (" . join(',', $post_topics) . ")";
+				if ( $post_topics_no )
+					$where .= " AND t.topic_id NOT IN (" . join(',', $post_topics_no) . ")";
+			endif;
+
+			if ( $q['topic_id'] ) :
+				$where .= $this->parse_value( 't.topic_id', $q['topic_id'] );
+			elseif ( $q['topic'] ) :
+				$q['topic'] = bb_slug_sanitize( $q['topic'] );
+				$where .= " AND t.topic_slug = '$q[topic]'";
+			endif;
+
+			if ( $q['forum_id'] ) :
+				$where .= $this->parse_value( 't.forum_id', $q['forum_id'] );
+			elseif ( $q['forum'] ) :
+				if ( !$q['forum_id'] = bb_get_id_from_slug( 'forum', $q['forum'] ) )
+					$this->error( 'query_var:forum', 'No forum by that name' );
+				$where .= " AND t.forum_id = $q[forum_id]";
+			endif;
+
+			/* Convert to JOIN after new taxonomy tables are in */
+
+			if ( $q['tag'] && !is_int($q['tag_id']) )
+				$q['tag_id'] = (int) bb_get_tag_id( $q['tag'] );
+
+			if ( is_numeric($q['tag_id']) ) :
+				if ( $tagged_topic_ids = bb_get_tagged_topic_ids( $q['tag_id'] ) )
+					$where .= " AND t.topic_id IN (" . join(',', $tagged_topic_ids) . ")";
+				else
+					$where .= " AND 0 /* No such tag */";
+			endif;
+
+			if ( is_numeric($q['favorites']) && $f_user = bb_get_user( $q['favorites'] ) )
+				$where .= $this->parse_value( 't.topic_id', $f_user->favorites );
+		endif; // !_part_of_post_query
+
+		if ( $q['topic_title'] )
+			$where .= ' AND ' . $this->generate_topic_title_sql( $q['topic_title'] );
+
+		if ( $q['started'] )
+			$where .= $this->date( 't.topic_start_time', $q['started'] );
+
+		if ( $q['updated'] )
+			$where .= $this->date( 't.topic_time', $q['updated'] );
+
+		if ( $q['topic_author_id'] ) :
+			$where .= $this->parse_value( 't.topic_poster', $q['topic_author_id'] );
+		elseif ( $q['topic_author'] ) :
+			$user = bb_get_user( $q['topic_author'], array( 'by' => 'login' ) );
+			if ( !$q['topic_author_id'] = (int) $user->ID )
+				$this->error( 'query_var:user', 'No user by that name' );
+			$where .= " AND t.topic_poster = $q[topic_author_id]";
+		endif;
+
+		if ( !$q['topic_status'] ) :
+			$where .= " AND t.topic_status = '0'";
+		elseif ( false === strpos($q['topic_status'], 'all') ) :
+			$stati = array( 'normal' => 0, 'deleted' => 1 );
+			$q['topic_status'] = str_replace(array_keys($stati), array_values($stati), $q['topic_status']);
+			$where .= $this->parse_value( 't.topic_status', $q['topic_status'] );
+		endif;
+
+		if ( false !== $q['open'] && false === strpos($q['open'], 'all') ) :
+			$stati = array( 'no' => 0, 'closed' => 0, 'yes' => 1, 'open' => 1 );
+			$q['open'] = str_replace(array_keys($stati), array_values($stati), $q['open']);
+			$where .= $this->parse_value( 't.topic_open', $q['open'] );
+		endif;
+
+		if ( false !== $q['sticky'] && false === strpos($q['sticky'], 'all') ) :
+			$stickies = array( 'no' => 0, 'normal' => 0, 'forum' => 1, 'super' => 2, 'front' => 2, 'sticky' => '-0' );
+			$q['sticky'] = str_replace(array_keys($stickies), array_values($stickies), $q['sticky']);
+			$where .= $this->parse_value( 't.topic_sticky', $q['sticky'] );
+		endif;
+
+		if ( false !== $q['post_count'] )
+			$where .= $this->parse_value( 't.topic_posts', $q['post_count'] );
+
+		if ( false !== $q['tag_count'] )
+			$where .= $this->parse_value( 't.tag_count', $q['tag_count'] );
+
+		if ( $q['meta_key'] && $q['meta_key'] = preg_replace('|[^a-z0-9_-]|i', '', $q['meta_key']) ) :
+			if ( '-' == substr($q['meta_key'], 0, 1) ) :
+				$join  .= " LEFT JOIN $bbdb->meta AS tm ON ( tm.object_type = 'bb_topic' AND t.topic_id = tm.object_id AND tm.meta_key = '" . substr( $q['meta_key'], 1 ) . "' )";
+				$where .= " AND tm.meta_key IS NULL";
+			else :
+				$join  .= " JOIN $bbdb->meta AS tm ON ( tm.object_type = 'bb_topic' AND t.topic_id = tm.object_id AND tm.meta_key = '$q[meta_key]' )";
+
+				if ( $q['meta_value'] ) :
+					$q['meta_value'] = maybe_serialize( $q['meta_value'] );
+					if ( strpos( $q['meta_value'], 'NULL' ) !== false )
+						$join = ' LEFT' . $join;
+					$where .= $this->parse_value( 'tm.meta_value', $q['meta_value'] );
+				endif;
+			endif;
+		endif;
+
+		// Just getting topic part for inclusion in post query
+		if ( $_part_of_post_query )
+			return $where;
+
+		$where .= $post_where;
+
+		if ( $where ) // Get rid of initial " AND " (this is pre-filters)
+			$where = substr($where, 5);
+
+		if ( $q['index_hint'] )
+			$index_hint = $q['index_hint'];
+
+		if ( $q['order_by'] )
+			$order_by = $q['order_by'];
+		else
+			$order_by = 't.topic_time';
+
+		$bits = compact( array('distinct', 'sql_calc_found_rows', 'fields', 'index_hint', 'join', 'where', 'group_by', 'having', 'order_by') );
+		$this->request = $this->_filter_sql( $bits, "$bbdb->topics AS t" );
+		return $this->request;
+	}
+
+	function generate_post_sql( $_part_of_topic_query = false ) {
+		global $bbdb;
+
+		$q =& $this->query_vars;
+		$distinct = '';
+		$sql_calc_found_rows = 'found_rows' === $q['count'] ? 'SQL_CALC_FOUND_ROWS' : ''; // unfiltered
+		$fields = 'p.*';
+		$index_hint = '';
+		$join = '';
+		$where = '';
+		$group_by = '';
+		$having = '';
+		$order_by = '';
+
+		$topic_where = '';
+		$topic_queries = array( 'topic_author_id', 'topic_author', 'topic_status', 'post_count', 'tag_count', 'started', 'updated', 'open', 'sticky', 'meta_key', 'meta_value', 'topic_title' );
+		if ( !$_part_of_topic_query && array_diff($topic_queries, $this->not_set) ) :
+			$join .= " JOIN $bbdb->topics as t ON ( t.topic_id = p.topic_id )";
+			$topic_where = $this->generate_topic_sql( true );
+		endif;
+		
+		if ( !$_part_of_topic_query ) :
+			if ( $q['post_id'] )
+				$where .= $this->parse_value( 'p.post_id', $q['post_id'] );
+
+			if ( $q['topic_id'] ) :
+				$where .= $this->parse_value( 'p.topic_id', $q['topic_id'] );
+			elseif ( $q['topic'] ) :
+				if ( !$q['topic_id'] = bb_get_id_from_slug( 'topic', $q['topic'] ) )
+					$this->error( 'query_var:topic', 'No topic by that name' );
+				$where .= " AND p.topic_id = " . $q['topic_id'];
+			endif;
+
+			if ( $q['forum_id'] ) :
+				$where .= $this->parse_value( 'p.forum_id', $q['forum_id'] );
+			elseif ( $q['forum'] ) :
+				if ( !$q['forum_id'] = bb_get_id_from_slug( 'forum', $q['forum'] ) )
+					$this->error( 'query_var:forum', 'No forum by that name' );
+				$where .= " AND p.forum_id = " . $q['forum_id'];
+			endif;
+
+			if ( $q['tag'] && !is_int($q['tag_id']) )
+				$q['tag_id'] = (int) bb_get_tag_id( $q['tag'] );
+
+			if ( is_numeric($q['tag_id']) ) :
+				if ( $tagged_topic_ids = bb_get_tagged_topic_ids( $q['tag_id'] ) )
+					$where .= " AND p.topic_id IN (" . join(',', $tagged_topic_ids) . ")";
+				else
+					$where .= " AND 0 /* No such tag */";
+			endif;
+
+			if ( is_numeric($q['favorites']) && $f_user = bb_get_user( $q['favorites'] ) )
+				$where .= $this->parse_value( 'p.topic_id', $f_user->favorites );
+		endif; // !_part_of_topic_query
+
+		if ( $q['post_text'] ) :
+			$where  .= ' AND ' . $this->generate_post_text_sql( $q['post_text'] );
+			if ( $this->match_query ) {
+				$fields .= ", $this->match_query AS search_score";
+				if ( !$q['order_by'] )
+					$q['order_by'] = 'search_score';
+			} else {
+				$fields .= ', 0 AS search_score';
+			}
+		endif;
+
+		if ( $q['posted'] )
+			$where .= $this->date( 'p.post_time', $q['posted'] );
+
+		if ( $q['post_author_id'] ) :
+			$where .= $this->parse_value( 'p.poster_id', $q['post_author_id'] );
+		elseif ( $q['post_author'] ) :
+			$user = bb_get_user( $q['post_author'], array( 'by' => 'login' ) );
+			if ( !$q['post_author_id'] = (int) $user->ID )
+				$this->error( 'query_var:user', 'No user by that name' );
+			$where .= " AND p.poster_id = $q[post_author_id]";
+		endif;
+
+		if ( !$q['post_status'] ) :
+			$where .= " AND p.post_status = '0'";
+		elseif ( false === strpos($q['post_status'], 'all') ) :
+			$stati = array( 'normal' => 0, 'deleted' => 1 );
+			$q['post_status'] = str_replace(array_keys($stati), array_values($stati), $q['post_status']);
+			$where .= $this->parse_value( 'p.post_status', $q['post_status'] );
+		endif;
+
+		if ( false !== $q['position'] )
+			$where .= $this->parse_value( 'p.post_position', $q['position'] );
+
+		if ( false !== $q['poster_ip'] )
+			$where .= " AND poster_ip = '" . $q['poster_ip'] . "'";
+
+		// Just getting post part for inclusion in topic query
+		if ( $_part_of_topic_query )
+			return $where;
+
+		$where .= $topic_where;
+
+		if ( $where ) // Get rid of initial " AND " (this is pre-filters)
+			$where = substr($where, 5);
+
+		if ( $q['index_hint'] )
+			$index_hint = $q['index_hint'];
+
+		if ( $q['order_by'] )
+			$order_by = $q['order_by'];
+		else
+			$order_by = 'p.post_time';
+
+		$bits = compact( array('distinct', 'sql_calc_found_rows', 'fields', 'index_hint', 'join', 'where', 'group_by', 'having', 'order_by') );
+		$this->request = $this->_filter_sql( $bits, "$bbdb->posts AS p" );
+
+		return $this->request;
+	}
+
+	function generate_topic_title_sql( $string ) {
+		global $bbdb;
+		$string = trim($string);
+
+		if ( !preg_match_all('/".*?("|$)|((?<=[\s",+])|^)[^\s",+]+/', $string, $matches) ) {
+			$string = $bbdb->escape($string);
+			return "(t.topic_title LIKE '%$string%')";
+		}
+
+		$where = '';
+
+		foreach ( $matches[0] as $match ) {
+			$term = trim($match, "\"\n\r ");
+			$term = $bbdb->escape($term);
+			$where .= " AND t.topic_title LIKE '%$term%'";
+		}
+
+		if ( count($matches[0]) > 1 && $string != $matches[0][0] ) {
+			$string = $bbdb->escape($string);
+			$where .= " OR t.topic_title LIKE '%$string%'";
+		}
+
+		return '(' . substr($where, 5) . ')';
+	}
+
+	function generate_post_text_sql( $string ) {
+		global $bbdb;
+		$string = trim($string);
+		$_string = $bbdb->escape( $string );
+		if ( strlen($string) < 5 )
+			return "p.post_text LIKE '%$_string%'";
+
+		return $this->match_query = "MATCH(p.post_text) AGAINST('$_string')";
+	}
+
+	function _filter_sql( $bits, $from ) {
+		global $bbdb;
+
+		$q =& $this->query_vars;
+
+		// MySQL 5.1 allows multiple index hints per query - earlier versions only get the first hint
+		if ( $bits['index_hint'] ) {
+			if ( !is_array( $bits['index_hint'] ) ) {
+				$bits['index_hint'] = array( (string) $bits['index_hint'] );
+			}
+			if ( $bbdb->has_cap( 'index_hint_for_any' ) ) {
+				// 5.1 <= MySQL
+				$_regex = '/\s*(USE|IGNORE|FORCE)\s+(INDEX|KEY)\s+(FOR\s+(JOIN|ORDER\s+BY|GROUP\s+BY)\s+)?\(\s*`?[a-z0-9_]+`?(\s*,\s*`?[a-z0-9_]+`?)*\s*\)\s*/i';
+			} elseif ( $bbdb->has_cap( 'index_hint_for_join' ) ) {
+				// 5.0 <= MySQL < 5.1
+				$_regex = '/\s*(USE|IGNORE|FORCE)\s+(INDEX|KEY)\s+(FOR\s+JOIN\s+)?\(\s*`?[a-z0-9_]+`?(\s*,\s*`?[a-z0-9_]+`?)*\s*\)\s*/i';
+			} else {
+				// MySQL < 5.0
+				$_regex = '/\s*(USE|IGNORE|FORCE)\s+(INDEX|KEY)\s+\(\s*`?[a-z0-9_]+`?(\s*,\s*`?[a-z0-9_]+`?)*\s*\)\s*/i';
+			}
+			$_index_hint = array();
+			foreach ( $bits['index_hint'] as $_hint ) {
+				if ( preg_match( $_regex, $_hint ) ) {
+					$_index_hint[] = trim( $_hint );
+				}
+			}
+			unset( $_regex, $_hint );
+			if ( $bbdb->has_cap( 'index_hint_lists' ) ) {
+				// 5.1 <= MySQL
+				$bits['index_hint'] = join( ' ', $_index_hint );
+			} else {
+				// MySQL < 5.1
+				$bits['index_hint'] = isset( $_index_hint[0] ) ? $_index_hint[0] : '';
+			}
+			unset( $_index_hint );
+		}
+
+		$q['order'] = strtoupper($q['order']);
+		if ( $q['order'] && in_array($q['order'], array('ASC', 'DESC')) )
+			$bits['order_by'] .= " $q[order]";
+		else
+			$bits['order_by'] .= " DESC";
+
+		if ( !$q['per_page'] )
+			$q['per_page'] = (int) bb_get_option( 'page_topics' );
+
+		$bits['limit'] = '';
+		if ( $q['per_page'] > 0 ) :
+			if ( $q['page'] > 1 )
+				$bits['limit'] .= $q['per_page'] * ( $q['page'] - 1 ) . ", ";
+			$bits['limit'] .= $q['per_page'];
+		endif;
+
+		$name = "get_{$this->type}s_";
+
+		// Unfiltered
+		$sql_calc_found_rows = $bits['sql_calc_found_rows'];
+		unset($bits['sql_calc_found_rows']);
+
+		foreach ( $bits as $bit => $value ) {
+			if ( $this->query_id )
+				$value = apply_filters( "{$this->query_id}_$bit", $value );
+			$$bit = apply_filters( "$name$bit", $value );
+		}
+
+		if ( $where )
+			$where = "WHERE $where";
+		if ( $group_by )
+			$group_by = "GROUP BY $group_by";
+		if ( $having )
+			$having = "HAVING $having";
+		if ( $order_by )
+			$order_by = "ORDER BY $order_by";
+		if ( $limit )
+			$limit = "LIMIT $limit";
+
+		return "SELECT $distinct $sql_calc_found_rows $fields FROM $from $index_hint $join $where $group_by $having $order_by $limit";
+	}
+
+	function parse_value( $field, $value = '' ) {
+		if ( !$value && !is_numeric($value) )
+			return '';
+
+		global $bbdb;
+
+		$op = substr($value, 0, 1);
+
+		// #, =whatever, <#, >#.  Cannot do < and > at same time
+		if ( in_array($op, array('<', '=', '>')) ) :
+			$value = substr($value, 1);
+			$value = is_numeric($value) ? (float) $value : $bbdb->escape( $value );
+			return " AND $field $op '$value'";
+		elseif ( false === strpos($value, ',') && 'NULL' !== $value && '-NULL' !== $value ) :
+			$value = is_numeric($value) ? (float) $value : $bbdb->escape( $value );
+			return '-' == $op ? " AND $field != '" . substr($value, 1) . "'" : " AND $field = '$value'";
+		endif;
+
+		$y = $n = array();
+		foreach ( explode(',', $value) as $v ) {
+			$v = is_numeric($v) ? (int) $v : $bbdb->escape( $v );
+			if ( '-' == substr($v, 0, 1) )
+				if ( $v === '-NULL' )
+					$not_null_flag = true;
+				else
+					$n[] = substr($v, 1);
+			else
+				if ( $v === 'NULL' )
+					$null_flag = true;
+				else
+					$y[] = $v;
+		}
+
+		$r = '';
+		if ( $y ) {
+			$r .= " AND ";
+			if ( $null_flag )
+				$r .= "(";
+			$r .= "$field IN ('" . join("','", $y) . "')";
+			if ( $null_flag )
+				$r .= " OR $field IS NULL)";
+		} elseif ( $null_flag ) {
+			$r .= " AND $field IS NULL";
+		}
+		
+		if ( $n ) {
+			$r .= " AND ";
+			if ( $not_null_flag )
+				$r .= "(";
+			$r .= "$field NOT IN ('" . join("','", $n) . "')";
+			if ( $not_null_flag )
+				$r .= " AND $field IS NOT NULL)";
+		} elseif ( $not_null_flag ) {
+			$r .= " AND $field IS NOT NULL";
+		}
+
+		return $r;
+	}
+
+	function date( $field, $date ) {
+		if ( !$date && !is_int($date) )
+			return '';
+
+		if ( $is_range = false !== strpos( $date, '--' ) )
+			$dates = explode( '--', $date, 2 );
+		else
+			$dates = array( $date );
+
+		$op = false;
+		$r = '';
+		foreach ( $dates as $date ) {
+			if ( $is_range ) {
+				$op = $op ? '<' : '>';
+				$date = (int) substr($date, 0, 14);
+			} else {
+				$op = substr($date, 0, 1);
+				if ( !in_array($op, array('>', '<')) )
+					break;
+				$date = (int) substr($date, 1, 14);
+			}
+			if ( strlen($date) < 14 )
+				$date .= str_repeat('0', 14 - strlen($date));
+			$r .= " AND $field $op $date";
+		}
+		if ( $r )
+			return $r;
+
+		$date = (int) $date;
+		$r = " AND YEAR($field) = " . substr($date, 0, 4);
+		if ( strlen($date) > 5 )
+			$r .= " AND MONTH($field) = " . substr($date, 4, 2);
+		if ( strlen($date) > 7 )
+			$r .= " AND DAYOFMONTH($field) = " . substr($date, 6, 2);
+		if ( strlen($date) > 9 )
+			$r .= " AND HOUR($field) = " . substr($date, 8, 2);
+		if ( strlen($date) > 11 )
+			$r .= " AND MINUTE($field) = " . substr($date, 10, 2);
+		if ( strlen($date) > 13 )
+			$r .= " AND SECOND($field) = " . substr($date, 12, 2);
+		return $r;
+	}
+
+	function error( $code, $message ) {
+		if ( is_wp_error($this->errors) )
+			$this->errors->add( $code, $message );
+		else
+			$this->errors = new WP_Error( $code, $message );
+	}
+}
+
+class BB_Query_Form extends BB_Query {
+	var $defaults;
+	var $allowed;
+
+	// Can optionally pass unique id string to help out filters
+	function BB_Query_Form( $type = 'topic', $defaults = '', $allowed = '', $id = '' ) {
+		$this->defaults = wp_parse_args( $defaults );
+		$this->allowed  = wp_parse_args( $allowed );
+		if ( !empty($defaults) || !empty($allowed) )
+			$this->query_from_env($type, $defaults, $allowed, $id);
+	}
+
+	function form( $args = null ) {
+		$_post = 'post' == $this->type;
+
+		$defaults = array(
+			'search' => true,
+			'forum'  => true,
+			'tag'    => false,
+			'open'   => false,
+			'topic_author' => false,
+			'post_author'  => false,
+			'topic_status' => false,
+			'post_status'  => false,
+			'topic_title'  => false,
+			'poster_ip'  => false,
+
+			'method' => 'get',
+			'submit' => __('Search &#187;'),
+			'action' => ''
+		);
+		$defaults['id'] = $_post ? 'post-search-form' : 'topic-search-form';
+
+		$args = wp_parse_args( $args, $defaults );
+		extract( $args, EXTR_SKIP );
+
+		$id = esc_attr( $id );
+		$method = 'get' == strtolower($method) ? 'get' : 'post';
+		$submit = esc_attr( $submit );
+		if ( !$action = esc_url( $action ) )
+			$action = '';
+
+		if ( $this->query_vars )
+			$query_vars =& $this->query_vars;
+		else
+			$query_vars = $this->fill_query_vars( $this->defaults );
+
+		extract($query_vars, EXTR_PREFIX_ALL, 'q');
+
+		$r  = "<form action='$action' method='$method' id='$id' class='search-form'>\n";
+
+		$r .= "\t<fieldset>\n";
+
+		if ( $search ) {
+			if ( $_post ) {
+				$s_value = esc_attr( $q_post_text );
+				$s_name = 'post_text';
+				$s_id = 'post-text';
+			} else {
+				$s_value = esc_attr( $q_search );
+				$s_name = $s_id = 'search';
+			}
+			$r .= "\t<div><label for=\"$s_id\">" . __('Search term') . "</label>\n";
+			$r .= "\t\t<div><input name='$s_name' id='$s_id' type='text' class='text-input' value='$s_value' /></div>\n";
+			$r .= "\t</div>\n\n";
+		}
+
+		if ( $forum ) {
+			$r .= "\t<div><label for=\"forum-id\">" . __('Forum')  . "</label>\n";
+			$r .= "\t\t<div>" . bb_get_forum_dropdown( array( 'selected' => $q_forum_id, 'none' => __('Any'), 'id' => 'forum-id' ) ) . "</div>\n";
+			$r .= "\t</div>\n\n";
+		}
+
+		if ( $tag ) {
+			$q_tag = esc_attr( $q_tag );
+			$r .= "\t<div><label for=\"topic-tag\">" .  __('Tag') . "</label>\n";
+			$r .= "\t\t<div><input name='tag' id='topic-tag' type='text' class='text-input' value='$q_tag' /></div>\n";
+			$r .= "\t</div>\n\n";
+		}
+
+		if ( $topic_author ) {
+			$q_topic_author = esc_attr( $q_topic_author );
+			$r .= "\t<div><label for=\"topic-author\">" . __('Topic author') . "</label>\n";
+			$r .= "\t\t<div><input name='topic_author' id='topic-author' type='text' class='text-input' value='$q_topic_author' /></div>\n";
+			$r .= "\t</div>\n\n";
+		}
+
+		if ( $post_author ) {
+			$q_post_author = esc_attr( $q_post_author );
+			$r .= "\t<div><label for=\"post-author\">" . __('Post author') . "</label>\n";
+			$r .= "\t\t<div><input name='post_author' id='post-author' type='text' class='text-input' value='$q_post_author' /></div>\n";
+			$r .= "\t</div>\n\n";
+		}
+
+		$stati = apply_filters( 'bb_query_form_post_status', array( 'all' => __('All'), '0' => __('Normal'), '1' => __('Deleted') ), $this->type );
+
+		if ( $topic_status ) {
+			$r .= "\t<div><label for=\"topic-status\">" . __('Topic status') . "</label>\n";
+			$r .= "\t\t<div><select name='topic_status' id='topic-status'>\n";
+			foreach ( $stati as $status => $label ) {
+				$selected = (string) $status == (string) $q_topic_status ? " selected='selected'" : '';
+				$r .= "\t\t\t<option value='$status'$selected>$label</option>\n";
+			}
+			$r .= "\t\t</select></div>\n";
+			$r .= "\t</div>\n\n";
+		}
+
+		if ( $post_status ) {
+			$r .= "\t<div><label for=\"post-status\">" . __('Post status') . "</label>\n";
+			$r .= "\t\t<div><select name='post_status' id='post-status'>\n";
+			foreach ( $stati as $status => $label ) {
+				$selected = (string) $status == (string) $q_post_status ? " selected='selected'" : '';
+				$r .= "\t\t\t<option value='$status'$selected>$label</option>\n";
+			}
+			$r .= "\t\t</select></div>\n";
+			$r .= "\t</div>\n\n";
+		}
+
+		if ( $poster_ip ) {
+			$r .= "\t<div><label for=\"poster-ip\">" . __('Poster IP address') . "</label>\n";
+			$r .= "\t\t<div><input name='poster_ip' id='poster-ip' type='text' class='text-input' value='$q_poster_ip' /></div>\n";
+			$r .= "\t</div>\n\n";
+		}
+
+		if ( $open ) {
+			$r .= "\t<div><label for=\"topic-open\">" . __('Open?') . "</label>\n";
+			$r .= "\t\t<div><select name='open' id='topic-open'>\n";
+			foreach ( array( 'all' => __('All'), '1' => _x( 'Open', 'posting status' ), '0' => __('Closed') ) as $status => $label ) {
+				$label = esc_html( $label );
+				$selected = (string) $status == (string) $q_open ? " selected='selected'" : '';
+				$r .= "\t\t\t<option value='$status'$selected>$label</option>\n";
+			}
+			$r .= "\t\t</select></div>\n";
+			$r .= "\t</div>\n\n";
+		}
+
+		if ( $topic_title ) {
+			$q_topic_title = esc_attr( $q_topic_title );
+			$r .= "\t<div><label for=\"topic-title\">" . __('Title') . "</label>\n";
+			$r .= "\t\t<div><input name='topic_title' id='topic-title' type='text' class='text-input' value='$q_topic_title' /></div>\n";
+			$r .= "\t</div>\n\n";
+		}
+
+		$r .= "\t<div class=\"submit\"><label for=\"$id-submit\">" . __('Search') . "</label>\n";
+		$r .= "\t\t<div><input type='submit' class='button submit-input' value='$submit' id='$id-submit' /></div>\n";
+		$r .= "\t</div>\n";
+
+		$r .= "\t</fieldset>\n\n";
+
+		do_action( 'bb_query_form', $args, $query_vars );
+
+		$r .= "</form>\n\n";
+
+		echo $r;
+	}
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-taxonomy.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-taxonomy.php
new file mode 100644
index 0000000000000000000000000000000000000000..7c98a42de6719682157a5c72ced82814698c0ac8
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-taxonomy.php
@@ -0,0 +1,329 @@
+<?php
+/**
+ * Taxonomy API
+ *
+ * @package bbPress
+ * @subpackage Taxonomy
+ * @since 1.0
+ * @todo cache
+ */
+class BB_Taxonomy extends WP_Taxonomy
+{
+	/**
+	 * Retrieve object_ids of valid taxonomy and term.
+	 *
+	 * The strings of $taxonomies must exist before this function will continue. On
+	 * failure of finding a valid taxonomy, it will return an WP_Error class, kind
+	 * of like Exceptions in PHP 5, except you can't catch them. Even so, you can
+	 * still test for the WP_Error class and get the error message.
+	 *
+	 * The $terms aren't checked the same as $taxonomies, but still need to exist
+	 * for $object_ids to be returned.
+	 *
+	 * It is possible to change the order that object_ids is returned by either
+	 * using PHP sort family functions or using the database by using $args with
+	 * either ASC or DESC array. The value should be in the key named 'order'.
+	 *
+	 * @package bbPress
+	 * @subpackage Taxonomy
+	 * @since 1.0
+	 *
+	 * @uses wp_parse_args() Creates an array from string $args.
+	 *
+	 * @param string|array $terms String of term or array of string values of terms that will be used
+	 * @param string|array $taxonomies String of taxonomy name or Array of string values of taxonomy names
+	 * @param array|string $args Change the order of the object_ids, either ASC or DESC
+	 * @return WP_Error|array If the taxonomy does not exist, then WP_Error will be returned. On success
+	 *	the array can be empty meaning that there are no $object_ids found or it will return the $object_ids found.
+	 */
+	function get_objects_in_term( $terms, $taxonomies, $args = null ) {
+		if ( !is_array($terms) )
+			$terms = array($terms);
+
+		if ( !is_array($taxonomies) )
+			$taxonomies = array($taxonomies);
+
+		foreach ( (array) $taxonomies as $taxonomy ) {
+			if ( !$this->is_taxonomy($taxonomy) )
+				return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
+		}
+
+		$defaults = array('order' => 'ASC', 'field' => 'term_id', 'user_id' => 0);
+		$args = wp_parse_args( $args, $defaults );
+		extract($args, EXTR_SKIP);
+
+		if ( 'tt_id' == $field )
+			$field = 'tt.term_taxonomy_id';
+		else
+			$field = 'tt.term_id';
+
+		$order = ( 'desc' == strtolower($order) ) ? 'DESC' : 'ASC';
+		$user_id = (int) $user_id;
+
+		$terms = array_map('intval', $terms);
+
+		$taxonomies = "'" . implode("', '", $taxonomies) . "'";
+		$terms = "'" . implode("', '", $terms) . "'";
+
+		$sql = "SELECT tr.object_id FROM {$this->db->term_relationships} AS tr INNER JOIN {$this->db->term_taxonomy} AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND $field IN ($terms)";
+		if ( $user_id )
+			$sql .= " AND tr.user_id = '$user_id'";
+		$sql .= " ORDER BY tr.object_id $order";
+
+		$object_ids = $this->db->get_col( $sql );
+
+		if ( ! $object_ids )
+			return array();
+
+		return $object_ids;
+	}
+
+	/**
+	 * Will unlink the term from the taxonomy.
+	 *
+	 * Will remove the term's relationship to the taxonomy, not the term or taxonomy
+	 * itself. The term and taxonomy will still exist. Will require the term's
+	 * object ID to perform the operation.
+	 *
+	 * @package bbPress
+	 * @subpackage Taxonomy
+	 * @since 1.0
+	 *
+	 * @param int $object_id The term Object Id that refers to the term
+	 * @param string|array $taxonomy List of Taxonomy Names or single Taxonomy name.
+	 * @param int $user_id The ID of the user who created the relationship.
+	 */
+	function delete_object_term_relationships( $object_id, $taxonomies, $user_id = 0 ) {
+		$object_id = (int) $object_id;
+		$user_id = (int) $user_id;
+
+		if ( !is_array($taxonomies) )
+			$taxonomies = array($taxonomies);
+
+		foreach ( (array) $taxonomies as $taxonomy ) {
+			$terms = $this->get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids', 'user_id' => $user_id));
+			$in_terms = "'" . implode("', '", $terms) . "'";
+			$sql = "DELETE FROM {$this->db->term_relationships} WHERE object_id = %d AND term_taxonomy_id IN ($in_terms)";
+			if ( $user_id )
+				$sql .= " AND user_id = %d";
+			$this->db->query( $this->db->prepare( $sql, $object_id, $user_id ) );
+			$this->update_term_count($terms, $taxonomy);
+		}
+	}
+
+	/**
+	 * Retrieves the terms associated with the given object(s), in the supplied taxonomies.
+	 *
+	 * The following information has to do the $args parameter and for what can be
+	 * contained in the string or array of that parameter, if it exists.
+	 *
+	 * The first argument is called, 'orderby' and has the default value of 'name'.
+	 * The other value that is supported is 'count'.
+	 *
+	 * The second argument is called, 'order' and has the default value of 'ASC'.
+	 * The only other value that will be acceptable is 'DESC'.
+	 *
+	 * The final argument supported is called, 'fields' and has the default value of
+	 * 'all'. There are multiple other options that can be used instead. Supported
+	 * values are as follows: 'all', 'ids', 'names', and finally
+	 * 'all_with_object_id'.
+	 *
+	 * The fields argument also decides what will be returned. If 'all' or
+	 * 'all_with_object_id' is choosen or the default kept intact, then all matching
+	 * terms objects will be returned. If either 'ids' or 'names' is used, then an
+	 * array of all matching term ids or term names will be returned respectively.
+	 *
+	 * @package bbPress
+	 * @subpackage Taxonomy
+	 * @since 1.0
+	 *
+	 * @param int|array $object_id The id of the object(s) to retrieve.
+	 * @param string|array $taxonomies The taxonomies to retrieve terms from.
+	 * @param array|string $args Change what is returned
+	 * @return array|WP_Error The requested term data or empty array if no terms found. WP_Error if $taxonomy does not exist.
+	 */
+	function get_object_terms($object_ids, $taxonomies, $args = array()) {
+		if ( !is_array($taxonomies) )
+			$taxonomies = array($taxonomies);
+
+		foreach ( (array) $taxonomies as $taxonomy ) {
+			if ( !$this->is_taxonomy($taxonomy) )
+				return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
+		}
+
+		if ( !is_array($object_ids) )
+			$object_ids = array($object_ids);
+		$object_ids = array_map('intval', $object_ids);
+
+		$defaults = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all', 'user_id' => 0);
+		$args = wp_parse_args( $args, $defaults );
+		$args['user_id'] = (int) $args['user_id'];
+
+		$terms = array();
+		if ( count($taxonomies) > 1 ) {
+			foreach ( $taxonomies as $index => $taxonomy ) {
+				$t = $this->get_taxonomy($taxonomy);
+				if ( isset($t->args) && is_array($t->args) && $args != array_merge($args, $t->args) ) {
+					unset($taxonomies[$index]);
+					$terms = array_merge($terms, $this->get_object_terms($object_ids, $taxonomy, array_merge($args, $t->args)));
+				}
+			}
+		} else {
+			$t = $this->get_taxonomy($taxonomies[0]);
+			if ( isset($t->args) && is_array($t->args) )
+				$args = array_merge($args, $t->args);
+		}
+
+		extract($args, EXTR_SKIP);
+		$user_id = (int) $user_id;
+
+		if ( 'count' == $orderby )
+			$orderby = 'tt.count';
+		else if ( 'name' == $orderby )
+			$orderby = 't.name';
+		else if ( 'slug' == $orderby )
+			$orderby = 't.slug';
+		else if ( 'term_group' == $orderby )
+			$orderby = 't.term_group';
+		else if ( 'term_order' == $orderby )
+			$orderby = 'tr.term_order';
+		else if ( 'none' == $orderby ) {
+			$orderby = '';
+			$order = '';
+		} else {
+			$orderby = 't.term_id';
+		}
+
+		// tt_ids queries can only be none or tr.term_taxonomy_id
+		if ( ('tt_ids' == $fields) && !empty($orderby) )
+			$orderby = 'tr.term_taxonomy_id';
+
+		if ( !empty($orderby) )
+			$orderby = "ORDER BY $orderby";
+
+		$taxonomies = "'" . implode("', '", $taxonomies) . "'";
+		$object_ids = implode(', ', $object_ids);
+
+		$select_this = '';
+		if ( 'all' == $fields )
+			$select_this = 't.*, tt.*, tr.user_id';
+		else if ( 'ids' == $fields )
+			$select_this = 't.term_id';
+		else if ( 'names' == $fields )
+			$select_this = 't.name';
+		else if ( 'all_with_object_id' == $fields )
+			$select_this = 't.*, tt.*, tr.user_id, tr.object_id';
+
+		$query = "SELECT $select_this FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} AS tt ON tt.term_id = t.term_id INNER JOIN {$this->db->term_relationships} AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids)";
+		if ( $user_id )
+			$query .= " AND user_id = '$user_id'";
+		$query .= " $orderby $order";
+
+		if ( 'all' == $fields || 'all_with_object_id' == $fields ) {
+			$terms = array_merge($terms, $this->db->get_results($query));
+			$this->update_term_cache($terms);
+		} else if ( 'ids' == $fields || 'names' == $fields ) {
+			$terms = array_merge($terms, $this->db->get_col($query));
+		} else if ( 'tt_ids' == $fields ) {
+			$query = "SELECT tr.term_taxonomy_id FROM {$this->db->term_relationships} AS tr INNER JOIN {$this->db->term_taxonomy} AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN ($object_ids) AND tt.taxonomy IN ($taxonomies)";
+			if ( $user_id )
+				$query .= " AND tr.user_id = '$user_id'";
+			$query .= " $orderby $order";
+			$terms = $this->db->get_col( $query );
+		}
+
+		if ( ! $terms )
+			$terms = array();
+
+		return apply_filters('wp_get_object_terms', $terms, $object_ids, $taxonomies, $args);
+	}
+
+	/**
+	 * Create Term and Taxonomy Relationships.
+	 *
+	 * Relates an object (post, link etc) to a term and taxonomy type. Creates the
+	 * term and taxonomy relationship if it doesn't already exist. Creates a term if
+	 * it doesn't exist (using the slug).
+	 *
+	 * A relationship means that the term is grouped in or belongs to the taxonomy.
+	 * A term has no meaning until it is given context by defining which taxonomy it
+	 * exists under.
+	 *
+	 * @package bbPress
+	 * @subpackage Taxonomy
+	 * @since 1.0
+	 *
+	 * @param int $object_id The object to relate to.
+	 * @param array|int|string $term The slug or id of the term, will replace all existing
+	 * related terms in this taxonomy.
+	 * @param array|string $taxonomy The context in which to relate the term to the object.
+	 * @param bool $append If false will delete difference of terms.
+	 * @return array|WP_Error Affected Term IDs
+	 */
+	function set_object_terms($object_id, $terms, $taxonomy, $args = null) {
+		$object_id = (int) $object_id;
+
+		$defaults = array( 'append' => false, 'user_id' => 0 );
+		if ( is_scalar( $args ) )
+			$args = array( 'append' => (bool) $args );
+		$args = wp_parse_args( $args, $defaults );
+		extract( $args, EXTR_SKIP );
+		if ( !$user_id = (int) $user_id )
+			return new WP_Error('invalid_user_id', __('Invalid User ID'));
+
+		if ( !$this->is_taxonomy($taxonomy) )
+			return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
+
+		if ( !is_array($terms) )
+			$terms = array($terms);
+
+		if ( ! $append )
+			$old_tt_ids = $this->get_object_terms($object_id, $taxonomy, array('user_id' => $user_id, 'fields' => 'tt_ids', 'orderby' => 'none'));
+
+		$tt_ids = array();
+		$term_ids = array();
+
+		foreach ( (array) $terms as $term ) {
+			if ( !strlen(trim($term)) )
+				continue;
+
+			if ( !$id = $this->is_term($term, $taxonomy) )
+				$id = $this->insert_term($term, $taxonomy);
+			if ( is_wp_error($id) )
+				return $id;
+			$term_ids[] = $id['term_id'];
+			$id = $id['term_taxonomy_id'];
+			$tt_ids[] = $id;
+
+			if ( $this->db->get_var( $this->db->prepare( "SELECT term_taxonomy_id FROM {$this->db->term_relationships} WHERE object_id = %d AND term_taxonomy_id = %d AND user_id = %d", $object_id, $id, $user_id ) ) )
+				continue;
+			$this->db->insert( $this->db->term_relationships, array( 'object_id' => $object_id, 'term_taxonomy_id' => $id, 'user_id' => $user_id ) );
+		}
+
+		$this->update_term_count($tt_ids, $taxonomy);
+
+		if ( ! $append ) {
+			$delete_terms = array_diff($old_tt_ids, $tt_ids);
+			if ( $delete_terms ) {
+				$in_delete_terms = "'" . implode("', '", $delete_terms) . "'";
+				$this->db->query( $this->db->prepare("DELETE FROM {$this->db->term_relationships} WHERE object_id = %d AND user_id = %d AND term_taxonomy_id IN ($in_delete_terms)", $object_id, $user_id) );
+				$this->update_term_count($delete_terms, $taxonomy);
+			}
+		}
+
+		$t = $this->get_taxonomy($taxonomy);
+		if ( ! $append && isset($t->sort) && $t->sort ) {
+			$values = array();
+			$term_order = 0;
+			$final_tt_ids = $this->get_object_terms($object_id, $taxonomy, array( 'user_id' => $user_id, 'fields' => 'tt_ids' ));
+			foreach ( $tt_ids as $tt_id )
+				if ( in_array($tt_id, $final_tt_ids) )
+					$values[] = $this->db->prepare( "(%d, %d, %d, %d)", $object_id, $tt_id, $user_id, ++$term_order);
+			if ( $values )
+				$this->db->query("INSERT INTO {$this->db->term_relationships} (object_id, term_taxonomy_id, user_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");
+		}
+
+		do_action('set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append);
+		return $tt_ids;
+	}
+} // END class BB_Taxonomy extends WP_Taxonomy
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-walker.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-walker.php
new file mode 100644
index 0000000000000000000000000000000000000000..378e058dd6da316ba0991afd47dfa90b804bccc5
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-walker.php
@@ -0,0 +1,253 @@
+<?php
+
+class BB_Walker {
+	var $tree_type;
+	var $db_fields;
+
+	//abstract callbacks
+	function start_lvl($output) { return $output; }
+	function end_lvl($output)   { return $output; }
+	function start_el($output)  { return $output; }
+	function end_el($output)    { return $output; }
+
+	function _init() {
+		$this->parents = array();
+		$this->depth = 1;
+		$this->previous_element = '';
+	}		
+
+	function walk($elements, $to_depth) {
+		$args = array_slice(func_get_args(), 2);
+		$output = '';
+
+		// padding at the end
+		$last_element->{$this->db_fields['parent']} = 0;
+		$last_element->{$this->db_fields['id']} = 0;
+		$elements[] = $last_element;
+
+		$flat = (-1 == $to_depth) ? true : false;
+		foreach ( $elements as $element )
+			$output .= call_user_func_array( array(&$this, 'step'), array_merge( array($element, $to_depth), $args ) );
+
+		return $output;
+	}
+
+	function step( $element, $to_depth ) {
+		if ( !isset($this->depth) )
+			$this->_init();
+
+		$args = array_slice(func_get_args(), 2);
+		$id_field = $this->db_fields['id'];
+		$parent_field = $this->db_fields['parent'];
+
+		$flat = (-1 == $to_depth) ? true : false;
+
+		$output = '';
+
+		// If flat, start and end the element and skip the level checks.
+		if ( $flat ) {
+			// Start the element.
+			if ( isset($element->$id_field) && $element->$id_field != 0 ) {
+				$cb_args = array_merge( array(&$output, $element, $this->depth - 1), $args);
+				call_user_func_array(array(&$this, 'start_el'), $cb_args);
+			}
+
+			// End the element.
+			if ( isset($element->$id_field) && $element->$id_field != 0 ) {
+				$cb_args = array_merge( array(&$output, $element, $this->depth - 1), $args);
+				call_user_func_array(array(&$this, 'end_el'), $cb_args);
+			}
+
+			return;
+		}
+
+		// Walk the tree.
+		if ( !empty($element) && !empty($this->previous_element) && $element->$parent_field == $this->previous_element->$id_field ) {
+			// Previous element is my parent. Descend a level.
+			array_unshift($this->parents, $this->previous_element);
+			if ( !$to_depth || ($this->depth < $to_depth) ) { //only descend if we're below $to_depth
+				$cb_args = array_merge( array(&$output, $this->depth), $args);
+				call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
+			} else if ( $to_depth && $this->depth == $to_depth  ) {  // If we've reached depth, end the previous element.
+				$cb_args = array_merge( array(&$output, $this->previous_element, $this->depth), $args);
+				call_user_func_array(array(&$this, 'end_el'), $cb_args);
+			}
+			$this->depth++; //always do this so when we start the element further down, we know where we are
+		} else if ( !empty($element) && !empty($this->previous_element) && $element->$parent_field == $this->previous_element->$parent_field) {
+			// On the same level as previous element.
+			if ( !$to_depth || ($this->depth <= $to_depth) ) {
+				$cb_args = array_merge( array(&$output, $this->previous_element, $this->depth - 1), $args);
+				call_user_func_array(array(&$this, 'end_el'), $cb_args);
+			}
+		} else if ( $this->depth > 1 ) {
+			// Ascend one or more levels.
+			if ( !$to_depth || ($this->depth <= $to_depth) ) {
+				$cb_args = array_merge( array(&$output, $this->previous_element, $this->depth - 1), $args);
+				call_user_func_array(array(&$this, 'end_el'), $cb_args);
+			}
+
+			while ( $parent = array_shift($this->parents) ) {
+				$this->depth--;
+				if ( !$to_depth || ($this->depth < $to_depth) ) {
+					$cb_args = array_merge( array(&$output, $this->depth), $args);
+					call_user_func_array(array(&$this, 'end_lvl'), $cb_args);
+					$cb_args = array_merge( array(&$output, $parent, $this->depth - 1), $args);
+					call_user_func_array(array(&$this, 'end_el'), $cb_args);
+				}
+				if ( !empty($element) && isset($this->parents[0]) && $element->$parent_field == $this->parents[0]->$id_field ) {
+					break;
+				}
+			}
+		} else if ( !empty($this->previous_element) ) {
+			// Close off previous element.
+			if ( !$to_depth || ($this->depth <= $to_depth) ) {
+				$cb_args = array_merge( array(&$output, $this->previous_element, $this->depth - 1), $args);
+				call_user_func_array(array(&$this, 'end_el'), $cb_args);
+			}
+		}
+
+		// Start the element.
+		if ( !$to_depth || ($this->depth <= $to_depth) ) {
+			if ( !empty($element) && $element->$id_field != 0 ) {
+				$cb_args = array_merge( array(&$output, $element, $this->depth - 1), $args);
+				call_user_func_array(array(&$this, 'start_el'), $cb_args);
+			}
+		}
+
+		$this->previous_element = $element;
+		return $output;
+	}
+}
+
+class BB_Walker_Blank extends BB_Walker { // Used for template functions
+	var $tree_type;
+	var $db_fields = array( 'id' => '', 'parent' => '' );
+
+	var $start_lvl = '';
+	var $end_lvl   = '';
+
+	//abstract callbacks
+	function start_lvl( $output, $depth ) { 
+		if ( !$this->start_lvl )
+			return '';
+		$indent = str_repeat("\t", $depth);
+		$output .= $indent . "$this->start_lvl\n";
+		return $output;
+	}
+
+	function end_lvl( $output, $depth )   {
+		if ( !$this->end_lvl )
+			return '';
+		$indent = str_repeat("\t", $depth);
+		$output .= $indent . "$this->end_lvl\n";
+		return $output;
+	}
+
+	function start_el()  { return ''; }
+	function end_el()    { return ''; }
+}
+
+class BB_Loop {
+	var $elements;
+	var $walker;
+	var $_preserve = array();
+	var $_looping = false;
+
+	function &start( $elements, $walker = 'BB_Walker_Blank' ) {
+		$null = null;
+		$a = new BB_Loop( $elements );
+		if ( !$a->elements )
+			return $null;
+		$a->walker = new $walker;
+		return $a;
+	}
+
+	function BB_Loop( &$elements ) {
+		$this->elements = $elements;
+		if ( !is_array($this->elements) || empty($this->elements) )
+			return $this->elements = false;
+	}
+
+	function step() {
+		if ( !is_array($this->elements) || !current($this->elements) || !is_object($this->walker) )
+			return false;
+
+		if ( !$this->_looping ) {
+			$r = reset($this->elements);
+			$this->_looping = true;
+		} else {
+			$r = next($this->elements);
+		}
+
+		if ( !$args = func_get_args() )
+			$args = array( 0 );
+		echo call_user_func_array( array(&$this->walker, 'step'), array_merge(array(current($this->elements)), $args) );
+		return $r;
+	}
+
+	function pad( $pad, $offset = 0 ) {
+		if ( !is_array($this->elements) || !is_object($this->walker) )
+			return false;
+
+		if ( is_numeric($pad) )
+			return $pad * ($this->walker->depth - 1) + (int) $offset;
+
+		return str_repeat( $pad, $this->walker->depth - 1 );
+	}
+
+	function preserve( $array ) {
+		if ( !is_array( $array ) )
+			return false;
+
+		foreach ( $array as $key )
+			$this->_preserve[$key] = $GLOBALS[$key];
+	}
+
+	function reinstate() {
+		foreach ( $this->_preserve as $key => $value )
+			$GLOBALS[$key] = $value;
+	}
+
+	function classes( $output = 'string' ) {
+		if ( !is_array($this->elements) || !is_object($this->walker) )
+			return false;
+		$classes = array();
+
+		$current = current($this->elements);
+
+		if ( $prev = prev($this->elements) )
+			next($this->elements);
+		else		
+			reset($this->elements);
+
+		if ( $next = next($this->elements) )
+			prev($this->elements);
+		else
+			end($this->elements);
+
+		if ( !empty($next) && $next->{$this->walker->db_fields['parent']} == $current->{$this->walker->db_fields['id']} )
+			$classes[] = 'bb-parent';
+		elseif ( !empty($next) && $next->{$this->walker->db_fields['parent']} == $current->{$this->walker->db_fields['parent']} )
+			$classes[] = 'bb-precedes-sibling';
+		else
+			$classes[] = 'bb-last-child';
+
+		if ( !empty($prev) && $current->{$this->walker->db_fields['parent']} == $prev->{$this->walker->db_fields['id']} )
+			$classes[] = 'bb-first-child';
+		elseif ( !empty($prev) && $current->{$this->walker->db_fields['parent']} == $prev->{$this->walker->db_fields['parent']} )
+			$classes[] = 'bb-follows-sibling';
+		elseif ( $prev )
+			$classes[] = 'bb-follows-niece';
+
+		if ( $this->walker->depth > 1 )
+			$classes[] = 'bb-child';
+		else
+			$classes[] = 'bb-root';
+
+		if ( $output === 'string' )
+			$classes = join(' ', $classes);
+
+		return $classes;
+	}
+
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bp-options.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bp-options.php
new file mode 100644
index 0000000000000000000000000000000000000000..e4fee9474f55959f377058ac0bb95c7f61528eb8
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bp-options.php
@@ -0,0 +1,97 @@
+<?php
+/**
+ * BP_Options allows storage of options for BackPress
+ * in the bbPress database
+ *
+ * @see BP_Options_Interface
+ * @package bbPress
+ */
+class BP_Options
+{
+	function prefix()
+	{
+		return 'bp_bbpress_';
+	}
+	
+	function get( $option )
+	{
+		switch ( $option ) {
+			case 'application_id':
+				return bb_get_option( 'site_id' );
+				break;
+			case 'application_uri':
+				return bb_get_uri( null, null, BB_URI_CONTEXT_NONE );
+				break;
+			case 'cron_uri':
+				return bb_get_uri( 'bb-cron.php', array( 'check' => BP_Options::get( 'cron_check' ) ), BB_URI_CONTEXT_WP_HTTP_REQUEST );
+				break;
+			case 'cron_check':
+				return bb_hash( '187425' );
+				break;
+			case 'wp_http_version':
+				return 'bbPress/' . bb_get_option( 'version' );
+				break;
+			case 'hash_function_name':
+				return 'bb_hash';
+				break;
+			case 'language_locale':
+				return bb_get_locale();
+				break;
+			case 'language_directory':
+				return BB_LANG_DIR;
+				break;
+			case 'charset':
+			case 'gmt_offset':
+			case 'timezone_string':
+				return bb_get_option( $option );
+				break;
+			default:
+				return bb_get_option( BP_Options::prefix() . $option );
+				break;
+		}
+	}
+	
+	function add( $option, $value )
+	{
+		return BP_Options::update( $option, $value );
+	}
+	
+	function update( $option, $value )
+	{
+		return bb_update_option( BP_Options::prefix() . $option, $value );
+	}
+	
+	function delete( $option )
+	{
+		return bb_delete_option( BP_Options::prefix() . $option );
+	}
+} // END class BP_Options
+
+/**
+ * Allows storage of transients for BackPress
+ *
+ * @see BP_Transients_Interface
+ * @package bbPress
+ */
+class BP_Transients
+{
+	function prefix()
+	{
+		return 'bp_bbpress_';
+	}
+	
+	function get( $transient )
+	{
+		return bb_get_transient( BP_Transients::prefix() . $transient );
+	}
+	
+	function set( $transient, $value, $expiration = 0 )
+	{
+		return bb_set_transient( BP_Transients::prefix() . $transient, $value, $expiration );
+	}
+	
+	function delete( $transient )
+	{
+		return bb_delete_transient( BP_Transients::prefix() . $transient );
+	}
+} // END class BP_Transients
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/defaults.bb-filters.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/defaults.bb-filters.php
new file mode 100644
index 0000000000000000000000000000000000000000..937f5221d1ac4b2cb27139c6396064b389917c45
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/defaults.bb-filters.php
@@ -0,0 +1,155 @@
+<?php
+/**
+ * Sets up the default filters and actions for most
+ * of the bbPress hooks.
+ *
+ * If you need to remove a default hook, this file will
+ * give you the priority for which to use to remove the
+ * hook.
+ *
+ * Not all of the default hooks are found in this files
+ *
+ * @package bbPress
+ */
+
+// Strip, trim, kses, special chars for string saves
+$filters = array( 'pre_term_name', 'bb_pre_forum_name', 'pre_topic_title' );
+foreach ( $filters as $filter ) {
+	add_filter( $filter, 'strip_tags' );
+	add_filter( $filter, 'trim' );
+	add_filter( $filter, 'bb_filter_kses' );
+	add_filter( $filter, 'esc_html', 30 );
+}
+
+// Kses only for textarea saves
+$filters = array( 'pre_term_description', 'bb_pre_forum_desc' );
+foreach ( $filters as $filter ) {
+	add_filter( $filter, 'bb_filter_kses' );
+}
+
+// Slugs
+add_filter( 'pre_term_slug', 'bb_pre_term_slug' );
+
+// DB truncations
+add_filter( 'pre_topic_title', 'bb_trim_for_db_150', 9999 );
+add_filter( 'bb_pre_forum_name', 'bb_trim_for_db_150', 9999 );
+add_filter( 'pre_term_name', 'bb_trim_for_db_55', 9999 );
+
+// Format Strings for Display
+$filters = array( 'forum_name', 'topic_title', 'bb_title', 'bb_option_name' );
+foreach ( $filters as $filter ) {
+	add_filter( $filter, 'esc_html' );
+}
+
+// Numbers
+$filters = array( 'forum_topics', 'forum_posts', 'total_posts', 'total_users', 'total_topics' );
+foreach ( $filters as $filter ) {
+	add_filter( $filter, 'bb_number_format_i18n' );
+}
+
+// Offset Times
+$filters = array( 'topic_time', 'topic_start_time', 'bb_post_time' );
+foreach ( $filters as $filter ) {
+	add_filter( $filter, 'bb_offset_time', 10, 2 );
+}
+
+add_filter('bb_topic_labels', 'bb_closed_label', 10);
+add_filter('bb_topic_labels', 'bb_sticky_label', 20);
+
+add_filter('pre_post', 'trim');
+add_filter('pre_post', 'bb_encode_bad');
+add_filter('pre_post', 'bb_code_trick');
+add_filter('pre_post', 'force_balance_tags');
+add_filter('pre_post', 'bb_filter_kses', 50);
+add_filter('pre_post', 'bb_autop', 60);
+
+add_filter('post_text', 'do_shortcode');
+
+function bb_contextualise_search_post_text()
+{
+	if ( bb_is_search() ) {
+		add_filter( 'get_post_text', 'bb_post_text_context' );
+	}
+}
+add_action( 'bb_init', 'bb_contextualise_search_post_text' );
+
+add_filter('post_text', 'make_clickable');
+
+add_filter('edit_text', 'bb_code_trick_reverse');
+add_filter('edit_text', 'wp_specialchars');
+add_filter('edit_text', 'trim', 15);
+
+add_filter('pre_sanitize_with_dashes', 'bb_pre_sanitize_with_dashes_utf8', 10, 3 );
+
+add_filter('get_user_link', 'bb_fix_link');
+
+add_filter('sanitize_profile_info', 'esc_html');
+add_filter('sanitize_profile_admin', 'esc_html');
+
+add_filter( 'get_recent_user_replies_fields', 'bb_get_recent_user_replies_fields' );
+add_filter( 'get_recent_user_replies_group_by', 'bb_get_recent_user_replies_group_by' );
+
+add_filter('sort_tag_heat_map', 'bb_sort_tag_heat_map');
+
+// URLS
+
+if ( !bb_get_option( 'mod_rewrite' ) ) {
+	add_filter( 'bb_stylesheet_uri', 'esc_attr', 1, 9999 );
+	add_filter( 'forum_link', 'esc_attr', 1, 9999 );
+	add_filter( 'bb_forum_posts_rss_link', 'esc_attr', 1, 9999 );
+	add_filter( 'bb_forum_topics_rss_link', 'esc_attr', 1, 9999 );
+	add_filter( 'bb_tag_link', 'esc_attr', 1, 9999 );
+	add_filter( 'tag_rss_link', 'esc_attr', 1, 9999 );
+	add_filter( 'topic_link', 'esc_attr', 1, 9999 );
+	add_filter( 'topic_rss_link', 'esc_attr', 1, 9999 );
+	add_filter( 'post_link', 'esc_attr', 1, 9999 );
+	add_filter( 'post_anchor_link', 'esc_attr', 1, 9999 );
+	add_filter( 'user_profile_link', 'esc_attr', 1, 9999 );
+	add_filter( 'profile_tab_link', 'esc_attr', 1, 9999 );
+	add_filter( 'favorites_link', 'esc_attr', 1, 9999 );
+	add_filter( 'view_link', 'esc_attr', 1, 9999 );
+}
+
+// Feed Stuff
+
+function bb_filter_feed_content()
+{
+	if ( bb_is_feed() ) {
+		add_filter( 'bb_title_rss', 'ent2ncr' );
+		add_filter( 'topic_title', 'ent2ncr' );
+		add_filter( 'post_link', 'esc_html' );
+		add_filter( 'post_text', 'htmlspecialchars' ); // encode_bad should not be overruled by esc_html
+		add_filter( 'post_text', 'ent2ncr' );
+	}
+}
+add_action( 'bb_init', 'bb_filter_feed_content' );
+
+add_filter( 'init_roles', 'bb_init_roles' );
+add_filter( 'map_meta_cap', 'bb_map_meta_cap', 1, 4 );
+
+// Actions
+
+add_action( 'bb_head', 'bb_generator' );
+add_action('bb_head', 'bb_template_scripts');
+add_action('bb_head', 'wp_print_scripts');
+add_action('bb_head', 'wp_print_styles');
+add_action('bb_head', 'bb_rsd_link');
+add_action('bb_head', 'bb_pingback_link');
+if ( $bb_log->type === 'console' ) {
+	add_action('bb_head', array(&$bb_log, 'console_javascript'));
+	add_action('bb_admin_head', array(&$bb_log, 'console_javascript'));
+}
+add_action('bb_send_headers', 'bb_pingback_header');
+add_action('bb_admin_print_scripts', 'wp_print_scripts');
+
+add_action('bb_user_has_no_caps', 'bb_give_user_default_role');
+
+add_action('do_pingbacks', array('BB_Pingbacks', 'send_all'), 10, 1);
+
+add_action( 'bb_init', 'bb_register_default_views' );
+
+add_action( 'set_current_user', 'bb_apply_wp_role_map_to_user' );
+
+add_filter( 'bb_pre_get_option_gmt_offset', 'wp_timezone_override_offset' );
+
+unset( $filters, $filter );
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-capabilities.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-capabilities.php
new file mode 100644
index 0000000000000000000000000000000000000000..ffcf2152834d51d88276cd6495bb260c5a97c247
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-capabilities.php
@@ -0,0 +1,346 @@
+<?php
+/**
+ * bbPress Roles and Capabilities Wrapping Functions.
+ *
+ * @package bbPress
+ * @subpackage User
+ */
+
+
+
+/**
+ * Whether current user has capability or role.
+ *
+ * @since 0.7.2
+ * @uses $bb_current_user Current User Object
+ *
+ * @param string $capability Capability or role name.
+ * @return bool
+ */
+function bb_current_user_can($capability) {
+	global $bb_current_user;
+
+	$args = array_slice(func_get_args(), 1);
+	$args = array_merge(array($capability), $args);
+
+	if ( empty($bb_current_user) ) {
+		$retvalue = false;
+	} else {
+		$retvalue = call_user_func_array(array(&$bb_current_user, 'has_cap'), $args);
+	}
+	
+	// Use bb_user_has_cap whenever possible!  This will not work everywhere.
+	return apply_filters('bb_current_user_can', $retvalue, $capability, $args);
+}
+
+/**
+ * Give a user the default role
+ *
+ * @since 0.7.2
+ *
+ * @param BP_User $user User object to give default role to
+ */
+function bb_give_user_default_role( $user ) {
+	if ( !( is_object($user) && is_a($user, 'BP_User') ) )
+		return;
+	$user->set_role('member');
+}
+
+/**
+ * Setup all default roles and associate them with capabilities
+ *
+ * @since 0.7.2
+ *
+ * @param BP_Roles $roles Roles object to add default roles to
+ */
+function bb_init_roles( &$roles ) {
+	$roles->add_role( 'keymaster', __('Key Master'), array(
+		'use_keys' => true,				// Verb forms of roles - keymaster
+		'administrate' => true,			// administrator
+		'moderate' => true, 			// moderator
+		'participate' => true,			// member
+
+		'keep_gate' => true,			// Make new Key Masters		//+
+		'import_export' => true,		// Import and export data	//+
+		'recount' => true,				// bb-do-counts.php			//+
+		'manage_options' => true,		// backend					//+
+		'manage_themes' => true,		// Themes					//+
+		'manage_plugins' => true,		// Plugins					//+
+		'manage_options' => true,		// Options					//+
+		'edit_users' => true,
+		'manage_tags' => true,			// Rename, Merge, Destroy
+		'edit_others_favorites' => true,
+		'manage_forums' => true,		// Add/Rename forum
+		'delete_forums' => true,		// Delete forum
+		'delete_topics' => true,
+		'close_topics' => true,
+		'stick_topics' => true,
+		'move_topics' => true,
+		'view_by_ip' => true,			// view-ip.php
+		'edit_closed' => true,			// Edit closed topics
+		'edit_deleted' => true,			// Edit deleted topics/posts
+		'browse_deleted' => true,		// Use 'deleted' view
+		'edit_others_tags' => true,
+		'edit_others_topics' => true,
+		'delete_posts' => true,
+		'throttle' => true,				// Post back to back arbitrarily quickly
+		'ignore_edit_lock' => true,
+		'edit_others_posts' => true,
+		'edit_favorites' => true,
+		'edit_tags' => true,
+		'edit_topics' => true,			// Edit title, resolution status
+		'edit_posts' => true,
+		'edit_profile' => true,
+		'write_topics' => true,
+		'write_posts' => true,
+		'change_password' => true,
+		'read' => true
+	) );
+
+	$roles->add_role( 'administrator', __('Administrator'), array(
+		'administrate' => true,
+		'moderate' => true,
+		'participate' => true,
+
+		'edit_users' => true,				//+
+		'edit_others_favorites' => true,	//+
+		'manage_forums' => true,			//+
+		'delete_forums' => true,			//+
+		'manage_tags' => true,
+		'delete_topics' => true,
+		'close_topics' => true,
+		'stick_topics' => true,
+		'move_topics' => true,
+		'view_by_ip' => true,
+		'edit_closed' => true,
+		'edit_deleted' => true,
+		'browse_deleted' => true,
+		'edit_others_tags' => true,
+		'edit_others_topics' => true,
+		'delete_posts' => true,
+		'throttle' => true,
+		'ignore_edit_lock' => true,
+		'edit_others_posts' => true,
+		'edit_favorites' => true,
+		'edit_tags' => true,
+		'edit_topics' => true,
+		'edit_posts' => true,
+		'edit_profile' => true,
+		'write_topics' => true,
+		'write_posts' => true,
+		'change_password' => true,
+		'read' => true
+	) );
+
+	$roles->add_role( 'moderator', __('Moderator'), array(
+		'moderate' => true,
+		'participate' => true,
+
+		'manage_tags' => true,			//+
+		'delete_topics' => true,		//+
+		'close_topics' => true,			//+
+		'stick_topics' => true,			//+
+		'move_topics' => true,			//+
+		'view_by_ip' => true,			//+
+		'edit_closed' => true,			//+
+		'edit_deleted' => true,			//+
+		'browse_deleted' => true,		//+
+		'edit_others_tags' => true,		//+
+		'edit_others_topics' => true,	//+
+		'delete_posts' => true,			//+
+		'throttle' => true,				//+
+		'ignore_edit_lock' => true,		//+
+		'edit_others_posts' => true,	//+
+		'edit_favorites' => true,
+		'edit_tags' => true,
+		'edit_topics' => true,
+		'edit_posts' => true,
+		'edit_profile' => true,
+		'write_topics' => true,
+		'write_posts' => true,
+		'change_password' => true,
+		'read' => true
+	) );
+
+
+	$roles->add_role( 'member', __('Member'), array(
+		'participate' => true,
+
+		'edit_favorites' => true,
+		'edit_tags' => true,
+		'edit_topics' => true,
+		'edit_posts' => true,
+		'edit_profile' => true,
+		'write_topics' => true,
+		'write_posts' => true,
+		'change_password' => true,
+		'read' => true
+	) );
+
+	$roles->add_role( 'inactive', __('Inactive'), array(
+		'change_password' => true,
+		'read' => true
+	) );
+
+	$roles->add_role( 'blocked', __('Blocked'), array(
+		'not_play_nice' => true // Madness - a negative capability.  Don't try this at home.
+	) );
+}
+
+/**
+ * Map meta capabilities to primitive capabilities.
+ *
+ * This does not actually compare whether the user ID has the actual capability,
+ * just what the capability or capabilities are. Meta capability list value can
+ * be 'delete_user', 'edit_user', 'delete_post', 'delete_page', 'edit_post',
+ * 'edit_page', 'read_post', or 'read_page'.
+ *
+ * @since 0.7.2
+ *
+ * @param array $caps Previously existing capabilities
+ * @param string $cap Capability name.
+ * @param int $user_id User ID.
+ * @return array Actual capabilities for meta capability.
+ */
+function bb_map_meta_cap( $caps, $cap, $user_id, $args ) {
+	// Unset the meta cap
+	if ( false !== $cap_pos = array_search( $cap, $caps ) )
+		unset( $caps[$cap_pos] );
+
+	switch ( $cap ) {
+		case 'write_post':
+			$caps[] = 'write_posts';
+			break;
+		case 'edit_post':
+			// edit_posts, edit_others_posts, edit_deleted, edit_closed, ignore_edit_lock
+			if ( !$bb_post = bb_get_post( $args[0] ) ) {
+				$caps[] = 'magically_provide_data_given_bad_input';
+				return $caps;
+			}
+			if ( $user_id == $bb_post->poster_id )
+				$caps[] = 'edit_posts';
+			else
+				$caps[] = 'edit_others_posts';
+			if ( $bb_post->post_status == '1' )
+				$caps[] = 'edit_deleted';
+			if ( !topic_is_open( $bb_post->topic_id ) )
+				$caps[] = 'edit_closed';
+			$post_time = bb_gmtstrtotime( $bb_post->post_time );
+			$curr_time = time() + 1;
+			$edit_lock = bb_get_option( 'edit_lock' );
+			if ( $edit_lock >= 0 && $curr_time - $post_time > $edit_lock * 60 )
+				$caps[] = 'ignore_edit_lock';
+			break;
+		case 'delete_post' :
+			// edit_deleted, delete_posts
+			if ( !$bb_post = bb_get_post( $args[0] ) ) {
+				$caps[] = 'magically_provide_data_given_bad_input';
+				return $caps;
+			}
+			if ( 0 != $bb_post->post_status )
+				$caps[] = 'edit_deleted';
+			// NO BREAK
+		case 'manage_posts' : // back compat
+			$caps[] = 'delete_posts';
+			break;
+		case 'write_topic':
+			$caps[] = 'write_topics';
+			break;
+		case 'edit_topic':
+			// edit_closed, edit_deleted, edit_topics, edit_others_topics
+			if ( !$topic = get_topic( $args[0] ) ) {
+				$caps[] = 'magically_provide_data_given_bad_input';
+				return $caps;
+			}
+			if ( !topic_is_open( $args[0]) )
+				$caps[] = 'edit_closed';
+			if ( '1' == $topic->topic_status )
+				$caps[] = 'edit_deleted';
+			if ( $user_id == $topic->topic_poster )
+				$caps[] = 'edit_topics';
+			else
+				$caps[] = 'edit_others_topics';
+			break;
+		case 'move_topic' :
+			$caps[] = 'move_topics';
+			break;
+		case 'stick_topic' :
+			$caps[] = 'stick_topics';
+			break;
+		case 'close_topic' :
+			$caps[] = 'close_topics';
+			break;
+		case 'delete_topic' :
+			$caps[] = 'delete_topics';
+			add_filter( 'get_topic_where', 'bb_no_where', 9999 );
+			if ( !$topic = get_topic( $args[0] ) ) {
+				$caps[] = 'magically_provide_data_given_bad_input';
+				return $caps;
+			}
+			if ( 0 != $topic->topic_status )
+				$caps[] = 'edit_deleted';
+			remove_filter( 'get_topic_where', 'bb_no_where', 9999 );
+			break;
+		case 'manage_topics' :
+			// back compat
+			$caps[] = 'move_topics';
+			$caps[] = 'stick_topics';
+			$caps[] = 'close_topics';
+			$caps[] = 'delete_topics';
+			break;
+		case 'add_tag_to':
+			// edit_closed, edit_deleted, edit_tags;
+			if ( !$topic = get_topic( $args[0] ) ) {
+				$caps[] = 'magically_provide_data_given_bad_input';
+				return $caps;
+			}
+			if ( !topic_is_open( $topic->topic_id ) )
+				$caps[] = 'edit_closed';
+			if ( '1' == $topic->topic_status )
+				$caps[] = 'edit_deleted';
+			$caps[] = 'edit_tags';
+			break;
+		case 'edit_tag_by_on':
+			// edit_closed, edit_deleted, edit_tags, edit_others_tags
+			if ( !$topic = get_topic( $args[1] ) ) {
+				$caps[] = 'magically_provide_data_given_bad_input';
+				return $caps;
+			}
+			if ( !topic_is_open( $topic->topic_id ) )
+				$caps[] = 'edit_closed';
+			if ( '1' == $topic->topic_status )
+				$caps[] = 'edit_deleted';
+			if ( $user_id == $args[0] )
+				$caps[] = 'edit_tags';
+			else
+				$caps[] = 'edit_others_tags';
+			break;
+		case 'edit_user':
+			// edit_profile, edit_users;
+			if ( $user_id == $args[0] )
+				$caps[] = 'edit_profile';
+			else
+				$caps[] = 'edit_users';
+			break;
+		case 'edit_favorites_of':
+			// edit_favorites, edit_others_favorites;
+			if ( $user_id == $args[0] )
+				$caps[] = 'edit_favorites';
+			else
+				$caps[] = 'edit_others_favorites';
+			break;
+		case 'delete_forum':
+			$caps[] = 'delete_forums';
+			break;
+		case 'change_user_password':
+			// change_password, edit_users
+			$caps[] = 'change_password';
+			if ( $user_id != $args[0] )
+				$caps[] = 'edit_users';
+			break;
+		default:
+			// If no meta caps match, return the original cap.
+			$caps[] = $cap;
+	}
+	return $caps;
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-core.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-core.php
new file mode 100644
index 0000000000000000000000000000000000000000..c1c5ce9e0af57180f64685ae81242fc4fefe74e3
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-core.php
@@ -0,0 +1,1789 @@
+<?php
+/**
+ * Core bbPress functions.
+ *
+ * @package bbPress
+ */
+
+
+
+/**
+ * Initialization functions mostly called in bb-settings.php
+ */
+
+/**
+ * Marks things as deprecated and informs when they have been used.
+ *
+ * @since 0.9
+ *
+ * @param string $type The type of thing that was attempted: function, class::function, constant, variable or page.
+ * @param string $name The thing that was called.
+ * @param string $replacement Optional. The thing that should have been called.
+ * @uses $bb_log BP_Log logging object.
+ */
+function bb_log_deprecated( $type, $name, $replacement = 'none' ) {
+	global $bb_log;
+	$bb_log->notice( sprintf( __( 'Using deprecated bbPress %1$s - %2$s - replace with - %3$s' ), $type, $name, $replacement ) );
+}
+
+/**
+ * Sanitizes user input en-masse.
+ *
+ * @param mixed $array The array of values or a single value to sanitize, usually a global variable like $_GET or $_POST.
+ * @param boolean $trim Optional. Whether to trim the value or not. Default is true.
+ * @return mixed The sanitized data.
+ */
+function bb_global_sanitize( $array, $trim = true )
+{
+	foreach ( $array as $k => $v ) {
+		if ( is_array( $v ) ) {
+			$array[$k] = bb_global_sanitize( $v );
+		} else {
+			if ( !get_magic_quotes_gpc() ) {
+				$array[$k] = addslashes( $v );
+			}
+			if ( $trim ) {
+				$array[$k] = trim( $array[$k] );
+			}
+		}
+	}
+
+	return $array;
+}
+
+/**
+ * Reports whether bbPress is installed by getting forums.
+ *
+ * @return boolean True if there are forums, otherwise false.
+ */
+function bb_is_installed()
+{
+	// Maybe grab all the forums and cache them
+	global $bbdb;
+	$bbdb->suppress_errors();
+	$forums = (array) @bb_get_forums();
+	$bbdb->suppress_errors(false);
+
+	if ( !$forums ) {
+		return false;
+	}
+
+	return true;
+}
+
+/**
+ * Sets the required variables to connect to custom user tables.
+ *
+ * @return boolean Always returns true.
+ */
+function bb_set_custom_user_tables()
+{
+	global $bb;
+
+	// Check for older style custom user table
+	if ( !isset( $bb->custom_tables['users'] ) ) { // Don't stomp new setting style
+		if ( $bb->custom_user_table = bb_get_option( 'custom_user_table' ) ) {
+			if ( !isset( $bb->custom_tables ) ) {
+				$bb->custom_tables = array();
+			}
+			$bb->custom_tables['users'] = $bb->custom_user_table;
+		}
+	}
+
+	// Check for older style custom user meta table
+	if ( !isset( $bb->custom_tables['usermeta'] ) ) { // Don't stomp new setting style
+		if ( $bb->custom_user_meta_table = bb_get_option( 'custom_user_meta_table' ) ) {
+			if ( !isset( $bb->custom_tables ) ) {
+				$bb->custom_tables = array();
+			}
+			$bb->custom_tables['usermeta'] = $bb->custom_user_meta_table;
+		}
+	}
+
+	// Check for older style wp_table_prefix
+	if ( $bb->wp_table_prefix = bb_get_option( 'wp_table_prefix' ) ) { // User has set old constant
+		if ( !isset( $bb->custom_tables ) ) {
+			$bb->custom_tables = array(
+				'users'    => $bb->wp_table_prefix . 'users',
+				'usermeta' => $bb->wp_table_prefix . 'usermeta'
+			);
+		} else {
+			if ( !isset( $bb->custom_tables['users'] ) ) { // Don't stomp new setting style
+				$bb->custom_tables['users'] = $bb->wp_table_prefix . 'users';
+			}
+			if ( !isset( $bb->custom_tables['usermeta'] ) ) {
+				$bb->custom_tables['usermeta'] = $bb->wp_table_prefix . 'usermeta';
+			}
+		}
+	}
+
+	if ( bb_get_option( 'wordpress_mu_primary_blog_id' ) ) {
+		$bb->wordpress_mu_primary_blog_id = bb_get_option( 'wordpress_mu_primary_blog_id' );
+	}
+
+	// Check for older style user database
+	if ( !isset( $bb->custom_databases ) ) {
+		$bb->custom_databases = array();
+	}
+	if ( !isset( $bb->custom_databases['user'] ) ) {
+		if ( $bb->user_bbdb_name = bb_get_option( 'user_bbdb_name' ) ) {
+			$bb->custom_databases['user']['name'] = $bb->user_bbdb_name;
+		}
+		if ( $bb->user_bbdb_user = bb_get_option( 'user_bbdb_user' ) ) {
+			$bb->custom_databases['user']['user'] = $bb->user_bbdb_user;
+		}
+		if ( $bb->user_bbdb_password = bb_get_option( 'user_bbdb_password' ) ) {
+			$bb->custom_databases['user']['password'] = $bb->user_bbdb_password;
+		}
+		if ( $bb->user_bbdb_host = bb_get_option( 'user_bbdb_host' ) ) {
+			$bb->custom_databases['user']['host'] = $bb->user_bbdb_host;
+		}
+		if ( $bb->user_bbdb_charset = bb_get_option( 'user_bbdb_charset' ) ) {
+			$bb->custom_databases['user']['charset'] = $bb->user_bbdb_charset;
+		}
+		if ( $bb->user_bbdb_collate = bb_get_option( 'user_bbdb_collate' ) ) {
+			$bb->custom_databases['user']['collate'] = $bb->user_bbdb_collate;
+		}
+		if ( isset( $bb->custom_databases['user'] ) ) {
+			if ( isset( $bb->custom_tables['users'] ) ) {
+				$bb->custom_tables['users'] = array( 'user', $bb->custom_tables['users'] );
+			}
+			if ( isset( $bb->custom_tables['usermeta'] ) ) {
+				$bb->custom_tables['usermeta'] = array( 'user', $bb->custom_tables['usermeta'] );
+			}
+		}
+	}
+
+	return true;
+}
+
+
+/* Pagination */
+
+/**
+ * Retrieve paginated links for pages.
+ *
+ * Technically, the function can be used to create paginated link list for any
+ * area. The 'base' argument is used to reference the url, which will be used to
+ * create the paginated links. The 'format' argument is then used for replacing
+ * the page number. It is however, most likely and by default, to be used on the
+ * archive post pages.
+ *
+ * The 'type' argument controls format of the returned value. The default is
+ * 'plain', which is just a string with the links separated by a newline
+ * character. The other possible values are either 'array' or 'list'. The
+ * 'array' value will return an array of the paginated link list to offer full
+ * control of display. The 'list' value will place all of the paginated links in
+ * an unordered HTML list.
+ *
+ * The 'total' argument is the total amount of pages and is an integer. The
+ * 'current' argument is the current page number and is also an integer.
+ *
+ * An example of the 'base' argument is "http://example.com/all_posts.php%_%"
+ * and the '%_%' is required. The '%_%' will be replaced by the contents of in
+ * the 'format' argument. An example for the 'format' argument is "?page=%#%"
+ * and the '%#%' is also required. The '%#%' will be replaced with the page
+ * number.
+ *
+ * You can include the previous and next links in the list by setting the
+ * 'prev_next' argument to true, which it is by default. You can set the
+ * previous text, by using the 'prev_text' argument. You can set the next text
+ * by setting the 'next_text' argument.
+ *
+ * If the 'show_all' argument is set to true, then it will show all of the pages
+ * instead of a short list of the pages near the current page. By default, the
+ * 'show_all' is set to false and controlled by the 'end_size' and 'mid_size'
+ * arguments. The 'end_size' argument is how many numbers on either the start
+ * and the end list edges, by default is 1. The 'mid_size' argument is how many
+ * numbers to either side of current page, but not including current page.
+ *
+ * It is possible to add query vars to the link by using the 'add_args' argument
+ * and see {@link add_query_arg()} for more information.
+ *
+ * @since 1.0
+ *
+ * @param string|array $args Optional. Override defaults.
+ * @return array|string String of page links or array of page links.
+ */
+function bb_paginate_links( $args = '' ) {
+	$defaults = array(
+		'base'         => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
+		'format'       => '?page=%#%', // ?page=%#% : %#% is replaced by the page number
+		'total'        => 1,
+		'current'      => 0,
+		'show_all'     => false,
+		'prev_next'    => true,
+		'prev_text'    => __( '&laquo; Previous' ),
+		'next_text'    => __( 'Next &raquo;' ),
+		'end_size'     => 1, // How many numbers on either end including the end
+		'mid_size'     => 2, // How many numbers to either side of current not including current
+		'type'         => 'plain',
+		'add_args'     => false, // array of query args to add
+		'add_fragment' => '',
+		'n_title'      => __( 'Page %d' ), // Not from WP version
+		'prev_title'   => __( 'Previous page' ), // Not from WP version
+		'next_title'   => __( 'Next page' ) // Not from WP version
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	// Who knows what else people pass in $args
+	$total = (int) $total;
+	if ( $total < 2 )
+		return;
+	$current  = (int) $current;
+	$end_size = 0 < (int) $end_size ? (int) $end_size : 1; // Out of bounds?  Make it the default.
+	$mid_size = 0 <= (int) $mid_size ? (int) $mid_size : 2;
+	$add_args = is_array($add_args) ? $add_args : false;
+	$r = '';
+	$page_links = array();
+	$n = 0;
+	$dots = false;
+
+	$empty_format = '';
+	if ( strpos( $format, '?' ) === 0 ) {
+		$empty_format = '?';
+	}
+
+	if ( $prev_next && $current && 1 < $current ) {
+		$link = str_replace( '%_%', 2 == $current ? $empty_format : $format, $base );
+		$link = str_replace( '%#%', $current - 1, $link );
+		$link = str_replace( '?&', '?', $link );
+		if ( $add_args )
+			$link = add_query_arg( $add_args, $link );
+		$link .= $add_fragment;
+		$page_links[] = '<a class="prev page-numbers" href="' . esc_url( $link ) . '" title="' . esc_attr( $prev_title ) . '">' . $prev_text . '</a>';
+	}
+
+	for ( $n = 1; $n <= $total; $n++ ) {
+		if ( $n == $current ) {
+			$n_display = bb_number_format_i18n( $n );
+			$n_display_title =  esc_attr( sprintf( $n_title, $n ) );
+			$page_links[] = '<span class="page-numbers current" title="' . $n_display_title . '">' . $n_display . '</span>';
+			$dots = true;
+		} else {
+			if ( $show_all || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) {
+				$n_display = bb_number_format_i18n( $n );
+				$n_display_title =  esc_attr( sprintf( $n_title, $n ) );
+				$link = str_replace( '%_%', 1 == $n ? $empty_format : $format, $base );
+				$link = str_replace( '%#%', $n, $link );
+				$link = str_replace( '?&', '?', $link );
+				if ( $add_args )
+					$link = add_query_arg( $add_args, $link );
+				$link .= $add_fragment;
+				$page_links[] = '<a class="page-numbers" href="' . esc_url( $link ) . '" title="' . $n_display_title . '">' . $n_display . '</a>';
+				$dots = true;
+			} elseif ( $dots && !$show_all ) {
+				$page_links[] = '<span class="page-numbers dots">&hellip;</span>';
+				$dots = false;
+			}
+		}
+	}
+	if ( $prev_next && $current && ( $current < $total || -1 == $total ) ) {
+		$link = str_replace( '%_%', $format, $base );
+		$link = str_replace( '%#%', $current + 1, $link );
+		if ( $add_args )
+			$link = add_query_arg( $add_args, $link );
+		$link .= $add_fragment;
+		$page_links[] = '<a class="next page-numbers" href="' . esc_url( $link ) . '" title="' . esc_attr( $next_title ) . '">' . $next_text . '</a>';
+	}
+	switch ( $type ) {
+		case 'array':
+			return $page_links;
+			break;
+		case 'list':
+			$r .= '<ul class="page-numbers">' . "\n\t" . '<li>';
+			$r .= join( '</li>' . "\n\t" . '<li>', $page_links );
+			$r .= '</li>' . "\n" . '</ul>' . "\n";
+			break;
+		default:
+			$r = join( "\n", $page_links );
+			break;
+	}
+	return $r;
+}
+
+function bb_get_uri_page() {
+	if ( isset($_GET['page']) && is_numeric($_GET['page']) && 1 < (int) $_GET['page'] )
+		return (int) $_GET['page'];
+
+	if ( isset($_SERVER['PATH_INFO']) )
+		$path = $_SERVER['PATH_INFO'];
+	else
+		if ( !$path = strtok($_SERVER['REQUEST_URI'], '?') )
+			return 1;
+
+	if ( preg_match( '/^\/([0-9]+)\/?$/', $path, $matches ) ) {
+		$page = (int) $matches[1];
+		if ( 1 < $page ) {
+			return $page;
+		}
+	}
+
+	if ( $page = strstr($path, '/page/') ) {
+		$page = (int) substr($page, 6);
+		if ( 1 < $page )
+			return $page;
+	}
+	return 1;
+}
+
+//expects $item = 1 to be the first, not 0
+function bb_get_page_number( $item, $per_page = 0 ) {
+	if ( !$per_page )
+		$per_page = bb_get_option('page_topics');
+	return intval( ceil( $item / $per_page ) ); // page 1 is the first page
+}
+
+
+
+/* Time */
+
+function bb_timer_stop($display = 0, $precision = 3) { //if called like bb_timer_stop(1), will echo $timetotal
+	global $bb_timestart, $timeend;
+	$mtime = explode(' ', microtime());
+	$timeend = $mtime[1] + $mtime[0];
+	$timetotal = $timeend - $bb_timestart;
+	if ($display)
+		echo bb_number_format_i18n($timetotal, $precision);
+	return bb_number_format_i18n($timetotal, $precision);
+}
+
+// GMT -> so many minutes ago
+function bb_since( $original, $do_more = 0 ) {
+	$today = time();
+
+	if ( !is_numeric($original) ) {
+		if ( $today < $_original = bb_gmtstrtotime( str_replace(',', ' ', $original) ) ) // Looks like bb_since was called twice
+			return $original;
+		else
+			$original = $_original;
+	}
+		
+	// array of time period chunks
+	$chunks = array(
+		( 60 * 60 * 24 * 365 ), // years
+		( 60 * 60 * 24 * 30 ),  // months
+		( 60 * 60 * 24 * 7 ),   // weeks
+		( 60 * 60 * 24 ),       // days
+		( 60 * 60 ),            // hours
+		( 60 ),                 // minutes
+		( 1 )                   // seconds
+	);
+
+	$since = $today - $original;
+
+	for ($i = 0, $j = count($chunks); $i < $j; $i++) {
+		$seconds = $chunks[$i];
+
+		if ( 0 != $count = floor($since / $seconds) )
+			break;
+	}
+
+	$trans = array(
+		_n( '%d year', '%d years', $count ),
+		_n( '%d month', '%d months', $count ),
+		_n( '%d week', '%d weeks', $count ),
+		_n( '%d day', '%d days', $count ),
+		_n( '%d hour', '%d hours', $count ),
+		_n( '%d minute', '%d minutes', $count ),
+		_n( '%d second', '%d seconds', $count )
+	);
+
+	$print = sprintf( $trans[$i], $count );
+
+	if ( $do_more && $i + 1 < $j) {
+		$seconds2 = $chunks[$i + 1];
+		if ( 0 != $count2 = floor( ($since - $seconds * $count) / $seconds2) )
+			$print .= sprintf( $trans[$i + 1], $count2 );
+	}
+	return $print;
+}
+
+function bb_current_time( $type = 'timestamp' ) {
+	return current_time( $type, true );
+}
+
+// GMT -> Local
+// in future versions this could eaily become a user option.
+function bb_offset_time( $time, $args = null ) {
+	if ( isset($args['format']) && 'since' == $args['format'] )
+		return $time;
+	if ( !is_numeric($time) ) {
+		if ( -1 !== $_time = bb_gmtstrtotime( $time ) )
+			return gmdate('Y-m-d H:i:s', $_time + bb_get_option( 'gmt_offset' ) * 3600);
+		else
+			return $time; // Perhaps should return -1 here
+	} else {
+		return $time + bb_get_option( 'gmt_offset' ) * 3600;
+	}
+}
+
+
+
+/* Permalinking / URLs / Paths */
+
+/**
+ * BB_URI_CONTEXT_* - Bitwise definitions for bb_uri() and bb_get_uri() contexts
+ *
+ * @since 1.0
+ */
+define( 'BB_URI_CONTEXT_NONE',                 0 );
+define( 'BB_URI_CONTEXT_HEADER',               1 );
+define( 'BB_URI_CONTEXT_TEXT',                 2 );
+define( 'BB_URI_CONTEXT_A_HREF',               4 );
+define( 'BB_URI_CONTEXT_FORM_ACTION',          8 );
+define( 'BB_URI_CONTEXT_IMG_SRC',              16 );
+define( 'BB_URI_CONTEXT_LINK_STYLESHEET_HREF', 32 );
+define( 'BB_URI_CONTEXT_LINK_ALTERNATE_HREF',  64 );
+define( 'BB_URI_CONTEXT_LINK_OTHER',           128 );
+define( 'BB_URI_CONTEXT_SCRIPT_SRC',           256 );
+define( 'BB_URI_CONTEXT_IFRAME_SRC',           512 );
+define( 'BB_URI_CONTEXT_BB_FEED',              1024 );
+define( 'BB_URI_CONTEXT_BB_USER_FORMS',        2048 );
+define( 'BB_URI_CONTEXT_BB_ADMIN',             4096 );
+define( 'BB_URI_CONTEXT_BB_XMLRPC',            8192 );
+define( 'BB_URI_CONTEXT_WP_HTTP_REQUEST',      16384 );
+//define( 'BB_URI_CONTEXT_*',                    32768 );  // Reserved for future definitions
+//define( 'BB_URI_CONTEXT_*',                    65536 );  // Reserved for future definitions
+//define( 'BB_URI_CONTEXT_*',                    131072 ); // Reserved for future definitions
+//define( 'BB_URI_CONTEXT_*',                    262144 ); // Reserved for future definitions
+define( 'BB_URI_CONTEXT_AKISMET',              524288 );
+
+/**
+ * Echo a URI based on the URI setting
+ *
+ * @since 1.0
+ *
+ * @param $resource string The directory, may include a querystring
+ * @param $query mixed The query arguments as a querystring or an associative array
+ * @param $context integer The context of the URI, use BB_URI_CONTEXT_*
+ * @return void
+ */
+function bb_uri( $resource = null, $query = null, $context = BB_URI_CONTEXT_A_HREF )
+{
+	echo apply_filters( 'bb_uri', bb_get_uri( $resource, $query, $context ), $resource, $query, $context );
+}
+
+/**
+ * Return a URI based on the URI setting
+ *
+ * @since 1.0
+ *
+ * @param $resource string The directory, may include a querystring
+ * @param $query mixed The query arguments as a querystring or an associative array
+ * @param $context integer The context of the URI, use BB_URI_CONTEXT_*
+ * @return string The complete URI
+ */
+function bb_get_uri( $resource = null, $query = null, $context = BB_URI_CONTEXT_A_HREF )
+{
+	// If there is a querystring in the resource then extract it
+	if ( $resource && strpos( $resource, '?' ) !== false ) {
+		list( $_resource, $_query ) = explode( '?', trim( $resource ), 2 );
+		$resource = $_resource;
+		$_query = wp_parse_args( $_query );
+	} else {
+		// Make sure $_query is an array for array_merge()
+		$_query = array();
+	}
+
+	// $query can be an array as well as a string
+	if ( $query ) {
+		if ( is_string( $query ) ) {
+			$query = ltrim( trim( $query ), '?' );
+		}
+		$query = wp_parse_args( $query );
+	}
+
+	// Make sure $query is an array for array_merge()
+	if ( !$query ) {
+		$query = array();
+	}
+
+	// Merge the queries into a single array
+	$query = array_merge( $_query, $query );
+
+	// Make sure context is an integer
+	if ( !$context || !is_integer( $context ) ) {
+		$context = BB_URI_CONTEXT_A_HREF;
+	}
+
+	// Get the base URI
+	static $_uri;
+	if( !isset( $_uri ) ) {
+		$_uri = bb_get_option( 'uri' );
+	}
+	$uri = $_uri;
+
+	// Use https?
+	if (
+		( ( $context & BB_URI_CONTEXT_BB_USER_FORMS ) && force_ssl_login() ) // Force https when required on user forms
+	||
+		( ( $context & BB_URI_CONTEXT_BB_ADMIN ) && force_ssl_admin() ) // Force https when required in admin
+	) {
+		static $_uri_ssl;
+		if( !isset( $_uri_ssl ) ) {
+			$_uri_ssl = bb_get_option( 'uri_ssl' );
+		}
+		$uri = $_uri_ssl;
+	}
+
+	// Add the directory
+	$uri .= ltrim( $resource, '/' );
+
+	// Add the query string to the URI
+	$uri = add_query_arg( $query, $uri );
+
+	return apply_filters( 'bb_get_uri', $uri, $resource, $context );
+}
+
+/**
+ * Forces redirection to an SSL page when required
+ *
+ * @since 1.0
+ *
+ * @return void
+ */
+function bb_ssl_redirect()
+{
+	$page = bb_get_location();
+
+	do_action( 'bb_ssl_redirect' );
+
+	if ( BB_IS_ADMIN ) {
+		if ( !force_ssl_admin() ) {
+			return;
+		}
+	} else {
+		switch ( $page ) {
+			case 'login-page':
+			case 'register-page':
+				if ( !force_ssl_login() ) {
+					return;
+				}
+				break;
+			case 'profile-page':
+				global $self;
+				if ( $self == 'profile-edit.php' ) {
+					if ( !force_ssl_login() ) {
+						return;
+					}
+				} else {
+					return;
+				}
+				break;
+			default:
+				return;
+				break;
+		}
+	}
+
+	if ( is_ssl() ) {
+		return;
+	}
+
+	$uri_ssl = parse_url( bb_get_option( 'uri_ssl' ) );
+	$uri = $uri_ssl['scheme'] . '://' . $uri_ssl['host'] . $_SERVER['REQUEST_URI'];
+	bb_safe_redirect( $uri );
+	exit;
+}
+
+function bb_get_path( $level = 1, $base = false, $request = false ) {
+	if ( !$request )
+		$request = $_SERVER['REQUEST_URI'];
+	if ( is_string($request) )
+		$request = parse_url($request);
+	if ( !is_array($request) || !isset($request['path']) )
+		return '';
+
+	$path = rtrim($request['path'], " \t\n\r\0\x0B/");
+	if ( !$base )
+		$base = rtrim(bb_get_option('path'), " \t\n\r\0\x0B/");
+	$path = preg_replace('|' . preg_quote($base, '|') . '/?|','',$path,1);
+	if ( !$path )
+		return '';
+	if ( strpos($path, '/') === false )
+		return '';
+
+	$url = explode('/',$path);
+	if ( !isset($url[$level]) )
+		return '';
+
+	return urldecode($url[$level]);
+}
+
+function bb_find_filename( $text ) {
+	if ( preg_match('|.*?/([a-z\-]+\.php)/?.*|', $text, $matches) )
+		return $matches[1];
+	else {
+		$path = bb_get_option( 'path' );
+		$text = preg_replace("#^$path#", '', $text);
+		$text = preg_replace('#/.+$#', '', $text);
+		return $text . '.php';
+	}
+	return false;
+}
+
+function bb_send_headers() {
+	if ( bb_is_user_logged_in() )
+		nocache_headers();
+	@header('Content-Type: ' . bb_get_option( 'html_type' ) . '; charset=' . bb_get_option( 'charset' ));
+	do_action( 'bb_send_headers' );
+}
+
+function bb_pingback_header() {
+	if (bb_get_option('enable_pingback'))
+		@header('X-Pingback: '. bb_get_uri('xmlrpc.php', null, BB_URI_CONTEXT_HEADER + BB_URI_CONTEXT_BB_XMLRPC));
+}
+
+// Inspired by and adapted from Yung-Lung Scott YANG's http://scott.yang.id.au/2005/05/permalink-redirect/ (GPL)
+function bb_repermalink() {
+	global $page;
+	$location = bb_get_location();
+	$uri = $_SERVER['REQUEST_URI'];
+	if ( isset($_GET['id']) )
+		$id = $_GET['id'];
+	else
+		$id = bb_get_path();
+	$_original_id = $id;
+
+	do_action( 'pre_permalink', $id );
+
+	$id = apply_filters( 'bb_repermalink', $id );
+
+	switch ($location) {
+		case 'front-page':
+			$path = null;
+			$querystring = null;
+			if ($page > 1) {
+				if (bb_get_option( 'mod_rewrite' )) {
+					$path = 'page/' . $page;
+				} else {
+					$querystring = array('page' => $page);
+				}
+			}
+			$permalink = bb_get_uri($path, $querystring, BB_URI_CONTEXT_HEADER);
+			$issue_404 = true;
+			break;
+		case 'forum-page':
+			if (empty($id)) {
+				$permalink = bb_get_uri(null, null, BB_URI_CONTEXT_HEADER);
+				break;
+			}
+			global $forum_id, $forum;
+			$forum     = bb_get_forum( $id );
+			$forum_id  = $forum->forum_id;
+			$permalink = get_forum_link( $forum->forum_id, $page );
+			break;
+		case 'topic-edit-page':
+		case 'topic-page':
+			if (empty($id)) {
+				$permalink = bb_get_uri(null, null, BB_URI_CONTEXT_HEADER);
+				break;
+			}
+			global $topic_id, $topic;
+			$topic     = get_topic( $id );
+			$topic_id  = $topic->topic_id;
+			$permalink = get_topic_link( $topic->topic_id, $page );
+			break;
+		case 'profile-page': // This handles the admin side of the profile as well.
+			global $user_id, $user, $profile_hooks, $self;
+			if ( isset($_GET['id']) )
+				$id = $_GET['id'];
+			elseif ( isset($_GET['username']) )
+				$id = $_GET['username'];
+			else
+				$id = bb_get_path();
+			$_original_id = $id;
+			
+			if ( !$id ) {
+				$user = bb_get_current_user(); // Attempt to go to the current users profile
+			} else {
+				if ( bb_get_option( 'mod_rewrite' ) === 'slugs') {
+					$user = bb_get_user_by_nicename( $id ); // Get by the user_nicename
+				} else {
+					$user = bb_get_user( $id ); // Get by the ID
+				}
+			}
+
+			if ( !$user || ( 1 == $user->user_status && !bb_current_user_can( 'moderate' ) ) )
+				bb_die(__('User not found.'), '', 404);
+
+			$user_id = $user->ID;
+			bb_global_profile_menu_structure();
+			$valid = false;
+			if ( $tab = isset($_GET['tab']) ? $_GET['tab'] : bb_get_path(2) ) {
+				foreach ( $profile_hooks as $valid_tab => $valid_file ) {
+					if ( $tab == $valid_tab ) {
+						$valid = true;
+						$self = $valid_file;
+					}
+				}
+			}
+			if ( $valid ) {
+				$permalink = get_profile_tab_link( $user->ID, $tab, $page );
+			} else {
+				$permalink = get_user_profile_link( $user->ID, $page );
+				unset($self, $tab);
+			}
+			break;
+		case 'favorites-page':
+			$permalink = get_favorites_link();
+			break;
+		case 'tag-page': // It's not an integer and tags.php pulls double duty.
+			if ( isset($_GET['tag']) )
+				$id = $_GET['tag'];
+			$_original_id = $id;
+			if ( !$id )
+				$permalink = bb_get_tag_page_link();
+			else {
+				global $tag, $tag_name;
+				$tag_name = $id;
+				$tag = bb_get_tag( (string) $tag_name );
+				$permalink = bb_get_tag_link( 0, $page ); // 0 => grabs $tag from global.
+			}
+			break;
+		case 'view-page': // Not an integer
+			if ( isset($_GET['view']) )
+				$id = $_GET['view'];
+			else
+				$id = bb_get_path();
+			$_original_id = $id;
+			global $view;
+			$view = $id;
+			$permalink = get_view_link( $view, $page );
+			break;
+		default:
+			return;
+			break;
+	}
+	
+	wp_parse_str($_SERVER['QUERY_STRING'], $args);
+	$args = urlencode_deep($args);
+	if ( $args ) {
+		$permalink = add_query_arg($args, $permalink);
+		if ( bb_get_option('mod_rewrite') ) {
+			$pretty_args = array('id', 'page', 'tag', 'tab', 'username'); // these are already specified in the path
+			if ( $location == 'view-page' )
+				$pretty_args[] = 'view';
+			foreach ( $pretty_args as $pretty_arg )
+				$permalink = remove_query_arg( $pretty_arg, $permalink );
+		}
+	}
+
+	$permalink = apply_filters( 'bb_repermalink_result', $permalink, $location );
+
+	$domain = bb_get_option('domain');
+	$domain = preg_replace('/^https?/', '', $domain);
+	$check = preg_replace( '|^.*' . trim($domain, ' /' ) . '|', '', $permalink, 1 );
+	$uri = rtrim( $uri, " \t\n\r\0\x0B?" );
+	$uri = str_replace( '/index.php', '/', $uri );
+
+	global $bb_log;
+	$bb_log->debug($uri, 'bb_repermalink() ' . __('REQUEST_URI'));
+	$bb_log->debug($check, 'bb_repermalink() ' . __('should be'));
+	$bb_log->debug($permalink, 'bb_repermalink() ' . __('full permalink'));
+	$bb_log->debug($_SERVER['PATH_INFO'], 'bb_repermalink() ' . __('PATH_INFO'));
+
+	if ( $check != $uri && $check != str_replace(urlencode($_original_id), $_original_id, $uri) ) {
+		if ( $issue_404 && rtrim( $check, " \t\n\r\0\x0B/" ) !== rtrim( $uri, " \t\n\r\0\x0B/" ) ) {
+			status_header( 404 );
+			bb_load_template( '404.php' );
+		} else {
+			wp_redirect( $permalink );
+		}
+		exit;
+	}
+
+	do_action( 'post_permalink', $permalink );
+}
+
+/* Profile/Admin */
+
+function bb_global_profile_menu_structure() {
+	global $user_id, $profile_menu, $profile_hooks;
+	// Menu item name
+	// The capability required for own user to view the tab ('' to allow non logged in access)
+	// The capability required for other users to view the tab ('' to allow non logged in access)
+	// The URL of the item's file
+	// Item name for URL (nontranslated)
+	$profile_menu[0] = array(__('Edit'), 'edit_profile', 'edit_users', 'profile-edit.php', 'edit');
+	$profile_menu[5] = array(__('Favorites'), '', '', 'favorites.php', 'favorites');
+
+	// Create list of page plugin hook names the current user can access
+	$profile_hooks = array();
+	foreach ($profile_menu as $profile_tab)
+		if ( bb_can_access_tab( $profile_tab, bb_get_current_user_info( 'id' ), $user_id ) )
+			$profile_hooks[bb_sanitize_with_dashes($profile_tab[4])] = $profile_tab[3];
+
+	do_action('bb_profile_menu');
+	ksort($profile_menu);
+}
+
+function bb_add_profile_tab($tab_title, $users_cap, $others_cap, $file, $arg = false) {
+	global $profile_menu, $profile_hooks, $user_id;
+
+	$arg = $arg ? $arg : $tab_title;
+
+	$profile_tab = array($tab_title, $users_cap, $others_cap, $file, $arg);
+	$profile_menu[] = $profile_tab;
+	if ( bb_can_access_tab( $profile_tab, bb_get_current_user_info( 'id' ), $user_id ) )
+		$profile_hooks[bb_sanitize_with_dashes($arg)] = $file;
+}
+
+function bb_can_access_tab( $profile_tab, $viewer_id, $owner_id ) {
+	global $bb_current_user;
+	$viewer_id = (int) $viewer_id;
+	$owner_id = (int) $owner_id;
+	if ( $viewer_id == bb_get_current_user_info( 'id' ) )
+		$viewer =& $bb_current_user;
+	else
+		$viewer = new BP_User( $viewer_id );
+	if ( !$viewer )
+		return '' === $profile_tab[2];
+
+	if ( $owner_id == $viewer_id ) {
+		if ( '' === $profile_tab[1] )
+			return true;
+		else
+			return $viewer->has_cap($profile_tab[1]);
+	} else {
+		if ( '' === $profile_tab[2] )
+			return true;
+		else
+			return $viewer->has_cap($profile_tab[2]);
+	}
+}
+
+//meta_key => (required?, Label, hCard property).  Don't use user_{anything} as the name of your meta_key.
+function bb_get_profile_info_keys( $context = null ) {
+	return apply_filters( 'get_profile_info_keys', array(
+		'first_name' => array(0, __('First name')),
+		'last_name' => array(0, __('Last name')),
+		'display_name' => array(1, __('Display name as')),
+		'user_email' => array(1, __('Email'), 'email'),
+		'user_url' => array(0, __('Website'), 'url'),
+		'from' => array(0, __('Location')),
+		'occ' => array(0, __('Occupation'), 'role'),
+		'interest' => array(0, __('Interests')),
+	), $context );
+}
+
+function bb_get_profile_admin_keys( $context = null ) {
+	global $bbdb;
+	return apply_filters( 'get_profile_admin_keys', array(
+		$bbdb->prefix . 'title' => array(0, __('Custom Title'))
+	), $context );
+}
+
+function bb_get_assignable_caps() {
+	$caps = array();
+	if ( $throttle_time = bb_get_option( 'throttle_time' ) )
+		$caps['throttle'] = sprintf( __('Ignore the %d second post throttling limit'), $throttle_time );
+	return apply_filters( 'get_assignable_caps', $caps );
+}
+
+/* Views */
+
+function bb_get_views() {
+	global $bb_views;
+
+	$views = array();
+	foreach ( (array) $bb_views as $view => $array )
+		$views[$view] = $array['title'];
+
+	return $views;
+}
+
+function bb_register_view( $view, $title, $query_args = '', $feed = TRUE ) {
+	global $bb_views;
+
+	$view  = bb_slug_sanitize( $view );
+	$title = esc_html( $title );
+
+	if ( !$view || !$title )
+		return false;
+
+	$query_args = wp_parse_args( $query_args );
+
+	if ( !$sticky_set = isset($query_args['sticky']) )
+		$query_args['sticky'] = 'no';
+
+	$bb_views[$view]['title']  = $title;
+	$bb_views[$view]['query']  = $query_args;
+	$bb_views[$view]['sticky'] = !$sticky_set; // No sticky set => split into stickies and not
+	$bb_views[$view]['feed'] = $feed;
+	return $bb_views[$view];
+}
+
+function bb_deregister_view( $view ) {
+	global $bb_views;
+
+	$view = bb_slug_sanitize( $view );
+	if ( !isset($bb_views[$view]) )
+		return false;
+
+	unset($GLOBALS['bb_views'][$view]);
+	return true;
+}
+
+function bb_view_query( $view, $new_args = '' ) {
+	global $bb_views;
+
+	$view = bb_slug_sanitize( $view );
+	if ( !isset($bb_views[$view]) )
+		return false;
+
+	if ( $new_args ) {
+		$new_args = wp_parse_args( $new_args );
+		$query_args = array_merge( $bb_views[$view]['query'], $new_args );
+	} else {
+		$query_args = $bb_views[$view]['query'];
+	}
+
+	return new BB_Query( 'topic', $query_args, "bb_view_$view" );
+}
+
+function bb_get_view_query_args( $view ) {
+	global $bb_views;
+
+	$view = bb_slug_sanitize( $view );
+	if ( !isset($bb_views[$view]) )
+		return false;
+
+	return $bb_views[$view]['query'];
+}
+
+function bb_register_default_views() {
+	// no posts (besides the first one), older than 2 hours
+	bb_register_view( 'no-replies', __('Topics with no replies'), array( 'post_count' => 1, 'started' => '<' . gmdate( 'YmdH', time() - 7200 ) ) );
+	bb_register_view( 'untagged'  , __('Topics with no tags')   , array( 'tag_count'  => 0 ) );
+}
+
+/* Feeds */
+
+/**
+ * Send status headers for clients supporting Conditional Get
+ *
+ * The function sends the Last-Modified and ETag headers for all clients. It
+ * then checks both the If-None-Match and If-Modified-Since headers to see if
+ * the client has used them. If so, and the ETag does matches the client ETag
+ * or the last modified date sent by the client is newer or the same as the
+ * generated last modified, the function sends a 304 Not Modified and exits.
+ *
+ * @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3
+ * @param string $bb_last_modified Last modified time. Must be a HTTP-date
+ */
+function bb_send_304( $bb_last_modified ) {
+	$bb_etag = '"' . md5($bb_last_modified) . '"';
+	@header("Last-Modified: $bb_last_modified");
+	@header("ETag: $bb_etag");
+
+	// Support for Conditional GET
+	if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) $client_etag = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']);
+	else $client_etag = false;
+
+	$client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE']);
+	// If string is empty, return 0. If not, attempt to parse into a timestamp
+	$client_modified_timestamp = $client_last_modified ? bb_gmtstrtotime($client_last_modified) : 0;
+
+	// Make a timestamp for our most recent modification...	
+	$bb_modified_timestamp = bb_gmtstrtotime($bb_last_modified);
+
+	if ( ($client_last_modified && $client_etag) ?
+		 (($client_modified_timestamp >= $bb_modified_timestamp) && ($client_etag == $bb_etag)) :
+		 (($client_modified_timestamp >= $bb_modified_timestamp) || ($client_etag == $bb_etag)) ) {
+		status_header( 304 );
+		exit;
+	}
+}
+
+/* Nonce */
+
+/**
+ * Retrieve URL with nonce added to URL query.
+ *
+ * @package bbPress
+ * @subpackage Security
+ * @since 1.0
+ *
+ * @param string $actionurl URL to add nonce action
+ * @param string $action Optional. Nonce action name
+ * @return string URL with nonce action added.
+ */
+function bb_nonce_url( $actionurl, $action = -1 ) {
+	$actionurl = str_replace( '&amp;', '&', $actionurl );
+	$nonce = bb_create_nonce( $action );
+	return esc_html( add_query_arg( '_wpnonce', $nonce, $actionurl ) );
+}
+
+/**
+ * Retrieve or display nonce hidden field for forms.
+ *
+ * The nonce field is used to validate that the contents of the form came from
+ * the location on the current site and not somewhere else. The nonce does not
+ * offer absolute protection, but should protect against most cases. It is very
+ * important to use nonce field in forms.
+ *
+ * If you set $echo to true and set $referer to true, then you will need to
+ * retrieve the {@link wp_referer_field() wp referer field}. If you have the
+ * $referer set to true and are echoing the nonce field, it will also echo the
+ * referer field.
+ *
+ * The $action and $name are optional, but if you want to have better security,
+ * it is strongly suggested to set those two parameters. It is easier to just
+ * call the function without any parameters, because validation of the nonce
+ * doesn't require any parameters, but since crackers know what the default is
+ * it won't be difficult for them to find a way around your nonce and cause
+ * damage.
+ *
+ * The input name will be whatever $name value you gave. The input value will be
+ * the nonce creation value.
+ *
+ * @package bbPress
+ * @subpackage Security
+ * @since 1.0
+ *
+ * @param string $action Optional. Action name.
+ * @param string $name Optional. Nonce name.
+ * @param bool $referer Optional, default true. Whether to set the referer field for validation.
+ * @param bool $echo Optional, default true. Whether to display or return hidden form field.
+ * @return string Nonce field.
+ */
+function bb_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) {
+	$name = esc_attr( $name );
+	$nonce = bb_create_nonce( $action );
+	$nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . $nonce . '" />';
+	if ( $echo )
+		echo $nonce_field;
+
+	if ( $referer )
+		wp_referer_field( $echo, 'previous' );
+
+	return $nonce_field;
+}
+
+function bb_nonce_ays( $action )
+{
+	$title = __( 'bbPress Failure Notice' );
+	$html .= "\t<div id='message' class='updated fade'>\n\t<p>" . esc_html( bb_explain_nonce( $action ) ) . "</p>\n\t<p>";
+	if ( wp_get_referer() )
+		$html .= "<a href='" . remove_query_arg( 'updated', esc_url( wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
+	$html .= "</p>\n\t</div>\n";
+	$html .= "</body>\n</html>";
+	bb_die( $html, $title );
+}
+
+function bb_install_header( $title = '', $header = false, $logo = false )
+{
+	if ( empty($title) )
+		if ( function_exists('__') )
+			$title = __('bbPress');
+		else
+			$title = 'bbPress';
+		
+		$uri = false;
+		if ( function_exists('bb_get_uri') && !BB_INSTALLING ) {
+			$uri = bb_get_uri();
+			$uri_stylesheet = bb_get_uri('bb-admin/install.css', null, BB_URI_CONTEXT_LINK_STYLESHEET_HREF + BB_URI_CONTEXT_BB_INSTALLER);
+			$uri_stylesheet_rtl = bb_get_uri('bb-admin/install-rtl.css', null, BB_URI_CONTEXT_LINK_STYLESHEET_HREF + BB_URI_CONTEXT_BB_INSTALLER);
+			$uri_logo = bb_get_uri('bb-admin/images/bbpress-logo.png', null, BB_URI_CONTEXT_IMG_SRC + BB_URI_CONTEXT_BB_INSTALLER);
+		}
+		
+		if (!$uri) {
+			$uri = preg_replace('|(/bb-admin)?/[^/]+?$|', '/', $_SERVER['PHP_SELF']);
+			$uri_stylesheet = $uri . 'bb-admin/install.css';
+			$uri_stylesheet_rtl = $uri . 'bb-admin/install-rtl.css';
+			$uri_logo = $uri . 'bb-admin/images/bbpress-logo.png';
+		}
+	
+	header('Content-Type: text/html; charset=utf-8');
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( function_exists( 'bb_language_attributes' ) ) bb_language_attributes(); ?>>
+<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<title><?php echo $title; ?></title>
+	<meta name="robots" content="noindex, nofollow" />
+	<link rel="stylesheet" href="<?php echo $uri_stylesheet; ?>" type="text/css" />
+<?php
+	if ( function_exists( 'bb_get_option' ) && 'rtl' == bb_get_option( 'text_direction' ) ) {
+?>
+	<link rel="stylesheet" href="<?php echo $uri_stylesheet_rtl; ?>" type="text/css" />
+<?php
+	}
+?>
+</head>
+<body>
+	<div id="container">
+<?php
+	if ( $logo ) {
+?>
+		<div class="logo">
+			<img src="<?php echo $uri_logo; ?>" alt="bbPress" />
+		</div>
+<?php
+	}
+
+	if ( !empty($header) ) {
+?>
+		<h1>
+			<?php echo $header; ?>
+		</h1>
+<?php
+	}
+}
+
+function bb_install_footer() {
+?>
+	</div>
+</body>
+</html>
+<?php
+}
+
+function bb_die( $message, $title = '', $header = 0 ) {
+	global $bb_locale;
+
+	if ( $header && !headers_sent() )
+		status_header( $header );
+
+	if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
+		if ( empty( $title ) ) {
+			$error_data = $message->get_error_data();
+			if ( is_array( $error_data ) && isset( $error_data['title'] ) )
+				$title = $error_data['title'];
+		}
+		$errors = $message->get_error_messages();
+		switch ( count( $errors ) ) :
+		case 0 :
+			$message = '';
+			break;
+		case 1 :
+			$message = "<p>{$errors[0]}</p>";
+			break;
+		default :
+			$message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $errors ) . "</li>\n\t</ul>";
+			break;
+		endswitch;
+	} elseif ( is_string( $message ) ) {
+		$message = "<p>$message</p>";
+	}
+
+	if ( empty($title) )
+		$title = __('bbPress &rsaquo; Error');
+	
+	bb_install_header( $title );
+?>
+	<p><?php echo $message; ?></p>
+<?php
+	if ($uri = bb_get_uri()) {
+?>
+	<p class="last"><?php printf( __('Back to <a href="%s">%s</a>.'), $uri, bb_get_option( 'name' ) ); ?></p>
+<?php
+	}
+	bb_install_footer();
+	die();
+}
+
+function bb_explain_nonce($action) {
+	if ( $action !== -1 && preg_match('/([a-z]+)-([a-z]+)(_(.+))?/', $action, $matches) ) {
+		$verb = $matches[1];
+		$noun = $matches[2];
+
+		$trans = array();
+		$trans['create']['post'] = array(__('Your attempt to submit this post has failed.'), false);
+		$trans['edit']['post'] = array(__('Your attempt to edit this post has failed.'), false);
+		$trans['delete']['post'] = array(__('Your attempt to delete this post has failed.'), false);
+
+		$trans['create']['topic'] = array(__('Your attempt to create this topic has failed.'), false);
+		$trans['resolve']['topic'] = array(__('Your attempt to change the resolution status of this topic has failed.'), false);
+		$trans['delete']['topic'] = array(__('Your attempt to delete this topic has failed.'), false);
+		$trans['close']['topic'] = array(__('Your attempt to change the status of this topic has failed.'), false);
+		$trans['stick']['topic'] = array(__('Your attempt to change the sticky status of this topic has failed.'), false);
+		$trans['move']['topic'] = array(__('Your attempt to move this topic has failed.'), false);
+
+		$trans['add']['tag'] = array(__('Your attempt to add this tag to this topic has failed.'), false);
+		$trans['rename']['tag'] = array(__('Your attempt to rename this tag has failed.'), false);
+		$trans['merge']['tag'] = array(__('Your attempt to submit these tags has failed.'), false);
+		$trans['destroy']['tag'] = array(__('Your attempt to destroy this tag has failed.'), false);
+		$trans['remove']['tag'] = array(__('Your attempt to remove this tag from this topic has failed.'), false);
+
+		$trans['toggle']['favorite'] = array(__('Your attempt to toggle your favorite status for this topic has failed.'), false);
+
+		$trans['edit']['profile'] = array(__("Your attempt to edit this user's profile has failed."), false);
+
+		$trans['add']['forum'] = array(__("Your attempt to add this forum has failed."), false);
+		$trans['update']['forums'] = array(__("Your attempt to update your forums has failed."), false);
+		$trans['delete']['forums'] = array(__("Your attempt to delete that forum has failed."), false);
+
+		$trans['do']['counts'] = array(__("Your attempt to recount these items has failed."), false);
+
+		$trans['switch']['theme'] = array(__("Your attempt to switch themes has failed."), false);
+
+		if ( isset($trans[$verb][$noun]) ) {
+			if ( !empty($trans[$verb][$noun][1]) ) {
+				$lookup = $trans[$verb][$noun][1];
+				$object = $matches[4];
+				if ( 'use_id' != $lookup )
+					$object = call_user_func($lookup, $object);
+				return sprintf($trans[$verb][$noun][0], esc_html( $object ));
+			} else {
+				return $trans[$verb][$noun][0];
+			}
+		}
+	}
+
+	return apply_filters( 'bb_explain_nonce_' . $verb . '-' . $noun, __('Your attempt to do this has failed.'), $matches[4] );
+}
+
+/* DB Helpers */
+
+function bb_count_last_query( $query = '' ) {
+	global $bbdb, $bb_last_countable_query;
+
+	if ( $query )
+		$q = $query;
+	elseif ( $bb_last_countable_query )
+		$q = $bb_last_countable_query;
+	else
+		$q = $bbdb->last_query;
+
+	if ( false === strpos($q, 'SELECT') )
+		return false;
+
+	if ( false !== strpos($q, 'SQL_CALC_FOUND_ROWS') )
+		return (int) $bbdb->get_var( "SELECT FOUND_ROWS()" );
+
+	$q_original = $q;
+
+	$q = preg_replace(
+		array('/SELECT.*?\s+FROM/', '/LIMIT [0-9]+(\s*,\s*[0-9]+)?/', '/ORDER BY\s+.*$/', '/DESC/', '/ASC/'),
+		array('SELECT COUNT(*) FROM', ''),
+		$q
+	);
+
+	if ( preg_match( '/GROUP BY\s+(\S+)/', $q, $matches ) )
+		$q = str_replace( array( 'COUNT(*)', $matches[0] ), array( "COUNT(DISTINCT $matches[1])", '' ), $q );
+
+	if ( !$query )
+		$bb_last_countable_query = '';
+
+	$q = apply_filters( 'bb_count_last_query', $q, $q_original );
+
+	return (int) $bbdb->get_var($q);
+}
+
+function bb_no_where( $where ) {
+	return;
+}
+
+/* Plugins/Themes utility */
+
+function bb_basename( $file, $directories )
+{
+	if ( strpos( $file, '#' ) !== false ) {
+		return $file; // It's already a basename
+	}
+
+	foreach ( $directories as $type => $directory ) {
+		if ( strpos( $file, $directory ) !== false ) {
+			break; // Keep the $file and $directory set and use them below, nifty huh?
+		}
+	}
+
+	list( $file, $directory ) = str_replace( '\\','/', array( $file, $directory ) );
+	list( $file, $directory ) = preg_replace( '|/+|','/', array( $file,$directory ) );
+	$file = preg_replace( '|^.*' . preg_quote( $directory, '|' ) . '|', $type . '#', $file );
+
+	return $file;
+}
+
+/* Plugins */
+
+function bb_plugin_basename( $file )
+{
+	global $bb;
+	$directories = array();
+	foreach ( $bb->plugin_locations as $_name => $_data ) {
+		$directories[$_name] = $_data['dir'];
+	}
+	return bb_basename( $file, $directories );
+}
+
+function bb_register_plugin_activation_hook( $file, $function )
+{
+	$file = bb_plugin_basename( $file );
+	add_action( 'bb_activate_plugin_' . $file, $function );
+}
+
+function bb_register_plugin_deactivation_hook( $file, $function )
+{
+	$file = bb_plugin_basename( $file );
+	add_action( 'bb_deactivate_plugin_' . $file, $function );
+}
+
+function bb_get_plugin_uri( $plugin = false )
+{
+	global $bb;
+	if ( preg_match( '/^([a-z0-9_-]+)#((?:[a-z0-9\/\\_-]+.)+)(php)$/i', $plugin, $_matches ) ) {
+		$plugin_uri = $bb->plugin_locations[$_matches[1]]['url'] . $_matches[2] . $_matches[3];
+		$plugin_uri = dirname( $plugin_uri ) . '/';
+	} else {
+		$plugin_uri = $bb->plugin_locations['core']['url'];
+	}
+	return apply_filters( 'bb_get_plugin_uri', $plugin_uri, $plugin );
+}
+
+function bb_get_plugin_directory( $plugin = false, $path = false )
+{
+	global $bb;
+	if ( preg_match( '/^([a-z0-9_-]+)#((?:[a-z0-9\/\\_-]+.)+)(php)$/i', $plugin, $_matches ) ) {
+		$plugin_directory = $bb->plugin_locations[$_matches[1]]['dir'] . $_matches[2] . $_matches[3];
+		if ( !$path ) {
+			$plugin_directory = dirname( $plugin_directory ) . '/';
+		}
+	} else {
+		$plugin_directory = $bb->plugin_locations['core']['dir'];
+	}
+	return apply_filters( 'bb_get_plugin_directory', $plugin_directory, $plugin, $path );
+}
+
+function bb_get_plugin_path( $plugin = false )
+{
+	$plugin_path = bb_get_plugin_directory( $plugin, true );
+	return apply_filters( 'bb_get_plugin_path', $plugin_path, $plugin );
+}
+
+/* Themes / Templates */
+
+function bb_get_active_theme_directory()
+{
+	return apply_filters( 'bb_get_active_theme_directory', bb_get_theme_directory() );
+}
+
+function bb_get_theme_directory( $theme = false )
+{
+	global $bb;
+	if ( !$theme ) {
+		$theme = bb_get_option( 'bb_active_theme' );
+	}
+	if ( preg_match( '/^([a-z0-9_-]+)#([\.a-z0-9_-]+)$/i', $theme, $_matches ) ) {
+		$theme_directory = $bb->theme_locations[$_matches[1]]['dir'] . $_matches[2] . '/';
+	} else {
+		$theme_directory = BB_DEFAULT_THEME_DIR;
+	}
+	return $theme_directory;
+}
+
+function bb_get_themes()
+{
+	$r = array();
+	global $bb;
+	foreach ( $bb->theme_locations as $_name => $_data ) {
+		if ( $themes_dir = @dir( $_data['dir'] ) ) {
+			while( ( $theme_dir = $themes_dir->read() ) !== false ) {
+				if ( is_file( $_data['dir'] . $theme_dir . '/style.css' ) && is_readable( $_data['dir'] . $theme_dir . '/style.css' ) && '.' != $theme_dir{0} ) {
+					$r[$_name . '#' . $theme_dir] = $_name . '#' . $theme_dir;
+				}
+			}
+		}
+	}
+	ksort( $r );
+	return $r;
+}
+
+function bb_theme_basename( $file )
+{
+	global $bb;
+	$directories = array();
+	foreach ( $bb->theme_locations as $_name => $_data ) {
+		$directories[$_name] = $_data['dir'];
+	}
+	$file = bb_basename( $file, $directories );
+	$file = preg_replace( '|/+.*|', '', $file );
+	return $file;
+}
+
+function bb_register_theme_activation_hook( $file, $function )
+{
+	$file = bb_theme_basename( $file );
+	add_action( 'bb_activate_theme_' . $file, $function );
+}
+
+function bb_register_theme_deactivation_hook( $file, $function )
+{
+	$file = bb_theme_basename( $file );
+	add_action( 'bb_deactivate_theme_' . $file, $function );
+}
+
+/* Search Functions */
+// NOT bbdb::prepared
+function bb_user_search( $args = '' ) {
+	global $bbdb, $bb_last_countable_query;
+
+	if ( $args && is_string( $args ) && false === strpos( $args, '=' ) ) {
+		$args = array( 'query' => $args );
+	}
+
+	$defaults = array(
+		'query' => '',
+		'append_meta' => true,
+		'user_login' => true,
+		'display_name' => true,
+		'user_nicename' => false,
+		'user_url' => true,
+		'user_email' => false,
+		'user_meta' => false,
+		'users_per_page' => false,
+		'page' => false,
+		'roles' => false
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	$query = trim( $query );
+	if ( $query && strlen( preg_replace( '/[^a-z0-9]/i', '', $query ) ) < 3 ) {
+		return new WP_Error( 'invalid-query', __('Your search term was too short') );
+	}
+	$query = $bbdb->escape( $query );
+
+	if ( !$page ) {
+		$page = $GLOBALS['page'];
+	}
+	$page = (int) $page;
+
+	$limit = 0 < (int) $users_per_page ? (int) $users_per_page : bb_get_option( 'page_topics' );
+	if ( 1 < $page ) {
+		$limit = ($limit * ($page - 1)) . ", $limit";
+	}
+
+	$likeit = preg_replace( '/\s+/', '%', like_escape( $query ) );
+
+	$fields = array();
+	foreach ( array( 'user_login', 'display_name', 'user_nicename', 'user_url', 'user_email' ) as $field ) {
+		if ( $$field ) {
+			$fields[] = $field;
+		}
+	}
+
+	if ( $roles ) {
+		$roles = (array) $roles;
+	}
+
+	if ( $roles && !empty( $roles ) && false === $role_user_ids = apply_filters( 'bb_user_search_role_user_ids', false, $roles, $args ) ) {
+		$role_meta_key = $bbdb->escape( $bbdb->prefix . 'capabilities' );
+		$role_sql_terms = array();
+		foreach ( $roles as $role ) {
+			$role_sql_terms[] = "`meta_value` LIKE '%" . $bbdb->escape( like_escape( $role ) ) . "%'";
+		}
+		$role_sql_terms = join( ' OR ', $role_sql_terms );
+		$role_sql = "SELECT `user_id` FROM `$bbdb->usermeta` WHERE `meta_key` = '$role_meta_key' AND ($role_sql_terms);";
+		$role_user_ids = $bbdb->get_col( $role_sql, 0 );
+		if ( is_wp_error( $role_user_ids ) ) {
+			return false;
+		}
+	}
+
+	if ( is_array( $role_user_ids ) && empty( $role_user_ids ) ) {
+		return false;
+	}
+
+	if ( $query && $user_meta && false === $meta_user_ids = apply_filters( 'bb_user_search_meta_user_ids', false, $args ) ) {
+		$meta_sql = "SELECT `user_id` FROM `$bbdb->usermeta` WHERE `meta_value` LIKE ('%$likeit%')";
+		if ( empty( $fields ) ) {
+			$meta_sql .= " LIMIT $limit";
+		}
+		$meta_user_ids = $bbdb->get_col( $meta_sql, 0 );
+		if ( is_wp_error( $meta_user_ids ) ) {
+			$meta_user_ids = false;
+		}
+	}
+
+	$user_ids = array();
+	if ( $role_user_ids && $meta_user_ids ) {
+		$user_ids = array_intersect( (array) $role_user_ids, (array) $meta_user_ids );
+	} elseif ( $role_user_ids ) {
+		$user_ids = (array) $role_user_ids;
+	} elseif ( $meta_user_ids ) {
+		$user_ids = (array) $meta_user_ids;
+	}
+
+	$sql = "SELECT * FROM $bbdb->users";
+
+	$sql_terms = array();
+	if ( $query && count( $fields ) ) {
+		foreach ( $fields as $field ) {
+			$sql_terms[] = "$field LIKE ('%$likeit%')";
+		}
+	}
+
+	$user_ids_sql = '';
+	if ( $user_ids ) {
+		$user_ids_sql = "AND ID IN (". join(',', $user_ids) . ")";
+	}
+
+	if ( $query && empty( $sql_terms ) ) {
+		return new WP_Error( 'invalid-query', __( 'Your query parameters are invalid' ) );
+	}
+
+	if ( count( $sql_terms ) || count( $user_ids ) ) {
+		$sql .= ' WHERE ';
+	}
+
+	if ( count( $sql_terms ) ) {
+		$sql .= '(' . implode( ' OR ', $sql_terms ) . ')';
+	}
+
+	if ( count( $sql_terms ) && count( $user_ids ) ) {
+		$sql .= ' AND ';
+	}
+
+	if ( count( $user_ids ) ) {
+		$sql .= '`ID` IN (' . join( ',', $user_ids ) . ')';
+	}
+
+	$sql .= " ORDER BY user_login LIMIT $limit";
+
+	$bb_last_countable_query = $sql;
+
+	do_action( 'bb_user_search', $sql, $args );
+
+	if ( ( $users = $bbdb->get_results( $sql ) ) && $append_meta ) {
+		return bb_append_meta( $users, 'user' );
+	}
+
+	return $users ? $users : false;
+}
+
+function bb_tag_search( $args = '' ) {
+	global $page, $wp_taxonomy_object;
+
+	if ( $args && is_string($args) && false === strpos($args, '=') )
+		$args = array( 'search' => $args );
+
+	$defaults = array( 'search' => '', 'number' => false );
+
+	$args = wp_parse_args( $args );
+	if ( isset( $args['query'] ) )
+		$args['search'] = $args['query'];
+	if ( isset( $args['tags_per_page'] ) )
+		$args['number'] = $args['tags_per_page'];
+	unset($args['query'], $args['tags_per_page']);
+	$args = wp_parse_args( $args, $defaults );
+
+	extract( $args, EXTR_SKIP );
+
+	$number = (int) $number;
+	$search = trim( $search );
+	if ( strlen( $search ) < 3 )
+		return new WP_Error( 'invalid-query', __('Your search term was too short') );
+
+	$number = 0 < $number ? $number : bb_get_option( 'page_topics' );
+	if ( 1 < $page )
+		$offset = ( intval($page) - 1 ) * $number;
+
+	$args = array_merge( $args, compact( 'number', 'offset', 'search' ) );
+
+	$terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag', $args );
+	if ( is_wp_error( $terms ) )
+		return false;
+
+	for ( $i = 0; isset($terms[$i]); $i++ )
+		_bb_make_tag_compat( $terms[$i] );
+
+	return $terms;
+}
+
+
+
+/* Slugs */
+
+function bb_slug_increment( $slug, $existing_slug, $slug_length = 255 ) {
+	if ( preg_match('/^.*-([0-9]+)$/', $existing_slug, $m) )
+		$number = (int) $m[1] + 1;
+	else
+		$number = 1;
+
+	$r = bb_encoded_utf8_cut( $slug, $slug_length - 1 - strlen($number) );
+	return apply_filters( 'bb_slug_increment', "$r-$number", $slug, $existing_slug, $slug_length );
+}
+
+function bb_get_id_from_slug( $table, $slug, $slug_length = 255 ) {
+	global $bbdb;
+	$tablename = $table . 's';
+
+	list($_slug, $sql) = bb_get_sql_from_slug( $table, $slug, $slug_length );
+
+	if ( !$_slug || !$sql )
+		return 0;
+
+	return (int) $bbdb->get_var( "SELECT ${table}_id FROM {$bbdb->$tablename} WHERE $sql" );
+}
+
+function bb_get_sql_from_slug( $table, $slug, $slug_length = 255 ) {
+	global $bbdb;
+
+	// Look for new style equiv of old style slug
+	$_slug = bb_slug_sanitize( (string) $slug );
+	if ( strlen( $_slug ) < 1 )
+		return '';
+
+	if ( strlen($_slug) > $slug_length && preg_match('/^.*-([0-9]+)$/', $_slug, $m) ) {
+		$_slug = bb_encoded_utf8_cut( $_slug, $slug_length - 1 - strlen($number) );
+		$number = (int) $m[1];
+		$_slug =  "$_slug-$number";
+	}
+
+	return array( $_slug, $bbdb->prepare( "${table}_slug = %s", $_slug ) );
+}	
+
+
+
+/* Utility */
+
+function bb_flatten_array( $array, $cut_branch = 0, $keep_child_array_keys = true ) {
+	if ( !is_array($array) )
+		return $array;
+	
+	if ( empty($array) )
+		return null;
+	
+	$temp = array();
+	foreach ( $array as $k => $v ) {
+		if ( $cut_branch && $k == $cut_branch )
+			continue;
+		if ( is_array($v) ) {
+			if ( $keep_child_array_keys ) {
+				$temp[$k] = true;
+			}
+			$temp += bb_flatten_array($v, $cut_branch, $keep_child_array_keys);
+		} else {
+			$temp[$k] = $v;
+		}
+	}
+	return $temp;
+}
+
+function bb_get_common_parts($string1 = false, $string2 = false, $delimiter = '', $reverse = false) {
+	if (!$string1 || !$string2) {
+		return false;
+	}
+	
+	if ($string1 === $string2) {
+		return $string1;
+	}
+	
+	$string1_parts = explode( $delimiter, (string) $string1 );
+	$string2_parts = explode( $delimiter, (string) $string2 );
+	
+	if ($reverse) {
+		$string1_parts = array_reverse( $string1_parts );
+		$string2_parts = array_reverse( $string2_parts );
+		ksort( $string1_parts );
+		ksort( $string2_parts );
+	}
+	
+	$common_parts = array();
+	foreach ( $string1_parts as $index => $part ) {
+		if ( isset( $string2_parts[$index] ) && $string2_parts[$index] == $part ) {
+			$common_parts[] = $part;
+		} else {
+			break;
+		}
+	}
+	
+	if (!count($common_parts)) {
+		return false;
+	}
+	
+	if ($reverse) {
+		$common_parts = array_reverse( $common_parts );
+	}
+	
+	return join( $delimiter, $common_parts );
+}
+
+function bb_get_common_domains($domain1 = false, $domain2 = false) {
+	if (!$domain1 || !$domain2) {
+		return false;
+	}
+	
+	$domain1 = strtolower( preg_replace( '@^https?://([^/]+).*$@i', '$1', $domain1 ) );
+	$domain2 = strtolower( preg_replace( '@^https?://([^/]+).*$@i', '$1', $domain2 ) );
+	
+	return bb_get_common_parts( $domain1, $domain2, '.', true );
+}
+
+function bb_get_common_paths($path1 = false, $path2 = false) {
+	if (!$path1 || !$path2) {
+		return false;
+	}
+	
+	$path1 = preg_replace('@^https?://[^/]+(.*)$@i', '$1', $path1);
+	$path2 = preg_replace('@^https?://[^/]+(.*)$@i', '$1', $path2);
+	
+	if ($path1 === $path2) {
+		return $path1;
+	}
+	
+	$path1 = trim( $path1, '/' );
+	$path2 = trim( $path2, '/' );
+	
+	$common_path = bb_get_common_parts( $path1, $path2, '/' );
+	
+	if ($common_path) {
+		return '/' . $common_path . '/';
+	} else {
+		return '/';
+	}
+}
+
+function bb_match_domains($domain1 = false, $domain2 = false) {
+	if (!$domain1 || !$domain2) {
+		return false;
+	}
+	
+	$domain1 = strtolower( preg_replace( '@^https?://([^/]+).*$@i', '$1', $domain1 ) );
+	$domain2 = strtolower( preg_replace( '@^https?://([^/]+).*$@i', '$1', $domain2 ) );
+	
+	if ( (string) $domain1 === (string) $domain2 ) {
+		return true;
+	}
+	
+	return false;
+}
+
+function bb_glob($pattern) {
+	// On fail return an empty array so that loops don't explode
+	
+	if (!$pattern)
+		return array();
+	
+	// May break if pattern contains forward slashes
+	$directory = dirname( $pattern );
+	
+	if (!$directory)
+		return array();
+	
+	if (!file_exists($directory))
+		return array();
+	
+	if (!is_dir($directory))
+		return array();
+	
+	if (!function_exists('glob'))
+		return array();
+	
+	if (!is_callable('glob'))
+		return array();
+	
+	$glob = glob($pattern);
+	
+	if (!is_array($glob))
+		$glob = array();
+	
+	return $glob;
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-deprecated.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-deprecated.php
new file mode 100644
index 0000000000000000000000000000000000000000..0f86f6101de33bad7062a5116f8d36d53a9069c7
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-deprecated.php
@@ -0,0 +1,1179 @@
+<?php
+/**
+ * Deprecated functions from past bbPress versions. You shouldn't use these
+ * globals and functions and look for the alternatives instead. The functions
+ * and globals will be removed in a later version.
+ *
+ * @package bbPress
+ * @subpackage Deprecated
+ */
+
+
+
+function bb_specialchars( $text, $quotes = 0 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'esc_html');
+	return esc_html( $text, $quotes );
+}
+
+function bb_make_clickable( $ret ) {
+	bb_log_deprecated('function', __FUNCTION__, 'make_clickable');
+	return make_clickable( $ret );
+}
+
+function bb_apply_filters($tag, $string, $filter = true) {
+	bb_log_deprecated('function', __FUNCTION__, 'apply_filters');
+	$args = func_get_args();
+	return call_user_func_array('apply_filters', $args);
+}
+
+function bb_add_filter($tag, $function_to_add, $priority = 10) {
+	bb_log_deprecated('function', __FUNCTION__, 'add_filter');
+	$args = func_get_args();
+	return call_user_func_array('add_filter', $args);
+}
+
+function bb_remove_filter($tag, $function_to_remove, $priority = 10) {
+	bb_log_deprecated('function', __FUNCTION__, 'remove_filter');
+	$args = func_get_args();
+	return call_user_func_array('remove_filter', $args);
+}
+
+function bb_do_action($tag) {
+	bb_log_deprecated('function', __FUNCTION__, 'do_action');
+	$args = func_get_args();
+	return call_user_func_array('do_action', $args);
+}
+
+function bb_add_action($tag, $function_to_add, $priority = 10) {
+	bb_log_deprecated('function', __FUNCTION__, 'add_action');
+	$args = func_get_args();
+	return call_user_func_array('add_action', $args);
+}
+
+function bb_remove_action($tag, $function_to_remove, $priority = 10) {
+	bb_log_deprecated('function', __FUNCTION__, 'remove_action');
+	$args = func_get_args();
+	return call_user_func_array('remove_action', $args);
+}
+
+function bb_add_query_arg() {
+	bb_log_deprecated('function', __FUNCTION__, 'add_query_arg');
+	$args = func_get_args();
+	return call_user_func_array('add_query_arg', $args);
+}
+
+function bb_remove_query_arg($key, $query = '') {
+	bb_log_deprecated('function', __FUNCTION__, 'remove_query_arg');
+	return remove_query_arg($key, $query);
+}
+
+if ( !function_exists('language_attributes') ) :
+function language_attributes( $xhtml = 0 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_language_attributes');
+	bb_language_attributes( $xhtml );
+}
+endif;
+
+function cast_meta_value( $data ) {
+	bb_log_deprecated('function', __FUNCTION__, 'maybe_unserialize');
+	return maybe_unserialize( $data );
+}
+
+function option( $option ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_option');
+	return bb_option( $option );
+}
+
+// Use topic_time
+function topic_date( $format = '', $id = 0 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_gmdate_i18n( $format, get_topic_timestamp( $id ) )');
+	echo bb_gmdate_i18n( $format, get_topic_timestamp( $id ) );
+}
+function get_topic_date( $format = '', $id = 0 ){
+	bb_log_deprecated('function', __FUNCTION__, 'bb_gmdate_i18n( $format, get_topic_timestamp( $id ) )');
+	return bb_gmdate_i18n( $format, get_topic_timestamp( $id ) );
+}
+function get_topic_timestamp( $id = 0 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_gmtstrtotime( $topic->topic_time )');
+	global $topic;
+	if ( $id )
+		$topic = get_topic( $id );
+	return bb_gmtstrtotime( $topic->topic_time );
+}
+
+// Use topic_start_time
+function topic_start_date( $format = '', $id = 0 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_gmdate_i18n( $format, get_topic_start_timestamp( $id ) )');
+	echo bb_gmdate_i18n( $format, get_topic_start_timestamp( $id ) );
+}
+function get_topic_start_timestamp( $id = 0 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_gmtstrtotime( $topic->topic_start_time )');
+	global $topic;
+	if ( $id )
+		$topic = get_topic( $id );
+	return bb_gmtstrtotime( $topic->topic_start_time );
+}
+
+// Use bb_post_time
+function post_date( $format ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_gmdate_i18n( $format, bb_gmtstrtotime( $bb_post->post_time ) )');
+	global $bb_post;
+	echo bb_gmdate_i18n( $format, bb_gmtstrtotime( $bb_post->post_time ) );
+}
+function get_post_timestamp() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_gmtstrtotime( $bb_post->post_time )');
+	global $bb_post;
+	return bb_gmtstrtotime( $bb_post->post_time );
+}
+
+function get_inception() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_inception( \'timestamp\' )');
+	return bb_get_inception( 'timestamp' );
+}
+
+function forum_dropdown( $c = false, $a = false ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_forum_dropdown');
+	bb_forum_dropdown( $c, $a );
+}
+
+function get_ids_by_role( $role = 'moderator', $sort = 0, $limit_str = '' ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_ids_by_role');
+	return bb_get_ids_by_role( $role , $sort , $limit_str);
+}
+
+function get_deleted_posts( $page = 1, $limit = false, $status = 1, $topic_status = 0 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'no alternative');
+}
+
+function bozo_posts( $where ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_posts');
+	return bb_bozo_posts( $where );
+}
+
+function bozo_topics( $where ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_topics');
+	return bb_bozo_topics( $where );
+}
+
+function get_bozos( $page = 1 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_bozos');
+	return bb_get_bozos($page);
+}
+
+function current_user_is_bozo( $topic_id = false ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_current_user_is_bozo');
+	return bb_current_user_is_bozo( $topic_id );
+}
+
+function bozo_pre_permalink() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_pre_permalink');
+	return bb_bozo_pre_permalink();
+}
+
+function bozo_latest_filter() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_latest_filter');
+	return bb_bozo_latest_filter();
+}
+
+function bozo_topic_db_filter() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_topic_db_filter');
+	return bb_bozo_topic_db_filter();
+}
+
+function bozo_profile_db_filter() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_profile_db_filter');
+	return bb_bozo_profile_db_filter();
+}
+
+function bozo_recount_topics() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_recount_topics');
+	return bb_bozo_recount_topics();
+}
+
+function bozo_recount_users() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_recount_users');
+	return bb_bozo_recount_users();
+}
+
+function bozo_post_del_class( $status ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_post_del_class');
+	return bb_bozo_post_del_class( $status );
+}
+
+function bozo_add_recount_list() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_add_recount_list');
+	return bb_bozo_add_recount_list() ;
+}
+
+function bozo_topic_pages_add( $add ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_topic_pages_add');
+	return bb_bozo_topic_pages_add( $add );
+}
+
+function bozo_get_topic_posts( $topic_posts ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_get_topic_posts');
+	return bb_bozo_get_topic_posts( $topic_posts ) ;
+}
+
+function bozo_new_post( $post_id ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_new_post');
+	return bb_bozo_new_post( $post_id );
+}
+
+function bozo_pre_post_status( $status, $post_id, $topic_id ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_pre_post_status');
+	return bb_bozo_pre_post_status( $status, $post_id, $topic_id ) ;
+}
+
+function bozo_delete_post( $post_id, $new_status, $old_status ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_delete_post');
+	return bb_bozo_delete_post( $post_id, $new_status, $old_status ) ;
+}
+
+function bozon( $user_id, $topic_id = 0 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozon');
+	return bb_bozon( $user_id, $topic_id ) ;
+}
+
+function fermion( $user_id, $topic_id = 0 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_fermion');
+	return bb_fermion( $user_id, $topic_id ) ;
+}
+
+function bozo_profile_admin_keys( $a ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_profile_admin_keys');
+	return bb_bozo_profile_admin_keys( $a ) ;
+}
+function bozo_add_admin_page() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_add_admin_page');
+	return bb_bozo_add_admin_page() ;
+}
+
+function bozo_admin_page() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_bozo_admin_page');
+	return bb_bozo_admin_page() ;
+}
+
+function encodeit( $matches ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_encodeit');
+	return bb_encodeit( $matches ) ;
+}
+
+function decodeit( $matches ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_decodeit');
+	return bb_decodeit( $matches ) ;
+}
+
+function code_trick( $text ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_code_trick');
+	return bb_code_trick( $text ) ;
+}
+
+function code_trick_reverse( $text ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_code_trick_reverse');
+	return bb_code_trick_reverse( $text ) ;
+}
+
+function encode_bad( $text ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_encode_bad');
+	return bb_encode_bad( $text ) ;
+}
+
+function user_sanitize( $text, $strict = false ) {
+	bb_log_deprecated('function', __FUNCTION__, 'sanitize_user');
+	return sanitize_user( $text, $strict );
+}
+
+function bb_user_sanitize( $text, $strict = false ) {
+	bb_log_deprecated('function', __FUNCTION__, 'sanitize_user');
+	return sanitize_user( $text, $strict );
+}
+
+function utf8_cut( $utf8_string, $length ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_utf8_cut');
+	return bb_utf8_cut( $utf8_string, $length ) ;
+}
+
+function tag_sanitize( $tag ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_tag_sanitize');
+	return bb_tag_sanitize( $tag ) ;
+}
+
+function sanitize_with_dashes( $text, $length = 200 ) { // Multibyte aware
+	bb_log_deprecated('function', __FUNCTION__, 'bb_sanitize_with_dashes');
+	return bb_sanitize_with_dashes( $text, $length ) ;
+}
+
+function bb_make_feed( $link ) {
+	bb_log_deprecated('function', __FUNCTION__, 'no aternative');
+	return trim( $link );
+}
+
+function show_context( $term, $text ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_show_context');
+	return bb_show_context( $term, $text );
+}
+
+function closed_title( $title ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_closed_label');
+	return bb_closed_label( $title );
+}
+
+// Closed label now applied using bb_topic_labels filters
+function bb_closed_title( $title ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_closed_label');
+	return bb_closed_label( $title );
+}
+
+function make_link_view_all( $link ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_make_link_view_all');
+	return bb_make_link_view_all( $link );
+}
+
+function remove_topic_tag( $tag_id, $user_id, $topic_id ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_remove_topic_tag');
+	return bb_remove_topic_tag( $tag_id, $user_id, $topic_id );
+}
+
+function add_topic_tag( $topic_id, $tag ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_add_topic_tag');
+	return bb_add_topic_tag( $topic_id, $tag );
+}
+
+function add_topic_tags( $topic_id, $tags ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_add_topic_tags');
+	return bb_add_topic_tags( $topic_id, $tags );
+}
+
+function create_tag( $tag ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_create_tag');
+	return bb_create_tag( $tag );
+}
+
+function destroy_tag( $tag_id, $recount_topics = true ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_destroy_tag');
+	return bb_destroy_tag( $tag_id, $recount_topics );
+}
+
+if ( !function_exists( 'get_tag_id' ) ) :
+function get_tag_id( $tag ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_tag_id');
+	return bb_get_tag_id( $tag );
+}
+endif;
+
+if ( !function_exists( 'get_tag' ) ) :
+function get_tag( $tag_id, $user_id = 0, $topic_id = 0 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_tag');
+	return bb_get_tag( $tag_id, $user_id, $topic_id );
+}
+endif;
+
+if ( !function_exists( 'get_tag_by_name' ) ) :
+function get_tag_by_name( $tag ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_tag_by_name');
+	return bb_get_tag( $tag );
+}
+endif;
+
+function get_topic_tags( $topic_id ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_topic_tags');
+	return bb_get_topic_tags( $topic_id );
+}
+
+function get_user_tags( $topic_id, $user_id ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_user_tags');
+	return bb_get_user_tags( $topic_id, $user_id );
+}
+
+function get_other_tags( $topic_id, $user_id ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_other_tags');
+	return bb_get_other_tags( $topic_id, $user_id );
+}
+
+function get_public_tags( $topic_id ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_public_tags');
+	return bb_get_public_tags( $topic_id );
+}
+
+function get_tagged_topic_ids( $tag_id ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_tagged_topic_ids');
+	return bb_get_tagged_topic_ids( $tag_id );
+}
+
+if ( !function_exists( 'get_top_tags' ) ) :
+function get_top_tags( $recent = true, $limit = 40 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_top_tags');
+	return bb_get_top_tags( array( 'number' => $limit ) );
+}
+endif;
+
+if ( !function_exists( 'get_tag_name' ) ) :
+function get_tag_name( $id = 0 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_tag_name');
+	return bb_get_tag_name( $id );
+}
+endif;
+
+if ( !function_exists( 'tag_name' ) ) :
+function tag_name( $id = 0 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_tag_name');
+	bb_tag_name( $id );
+}
+endif;
+
+if ( !function_exists( 'get_tag_rss_link' ) ) :
+function get_tag_rss_link( $id = 0 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_tag_posts_rss_link');
+	return bb_get_tag_posts_rss_link( $id );
+}
+endif;
+
+if ( !function_exists( 'tag_rss_link' ) ) :
+function tag_rss_link( $id = 0 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_tag_posts_rss_link');
+	bb_tag_posts_rss_link( $id );
+}
+endif;
+
+if ( !function_exists( 'get_tag_page_link' ) ) :
+function get_tag_page_link() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_tag_page_link');
+	bb_get_tag_page_link();
+}
+endif;
+
+if ( !function_exists( 'tag_page_link' ) ) :
+function tag_page_link() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_tag_page_link');
+	bb_tag_page_link();
+}
+endif;
+
+if ( !function_exists( 'get_tag_remove_link' ) ) :
+function get_tag_remove_link() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_tag_remove_link');
+	bb_get_tag_remove_link();
+}
+endif;
+
+if ( !function_exists( 'tag_remove_link' ) ) :
+function tag_remove_link() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_tag_remove_link');
+	bb_tag_remove_link();
+}
+endif;
+
+if ( !function_exists( 'tag_heat_map' ) ) :
+function tag_heat_map( $args = '' ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_tag_heat_map (with variations to arguments)');
+	$defaults = array( 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'limit' => 45, 'format' => 'flat' );
+	$args = wp_parse_args( $args, $defaults );
+
+	if ( 1 < $fn = func_num_args() ) : // For back compat
+		$args['smallest'] = func_get_arg(0);
+		$args['largest']  = func_get_arg(1);
+		$args['unit']     = 2 < $fn ? func_get_arg(2) : $unit;
+		$args['limit']    = 3 < $fn ? func_get_arg(3) : $limit;
+	endif;
+
+	bb_tag_heat_map( $args );
+}
+endif;
+
+function get_bb_location() {
+	bb_log_deprecated('function', __FUNCTION__, 'no alternative');
+	$r = bb_get_location();
+	if ( !$r )
+		$r = apply_filters( 'get_bb_location', '' ); // Deprecated filter
+	return $r;
+}
+
+function bb_parse_args( $args, $defaults = '' ) {
+	bb_log_deprecated('function', __FUNCTION__, 'wp_parse_args');
+	return wp_parse_args( $args, $defaults );
+}
+
+if ( !function_exists( 'is_tag' ) ) :
+function is_tag() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_is_tag');
+	return bb_is_tag();
+}
+endif;
+
+if ( !function_exists( 'is_tags' ) ) :
+function is_tags() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_is_tags');
+	return bb_is_tags();
+}
+endif;
+
+if ( !function_exists( 'tag_link' ) ) :
+function tag_link() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_tag_link');
+	bb_tag_link();
+}
+endif;
+
+if ( !function_exists( 'tag_link_base' ) ) :
+function tag_link_base() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_tag_link_base');
+	bb_tag_link_base();
+}
+endif;
+
+if ( !function_exists( 'get_tag_link' ) ) :
+function get_tag_link() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_tag_link');
+	bb_get_tag_link();
+}
+endif;
+
+if ( !function_exists( 'get_tag_link_base' ) ) :
+function get_tag_link_base() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_tag_link_base');
+	bb_get_tag_link_base();
+}
+endif;
+
+// It's not omnipotent
+function bb_path_to_url( $path ) {
+	bb_log_deprecated('function', __FUNCTION__, 'no alternative');
+	return apply_filters( 'bb_path_to_url', bb_convert_path_base( $path, BB_PATH, bb_get_uri(null, null, BB_URI_CONTEXT_TEXT) ), $path );
+}
+
+// Neither is this one
+function bb_url_to_path( $url ) {
+	bb_log_deprecated('function', __FUNCTION__, 'no alternative');
+	return apply_filters( 'bb_url_to_path', bb_convert_path_base( $url, bb_get_uri(null, null, BB_URI_CONTEXT_TEXT), BB_PATH ), $url );
+}
+
+function bb_convert_path_base( $path, $from_base, $to_base ) {
+	bb_log_deprecated('function', __FUNCTION__, 'no alternative');
+	$last_char = $path{strlen($path)-1};
+	if ( '/' != $last_char && '\\' != $last_char )
+		$last_char = '';
+
+	list($from_base, $to_base) = bb_trim_common_path_right($from_base, $to_base);
+
+	if ( 0 === strpos( $path, $from_base ) )
+		$r = $to_base . substr($path, strlen($from_base)) . $last_char;
+	else
+		return false;
+
+	$r = str_replace(array('//', '\\\\'), array('/', '\\'), $r);
+	$r = preg_replace('|:/([^/])|', '://$1', $r);
+
+	return $r;
+}
+
+function bb_trim_common_path_right( $one, $two ) {
+	bb_log_deprecated('function', __FUNCTION__, 'no alternative');
+	$root_one = false;
+	$root_two = false;
+
+	while ( false === $root_one ) {
+		$base_one = basename($one);
+		$base_two = basename($two);
+		if ( !$base_one || !$base_two )
+			break;		
+		if ( $base_one == $base_two ) {
+			$one = dirname($one);
+			$two = dirname($two);
+		} else {
+			$root_one = $one;
+			$root_two = $two;
+		}
+	}
+
+	return array($root_one, $root_two);
+}
+
+function deleted_topics( $where ) {
+	bb_log_deprecated('function', __FUNCTION__, 'no alternative');
+	return preg_replace( '/(\w+\.)?topic_status = ["\']?0["\']?/', "\\1topic_status = 1", $where);
+}
+
+function no_replies( $where ) {
+	bb_log_deprecated('function', __FUNCTION__, 'no alternative');
+	return $where . ' AND topic_posts = 1 ';
+}
+
+function untagged( $where ) {
+	bb_log_deprecated('function', __FUNCTION__, 'no alternative');
+	return $where . ' AND tag_count = 0 ';
+}
+
+function get_views() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_views');
+	return bb_get_views();
+}
+
+if ( !function_exists( 'balanceTags' ) ) :
+function balanceTags( $text ) {
+	bb_log_deprecated('function', __FUNCTION__, 'force_balance_tags');
+	return force_balance_tags( $text );
+}
+endif;
+
+// With no extra arguments, converts array of objects into object of arrays
+// With extra arguments corresponding to name of object properties, returns array of arrays:
+//     list($a, $b) = bb_pull_cols( $obj_array, 'a', 'b' );
+function bb_pull_cols( $obj_array ) {
+	bb_log_deprecated('function', __FUNCTION__, 'no alternative');
+	$r = new stdClass;
+	foreach ( array_keys($obj_array) as $o )
+		foreach ( get_object_vars( $obj_array[$o] ) as $k => $v )
+			$r->{$k}[] = $v;
+
+	if ( 1 == func_num_args() )
+		return $r;
+
+	$args = func_get_args();
+	$args = array_splice($args, 1);
+
+	$a = array();
+	foreach ( $args as $arg )
+		$a[] = $r->$arg;
+	return $a;
+}
+
+// $length parameter is deprecated
+function bb_random_pass( $length ) {
+	bb_log_deprecated('function', __FUNCTION__, 'wp_generate_password');
+	return wp_generate_password();
+}
+
+// Old RSS related functions
+function get_recent_rss_link() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_posts_rss_link');
+	return bb_get_posts_rss_link();
+}
+
+function forum_rss_link( $forum_id = 0 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_forum_posts_rss_link');
+	bb_forum_posts_rss_link( $forum_id );
+}
+
+function get_forum_rss_link( $forum_id = 0 ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_forum_posts_rss_link');
+	return bb_get_forum_posts_rss_link( $forum_id );
+}
+
+function bb_register_activation_hook($file, $function) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_register_plugin_activation_hook');
+	bb_register_plugin_activation_hook($file, $function);
+}
+
+function bb_register_deactivation_hook($file, $function) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_register_plugin_deactivation_hook');
+	bb_register_plugin_deactivation_hook($file, $function);
+}
+
+function bb_enqueue_script( $handle, $src = false, $deps = array(), $ver = false ) {
+	bb_log_deprecated('function', __FUNCTION__, 'wp_enqueue_script');
+	wp_enqueue_script( $handle, $src, $deps, $ver );
+}
+
+function bb_get_user_by_name( $name ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_user');
+	return bb_get_user( $name, array( 'by' => 'login' ) );
+}
+
+function bb_user_exists( $user ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_user');
+	return bb_get_user( $user );
+}
+
+function bb_maybe_serialize( $string ) {
+	bb_log_deprecated('function', __FUNCTION__, 'maybe_serialize');
+	return maybe_serialize( $string );
+}
+
+function bb_maybe_unserialize( $string ) {
+	bb_log_deprecated('function', __FUNCTION__, 'maybe_unserialize');
+	return maybe_unserialize( $string );
+}
+
+function bb_get_active_theme_folder() {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_active_theme_directory');
+	return apply_filters( 'bb_get_active_theme_folder', bb_get_active_theme_directory() );
+}
+
+function bb_tag_sanitize( $tag ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_pre_term_slug');
+	return bb_pre_term_slug( $tag );
+}
+
+function bb_get_tag_by_name( $tag ) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_get_tag');
+	return bb_get_tag( $tag );
+}
+
+function bb_dbDelta($queries, $execute = true) {
+	bb_log_deprecated('function', __FUNCTION__, 'bb_sql_delta');
+	return bb_sql_delta($queries, $execute);
+}
+
+function bb_make_db_current() {
+	bb_log_deprecated('function', __FUNCTION__, 'no alternative');
+	return false;
+}
+
+function bb_maybe_add_column( $table_name, $column_name, $create_ddl ) {
+	bb_log_deprecated('function', __FUNCTION__, 'no alternative');
+	return false;
+}
+
+class BB_Cache {
+	var $use_cache = false;
+	var $flush_freq = 100;
+	var $flush_time = 172800; // 2 days
+
+	function get_user( $user_id, $use_cache = true ) {
+		bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'bb_get_user');
+		return bb_get_user( $user_id );
+	}
+
+	function append_current_user_meta( $user ) {
+		bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'bb_append_meta');
+		return bb_append_meta( $user, 'user' );
+	}
+
+	function append_user_meta( $user ) {
+		bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'bb_append_meta');
+		return bb_append_meta( $user, 'user' );
+	}
+
+	// NOT bbdb::prepared
+	function cache_users( $ids, $use_cache = true ) {
+		bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'bb_cache_users');
+		return bb_cache_users( $ids );
+	}
+
+	// NOT bbdb::prepared
+	function get_topic( $topic_id, $use_cache = true ) {
+		bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'get_topic');
+		return get_topic( $topic_id, $use_cache );
+	}
+
+	// NOT bbdb::prepared
+	function get_thread( $topic_id, $page = 1, $reverse = 0 ) {
+		bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'get_thread');
+		return get_thread( $topic_id, $page, $reverse );
+	}
+
+	// NOT bbdb::prepared
+	function cache_posts( $query ) { // soft cache
+		bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'bb_cache_posts');
+		return bb_cache_posts( $query );
+	}
+
+	// NOT bbdb::prepared
+	function get_forums() {
+		bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'bb_get_forums');
+		return bb_get_forums();
+	}
+
+	function get_forum( $forum_id ) {
+		bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'bb_get_forum');
+		return bb_get_forum( $forum_id );
+	}
+
+	function read_cache($file) {
+		bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'no alternative');
+		return false;
+	}
+
+	function write_cache($file, $data) {
+		bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'no alternative');
+		return false;
+	}
+
+	function flush_one( $type, $id = false, $page = 0 ) {
+		bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'no alternative');
+		return true;
+	}
+
+	function flush_many( $type, $id, $start = 0 ) {
+		bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'no alternative');
+		return true;
+	}
+
+	function flush_old() {
+		bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'no alternative');
+		return true;
+	}
+
+	function flush_all() {
+		bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'no alternative');
+		return true;
+	}
+
+}
+
+function new_topic( $args = null ) {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_new_topic_link' );
+	bb_new_topic_link( $args );
+}
+
+function bb_upgrade_1060() {
+	bb_log_deprecated( 'function', __FUNCTION__, 'no alternative' );
+}
+
+if ( !function_exists( 'paginate_links' ) ) : // Deprecated in bbPress not WordPress
+function paginate_links( $args = '' ) {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_paginate_links' );
+	return bb_paginate_links( $args );
+}
+endif;
+
+if ( !function_exists('wp_clear_auth_cookie') ) : // Deprecated in bbPress not WordPress
+function wp_clear_auth_cookie() {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_clear_auth_cookie' );
+	bb_clear_auth_cookie();
+}
+endif;
+
+if ( !function_exists( 'wp_validate_auth_cookie' ) ) : // Deprecated in bbPress not WordPress
+function wp_validate_auth_cookie( $cookie = '', $scheme = 'auth' ) {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_validate_auth_cookie' );
+	return bb_validate_auth_cookie( $cookie, $scheme );
+}
+endif;
+
+if ( !function_exists( 'wp_set_auth_cookie' ) ) : // Deprecated in bbPress not WordPress
+function wp_set_auth_cookie( $user_id, $remember = false, $secure = '' ) {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_set_auth_cookie' );
+	bb_set_auth_cookie( $user_id, $remember, $secure );
+}
+endif;
+
+if ( !function_exists( 'wp_salt' ) ) : // Deprecated in bbPress not WordPress
+function wp_salt( $scheme = 'auth' ) {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_salt' );
+	return bb_salt( $scheme );
+}
+endif;
+
+if ( !function_exists( 'wp_hash' ) ) : // Deprecated in bbPress not WordPress
+function wp_hash( $data, $scheme = 'auth' ) {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_hash' );
+	return bb_hash( $data, $scheme );
+}
+endif;
+
+if ( !function_exists( 'wp_hash_password' ) ) : // Deprecated in bbPress not WordPress
+function wp_hash_password( $password ) {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_hash_password' );
+	return bb_hash_password( $password );
+}
+endif;
+
+if ( !function_exists( 'wp_check_password') ) : // Deprecated in bbPress not WordPress
+function wp_check_password( $password, $hash, $user_id = '' ) {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_check_password' );
+	return bb_check_password( $password, $hash, $user_id );
+}
+endif;
+
+if ( !function_exists( 'wp_generate_password' ) ) : // Deprecated in bbPress not WordPress
+function wp_generate_password( $length = 12, $special_chars = true ) {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_generate_password' );
+	return bb_generate_password( $length, $special_chars );
+}
+endif;
+
+if ( !class_exists( 'WP_User' ) ) : // Deprecated in BackPress not WordPress
+class WP_User extends BP_User {
+	function WP_User( $id, $name = '' ) {
+		return parent::BP_User( $id, $name );
+	}
+}
+endif;
+
+function bb_sql_get_column_definition( $column_data ) {
+	require_once( BACKPRESS_PATH . 'class.bp-sql-schema-parser.php' );
+	bb_log_deprecated( 'function', __FUNCTION__, 'BP_SQL_Schema_Parser::get_column_definition' );
+	return BP_SQL_Schema_Parser::get_column_definition( $column_data );
+}
+
+function bb_sql_get_index_definition( $index_data ) {
+	require_once( BACKPRESS_PATH . 'class.bp-sql-schema-parser.php' );
+	bb_log_deprecated( 'function', __FUNCTION__, 'BP_SQL_Schema_Parser::get_index_definition' );
+	return BP_SQL_Schema_Parser::get_index_definition( $index_data );
+}
+
+function bb_sql_describe_table( $query ) {
+	require_once( BACKPRESS_PATH . 'class.bp-sql-schema-parser.php' );
+	bb_log_deprecated( 'function', __FUNCTION__, 'BP_SQL_Schema_Parser::describe_table' );
+	return BP_SQL_Schema_Parser::describe_table( $query );
+}
+
+function bb_sql_parse( $sql ) {
+	require_once( BACKPRESS_PATH . 'class.bp-sql-schema-parser.php' );
+	bb_log_deprecated( 'function', __FUNCTION__, 'BP_SQL_Schema_Parser::parse' );
+	return BP_SQL_Schema_Parser::parse( $sql );
+}
+
+function bb_sql_delta( $queries, $execute = true ) {
+	require_once( BACKPRESS_PATH . 'class.bp-sql-schema-parser.php' );
+	bb_log_deprecated( 'function', __FUNCTION__, 'BP_SQL_Schema_Parser::delta' );
+	global $bbdb;
+	return BP_SQL_Schema_Parser::delta( $bbdb, $queries, false, $execute );
+}
+
+function is_front() {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_is_front' );
+	return bb_is_front();
+}
+
+function is_forum() {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_is_forum' );
+	return bb_is_forum();
+}
+
+function is_bb_tags() {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_is_tags' );
+	return bb_is_tags();
+}
+
+function is_bb_tag() {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_is_tag' );
+	return bb_is_tag();
+}
+
+function is_topic_edit() {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_is_topic_edit' );
+	return bb_is_topic_edit();
+}
+
+function is_topic() {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_is_topic' );
+	return bb_is_topic();
+}
+
+function is_bb_feed() {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_is_feed' );
+	return bb_is_feed();
+}
+
+function is_bb_search() {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_is_search' );
+	return bb_is_search();
+}
+
+function is_bb_profile() {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_is_profile' );
+	return bb_is_profile();
+}
+
+function is_bb_favorites() {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_is_favorites' );
+	return bb_is_favorites();
+}
+
+function is_view() {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_is_view' );
+	return bb_is_view();
+}
+
+function is_bb_stats() {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_is_statistics' );
+	return bb_is_statistics();
+}
+
+function is_bb_admin() {
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_is_admin' );
+	return bb_is_admin();
+}
+
+function bb_verify_email( $email, $check_dns = false )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'is_email' );
+	return is_email( $email, $check_dns );
+}
+
+function bb_tag_rss_link( $tag_id = 0, $context = 0 )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_tag_posts_rss_link' );
+	return bb_tag_posts_rss_link( $tag_id, $context );
+}
+
+function bb_get_tag_rss_link( $tag_id = 0, $context = 0 )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_get_tag_posts_rss_link' );
+	return bb_get_tag_posts_rss_link( $tag_id, $context );
+}
+
+function rename_tag( $tag_id, $tag_name )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_rename_tag' );
+	return bb_rename_tag( $tag_id, $tag_name );
+}
+
+function merge_tags( $old_id, $new_id )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_merge_tags' );
+	return bb_merge_tags( $old_id, $new_id );
+}
+
+function bb_related_tags( $_tag = false, $number = 0 )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'no alternative' );
+	return false;
+}
+
+function bb_related_tags_heat_map( $args = '' )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'no alternative' );
+	return;
+}
+
+function bb_cache_javascript_headers()
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'cache_javascript_headers' );
+	cache_javascript_headers();
+}
+
+function bb_is_ssl()
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'is_ssl' );
+	return is_ssl();
+}
+
+function bb_force_ssl_user_forms( $force = '' )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'force_ssl_login' );
+	return force_ssl_login( $force );
+}
+
+function bb_force_ssl_admin( $force = '' )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'force_ssl_admin' );
+	return force_ssl_admin( $force );
+}
+
+function get_forums( $args = null )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_get_forums' );
+	return bb_get_forums( $args );
+}
+
+function get_forum( $id )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_get_forum' );
+	return bb_get_forum( $id );
+}
+
+function get_latest_posts( $limit = 0, $page = 1 )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_get_latest_posts' );
+	return bb_get_latest_posts( $limit, $page );
+}
+
+function get_latest_forum_posts( $forum_id, $limit = 0, $page = 1 )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_get_latest_forum_posts' );
+	return bb_get_latest_forum_posts( $forum_id, $limit, $page );
+}
+
+function update_post_positions( $topic_id )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_update_post_positions' );
+	return bb_update_post_positions( $topic_id );
+}
+
+function topics_replied_on_undelete_post( $post_id )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_topics_replied_on_undelete_post' );
+	return bb_topics_replied_on_undelete_post( $post_id );
+}
+
+function post_author_cache( $posts )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_post_author_cache' );
+	return bb_post_author_cache( $posts );
+}
+
+function get_recent_user_replies( $user_id )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_get_recent_user_replies' );
+	return bb_get_recent_user_replies( $user_id );
+}
+
+function no_where( $where )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_no_where' );
+	return bb_no_where( $where );
+}
+
+function get_path( $level = 1, $base = false, $request = false )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_get_path' );
+	return bb_get_path( $level, $base, $request );
+}
+
+function add_profile_tab( $tab_title, $users_cap, $others_cap, $file, $arg = false )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_add_profile_tab' );
+	return bb_add_profile_tab( $tab_title, $users_cap, $others_cap, $file, $arg );
+}
+
+function can_access_tab( $profile_tab, $viewer_id, $owner_id )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_can_access_tab' );
+	return bb_can_access_tab( $profile_tab, $viewer_id, $owner_id );
+}
+
+function get_profile_info_keys( $context = null )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_get_profile_info_keys' );
+	return bb_get_profile_info_keys( $context );
+}
+
+function get_profile_admin_keys( $context = null )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_get_profile_admin_keys' );
+	return bb_get_profile_admin_keys( $context );
+}
+
+function get_assignable_caps()
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_get_assignable_caps' );
+	return bb_get_assignable_caps();
+}
+
+function get_page_number( $item, $per_page = 0 )
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_get_page_number' );
+	return bb_get_page_number( $item, $per_page );
+}
+
+function get_recent_registrants( $num = 10 )
+{
+	bb_log_deprecated('function', __FUNCTION__, 'no aternative');
+	return;
+}
+
+if ( !function_exists( 'get_total_users' ) ) {
+	function get_total_users()
+	{
+		bb_log_deprecated( 'function', __FUNCTION__, 'bb_get_total_users' );
+		return bb_get_total_users();
+	}
+}
+
+function total_users()
+{
+	bb_log_deprecated( 'function', __FUNCTION__, 'bb_total_users' );
+	bb_total_users();
+}
+
+if ( !function_exists( 'update_user_status' ) ) {
+	function update_user_status( $user_id, $user_status = 0 )
+	{
+		bb_log_deprecated( 'function', __FUNCTION__, 'bb_update_user_status' );
+		return bb_update_user_status( $user_id, $user_status );
+	}
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-formatting.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-formatting.php
new file mode 100644
index 0000000000000000000000000000000000000000..eae5e7d58a937b74f3f260debcdc84221200d09c
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-formatting.php
@@ -0,0 +1,331 @@
+<?php
+
+function bb_autop($pee, $br = 1) { // Reduced to be faster
+	$pee = $pee . "\n"; // just to make things a little easier, pad the end
+	$pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
+	// Space things out a little
+	$pee = preg_replace('!(<(?:ul|ol|li|blockquote|pre|p)[^>]*>)!', "\n$1", $pee); 
+	$pee = preg_replace('!(</(?:ul|ol|li|blockquote|pre|p)>)!', "$1\n", $pee);
+	$pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines 
+	$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
+	$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end 
+	$pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace 
+	$pee = preg_replace('!<p>\s*(</?(?:ul|ol|li|blockquote|p)[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
+	$pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
+	$pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
+	$pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
+	$pee = preg_replace('!<p>\s*(</?(?:ul|ol|li|blockquote|p)[^>]*>)!', "$1", $pee);
+	$pee = preg_replace('!(</?(?:ul|ol|li|blockquote|p)[^>]*>)\s*</p>!', "$1", $pee); 
+	if ($br) $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
+	$pee = preg_replace('!(</?(?:ul|ol|li|blockquote|p)[^>]*>)\s*<br />!', "$1", $pee);
+	$pee = preg_replace('!<br />(\s*</?(?:p|li|ul|ol)>)!', '$1', $pee);
+	if ( false !== strpos( $pee, '<pre' ) )
+		$pee = preg_replace_callback('!(<pre.*?>)(.*?)</pre>!is', 'clean_pre', $pee );
+	return $pee; 
+}
+
+function bb_encodeit( $matches ) {
+	$text = trim($matches[2]);
+	$text = htmlspecialchars($text, ENT_QUOTES);
+	$text = str_replace(array("\r\n", "\r"), "\n", $text);
+	$text = preg_replace("|\n\n\n+|", "\n\n", $text);
+	$text = str_replace('&amp;amp;', '&amp;', $text);
+	$text = str_replace('&amp;lt;', '&lt;', $text);
+	$text = str_replace('&amp;gt;', '&gt;', $text);
+	$text = "<code>$text</code>";
+	if ( "`" != $matches[1] )
+		$text = "<pre>$text</pre>";
+	return $text;
+}
+
+function bb_decodeit( $matches ) {
+	$text = $matches[2];
+	$trans_table = array_flip(get_html_translation_table(HTML_ENTITIES));
+	$text = strtr($text, $trans_table);
+	$text = str_replace('<br />', '<coded_br />', $text);
+	$text = str_replace('<p>', '<coded_p>', $text);
+	$text = str_replace('</p>', '</coded_p>', $text);
+	$text = str_replace(array('&#38;','&amp;'), '&', $text);
+	$text = str_replace('&#39;', "'", $text);
+	if ( '<pre><code>' == $matches[1] )
+		$text = "\n$text\n";
+	return "`$text`";
+}
+
+function bb_code_trick( $text ) {
+	$text = str_replace(array("\r\n", "\r"), "\n", $text);
+	$text = preg_replace_callback("|(`)(.*?)`|", 'bb_encodeit', $text);
+	$text = preg_replace_callback("!(^|\n)`(.*?)`!s", 'bb_encodeit', $text);
+	return $text;
+}
+
+function bb_code_trick_reverse( $text ) {
+	$text = preg_replace_callback("!(<pre><code>|<code>)(.*?)(</code></pre>|</code>)!s", 'bb_decodeit', $text);
+	$text = str_replace(array('<p>', '<br />'), '', $text);
+	$text = str_replace('</p>', "\n", $text);
+	$text = str_replace('<coded_br />', '<br />', $text);
+	$text = str_replace('<coded_p>', '<p>', $text);
+	$text = str_replace('</coded_p>', '</p>', $text);
+	return $text;
+}
+
+function _bb_encode_bad_empty(&$text, $key, $preg) {
+	if (strpos($text, '`') !== 0)
+		$text = preg_replace("|&lt;($preg)\s*?/*?&gt;|i", '<$1 />', $text);
+}
+
+function _bb_encode_bad_normal(&$text, $key, $preg) {
+	if (strpos($text, '`') !== 0)
+		$text = preg_replace("|&lt;(/?$preg)&gt;|i", '<$1>', $text);
+}
+
+function bb_encode_bad( $text ) {
+	$text = wp_specialchars( $text, ENT_NOQUOTES );
+
+	$text = preg_split('@(`[^`]*`)@m', $text, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
+
+	$allowed = bb_allowed_tags();
+	$empty = array( 'br' => true, 'hr' => true, 'img' => true, 'input' => true, 'param' => true, 'area' => true, 'col' => true, 'embed' => true );
+
+	foreach ( $allowed as $tag => $args ) {
+		$preg = $args ? "$tag(?:\s.*?)?" : $tag;
+
+		if ( isset( $empty[$tag] ) )
+			array_walk($text, '_bb_encode_bad_empty', $preg);
+		else
+			array_walk($text, '_bb_encode_bad_normal', $preg);
+	}
+
+	return join('', $text);
+}
+
+function bb_filter_kses($data) {
+	$allowedtags = bb_allowed_tags();
+	return wp_kses($data, $allowedtags);
+}
+
+function bb_allowed_tags() {
+	$tags = array(
+		'a' => array(
+			'href' => array(),
+			'title' => array(),
+			'rel' => array()),
+		'blockquote' => array('cite' => array()),
+		'br' => array(),
+		'code' => array(),
+		'pre' => array(),
+		'em' => array(),
+		'strong' => array(),
+		'ul' => array(),
+		'ol' => array(),
+		'li' => array()
+	);
+	return apply_filters( 'bb_allowed_tags', $tags );
+}
+
+function bb_rel_nofollow( $text ) {
+	return preg_replace_callback('|<a (.+?)>|i', 'bb_rel_nofollow_callback', $text);
+}
+
+function bb_rel_nofollow_callback( $matches ) {
+	$text = $matches[1];
+	$text = str_replace(array(' rel="nofollow"', " rel='nofollow'"), '', $text);
+	return "<a $text rel=\"nofollow\">";
+}
+
+// Should be able to take both escaped and unescaped data
+function bb_trim_for_db( $string, $length ) {
+	$_string = $string;
+	if ( seems_utf8( $string ) ) {
+		$string = bb_utf8_cut( $string, $length );
+		// if we have slashes at the end, make sure we have a reasonable number of them
+		if ( preg_match( '#[^\\\\](\\\\+)$#', $string, $matches ) ) {
+			$end = stripslashes($matches[1]);
+			$end = addslashes($end);
+			$string = trim( $string, '\\' ) . $end;
+		}
+	}
+	return apply_filters( 'bb_trim_for_db', $string, $_string, $length );
+}
+
+// Reduce utf8 string to $length in single byte character equivalents without breaking multibyte characters
+function bb_utf8_cut( $utf8_string, $length = 0 ) {
+	if ( $length < 1 )
+		return $utf8_string;
+
+	$unicode = '';
+	$chars = array();
+	$num_octets = 1;
+
+	for ($i = 0; $i < strlen( $utf8_string ); $i++ ) {
+
+		$value = ord( $utf8_string[ $i ] );
+
+		if ( 128 > $value ) {
+			if ( strlen($unicode) + 1 > $length )
+				break; 
+			$unicode .= $utf8_string[ $i ];
+		} else {
+			if ( count( $chars ) == 0 )
+				$num_octets = ( 224 > $value ) ? 2 : 3;
+
+			$chars[] = $utf8_string[ $i ];
+			if ( strlen($unicode) + $num_octets > $length )
+				break;
+			if ( count( $chars ) == $num_octets ) {
+				$unicode .= join('', $chars);
+				$chars = array();
+				$num_octets = 1;
+			}
+		}
+	}
+
+	return $unicode;
+}
+
+function bb_encoded_utf8_cut( $encoded, $length = 0 ) {
+	if ( $length < 1 )
+		return $encoded;
+
+	$r = '';
+	$values = preg_split( '/(%[0-9a-f]{2})/i', $encoded, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );;
+
+	for ($i = 0; $i < count( $values ); $i += $num_octets ) {
+		$num_octets = 1;
+		if ( '%' != $values[$i][0] ) {
+			$r .= $values[$i];
+			if ( $length && strlen($r) > $length )
+				return substr($r, 0, $length);
+		} else {
+			$value = hexdec(substr($values[$i], 1));
+
+			if ( 1 == $num_octets )
+				$num_octets = ( 224 > $value ) ? 2 : 3;
+
+			if ( $length && ( strlen($r) + $num_octets * 3 ) > $length )
+				return $r;
+
+			$r .= $values[$i] . $values[$i + 1];
+			if ( 3 == $num_octets )
+				$r .= $values[$i + 2];
+		}
+	}
+
+	return $r;
+}
+
+function bb_pre_term_slug( $slug, $taxonomy = '', $term_id = 0 ) {
+	return bb_sanitize_with_dashes( $slug, 200 );
+}
+
+function bb_trim_for_db_55( $string ) {
+	return bb_trim_for_db( $string, 55 );
+}
+
+function bb_trim_for_db_150( $string ) {
+	return bb_trim_for_db( $string, 150 );
+}
+
+function bb_slug_sanitize( $slug, $length = 255 ) {
+	$_slug = $slug;
+	return apply_filters( 'bb_slug_sanitize', bb_sanitize_with_dashes( $slug, $length ), $_slug, $length );
+}
+
+function bb_user_nicename_sanitize( $user_nicename, $length = 50 ) {
+	$_user_nicename = $user_nicename;
+	return apply_filters( 'bb_user_nicename_sanitize', bb_sanitize_with_dashes( $user_nicename, $length ), $_user_nicename, $length );
+}
+
+function bb_sanitize_with_dashes( $text, $length = 0 ) { // Multibyte aware
+	$_text = $text;
+	$text = trim($text);
+	$text = strip_tags($text);
+	// Preserve escaped octets.
+	$text = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $text);
+	// Remove percent signs that are not part of an octet.
+	$text = str_replace('%', '', $text);
+	// Restore octets.
+	$text = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $text);
+
+	$text = apply_filters( 'pre_sanitize_with_dashes', $text, $_text, $length );
+
+	$text = strtolower($text);
+	$text = preg_replace('/&(^\x80-\xff)+?;/', '', $text); // kill entities
+	$text = preg_replace('/[^%a-z0-9\x80-\xff _-]/', '', $text);
+	$text = trim($text);
+	$text = preg_replace('/\s+/', '-', $text);
+	$text = preg_replace(array('|-+|', '|_+|'), array('-', '_'), $text); // Kill the repeats
+	
+	return $text;
+}
+
+function bb_pre_sanitize_with_dashes_utf8( $text, $_text = '', $length = 0 ) {
+	$text = remove_accents($text);
+
+	if ( seems_utf8( $text ) ) {
+		if ( function_exists('mb_strtolower') )
+			$text = mb_strtolower($text, 'UTF-8');
+		$text = utf8_uri_encode( $text, $length );
+	}
+
+	return $text;
+}
+
+function bb_post_text_context( $post_text ) {
+	return bb_show_context( $GLOBALS['q'], $post_text );
+}
+
+function bb_show_context( $term, $text ) {
+	$text = strip_tags($text);
+	$term = preg_quote($term);
+	$text = preg_replace("|.*?(.{0,80})$term(.{0,80}).*|is", "... $1<strong>$term</strong>$2 ...", $text, 1);
+	$text = substr($text, 0, 210);
+	return $text;
+}
+
+function bb_fix_link( $link ) {
+	if ( false === strpos($link, '.') ) // these are usually random words
+		return '';
+	$link = wp_kses_no_null( $link );
+	return esc_url( $link );
+}
+
+function bb_sticky_label( $label ) {
+	global $topic;
+	if (bb_is_front()) {
+		if ( '2' === $topic->topic_sticky ) {
+			return sprintf(__('[sticky] %s'), $label);
+		}
+	} else {
+		if ( '1' === $topic->topic_sticky || '2' === $topic->topic_sticky ) {
+			return sprintf(__('[sticky] %s'), $label);
+		}
+	}
+	return $label;
+}
+
+function bb_closed_label( $label ) {
+	global $topic;
+	if ( '0' === $topic->topic_open )
+		return sprintf(__('[closed] %s'), $label);
+	return $label;
+}
+
+function bb_make_link_view_all( $link ) {
+	return esc_html( add_query_arg( 'view', 'all', $link ) );
+}
+
+function bb_gmtstrtotime( $string ) {
+	if ( is_numeric($string) )
+		return $string;
+	if ( !is_string($string) )
+		return -1;
+
+	if ( stristr($string, 'utc') || stristr($string, 'gmt') || stristr($string, '+0000') )
+		return strtotime($string);
+
+	if ( -1 == $time = strtotime($string . ' +0000') )
+		return strtotime($string);
+
+	return $time;
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-forums.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-forums.php
new file mode 100644
index 0000000000000000000000000000000000000000..5ae3320fe4394e9bd4eebb570ce30f71d764cee4
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-forums.php
@@ -0,0 +1,157 @@
+<?php
+
+/* Forums */
+
+function bb_get_forums_hierarchical( $root = 0, $depth = 0, $leaves = false, $_recursed = false ) {
+	static $_leaves = false;
+
+	if (!$_recursed)
+		$_leaves = false;
+
+	$root = (int) $root;
+
+	if ( false === $_leaves )
+		$_leaves = $leaves ? $leaves : bb_get_forums();
+
+	if ( !$_leaves )
+		return false;
+
+	$branch = array();
+
+	reset($_leaves);
+
+	while ( list($l, $leaf) = each($_leaves) ) {
+		if ( $root == $leaf->forum_parent ) {
+			$new_root = (int) $leaf->forum_id;
+			unset($_leaves[$l]);
+			$branch[$new_root] = 1 == $depth ? true : bb_get_forums_hierarchical( $new_root, $depth - 1, false, true );
+			reset($_leaves);
+		}
+	}
+
+	if ( !$_recursed ) {
+		if ( !$root )
+			foreach ( $_leaves as $leaf ) // Attach orphans to root
+				$branch[$leaf->forum_id] = true;
+		$_leaves = false;
+		return ( empty($branch) ? false : $branch );
+	}
+
+	return $branch ? $branch : true;
+}
+
+function _bb_get_cached_data( $keys, $group, $callback ) {
+	$return = array();
+	foreach ( $keys as $key ) {
+		// should use wp_cache_get_multi if available
+		if ( false === $value = wp_cache_get( $key, $group ) )
+			if ( !$value = call_user_func( $group, $key ) )
+				continue;
+		$return[$key] = $value;
+	}
+	return $return;
+}
+
+// 'where' arg provided for backward compatibility only
+function bb_get_forums( $args = null ) {
+	global $bbdb;
+
+	if ( is_numeric($args) ) {
+		$args = array( 'child_of' => $args, 'hierarchical' => 1, 'depth' => 0 );
+	} elseif ( is_callable($args) ) {
+		$args = array( 'callback' => $args );
+		if ( 1 < func_num_args() )
+			$args['callback_args'] = func_get_arg(1);
+	}
+
+	$defaults = array( 'callback' => false, 'callback_args' => false, 'child_of' => 0, 'hierarchical' => 0, 'depth' => 0, 'cut_branch' => 0, 'where' => '', 'order_by' => 'forum_order' );
+	$args = wp_parse_args( $args, $defaults );
+
+	extract($args, EXTR_SKIP);
+	$child_of = (int) $child_of;
+	$hierarchical = 'false' === $hierarchical ? false : (bool) $hierarchical;
+	$depth = (int) $depth;
+
+	$where = apply_filters( 'get_forums_where', $where );
+	$key = md5( serialize( $where . '|' . $order_by ) ); // The keys that change the SQL query
+	if ( false !== $forum_ids = wp_cache_get( $key, 'bb_forums' ) ) {
+		$forums = _bb_get_cached_data( $forum_ids, 'bb_forum', 'get_forum' );
+	} else {
+		$forum_ids = array();
+		$forums = array();
+		$_forums = (array) $bbdb->get_results("SELECT * FROM $bbdb->forums $where ORDER BY `$order_by`;");
+		$_forums = bb_append_meta( $_forums, 'forum' );
+		foreach ( $_forums as $f ) {
+			$forums[(int) $f->forum_id] = $f;
+			$forum_ids[] = (int) $f->forum_id;
+			wp_cache_add( $f->forum_id, $f, 'bb_forum' );
+			wp_cache_add( $f->forum_slug, $f->forum_id, 'bb_forum_slug' );
+		}
+		wp_cache_set( $key, $forum_ids, 'bb_forums' );
+	}
+
+	$forums = (array) apply_filters( 'get_forums', $forums );
+
+	if ( $child_of || $hierarchical || $depth ) {
+
+		$_forums = bb_get_forums_hierarchical( $child_of, $depth, $forums );
+
+		if ( !is_array( $_forums ) )
+			return false;
+
+		$_forums = (array) bb_flatten_array( $_forums, $cut_branch );
+
+		foreach ( array_keys($_forums) as $_id )
+			$_forums[$_id] = $forums[$_id];
+
+		$forums = $_forums;
+	}
+
+	if ( !is_callable($callback) )
+		return $forums;
+
+	if ( !is_array($callback_args) )
+		$callback_args = array();
+
+	foreach ( array_keys($forums) as $f ) :
+		$_callback_args = $callback_args;
+		array_push( $_callback_args, $forums[$f]->forum_id );
+		if ( false == call_user_func_array( $callback, $_callback_args ) ) // $forum_id will be last arg;
+			unset($forums[$f]);
+	endforeach;
+	return $forums;
+}
+
+function bb_get_forum( $id ) {
+	global $bbdb;
+
+	if ( !is_numeric($id) ) {
+		list($slug, $sql) = bb_get_sql_from_slug( 'forum', $id );
+		$id = wp_cache_get( $slug, 'bb_forum_slug' );
+	}
+
+	// not else
+	if ( is_numeric($id) ) {
+		$id = (int) $id;
+		$sql = "forum_id = $id";
+	}
+
+	if ( 0 === $id || !$sql )
+		return false;
+
+	// $where is NOT bbdb:prepared
+	if ( $where = apply_filters( 'get_forum_where', '' ) ) {
+		$forum = $bbdb->get_row( $bbdb->prepare( "SELECT * FROM $bbdb->forums WHERE forum_id = %d", $id ) . " $where" );
+		return bb_append_meta( $forum, 'forum' );
+	}
+
+	if ( is_numeric($id) && false !== $forum = wp_cache_get( $id, 'bb_forum' ) )
+		return $forum;
+
+	$forum = $bbdb->get_row( $bbdb->prepare( "SELECT * FROM $bbdb->forums WHERE $sql", $id ) );
+	$forum = bb_append_meta( $forum, 'forum' );
+	wp_cache_set( $forum->forum_id, $forum, 'bb_forum' );
+	wp_cache_add( $forum->forum_slug, $forum, 'bb_forum_slug' );
+
+	return $forum;
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-l10n.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-l10n.php
new file mode 100644
index 0000000000000000000000000000000000000000..a5c1bef3cf2a1dff8b16d39a556ef45af3ff6ee1
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-l10n.php
@@ -0,0 +1,490 @@
+<?php
+/**
+ * bbPress Translation API
+ *
+ * @package bbPress
+ * @subpackage i18n
+ */
+
+/**
+ * Gets the current locale.
+ *
+ * If the locale is set, then it will filter the locale in the 'locale' filter
+ * hook and return the value.
+ *
+ * If the locale is not set already, then the BB_LANG constant is used if it is
+ * defined. Then it is filtered through the 'locale' filter hook and the value
+ * for the locale global set and the locale is returned.
+ *
+ * The process to get the locale should only be done once but the locale will
+ * always be filtered using the 'locale' hook.
+ *
+ * @since 0.7.2
+ * @uses apply_filters() Calls 'locale' hook on locale value.
+ * @uses $locale Gets the locale stored in the global.
+ *
+ * @return string The locale of the blog or from the 'locale' hook.
+ */
+function bb_get_locale() {
+	global $locale;
+
+	if (isset($locale))
+		return apply_filters( 'locale', $locale );
+
+	// BB_LANG is defined in bb-config.php
+	if (defined('BB_LANG'))
+		$locale = BB_LANG;
+
+	if (empty($locale))
+		$locale = 'en_US';
+
+	return apply_filters('locale', $locale);
+}
+
+if ( !function_exists( 'get_locale' ) ) :
+function get_locale() {
+	return bb_get_locale();
+}
+endif;
+
+if ( !function_exists( 'translate' ) ) :
+/**
+ * Retrieves the translation of $text. If there is no translation, or
+ * the domain isn't loaded the original text is returned.
+ *
+ * @see __() Don't use translate() directly, use __()
+ * @since 1.0
+ * @uses apply_filters() Calls 'gettext' on domain translated text
+ *		with the untranslated text as second parameter.
+ *
+ * @param string $text Text to translate.
+ * @param string $domain Domain to retrieve the translated text.
+ * @return string Translated text
+ */
+function translate( $text, $domain = 'default' ) {
+	$translations = &get_translations_for_domain( $domain );
+	return apply_filters('gettext', $translations->translate($text), $text, $domain);
+}
+endif;
+
+if ( !function_exists( 'before_last_bar' ) ) :
+/**
+ * @since 1.0
+ */
+function before_last_bar( $string ) {
+	$last_bar = strrpos( $string, '|' );
+	if ( false == $last_bar )
+		return $string;
+	else
+		return substr( $string, 0, $last_bar );
+}
+endif;
+
+if ( !function_exists( 'translate_with_context' ) ) :
+/**
+ * Translate $text like translate(), but assumes that the text
+ * contains a context after its last vertical bar.
+ *
+ * @since 1.0
+ * @uses translate()
+ *
+ * @param string $text Text to translate
+ * @param string $domain Domain to retrieve the translated text
+ * @return string Translated text
+ */
+function translate_with_context( $text, $domain = 'default' ) {
+	return before_last_bar( translate( $text, $domain ) );
+
+}
+endif;
+
+if ( !function_exists( 'translate_with_gettext_context' ) ) :
+/**
+ * @since 1.0
+ */
+function translate_with_gettext_context( $text, $context, $domain = 'default' ) {
+	$translations = &get_translations_for_domain( $domain );
+	return apply_filters( 'gettext_with_context', $translations->translate( $text, $context ), $text, $context, $domain);
+}
+endif;
+
+if ( !function_exists( '__' ) ) :
+/**
+ * Retrieves the translation of $text. If there is no translation, or
+ * the domain isn't loaded the original text is returned.
+ *
+ * @see translate() An alias of translate()
+ * @since 0.7.2
+ *
+ * @param string $text Text to translate
+ * @param string $domain Optional. Domain to retrieve the translated text
+ * @return string Translated text
+ */
+function __( $text, $domain = 'default' ) {
+	return translate( $text, $domain );
+}
+endif;
+
+if ( !function_exists( 'esc_attr__' ) ) :
+/**
+ * Retrieves the translation of $text and escapes it for safe use in an attribute.
+ * If there is no translation, or the domain isn't loaded the original text is returned.
+ *
+ * @see translate() An alias of translate()
+ * @see esc_attr()
+ * @since 1.0
+ *
+ * @param string $text Text to translate
+ * @param string $domain Optional. Domain to retrieve the translated text
+ * @return string Translated text
+ */
+function esc_attr__( $text, $domain = 'default' ) {
+	return esc_attr( translate( $text, $domain ) );
+}
+endif;
+
+if ( !function_exists( 'esc_html__' ) ) :
+/**
+ * Retrieves the translation of $text and escapes it for safe use in HTML output.
+ * If there is no translation, or the domain isn't loaded the original text is returned.
+ *
+ * @see translate() An alias of translate()
+ * @see esc_html()
+ * @since 1.0
+ *
+ * @param string $text Text to translate
+ * @param string $domain Optional. Domain to retrieve the translated text
+ * @return string Translated text
+ */
+function esc_html__( $text, $domain = 'default' ) {
+	return esc_html( translate( $text, $domain ) );
+}
+endif;
+
+if ( !function_exists( '_e' ) ) :
+/**
+ * Displays the returned translated text from translate().
+ *
+ * @see translate() Echos returned translate() string
+ * @since 0.7.2
+ *
+ * @param string $text Text to translate
+ * @param string $domain Optional. Domain to retrieve the translated text
+ */
+function _e( $text, $domain = 'default' ) {
+	echo translate( $text, $domain );
+}
+endif;
+
+if ( !function_exists( 'esc_attr_e' ) ) :
+/**
+ * Displays translated text that has been escaped for safe use in an attribute.
+ *
+ * @see translate() Echoes returned translate() string
+ * @see esc_attr()
+ * @since 1.0
+ *
+ * @param string $text Text to translate
+ * @param string $domain Optional. Domain to retrieve the translated text
+ */
+function esc_attr_e( $text, $domain = 'default' ) {
+	echo esc_attr( translate( $text, $domain ) );
+}
+endif;
+
+if ( !function_exists( 'esc_html_e' ) ) :
+/**
+ * Displays translated text that has been escaped for safe use in HTML output.
+ *
+ * @see translate() Echoes returned translate() string
+ * @see esc_html()
+ * @since 1.0
+ *
+ * @param string $text Text to translate
+ * @param string $domain Optional. Domain to retrieve the translated text
+ */
+function esc_html_e( $text, $domain = 'default' ) {
+	echo esc_html( translate( $text, $domain ) );
+}
+endif;
+
+if ( !function_exists( '_c' ) ) :
+/**
+ * Retrieve translated string with vertical bar context
+ *
+ * Quite a few times, there will be collisions with similar translatable text
+ * found in more than two places but with different translated context.
+ *
+ * In order to use the separate contexts, the _c() function is used and the
+ * translatable string uses a pipe ('|') which has the context the string is in.
+ *
+ * When the translated string is returned, it is everything before the pipe, not
+ * including the pipe character. If there is no pipe in the translated text then
+ * everything is returned.
+ *
+ * @since 1.0
+ *
+ * @param string $text Text to translate
+ * @param string $domain Optional. Domain to retrieve the translated text
+ * @return string Translated context string without pipe
+ */
+function _c($text, $domain = 'default') {
+	return translate_with_context($text, $domain);
+}
+endif;
+
+if ( !function_exists( '_x' ) ) :
+/**
+ * @since 1.0
+ */
+function _x( $single, $context, $domain = 'default' ) {
+	return translate_with_gettext_context( $single, $context, $domain );
+}
+endif;
+
+if ( !function_exists( 'esc_attr_x' ) ) :
+function esc_attr_x( $single, $context, $domain = 'default' ) {
+	return esc_attr( translate_with_gettext_context( $single, $context, $domain ) );
+}
+endif;
+
+if ( !function_exists( '__ngettext' ) ) :
+/**
+ * @deprecated Use _n()
+ */
+function __ngettext() {
+	//_deprecated_function( __FUNCTION__, '2.8', '_n()' );
+	$args = func_get_args();
+	return call_user_func_array('_n', $args);
+}
+endif;
+
+if ( !function_exists( '_n' ) ) :
+/**
+ * Retrieve the plural or single form based on the amount.
+ *
+ * If the domain is not set in the $l10n list, then a comparsion will be made
+ * and either $plural or $single parameters returned.
+ *
+ * If the domain does exist, then the parameters $single, $plural, and $number
+ * will first be passed to the domain's ngettext method. Then it will be passed
+ * to the 'ngettext' filter hook along with the same parameters. The expected
+ * type will be a string.
+ *
+ * @since 1.0
+ * @uses $l10n Gets list of domain translated string (gettext_reader) objects
+ * @uses apply_filters() Calls 'ngettext' hook on domains text returned,
+ *		along with $single, $plural, and $number parameters. Expected to return string.
+ *
+ * @param string $single The text that will be used if $number is 1
+ * @param string $plural The text that will be used if $number is not 1
+ * @param int $number The number to compare against to use either $single or $plural
+ * @param string $domain Optional. The domain identifier the text should be retrieved in
+ * @return string Either $single or $plural translated text
+ */
+function _n($single, $plural, $number, $domain = 'default') {
+	$translations = &get_translations_for_domain( $domain );
+	$translation = $translations->translate_plural( $single, $plural, $number );
+	return apply_filters( 'ngettext', $translation, $single, $plural, $number );
+}
+endif;
+
+if ( !function_exists( '_nc' ) ) :
+/**
+ * @see _n() A version of _n(), which supports contexts --
+ * strips everything from the translation after the last bar
+ * @since 1.0
+ */
+function _nc( $single, $plural, $number, $domain = 'default' ) {
+	return before_last_bar( _n( $single, $plural, $number, $domain ) );
+}
+endif;
+
+if ( !function_exists( '_nx' ) ) :
+/**
+ * @since 1.0
+ */
+function _nx($single, $plural, $number, $context, $domain = 'default') {
+	$translations = &get_translations_for_domain( $domain );
+	$translation = $translations->translate_plural( $single, $plural, $number, $context );
+	return apply_filters( 'ngettext_with_context ', $translation, $single, $plural, $number, $context );
+}
+endif;
+
+if ( !function_exists( '__ngettext_noop' ) ) :
+/**
+ * @deprecated Use _n_noop()
+ */
+function __ngettext_noop() {
+	//_deprecated_function( __FUNCTION__, '2.8', '_n_noop()' );
+	$args = func_get_args();
+	return call_user_func_array('_n_noop', $args);
+}
+endif;
+
+if ( !function_exists( '_n_noop' ) ) :
+/**
+ * Register plural strings in POT file, but don't translate them.
+ *
+ * Used when you want do keep structures with translatable plural strings and
+ * use them later.
+ *
+ * Example:
+ *  $messages = array(
+ *  	'post' => _n_noop('%s post', '%s posts'),
+ *  	'page' => _n_noop('%s pages', '%s pages')
+ *  );
+ *  ...
+ *  $message = $messages[$type];
+ *  $usable_text = sprintf(_n($message[0], $message[1], $count), $count);
+ *
+ * @since 1.0
+ * @param $single Single form to be i18ned
+ * @param $plural Plural form to be i18ned
+ * @return array array($single, $plural)
+ */
+function _n_noop( $single, $plural ) {
+	return array( $single, $plural );
+}
+endif;
+
+if ( !function_exists( '_nx_noop' ) ) :
+/**
+ * Register plural strings with context in POT file, but don't translate them.
+ *
+ * @see _n_noop()
+ */
+function _nx_noop( $single, $plural, $context ) {
+	return array( $single, $plural, $context );
+}
+endif;
+
+if ( !function_exists( 'load_textdomain' ) ) :
+/**
+ * Loads MO file into the list of domains.
+ *
+ * If the domain already exists, the inclusion will fail. If the MO file is not
+ * readable, the inclusion will fail.
+ *
+ * On success, the mofile will be placed in the $l10n global by $domain and will
+ * be an gettext_reader object.
+ *
+ * @since 0.7.2
+ * @uses $l10n Gets list of domain translated string (gettext_reader) objects
+ * @uses CacheFileReader Reads the MO file
+ * @uses gettext_reader Allows for retrieving translated strings
+ *
+ * @param string $domain Unique identifier for retrieving translated strings
+ * @param string $mofile Path to the .mo file
+ * @return null On failure returns null and also on success returns nothing.
+ */
+function load_textdomain($domain, $mofile) {
+	global $l10n;
+
+	if ( !is_readable($mofile)) return;
+	
+	$mo = new MO();
+	$mo->import_from_file( $mofile );
+
+	if (isset($l10n[$domain]))
+		$mo->merge_with( $l10n[$domain] );
+		
+	$l10n[$domain] = &$mo;
+}
+endif;
+
+/**
+ * Loads default translated strings based on locale.
+ *
+ * Loads the .mo file in WP_LANG_DIR constant path from WordPress root. The
+ * translated (.mo) file is named based off of the locale.
+ *
+ * @since 1.5.0
+ */
+function bb_load_default_textdomain() {
+	$locale = bb_get_locale();
+
+	$mofile = BB_LANG_DIR . "/$locale.mo";
+
+	load_textdomain('default', $mofile);
+}
+
+if ( !function_exists( 'load_default_textdomain' ) ) :
+function load_default_textdomain() {
+	bb_load_default_textdomain();
+}
+endif;
+
+/**
+ * Loads the plugin's translated strings.
+ *
+ * If the path is not given then it will be the root of the plugin directory.
+ * The .mo file should be named based on the domain with a dash followed by a
+ * dash, and then the locale exactly.
+ *
+ * @since 0.7.2
+ *
+ * @param string $domain Unique identifier for retrieving translated strings
+ * @param string $path Optional. Absolute path to folder where the .mo file resides
+ */
+function bb_load_plugin_textdomain($domain, $path = false) {
+	$locale = bb_get_locale();
+
+	if ( false === $path ) {
+		global $bb;
+		$path = $bb->plugin_locations['core']['dir'];
+	}
+
+	$mofile = rtrim( trim( $path ), " \t\n\r\0\x0B/" ) . '/'. $domain . '-' . $locale . '.mo';
+	load_textdomain($domain, $mofile);
+}
+
+if ( !function_exists( 'load_plugin_textdomain' ) ) :
+function load_plugin_textdomain( $domain, $path = false ) {
+	bb_load_plugin_textdomain( $domain, $path );
+}
+endif;
+
+/**
+ * Loads the theme's translated strings.
+ *
+ * If the current locale exists as a .mo file in the theme's root directory, it
+ * will be included in the translated strings by the $domain.
+ *
+ * The .mo files must be named based on the locale exactly.
+ *
+ * @since 0.7.2
+ *
+ * @param string $domain Unique identifier for retrieving translated strings
+ */
+function bb_load_theme_textdomain($domain, $path = false) {
+	$locale = bb_get_locale();
+
+	$mofile = ( empty( $path ) ) ? bb_get_template( $locale . '.mo' ) : "$path/$locale.mo";
+	
+	load_textdomain($domain, $mofile);
+}
+
+if ( !function_exists( 'load_theme_textdomain' ) ) :
+function load_theme_textdomain( $domain, $path = false ) {
+	bb_load_theme_textdomain( $domain, $path );
+}
+endif;
+
+if ( !function_exists( 'get_translations_for_domain' ) ) :
+/**
+ * Returns the Translations instance for a domain. If there isn't one,
+ * returns empty Translations instance.
+ *
+ * @param string $domain
+ * @return object A Translation instance
+ */
+function &get_translations_for_domain( $domain ) {
+	global $l10n;
+	$empty = &new Translations;
+	if ( isset($l10n[$domain]) )
+		return $l10n[$domain];
+	else
+		return $empty;
+}
+endif;
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-meta.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-meta.php
new file mode 100644
index 0000000000000000000000000000000000000000..e8bd12063594f6b437af6752e8b8f231ff7a90a5
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-meta.php
@@ -0,0 +1,932 @@
+<?php
+
+/* Options/Meta */
+
+
+/* Internal */
+
+function bb_sanitize_meta_key( $key )
+{
+	return preg_replace( '|[^a-z0-9_]|i', '', $key );
+}
+
+/**
+ * Adds and updates meta data in the database
+ *
+ * @internal
+ */
+function bb_update_meta( $object_id = 0, $meta_key, $meta_value, $type, $global = false )
+{
+	global $bbdb;
+	if ( !is_numeric( $object_id ) || empty( $object_id ) && !$global ) {
+		return false;
+	}
+	$cache_object_id = $object_id = (int) $object_id;
+	switch ( $type ) {
+		case 'option':
+			$object_type = 'bb_option';
+			break;
+		case 'user' :
+			global $wp_users_object;
+			$id = $object_id;
+			$return = $wp_users_object->update_meta( compact( 'id', 'meta_key', 'meta_value' ) );
+			if ( is_wp_error( $return ) ) {
+				return false;
+			}
+			return $return;
+			break;
+		case 'forum' :
+			$object_type = 'bb_forum';
+			break;
+		case 'topic' :
+			$object_type = 'bb_topic';
+			break;
+		case 'post' :
+			$object_type = 'bb_post';
+			break;
+		default :
+			$object_type = $type;
+			break;
+	}
+
+	$meta_key = bb_sanitize_meta_key( $meta_key );
+
+	$meta_tuple = compact( 'object_type', 'object_id', 'meta_key', 'meta_value', 'type' );
+	$meta_tuple = apply_filters( 'bb_update_meta', $meta_tuple );
+	extract( $meta_tuple, EXTR_OVERWRITE );
+
+	$meta_value = $_meta_value = maybe_serialize( $meta_value );
+	$meta_value = maybe_unserialize( $meta_value );
+
+	$cur = $bbdb->get_row( $bbdb->prepare( "SELECT * FROM `$bbdb->meta` WHERE `object_type` = %s AND `object_id` = %d AND `meta_key` = %s", $object_type, $object_id, $meta_key ) );
+	if ( !$cur ) {
+		$bbdb->insert( $bbdb->meta, array( 'object_type' => $object_type, 'object_id' => $object_id, 'meta_key' => $meta_key, 'meta_value' => $_meta_value ) );
+	} elseif ( $cur->meta_value != $meta_value ) {
+		$bbdb->update( $bbdb->meta, array( 'meta_value' => $_meta_value), array( 'object_type' => $object_type, 'object_id' => $object_id, 'meta_key' => $meta_key ) );
+	}
+
+	if ( $object_type === 'bb_option' ) {
+		$cache_object_id = $meta_key;
+		wp_cache_delete( $cache_object_id, 'bb_option_not_set' );
+	}
+	wp_cache_delete( $cache_object_id, $object_type );
+
+	if ( !$cur ) {
+		return true;
+	}
+}
+
+/**
+ * Deletes meta data from the database
+ *
+ * @internal
+ */
+function bb_delete_meta( $object_id = 0, $meta_key, $meta_value, $type, $global = false )
+{
+	global $bbdb;
+	if ( !is_numeric( $object_id ) || empty( $object_id ) && !$global ) {
+		return false;
+	}
+	$cache_object_id = $object_id = (int) $object_id;
+	switch ( $type ) {
+		case 'option':
+			$object_type = 'bb_option';
+			break;
+		case 'user':
+			global $wp_users_object;
+			$id = $object_id;
+			return $wp_users_object->update_meta( compact( 'id', 'meta_key', 'meta_value' ) );
+			break;
+		case 'forum':
+			$object_type = 'bb_forum';
+			break;
+		case 'topic':
+			$object_type = 'bb_topic';
+			break;
+		case 'post':
+			$object_type = 'bb_post';
+			break;
+		default:
+			$object_type = $type;
+			break;
+	}
+
+	$meta_key = bb_sanitize_meta_key( $meta_key );
+
+	$meta_tuple = compact( 'object_type', 'object_id', 'meta_key', 'meta_value', 'type' );
+	$meta_tuple = apply_filters( 'bb_delete_meta', $meta_tuple );
+	extract( $meta_tuple, EXTR_OVERWRITE );
+
+	$meta_value = maybe_serialize( $meta_value );
+
+	if ( empty( $meta_value ) ) {
+		$meta_sql = $bbdb->prepare( "SELECT `meta_id` FROM `$bbdb->meta` WHERE `object_type` = %s AND `object_id` = %d AND `meta_key` = %s", $object_type, $object_id, $meta_key );
+	} else {
+		$meta_sql = $bbdb->prepare( "SELECT `meta_id` FROM `$bbdb->meta` WHERE `object_type` = %s AND `object_id` = %d AND `meta_key` = %s AND `meta_value` = %s", $object_type, $object_id, $meta_key, $meta_value );
+	}
+
+	if ( !$meta_id = $bbdb->get_var( $meta_sql ) ) {
+		return false;
+	}
+
+	$bbdb->query( $bbdb->prepare( "DELETE FROM `$bbdb->meta` WHERE `meta_id` = %d", $meta_id ) );
+
+	if ( $object_type == 'bb_option' ) {
+		$cache_object_id = $meta_key;
+		wp_cache_delete( $cache_object_id, 'bb_option_not_set' );
+	}
+	wp_cache_delete( $cache_object_id, $object_type );
+	return true;
+}
+
+/**
+ * Adds an objects meta data to the object
+ *
+ * This is the only function that should add to user / topic - NOT bbdb::prepared
+ *
+ * @internal
+ */
+function bb_append_meta( $object, $type )
+{
+	global $bbdb;
+	switch ( $type ) {
+		case 'user':
+			global $wp_users_object;
+			return $wp_users_object->append_meta( $object );
+			break;
+		case 'forum':
+			$object_id_column = 'forum_id';
+			$object_type = 'bb_forum';
+			$slug = 'forum_slug';
+			break;
+		case 'topic':
+			$object_id_column = 'topic_id';
+			$object_type = 'bb_topic';
+			$slug = 'topic_slug';
+			break;
+		case 'post':
+			$object_id_column = 'post_id';
+			$object_type = 'bb_post';
+			$slug = false;
+			break;
+	}
+
+	if ( is_array( $object ) && count( $object ) ) {
+		$trans = array();
+		foreach ( array_keys( $object ) as $i ) {
+			$trans[$object[$i]->$object_id_column] =& $object[$i];
+		}
+		$ids = array_map( 'intval', array_keys( $trans ) );
+		$query_ids = array();
+		$cached_objects = array();
+		$position = 0;
+		foreach ( $ids as $_id ) {
+			if ( false !== $_cached_object = wp_cache_get( $_id, $object_type ) ) {
+				$cached_objects[$position] = $_cached_object;
+			} else {
+				$query_ids[$position] = $_id;
+			}
+			$position++;
+		}
+		if ( !count( $query_ids ) ) {
+			return $cached_objects;
+		}
+
+		$_query_ids = $query_ids;
+		sort( $_query_ids );
+		$_query_ids = join( ',', $_query_ids );
+
+		if ( $metas = $bbdb->get_results( "SELECT `object_id`, `meta_key`, `meta_value` FROM `$bbdb->meta` WHERE `object_type` = '$object_type' AND `object_id` IN ($_query_ids) /* bb_append_meta */" ) ) {
+			usort( $metas, '_bb_append_meta_sort' );
+			foreach ( $metas as $meta ) {
+				$trans[$meta->object_id]->{$meta->meta_key} = maybe_unserialize( $meta->meta_value );
+				if ( strpos($meta->meta_key, $bbdb->prefix) === 0 ) {
+					$trans[$meta->object_id]->{substr($meta->meta_key, strlen($bbdb->prefix))} = maybe_unserialize( $meta->meta_value );
+				}
+			}
+		}
+		foreach ( $query_ids as $position => $i ) {
+			$cached_objects[$position] = $trans[$i];
+			wp_cache_add( $i, $trans[$i], $object_type );
+			if ( $slug ) {
+				wp_cache_add( $trans[$i]->$slug, $i, 'bb_' . $slug );
+			}
+		}
+		if ( !count( $cached_objects ) ) {
+			return $object;
+		}
+		ksort( $cached_objects );
+
+		return $cached_objects;
+	} elseif ( $object ) {
+		if ( false !== $cached_object = wp_cache_get( $object->$object_id_column, $object_type ) ) {
+			return $cached_object;
+		}
+		if ( $metas = $bbdb->get_results( $bbdb->prepare( "SELECT `object_id`, `meta_key`, `meta_value` FROM `$bbdb->meta` WHERE `object_type` = '$object_type' AND `object_id` = %d /* bb_append_meta */", $object->$object_id_column ) ) ) {
+			usort( $metas, '_bb_append_meta_sort' );
+			foreach ( $metas as $meta ) {
+				$object->{$meta->meta_key} = maybe_unserialize( $meta->meta_value );
+				if ( strpos( $meta->meta_key, $bbdb->prefix ) === 0 ) {
+					$object->{substr( $meta->meta_key, strlen( $bbdb->prefix ) )} = $object->{$meta->meta_key};
+				}
+			}
+		}
+		if ( $object->$object_id_column ) {
+			wp_cache_add( $object->$object_id_column, $object, $object_type );
+			if ( $slug ) {
+				wp_cache_add( $object->$slug, $object->$object_id_column, 'bb_' . $slug );
+			}
+		}
+		return $object;
+	}
+}
+
+/**
+ * Sorts meta keys by length to ensure $appended_object->{$bbdb->prefix} key overwrites $appended_object->key as desired
+ *
+ * @internal
+ */
+function _bb_append_meta_sort( $a, $b )
+{
+	return strlen( $a->meta_key ) - strlen( $b->meta_key );
+}
+
+
+
+/* Options */
+
+/**
+ * Echoes the requested bbPress option by calling bb_get_option()
+ *
+ * @param string The option to be echoed
+ * @return void
+ */
+function bb_option( $option )
+{
+	echo apply_filters( 'bb_option_' . $option, bb_get_option( $option ) );
+}
+
+/**
+ * Returns the requested bbPress option from the meta table or the $bb object
+ *
+ * @param string The option to be echoed
+ * @return mixed The value of the option
+ */
+function bb_get_option( $option )
+{
+	// Allow plugins to short-circuit options.
+	if ( false !== $r = apply_filters( 'bb_pre_get_option_' . $option, false, $option ) ) {
+		return $r;
+	}
+
+	global $bb;
+
+	switch ( $option ) {
+		case 'site_id':
+			if ( isset( $bb->site_id ) && is_numeric( $bb->site_id ) ) {
+				$r = (int) $bb->site_id;
+			} else {
+				$r = 1;
+			}
+			break;
+		case 'language':
+			$r = str_replace( '_', '-', bb_get_locale() );
+			break;
+		case 'text_direction':
+			global $bb_locale;
+			$r = $bb_locale->text_direction;
+			break;
+		case 'version':
+			return '1.0.2'; // Don't filter
+			break;
+		case 'bb_db_version' :
+			return '2078'; // Don't filter
+			break;
+		case 'html_type':
+			$r = 'text/html';
+			break;
+		case 'charset':
+			$r = 'UTF-8';
+			break;
+		case 'bb_table_prefix':
+		case 'table_prefix':
+			global $bbdb;
+			return $bbdb->prefix; // Don't filter;
+			break;
+		case 'url':
+			$option = 'uri';
+		default:
+			if ( isset( $bb->$option ) ) {
+				$r = $bb->$option;
+				if ( $option === 'mod_rewrite' ) {
+					if ( is_bool( $r ) ) {
+						$r = (int) $r;
+					}
+				}
+				break;
+			}
+
+			$r = bb_get_option_from_db( $option );
+
+			if ( !$r ) {
+				switch ( $option ) {
+					case 'name':
+						$r = __( 'Please give me a name!' );
+						break;
+					case 'wp_table_prefix' :
+						global $wp_table_prefix; // This global is deprecated
+						return $wp_table_prefix; // Don't filter;
+						break;
+					case 'mod_rewrite':
+						$r = 0;
+						break;
+					case 'page_topics':
+						$r = 30;
+						break;
+					case 'edit_lock':
+						$r = 60;
+						break;
+					case 'gmt_offset':
+						$r = 0;
+						break;
+					case 'uri_ssl':
+						$r = preg_replace( '|^http://|i', 'https://', bb_get_option( 'uri' ) );
+						break;
+					case 'throttle_time':
+						$r = 30;
+						break;
+					case 'email_login':
+						$r = false;
+						break;
+				}
+			}
+			break;
+	}
+
+	return apply_filters( 'bb_get_option_' . $option, $r, $option );
+}
+
+/**
+ * Retrieves and returns the requested bbPress option from the meta table
+ *
+ * @param string The option to be echoed
+ * @return void
+ */
+function bb_get_option_from_db( $option )
+{
+	global $bbdb;
+	$option = bb_sanitize_meta_key( $option );
+
+	if ( wp_cache_get( $option, 'bb_option_not_set' ) ) {
+		$r = null;
+	} elseif ( false !== $_r = wp_cache_get( $option, 'bb_option' ) ) {
+		$r = $_r;
+	} else {
+		if ( BB_INSTALLING ) {
+			$bbdb->suppress_errors();
+		}
+		$row = $bbdb->get_row( $bbdb->prepare( "SELECT `meta_value` FROM `$bbdb->meta` WHERE `object_type` = 'bb_option' AND `meta_key` = %s", $option ) );
+		if ( BB_INSTALLING ) {
+			$bbdb->suppress_errors( false );
+		}
+
+		if ( is_object( $row ) ) {
+			$r = maybe_unserialize( $row->meta_value );
+		} else {
+			$r = null;
+		}
+	}
+
+	if ( $r === null ) {
+		wp_cache_set( $option, true, 'bb_option_not_set' );
+	} else {
+		wp_cache_set( $option, $r, 'bb_option' );
+	}
+
+	return apply_filters( 'bb_get_option_from_db_' . $option, $r, $option );
+}
+
+function bb_form_option( $option )
+{
+	echo bb_get_form_option( $option );
+}
+
+function bb_get_form_option( $option )
+{
+	return esc_attr( bb_get_option( $option ) );
+}
+
+// Don't use the return value; use the API. Only returns options stored in DB.
+function bb_cache_all_options()
+{
+	$base_options = array(
+		'site_id',
+		'bb_db_version',
+		'name',
+		'description',
+		'uri_ssl',
+		'from_email',
+		'bb_auth_salt',
+		'bb_secure_auth_salt',
+		'bb_logged_in_salt',
+		'bb_nonce_salt',
+		'page_topics',
+		'edit_lock',
+		'bb_active_theme',
+		'active_plugins',
+		'mod_rewrite',
+		'datetime_format',
+		'date_format',
+		'avatars_show',
+		'avatars_default',
+		'avatars_rating',
+		'wp_table_prefix',
+		'user_bbdb_name',
+		'user_bbdb_user',
+		'user_bbdb_password',
+		'user_bbdb_host',
+		'user_bbdb_charset',
+		'user_bbdb_collate',
+		'custom_user_table',
+		'custom_user_meta_table',
+		'wp_siteurl',
+		'wp_home',
+		'cookiedomain',
+		'usercookie',
+		'passcookie',
+		'authcookie',
+		'cookiepath',
+		'sitecookiepath',
+		'secure_auth_cookie',
+		'logged_in_cookie',
+		'admin_cookie_path',
+		'core_plugins_cookie_path',
+		'user_plugins_cookie_path',
+		'wp_admin_cookie_path',
+		'wp_plugins_cookie_path',
+		'wordpress_mu_primary_blog_id',
+		'enable_xmlrpc',
+		'enable_pingback',
+		'throttle_time',
+		'bb_xmlrpc_allow_user_switching',
+		'bp_bbpress_cron',
+		'email_login',
+		'static_title',
+		'plugin_cookie_paths',
+		'wp_roles_map',
+		'gmt_offset',
+		'timezone_string'
+	);
+
+	// Check that these aren't already in the cache
+	$query_options = array();
+	foreach ( $base_options as $base_option ) {
+		if ( isset( $bb->$base_option ) ) {
+			continue;
+		}
+		if ( wp_cache_get( $base_option, 'bb_option_not_set' ) ) {
+			continue;
+		}
+		if ( false === wp_cache_get( $base_option, 'bb_option' ) ) {
+			$query_options[] = $base_option;
+			wp_cache_set( $base_option, true, 'bb_option_not_set' );
+		}
+	}
+	if ( !count( $query_options ) ) {
+		// It's all in cache
+		return true;
+	}
+
+	$query_keys = "('" . join( "','", $query_options ) . "')";
+
+	global $bbdb;
+	$results = $bbdb->get_results( "SELECT `meta_key`, `meta_value` FROM `$bbdb->meta` WHERE `object_type` = 'bb_option' AND `meta_key` IN $query_keys;" );
+
+	if ( count( $base_options ) === count( $query_options ) && ( !$results || !is_array( $results ) || !count( $results ) ) ) {
+		// Let's assume that the options haven't been populated from the old topicmeta table
+		if ( !BB_INSTALLING ) {
+			$topicmeta_exists = $bbdb->query( "SELECT * FROM $bbdb->topicmeta LIMIT 1" );
+			if ($topicmeta_exists) {
+				require_once( BB_PATH . 'bb-admin/includes/defaults.bb-schema.php' );
+				// Create the meta table
+				$bbdb->query( $bb_queries['meta'] );
+				// Copy options
+				$bbdb->query( "INSERT INTO `$bbdb->meta` (`meta_key`, `meta_value`) SELECT `meta_key`, `meta_value` FROM `$bbdb->topicmeta` WHERE `topic_id` = 0;" );
+				// Copy topic meta
+				$bbdb->query( "INSERT INTO `$bbdb->meta` (`object_id`, `meta_key`, `meta_value`) SELECT `topic_id`, `meta_key`, `meta_value` FROM `$bbdb->topicmeta` WHERE `topic_id` != 0;" );
+				// Entries with an object_id are topic meta at this stage
+				$bbdb->query( "UPDATE `$bbdb->meta` SET `object_type` = 'bb_topic' WHERE `object_id` != 0" );
+			}
+			unset( $topicmeta_exists );
+
+			return bb_cache_all_options();
+		}
+
+		return false;
+	} else {
+		foreach ( $results as $options ) {
+			wp_cache_delete( $options->meta_key, 'bb_option_not_set' );
+			wp_cache_set( $options->meta_key, maybe_unserialize( $options->meta_value ), 'bb_option' );
+		}
+	}
+
+	return true;
+}
+
+// Can store anything but NULL.
+function bb_update_option( $option, $value )
+{
+	return bb_update_meta( 0, $option, $value, 'option', true );
+}
+
+function bb_delete_option( $option, $value = '' )
+{
+	return bb_delete_meta( 0, $option, $value, 'option', true );
+}
+
+/**
+ * Delete a transient
+ *
+ * @since 1.0
+ * @package bbPress
+ * @subpackage Transient
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped
+ * @return bool true if successful, false otherwise
+ */
+function bb_delete_transient( $transient )
+{
+	global $_bb_using_ext_object_cache, $bbdb;
+
+	if ( $_bb_using_ext_object_cache ) {
+		return wp_cache_delete( $transient, 'transient' );
+	} else {
+		$transient = '_transient_' . $bbdb->escape( $transient );
+		return bb_delete_option( $transient );
+	}
+}
+
+/**
+ * Get the value of a transient
+ *
+ * If the transient does not exist or does not have a value, then the return value
+ * will be false.
+ * 
+ * @since 1.0
+ * @package bbPress
+ * @subpackage Transient
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped
+ * @return mixed Value of transient
+ */
+function bb_get_transient( $transient )
+{
+	global $_bb_using_ext_object_cache, $bbdb;
+
+	if ( $_bb_using_ext_object_cache ) {
+		$value = wp_cache_get( $transient, 'transient' );
+	} else {
+		$transient_option = '_transient_' . $bbdb->escape( $transient );
+		$transient_timeout = '_transient_timeout_' . $bbdb->escape( $transient );
+		$timeout = bb_get_option( $transient_timeout );
+		if ( $timeout && $timeout < time() ) {
+			bb_delete_option( $transient_option );
+			bb_delete_option( $transient_timeout );
+			return false;
+		}
+
+		$value = bb_get_option( $transient_option );
+	}
+
+	return apply_filters( 'transient_' . $transient, $value );
+}
+
+/**
+ * Set/update the value of a transient
+ *
+ * You do not need to serialize values, if the value needs to be serialize, then
+ * it will be serialized before it is set.
+ *
+ * @since 1.0
+ * @package bbPress
+ * @subpackage Transient
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped
+ * @param mixed $value Transient value.
+ * @param int $expiration Time until expiration in seconds, default 0
+ * @return bool False if value was not set and true if value was set.
+ */
+function bb_set_transient( $transient, $value, $expiration = 0 )
+{
+	global $_bb_using_ext_object_cache, $bbdb;
+
+	if ( $_bb_using_ext_object_cache ) {
+		return wp_cache_set( $transient, $value, 'transient', $expiration );
+	} else {
+		$transient_timeout = '_transient_timeout_' . $bbdb->escape( $transient );
+		$transient = '_transient_' . $bbdb->escape( $transient );
+		if ( 0 != $expiration ) {
+			bb_update_option( $transient_timeout, time() + $expiration );
+		}
+		return bb_update_option( $transient, $value );
+	}
+}
+
+
+
+/* User meta */
+
+function bb_get_usermeta( $user_id, $meta_key )
+{
+	if ( !$user = bb_get_user( $user_id ) ) {
+		return;
+	}
+
+	$meta_key = bb_sanitize_meta_key( $meta_key );
+	if ( !isset( $user->$meta_key ) ) {
+		return;
+	}
+	return $user->$meta_key;
+}
+
+function bb_update_usermeta( $user_id, $meta_key, $meta_value )
+{
+	return bb_update_meta( $user_id, $meta_key, $meta_value, 'user' );
+}
+
+function bb_delete_usermeta( $user_id, $meta_key, $meta_value = '' )
+{
+	return bb_delete_meta( $user_id, $meta_key, $meta_value, 'user' );
+}
+
+/**
+ * Saves and restores user interface settings stored in a cookie.
+ *
+ * Checks if the current user-settings cookie is updated and stores it. When no
+ * cookie exists (different browser used), adds the last saved cookie restoring
+ * the settings.
+ *
+ * @package bbPress
+ * @subpackage Meta
+ * @since 1.0
+ */
+function bb_user_settings()
+{
+	if ( !defined( 'BB_IS_ADMIN' ) || !BB_IS_ADMIN ) {
+		return;
+	}
+
+	if ( defined( 'DOING_AJAX' ) ) {
+		return;
+	}
+
+	if ( !$user = bb_get_current_user() ) {
+		return;
+	}
+
+	$settings = bb_get_usermeta( $user->ID, 'bb_user_settings' );
+
+	if ( isset( $_COOKIE['bb-user-settings-' . $user->ID] ) ) {
+		$cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['bb-user-settings-' . $user->ID] );
+
+		if ( !empty( $cookie ) && strpos( $cookie, '=' ) ) {
+			if ( $cookie == $settings ) {
+				return;
+			}
+
+			$last_time = (int) bb_get_usermeta( $user->ID, 'bb_user_settings_time' );
+			$saved = isset( $_COOKIE['bb-user-settings-time-' . $user->ID] ) ? preg_replace( '/[^0-9]/', '', $_COOKIE['bb-user-settings-time-' . $user->ID] ) : 0;
+
+			if ( $saved > $last_time ) {
+				bb_update_usermeta( $user->ID, 'bb_user_settings', $cookie );
+				bb_update_usermeta( $user->ID, 'bb_user_settings_time', time() - 5 );
+				return;
+			}
+		}
+	}
+
+	setcookie( 'bb-user-settings-' . $user->ID, $settings, time() + 31536000, $bb->cookiepath );
+	setcookie( 'bb-user-settings-time-' . $user->ID, time(), time() + 31536000, $bb->cookiepath );
+}
+
+/**
+ * Retrieve user interface setting value based on setting name.
+ *
+ * @package bbPress
+ * @subpackage Meta
+ * @since 1.0
+ *
+ * @param string $name The name of the setting.
+ * @param string $default Optional default value to return when $name is not set.
+ * @return mixed the last saved user setting or the default value/false if it doesn't exist.
+ */
+function bb_get_user_setting( $name, $default = false )
+{
+	$arr = bb_get_all_user_settings();
+
+	return isset( $arr[$name] ) ? $arr[$name] : $default;
+}
+
+/**
+ * Adds or updates a user interface setting value based on setting name.
+ *
+ * @package bbPress
+ * @subpackage Meta
+ * @since 1.0
+ *
+ * @param string $name The name of the setting.
+ * @param string $value The value of the setting.
+ */
+function bb_update_user_setting( $name, $value )
+{
+	if ( is_null( $value ) || $value === '' ) {
+		return;
+	}
+
+	if ( !$user = bb_get_current_user() ) {
+		return;
+	}
+
+	$name = (string) $name;
+	$name = preg_replace( '/[^A-Za-z0-9_]/', '', $name );
+
+	$value = (string) $value;
+	$value = preg_replace( '/[^A-Za-z0-9_]/', '', $value );
+
+	$arr = bb_get_all_user_settings();
+	$arr[$name] = $value;
+
+	foreach ( $arr as $k => $v ) {
+		$settings .= $k . '=' . $v . '&';
+	}
+	$settings = rtrim( $settings, '&' );
+
+	bb_update_usermeta( $user->ID, 'bb_user_settings', $settings );
+	setcookie( 'bb-user-settings-' . $user->ID, $settings, time() + 31536000, $bb->cookiepath );
+}
+
+/**
+ * Delete user interface settings.
+ *
+ * Deleting settings would reset them to the defaults.
+ *
+ * @package bbPress
+ * @subpackage Meta
+ * @since 1.0
+ *
+ * @param mixed $names The name or array of names of the setting to be deleted.
+ */
+function bb_delete_user_setting( $names )
+{
+	$arr = bb_get_all_user_settings();
+	$names = (array) $names;
+
+	if ( !$user = bb_get_current_user() ) {
+		return;
+	}
+
+	foreach ( $names as $name ) {
+		if ( isset( $arr[$name] ) ) {
+			unset( $arr[$name] );
+			$settings = '';
+		}
+	}
+
+	if ( isset( $settings ) ) {
+		foreach ( $arr as $k => $v ) {
+			$settings .= $k . '=' . $v . '&';
+		}
+		$settings = rtrim( $settings, '&' );
+
+		bb_update_usermeta( $user->ID, 'bb_user_settings', $settings );
+		setcookie( 'bb-user-settings-' . $user->ID, $settings, time() + 31536000, $bb->cookiepath );
+	}
+}
+
+/**
+ * Retrieve all user interface settings.
+ *
+ * @package bbPress
+ * @subpackage Meta
+ * @since 1.0
+ *
+ * @return array the last saved user settings or empty array.
+ */
+function bb_get_all_user_settings()
+{
+	if ( ! $user = bb_get_current_user() ) {
+		return array();
+	}
+
+	$arr = array();
+	if ( isset( $_COOKIE['bb-user-settings-' . $user->ID] ) ) {
+		$cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['bb-user-settings-' . $user->ID] );
+
+		if ( $cookie && strpos( $cookie, '=' ) ) { // the '=' cannot be 1st char
+			parse_str( $cookie, $arr );
+		}
+	} elseif ( isset( $user->bb_user_settings ) && is_string( $user->bb_user_settings ) ) {
+		parse_str( $user->bb_user_settings, $arr );
+	}
+
+	return $arr;
+}
+
+/**
+ * Delete the user settings of the current user.
+ *
+ * @package bbPress
+ * @subpackage Meta
+ * @since 1.0
+ */
+function bb_delete_all_user_settings()
+{
+	if ( !$user = bb_get_current_user() ) {
+		return;
+	}
+
+	bb_delete_usermeta( $user->ID, 'bb_user_settings' );
+	setcookie( 'bb-user-settings-' . $user->ID, ' ', time() - 31536000, $bb->cookiepath );
+}
+
+
+
+
+/* Forum meta */
+
+function bb_get_forummeta( $forum_id, $meta_key )
+{
+	if ( !$forum = bb_get_forum( $forum_id ) ) {
+		return;
+	}
+
+	$meta_key = bb_sanitize_meta_key( $meta_key );
+	if ( !isset( $forum->$meta_key ) ) {
+		return;
+	}
+	return $forum->$meta_key;
+}
+
+function bb_update_forummeta( $forum_id, $meta_key, $meta_value )
+{
+	return bb_update_meta( $forum_id, $meta_key, $meta_value, 'forum' );
+}
+
+function bb_delete_forummeta( $forum_id, $meta_key, $meta_value = '' )
+{
+	return bb_delete_meta( $forum_id, $meta_key, $meta_value, 'forum' );
+}
+
+
+
+/* Topic meta */
+
+function bb_get_topicmeta( $topic_id, $meta_key )
+{
+	if ( !$topic = get_topic( $topic_id ) ) {
+		return;
+	}
+
+	$meta_key = bb_sanitize_meta_key( $meta_key );
+	if ( !isset($topic->$meta_key) ) {
+		return;
+	}
+	return $topic->$meta_key;
+}
+
+function bb_update_topicmeta( $topic_id, $meta_key, $meta_value )
+{
+	return bb_update_meta( $topic_id, $meta_key, $meta_value, 'topic' );
+}
+
+function bb_delete_topicmeta( $topic_id, $meta_key, $meta_value = '' )
+{
+	return bb_delete_meta( $topic_id, $meta_key, $meta_value, 'topic' );
+}
+
+
+
+/* Post meta */
+
+function bb_get_postmeta( $post_id, $meta_key )
+{
+	if ( !$post = bb_get_post( $post_id ) ) {
+		return;
+	}
+
+	$meta_key = bb_sanitize_meta_key( $meta_key );
+	if ( !isset( $post->$meta_key ) ) {
+		return;
+	}
+	return $post->$meta_key;
+}
+
+function bb_update_postmeta( $post_id, $meta_key, $meta_value )
+{
+	return bb_update_meta( $post_id, $meta_key, $meta_value, 'post' );
+}
+
+function bb_delete_postmeta( $post_id, $meta_key, $meta_value = '' )
+{
+	return bb_delete_meta( $post_id, $meta_key, $meta_value, 'post' );
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-pluggable.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-pluggable.php
new file mode 100644
index 0000000000000000000000000000000000000000..6cf87cbae00301c69f708c0056abd7163808c345
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-pluggable.php
@@ -0,0 +1,931 @@
+<?php
+
+if ( !function_exists( 'bb_auth' ) ) :
+function bb_auth( $scheme = 'auth' ) { // Checks if a user has a valid cookie, if not redirects them to the main page
+	if ( !bb_validate_auth_cookie( '', $scheme ) ) {
+		nocache_headers();
+		if ( 'auth' === $scheme && !bb_is_user_logged_in() ) {
+			wp_redirect( bb_get_uri( 'bb-login.php', array( 're' => $_SERVER['REQUEST_URI'] ), BB_URI_CONTEXT_HEADER + BB_URI_CONTEXT_BB_USER_FORMS ) );
+		} else {
+			wp_redirect( bb_get_uri( null, null, BB_URI_CONTEXT_HEADER ) );
+		}
+		exit;
+	}
+}
+endif;
+
+// $already_md5 variable is deprecated
+if ( !function_exists('bb_check_login') ) :
+function bb_check_login($user, $pass, $already_md5 = false) {
+	global $wp_users_object;
+
+	if ( !bb_get_option( 'email_login' ) || false === strpos( $user, '@' ) ) { // user_login
+		$user = $wp_users_object->get_user( $user, array( 'by' => 'login' ) );
+	} else { // maybe an email
+		$email_user = $wp_users_object->get_user( $user, array( 'by' => 'email' ) );
+		$user = $wp_users_object->get_user( $user, array( 'by' => 'login' ) );
+		// 9 cases.  each can be FALSE, USER, or WP_ERROR
+		if (
+			( !$email_user && $user ) // FALSE && USER, FALSE && WP_ERROR
+		||
+			( is_wp_error( $email_user ) && $user && !is_wp_error( $user ) ) // WP_ERROR && USER
+		) {
+			// nope: it really was a user_login
+			// [sic]: use $user
+		} elseif (
+			( $email_user && !$user ) // USER && FALSE, WP_ERROR && FALSE
+		||
+			( $email_user && !is_wp_error( $email_user ) && is_wp_error( $user ) ) // USER && WP_ERROR
+		) {
+			// yup: it was an email
+			$user =& $email_user;
+		} elseif ( !$email_user && !$user ) { // FALSE && FALSE
+			// Doesn't matter what it was: neither worked
+			return false;
+		} elseif ( is_wp_error( $email_user ) && is_wp_error( $user ) ) { // WP_ERROR && WP_ERROR
+			// This can't happen.  If it does, let's use the email error.  It's probably "multiple matches", so maybe logging in with a username will work
+			$user =& $email_user;
+		} elseif ( $email_user && $user ) { // USER && USER
+			// both are user objects
+			if ( $email_user->ID == $user->ID ); // [sic]: they are the same, use $user
+			elseif ( bb_check_password($pass, $user->user_pass, $user->ID) ); // [sic]: use $user
+			elseif ( bb_check_password($pass, $email_user->user_pass, $email_user->ID) )
+				$user =& $email_user;
+		} else { // This can't happen, that's all 9 cases.
+			// [sic]: use $user
+		}
+	}
+
+	if ( !$user )
+		return false;
+
+	if ( is_wp_error($user) )
+		return $user;
+	
+	if ( !bb_check_password($pass, $user->user_pass, $user->ID) )
+		return false;
+
+	// User is logging in for the first time, update their user_status to normal
+	if ( 1 == $user->user_status )
+		bb_update_user_status( $user->ID, 0 );
+	
+	return $user;
+}
+endif;
+
+if ( !function_exists('bb_get_current_user') ) :
+function bb_get_current_user() {
+	global $wp_auth_object;
+	return $wp_auth_object->get_current_user();
+}
+endif;
+
+if ( !function_exists('bb_set_current_user') ) :
+function bb_set_current_user( $id ) {
+	global $wp_auth_object;
+	$current_user = $wp_auth_object->set_current_user( $id );
+	
+	do_action('bb_set_current_user', isset($current_user->ID) ? $current_user->ID : 0 );
+	
+	return $current_user;
+}
+endif;
+
+if ( !function_exists('bb_current_user') ) :
+//This is only used at initialization.  Use bb_get_current_user_info() (or $bb_current_user global if really needed) to grab user info.
+function bb_current_user() {
+	if (BB_INSTALLING)
+		return false;
+
+	return bb_get_current_user();
+}
+endif;
+
+if ( !function_exists('bb_is_user_authorized') ) :
+function bb_is_user_authorized() {
+	return bb_is_user_logged_in();
+}
+endif;
+
+if ( !function_exists('bb_is_user_logged_in') ) :
+function bb_is_user_logged_in() {
+	$current_user = bb_get_current_user();
+
+	if ( empty($current_user) )
+		return false;
+	
+	return true;
+}
+endif;
+
+if ( !function_exists('bb_login') ) :
+function bb_login( $login, $password, $remember = false ) {
+	$user = bb_check_login( $login, $password );
+	if ( $user && !is_wp_error( $user ) ) {
+		bb_set_auth_cookie( $user->ID, $remember );
+		do_action('bb_user_login', (int) $user->ID );
+	}
+	
+	return $user;
+}
+endif;
+
+if ( !function_exists('bb_logout') ) :
+function bb_logout() {
+	bb_clear_auth_cookie();
+	
+	do_action('bb_user_logout');
+}
+endif;
+
+if ( !function_exists( 'bb_validate_auth_cookie' ) ) :
+function bb_validate_auth_cookie( $cookie = '', $scheme = 'auth' ) {
+	global $wp_auth_object;
+	if ( empty($cookie) && $scheme == 'auth' ) {
+		if ( is_ssl() ) {
+			$scheme = 'secure_auth';
+		} else {
+			$scheme = 'auth';
+		}
+	}
+	return $wp_auth_object->validate_auth_cookie( $cookie, $scheme );
+}
+endif;
+
+if ( !function_exists( 'bb_set_auth_cookie' ) ) :
+function bb_set_auth_cookie( $user_id, $remember = false, $schemes = false ) {
+	global $wp_auth_object;
+
+	if ( $remember ) {
+		$expiration = $expire = time() + 1209600;
+	} else {
+		$expiration = time() + 172800;
+		$expire = 0;
+	}
+
+	if ( true === $schemes ) {
+		$schemes = array( 'secure_auth', 'logged_in' );
+	} elseif ( !is_array( $schemes ) ) {
+		$schemes = array();
+		if ( force_ssl_login() || force_ssl_admin() ) {
+			$schemes[] = 'secure_auth';
+		}
+		if ( !( force_ssl_login() && force_ssl_admin() ) ) {
+			$schemes[] = 'auth';
+		}
+		$schemes[] = 'logged_in';
+	}
+	$schemes = array_unique( $schemes );
+
+	foreach ( $schemes as $scheme ) {
+		$wp_auth_object->set_auth_cookie( $user_id, $expiration, $expire, $scheme );
+	}
+}
+endif;
+
+if ( !function_exists('bb_clear_auth_cookie') ) :
+function bb_clear_auth_cookie() {
+	global $bb, $wp_auth_object;
+	
+	$wp_auth_object->clear_auth_cookie();
+	
+	// Old cookies
+	setcookie($bb->authcookie, ' ', time() - 31536000, $bb->cookiepath, $bb->cookiedomain);
+	setcookie($bb->authcookie, ' ', time() - 31536000, $bb->sitecookiepath, $bb->cookiedomain);
+	
+	// Even older cookies
+	setcookie($bb->usercookie, ' ', time() - 31536000, $bb->cookiepath, $bb->cookiedomain);
+	setcookie($bb->usercookie, ' ', time() - 31536000, $bb->sitecookiepath, $bb->cookiedomain);
+	setcookie($bb->passcookie, ' ', time() - 31536000, $bb->cookiepath, $bb->cookiedomain);
+	setcookie($bb->passcookie, ' ', time() - 31536000, $bb->sitecookiepath, $bb->cookiedomain);
+}
+endif;
+
+if ( !function_exists('wp_redirect') ) : // [WP11537]
+/**
+ * Redirects to another page, with a workaround for the IIS Set-Cookie bug.
+ *
+ * @link http://support.microsoft.com/kb/q176113/
+ * @since 1.5.1
+ * @uses apply_filters() Calls 'wp_redirect' hook on $location and $status.
+ *
+ * @param string $location The path to redirect to
+ * @param int $status Status code to use
+ * @return bool False if $location is not set
+ */
+function wp_redirect($location, $status = 302) {
+	global $is_IIS;
+
+	$location = apply_filters('wp_redirect', $location, $status);
+	$status = apply_filters('wp_redirect_status', $status, $location);
+
+	if ( !$location ) // allows the wp_redirect filter to cancel a redirect
+		return false;
+
+	$location = wp_sanitize_redirect($location);
+
+	if ( $is_IIS ) {
+		header("Refresh: 0;url=$location");
+	} else {
+		if ( php_sapi_name() != 'cgi-fcgi' )
+			status_header($status); // This causes problems on IIS and some FastCGI setups
+		header("Location: $location");
+	}
+}
+endif;
+
+if ( !function_exists('wp_sanitize_redirect') ) : // [WP11537]
+/**
+ * Sanitizes a URL for use in a redirect.
+ *
+ * @since 2.3
+ *
+ * @return string redirect-sanitized URL
+ **/
+function wp_sanitize_redirect($location) {
+	$location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%!]|i', '', $location);
+	$location = wp_kses_no_null($location);
+
+	// remove %0d and %0a from location
+	$strip = array('%0d', '%0a');
+	$found = true;
+	while($found) {
+		$found = false;
+		foreach( (array) $strip as $val ) {
+			while(strpos($location, $val) !== false) {
+				$found = true;
+				$location = str_replace($val, '', $location);
+			}
+		}
+	}
+	return $location;
+}
+endif;
+
+if ( !function_exists('bb_safe_redirect') ) : // based on [WP6145] (home is different)
+/**
+ * Performs a safe (local) redirect, using wp_redirect().
+ *
+ * Checks whether the $location is using an allowed host, if it has an absolute
+ * path. A plugin can therefore set or remove allowed host(s) to or from the
+ * list.
+ *
+ * If the host is not allowed, then the redirect is to the site url
+ * instead. This prevents malicious redirects which redirect to another host,
+ * but only used in a few places.
+ *
+ * @uses apply_filters() Calls 'allowed_redirect_hosts' on an array containing
+ *		bbPress host string and $location host string.
+ *
+ * @return void Does not return anything
+ **/
+function bb_safe_redirect( $location, $status = 302 ) {
+
+	// Need to look at the URL the way it will end up in wp_redirect()
+	$location = wp_sanitize_redirect($location);
+
+	// browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//'
+	if ( substr($location, 0, 2) == '//' )
+		$location = 'http:' . $location;
+
+	// In php 5 parse_url may fail if the URL query part contains http://, bug #38143
+	$test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location;
+
+	$lp = parse_url($test);
+	$bp = parse_url(bb_get_uri());
+
+	$allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($bp['host']), isset($lp['host']) ? $lp['host'] : '');
+
+	if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($bp['host'])) )
+		$location = bb_get_uri(null, null, BB_URI_CONTEXT_HEADER);
+
+	return wp_redirect($location, $status);
+}
+endif;
+
+if ( !function_exists('bb_nonce_tick') ) :
+/**
+ * Get the time-dependent variable for nonce creation.
+ *
+ * A nonce has a lifespan of two ticks. Nonces in their second tick may be
+ * updated, e.g. by autosave.
+ *
+ * @since 1.0
+ *
+ * @return int
+ */
+function bb_nonce_tick() {
+	$nonce_life = apply_filters('bb_nonce_life', 86400);
+
+	return ceil(time() / ( $nonce_life / 2 ));
+}
+endif;
+
+if ( !function_exists('bb_verify_nonce') ) :
+/**
+ * Verify that correct nonce was used with time limit.
+ *
+ * The user is given an amount of time to use the token, so therefore, since the
+ * UID and $action remain the same, the independent variable is the time.
+ *
+ * @param string $nonce Nonce that was used in the form to verify
+ * @param string|int $action Should give context to what is taking place and be the same when nonce was created.
+ * @return bool Whether the nonce check passed or failed.
+ */
+function bb_verify_nonce($nonce, $action = -1) {
+	$user = bb_get_current_user();
+	$uid = (int) $user->ID;
+
+	$i = bb_nonce_tick();
+
+	// Nonce generated 0-12 hours ago
+	if ( substr(bb_hash($i . $action . $uid, 'nonce'), -12, 10) == $nonce )
+		return 1;
+	// Nonce generated 12-24 hours ago
+	if ( substr(bb_hash(($i - 1) . $action . $uid, 'nonce'), -12, 10) == $nonce )
+		return 2;
+	// Invalid nonce
+	return false;
+}
+endif;
+
+if ( !function_exists('bb_create_nonce') ) :
+/**
+ * Creates a random, one time use token.
+ *
+ * @since 2.0.4
+ *
+ * @param string|int $action Scalar value to add context to the nonce.
+ * @return string The one use form token
+ */
+function bb_create_nonce($action = -1) {
+	$user = bb_get_current_user();
+	$uid = (int) $user->ID;
+
+	$i = bb_nonce_tick();
+	
+	return substr(bb_hash($i . $action . $uid, 'nonce'), -12, 10);
+}
+endif;
+
+function _bb_get_key( $key, $default_key = false ) {
+	if ( !$default_key ) {
+		global $bb_default_secret_key;
+		$default_key = $bb_default_secret_key;
+	}
+
+	if ( defined( $key ) && '' != constant( $key ) && $default_key != constant( $key ) ) {
+		return constant( $key );
+	}
+
+	return $default_key;
+}
+
+function _bb_get_salt( $constants, $option = false ) {
+	if ( !is_array( $constants ) ) {
+		$constants = array( $constants );
+	}
+
+	foreach ($constants as $constant ) {
+		if ( defined( $constant ) ) {
+			return constant( $constant );
+		}
+	}
+
+	if ( !defined( 'BB_INSTALLING' ) || !BB_INSTALLING ) {
+		if ( !$option ) {
+			$option = strtolower( $constants[0] );
+		}
+		$salt = bb_get_option( $option );
+		if ( empty( $salt ) ) {
+			$salt = bb_generate_password();
+			bb_update_option( $option, $salt );
+		}
+		return $salt;
+	}
+
+	return '';
+}
+
+// Not verbatim WP, constants have different names, uses helper functions.
+if ( !function_exists( 'bb_salt' ) ) :
+/**
+ * Get salt to add to hashes to help prevent attacks.
+ *
+ * @since 0.9
+ * @link http://api.wordpress.org/secret-key/1.1/bbpress/ Create a set of keys for bb-config.php
+ * @uses _bb_get_key()
+ * @uses _bb_get_salt()
+ *
+ * @return string Salt value for the given scheme
+ */
+function bb_salt($scheme = 'auth') {
+	$secret_key = _bb_get_key( 'BB_SECRET_KEY' );
+
+	switch ($scheme) {
+		case 'auth':
+			$secret_key = _bb_get_key( 'BB_AUTH_KEY', $secret_key );
+			$salt = _bb_get_salt( array( 'BB_AUTH_SALT', 'BB_SECRET_SALT' ) );
+			break;
+
+		case 'secure_auth':
+			$secret_key = _bb_get_key( 'BB_SECURE_AUTH_KEY', $secret_key );
+			$salt = _bb_get_salt( 'BB_SECURE_AUTH_SALT' );
+			break;
+
+		case 'logged_in':
+			$secret_key = _bb_get_key( 'BB_LOGGED_IN_KEY', $secret_key );
+			$salt = _bb_get_salt( 'BB_LOGGED_IN_SALT' );
+			break;
+
+		case 'nonce':
+			$secret_key = _bb_get_key( 'BB_NONCE_KEY', $secret_key );
+			$salt = _bb_get_salt( 'BB_NONCE_SALT' );
+			break;
+
+		default:
+			// ensure each auth scheme has its own unique salt
+			$salt = hash_hmac( 'md5', $scheme, $secret_key );
+			break;
+	}
+
+	return apply_filters( 'salt', $secret_key . $salt, $scheme );
+}
+endif;
+
+if ( !function_exists( 'bb_hash' ) ) :
+function bb_hash( $data, $scheme = 'auth' ) { 
+	$salt = bb_salt( $scheme );
+
+	return hash_hmac( 'md5', $data, $salt );
+}
+endif;
+
+if ( !function_exists( 'bb_hash_password' ) ) :
+function bb_hash_password( $password ) {
+	return WP_Pass::hash_password( $password );
+}
+endif;
+
+if ( !function_exists( 'bb_check_password') ) :
+function bb_check_password( $password, $hash, $user_id = '' ) {
+	return WP_Pass::check_password( $password, $hash, $user_id );
+}
+endif;
+
+if ( !function_exists( 'bb_generate_password' ) ) :
+/**
+ * Generates a random password drawn from the defined set of characters
+ * @return string the password
+ */
+function bb_generate_password( $length = 12, $special_chars = true ) {
+	return WP_Pass::generate_password( $length, $special_chars );
+}
+endif;
+
+if ( !function_exists('bb_check_admin_referer') ) :
+function bb_check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {
+	$nonce = '';
+	if ( isset( $_POST[$query_arg] ) && $_POST[$query_arg] ) {
+		$nonce = $_POST[$query_arg];
+	} elseif ( isset( $_GET[$query_arg] ) && $_GET[$query_arg] ) {
+		$nonce = $_GET[$query_arg];
+	}
+	if ( !bb_verify_nonce($nonce, $action) ) {
+		bb_nonce_ays($action);
+		die();
+	}
+	do_action('bb_check_admin_referer', $action);
+}
+endif;
+
+if ( !function_exists('bb_check_ajax_referer') ) :
+function bb_check_ajax_referer( $action = -1, $query_arg = false, $die = true ) {
+	$requests = array();
+	if ( $query_arg ) {
+		$requests[] = $query_arg;
+	}
+	$requests[] = '_ajax_nonce';
+	$requests[] = '_wpnonce';
+
+	$nonce = '';
+	foreach ( $requests as $request ) {
+		if ( isset( $_POST[$request] ) && $_POST[$request] ) {
+			$nonce = $_POST[$request];
+			break;
+		} elseif ( isset( $_GET[$request] ) && $_GET[$request] ) {
+			$nonce = $_GET[$request];
+			break;
+		}
+	}
+
+	$result = bb_verify_nonce( $nonce, $action );
+
+	if ( $die && false == $result )
+		die('-1');
+
+	do_action('bb_check_ajax_referer', $action, $result);
+	return $result;
+}
+endif;
+
+if ( !function_exists('bb_break_password') ) :
+function bb_break_password( $user_id ) {
+	global $bbdb;
+	$user_id = (int) $user_id;
+	if ( !$user = bb_get_user( $user_id ) )
+		return false;
+	$secret = substr(bb_hash( 'bb_break_password' ), 0, 13);
+	if ( false === strpos( $user->user_pass, '---' ) )
+		return $bbdb->query( $bbdb->prepare(
+			"UPDATE $bbdb->users SET user_pass = CONCAT(user_pass, '---', %s) WHERE ID = %d",
+			$secret, $user_id
+		) );
+	else
+		return true;
+}
+endif;
+
+if ( !function_exists('bb_fix_password') ) :
+function bb_fix_password( $user_id ) {
+	global $bbdb;
+	$user_id = (int) $user_id;
+	if ( !$user = bb_get_user( $user_id ) )
+		return false;
+	if ( false === strpos( $user->user_pass, '---' ) )
+		return true;
+	else
+		return $bbdb->query( $bbdb->prepare(
+			"UPDATE $bbdb->users SET user_pass = SUBSTRING_INDEX(user_pass, '---', 1) WHERE ID = %d",
+			$user_id
+		) );
+}
+endif;
+
+if ( !function_exists('bb_has_broken_pass') ) :
+function bb_has_broken_pass( $user_id = 0 ) {
+	global $bb_current_user;
+	if ( !$user_id )
+		$user =& $bb_current_user->data;
+	else
+		$user = bb_get_user( $user_id );
+
+	return ( false !== strpos($user->user_pass, '---' ) );
+}
+endif;
+
+if ( !function_exists('bb_new_user') ) :
+function bb_new_user( $user_login, $user_email, $user_url, $user_status = 1 ) {
+	global $wp_users_object, $bbdb;
+
+	// is_email check + dns
+	if ( !$user_email = is_email( $user_email ) )
+		return new WP_Error( 'user_email', __( 'Invalid email address' ), $user_email );
+
+	if ( !$user_login = sanitize_user( $user_login, true ) )
+		return new WP_Error( 'user_login', __( 'Invalid username' ), $user_login );
+	
+	// user_status = 1 means the user has not yet been verified
+	$user_status = is_numeric($user_status) ? (int) $user_status : 1;
+	if ( defined( 'BB_INSTALLING' ) )
+		$user_status = 0;
+	
+	$user_nicename = $_user_nicename = bb_user_nicename_sanitize( $user_login );
+	if ( strlen( $_user_nicename ) < 1 )
+		return new WP_Error( 'user_login', __( 'Invalid username' ), $user_login );
+
+	while ( is_numeric($user_nicename) || $existing_user = bb_get_user_by_nicename( $user_nicename ) )
+		$user_nicename = bb_slug_increment($_user_nicename, $existing_user->user_nicename, 50);
+	
+	$user_url = $user_url ? bb_fix_link( $user_url ) : '';
+
+	$user_pass = bb_generate_password();
+
+	$user = $wp_users_object->new_user( compact( 'user_login', 'user_email', 'user_url', 'user_nicename', 'user_status', 'user_pass' ) );
+	if ( is_wp_error($user) ) {
+		if ( 'user_nicename' == $user->get_error_code() )
+			return new WP_Error( 'user_login', $user->get_error_message() );
+		return $user;
+	}
+
+	if (BB_INSTALLING) {
+		bb_update_usermeta( $user['ID'], $bbdb->prefix . 'capabilities', array('keymaster' => true) );
+	} else {
+		bb_update_usermeta( $user['ID'], $bbdb->prefix . 'capabilities', array('member' => true) );
+		bb_send_pass( $user['ID'], $user['plain_pass'] );
+	}
+
+	do_action('bb_new_user', $user['ID'], $user['plain_pass']);
+	return $user['ID'];
+}
+endif;
+
+if ( !function_exists( 'bb_mail' ) ) :
+/**
+ * Send mail, similar to PHP's mail
+ *
+ * A true return value does not automatically mean that the user received the
+ * email successfully. It just only means that the method used was able to
+ * process the request without any errors.
+ *
+ * Using the two 'bb_mail_from' and 'bb_mail_from_name' hooks allow from
+ * creating a from address like 'Name <email@address.com>' when both are set. If
+ * just 'bb_mail_from' is set, then just the email address will be used with no
+ * name.
+ *
+ * The default content type is 'text/plain' which does not allow using HTML.
+ * However, you can set the content type of the email by using the
+ * 'bb_mail_content_type' filter.
+ *
+ * The default charset is based on the charset used on the blog. The charset can
+ * be set using the 'bb_mail_charset' filter.
+ *
+ * @uses apply_filters() Calls 'bb_mail' hook on an array of all of the parameters.
+ * @uses apply_filters() Calls 'bb_mail_from' hook to get the from email address.
+ * @uses apply_filters() Calls 'bb_mail_from_name' hook to get the from address name.
+ * @uses apply_filters() Calls 'bb_mail_content_type' hook to get the email content type.
+ * @uses apply_filters() Calls 'bb_mail_charset' hook to get the email charset
+ * @uses do_action_ref_array() Calls 'bb_phpmailer_init' hook on the reference to
+ *		phpmailer object.
+ * @uses PHPMailer
+ *
+ * @param string $to Email address to send message
+ * @param string $subject Email subject
+ * @param string $message Message contents
+ * @param string|array $headers Optional. Additional headers.
+ * @param string|array $attachments Optional. Files to attach.
+ * @return bool Whether the email contents were sent successfully.
+ */
+function bb_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
+	// Compact the input, apply the filters, and extract them back out
+	extract( apply_filters( 'bb_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) );
+
+	if ( !is_array($attachments) )
+		$attachments = explode( "\n", $attachments );
+
+	global $bb_phpmailer;
+
+	// (Re)create it, if it's gone missing
+	if ( !is_object( $bb_phpmailer ) || !is_a( $bb_phpmailer, 'PHPMailer' ) ) {
+		require_once BACKPRESS_PATH . 'class.mailer.php';
+		require_once BACKPRESS_PATH . 'class.mailer-smtp.php';
+		$bb_phpmailer = new PHPMailer();
+	}
+
+	// Headers
+	if ( empty( $headers ) ) {
+		$headers = array();
+	} else {
+		if ( !is_array( $headers ) ) {
+			// Explode the headers out, so this function can take both
+			// string headers and an array of headers.
+			$tempheaders = (array) explode( "\n", $headers );
+		} else {
+			$tempheaders = $headers;
+		}
+		$headers = array();
+
+		// If it's actually got contents
+		if ( !empty( $tempheaders ) ) {
+			// Iterate through the raw headers
+			foreach ( (array) $tempheaders as $header ) {
+				if ( strpos($header, ':') === false ) {
+					if ( false !== stripos( $header, 'boundary=' ) ) {
+						$parts = preg_split('/boundary=/i', trim( $header ) );
+						$boundary = trim( str_replace( array( "'", '"' ), '', $parts[1] ) );
+					}
+					continue;
+				}
+				// Explode them out
+				list( $name, $content ) = explode( ':', trim( $header ), 2 );
+
+				// Cleanup crew
+				$name = trim( $name );
+				$content = trim( $content );
+
+				// Mainly for legacy -- process a From: header if it's there
+				if ( 'from' == strtolower($name) ) {
+					if ( strpos($content, '<' ) !== false ) {
+						// So... making my life hard again?
+						$from_name = substr( $content, 0, strpos( $content, '<' ) - 1 );
+						$from_name = str_replace( '"', '', $from_name );
+						$from_name = trim( $from_name );
+
+						$from_email = substr( $content, strpos( $content, '<' ) + 1 );
+						$from_email = str_replace( '>', '', $from_email );
+						$from_email = trim( $from_email );
+					} else {
+						$from_email = trim( $content );
+					}
+				} elseif ( 'content-type' == strtolower($name) ) {
+					if ( strpos( $content,';' ) !== false ) {
+						list( $type, $charset ) = explode( ';', $content );
+						$content_type = trim( $type );
+						if ( false !== stripos( $charset, 'charset=' ) ) {
+							$charset = trim( str_replace( array( 'charset=', '"' ), '', $charset ) );
+						} elseif ( false !== stripos( $charset, 'boundary=' ) ) {
+							$boundary = trim( str_replace( array( 'BOUNDARY=', 'boundary=', '"' ), '', $charset ) );
+							$charset = '';
+						}
+					} else {
+						$content_type = trim( $content );
+					}
+				} elseif ( 'cc' == strtolower($name) ) {
+					$cc = explode(",", $content);
+				} elseif ( 'bcc' == strtolower($name) ) {
+					$bcc = explode(",", $content);
+				} else {
+					// Add it to our grand headers array
+					$headers[trim( $name )] = trim( $content );
+				}
+			}
+		}
+	}
+
+	// Empty out the values that may be set
+	$bb_phpmailer->ClearAddresses();
+	$bb_phpmailer->ClearAllRecipients();
+	$bb_phpmailer->ClearAttachments();
+	$bb_phpmailer->ClearBCCs();
+	$bb_phpmailer->ClearCCs();
+	$bb_phpmailer->ClearCustomHeaders();
+	$bb_phpmailer->ClearReplyTos();
+
+	// From email and name
+	// If we don't have a name from the input headers
+	if ( !isset( $from_name ) ) {
+		$from_name = bb_get_option('name');
+	}
+
+	// If we don't have an email from the input headers
+	if ( !isset( $from_email ) ) {
+		$from_email = bb_get_option('from_email');
+	}
+
+	// If there is still no email address
+	if ( !$from_email ) {
+		// Get the site domain and get rid of www.
+		$sitename = strtolower( $_SERVER['SERVER_NAME'] );
+		if ( substr( $sitename, 0, 4 ) == 'www.' ) {
+			$sitename = substr( $sitename, 4 );
+		}
+
+		$from_email = 'bbpress@' . $sitename;
+	}
+
+	// Plugin authors can override the potentially troublesome default
+	$bb_phpmailer->From = apply_filters( 'bb_mail_from', $from_email );
+	$bb_phpmailer->FromName = apply_filters( 'bb_mail_from_name', $from_name );
+
+	// Set destination address
+	$bb_phpmailer->AddAddress( $to );
+
+	// Set mail's subject and body
+	$bb_phpmailer->Subject = $subject;
+	$bb_phpmailer->Body = $message;
+
+	// Add any CC and BCC recipients
+	if ( !empty($cc) ) {
+		foreach ( (array) $cc as $recipient ) {
+			$bb_phpmailer->AddCc( trim($recipient) );
+		}
+	}
+	if ( !empty($bcc) ) {
+		foreach ( (array) $bcc as $recipient) {
+			$bb_phpmailer->AddBcc( trim($recipient) );
+		}
+	}
+
+	// Set to use PHP's mail()
+	$bb_phpmailer->IsMail();
+
+	// Set Content-Type and charset
+	// If we don't have a content-type from the input headers
+	if ( !isset( $content_type ) ) {
+		$content_type = 'text/plain';
+	}
+
+	$content_type = apply_filters( 'bb_mail_content_type', $content_type );
+
+	$bb_phpmailer->ContentType = $content_type;
+
+	// Set whether it's plaintext or not, depending on $content_type
+	if ( $content_type == 'text/html' ) {
+		$bb_phpmailer->IsHTML( true );
+	}
+
+	// If we don't have a charset from the input headers
+	if ( !isset( $charset ) ) {
+		$charset = bb_get_option( 'charset' );
+	}
+
+	// Set the content-type and charset
+	$bb_phpmailer->CharSet = apply_filters( 'bb_mail_charset', $charset );
+
+	// Set custom headers
+	if ( !empty( $headers ) ) {
+		foreach( (array) $headers as $name => $content ) {
+			$bb_phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
+		}
+		if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) ) {
+			$bb_phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );
+		}
+	}
+
+	if ( !empty( $attachments ) ) {
+		foreach ( $attachments as $attachment ) {
+			$bb_phpmailer->AddAttachment($attachment);
+		}
+	}
+
+	do_action_ref_array( 'bb_phpmailer_init', array( &$bb_phpmailer ) );
+
+	// Send!
+	$result = @$bb_phpmailer->Send();
+
+	return $result;
+}
+endif;
+
+if ( !function_exists( 'bb_get_avatar' ) ) :
+/**
+ * Retrieve the avatar for a user provided a user ID or email address
+ *
+ * @since 0.9
+ * @param int|string $id_or_email A user ID or email address
+ * @param int $size Size of the avatar image
+ * @param string $default URL to a default image to use if no avatar is available
+ * @param string $alt Alternate text to use in image tag. Defaults to blank
+ * @return string <img> tag for the user's avatar
+*/
+function bb_get_avatar( $id_or_email, $size = 80, $default = '', $alt = false ) {
+	if ( !bb_get_option('avatars_show') )
+		return false;
+
+	if ( false === $alt)
+		$safe_alt = '';
+	else
+		$safe_alt = esc_attr( $alt );
+
+	if ( !is_numeric($size) )
+		$size = 80;
+
+	if ( $email = bb_get_user_email($id_or_email) ) {
+		$class = 'photo ';
+	} else {
+		$class = '';
+		$email = $id_or_email;
+	}
+
+	if ( !$email )
+		$email = '';
+
+	if ( empty($default) )
+		$default = bb_get_option('avatars_default');
+
+ 	if ( is_ssl() )
+		$host = 'https://secure.gravatar.com';
+	else
+		$host = 'http://www.gravatar.com';
+
+	switch ($default) {
+		case 'logo':
+			$default = '';
+			break;
+		case 'blank':
+			$default = bb_get_uri( 'bb-admin/images/blank.gif', null, BB_URI_CONTEXT_IMG_SRC );
+			break;
+		case 'monsterid':
+		case 'wavatar':
+		case 'identicon':
+			break;
+		case 'default':
+		default:
+			$default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size;
+			// ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
+			break;
+	}
+
+	$src = $host . '/avatar/';
+	$class .= 'avatar avatar-' . $size;
+
+	if ( !empty($email) ) {
+		$src .= md5( strtolower( $email ) );
+	} else {
+		$src .= 'd41d8cd98f00b204e9800998ecf8427e';
+		// d41d8cd98f00b204e9800998ecf8427e == md5('')
+		$class .= ' avatar-noemail';
+	}
+
+	$src .= '?s=' . $size;
+	$src .= '&amp;d=' . urlencode( $default );
+
+	$rating = bb_get_option('avatars_rating');
+	if ( !empty( $rating ) )
+		$src .= '&amp;r=' . $rating;
+
+	$avatar = '<img alt="' . $safe_alt . '" src="' . $src . '" class="' . $class . '" style="height:' . $size . 'px; width:' . $size . 'px;" />';
+
+	return apply_filters('bb_get_avatar', $avatar, $id_or_email, $size, $default, $alt);
+}
+endif;
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-posts.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-posts.php
new file mode 100644
index 0000000000000000000000000000000000000000..71e8005689f65738b61c3e453d46126382f1ac3d
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-posts.php
@@ -0,0 +1,512 @@
+<?php
+
+/* Posts */
+
+function bb_get_post( $post_id ) {
+	global $bbdb;
+	$post_id = (int) $post_id;
+	if ( false === $post = wp_cache_get( $post_id, 'bb_post' ) ) {
+		$post = $bbdb->get_row( $bbdb->prepare( "SELECT * FROM $bbdb->posts WHERE post_id = %d", $post_id ) );
+		$post = bb_append_meta( $post, 'post' );
+		wp_cache_set( $post_id, $post, 'bb_post' );
+	}
+	return $post;
+}
+
+// NOT bbdb::prepared
+function bb_is_first( $post_id ) { // First post in thread
+	global $bbdb;
+	if ( !$bb_post = bb_get_post( $post_id ) )
+		return false;
+	$post_id = (int) $bb_post->post_id;
+	$topic_id = (int) $bb_post->topic_id;
+
+	static $first_post;
+	if ( !isset( $first_post ) ) {
+		$where = apply_filters('bb_is_first_where', 'AND post_status = 0');
+		$first_post = (int) $bbdb->get_var("SELECT post_id FROM $bbdb->posts WHERE topic_id = $topic_id $where ORDER BY post_id ASC LIMIT 1");
+	}
+
+	return $post_id == $first_post;
+}
+
+// Globalizes the result.
+function bb_get_first_post( $_topic = false, $author_cache = true ) {
+	global $topic, $bb_first_post_cache, $bb_post;
+	if ( !$_topic )
+		$topic_id = (int) $topic->topic_id;
+	else if ( is_object($_topic) )
+		$topic_id = (int) $_topic->topic_id;
+	else if ( is_numeric($_topic) )
+		$topic_id = (int) $_topic;
+
+	if ( !$topic_id )
+		return false;
+
+	if ( isset($bb_first_post_cache[$topic_id]) ) {
+		$post = bb_get_post( $bb_first_post_cache[$topic_id] );
+	} else {
+		$first_posts = bb_cache_first_posts( array($topic_id), $author_cache );
+		if ( isset($first_posts[$topic_id]) )
+			$post = $first_posts[$topic_id];
+	}
+
+	if ( $post ) {
+		$bb_post = $post;
+		return $bb_post;
+	}
+
+	return false;
+}
+
+// Ignore the return value.  Cache first posts with this function and use bb_get_first_post to grab each.
+// NOT bbdb::prepared
+function bb_cache_first_posts( $_topics = false, $author_cache = true ) {
+	global $topics, $bb_first_post_cache, $bbdb;
+	if ( !$_topics )
+		$_topics =& $topics;
+	if ( !is_array($_topics) )
+		return false;
+
+	$topic_ids = array();
+	foreach ( $_topics as $topic )
+		if ( is_object($topic) )
+			$topic_ids[] = (int) $topic->topic_id;
+		else if ( is_numeric($topic) )
+			$topic_ids[] = (int) $topic;
+
+	$_topic_ids = join(',', $topic_ids);
+
+	$posts = (array) bb_cache_posts( "SELECT post_id FROM $bbdb->posts WHERE topic_id IN ($_topic_ids) AND post_position = 1 AND post_status = 0", true );
+
+	$first_posts = array();
+	foreach ( $posts as $post ) {
+		$bb_first_post_cache[(int) $post->topic_id] = (int) $post->post_id;
+		$first_posts[(int) $post->topic_id] = $post;
+	}
+
+	if ( $author_cache )
+		bb_post_author_cache( $posts );
+
+	return $first_posts;
+}
+
+function bb_cache_posts( $query, $post_id_query = false ) {
+	global $bbdb;
+
+	$_query_post_ids = array();
+	$_query_posts = array();
+	$_cached_posts = array();
+
+	if ( $post_id_query && is_string( $query ) ) {
+		// The query is a SQL query to retrieve post_ids only
+		$key = md5( $query );
+		if ( false === $post_ids = wp_cache_get( $key, 'bb_cache_posts_post_ids' ) ) {
+			if ( !$post_ids = (array) $bbdb->get_col( $query, 0 ) ) {
+				return array();
+			}
+			wp_cache_add( $key, $post_ids, 'bb_cache_posts_post_ids' );
+		}
+		$query = $post_ids;
+	}
+
+	if ( is_array( $query ) ) {
+		foreach ( $query as $_post_id ) {
+			if ( false === $_post = wp_cache_get( $_post_id, 'bb_post' ) ) {
+				$_query_post_ids[] = $_post_id;
+			} else {
+				$_cached_posts[$_post->post_id] = $_post;
+			}
+		}
+
+		if ( count( $_query_post_ids ) ) {
+			// Escape the ids for the SQL query
+			$_query_post_ids = $bbdb->escape_deep( $_query_post_ids );
+
+			// Sort the ids so the MySQL will more consistently cache the query
+			sort( $_query_post_ids );
+
+			$_query = "SELECT * FROM $bbdb->posts WHERE post_id IN ('" . join( "','", $_query_post_ids ) . "')";
+		}
+	} else {
+		// The query is a full SQL query which needs to be executed
+		$_query = $query;
+	}
+
+	if ( $_query_posts = (array) $bbdb->get_results( $_query ) ) {
+		$_appendable_posts = array();
+		foreach ( $_query_posts as $_query_post ) {
+			if ( false === $_post = wp_cache_get( $_query_post->post_id, 'bb_post' ) ) {
+				$_appendable_posts[] = $_query_post;
+			} else {
+				$_cached_posts[$_query_post->post_id] = $_post;
+			}
+		}
+		if ( count( $_appendable_posts ) ) {
+			$_query_posts = bb_append_meta( $_appendable_posts, 'post' );
+			foreach( $_query_posts as $_query_post ) {
+				wp_cache_add( $_query_post->post_id, $_query_post, 'bb_post' );
+			}
+		}
+	} else {
+		$_query_posts = array();
+	}
+
+	return array_merge( $_cached_posts, $_query_posts );
+}
+
+// Globalizes the result
+function bb_get_last_post( $_topic = false, $author_cache = true ) {
+	global $topic, $bb_post;
+	if ( !$_topic )
+		$topic_id = (int) $topic->topic_id;
+	else if ( is_object($_topic) )
+		$topic_id = (int) $_topic->topic_id;
+	else if ( is_numeric($_topic) )
+		$topic_id = (int) $_topic;
+
+	if ( !$topic_id )
+		return false;
+
+	$_topic = get_topic( $topic_id );
+
+	if ( $post = bb_get_post( $_topic->topic_last_post_id ) ) {
+		if ( $author_cache )
+			bb_post_author_cache( array($post) );
+		$bb_post = $post;
+	}
+
+	return $post;
+}
+
+// No return value. Cache last posts with this function and use bb_get_last_post to grab each.
+// NOT bbdb::prepared
+function bb_cache_last_posts( $_topics = false, $author_cache = true ) {
+	global $topics, $bbdb;
+	if ( !$_topics )
+		$_topics =& $topics;
+	if ( !is_array($_topics) )
+		return false;
+
+	$last_post_ids = array();
+	$topic_ids = array();
+	foreach ( $_topics as $topic )
+		if ( is_object($topic) )
+			$last_post_ids[] = (int) $topic->topic_last_post_id;
+		else if ( is_numeric($topic) && false !== $cached_topic = wp_cache_get( $topic, 'bb_topic' ) )
+			$last_post_ids[] = (int) $cached_topic->topic_last_post_id;
+		else if ( is_numeric($topic) )
+			$topic_ids[] = (int) $topic;
+
+	if ( !empty($last_post_ids) ) {
+		$_last_post_ids = join(',', $last_post_ids);
+		$posts = (array) bb_cache_posts( "SELECT post_id FROM $bbdb->posts WHERE post_id IN ($_last_post_ids) AND post_status = 0", true );
+		if ( $author_cache )
+			bb_post_author_cache( $posts );
+	}
+
+	if ( !empty($topic_ids) ) {	
+		$_topic_ids = join(',', $topic_ids);
+		$posts = (array) bb_cache_posts( "SELECT p.post_id FROM $bbdb->topics AS t LEFT JOIN $bbdb->posts AS p ON ( t.topic_last_post_id = p.post_id ) WHERE t.topic_id IN ($_topic_ids) AND p.post_status = 0", true );
+		if ( $author_cache )
+			bb_post_author_cache( $posts );
+	}
+}
+
+// NOT bbdb::prepared
+function bb_cache_post_topics( $posts ) {
+	global $bbdb;
+
+	if ( !$posts )
+		return;
+
+	$topic_ids = array();
+	foreach ( $posts as $post )
+		if ( false === wp_cache_get( $post->topic_id, 'bb_topic' ) )
+			$topic_ids[] = (int) $post->topic_id;
+
+	if ( !$topic_ids )
+		return;
+
+	sort( $topic_ids );
+	$topic_ids = join(',', $topic_ids);
+
+	if ( $topics = $bbdb->get_results( "SELECT * FROM $bbdb->topics WHERE topic_id IN($topic_ids)" ) )
+		bb_append_meta( $topics, 'topic' );
+}
+
+function bb_get_latest_posts( $limit = 0, $page = 1 ) {
+	$limit = (int) $limit;
+	$post_query = new BB_Query( 'post', array( 'page' => $page, 'per_page' => $limit ), 'get_latest_posts' );
+	return $post_query->results;
+}
+
+function bb_get_latest_forum_posts( $forum_id, $limit = 0, $page = 1 ) {
+	$forum_id = (int) $forum_id;
+	$limit    = (int) $limit;
+	$post_query = new BB_Query( 'post', array( 'forum_id' => $forum_id, 'page' => $page, 'per_page' => $limit ), 'get_latest_forum_posts' );
+	return $post_query->results;
+}
+
+function bb_insert_post( $args = null ) {
+	global $bbdb, $bb_current_user;
+
+	if ( !$args = wp_parse_args( $args ) )
+		return false;
+
+	$fields = array_keys( $args );
+
+	if ( isset($args['post_id']) && false !== $args['post_id'] ) {
+		$update = true;
+		if ( !$post_id = (int) get_post_id( $args['post_id'] ) )
+			return false;
+		// Get from db, not cache.  Good idea?
+		$post = $bbdb->get_row( $bbdb->prepare( "SELECT * FROM $bbdb->posts WHERE post_id = %d", $post_id ) );
+		$defaults = get_object_vars( $post );
+		unset( $defaults['post_id'] );
+
+		// Only update the args we passed
+		$fields = array_intersect( $fields, array_keys($defaults) );
+		if ( in_array( 'topic_id', $fields ) )
+			$fields[] = 'forum_id';
+
+		// No need to run filters if these aren't changing
+		// bb_new_post() and bb_update_post() will always run filters
+		$run_filters = (bool) array_intersect( array( 'post_status', 'post_text' ), $fields );
+	} else {
+		$post_id = false;
+		$update = false;
+		$now = bb_current_time( 'mysql' );
+		$current_user_id = bb_get_current_user_info( 'id' );
+		$ip_address = $_SERVER['REMOTE_ADDR'];
+
+		$defaults = array(
+			'topic_id' => 0,
+			'post_text' => '',
+			'post_time' => $now,
+			'poster_id' => $current_user_id, // accepts ids or names
+			'poster_ip' => $ip_address,
+			'post_status' => 0, // use bb_delete_post() instead
+			'post_position' => false
+		);
+
+		// Insert all args
+		$fields = array_keys($defaults);
+		$fields[] = 'forum_id';
+
+		$run_filters = true;
+	}
+
+	$defaults['throttle'] = true;
+	extract( wp_parse_args( $args, $defaults ) );
+
+	if ( !$topic = get_topic( $topic_id ) )
+		return false;
+
+	if ( !$user = bb_get_user( $poster_id ) )
+		return false;
+
+	$topic_id = (int) $topic->topic_id;
+	$forum_id = (int) $topic->forum_id;
+
+	if ( $run_filters && !$post_text = apply_filters('pre_post', $post_text, $post_id, $topic_id) )
+		return false;
+
+	if ( $update ) // Don't change post_status with this function.  Use bb_delete_post().
+		$post_status = $post->post_status;
+
+	if ( $run_filters )
+		$post_status = (int) apply_filters('pre_post_status', $post_status, $post_id, $topic_id);
+
+	if ( false === $post_position )
+		$post_position = $topic_posts = intval( ( 0 == $post_status ) ? $topic->topic_posts + 1 : $topic->topic_posts );
+
+	unset($defaults['throttle']);
+
+	if ( $update ) {
+		$bbdb->update( $bbdb->posts, compact( $fields ), compact( 'post_id' ) );
+		wp_cache_delete( $post_id, 'bb_post' );
+	} else {
+		$bbdb->insert( $bbdb->posts, compact( $fields ) );
+		$post_id = $topic_last_post_id = (int) $bbdb->insert_id;
+
+		if ( 0 == $post_status ) {
+			$topic_time = $post_time;
+			$topic_last_poster = $poster_id;
+			$topic_last_poster_name = $user->user_login;
+
+			$bbdb->query( $bbdb->prepare( "UPDATE $bbdb->forums SET posts = posts + 1 WHERE forum_id = %d;", $topic->forum_id ) );
+			$bbdb->update(
+				$bbdb->topics,
+				compact( 'topic_time', 'topic_last_poster', 'topic_last_poster_name', 'topic_last_post_id', 'topic_posts' ),
+				compact ( 'topic_id' )
+			);
+
+			$query = new BB_Query( 'post', array( 'post_author_id' => $poster_id, 'topic_id' => $topic_id, 'post_id' => "-$post_id" ) );
+			if ( !$query->results )
+				bb_update_usermeta( $poster_id, $bbdb->prefix . 'topics_replied', $user->topics_replied + 1 );
+
+		} else {
+			bb_update_topicmeta( $topic->topic_id, 'deleted_posts', isset($topic->deleted_posts) ? $topic->deleted_posts + 1 : 1 );
+		}
+	}
+	bb_update_topic_voices( $topic_id );
+	
+	if ( $throttle && !bb_current_user_can( 'throttle' ) )
+		bb_update_usermeta( $poster_id, 'last_posted', time() );
+
+	wp_cache_delete( $topic_id, 'bb_topic' );
+	wp_cache_delete( $topic_id, 'bb_thread' );
+	wp_cache_delete( $forum_id, 'bb_forum' );
+	wp_cache_flush( 'bb_forums' );
+	wp_cache_flush( 'bb_query' );
+	wp_cache_flush( 'bb_cache_posts_post_ids' );
+
+	if ( $update ) // fire actions after cache is flushed
+		do_action( 'bb_update_post', $post_id );
+	else
+		do_action( 'bb_new_post', $post_id );
+
+	do_action( 'bb_insert_post', $post_id, $args, compact( array_keys($args) ) ); // post_id, what was passed, what was used
+
+	if (bb_get_option('enable_pingback')) {
+		bb_update_postmeta($post_id, 'pingback_queued', '');
+		wp_schedule_single_event(time(), 'do_pingbacks');
+	}
+
+	return $post_id;
+}
+
+// Deprecated: expects $post_text to be pre-escaped
+function bb_new_post( $topic_id, $post_text ) {
+	$post_text = stripslashes( $post_text );
+	return bb_insert_post( compact( 'topic_id', 'post_text' ) );
+}
+
+// Deprecated: expects $post_text to be pre-escaped
+function bb_update_post( $post_text, $post_id, $topic_id ) {
+	$post_text = stripslashes( $post_text );
+	return bb_insert_post( compact( 'post_text', 'post_id', 'topic_id' ) );
+}
+
+function bb_update_post_positions( $topic_id ) {
+	global $bbdb;
+	$topic_id = (int) $topic_id;
+	$posts = get_thread( $topic_id, array( 'per_page' => '-1' ) );
+	if ( $posts ) {
+		foreach ( $posts as $i => $post ) {
+			$bbdb->query( $bbdb->prepare( "UPDATE $bbdb->posts SET post_position = %d WHERE post_id = %d", $i + 1, $post->post_id ) );
+			wp_cache_delete( (int) $post->post_id, 'bb_post' );
+		}
+		wp_cache_delete( $topic_id, 'bb_thread' );
+		wp_cache_flush( 'bb_query' );
+		wp_cache_flush( 'bb_cache_posts_post_ids' );
+		return true;
+	} else {
+		return false;
+	}
+}
+
+function bb_delete_post( $post_id, $new_status = 0 ) {
+	global $bbdb, $topic, $bb_post;
+	$post_id = (int) $post_id;
+	$bb_post    = bb_get_post ( $post_id );
+	$new_status = (int) $new_status;
+	$old_status = (int) $bb_post->post_status;
+	add_filter( 'get_topic_where', 'bb_no_where' );
+	$topic   = get_topic( $bb_post->topic_id );
+	$topic_id = (int) $topic->topic_id;
+
+	if ( $bb_post ) {
+		$uid = (int) $bb_post->poster_id;
+		if ( $new_status == $old_status )
+			return;
+		_bb_delete_post( $post_id, $new_status );
+		if ( 0 == $old_status ) {
+			bb_update_topicmeta( $topic_id, 'deleted_posts', $topic->deleted_posts + 1 );
+			$bbdb->query( $bbdb->prepare( "UPDATE $bbdb->forums SET posts = posts - 1 WHERE forum_id = %d", $topic->forum_id ) );
+		} else if ( 0 == $new_status ) {
+			bb_update_topicmeta( $topic_id, 'deleted_posts', $topic->deleted_posts - 1 );
+			$bbdb->query( $bbdb->prepare( "UPDATE $bbdb->forums SET posts = posts + 1 WHERE forum_id = %d", $topic->forum_id ) );
+		}
+		$posts = (int) $bbdb->get_var( $bbdb->prepare( "SELECT COUNT(*) FROM $bbdb->posts WHERE topic_id = %d AND post_status = 0", $topic_id ) );
+		$bbdb->update( $bbdb->topics, array( 'topic_posts' => $posts ), compact( 'topic_id' ) );
+
+		if ( 0 == $posts ) {
+			if ( 0 == $topic->topic_status || 1 == $new_status )
+				bb_delete_topic( $topic_id, $new_status );
+		} else {
+			if ( 0 != $topic->topic_status ) {
+				$bbdb->update( $bbdb->topics, array( 'topic_status' => 0 ), compact( 'topic_id' ) );
+				$bbdb->query( $bbdb->prepare( "UPDATE $bbdb->forums SET topics = topics + 1 WHERE forum_id = %d", $topic->forum_id ) );
+			}
+			bb_topic_set_last_post( $topic_id );
+			bb_update_post_positions( $topic_id );
+			bb_update_topic_voices( $topic_id );
+		}
+
+		$user = bb_get_user( $uid );
+
+		$user_posts = new BB_Query( 'post', array( 'post_author_id' => $user->ID, 'topic_id' => $topic_id ) );
+		if ( $new_status && !$user_posts->results )
+			bb_update_usermeta( $user->ID, $bbdb->prefix . 'topics_replied', $user->topics_replied - 1 );
+		wp_cache_delete( $topic_id, 'bb_topic' );
+		wp_cache_delete( $topic_id, 'bb_thread' );
+		wp_cache_flush( 'bb_forums' );
+		wp_cache_flush( 'bb_query' );
+		wp_cache_flush( 'bb_cache_posts_post_ids' );
+		do_action( 'bb_delete_post', $post_id, $new_status, $old_status );
+		return $post_id;
+	} else {
+		return false;
+	}
+}
+
+function _bb_delete_post( $post_id, $post_status ) {
+	global $bbdb;
+	$post_id = (int) $post_id;
+	$post_status = (int) $post_status;
+	$bbdb->update( $bbdb->posts, compact( 'post_status' ), compact( 'post_id' ) );
+	wp_cache_delete( $post_id, 'bb_post' );
+}
+
+function bb_topics_replied_on_undelete_post( $post_id ) {
+	global $bbdb;
+	$bb_post = bb_get_post( $post_id );
+	$topic = get_topic( $bb_post->topic_id );
+
+	$user_posts = new BB_Query( 'post', array( 'post_author_id' => $bb_post->poster_id, 'topic_id' => $topic->topic_id ) );
+
+	if ( 1 == count($user_posts) && $user = bb_get_user( $bb_post->poster_id ) )
+		bb_update_usermeta( $user->ID, $bbdb->prefix . 'topics_replied', $user->topics_replied + 1 );
+}
+
+function bb_post_author_cache($posts) {
+	if ( !$posts )
+		return;
+
+	$ids = array();
+	foreach ($posts as $bb_post)
+		$ids[] = $bb_post->poster_id;
+
+	if ( $ids )
+		bb_cache_users(array_unique($ids));
+}
+
+// These two filters are lame.  It'd be nice if we could do this in the query parameters
+function bb_get_recent_user_replies_fields( $fields ) {
+	return $fields . ', MAX(post_time) as post_time';
+}
+
+function bb_get_recent_user_replies_group_by() {
+	return 'p.topic_id';
+}
+
+function bb_get_recent_user_replies( $user_id ) {
+	global $bbdb;
+	$user_id = (int) $user_id;
+
+	$post_query = new BB_Query( 'post', array( 'post_author_id' => $user_id, 'order_by' => 'post_time' ), 'get_recent_user_replies' );
+
+	return $post_query->results;
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-script-loader.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-script-loader.php
new file mode 100644
index 0000000000000000000000000000000000000000..19a19da238e2def56d942294abe5eeedb37e3645
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-script-loader.php
@@ -0,0 +1,100 @@
+<?php
+
+function bb_default_scripts( &$scripts ) {
+	$scripts->base_url = bb_get_uri(BB_INC, null, BB_URI_CONTEXT_SCRIPT_SRC);
+	$scripts->base_url_admin = bb_get_uri('bb-admin/', null, BB_URI_CONTEXT_SCRIPT_SRC + BB_URI_CONTEXT_BB_ADMIN);
+	$scripts->content_url = ''; // May not work - might need to specify plugin and theme urls
+	$scripts->default_version = bb_get_option( 'version' );
+	$scripts->default_dirs = array('/bb-admin/js/', '/bb-includes/js/');
+
+	// These are our enqueued scripts
+	$scripts->add( 'topic', $scripts->base_url . 'js/topic.js', array('wp-lists'), '20090602' );
+	$scripts->add( 'profile-edit', $scripts->base_url . 'js/profile-edit.js', array('password-strength-meter'), '20080721' );
+	$scripts->add( 'admin-forums', $scripts->base_url_admin . 'js/admin-forums.js', array('wp-lists', 'interface'), '20090320' );
+	$scripts->add( 'utils', $scripts->base_url_admin . 'js/utils.js', false, '20090102' );
+	$scripts->add( 'common', $scripts->base_url_admin . 'js/common.js', array('jquery', 'hoverIntent', 'utils'), '20090517' );
+	$scripts->add_data( 'common', 'group', 1 );
+	$scripts->localize( 'common', 'commonL10n', array(
+		'warnDelete' => __("You are about to delete the selected items.\n  'Cancel' to stop, 'OK' to delete."),
+		'l10n_print_after' => 'try{convertEntities(commonL10n);}catch(e){};'
+	) );
+	$scripts->localize( 'admin-forums', 'bbSortForumsL10n', array(
+		'handleText' => __('drag'),
+		'saveText'   => __('Save Forum Order'),
+		'editText'   => __('Edit Forum Order')
+	));
+
+	// These are non-3rd-party libraries
+	$scripts->add( 'wp-lists', $scripts->base_url . 'js/wp-lists.js', array('wp-ajax-response','jquery-color'), '20080826' );
+	$scripts->localize( 'wp-lists', 'wpListL10n', array(
+		'url' => $scripts->base_url_admin . 'admin-ajax.php'
+	) );
+	$scripts->add( 'wp-ajax-response', $scripts->base_url . 'js/wp-ajax-response.js', array('jquery'), '20080316' );
+	$scripts->localize( 'wp-ajax-response', 'wpAjax', array(
+		'noPerm' => __('You do not have permission to do that.'),
+		'broken' => __('An unidentified error has occurred.')
+	) );
+
+	// jQuery and friends
+	$scripts->add( 'jquery', $scripts->base_url . 'js/jquery/jquery.js', false, '1.2.6');
+	$scripts->add( 'jquery-color', $scripts->base_url . 'js/jquery/jquery.color.js', array('jquery'), '2.0-4561' );
+	$scripts->add( 'interface', $scripts->base_url . 'js/jquery/interface.js', array('jquery'), '1.2.3');
+	$scripts->add( 'password-strength-meter', $scripts->base_url . 'js/jquery/password-strength-meter.js', array('jquery'), '20070405' );
+	$scripts->localize( 'password-strength-meter', 'pwsL10n', array(
+		'short' => __('Too short'),
+		'bad' => __('Bad'),
+		'good' => __('Good'),
+		'strong' => __('Strong')
+	));
+	$scripts->add( 'hoverIntent', $scripts->base_url . 'js/jquery/hoverIntent.js', array('jquery'), '20090102' );
+	$scripts->add_data( 'hoverIntent', 'group', 1 );
+}
+
+/**
+ * Reorder JavaScript scripts array to place prototype before jQuery.
+ *
+ * @param array $js_array JavaScript scripst array
+ * @return array Reordered array, if needed.
+ */
+function bb_prototype_before_jquery( $js_array ) {
+	if ( false === $jquery = array_search( 'jquery', $js_array, true ) )
+		return $js_array;
+
+	if ( false === $prototype = array_search( 'prototype', $js_array, true ) )
+		return $js_array;
+
+	if ( $prototype < $jquery )
+		return $js_array;
+
+	unset($js_array[$prototype]);
+
+	array_splice( $js_array, $jquery, 0, 'prototype' );
+
+	return $js_array;
+}
+
+/**
+ * Load localized script just in time for MCE.
+ *
+ * These localizations require information that may not be loaded even by init.
+ */
+function bb_just_in_time_script_localization() {
+	wp_localize_script( 'topic', 'bbTopicJS', array(
+		'currentUserId' => bb_get_current_user_info( 'id' ),
+		'topicId' => get_topic_id(),
+		'favoritesLink' => get_favorites_link(),
+		'isFav' => (int) is_user_favorite( bb_get_current_user_info( 'id' ) ),
+		'confirmPostDelete' => __("Are you sure you wanna delete this post?"),
+		'confirmPostUnDelete' => __("Are you sure you wanna undelete this post?"),
+		'favLinkYes' => __( 'favorites' ),
+		'favLinkNo' => __( '?' ),
+		'favYes' => __( 'This topic is one of your %favLinkYes% [%favDel%]' ),
+		'favNo' => __( '%favAdd% (%favLinkNo%)' ),
+		'favDel' => __( '&times;' ),
+		'favAdd' => __( 'Add this topic to your favorites' )
+	));
+}
+
+add_action( 'wp_default_scripts', 'bb_default_scripts' );
+add_filter( 'wp_print_scripts', 'bb_just_in_time_script_localization' );
+add_filter( 'print_scripts_array', 'bb_prototype_before_jquery' );
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-statistics.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-statistics.php
new file mode 100644
index 0000000000000000000000000000000000000000..5aec0b7d2b7434790f0a90db531685279602de95
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-statistics.php
@@ -0,0 +1,250 @@
+<?php
+/**
+ * bbPress Forum Content Statistics Functions
+ *
+ * @package bbPress
+ */
+
+
+
+/**
+ * Get the total number of forums
+ *
+ * @since 1.0
+ * @uses $bbdb Database Object
+ * @uses $bb_total_forums Cache of result generated by previous run
+ *
+ * @return int
+ */
+function get_total_forums() {
+	global $bbdb, $bb_total_forums;
+	if ( isset($bb_total_forums) )
+		return $bb_total_forums;
+	$bb_total_forums = $bbdb->get_var("SELECT COUNT(*) FROM $bbdb->forums USE INDEX (PRIMARY)");
+	return $bb_total_forums;
+}
+
+/**
+ * Output the number of forums
+ *
+ * @since 1.0
+ */
+function total_forums() {
+	echo apply_filters('total_forums', get_total_forums() );
+}
+
+/**
+ * Get the total number of users
+ *
+ * @since 1.0
+ * @uses $bbdb Database Object
+ * @uses $bb_total_users Cache of result generated by previous run
+ *
+ * @return int
+ */
+function bb_get_total_users()
+{
+	global $bbdb, $bb_total_users;
+	if ( isset( $bb_total_users ) ) {
+		return $bb_total_users;
+	}
+	if ( false === $bb_total_users = apply_filters( 'bb_get_total_users', false ) ) {
+		$bb_total_users = $bbdb->get_var( "SELECT COUNT(*) FROM $bbdb->users USE INDEX (PRIMARY);" );
+	}
+	return $bb_total_users;
+}
+
+/**
+ * Output the number of users
+ *
+ * @since 1.0
+ */
+function bb_total_users()
+{
+	echo apply_filters( 'total_users', bb_get_total_users() );
+}
+
+/**
+ * Get the total number of posts
+ *
+ * @since 0.7.2
+ * @uses $bbdb Database Object
+ * @uses $bb_total_posts Cache of result generated by previous run
+ *
+ * @return int
+ */
+function get_total_posts() {
+	global $bbdb, $bb_total_posts;
+	if ( isset($bb_total_posts) )
+		return $bb_total_posts;
+	$bb_total_posts = $bbdb->get_var("SELECT SUM(posts) FROM $bbdb->forums");
+	return $bb_total_posts;
+}
+
+/**
+ * Output the number of posts
+ *
+ * @since 0.7.2
+ */
+function total_posts() {
+	echo apply_filters('total_posts', get_total_posts() );
+}
+
+/**
+ * Get the total number of topics
+ *
+ * @since 0.7.2
+ * @uses $bbdb Database Object
+ * @uses $bb_total_topics Cache of result generated by previous run
+ *
+ * @return int
+ */
+function get_total_topics() {
+	global $bbdb, $bb_total_topics;
+	if ( isset($bb_total_topics) )
+		return $bb_total_topics;
+	$bb_total_topics = $bbdb->get_var("SELECT SUM(topics) FROM $bbdb->forums");
+	return $bb_total_topics;
+}
+
+/**
+ * Output the number of topics
+ *
+ * @since 0.7.2
+ */
+function total_topics() {
+	echo apply_filters('total_topics', get_total_topics());
+}
+
+/**
+ * Get the popular topics
+ *
+ * @since 0.7.2
+ *
+ * @param int $num Number of topics to return
+ * @return array
+ */
+function get_popular_topics( $num = 10 ) {
+	$query = new BB_Query( 'topic', array('per_page' => $num, 'order_by' => 'topic_posts', 'append_meta' => 0) );
+	return $query->results;
+}
+
+/**
+ * Output the date when current installation was created
+ *
+ * @since 0.8
+ *
+ * @param string|array $args Arguments to pass through to bb_get_inception()
+ */
+function bb_inception( $args = '' ) {
+	$args = _bb_parse_time_function_args( $args );
+	$time = apply_filters( 'bb_inception', bb_get_inception( array('format' => 'mysql') + $args), $args );
+	echo _bb_time_function_return( $time, $args );
+}
+
+/**
+ * Get the date when current installation was created
+ *
+ * @since 0.8
+ * @uses $bbdb Database Object
+ * @uses $bb_inception Result cache
+ *
+ * @param string|array $args Formatting options for the timestamp.
+ * @return int
+ */
+function bb_get_inception( $args = '' ) {
+	$args = _bb_parse_time_function_args( $args );
+
+	global $bbdb, $bb_inception;
+	if ( !isset($bb_inception) )
+		$bb_inception = $bbdb->get_var("SELECT topic_start_time FROM $bbdb->topics ORDER BY topic_start_time LIMIT 1");
+
+	return apply_filters( 'bb_get_inception', _bb_time_function_return( $bb_inception, $args ) );
+}
+
+/**
+ * Get the average number of registrations per day
+ *
+ * @since 0.7.2
+ *
+ * @return int|float
+ */
+function get_registrations_per_day()
+{
+	return bb_get_total_users() / ceil( ( time() - bb_get_inception( 'timestamp' ) ) / 3600 / 24 );
+}
+
+/**
+ * Output the average number of registrations per day
+ *
+ * @since 0.7.2
+ */
+function registrations_per_day() {
+	echo apply_filters('registrations_per_day', bb_number_format_i18n(get_registrations_per_day(),3));
+}
+
+/**
+ * Get the average number of posts per day
+ *
+ * @since 0.7.2
+ *
+ * @return int|float
+ */
+function get_posts_per_day() {
+	return get_total_posts() / ceil( ( time() - bb_get_inception( 'timestamp' ) ) / 3600 / 24 );
+}
+
+/**
+ * Output the average number of posts per day
+ *
+ * @since 0.7.2
+ */
+function posts_per_day() {
+	echo apply_filters('posts_per_day', bb_number_format_i18n(get_posts_per_day(),3));
+}
+
+/**
+ * Get the average number of topics per day
+ *
+ * @since 0.7.2
+ *
+ * @return int|float
+ */
+function get_topics_per_day() {
+	return get_total_topics() / ceil( ( time() - bb_get_inception( 'timestamp' ) ) / 3600 / 24 );
+}
+
+/**
+ * Output the average number of topics per day
+ *
+ * @since 0.7.2
+ */
+function topics_per_day() {
+	echo apply_filters('topics_per_day', bb_number_format_i18n(get_topics_per_day(),3));
+}
+
+function bb_get_total_topic_tags()
+{
+	global $bb_total_topic_tags;
+	if ( isset($bb_total_topic_tags) ) {
+		return $bb_total_topic_tags;
+	}
+	global $wp_taxonomy_object;
+	$bb_total_topic_tags = $wp_taxonomy_object->count_terms( 'bb_topic_tag' );
+	return $bb_total_topic_tags;
+}
+
+function bb_total_topic_tags()
+{
+	echo apply_filters( 'bb_total_topic_tags', bb_get_total_topic_tags() );
+}
+
+function bb_get_topic_tags_per_day()
+{
+	return bb_get_total_topic_tags() / ceil( ( time() - bb_get_inception( 'timestamp' ) ) / 3600 / 24 );
+}
+
+function bb_topic_tags_per_day()
+{
+	echo apply_filters('bb_topic_tags_per_day', bb_number_format_i18n( bb_get_topic_tags_per_day(), 3 ) );
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-template.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-template.php
new file mode 100644
index 0000000000000000000000000000000000000000..2d7c65244aaeb2e1fe91c38acbcc8238ce7c58cd
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-template.php
@@ -0,0 +1,3527 @@
+<?php
+
+function bb_load_template( $files, $globals = false, $action_arg = null )
+{
+	global $bb, $bbdb, $bb_current_user, $page, $bb_cache,
+		$posts, $bb_post, $post_id, $topics, $topic, $topic_id,
+		$forums, $forum, $forum_id, $tags, $tag, $tag_name, $user, $user_id, $view,
+		$del_class, $bb_alt;
+
+	if ( $globals ) {
+		foreach ( $globals as $global => $v ) {
+			if ( !is_numeric($global) ) {
+				$$global = $v;
+			} else {
+				global $$v;
+			}
+		}
+	}
+
+	$files = (array) $files;
+	$template = false;
+	$default_template = false;
+	$file_used = false;
+	$default_file_used = false;
+
+	foreach ( $files as $file ) {
+		do_action( 'bb_' . $file, $action_arg );
+		if ( false !== $template = bb_get_template( $file, false ) ) {
+			$file_used = $file;
+			break;
+		}
+		if ( !$default_template ) {
+			if ( false !== $default_template = bb_get_default_template( $file ) ) {
+				$default_file_used = $file;
+			}
+		}
+	}
+
+	if ( !$template && $default_template ) {
+		$template = $default_template;
+		$file_used = $default_file_used;
+	}
+
+	$template = apply_filters( 'bb_template', $template, $file_used );
+	include( $template );
+
+	do_action( 'bb_after_' . $file_used, $action_arg );
+}
+
+function bb_get_template( $file, $default = true )
+{
+	global $bb;
+	// Skip theme loading in "safe" mode
+	if ( !isset( $bb->safemode ) || $bb->safemode !== true ) {
+		if ( file_exists( bb_get_active_theme_directory() .  $file ) ) {
+			return bb_get_active_theme_directory() .  $file;
+		}
+	}
+
+	if ( !$default ) {
+		return false;
+	}
+
+	return bb_get_default_template( $file );
+}
+
+function bb_get_default_template( $file )
+{
+	if ( file_exists( BB_DEFAULT_THEME_DIR . $file ) ) {
+		return BB_DEFAULT_THEME_DIR . $file;
+	}
+}
+
+function bb_get_header()
+{
+	bb_load_template( 'header.php' );
+}
+
+function bb_language_attributes( $xhtml = 0 )
+{
+	$output = '';
+	if ( $dir = bb_get_option( 'text_direction' ) ) {
+		$output = 'dir="' . $dir . '" ';
+	}
+	if ( $lang = bb_get_option( 'language' ) ) {
+		$output .= 'xml:lang="' . $lang . '" ';
+		if ( $xhtml < '1.1' ) {
+			$output .= 'lang="' . $lang . '"';
+		}
+	}
+
+	echo ' ' . rtrim( $output );
+}
+
+function bb_generator( $type = 'xhtml' )
+{
+	if ( !$type ) {
+		$type = 'xhtml';
+	}
+	echo apply_filters( 'bb_generator', bb_get_generator( $type ) . "\n", $type );
+}
+
+function bb_get_generator( $type = 'xhtml' )
+{
+	if ( !$type ) {
+		$type = 'xhtml';
+	}
+	switch ( $type ) {
+		case 'html':
+			$gen = '<meta name="generator" content="bbPress ' . bb_get_option( 'version' ) . '">';
+			break;
+		case 'xhtml':
+			$gen = '<meta name="generator" content="bbPress ' . bb_get_option( 'version' ) . '" />';
+			break;
+		case 'atom':
+			$gen = '<generator uri="http://bbpress.org/" version="' . bb_get_option( 'version' ) . '">bbPress</generator>';
+			break;
+		case 'rss2':
+			$gen = '<generator>http://bbpress.org/?v=' . bb_get_option( 'version' ) . '</generator>';
+			break;
+		case 'rdf':
+			$gen = '<admin:generatorAgent rdf:resource="http://bbpress.org/?v=' . bb_get_option( 'version' ) . '" />';
+			break;
+		case 'comment':
+			$gen = '<!-- generator="bbPress/' . bb_get_option( 'version' ) . '" -->';
+			break;
+		case 'export':
+			$gen = '<!-- generator="bbPress/' . bb_get_option( 'version' ) . '" created="'. date( 'Y-m-d H:i' ) . '"-->';
+			break;
+	}
+	return apply_filters( 'bb_get_generator', $gen, $type );
+}
+
+function bb_stylesheet_uri( $stylesheet = '' )
+{
+	echo esc_html( bb_get_stylesheet_uri( $stylesheet ) );
+}
+
+function bb_get_stylesheet_uri( $stylesheet = '' )
+{
+	if ( 'rtl' == $stylesheet ) {
+		$css_file = 'style-rtl.css';
+	} else {
+		$css_file = 'style.css';
+	}
+
+	$active_theme = bb_get_active_theme_directory();
+
+	if ( file_exists( $active_theme . $css_file ) ) {
+		$r = bb_get_active_theme_uri() . $css_file;
+	} else {
+		$r = BB_DEFAULT_THEME_URL . $css_file;
+	}
+
+	return apply_filters( 'bb_get_stylesheet_uri', $r, $stylesheet );
+}
+
+function bb_active_theme_uri()
+{
+	echo bb_get_active_theme_uri();
+}
+
+function bb_get_active_theme_uri()
+{
+	global $bb;
+	// Skip theme loading in "safe" mode
+	if ( isset( $bb->safemode ) && $bb->safemode === true ) {
+		$active_theme_uri = BB_DEFAULT_THEME_URL;
+	} elseif ( !$active_theme = bb_get_option( 'bb_active_theme' ) ) {
+		$active_theme_uri = BB_DEFAULT_THEME_URL;
+	} else {
+		$active_theme_uri = bb_get_theme_uri( $active_theme );
+	}
+	return apply_filters( 'bb_get_active_theme_uri', $active_theme_uri );
+}
+
+function bb_get_theme_uri( $theme = false )
+{
+	global $bb;
+	if ( preg_match( '/^([a-z0-9_-]+)#([a-z0-9_-]+)$/i', $theme, $_matches ) ) {
+		$theme_uri = $bb->theme_locations[$_matches[1]]['url'] . $_matches[2] . '/';
+	} else {
+		$theme_uri = $bb->theme_locations['core']['url'];
+	}
+	return apply_filters( 'bb_get_theme_uri', $theme_uri, $theme );
+}
+
+function bb_get_footer()
+{
+	bb_load_template( 'footer.php' );
+}
+
+function bb_head()
+{
+	do_action('bb_head');
+}
+
+/**
+ * Display the link to the Really Simple Discovery service endpoint.
+ *
+ * @link http://archipelago.phrasewise.com/rsd
+ * @since 1.0
+ */
+function bb_rsd_link() {
+	if (bb_get_option('enable_xmlrpc'))
+		echo '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . bb_get_uri('xmlrpc.php', 'rsd', BB_URI_CONTEXT_LINK_OTHER + BB_URI_CONTEXT_BB_XMLRPC) . '" />' . "\n";
+}
+
+/**
+ * Display the link to the pingback service endpoint.
+ *
+ * @since 1.0
+ */
+function bb_pingback_link() {
+	if (bb_get_option('enable_pingback'))
+		echo '<link rel="pingback" href="' . bb_get_uri('xmlrpc.php', null, BB_URI_CONTEXT_LINK_OTHER + BB_URI_CONTEXT_BB_XMLRPC) . '" />' . "\n";
+}
+
+function profile_menu() {
+	global $user_id, $profile_menu, $self, $profile_page_title;
+	$list  = "<ul id='profile-menu'>";
+	$list .= "\n\t<li" . ( ( $self ) ? '' : ' class="current"' ) . '><a href="' . esc_attr( get_user_profile_link( $user_id ) ) . '">' . __('Profile') . '</a></li>';
+	$id = bb_get_current_user_info( 'id' );
+	foreach ($profile_menu as $item) {
+		// 0 = name, 1 = users cap, 2 = others cap, 3 = file
+		$class = '';
+		if ( $item[3] == $self ) {
+			$class = ' class="current"';
+			$profile_page_title = $item[0];
+		}
+		if ( bb_can_access_tab( $item, $id, $user_id ) )
+			if ( file_exists($item[3]) || is_callable($item[3]) )
+				$list .= "\n\t<li$class><a href='" . esc_attr( get_profile_tab_link($user_id, $item[4]) ) . "'>{$item[0]}</a></li>";
+	}
+	$list .= "\n</ul>";
+	echo $list;
+}
+
+function login_form() {
+	if ( bb_is_user_logged_in() )
+		bb_load_template( 'logged-in.php' );
+	else
+		bb_load_template( 'login-form.php', array('user_login', 'remember_checked', 'redirect_to', 're') );
+}
+
+function search_form( $q = '' ) {
+	bb_load_template( 'search-form.php', array('q' => $q) );
+}
+
+function bb_post_template() {
+	bb_load_template( 'post.php' );
+}
+
+function post_form( $args = array() ) {
+	global $page, $topic, $forum;
+
+	if ( is_string( $args ) ) {
+		$args['h2'] = $args;
+	}
+	$defaults = array(
+		'h2' => '',
+		'last_page_only' => true
+	);
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	if ( isset( $forum->forum_is_category ) && $forum->forum_is_category ) {
+		return;
+	}
+
+	$add = topic_pages_add();
+	if ( empty( $h2 ) && false !== $h2 ) {
+		if ( bb_is_topic() ) {
+			$h2 = __( 'Reply' );
+		} elseif ( bb_is_forum() ) {
+			$h2 = __( 'New Topic in this Forum' );
+		} elseif ( bb_is_tag() || bb_is_front() ) {
+			$h2 = __( 'Add New Topic' );
+		}
+	}
+
+	$last_page = bb_get_page_number( ( isset( $topic->topic_posts ) ? $topic->topic_posts : 0 ) + $add );
+
+	if ( !empty( $h2 ) ) {
+		if ( bb_is_topic() && ( $page != $last_page && $last_page_only ) ) {
+			$h2 = '<a href="' . esc_attr( get_topic_link( 0, $last_page ) . '#postform' ) . '">' . $h2 . ' &raquo;</a>';
+		}
+		echo '<h2 class="post-form">' . $h2 . '</h2>' . "\n";
+	}
+
+	do_action( 'pre_post_form' );
+
+	if (
+		( bb_is_topic() && bb_current_user_can( 'write_post', $topic->topic_id ) && ( $page == $last_page || !$last_page_only ) ) ||
+		( !bb_is_topic() && bb_current_user_can( 'write_topic', isset( $forum->forum_id ) ? $forum->forum_id : 0 ) )
+	) {
+		echo '<form class="postform post-form" id="postform" method="post" action="' . bb_get_uri( 'bb-post.php', null, BB_URI_CONTEXT_FORM_ACTION ) . '">' . "\n";
+		echo '<fieldset>' . "\n";
+		bb_load_template( 'post-form.php', array('h2' => $h2) );
+		bb_nonce_field( bb_is_topic() ? 'create-post_' . $topic->topic_id : 'create-topic' );
+		if ( bb_is_forum() ) {
+			echo '<input type="hidden" name="forum_id" value="' . $forum->forum_id . '" />' . "\n";
+		} elseif ( bb_is_topic() ) {
+			echo '<input type="hidden" name="topic_id" value="' . $topic->topic_id . '" />' . "\n";
+		}
+		do_action( 'post_form' );
+		echo "\n</fieldset>\n</form>\n";
+	} elseif ( !bb_is_user_logged_in() ) {
+		echo '<p>';
+		printf(
+			__('You must <a href="%s">log in</a> to post.'),
+			esc_attr( bb_get_uri( 'bb-login.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_USER_FORMS ) )
+		);
+		echo '</p>';
+	}
+
+	do_action( 'post_post_form' );
+}
+
+function edit_form() {
+	global $bb_post;
+	do_action('pre_edit_form');
+	echo '<form class="postform edit-form" method="post" action="' . bb_get_uri('bb-edit.php', null, BB_URI_CONTEXT_FORM_ACTION)  . '">' . "\n";
+	echo '<fieldset>' . "\n";
+	bb_load_template( 'edit-form.php', array('topic_title') );
+	bb_nonce_field( 'edit-post_' . $bb_post->post_id );
+	do_action('edit_form');
+	if ($_REQUEST['view'] === 'all')
+		echo "\n" . '<input type="hidden" name="view" value="all" />';
+	echo "\n" . '</fieldset>' . "\n" . '</form>' . "\n";
+	do_action('post_edit_form');
+}
+
+function alt_class( $key, $others = '' ) {
+	echo get_alt_class( $key, $others );
+}
+
+function get_alt_class( $key, $others = '' ) {
+	global $bb_alt;
+	$class = '';
+	if ( !isset( $bb_alt[$key] ) ) $bb_alt[$key] = -1;
+	++$bb_alt[$key];
+	$others = trim($others);
+	if ( $others xor $bb_alt[$key] % 2 )
+		$class = ' class="' . ( ($others) ? $others : 'alt' ) . '"';
+	elseif ( $others && $bb_alt[$key] % 2 )
+		$class = ' class="' . $others . ' alt"';
+	return $class;
+}
+
+function bb_location() {
+	echo apply_filters( 'bb_location', bb_get_location() );
+}
+
+function bb_get_location() { // Not for display.  Do not internationalize.
+	static $file;
+	static $filename;
+
+	if ( !isset( $file ) ) {
+		$path = '';
+		foreach ( array( $_SERVER['SCRIPT_NAME'], $_SERVER['SCRIPT_FILENAME'], $_SERVER['PHP_SELF'] ) as $_path ) {
+			if ( false !== strpos( $_path, '.php' ) ) {
+				$path = $_path;
+				break;
+			}
+		}
+
+		$filename = bb_find_filename( $path );
+		// Make $file relative to bbPress root directory
+		$file = str_replace( bb_get_option( 'path' ), '', $path );
+	}
+
+	switch ( $filename ) {
+		case 'index.php':
+		case 'page.php':
+			$location = 'front-page';
+			break;
+		case 'forum.php':
+			$location = 'forum-page';
+			break;
+		case 'tags.php':
+			$location = 'tag-page';
+			break;
+		case 'edit.php':
+			$location = 'topic-edit-page';
+			break;
+		case 'topic.php':
+			$location = 'topic-page';
+			break;
+		case 'rss.php':
+			$location = 'feed-page';
+			break;
+		case 'search.php':
+			$location = 'search-page';
+			break;
+		case 'profile.php':
+			$location = 'profile-page';
+			break;
+		case 'favorites.php':
+			$location = 'favorites-page';
+			break;
+		case 'view.php':
+			$location = 'view-page';
+			break;
+		case 'statistics.php':
+			$location = 'stats-page';
+			break;
+		case 'bb-login.php':
+			$location = 'login-page';
+			break;
+		case 'register.php':
+			$location = 'register-page';
+			break;
+		default:
+			$location = apply_filters( 'bb_get_location', '', $file );
+			break;
+	}
+
+	return $location;
+}
+
+function bb_is_front() {
+	return 'front-page' == bb_get_location();
+}
+
+function bb_is_forum() {
+	return 'forum-page' == bb_get_location();
+}
+
+function bb_is_tags() {
+	return 'tag-page' == bb_get_location();
+}
+
+function bb_is_tag() {
+	global $tag, $tag_name;
+	return $tag && $tag_name && bb_is_tags();
+}
+
+function bb_is_topic_edit() {
+	return 'topic-edit-page' == bb_get_location();
+}
+
+function bb_is_topic() {
+	return 'topic-page' == bb_get_location();
+}
+
+function bb_is_feed() {
+	return 'feed-page' == bb_get_location();
+}
+
+function bb_is_search() {
+	return 'search-page' == bb_get_location();
+}
+
+function bb_is_profile() {
+	return 'profile-page' == bb_get_location();
+}
+
+function bb_is_favorites() {
+	return 'favorites-page' == bb_get_location();
+}
+
+function bb_is_view() {
+	return 'view-page' == bb_get_location();
+}
+
+function bb_is_statistics() {
+	return 'stats-page' == bb_get_location();
+}
+
+function bb_is_admin() {
+	if ( defined('BB_IS_ADMIN') )
+		return BB_IS_ADMIN;
+	return false;
+}
+
+function bb_title( $args = '' ) {
+	echo apply_filters( 'bb_title', bb_get_title( $args ) );
+}
+
+function bb_get_title( $args = '' ) {
+	$defaults = array(
+		'separator' => ' &laquo; ',
+		'order' => 'normal',
+		'front' => ''
+	);
+	$args = wp_parse_args( $args, $defaults );
+	$title = array();
+	
+	switch ( bb_get_location() ) {
+		case 'front-page':
+			if ( !empty( $args['front'] ) )
+				$title[] = $args['front'];
+			break;
+		
+		case 'topic-edit-page':
+		case 'topic-page':
+			$title[] = get_topic_title();
+			break;
+		
+		case 'forum-page':
+			$title[] = get_forum_name();
+			break;
+		
+		case 'tag-page':
+			if ( bb_is_tag() )
+				$title[] = esc_html( bb_get_tag_name() );
+			
+			$title[] = __('Tags');
+			break;
+		
+		case 'profile-page':
+			$title[] = get_user_display_name();
+			break;
+		
+		case 'view-page':
+			$title[] = get_view_name();
+			break;
+	}
+	
+	if ( $st = bb_get_option( 'static_title' ) )
+		$title = array( $st );
+	
+	$title[] = bb_get_option( 'name' );
+	
+	if ( 'reversed' == $args['order'] )
+		$title = array_reverse( $title );
+	
+	return apply_filters( 'bb_get_title', implode( $args['separator'], $title ) );
+}
+
+function bb_feed_head() {
+	
+	$feeds = array();
+	
+	switch (bb_get_location()) {
+		case 'profile-page':
+			if ( $tab = isset($_GET['tab']) ? $_GET['tab'] : bb_get_path(2) )
+				if ($tab != 'favorites')
+					break;
+			
+			$feeds[] = array(
+				'title' => sprintf(__('%1$s &raquo; User Favorites: %2$s'), bb_get_option( 'name' ), get_user_name()),
+				'href'  => get_favorites_rss_link(0, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED)
+			);
+			break;
+		
+		case 'topic-page':
+			$feeds[] = array(
+				'title' => sprintf(__('%1$s &raquo; Topic: %2$s'), bb_get_option( 'name' ), get_topic_title()),
+				'href'  => get_topic_rss_link(0, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED)
+			);
+			break;
+		
+		case 'tag-page':
+			if (bb_is_tag()) {
+				$feeds[] = array(
+					'title' => sprintf(__('%1$s &raquo; Tag: %2$s - Recent Posts'), bb_get_option( 'name' ), bb_get_tag_name()),
+					'href'  => bb_get_tag_posts_rss_link(0, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED)
+				);
+				$feeds[] = array(
+					'title' => sprintf(__('%1$s &raquo; Tag: %2$s - Recent Topics'), bb_get_option( 'name' ), bb_get_tag_name()),
+					'href'  => bb_get_tag_topics_rss_link(0, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED)
+				);
+			}
+			break;
+		
+		case 'forum-page':
+			$feeds[] = array(
+				'title' => sprintf(__('%1$s &raquo; Forum: %2$s - Recent Posts'), bb_get_option( 'name' ), get_forum_name()),
+				'href'  => bb_get_forum_posts_rss_link(0, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED)
+			);
+			$feeds[] = array(
+				'title' => sprintf(__('%1$s &raquo; Forum: %2$s - Recent Topics'), bb_get_option( 'name' ), get_forum_name()),
+				'href'  => bb_get_forum_topics_rss_link(0, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED)
+			);
+			break;
+		
+		case 'front-page':
+			$feeds[] = array(
+				'title' => sprintf(__('%1$s &raquo; Recent Posts'), bb_get_option( 'name' )),
+				'href'  => bb_get_posts_rss_link(BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED)
+			);
+			$feeds[] = array(
+				'title' => sprintf(__('%1$s &raquo; Recent Topics'), bb_get_option( 'name' )),
+				'href'  => bb_get_topics_rss_link(BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED)
+			);
+			break;
+		
+		case 'view-page':
+			global $bb_views, $view;
+			if ($bb_views[$view]['feed']) {
+				$feeds[] = array(
+					'title' => sprintf(__('%1$s &raquo; View: %2$s'), bb_get_option( 'name' ), get_view_name()),
+					'href'  => bb_get_view_rss_link(null, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED)
+				);
+			}
+			break;
+	}
+	
+	if (count($feeds)) {
+		$feed_links = array();
+		foreach ($feeds as $feed) {
+			$link = '<link rel="alternate" type="application/rss+xml" ';
+			$link .= 'title="' . esc_attr($feed['title']) . '" ';
+			$link .= 'href="' . esc_attr($feed['href']) . '" />';
+			$feed_links[] = $link;
+		}
+		$feed_links = join("\n", $feed_links);
+	} else {
+		$feed_links = '';
+	}
+	
+	echo apply_filters('bb_feed_head', $feed_links);
+}
+
+function bb_get_posts_rss_link($context = 0) {
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_FEED;
+	}
+	if ( bb_get_option( 'mod_rewrite' ) )
+		$link = bb_get_uri('rss/', null, $context);
+	else
+		$link = bb_get_uri('rss.php', null, $context);
+	return apply_filters( 'bb_get_posts_rss_link', $link, $context );
+}
+
+function bb_get_topics_rss_link($context = 0) {
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_FEED;
+	}
+	if ( bb_get_option( 'mod_rewrite' ) )
+		$link = bb_get_uri('rss/topics', null, $context);
+	else
+		$link = bb_get_uri('rss.php', array('topics' => 1), $context);
+	return apply_filters( 'bb_get_topics_rss_link', $link, $context );
+}
+
+function bb_view_rss_link($view = null, $context = 0) {
+	echo apply_filters( 'bb_view_rss_link', bb_get_view_rss_link($view, $context), $context);
+}
+
+function bb_get_view_rss_link($view = null, $context = 0) {
+	if (!$view) {
+		global $view;
+	}
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_FEED;
+	}
+	if ( bb_get_option( 'mod_rewrite' ) )
+		$link = bb_get_uri('rss/view/' . $view, null, $context);
+	else
+		$link = bb_get_uri('rss.php', array('view' => $view), $context);
+	return apply_filters( 'bb_get_view_rss_link', $link, $context );
+}
+
+function bb_latest_topics_pages( $args = null )
+{
+	$defaults = array( 'before' => '', 'after' => '' );
+	$args = wp_parse_args( $args, $defaults );
+
+	global $page;
+	static $bb_latest_topics_count;
+	if ( !$bb_latest_topics_count) {
+		global $bbdb;
+		$bb_latest_topics_count = $bbdb->get_var('SELECT COUNT(`topic_id`) FROM `' . $bbdb->topics . '` WHERE `topic_open` = 1 AND `topic_status` = 0 AND `topic_sticky` != 2;');
+	}
+	if ( $pages = apply_filters( 'bb_latest_topics_pages', get_page_number_links( $page, $bb_latest_topics_count ), $bb_latest_topics_count ) ) {
+		echo $args['before'] . $pages . $args['after'];
+	}
+}
+
+// FORUMS
+
+function forum_id( $forum_id = 0 ) {
+	echo apply_filters( 'forum_id', get_forum_id( $forum_id ) );
+}
+
+function get_forum_id( $forum_id = 0 ) {
+	global $forum;
+	$forum_id = (int) $forum_id;
+	if ( $forum_id )
+		$_forum = bb_get_forum( $forum_id );
+	else
+		$_forum =& $forum;
+	return $_forum->forum_id;
+}
+
+function forum_link( $forum_id = 0, $page = 1, $context = BB_URI_CONTEXT_A_HREF ) {
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF;
+	}
+	echo apply_filters('forum_link', get_forum_link( $forum_id, $page, $context ), $forum_id, $context );
+}
+
+function get_forum_link( $forum_id = 0, $page = 1, $context = BB_URI_CONTEXT_A_HREF ) {
+	$forum = bb_get_forum( get_forum_id( $forum_id ) );
+	
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF;
+	}
+	
+	$rewrite = bb_get_option( 'mod_rewrite' );
+	if ( $rewrite ) {
+		if ( $rewrite === 'slugs' ) {
+			$column = 'forum_slug';
+		} else {
+			$column = 'forum_id';
+		}
+		$page = (1 < $page) ? '/page/' . $page : '';
+		$link = bb_get_uri('forum/' . $forum->$column . $page, null, $context);
+	} else {
+		$query = array(
+			'id' => $forum->forum_id,
+			'page' => (1 < $page) ? $page : false
+		);
+		$link = bb_get_uri('forum.php', $query, $context);
+	}
+
+	return apply_filters( 'get_forum_link', $link, $forum->forum_id, $context );
+}
+
+function forum_name( $forum_id = 0 ) {
+	echo apply_filters( 'forum_name', get_forum_name( $forum_id ), $forum_id );
+}
+
+function get_forum_name( $forum_id = 0 ) {
+	$forum = bb_get_forum( get_forum_id( $forum_id ) );
+	return apply_filters( 'get_forum_name', $forum->forum_name, $forum->forum_id );
+}
+
+function forum_description( $args = null ) {
+	if ( is_numeric($args) )
+		$args = array( 'id' => $args );
+	elseif ( $args && is_string($args) && false === strpos($args, '=') )
+		$args = array( 'before' => $args );
+	$defaults = array( 'id' => 0, 'before' => ' &#8211; ', 'after' => '' );
+	$args = wp_parse_args( $args, $defaults );
+
+	if ( $desc = apply_filters( 'forum_description', get_forum_description( $args['id'] ), $args['id'], $args ) )
+		echo $args['before'] . $desc . $args['after'];
+}
+
+function get_forum_description( $forum_id = 0 ) {
+	$forum = bb_get_forum( get_forum_id( $forum_id ) );
+	return apply_filters( 'get_forum_description', $forum->forum_desc, $forum->forum_id );
+}
+
+function get_forum_parent( $forum_id = 0 ) {
+	$forum = bb_get_forum( get_forum_id( $forum_id ) );
+	return apply_filters( 'get_forum_parent', $forum->forum_parent, $forum->forum_id );
+}
+
+function get_forum_position( $forum_id = 0 ) {
+	$forum = bb_get_forum( get_forum_id( $forum_id ) );
+	return apply_filters( 'get_forum_position', $forum->forum_order, $forum->forum_id );
+}
+
+function bb_get_forum_is_category( $forum_id = 0 ) {
+	$forum = bb_get_forum( get_forum_id( $forum_id ) );
+	return apply_filters( 'bb_get_forum_is_category', isset($forum->forum_is_category) ? $forum->forum_is_category : false, $forum->forum_id );
+}
+
+function forum_topics( $forum_id = 0 ) {
+	echo apply_filters( 'forum_topics', get_forum_topics( $forum_id ), $forum_id );
+}
+
+function get_forum_topics( $forum_id = 0 ) {
+	$forum = bb_get_forum( get_forum_id( $forum_id ) );
+	return apply_filters( 'get_forum_topics', $forum->topics, $forum->forum_id );
+}
+
+function forum_posts( $forum_id = 0 ) {
+	echo apply_filters( 'forum_posts', get_forum_posts( $forum_id ), $forum_id );
+}
+
+function get_forum_posts( $forum_id = 0 ) {
+	$forum = bb_get_forum( get_forum_id( $forum_id ) );
+	return apply_filters( 'get_forum_posts', $forum->posts, $forum->forum_id );
+}
+
+function forum_pages( $args = null )
+{
+	// Compatibility
+	if ( $args && is_numeric( $args ) ) {
+		$args = array( 'id' => $args );
+	}
+	$defaults = array( 'id' => 0, 'before' => '', 'after' => '' );
+	$args = wp_parse_args( $args, $defaults );
+
+	global $page;
+	$forum = bb_get_forum( get_forum_id( $args['id'] ) );
+	if ( $pages = apply_filters( 'forum_pages', get_page_number_links( $page, $forum->topics ), $forum->topics ) ) {
+		echo $args['before'] . $pages . $args['after'];
+	}
+}
+
+function bb_forum_posts_rss_link( $forum_id = 0, $context = 0 ) {
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_FEED;
+	}
+	echo apply_filters('bb_forum_posts_rss_link', bb_get_forum_posts_rss_link( $forum_id, $context ), $context );
+}
+
+function bb_get_forum_posts_rss_link( $forum_id = 0, $context = 0 ) {
+	$forum = bb_get_forum( get_forum_id( $forum_id ) );
+	
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_FEED;
+	}
+	
+	$rewrite = bb_get_option( 'mod_rewrite' );
+	if ( $rewrite ) {
+		if ( $rewrite === 'slugs' ) {
+			$column = 'forum_slug';
+		} else {
+			$column = 'forum_id';
+		}
+		$link = bb_get_uri('rss/forum/' . $forum->$column, null, $context);
+	} else {
+		$link = bb_get_uri('rss.php', array('forum' => $forum->forum_id), $context);
+	}
+	return apply_filters( 'bb_get_forum_posts_rss_link', $link, $forum->forum_id, $context );
+}
+
+function bb_forum_topics_rss_link( $forum_id = 0, $context = 0 ) {
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_FEED;
+	}
+	echo apply_filters('bb_forum_topics_rss_link', bb_get_forum_topics_rss_link( $forum_id, $context ), $context );
+}
+
+function bb_get_forum_topics_rss_link( $forum_id = 0, $context = 0 ) {
+	$forum = bb_get_forum( get_forum_id( $forum_id ) );
+	
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_FEED;
+	}
+	
+	$rewrite = bb_get_option( 'mod_rewrite' );
+	if ( $rewrite ) {
+		if ( $rewrite === 'slugs' ) {
+			$column = 'forum_slug';
+		} else {
+			$column = 'forum_id';
+		}
+		$link = bb_get_uri('rss/forum/' . $forum->$column . '/topics', null, $context);
+	} else {
+		$link = bb_get_uri('rss.php', array('forum' => $forum->forum_id, 'topics' => 1), $context);
+	}
+	return apply_filters( 'bb_get_forum_topics_rss_link', $link, $forum->forum_id, $context );
+}
+
+function bb_get_forum_bread_crumb($args = '') {
+	$defaults = array(
+		'forum_id' => 0,
+		'separator' => ' &raquo; ',
+		'class' => null
+	);
+	$args = wp_parse_args($args, $defaults);
+	extract($args, EXTR_SKIP);
+
+	$trail = '';
+	$trail_forum = bb_get_forum(get_forum_id($forum_id));
+	if ($class) {
+		$class = ' class="' . $class . '"';
+	}
+	$current_trail_forum_id = $trail_forum->forum_id;
+	while ( $trail_forum && $trail_forum->forum_id > 0 ) {
+		$crumb = $separator;
+		if ($current_trail_forum_id != $trail_forum->forum_id || !bb_is_forum()) {
+			$crumb .= '<a' . $class . ' href="' . get_forum_link($trail_forum->forum_id) . '">';
+		} elseif ($class) {
+			$crumb .= '<span' . $class . '>';
+		}
+		$crumb .= get_forum_name($trail_forum->forum_id);
+		if ($current_trail_forum_id != $trail_forum->forum_id || !bb_is_forum()) {
+			$crumb .= '</a>';
+		} elseif ($class) {
+			$crumb .= '</span>';
+		}
+		$trail = $crumb . $trail;
+		$trail_forum = bb_get_forum($trail_forum->forum_parent);
+	}
+
+	return apply_filters('bb_get_forum_bread_crumb', $trail, $forum_id );
+}
+
+function bb_forum_bread_crumb( $args = '' ) {
+	echo apply_filters('bb_forum_bread_crumb', bb_get_forum_bread_crumb( $args ) );
+}
+
+// Forum Loop //
+
+function &bb_forums( $args = '' ) {
+	global $bb_forums_loop;
+
+	$default_type = 'flat';
+
+	if ( is_numeric($args) ) {
+		$args = array( 'child_of' => $args );
+	} elseif ( func_num_args() > 1 ) { // bb_forums( 'ul', $args ); Deprecated
+		$default_type = $args;
+		$args = func_get_arg(1);
+	} elseif ( $args && is_string($args) && false === strpos($args, '=') ) {
+		$args = array( 'type' => $args );
+	}
+
+	// hierarchical not used here.  Sent to bb_get_forums for proper ordering.
+	$args = wp_parse_args( $args, array('hierarchical' => true, 'type' => $default_type, 'walker' => 'BB_Walker_Blank') );
+
+	$levels = array( '', '' );
+
+	if ( in_array($args['type'], array('list', 'ul')) )
+		$levels = array( '<ul>', '</ul>' );
+
+	$forums = bb_get_forums( $args );
+
+	if ( !class_exists($args['walker']) )
+		$args['walker'] = 'BB_Walker_Blank';
+
+	if ( $bb_forums_loop = BB_Loop::start( $forums, $args['walker'] ) ) {
+		$bb_forums_loop->preserve( array('forum', 'forum_id') );
+		$bb_forums_loop->walker->db_fields = array( 'id' => 'forum_id', 'parent' => 'forum_parent' );
+		list($bb_forums_loop->walker->start_lvl, $bb_forums_loop->walker->end_lvl) = $levels;
+		return $bb_forums_loop->elements;
+	}
+	$false = false;
+	return $false;
+}
+
+function bb_forum() { // Returns current depth
+	global $bb_forums_loop;
+	if ( !is_object($bb_forums_loop) || !is_a($bb_forums_loop, 'BB_Loop') )
+		return false;
+	if ( !is_array($bb_forums_loop->elements) )
+		return false;
+
+	if ( $bb_forums_loop->step() ) {
+		$GLOBALS['forum'] =& $bb_forums_loop->elements[key($bb_forums_loop->elements)]; // Globalize the current forum object
+	} else {
+		$bb_forums_loop->reinstate();
+		return $bb_forums_loop = null; // All done?  Kill the object and exit the loop.
+	}
+
+	return $bb_forums_loop->walker->depth;
+}
+
+function bb_forum_pad( $pad, $offset = 0 ) {
+	global $bb_forums_loop;
+	if ( !is_object($bb_forums_loop) || !is_a($bb_forums_loop, 'BB_Loop') )
+		return false;
+
+	echo $bb_forums_loop->pad( $pad, $offset );
+}
+
+function bb_forum_class( $args = null ) {
+	echo apply_filters( 'bb_forum_class', get_alt_class( 'forum', bb_get_forum_class_names( $args ) ), $args );
+}
+
+function bb_get_forum_class_names( $args = null ) {
+	if ( is_numeric( $args ) ) { // Not used
+		$args = array( 'id' => $args );
+	} elseif ( $args && is_string( $args ) && false === strpos( $args, '=' ) ) {
+		$args = array( 'class' => $args );
+	}
+	$defaults = array( 'id' => 0, 'key' => 'forum', 'class' => '', 'output' => 'string' );
+	$args = wp_parse_args( $args, $defaults );
+
+	$classes = array();
+	if ( $args['class'] ) {
+		$classes[] = $args['class'];
+	}
+
+	global $bb_forums_loop;
+	if ( is_object( $bb_forums_loop ) && is_a( $bb_forums_loop, 'BB_Loop' ) ) {
+		$classes = array_merge( $classes, $bb_forums_loop->classes( 'array' ) );
+	}
+
+	if ( $args['output'] === 'string' ) {
+		$classes = join( ' ', $classes );
+	}
+
+	return apply_filters( 'bb_get_forum_class', $classes, $args );
+}
+
+// TOPICS
+function topic_id( $id = 0 ) {
+	echo apply_filters( 'topic_id', get_topic_id( $id ) );
+}
+
+function get_topic_id( $id = 0 ) {
+	global $topic;
+	$id = (int) $id;
+	if ( $id )
+		$_topic = get_topic( $id );
+	else
+		$_topic =& $topic;
+
+	if ( empty($_topic->topic_id) )
+		return 0;
+
+	return (int) $_topic->topic_id;
+}
+
+function topic_link( $id = 0, $page = 1, $context = BB_URI_CONTEXT_A_HREF ) {
+	echo apply_filters( 'topic_link', get_topic_link( $id, $page, $context ), $id, $page, $context );
+}
+
+function get_topic_link( $id = 0, $page = 1, $context = BB_URI_CONTEXT_A_HREF ) {
+	$topic = get_topic( get_topic_id( $id ) );
+
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF;
+	}
+
+	$args = array();
+
+	$rewrite = bb_get_option( 'mod_rewrite' );
+	if ( $rewrite ) {
+		if ( $rewrite === 'slugs' ) {
+			$column = 'topic_slug';
+		} else {
+			$column = 'topic_id';
+		}
+		$page = (1 < $page) ? '/page/' . $page : '';
+		$link = bb_get_uri('topic/' . $topic->$column . $page, null, $context);
+	} else {
+		$page = (1 < $page) ? $page : false;
+		$link = bb_get_uri('topic.php', array('id' => $topic->topic_id, 'page' => $page), $context);
+	}
+
+	return apply_filters( 'get_topic_link', $link, $topic->topic_id, $context );
+}
+
+function topic_rss_link( $id = 0, $context = 0 ) {
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_FEED;
+	}
+	echo apply_filters('topic_rss_link', get_topic_rss_link($id, $context), $id, $context );
+}
+
+function get_topic_rss_link( $id = 0, $context = 0 ) {
+	$topic = get_topic( get_topic_id( $id ) );
+
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_FEED;
+	}
+
+	$rewrite = bb_get_option( 'mod_rewrite' );
+	if ( $rewrite ) {
+		if ( $rewrite === 'slugs' ) {
+			$column = 'topic_slug';
+		} else {
+			$column = 'topic_id';
+		}
+		$link = bb_get_uri('rss/topic/' . $topic->$column, null, $context);
+	} else {
+		$link = bb_get_uri('rss.php', array('topic' => $topic->topic_id), $context);
+	}
+	return apply_filters( 'get_topic_rss_link', $link, $topic->topic_id, $context );
+}
+
+function bb_topic_labels() {
+	echo apply_filters( 'bb_topic_labels', null );
+}
+
+function topic_title( $id = 0 ) {
+	echo apply_filters( 'topic_title', get_topic_title( $id ), get_topic_id( $id ) );
+}
+
+function get_topic_title( $id = 0 ) {
+	$topic = get_topic( get_topic_id( $id ) );
+	return apply_filters( 'get_topic_title', $topic->topic_title, $topic->topic_id );
+}
+
+function topic_page_links( $id = 0, $args = null ) {
+	echo apply_filters( 'topic_page_links', get_topic_page_links( $id, $args ), get_topic_id( $id ) );
+}
+
+function get_topic_page_links( $id = 0, $args = null ) {
+
+	$defaults = array(
+		'show_all' => false,
+		'end_size' => 3,
+		'before' => ' - ',
+		'after' => null
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+
+	$topic = get_topic( get_topic_id( $id ) );
+
+	$uri = get_topic_link();
+	if ( bb_get_option('mod_rewrite') ) {
+		if ( false === $pos = strpos( $uri, '?' ) ) {
+			$uri = $uri . '%_%';
+		} else {
+			$uri = substr_replace( $uri, '%_%', $pos, 0 );
+		}
+	} else {
+		$uri = add_query_arg( 'page', '%_%', $uri );
+	}
+
+	$posts = $topic->topic_posts + topic_pages_add( $topic->topic_id );
+
+	$per_page = apply_filters( 'get_topic_page_links_per_page', bb_get_option('page_topics') );
+
+	$_links = bb_paginate_links(
+		array(
+			'base' => $uri,
+			'format' => bb_get_option('mod_rewrite') ? '/page/%#%' : '%#%',
+			'total' => ceil($posts/$per_page),
+			'current' => 0,
+			'show_all' => $args['show_all'],
+			'end_size' => $args['end_size'],
+			'type' => 'array'
+		)
+	);
+
+	$links = $_links;
+
+	if ( $links ) {
+		if ( !$show_first ) {
+			unset( $links[0] );
+		}
+
+		$r = '';
+		if ( $args['before'] ) {
+			$r .= $args['before'];
+		}
+		$r .= join('', $links);
+		if ( $args['after'] ) {
+			$r .= $args['after'];
+		}
+	}
+
+	return apply_filters( 'get_topic_page_links', $r, $_links, $topic->topic_id );
+}
+
+function bb_topic_voices( $id = 0 ) {
+	echo apply_filters( 'bb_topic_voices', bb_get_topic_voices( $id ), get_topic_id( $id ) );
+}
+
+function bb_get_topic_voices( $id = 0 ) {
+	$topic = get_topic( get_topic_id( $id ) );
+
+	if ( empty( $topic->voices_count ) ) {
+		global $bbdb;
+
+		if ( $voices = $bbdb->get_col( $bbdb->prepare( "SELECT DISTINCT poster_id FROM $bbdb->posts WHERE topic_id = %s AND post_status = '0';", $topic->topic_id ) ) ) {
+			$voices = count( $voices );
+			bb_update_topicmeta( $topic->topic_id, 'voices_count', $voices );
+		}
+	} else {
+		$voices = $topic->voices_count;
+	}
+
+	return apply_filters( 'bb_get_topic_voices', $voices, $topic->topic_id );
+}
+
+function topic_posts( $id = 0 ) {
+	echo apply_filters( 'topic_posts', get_topic_posts( $id ), get_topic_id( $id ) );
+}
+
+function get_topic_posts( $id = 0 ) {
+	$topic = get_topic( get_topic_id( $id ) );
+	return apply_filters( 'get_topic_posts', $topic->topic_posts, $topic->topic_id );
+}
+
+function get_topic_deleted_posts( $id = 0 ) {
+	$topic = get_topic( get_topic_id( $id ) );
+	return apply_filters( 'get_topic_deleted_posts', isset($topic->deleted_posts) ? $topic->deleted_posts : 0, $topic->topic_id );
+}
+
+function topic_noreply( $title ) {
+	if ( 1 == get_topic_posts() && ( bb_is_front() || bb_is_forum() ) )
+		$title = "<strong>$title</strong>";
+	return $title;
+}
+
+function topic_last_poster( $id = 0 ) {
+	$topic = get_topic( get_topic_id( $id ) );
+	echo apply_filters( 'topic_last_poster', get_topic_last_poster( $id ), $topic->topic_last_poster, $topic->topic_id ); // $topic->topic_last_poster = user ID
+}
+
+function get_topic_last_poster( $id = 0 ) {
+	$topic = get_topic( get_topic_id( $id ) );
+	$user_display_name = get_user_display_name($topic->topic_last_poster);
+	return apply_filters( 'get_topic_last_poster', $user_display_name, $topic->topic_last_poster, $topic->topic_id ); // $topic->topic_last_poster = user ID
+}
+
+function topic_author( $id = 0 ) {
+	$topic = get_topic( get_topic_id( $id ) );
+	echo apply_filters( 'topic_author', get_topic_author( $id ), $topic->topic_poster, $topic->topic_id ); // $topic->topic_poster = user ID
+}
+
+function get_topic_author( $id = 0 ) {
+	$topic = get_topic( get_topic_id( $id ) );
+	$user_display_name = get_user_display_name($topic->topic_poster);
+	return apply_filters( 'get_topic_author', $user_display_name, $topic->topic_poster, $topic->topic_id ); // $topic->topic_poster = user ID
+}
+
+// Filters expect the format to by mysql on both topic_time and get_topic_time
+function topic_time( $args = '' ) {
+	$args = _bb_parse_time_function_args( $args );
+	$time = apply_filters( 'topic_time', get_topic_time( array('format' => 'mysql') + $args), $args );
+	echo _bb_time_function_return( $time, $args );
+}
+
+function get_topic_time( $args = '' ) {
+	$args = _bb_parse_time_function_args( $args );
+
+	$topic = get_topic( get_topic_id( $args['id'] ) );
+
+	$time = apply_filters( 'get_topic_time', $topic->topic_time, $args );
+
+	return _bb_time_function_return( $time, $args );
+}
+
+function topic_start_time( $args = '' ) {
+	$args = _bb_parse_time_function_args( $args );
+	$time = apply_filters( 'topic_start_time', get_topic_start_time( array('format' => 'mysql') + $args), $args );
+	echo _bb_time_function_return( $time, $args );
+}
+
+function get_topic_start_time( $args = '' ) {
+	$args = _bb_parse_time_function_args( $args );
+
+	$topic = get_topic( get_topic_id( $args['id'] ) );
+
+	$time = apply_filters( 'get_topic_start_time', $topic->topic_start_time, $args, $topic->topic_id );
+
+	return _bb_time_function_return( $time, $args );
+}
+
+function topic_last_post_link( $id = 0 ) {
+	echo apply_filters( 'topic_last_post_link', get_topic_last_post_link( $id ), $id);
+}
+
+function get_topic_last_post_link( $id = 0 ){
+	$topic = get_topic( get_topic_id( $id ) );
+	$page = bb_get_page_number( $topic->topic_posts );
+	return apply_filters( 'get_post_link', get_topic_link( $topic->topic_id, $page ) . "#post-$topic->topic_last_post_id", $topic->topic_last_post_id, $topic->topic_id );
+}
+
+function topic_pages( $args = null )
+{
+	// Compatibility
+	if ( $args && is_numeric( $args ) ) {
+		$args = array( 'id' => $args );
+	}
+	$defaults = array( 'id' => 0, 'before' => '', 'after' => '' );
+	$args = wp_parse_args( $args, $defaults );
+
+	global $page;
+	$topic = get_topic( get_topic_id( $args['id'] ) );
+	$add = topic_pages_add( $topic->topic_id );
+	if ( $pages = apply_filters( 'topic_pages', get_page_number_links( $page, $topic->topic_posts + $add ), $topic->topic_id ) ) {
+		echo $args['before'] . $pages . $args['after'];
+	}
+}
+
+function topic_pages_add( $id = 0 ) {
+	$topic = get_topic( get_topic_id( $id ) );
+	if ( isset($_GET['view']) && 'all' == $_GET['view'] && bb_current_user_can('browse_deleted') && isset( $topic->deleted_posts ) )
+		$add = $topic->deleted_posts;
+	else
+		$add = 0;
+	return apply_filters( 'topic_pages_add', $add, isset($topic->topic_id) ? $topic->topic_id : 0 );
+}
+
+function get_page_number_links( $args ) {
+	if ( 1 < func_num_args() ) {
+		$_args = func_get_args();
+		$args = array(
+			'page' => $_args[0],
+			'total' => $_args[1],
+			'per_page' => isset( $_args[2] ) ? $_args[2] : '',
+			'mod_rewrite' => isset( $_args[3] ) ? $_args[3] : 'use_option'
+		);
+	}
+	$defaults = array(
+		'page' => 1,
+		'total' => false,
+		'per_page' => '',
+		'mod_rewrite' => 'use_option',
+		'prev_text' => __( '&laquo; Previous' ),
+		'next_text' => __( 'Next &raquo;' )
+	);
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	$add_args = array();
+	$uri = rtrim( $_SERVER['REQUEST_URI'], '?&' );
+
+	if ( $mod_rewrite === 'use_option' ) {
+		$mod_rewrite = bb_get_option( 'mod_rewrite' );
+	}
+
+	if ( $mod_rewrite ) {
+		$format = '/page/%#%';
+		if ( 1 == $page ) {
+			if ( false === $pos = strpos($uri, '?') )
+				$uri = $uri . '%_%';
+			else
+				$uri = substr_replace($uri, '%_%', $pos, 0);
+		} else {
+			$uri = preg_replace('|/page/[0-9]+|', '%_%', $uri);
+		}
+		$uri = str_replace( '/%_%', '%_%', $uri );
+	} else {
+		if ( 1 == $page ) {
+			if ( false === $pos = strpos($uri, '?') ) {
+				$uri = $uri . '%_%';
+				$format = '?page=%#%';
+			} else {
+				$uri = substr_replace($uri, '?%_%', $pos, 1);
+				$format = 'page=%#%&';
+			}
+		} else {
+			if ( false === strpos($uri, '?page=') ) {
+				$uri = preg_replace('!&page=[0-9]+!', '%_%', $uri );
+				$uri = str_replace( '&page=', '', $uri );
+				$format = '&page=%#%';
+			} else {
+				$uri = preg_replace('!\?page=[0-9]+!', '%_%', $uri );
+				$uri = str_replace( '?page=', '', $uri );
+				$format = '?page=%#%';
+			}
+		}
+	}
+
+	if ( isset($_GET['view']) && in_array($_GET['view'], bb_get_views()) )
+		$add_args['view'] = $_GET['view'];
+
+	if ( empty( $per_page ) ) {
+		$per_page = bb_get_option( 'page_topics' );
+	}
+
+	$links = bb_paginate_links( array(
+		'base' => $uri,
+		'format' => $format,
+		'total' => ceil( $total/$per_page ),
+		'current' => $page,
+		'add_args' => $add_args,
+		'type' => 'array',
+		'mid_size' => 1,
+		'prev_text' => $prev_text,
+		'next_text' => $next_text
+	) );
+
+	if ($links) {
+		$links = join('', $links);
+	}
+	return $links;
+}
+
+function bb_topic_admin( $args = '' )
+{
+	$parts = array(
+		'delete' => bb_get_topic_delete_link( $args ),
+		'close'  => bb_get_topic_close_link( $args ),
+		'sticky' => bb_get_topic_sticky_link( $args ),
+		'move'   => bb_get_topic_move_dropdown( $args )
+	);
+
+	echo join( "\n", apply_filters( 'bb_topic_admin', $parts ) );
+}
+
+function topic_delete_link( $args = '' ) {
+	echo bb_get_topic_delete_link( $args );
+}
+
+function bb_get_topic_delete_link( $args = '' ) {
+	$defaults = array( 'id' => 0, 'before' => '[', 'after' => ']', 'delete_text' => false, 'undelete_text' => false, 'redirect' => true );
+	extract(wp_parse_args( $args, $defaults ), EXTR_SKIP);
+	$id = (int) $id;
+
+	$topic = get_topic( get_topic_id( $id ) );
+
+	if ( !$topic || !bb_current_user_can( 'delete_topic', $topic->topic_id ) )
+		return;
+
+	if ( true === $redirect )
+		$redirect = $_SERVER['REQUEST_URI'];
+
+	if ( 0 == $topic->topic_status ) {
+		$query   = array( 'id' => $topic->topic_id, '_wp_http_referer' => $redirect ? rawurlencode( $redirect ) : false );
+		$confirm = __('Are you sure you wanna delete that?');
+		$display = esc_html( $delete_text ? $delete_text : __('Delete entire topic') );
+	} else {
+		$query   = array('id' => $topic->topic_id, 'view' => 'all', '_wp_http_referer' => $redirect ? rawurlencode( $redirect ) : false );
+		$confirm = __('Are you sure you wanna undelete that?');
+		$display = esc_html( $undelete_text ? $undelete_text : __('Undelete entire topic') );
+	}
+	$uri = bb_get_uri('bb-admin/delete-topic.php', $query, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN);
+	$uri = esc_url( bb_nonce_url( $uri, 'delete-topic_' . $topic->topic_id ) );
+	
+	return $before . '<a href="' . $uri . '" onclick="return confirm(\'' . esc_js( $confirm ) . '\');">' . $display . '</a>' . $after;
+}
+
+function topic_close_link( $args = '' ) {
+	echo bb_get_topic_close_link( $args );
+}
+
+function bb_get_topic_close_link( $args = '' ) {
+	$defaults = array( 'id' => 0, 'before' => '[', 'after' => ']', 'close_text' => false, 'open_text' => false, 'redirect' => true );
+	extract(wp_parse_args( $args, $defaults ), EXTR_SKIP);
+	$id = (int) $id;
+
+	$topic = get_topic( get_topic_id( $id ) );
+
+	if ( !$topic || !bb_current_user_can( 'close_topic', $topic->topic_id ) )
+		return;
+
+	if ( topic_is_open( $topic->topic_id ) )
+		$display = esc_html( $close_text ? $close_text : __( 'Close topic' ) );
+	else
+		$display = esc_html( $open_text ? $open_text : __( 'Open topic' ) );
+
+	if ( true === $redirect )
+		$redirect = $_SERVER['REQUEST_URI'];
+
+	$uri = bb_get_uri('bb-admin/topic-toggle.php', array( 'id' => $topic->topic_id, '_wp_http_referer' => $redirect ? rawurlencode( $redirect ) : false ), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN);
+	$uri = esc_url( bb_nonce_url( $uri, 'close-topic_' . $topic->topic_id ) );
+	
+	return $before . '<a href="' . $uri . '">' . $display . '</a>' . $after;
+}
+
+function topic_sticky_link( $args = '' ) {
+	echo bb_get_topic_sticky_link( $args );
+}
+
+function bb_get_topic_sticky_link( $args = '' ) {
+	$defaults = array( 'id' => 0, 'before' => '[', 'after' => ']' );
+	extract(wp_parse_args( $args, $defaults ), EXTR_SKIP);
+	$id = (int) $id;
+
+	$topic = get_topic( get_topic_id( $id ) );
+
+	if ( !$topic || !bb_current_user_can( 'stick_topic', $topic->topic_id ) )
+		return;
+
+	$uri_stick = bb_get_uri('bb-admin/sticky.php', array('id' => $topic->topic_id), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN);
+	$uri_stick = esc_url( bb_nonce_url( $uri_stick, 'stick-topic_' . $topic->topic_id ) );
+
+	$uri_super = bb_get_uri('bb-admin/sticky.php', array('id' => $topic->topic_id, 'super' => 1), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN);
+	$uri_super = esc_url( bb_nonce_url( $uri_super, 'stick-topic_' . $topic->topic_id ) );
+
+	if ( topic_is_sticky( $topic->topic_id ) )
+		return "$before<a href='" . $uri_stick . "'>". __('Unstick topic') ."</a>$after";
+	else
+		return "$before<a href='" . $uri_stick . "'>". __('Stick topic') . "</a> (<a href='" . $uri_super . "'>" . __('to front') . "</a>)$after";
+}
+
+function topic_show_all_link( $id = 0 ) {
+	if ( !bb_current_user_can( 'browse_deleted' ) )
+		return;
+	if ( 'all' == @$_GET['view'] )
+		echo "<a href='" . esc_attr( get_topic_link( $id ) ) . "'>". __('View normal posts') ."</a>";
+	else
+		echo "<a href='" . esc_attr( add_query_arg( 'view', 'all', get_topic_link( $id ) ) ) . "'>". __('View all posts') ."</a>";
+}
+
+function topic_posts_link( $id = 0 ) {
+	echo get_topic_posts_link( $id );
+}
+
+function get_topic_posts_link( $id = 0 ) {
+	$topic = get_topic( get_topic_id( $id ) );
+	$post_num = get_topic_posts( $id );
+	$posts = sprintf(__ngettext( '%s post', '%s posts', $post_num ), $post_num);
+	$r = '';
+
+	if ( ( 'all' == @$_GET['view'] || bb_is_admin() ) && bb_current_user_can('browse_deleted') )
+		$r .= "<a href='" . esc_attr( get_topic_link( $id ) ) . "'>$posts</a>";
+	else
+		$r .= $posts;
+
+	if ( bb_current_user_can( 'browse_deleted' ) ) {
+		$user_id = bb_get_current_user_info( 'id' );
+		if ( isset($topic->bozos[$user_id]) && 'all' != @$_GET['view'] )
+			add_filter('get_topic_deleted_posts', create_function('$a', "\$a -= {$topic->bozos[$user_id]}; return \$a;") );
+		if ( $deleted = get_topic_deleted_posts( $id ) ) {
+			$extra = sprintf(__('+%d more'), $deleted);
+			if ( 'all' == @$_GET['view'] )
+				$r .= " $extra";
+			else
+				$r .= " <a href='" . esc_attr( add_query_arg( 'view', 'all', get_topic_link( $id ) ) ) . "'>$extra</a>";
+		}
+	}
+
+	return $r;
+}
+
+function topic_move_dropdown( $args = '' )
+{
+	echo bb_get_topic_move_dropdown( $args );
+}
+
+function bb_get_topic_move_dropdown( $args = '' )
+{
+	if ( $args && is_numeric( $args ) ) {
+		$args = array( 'id' => (integer) $args );
+	}
+
+	$defaults = array( 'id' => 0, 'before' => '[', 'after' => ']' );
+	extract(wp_parse_args( $args, $defaults ), EXTR_SKIP);
+	$id = (int) $id;
+
+	$topic = get_topic( get_topic_id( $id ) );
+	if ( !bb_current_user_can( 'move_topic', $topic->topic_id ) )
+		return;
+
+	$dropdown = bb_get_forum_dropdown( array(
+		'callback' => 'bb_current_user_can',
+		'callback_args' => array('move_topic', $topic->topic_id),
+		'selected' => $topic->forum_id,
+		'tab' => false
+	) );
+
+	if ( !$dropdown )
+		return;
+
+	$r = $before . '<form id="topic-move" method="post" action="' . bb_get_uri( 'bb-admin/topic-move.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN ) . '">' . "\n";
+	$r .= '<fieldset>' . "\n";
+	$r .= '<div>' . "\n";
+	$r .= '<input type="hidden" name="topic_id" value="' . $topic->topic_id . '" />' . "\n";
+	$r .= '<label for="forum-id">'. __( 'Move to' ) . '</label>' . "\n";
+	$r .= $dropdown . "\n";
+	$r .= bb_nonce_field( 'move-topic_' . $topic->topic_id, '_wpnonce', true , false );
+	$r .= '<input type="submit" name="Submit" value="' . __( 'Move' ) . '" />' . "\n";
+	$r .= '</div>' . "\n";
+	$r .= '</fieldset>' . "\n";
+	$r .= '</form>' . $after;
+
+	return $r;
+}
+
+function topic_class( $class = '', $key = 'topic', $id = 0 ) {
+	$topic = get_topic( get_topic_id( $id ) );
+	$class = $class ? explode(' ', $class ) : array();
+	if ( '1' === $topic->topic_status && bb_current_user_can( 'browse_deleted' ) )
+		$class[] = 'deleted';
+	elseif ( 1 < $topic->topic_status && bb_current_user_can( 'browse_deleted' ) )
+		$class[] = 'bozo';
+	if ( '0' === $topic->topic_open )
+		$class[] = 'closed';
+	if ( 1 == $topic->topic_sticky && ( bb_is_forum() || bb_is_view() ) )
+		$class[] = 'sticky';
+	elseif ( 2 == $topic->topic_sticky && ( bb_is_front() || bb_is_forum() ) )
+		$class[] = 'sticky super-sticky';
+	$class = apply_filters( 'topic_class', $class, $topic->topic_id );
+	$class = join(' ', $class);
+	alt_class( $key, $class );
+}
+
+/**
+ * bb_get_new_topic_link() - Get the link to the form for a new topic
+ *
+ * @since 1.0
+ * @param mixed The arguments for this function.
+ * @return string The link to the new topic form
+ */
+function bb_get_new_topic_link( $args = null ) {
+	$defaults = array( 'text' => __('Add New &raquo;'), 'forum' => 0, 'tag' => '' );
+	if ( $args && is_string($args) && false === strpos($args, '=') )
+		$args = array( 'text' => $args );
+
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	if ( $forum && $forum = bb_get_forum( $forum ) )
+		$url = get_forum_link( $forum->forum_id ) . '#postform';
+	elseif ( $tag && $tag = bb_get_tag( $tag ) )
+		$url = bb_get_tag_link( $tag->tag ) . '#postform';
+	elseif ( bb_is_forum() ) {
+		global $forum;
+		$url = get_forum_link( $forum->forum_id ) . '#postform';
+	} elseif ( bb_is_tag() ) {
+		global $tag;
+		$url = bb_get_tag_link( $tag ) . '#postform';
+	} elseif ( bb_is_topic() )
+		$url = get_forum_link() . '#postform';
+	elseif ( bb_is_front() )
+		$url = bb_get_uri(null, array('new' => 1));
+
+	if ( !bb_is_user_logged_in() )
+		$url = bb_get_uri('bb-login.php', array('re' => $url), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_USER_FORMS);
+	elseif ( bb_is_forum() || bb_is_topic() ) {
+		if ( !bb_current_user_can( 'write_topic', get_forum_id() ) )
+			return;
+	} else {
+		if ( !bb_current_user_can( 'write_topics' ) )
+			return;
+	}
+
+	if ( $url = esc_attr( apply_filters( 'new_topic_url', $url, $args ) ) )
+		return '<a href="' . $url . '" class="new-topic">' . $text . '</a>' . "\n";
+}
+
+function bb_new_topic_link( $args = null ) {
+	echo bb_get_new_topic_link($args);
+}
+
+function bb_new_topic_forum_dropdown( $args = '' ) {
+	if ( !is_array( $args ) ) {
+		$args = array(
+			'callback' => 'bb_current_user_can',
+			'callback_args' => array( 'write_topic' )
+		);
+	}
+	if ( !isset( $args['callback'] ) && !isset( $args['callback_args'] ) ) {
+		$args['callback']      = 'bb_current_user_can';
+		$args['callback_args'] = array( 'write_topic' );
+	}
+	bb_forum_dropdown( $args );
+}
+
+function bb_topic_search_form( $args = null, $query_obj = null ) {
+	global $bb_query_form;
+
+	if ( $query_obj && is_a($query_obj, 'BB_Query_Form') ); // [sic]
+	else
+		$query_obj =& $bb_query_form;
+
+	$query_obj->form( $args );
+}
+
+/**
+ * bb_topic_pagecount() - Print the total page count for a topic
+ *
+ * @since 0.9
+ * @param int $topic_id The topic id of the topic being queried
+ * @return void
+ */
+function bb_topic_pagecount( $topic_id = 0 ) {
+	echo bb_get_topic_pagecount( $topic_id );
+}
+
+/**
+ * bb_get_topic_pagecount() - Get the total page count for a topic
+ *
+ * @since 0.9
+ * @param int $topic_id The topic id of the topic being queried
+ * @return int The total number of pages in the topic
+ */
+function bb_get_topic_pagecount( $topic_id = 0 ) {
+	$topic = get_topic( get_topic_id( $topic_id ) );
+	return bb_get_page_number( $topic->topic_posts + topic_pages_add() );
+}
+
+/**
+ * bb_is_topic_lastpage() - Report whether the current page is the last page of a given topic
+ *
+ * @since 0.9
+ * @param int $topic_id The topic id of the topic being queried
+ * @return boolean True if called on the last page of a topic, otherwise false
+ */
+function bb_is_topic_lastpage( $topic_id = 0 ) {
+	global $page;
+	return ( $page == bb_get_topic_pagecount( $topic_id ) );
+}
+
+// POSTS
+
+function post_id( $post_id = 0 ) {
+	echo get_post_id( $post_id );
+}
+
+function get_post_id( $post_id = 0 ) {
+	global $bb_post;
+	$post_id = (int) $post_id;
+	if ( $post_id )
+		$post = bb_get_post( $post_id );
+	else
+		$post =& $bb_post;
+	return $post->post_id;
+}
+
+function post_link( $post_id = 0 ) {
+	echo apply_filters( 'post_link', get_post_link( $post_id ), get_post_id( $post_id ) );
+}
+
+function get_post_link( $post_id = 0 ) {
+	$bb_post = bb_get_post( get_post_id( $post_id ) );
+	$page = bb_get_page_number( $bb_post->post_position );
+	return apply_filters( 'get_post_link', get_topic_link( $bb_post->topic_id, $page ) . "#post-$bb_post->post_id", $bb_post->post_id );
+}
+
+function post_anchor_link( $force_full = false ) {
+	if ( defined('DOING_AJAX') || $force_full )
+		post_link();
+	else
+		echo '#post-' . get_post_id();
+}
+
+function post_position( $post_id = 0 ) {
+	echo apply_filters( 'post_position', get_post_position( $post_id ), get_post_id( $post_id ) );
+}
+
+function get_post_position( $post_id = 0 ) {
+	$bb_post = bb_get_post( get_post_id( $post_id ) );
+	return apply_filters( 'get_post_position', $bb_post->post_position, $bb_post->post_id );
+}
+
+function post_position_link( $topic_id = 0, $position = 1 ) {
+	echo apply_filters( 'post_position_link', get_post_position_link( $topic_id, $position ), get_topic_id( $topic_id ), (integer) $position );
+}
+
+function get_post_position_link( $topic_id = 0, $position = 1 ) {
+	$position = (integer) $position;
+	$bb_topic = get_topic( get_topic_id( $topic_id ) );
+	if ( $bb_topic->topic_posts < $position ) {
+		return;
+	}
+	$page = bb_get_page_number( $position );
+	return apply_filters( 'get_post_position_link', get_topic_link( $bb_post->topic_id, $page ) . "#position-$position", $bb_topic->topic_id, $position );
+}
+
+function bb_post_meta( $key, $post_id = 0 ) {
+	echo bb_get_post_meta( $key, $post_id );
+}
+
+function bb_get_post_meta( $key, $post_id = 0 ) {
+	$bb_post = bb_get_post( get_post_id( $post_id ) );
+	if ( isset($bb_post->$key) )
+		return $bb_post->$key;
+}
+
+
+function post_author( $post_id = 0 ) {
+	echo apply_filters('post_author', get_post_author( $post_id ), $post_id );
+}
+
+function get_post_author( $post_id = 0 ) {
+	if ( $user = bb_get_user( get_post_author_id( $post_id ) ) )
+		return apply_filters( 'get_post_author', $user->display_name, $user->ID, $post_id );
+	elseif ( $title = bb_get_post_meta( 'pingback_title' ) )
+		return apply_filters( 'bb_get_pingback_title', $title, $post_id );
+	else
+		return apply_filters( 'get_post_author', __('Anonymous'), 0, $post_id );
+}
+
+function post_author_link( $post_id = 0 ) {
+	if ( $link = get_user_link( get_post_author_id( $post_id ) ) ) {
+		echo '<a href="' . esc_attr( $link ) . '">' . get_post_author( $post_id ) . '</a>';
+	} elseif ( $link = bb_get_post_meta( 'pingback_uri' )) {
+		echo '<a href="' . esc_attr( $link ) . '">' . get_post_author( $post_id ) . '</a>';
+	} else {
+		post_author( $post_id );
+	}
+}
+
+function post_author_avatar( $size = '48', $default = '', $post_id = 0 ) {
+	if ( ! bb_get_option('avatars_show') )
+		return false;
+	
+	$author_id = get_post_author_id( $post_id );
+	echo bb_get_avatar( $author_id, $size, $default );
+}
+
+function post_author_avatar_link( $size = '48', $default = '', $post_id = 0 ) {
+	if ( ! bb_get_option('avatars_show') )
+		return false;
+	
+	$author_id = get_post_author_id( $post_id );
+	if ( $link = get_user_link( $author_id ) ) {
+		echo '<a href="' . esc_attr( $link ) . '">' . bb_get_avatar( $author_id, $size, $default ) . '</a>';
+	} else {
+		echo bb_get_avatar( $author_id, $size, $default );
+	}
+}
+
+function post_text( $post_id = 0 ) {
+	echo apply_filters( 'post_text', get_post_text( $post_id ), get_post_id( $post_id ) );
+}
+
+function get_post_text( $post_id = 0 ) {
+	$bb_post = bb_get_post( get_post_id( $post_id ) );
+	return apply_filters( 'get_post_text', $bb_post->post_text, $bb_post->post_id );
+}
+
+function bb_post_time( $args = '' ) {
+	$args = _bb_parse_time_function_args( $args );
+	$time = apply_filters( 'bb_post_time', bb_get_post_time( array('format' => 'mysql') + $args ), $args );
+	echo _bb_time_function_return( $time, $args );
+}
+
+function bb_get_post_time( $args = '' ) {
+	$args = _bb_parse_time_function_args( $args );
+
+	$bb_post = bb_get_post( get_post_id( $args['id'] ) );
+
+	$time = apply_filters( 'bb_get_post_time', $bb_post->post_time, $args );
+
+	return _bb_time_function_return( $time, $args );
+}
+
+function post_ip( $post_id = 0 ) {
+	if ( bb_current_user_can( 'view_by_ip' ) )
+		echo apply_filters( 'post_ip', get_post_ip( $post_id ), get_post_id( $post_id ) );
+}
+
+function get_post_ip( $post_id = 0 ) {
+	$bb_post = bb_get_post( get_post_id( $post_id ) );
+	return apply_filters( 'get_post_ip', $bb_post->poster_ip, $bb_post->post_id );
+}
+
+function bb_post_admin( $args = null )
+{
+	$defaults = array(
+		'post_id' => 0,
+		'before' => '',
+		'after' => '',
+		'before_each' => '',
+		'after_each' => "\n",
+		'each' => array(
+			'ip' => array(
+				'post_id' => 0
+			),
+			'edit' => array(
+				'post_id' => 0
+			),
+			'delete' => array(
+				'post_id' => 0
+			),
+			'undelete' => array(
+				'post_id' => 0
+			)
+		)
+	);
+	if ( isset( $args['each'] ) ) {
+		$each_args = $args['each'];
+		$_each_args = $defaults['each'];
+		foreach ( $each_args as $_part_name => $_part_args ) {
+			if ( !isset( $defaults['each'][$_part_name] ) ) {
+				continue;
+			}
+			$_each_args[$_part_name] = wp_parse_args( $_part_args, $defaults['each'][$_part_name] );
+		}
+	}
+	$args = wp_parse_args( $args, $defaults );
+	if ( isset( $_each_args ) ) {
+		$args['each'] = $_each_args;
+	}
+
+	$parts = array();
+	if ( is_array( $args['each'] ) && count( $args['each'] ) ) {
+		foreach ( $args['each'] as $_part_name => $_part_args ) {
+			if ( $args['post_id'] && !$_part_args['post_id'] ) {
+				$_part_args['post_id'] = $args['post_id'];
+			}
+			if ( $args['before_each'] && !$_part_args['before'] ) {
+				$_part_args['before'] = $args['before_each'];
+			}
+			if ( $args['after_each'] && !$_part_args['after'] ) {
+				$_part_args['after'] = $args['after_each'];
+			}
+			$_part_function = 'bb_get_post_' . $_part_name . '_link';
+			$parts[$_part_name] = $_part_function( $_part_args );
+		}
+
+		// For the benefit of filters, mark the final part
+		if ( !isset( $args['last_each'] ) ) {
+			$args['last_each'] = $_part_args;
+		}
+	}
+
+	$parts = apply_filters( 'bb_post_admin', $parts, $args );
+
+	if ( !count( $parts ) ) {
+		return;
+	}
+
+	echo $args['before'] . join( '', $parts ) . $args['after'];
+}
+
+function post_ip_link( $args = null )
+{
+	echo bb_get_post_ip_link( $args );
+}
+
+function bb_get_post_ip_link( $args = null )
+{
+	if ( !bb_current_user_can( 'view_by_ip' ) ) {
+		return;
+	}
+
+	$defaults = array(
+		'post_id' => 0,
+		'before' => '',
+		'after' => '',
+		'text' => '%s'
+	);
+	if ( is_numeric( $args ) ) {
+		$args = array( 'post_id' => $args );
+	}
+	$args = wp_parse_args( $args, $defaults );
+
+	$bb_post = bb_get_post( get_post_id( $args['post_id'] ) );
+
+	$uri = bb_get_uri( 'bb-admin/posts.php', array( 'poster_ip' => get_post_ip( $bb_post->post_id ) ), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN );
+
+	// Make sure that the last tag in $before gets a class (if it's there)
+	if ( preg_match( '/.*(<[^>]+>)[^<]*/', $args['before'], $_node ) ) {
+		if ( preg_match( '/class=(\'|")(.*)\1/U', $_node[1], $_class ) ) {
+			$args['before'] = str_replace( $_class[0], 'class=' . $_class[1] . 'before-post-ip-link ' . $_class[2] . $_class[1], $args['before'] );
+		} else {
+			$args['before'] = preg_replace( '/(.*)<([a-z0-9_-]+)(\s?)([^>]*)>([^<]*)/i', '$1<$2 class="before-post-ip-link"$3$4>$5', $args['before'], 1 );
+		}
+	}
+
+	$link = $args['before'] . '<a class="post-ip-link" href="' . esc_attr( $uri ) . '">' . esc_html( sprintf( $args['text'], get_post_ip( $bb_post->post_id ) ) ) . '</a>' . $args['after'];
+	return apply_filters( 'post_ip_link', $link, $bb_post->post_id, $args );
+}
+
+function post_edit_link( $args = null )
+{
+	echo bb_get_post_edit_link( $args );
+}
+
+function bb_get_post_edit_link( $args = null )
+{
+	$defaults = array(
+		'post_id' => 0,
+		'before' => '',
+		'after' => '',
+		'text' => __( 'Edit' )
+	);
+	if ( is_numeric( $args ) ) {
+		$args = array( 'post_id' => $args );
+	}
+	$args = wp_parse_args( $args, $defaults );
+
+	$bb_post = bb_get_post( get_post_id( $args['post_id'] ) );
+
+	if ( bb_current_user_can( 'edit_post', $bb_post->post_id ) ) {
+		$uri = bb_get_uri( 'edit.php', array( 'id' => $bb_post->post_id ) );
+
+		// Make sure that the last tag in $before gets a class (if it's there)
+		if ( preg_match( '/.*(<[^>]+>)[^<]*/', $args['before'], $_node ) ) {
+			if ( preg_match( '/class=(\'|")(.*)\1/U', $_node[1], $_class ) ) {
+				$args['before'] = str_replace( $_class[0], 'class=' . $_class[1] . 'before-post-edit-link ' . $_class[2] . $_class[1], $args['before'] );
+			} else {
+				$args['before'] = preg_replace( '/(.*)<([a-z0-9_-]+)(\s?)([^>]*)>([^<]*)/i', '$1<$2 class="before-post-edit-link"$3$4>$5', $args['before'], 1 );
+			}
+		}
+
+		$r = $args['before'] . '<a class="post-edit-link" href="' . esc_attr( apply_filters( 'post_edit_uri', $uri, $bb_post->post_id, $args ) ) . '">' . esc_html( $args['text'] ) . '</a>' . $args['after'];
+		return apply_filters( 'bb_get_post_edit_link', $r, $bb_post->post_id, $args );
+	}
+}
+
+function post_del_class( $post_id = 0 )
+{
+	$bb_post = bb_get_post( get_post_id( $post_id ) );
+	$classes = array();
+	if ( bb_get_post_meta( 'pingback_uri', $post_id ) ) {
+		$classes[] = 'pingback';
+	}
+	if ( $bb_post->post_status == 1 ) {
+		$classes[] = 'deleted';
+	} elseif ( $bb_post->post_status != 0 ) {
+		$classes[] = 'post-status-' . $bb_post->post_status;
+	}
+	if ( count( $classes ) ) {
+		$classes = join( ' ', $classes );
+	} else {
+		$classes = '';
+	}
+	return apply_filters( 'post_del_class', $classes, $bb_post->post_id, $bb_post );
+}
+
+function post_delete_link( $args = null )
+{
+	echo bb_get_post_delete_link( $args );
+}
+
+function bb_get_post_delete_link( $args = null )
+{
+	$defaults = array(
+		'post_id' => 0,
+		'before' => '',
+		'after' => '',
+		'text' => __( 'Delete' ),
+		'redirect' => true
+	);
+	if ( is_numeric( $args ) || is_object( $args ) ) {
+		$args = array( 'post_id' => $args );
+	}
+	if ( isset( $args['delete_text'] ) && ( !isset( $args['text'] ) || !$args['text'] ) ) {
+		$args['text'] = $args['delete_text'];
+	}
+
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	$bb_post = bb_get_post( get_post_id( $post_id ) );
+	//if ( bb_is_first( $bb_post->post_id ) ) {
+	//	$topic = get_topic( $bb_post->topic_id );
+	//	if ( 2 > $topic->topic_posts ) {
+			// Should delete the whole topic
+	//		return;
+	//	}
+	//}
+	
+	if ( !bb_current_user_can( 'delete_post', $bb_post->post_id ) ) {
+		return;
+	}
+
+	if ( true === $redirect ) {
+		$redirect = $_SERVER['REQUEST_URI'];
+	}
+
+	$uri = bb_get_uri('bb-admin/delete-post.php', array(
+		'id' => $bb_post->post_id,
+		'status' => 1,
+		'_wp_http_referer' => $redirect ? rawurlencode( $redirect ) : false
+	), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN);
+	$uri = esc_url( bb_nonce_url( $uri, 'delete-post_' . $bb_post->post_id ) );
+
+	if ( ( bb_is_admin() || isset( $_GET['view'] ) && 'all' == $_GET['view'] ) ) {
+		$ajax_class = 'dim:thread:post-' . $bb_post->post_id . ':deleted:FF3333:FFFF33:action=delete-post&amp;status=1';
+	} else {
+		$ajax_class = 'delete:thread:post-' . $bb_post->post_id . '::status=1';
+	}
+
+	$text = esc_html( $text );
+
+	// Make sure that the last tag in $before gets a class (if it's there)
+	if ( preg_match( '/.*(<[^>]+>)[^<]*/', $before, $_node ) ) {
+		if ( preg_match( '/class=(\'|")(.*)\1/U', $_node[1], $_class ) ) {
+			$before = str_replace( $_class[0], 'class=' . $_class[1] . 'before-post-delete-link ' . $_class[2] . $_class[1], $before );
+		} else {
+			$before = preg_replace( '/(.*)<([a-z0-9_-]+)(\s?)([^>]*)>([^<]*)/i', '$1<$2 class="before-post-delete-link"$3$4>$5', $before, 1 );
+		}
+	}
+
+	$r = $before . '<a href="' . $uri . '" class="' . $ajax_class . ' post-delete-link">' . $text . '</a>' . $after;
+	$r = apply_filters( 'post_delete_link', $r, $bb_post->post_status, $bb_post->post_id, $args );
+	return $r;
+}
+
+function bb_post_undelete_link( $args = null )
+{
+	echo bb_get_post_undelete_link( $args );
+}
+
+function bb_get_post_undelete_link( $args = null )
+{
+	$defaults = array(
+		'post_id' => 0,
+		'before' => '',
+		'after' => '',
+		'text' => __( 'Undelete' ),
+		'redirect' => true
+	);
+	if ( is_numeric( $args ) || is_object( $args ) ) {
+		$args = array( 'post_id' => $args );
+	}
+
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	$bb_post = bb_get_post( get_post_id( $post_id ) );
+
+	if ( !bb_current_user_can( 'delete_post', $bb_post->post_id ) ) {
+		return;
+	}
+
+	if ( true === $redirect ) {
+		$redirect = $_SERVER['REQUEST_URI'];
+	}
+
+	$uri = bb_get_uri('bb-admin/delete-post.php', array(
+		'id' => $bb_post->post_id,
+		'status' => 0,
+		'view' => 'all',
+		'_wp_http_referer' => $redirect ? rawurlencode( $redirect ) : false
+	), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN);
+	$uri = esc_url( bb_nonce_url( $uri, 'delete-post_' . $bb_post->post_id ) );
+
+	$ajax_class = 'dim:thread:post-' . $bb_post->post_id . ':deleted:FF3333:FFFF33:action=delete-post&amp;status=0';
+
+	$text = esc_html( $text );
+
+	// Make sure that the last tag in $before gets a class (if it's there)
+	if ( preg_match( '/.*(<[^>]+>)[^<]*/', $before, $_node ) ) {
+		if ( preg_match( '/class=(\'|")(.*)\1/U', $_node[1], $_class ) ) {
+			$before = str_replace( $_class[0], 'class=' . $_class[1] . 'before-post-undelete-link ' . $_class[2] . $_class[1], $before );
+		} else {
+			$before = preg_replace( '/(.*)<([a-z0-9_-]+)(\s?)([^>]*)>([^<]*)/i', '$1<$2 class="before-post-undelete-link"$3$4>$5', $before, 1 );
+		}
+	}
+
+	$r = $before . '<a href="' . $uri . '" class="' . $ajax_class . ' post-undelete-link">' . $text . '</a>' . $after;
+	$r = apply_filters( 'post_undelete_link', $r, $bb_post->post_status, $bb_post->post_id, $args );
+	return $r;
+}
+
+function post_author_id( $post_id = 0 ) {
+	echo apply_filters( 'post_author_id', get_post_author_id( $post_id ), get_post_id( $post_id ) );
+}
+
+function get_post_author_id( $post_id = 0 ) {
+	$bb_post = bb_get_post( get_post_id( $post_id ) );
+	return apply_filters( 'get_post_author_id', (int) $bb_post->poster_id, get_post_id( $post_id ) );
+}
+
+function post_author_title( $post_id = 0 ) {
+	echo apply_filters( 'post_author_title', get_post_author_title( $post_id ), get_post_id( $post_id ) );
+}
+
+function get_post_author_title( $post_id = 0 ) {
+	return get_user_title( get_post_author_id( $post_id ) );
+}
+
+function post_author_title_link( $post_id = 0 ) {
+	echo apply_filters( 'post_author_title_link', get_post_author_title_link( $post_id ), get_post_id( $post_id ) );
+}
+
+function get_post_author_title_link( $post_id = 0 ) {
+	$title = get_post_author_title( $post_id );
+	if ( false === $title ) {
+		if ( bb_get_post_meta( 'pingback_uri', $post_id ) )
+			$r = __('PingBack');
+		else
+			$r = __('Unregistered'); // This should never happen
+	} else
+		$r = '<a href="' . esc_attr( get_user_profile_link( get_post_author_id( $post_id ) ) ) . '">' . $title . '</a>';
+
+	return apply_filters( 'get_post_author_title_link', $r, get_post_id( $post_id ) );
+}
+
+function post_author_type( $post_id = 0 ) {
+	$id = get_post_author_id( $post_id );
+	$type = get_user_type( $id );
+	if ( false === $type ) {
+		if ( bb_get_post_meta( 'pingback_uri', $post_id ) )
+			$r = __('PingBack');
+		else
+			$r = __('Unregistered'); // This should never happen
+	} else
+		$r = '<a href="' . esc_attr( get_user_profile_link( $id ) ) . '">' . $type . '</a>';
+
+	echo apply_filters( 'post_author_type', $r, $post_id );
+}
+
+function allowed_markup( $args = '' ) {
+	echo apply_filters( 'allowed_markup', get_allowed_markup( $args ) );
+}
+
+// format=list or array( 'format' => 'list' )
+function get_allowed_markup( $args = '' ) {
+	$args = wp_parse_args( $args, array('format' => 'flat') );
+	extract($args, EXTR_SKIP);
+
+	$tags = bb_allowed_tags();
+	unset($tags['pre'], $tags['br']);
+	$tags = array_keys($tags);
+
+	switch ( $format ) :
+	case 'array' :
+		$r = $tags;
+		break;
+	case 'list' :
+		$r = "<ul class='allowed-markup'>\n\t<li>";
+		$r .= join("</li>\n\t<li>", $tags);
+		$r .= "</li>\n</ul>\n";
+		break;
+	default :
+		$r = join(' ', $tags);
+		break;
+	endswitch;
+	return apply_filters( 'get_allowed_markup', $r, $format );
+}
+
+// USERS
+function bb_get_user_id( $id = 0 ) {
+	global $user;
+	if ( is_object($id) && isset($id->ID) )
+		return (int) $id->ID;
+	elseif ( !$id )
+		return $user->ID;
+
+	$_user = bb_get_user( (int) $id );
+	return isset($_user->ID) ? $_user->ID : 0;
+}
+
+function user_profile_link( $id = 0 , $page = 1, $context = BB_URI_CONTEXT_A_HREF ) {
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF;
+	}
+	echo apply_filters( 'user_profile_link', get_user_profile_link( $id ), bb_get_user_id( $id ), $context );
+}
+
+function get_user_profile_link( $id = 0, $page = 1, $context = BB_URI_CONTEXT_A_HREF ) {
+	$user = bb_get_user( bb_get_user_id( $id ) );
+	
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF;
+	}
+	
+	$rewrite = bb_get_option( 'mod_rewrite' );
+	if ( $rewrite ) {
+		if ( $rewrite === 'slugs' ) {
+			$column = 'user_nicename';
+		} else {
+			$column = 'ID';
+		}
+		$page = (1 < $page) ? '/page/' . $page : '';
+		$r = bb_get_uri('profile/' . $user->$column . $page, null, $context);
+	} else {
+		$query = array(
+			'id' => $user->ID,
+			'page' => (1 < $page) ? $page : false
+		);
+		$r = bb_get_uri('profile.php', $query, $context);
+	}
+	return apply_filters( 'get_user_profile_link', $r, $user->ID, $context );
+}
+
+function user_delete_button() {
+	global $user;
+	if ( bb_current_user_can( 'edit_users' ) && bb_get_current_user_info( 'id' ) != (int) $user->ID )
+		echo apply_filters( 'user_delete_button', get_user_delete_button() );
+}
+
+function get_user_delete_button() {
+	$r  = '<input type="submit" class="delete" name="delete-user" value="' . __('Delete User &raquo;') . '" ';
+	$r .= 'onclick="return confirm(\'' . esc_js(__('Are you sure you want to delete this user?')) . '\')" />';
+	return apply_filters( 'get_user_delete_button', $r);
+}
+
+function profile_tab_link( $id = 0, $tab, $page = 1 ) {
+	echo apply_filters( 'profile_tab_link', get_profile_tab_link( $id, $tab ) );
+}
+
+function get_profile_tab_link( $id = 0, $tab, $page = 1, $context = BB_URI_CONTEXT_A_HREF ) {
+	$user = bb_get_user( bb_get_user_id( $id ) );
+
+	$tab = bb_sanitize_with_dashes($tab);
+
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF;
+	}
+
+	if ( $tab === 'edit' && !( $context & BB_URI_CONTEXT_BB_USER_FORMS ) ) {
+		$context += BB_URI_CONTEXT_BB_USER_FORMS;
+	}
+
+	$rewrite = bb_get_option( 'mod_rewrite' );
+	if ( $rewrite ) {
+		if ( $rewrite === 'slugs' ) {
+			$column = 'user_nicename';
+		} else {
+			$column = 'ID';
+		}
+		$page = (1 < $page) ? '/page/' . $page : '';
+		$r = bb_get_uri('profile/' . $user->$column . '/' . $tab . $page, null, $context);
+	} else {
+		$query = array(
+			'id' => $user->ID,
+			'tab' => $tab,
+			'page' => (1 < $page) ? $page : false
+		);
+		$r = bb_get_uri('profile.php', $query, $context);
+	}
+	return apply_filters( 'get_profile_tab_link', $r, $user->ID, $context );
+}
+
+function user_link( $id = 0 ) {
+	echo apply_filters( 'user_link', get_user_link( $id ), $id );
+}
+
+function get_user_link( $id = 0 ) {
+	if ( $user = bb_get_user( bb_get_user_id( $id ) ) )
+		return apply_filters( 'get_user_link', $user->user_url, $user->ID );
+}
+
+function full_user_link( $id = 0 ) {
+	echo get_full_user_link( $id );
+}
+
+function get_full_user_link( $id = 0 ) {
+	if ( get_user_link( $id ) )
+		$r = '<a href="' . esc_attr( get_user_link( $id ) ) . '">' . get_user_display_name( $id ) . '</a>';
+	else
+		$r = get_user_display_name( $id );
+	return $r;
+}
+
+function user_type_label( $type ) {
+	echo apply_filters( 'user_type_label', get_user_type_label( $type ), $type );
+}
+
+function get_user_type_label( $type ) {
+	global $wp_roles;
+	if ( $wp_roles->is_role( $type ) )
+		return apply_filters( 'get_user_type_label', $wp_roles->role_names[$type], $type );
+}
+
+function user_type( $id = 0 ) {
+	echo apply_filters( 'user_type', get_user_type( $id ), $id );
+}
+
+function get_user_type( $id = 0 ) {
+	if ( $user = bb_get_user( bb_get_user_id( $id ) ) ) :
+		@$caps = array_keys($user->capabilities);
+		if ( !$caps )
+			$caps[] = 'inactive';
+
+		$type = get_user_type_label( $caps[0] ); //Just support one role for now.
+	else :
+		$type = false;
+	endif;
+	return apply_filters( 'get_user_type', $type, $user->ID );
+}
+
+function get_user_name( $id = 0 ) {
+	$user = bb_get_user( bb_get_user_id( $id ) );
+	return apply_filters( 'get_user_name', $user->user_login, $user->ID );
+}
+
+function get_user_display_name( $id = 0 ) {
+	$user = bb_get_user( bb_get_user_id( $id ) );
+	return apply_filters( 'get_user_display_name', $user->display_name, $user->ID );
+}
+
+function user_title( $id = 0 ) {
+	echo apply_filters( 'user_title', get_user_title( $id ), bb_get_user_id( $id ) );
+}
+
+function get_user_title( $id = 0 ) {
+	$user = bb_get_user( bb_get_user_id( $id ) );
+	return empty( $user->title ) ? get_user_type( $id ) : apply_filters( 'get_user_title', $user->title, $user->ID );
+}
+
+function profile_pages( $args = null )
+{
+	$defaults = array( 'before' => '', 'after' => '' );
+	$args = wp_parse_args( $args, $defaults );
+
+	global $page, $user;
+	$add = apply_filters( 'profile_pages_add', $add );
+	if ( $pages = apply_filters( 'profile_pages', get_page_number_links( $page, $user->topics_replied + $add ), $user->user_id ) ) {
+		echo $args['before'] . $pages . $args['after'];
+	}
+}
+
+function bb_profile_data( $id = 0 ) {
+	if ( !$user = bb_get_user( bb_get_user_id( $id ) ) )
+		return;
+
+	$reg_time = bb_gmtstrtotime( $user->user_registered );
+	$profile_info_keys = bb_get_profile_info_keys();
+	echo "<dl id='userinfo'>\n";
+	echo "\t<dt>" . __('Member Since') . "</dt>\n";
+	echo "\t<dd>" . bb_datetime_format_i18n($reg_time, 'date') . ' (' . bb_since($reg_time) . ")</dd>\n";
+	if ( is_array( $profile_info_keys ) ) {
+		foreach ( $profile_info_keys as $key => $label ) {
+			if ( in_array($key, array('first_name', 'last_name', 'display_name')) || !isset($user->$key) )
+				continue;
+			$val = 'user_url' == $key ? get_user_link( $user->ID ) : $user->$key;
+			if (
+				( 'user_email' != $key || ( 'user_email' == $key && bb_current_user_can( 'edit_users' ) ) )
+				&& $val
+				&& 'http://' != $val
+			) {
+				echo "\t<dt>{$label[1]}</dt>\n";
+				$val = make_clickable( $val );
+				$attributes = array();
+				if (isset($label[2]) && !empty($label[2]))
+					if (preg_match("#^<a#i", $val))
+						$val = preg_replace("#^<a#i", '<a class="' . esc_attr($label[2]) . '"', $val);
+					else
+						$val = '<span class="' . esc_attr($label[2]) . '">' . $val . '</span>';
+				
+				echo "\t<dd>" . $val . "</dd>\n";
+			}
+		}
+	}
+	echo "</dl>\n";
+}
+
+function bb_profile_base_content() {
+	global $self;
+	if ( !is_callable( $self ) )
+		return; // should never happen
+	call_user_func( $self );
+}
+
+function bb_profile_data_form( $id = 0 ) {
+	global $errors;
+	if ( !$user = bb_get_user( bb_get_user_id( $id ) ) )
+		return;
+
+	if ( !bb_current_user_can( 'edit_user', $user->ID ) )
+		return;
+
+	$error_codes = $errors->get_error_codes();
+	$profile_info_keys = bb_get_profile_info_keys();
+	$required = false;
+?>
+<table id="userinfo">
+<?php
+	if ( is_array($profile_info_keys) ) :
+		$bb_current_id = bb_get_current_user_info( 'id' );
+		foreach ( $profile_info_keys as $key => $label ) :
+			if ( $label[0] ) {
+				$class = 'form-field form-required required';
+				$required = true;
+			} else {
+				$class = 'form-field';
+			}
+			$title = esc_attr( $label[1] );
+
+			$name = esc_attr( $key );
+			$type = isset($label[2]) ? esc_attr( $label[2] ) : 'text';
+			if ( !in_array( $type, array( 'checkbox', 'file', 'hidden', 'image', 'password', 'radio', 'text' ) ) ) {
+				$type = 'text';
+			}
+
+			$checked = false;
+			if ( in_array( $key, $error_codes ) ) {
+				$class .= ' form-invalid error';
+				$data = $errors->get_error_data( $key );
+				if ( 'checkbox' == $type ) {
+					if ( isset($data['data']) )
+						$checked = $data['data'];
+					else
+						$checked = $_POST[$key];
+					$value = $label[3];
+					$checked = $checked == $value;
+				} else {
+					if ( isset($data['data']) )
+						$value = $data['data'];
+					else
+						$value = $_POST[$key];
+				}
+
+				$message = esc_html( $errors->get_error_message( $key ) );
+				$message = "<em>$message</em>";
+			} else {
+				if ( 'checkbox' == $type ) {
+					$checked = $user->$key == $label[3] || $label[4] == $label[3];
+					$value = $label[3];
+				} else {
+					$value = isset($user->$key) ? $user->$key : '';
+				}
+				$message = '';
+			}
+
+			$checked = $checked ? ' checked="checked"' : '';
+			$value = esc_attr( $value );
+
+?>
+
+<tr class="<?php echo $class; ?>">
+	<th scope="row">
+		<label for="<?php echo $name; ?>"><?php echo $title; ?></label>
+		<?php echo $message; ?>
+	</th>
+	<td>
+<?php
+			if ($key == 'display_name') {
+?>
+		<select name="display_name" id="display_name">
+<?php
+				$public_display = array();
+				$public_display['display_displayname'] = $user->display_name;
+				//$public_display['display_nickname'] = $user->nickname;
+				$public_display['display_username'] = $user->user_login;
+				if ( isset($user->first_name) ) {
+					$public_display['display_firstname'] = $user->first_name;
+					if ( isset($user->last_name) ) {
+						$public_display['display_firstlast'] = $user->first_name.' '.$user->last_name;
+						$public_display['display_lastfirst'] = $user->last_name.' '.$user->first_name;
+					}
+				}
+				if ( isset($user->last_name) )
+					$public_display['display_lastname'] = $user->last_name;
+				
+				$public_display = array_unique(array_filter(array_map('trim', $public_display)));
+				
+				foreach($public_display as $id => $item) {
+?>
+			<option id="<?php echo esc_attr( $id ); ?>" value="<?php echo esc_attr( $item ); ?>"><?php echo esc_html( $item ); ?></option>
+<?php
+				}
+?>
+		</select>
+<?php
+			} else {
+?>
+		<?php if ( 'checkbox' == $type && isset($label[5]) ) echo '<label for="' . $name . '">'; ?>
+		<input name="<?php echo $name; ?>" id="<?php echo $name; ?>" type="<?php echo $type; ?>"<?php echo $checked; ?> value="<?php echo $value; ?>" />
+		<?php if ( 'checkbox' == $type && isset($label[5]) ) echo esc_html( $label[5] ) . '</label>'; ?>
+<?php
+			}
+?>
+	</td>
+</tr>
+
+<?php endforeach; endif; // $profile_info_keys; $profile_info_keys ?>
+
+</table>
+
+<?php bb_nonce_field( 'edit-profile_' . $user->ID ); if ( $required ) : ?>
+
+<p class="required-message"><?php _e('These items are <span class="required">required</span>.') ?></p>
+
+<?php
+	endif;
+	do_action( 'extra_profile_info', $user->ID );
+}
+
+function bb_profile_admin_form( $id = 0 ) {
+	global $wp_roles, $errors;
+	if ( !$user = bb_get_user( bb_get_user_id( $id ) ) )
+		return;
+
+	if ( !bb_current_user_can( 'edit_user', $user->ID ) )
+		return;
+
+	$error_codes = $errors->get_error_codes();
+	$bb_current_id = bb_get_current_user_info( 'id' );
+
+	$profile_admin_keys = bb_get_profile_admin_keys();
+	$assignable_caps = bb_get_assignable_caps();
+	$required = false;
+
+	$roles = $wp_roles->role_names;
+	$can_keep_gate = bb_current_user_can( 'keep_gate' );
+
+	// Keymasters can't demote themselves
+	if ( ( $bb_current_id == $user->ID && $can_keep_gate ) || ( isset( $user->capabilities ) && is_array( $user->capabilities ) && array_key_exists('keymaster', $user->capabilities) && !$can_keep_gate ) ) {
+		$roles = array( 'keymaster' => $roles['keymaster'] );
+	} elseif ( !$can_keep_gate ) { // only keymasters can promote others to keymaster status
+		unset($roles['keymaster']);
+	}
+
+	$selected = array( 'inactive' => ' selected="selected"' );
+?>
+<table id="admininfo">
+<tr class='form-field<?php if ( in_array( 'role', $error_codes ) ) echo ' form-invalid error'; ?>'>
+	<th scope="row">
+		<label for="admininfo_role"><?php _e('User Type'); ?></label>
+		<?php if ( in_array( 'role', $error_codes ) ) echo '<em>' . $errors->get_error_message( 'role' ) . '</em>'; ?>
+	</th>
+	<td>
+		<select id="admininfo_role" name="role">
+<?php
+	foreach( $roles as $r => $n ) {
+		if ( isset( $user->capabilities ) && is_array( $user->capabilities ) && array_key_exists( $r, $user->capabilities ) ) {
+			$selected['inactive'] = '';
+			$selected[$r] = ' selected="selected"';
+		} elseif ( $r !== 'inactive' ) {
+			$selected[$r] = '';
+		}
+?>
+			<option value="<?php echo $r; ?>"<?php echo $selected[$r]; ?>><?php echo $n; ?></option>
+<?php
+	}
+?>
+		</select>
+	</td>
+</tr>
+<?php
+	if (count($assignable_caps)) :
+?>
+<tr class="extra-caps-row">
+	<th scope="row"><?php _e('Allow this user to'); ?></th>
+	<td>
+<?php
+	foreach( $assignable_caps as $cap => $label ) :
+		$name = esc_attr( $cap );
+		$checked = '';
+		if ( isset( $user->capabilities ) && is_array( $user->capabilities ) && array_key_exists( $cap, $user->capabilities ) ) {
+			$checked = ' checked="checked"';
+		}
+		$label = esc_html( $label );
+?>
+
+		<label><input name="<?php echo $name; ?>" value="1" type="checkbox"<?php echo $checked; ?> /> <?php echo $label; ?></label><br />
+
+<?php endforeach; ?>
+
+	</td>
+</tr>
+
+<?php
+	endif;
+	
+	if ( is_array($profile_admin_keys) ) :
+		foreach ( $profile_admin_keys as $key => $label ) :
+			if ( $label[0] ) {
+				$class = 'form-field form-required required';
+				$required = true;
+			} else {
+				$class = 'form-field';
+			}
+			$title = esc_attr( $label[1] );
+
+			$name = esc_attr( $key );
+			$type = isset($label[2]) ? esc_attr( $label[2] ) : 'text';
+
+			$checked = false;
+			if ( in_array( $key, $error_codes ) ) {
+				$class .= ' form-invalid error';
+				$data = $errors->get_error_data( $key );
+				if ( 'checkbox' == $type ) {
+					if ( isset($data['data']) )
+						$checked = $data['data'];
+					else
+						$checked = $_POST[$key];
+					$value = $label[3];
+					$checked = $checked == $value;
+				} else {
+					if ( isset($data['data']) )
+						$value = $data['data'];
+					else
+						$value = $_POST[$key];
+				}
+
+				$message = esc_html( $errors->get_error_message( $key ) );
+				$message = "<em>$message</em>";
+			} else {
+				if ( 'checkbox' == $type ) {
+					$checked = $user->$key == $label[3] || $label[4] == $label[3];
+					$value = $label[3];
+				} else {
+					$value = isset($user->$key) ? $user->$key : '';
+				}
+				$message = '';
+			}
+
+			$checked = $checked ? ' checked="checked"' : '';
+			$value = esc_attr( $value );
+
+?>
+
+<tr class="<?php echo $class; ?>">
+	<th scope="row">
+		<label for="<?php echo $name; ?>"><?php echo $title ?></label>
+		<?php echo $message; ?>
+	</th>
+	<td>
+		<?php if ( 'checkbox' == $type && isset($label[5]) ) echo "<label for='$name'>"; ?>
+		<input name="<?php echo $name; ?>" id="<?php echo $name; ?>" type="<?php echo $type; ?>"<?php echo $checked; ?> value="<?php echo $value; ?>" />
+		<?php if ( 'checkbox' == $type && isset($label[5]) ) echo esc_html( $label[5] ) . "</label>"; ?>
+	</td>
+</tr>
+
+<?php endforeach; endif; // $profile_admin_keys; $profile_admin_keys ?>
+
+</table>
+
+<?php if ( $required ) : ?>
+<p class="required-message"><?php _e('These items are <span class="required">required</span>.') ?></p>
+
+<?php endif; ?>
+<p><?php _e('Inactive users can login and look around but not do anything. Blocked users just see a simple error message when they visit the site.'); ?></p>
+<p><?php _e('<strong>Note</strong>: Blocking a user does <em>not</em> block any IP addresses.'); ?></p>
+<?php
+}
+
+function bb_profile_password_form( $id = 0 ) {
+	global $errors;
+	if ( !$user = bb_get_user( bb_get_user_id( $id ) ) )
+		return;
+
+	if ( !bb_current_user_can( 'change_user_password', $user->ID ) )
+		return;
+
+	$class = 'form-field';
+
+	if ( $message = $errors->get_error_message( 'pass' ) ) {
+		$class .= ' form-invalid error';
+		$message = '<em>' . esc_html( $message ) . '</em>';
+	}
+?>
+
+<table>
+<tr class="<?php echo $class; ?>">
+	<th scope="row" rowspan="2">
+		<label for="pass1"><?php _e('New password'); ?></label>
+		<?php echo $message; ?>
+	</th>
+	<td>
+		<input name="pass1" type="password" id="pass1" autocomplete="off" />
+	</td>
+</tr>
+<tr class="<?php echo $class; ?>">
+	<td>
+		<input name="pass2" type="password" id="pass2" autocomplete="off" />
+	</td>
+</tr>
+<tr class="pass-strength">
+	<th scope="row"><?php _e('Password Strength'); ?></th>
+	<td>
+		<input type="hidden" name="user_login" id="user_login" value="<?php echo $user->user_login; ?>" />
+		<noscript>
+			<?php _e('Disabled (requires JavaScript)'); ?>
+		</noscript>
+		<script type="text/javascript" charset="utf-8">
+			if (typeof jQuery != 'undefined') {
+				document.writeln('<div id="pass-strength-result">' + pwsL10n.short + '</div>');
+			} else {
+				document.writeln('<?php echo str_replace("'", "\'", __('Disabled (requires jQuery)')); ?>')
+			}
+		</script>
+	</td>
+</tr>
+</table>
+
+<p><?php _e('Hint: Use upper and lower case characters, numbers and symbols like !"?$%^&amp;( in your password.'); ?></p>
+
+<?php
+
+}
+
+function bb_logout_link( $args = '' ) {
+	echo apply_filters( 'bb_logout_link', bb_get_logout_link( $args ), $args );
+}
+
+function bb_get_logout_link( $args = '' ) {
+	if ( $args && is_string($args) && false === strpos($args, '=') )
+		$args = array( 'text' => $args );
+
+	$defaults = array('text' => __('Log Out'), 'before' => '', 'after' => '', 'redirect' => '');
+	$args = wp_parse_args( $args, $defaults );
+	extract($args, EXTR_SKIP);
+
+	$query = array( 'logout' => 1 );
+	if ( $redirect ) {
+		$query['re'] = $redirect;
+	}
+
+	$uri = esc_attr( bb_get_uri('bb-login.php', $query, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_USER_FORMS) );
+
+	return apply_filters( 'bb_get_logout_link', $before . '<a href="' . $uri . '">' . $text . '</a>' . $after, $args );
+}
+
+function bb_admin_link( $args = '' ) {
+	if ( !bb_current_user_can( 'moderate' ) )
+		return;
+	echo apply_filters( 'bb_admin_link', bb_get_admin_link( $args ), $args );
+}
+
+function bb_get_admin_link( $args = '' ) {
+	if ( !bb_current_user_can( 'moderate' ) )
+		return;
+	if ( $args && is_string($args) && false === strpos($args, '=') )
+		$args = array( 'text' => $args );
+
+	$defaults = array('text' => __('Admin'), 'before' => '', 'after' => '');
+	$args = wp_parse_args( $args, $defaults );
+	extract($args, EXTR_SKIP);
+
+	$uri = esc_attr( bb_get_uri('bb-admin/', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN) );
+
+	return apply_filters( 'bb_get_admin_link', $before . '<a href="' . $uri . '">' . $text . '</a>' . $after, $args );
+}
+
+function bb_profile_link( $args = '' ) {
+	echo apply_filters( 'bb_profile_link', bb_get_profile_link( $args ), $args );
+}
+
+function bb_get_profile_link( $args = '' ) {
+	if ( $args && is_string($args) && false === strpos($args, '=') )
+		$args = array( 'text' => $args );
+	elseif ( is_numeric($args) )
+		$args = array( 'id' => $args );
+
+	$defaults = array( 'text' => __('View your profile'), 'before' => '', 'after' => '', 'id' => false );
+	$args = wp_parse_args( $args, $defaults );
+	extract($args, EXTR_SKIP);
+
+	$id = (int) $id;
+	if ( !$id )
+		$id = bb_get_current_user_info( 'id' );
+
+	return apply_filters( 'bb_get_profile_link', "$before<a href='" . esc_attr( get_user_profile_link( $id ) ) . "'>$text</a>$after", $args );
+}
+
+function bb_current_user_info( $key = '' ) {
+	if ( !$key )
+		return;
+	echo apply_filters( 'bb_current_user_info', bb_get_current_user_info( $key ), $key );
+}
+	
+
+function bb_get_current_user_info( $key = '' ) {
+	if ( !is_string($key) )
+		return;
+	if ( !$user = bb_get_current_user() ) // Not globalized
+		return false;
+
+	switch ( $key ) :
+	case '' :
+		return $user;
+		break;
+	case 'id' :
+	case 'ID' :
+		return (int) $user->ID;
+		break;
+	case 'name' :
+		return get_user_display_name( $user->ID );
+		break;
+	case 'login' :
+	case 'user_login' :
+		return get_user_name( $user->ID );
+		break;
+	case 'email' :
+	case 'user_email' :
+		return bb_get_user_email( $user->ID );
+		break;
+	case 'url' :
+	case 'uri' :
+	case 'user_url' :
+		return get_user_link( $user->ID );
+		break;
+	endswitch;
+}
+
+function bb_get_user_email( $id ) {
+	if ( !$user = bb_get_user( bb_get_user_id( $id ) ) )
+		return false;
+
+	return apply_filters( 'bb_get_user_email', $user->user_email, $id );
+}
+
+//TAGS
+function topic_tags()
+{
+	global $tags, $tag, $topic_tag_cache, $user_tags, $other_tags, $topic;
+	if ( is_array( $tags ) || bb_current_user_can( 'edit_tag_by_on', bb_get_current_user_info( 'id' ), $topic->topic_id ) ) {
+		bb_load_template( 'topic-tags.php', array('user_tags', 'other_tags', 'public_tags') );
+	}
+}
+
+function bb_tag_page_link()
+{
+	echo bb_get_tag_page_link();
+}
+
+function bb_get_tag_page_link( $context = BB_URI_CONTEXT_A_HREF )
+{
+	if ( bb_get_option( 'mod_rewrite' ) ) {
+		$r = bb_get_uri( 'tags/', null, $context );
+	} else {
+		$r = bb_get_uri( 'tags.php', null, $context );
+	}
+	return apply_filters( 'bb_get_tag_page_link', $r, $context );
+}
+
+function bb_tag_link( $tag_id = 0, $page = 1, $context = BB_URI_CONTEXT_A_HREF )
+{
+	echo apply_filters( 'bb_tag_link', bb_get_tag_link( $tag_id, $page, $context ), $tag_id, $page, $context );
+}
+
+function bb_get_tag_link( $tag_id = 0, $page = 1, $context = BB_URI_CONTEXT_A_HREF )
+{
+	global $tag;
+
+	if ( $tag_id ) {
+		if ( is_object( $tag_id ) ) {
+			$_tag = $tag_id;
+		} else {
+			$_tag = bb_get_tag( $tag_id );
+		}
+	} else {
+		$_tag =& $tag;
+	}
+
+	if ( !is_object( $_tag ) ) {
+		return '';
+	}
+
+	if ( !$context || !is_integer( $context ) ) {
+		$context = BB_URI_CONTEXT_A_HREF;
+	}
+
+	if ( bb_get_option( 'mod_rewrite' ) ) {
+		$page = (1 < $page) ? '/page/' . $page : '';
+		$r = bb_get_uri( 'tags/' . $_tag->tag . $page, null, $context );
+	} else {
+		$query = array(
+			'tag' => $_tag->tag,
+			'page' => ( 1 < $page ) ? $page : false
+		);
+		$r = bb_get_uri( 'tags.php', $query, $context );
+	}
+
+	return apply_filters( 'bb_get_tag_link', $r, $_tag->tag, $page, $context );
+}
+
+function bb_tag_link_base()
+{
+	echo bb_get_tag_link_base();
+}
+
+function bb_get_tag_link_base()
+{
+	return bb_get_tag_page_link() . ( bb_get_option( 'mod_rewrite' ) ? '' : '?tag=' );
+}
+
+function bb_tag_name( $tag_id = 0 )
+{
+	echo esc_html( bb_get_tag_name( $tag_id ) );
+}
+
+function bb_get_tag_name( $tag_id = 0 ) {
+	global $tag;
+
+	if ( $tag_id ) {
+		if ( is_object( $tag_id ) ) {
+			$_tag = $tag_id;
+		} else {
+			$_tag = bb_get_tag( $tag_id );
+		}
+	} else {
+		$_tag =& $tag;
+	}
+
+	if ( !is_object( $_tag ) ) {
+		return '';
+	}
+
+	return $_tag->raw_tag;
+}
+
+function bb_tag_posts_rss_link( $tag_id = 0, $context = 0 )
+{
+	if ( !$context || !is_integer( $context ) ) {
+		$context = BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_FEED;
+	}
+
+	echo apply_filters( 'tag_posts_rss_link', bb_get_tag_posts_rss_link( $tagid, $context ), $tag_id, $context );
+}
+
+function bb_get_tag_posts_rss_link( $tag_id = 0, $context = 0 )
+{
+	global $tag;
+
+	if ( $tag_id ) {
+		if ( is_object( $tag_id ) ) {
+			$_tag = $tag_id;
+		} else {
+			$_tag = bb_get_tag( $tag_id );
+		}
+	} else {
+		$_tag =& $tag;
+	}
+
+	if ( !is_object( $_tag ) ) {
+		return '';
+	}
+
+	if ( !$context || !is_integer( $context ) ) {
+		$context = BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_FEED;
+	}
+
+	if ( bb_get_option( 'mod_rewrite' ) ) {
+		$link = bb_get_uri( 'rss/tags/' . $_tag->tag, null, $context );
+	} else {
+		$link = bb_get_uri( 'rss.php', array( 'tag' => $_tag->tag ), $context );
+	}
+
+	return apply_filters( 'get_tag_posts_rss_link', $link, $tag_id, $context );
+}
+
+function bb_tag_topics_rss_link( $tag_id = 0, $context = 0 )
+{
+	if ( !$context || !is_integer( $context ) ) {
+		$context = BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_FEED;
+	}
+
+	echo apply_filters( 'tag_topics_rss_link', bb_get_tag_topics_rss_link( $tag_id, $context ), $tag_id, $context );
+}
+
+function bb_get_tag_topics_rss_link( $tag_id = 0, $context = 0 )
+{
+	global $tag;
+
+	if ( $tag_id ) {
+		if ( is_object( $tag_id ) ) {
+			$_tag = $tag_id;
+		} else {
+			$_tag = bb_get_tag( $tag_id );
+		}
+	} else {
+		$_tag =& $tag;
+	}
+
+	if ( !is_object( $_tag ) ) {
+		return '';
+	}
+
+	if ( !$context || !is_integer( $context ) ) {
+		$context = BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_FEED;
+	}
+
+	if ( bb_get_option( 'mod_rewrite' ) ) {
+		$link = bb_get_uri( 'rss/tags/' . $_tag->tag . '/topics', null, $context );
+	} else {
+		$link = bb_get_uri( 'rss.php', array('tag' => $_tag->tag, 'topics' => 1 ), $context );
+	}
+
+	return apply_filters( 'get_tag_topics_rss_link', $link, $tag_id, $context );
+}
+
+function bb_list_tags( $args = null )
+{
+	$defaults = array(
+		'tags' => false,
+		'format' => 'list',
+		'topic' => 0,
+		'list_id' => 'tags-list'
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	if ( !$topic = get_topic( get_topic_id( $topic ) ) ) {
+		return false;
+	}
+
+	if ( !is_array( $tags ) ) {
+		$tags = bb_get_topic_tags( $topic->topic_id );
+	}
+
+	if ( !$tags ) {
+		return false;
+	}
+
+	$list_id = esc_attr( $list_id );
+
+	$r = '';
+	switch ( strtolower( $format ) ) {
+		case 'table' :
+			break;
+
+		case 'list' :
+		default :
+			$args['format'] = 'list';
+			$r .= '<ul id="' . $list_id . '" class="tags-list list:tag">' . "\n";
+			foreach ( $tags as $tag ) {
+				$r .= _bb_list_tag_item( $tag, $args );
+			}
+			$r .= '</ul>';
+			break;
+	}
+
+	echo $r;
+}
+
+function _bb_list_tag_item( $tag, $args )
+{
+	$url = esc_url( bb_get_tag_link( $tag ) );
+	$name = esc_html( bb_get_tag_name( $tag ) );
+	if ( 'list' == $args['format'] ) {
+		$id = 'tag-' . $tag->tag_id . '_' . $tag->user_id;
+		return "\t" . '<li id="' . $id . '"' . get_alt_class( 'topic-tags' ) . '><a href="' . $url . '" rel="tag">' . $name . '</a> ' . bb_get_tag_remove_link( array( 'tag' => $tag, 'list_id' => $args['list_id'] ) ) . '</li>' . "\n";
+	}
+}
+	
+function tag_form( $args = null )
+{
+	$defaults = array( 'topic' => 0, 'submit' => __('Add &raquo;'), 'list_id' => 'tags-list' );
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	if ( !$topic = get_topic( get_topic_id( $topic ) ) ) {
+		return false;
+	}
+
+	if ( !bb_current_user_can( 'edit_tag_by_on', bb_get_current_user_info( 'id' ), $topic->topic_id ) ) {
+		return false;
+	}
+
+	global $page;
+?>
+
+<form id="tag-form" method="post" action="<?php bb_uri('tag-add.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>" class="add:<?php echo esc_attr( $list_id ); ?>:">
+	<p>
+		<input name="tag" type="text" id="tag" />
+		<input type="hidden" name="id" value="<?php echo $topic->topic_id; ?>" />
+		<input type="hidden" name="page" value="<?php echo $page; ?>" />
+		<?php bb_nonce_field( 'add-tag_' . $topic->topic_id ); ?>
+		<input type="submit" name="submit" id="tagformsub" value="<?php echo esc_attr( $submit ); ?>" />
+	</p>
+</form>
+
+<?php
+}
+
+function manage_tags_forms()
+{
+	global $tag;
+	if ( !bb_current_user_can( 'manage_tags' ) ) {
+		return false;
+	}
+
+	$form  = '<ul id="manage-tags">' . "\n";
+	$form .= '<li id="tag-rename">' . __('Rename tag:') . "\n\t";
+	$form .= '<form method="post" action="' . bb_get_uri( 'bb-admin/tag-rename.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN ) . '"><div>' . "\n\t";
+	$form .= '<input type="text" name="tag" size="10" maxlength="30" />' . "\n\t";
+	$form .= '<input type="hidden" name="id" value="' . $tag->tag_id . '" />' . "\n\t";
+	$form .= "<input type='submit' name='Submit' value='" . __('Rename') . "' />\n\t";
+	echo $form;
+	bb_nonce_field( 'rename-tag_' . $tag->tag_id );
+	echo "\n\t</div></form>\n  </li>\n ";
+	$form  = "<li id='tag-merge'>" . __('Merge this tag into:') . "\n\t";
+	$form .= "<form method='post' action='" . bb_get_uri('bb-admin/tag-merge.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN) . "'><div>\n\t";
+	$form .= "<input type='text' name='tag' size='10' maxlength='30' />\n\t";
+	$form .= "<input type='hidden' name='id' value='$tag->tag_id' />\n\t";
+	$form .= "<input type='submit' name='Submit' value='" . __('Merge') . "' ";
+	$form .= 'onclick="return confirm(\'' . esc_js( sprintf(__('Are you sure you want to merge the "%s" tag into the tag you specified? This is permanent and cannot be undone.'), $tag->raw_tag) ) . "');\" />\n\t";
+	echo $form;
+	bb_nonce_field( 'merge-tag_' . $tag->tag_id );
+	echo "\n\t</div></form>\n  </li>\n ";
+	$form  = "<li id='tag-destroy'>" . __('Destroy tag:') . "\n\t";
+	$form .= "<form method='post' action='" . bb_get_uri('bb-admin/tag-destroy.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN) . "'><div>\n\t";
+	$form .= "<input type='hidden' name='id' value='$tag->tag_id' />\n\t";
+	$form .= "<input type='submit' name='Submit' value='" . __('Destroy') . "' ";
+	$form .= 'onclick="return confirm(\'' . esc_js( sprintf(__('Are you sure you want to destroy the "%s" tag? This is permanent and cannot be undone.'), $tag->raw_tag) ) . "');\" />\n\t";
+	echo $form;
+	bb_nonce_field( 'destroy-tag_' . $tag->tag_id );
+	echo "\n\t</div></form>\n  </li>\n</ul>";
+}
+
+function bb_tag_remove_link( $args = null ) {
+	echo bb_get_tag_remove_link( $args );
+}
+
+function bb_get_tag_remove_link( $args = null ) {
+	if ( is_scalar($args) || is_object( $args ) )
+		$args = array( 'tag' => $args );
+	$defaults = array( 'tag' => 0, 'topic' => 0, 'list_id' => 'tags-list' );
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	if ( is_object( $tag ) && isset( $tag->tag_id ) ); // [sic]
+	elseif ( !$tag = bb_get_tag( bb_get_tag_id( $tag ) ) )
+		return false;
+	if ( !$topic = get_topic( get_topic_id( $topic ) ) )
+		return false;
+	if ( !bb_current_user_can( 'edit_tag_by_on', $tag->user_id, $topic->topic_id ) )
+		return false;
+	$url = bb_get_uri('tag-remove.php', array('tag' => $tag->tag_id, 'user' => $tag->user_id, 'topic' => $topic->topic_id) );
+	$url = esc_url( bb_nonce_url( $url, 'remove-tag_' . $tag->tag_id . '|' . $topic->topic_id) );
+	$title = esc_attr__( 'Remove this tag' );
+	$list_id = esc_attr( $list_id );
+	return "[<a href='$url' class='delete:$list_id:tag-{$tag->tag_id}_{$tag->user_id}' title='$title'>&times;</a>]";
+}
+
+function bb_tag_heat_map( $args = '' ) {
+	$defaults = array( 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'limit' => 40, 'format' => 'flat' );
+	$args = wp_parse_args( $args, $defaults );
+
+	if ( 1 < $fn = func_num_args() ) : // For back compat
+		$args['smallest'] = func_get_arg(0);
+		$args['largest']  = func_get_arg(1);
+		$args['unit']     = 2 < $fn ? func_get_arg(2) : $unit;
+		$args['limit']    = 3 < $fn ? func_get_arg(3) : $limit;
+	endif;
+
+	extract($args, EXTR_SKIP);
+
+	$tags = bb_get_top_tags( array( 'number' => $limit ) );
+
+	if ( empty($tags) )
+		return;
+
+	$r = bb_get_tag_heat_map( $tags, $args );
+	echo apply_filters( 'tag_heat_map', $r, $args );
+}
+
+function bb_get_tag_heat_map( $tags, $args = '' ) {
+	$defaults = array( 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'limit' => 45, 'format' => 'flat' );
+	$args = wp_parse_args( $args, $defaults );
+	extract($args, EXTR_SKIP);
+
+	if ( !$tags )
+		return;
+
+	foreach ( (array) $tags as $tag ) {
+		$counts{$tag->raw_tag} = $tag->tag_count;
+		$taglinks{$tag->raw_tag} = bb_get_tag_link( $tag );
+	}
+
+	$min_count = min($counts);
+	$spread = max($counts) - $min_count;
+	if ( $spread <= 0 )
+		$spread = 1;
+	$fontspread = $largest - $smallest;
+	if ( $fontspread <= 0 )
+		$fontspread = 1;
+	$fontstep = $fontspread / $spread;
+
+	do_action_ref_array( 'sort_tag_heat_map', array(&$counts) );
+
+	$a = array();
+
+	foreach ( $counts as $tag => $count ) {
+		$taglink = esc_attr($taglinks{$tag});
+		$tag = str_replace(' ', '&nbsp;', esc_html( $tag ));
+		$fontsize = round( $smallest + ( ( $count - $min_count ) * $fontstep ), 1 );
+		$a[] = "<a href='$taglink' title='" . esc_attr( sprintf( __('%d topics'), $count ) ) . "' rel='tag' style='font-size:$fontsize$unit;'>$tag</a>";
+	}
+
+	switch ( $format ) :
+	case 'array' :
+		$r =& $a;
+		break;
+	case 'list' :
+		$r = "<ul class='bb-tag-heat-map'>\n\t<li>";
+		$r .= join("</li>\n\t<li>", $a);
+		$r .= "</li>\n</ul>\n";
+		break;
+	default :
+		$r = join("\n", $a);
+		break;
+	endswitch;
+
+	return apply_filters( 'bb_get_tag_heat_map', $r, $tags, $args );
+}
+
+function bb_sort_tag_heat_map( &$tag_counts ) {
+	uksort($tag_counts, 'strnatcasecmp');
+}
+
+function tag_pages( $args = null )
+{
+	$defaults = array( 'before' => '', 'after' => '' );
+	$args = wp_parse_args( $args, $defaults );
+
+	global $page, $tagged_topic_count;
+	if ( $pages = apply_filters( 'tag_pages', get_page_number_links( $page, $tagged_topic_count ) ) ) {
+		echo $args['before'] . $pages . $args['after'];
+	}
+}
+
+function bb_forum_dropdown( $args = '' ) {
+	if ( $args && is_string($args) && false === strpos($args, '=') )
+		$args = array( 'callback' => $args );
+	if ( 1 < func_num_args() )
+		$args['callback_args'] = func_get_arg(1);
+	echo bb_get_forum_dropdown( $args );
+}
+
+function bb_get_forum_dropdown( $args = '' ) {
+	$defaults = array( 'callback' => false, 'callback_args' => false, 'id' => 'forum_id', 'none' => false, 'selected' => false, 'tab' => false, 'hierarchical' => 1, 'depth' => 0, 'child_of' => 0, 'disable_categories' => 1, 'options_only' => false );
+	if ( $args && is_string($args) && false === strpos($args, '=') )
+		$args = array( 'callback' => $args );
+	if ( 1 < func_num_args() )
+		$args['callback_args'] = func_get_arg(1);
+
+	$args = wp_parse_args( $args, $defaults );
+
+	extract($args, EXTR_SKIP);
+
+	if ( !bb_forums( $args ) )
+		return;
+
+	global $forum_id, $forum;
+	$old_global = $forum;
+
+	$name = esc_attr( $id );
+	$id = str_replace( '_', '-', $name );
+	$tab = (int) $tab;
+
+	if ( $none && 1 == $none )
+		$none = __('- None -');
+
+	$r = '';
+	if ( !$options_only ) {
+		if ( $tab ) {
+			$tab = ' tabindex="' . $tab . '"';
+		} else {
+			$tab = '';
+		}
+		$r .= '<select name="' . $name . '" id="' . $id . '"' . $tab . '">' . "\n";
+	}
+	if ( $none )
+		$r .= "\n" . '<option value="0">' . $none . '</option>' . "\n";
+
+	$no_option_selected = true;
+	$options = array();
+	while ( $depth = bb_forum() ) :
+		global $forum; // Globals + References = Pain
+		$pad_left = str_repeat( '&nbsp;&nbsp;&nbsp;', $depth - 1 );
+		if ( $disable_categories && isset($forum->forum_is_category) && $forum->forum_is_category ) {
+			$options[] = array(
+				'value' => 0,
+				'display' => $pad_left . $forum->forum_name,
+				'disabled' => true,
+				'selected' => false
+			);
+			continue;
+		}
+		$_selected = false;
+		if ( (!$selected && $forum_id == $forum->forum_id) || $selected == $forum->forum_id ) {
+			$_selected = true;
+			$no_option_selected = false;
+		}
+		$options[] = array(
+			'value' => $forum->forum_id,
+			'display' => $pad_left . $forum->forum_name,
+			'disabled' => false,
+			'selected' => $_selected
+		);
+	endwhile;
+
+	if ( 1 === count( $options ) && !$none ) {
+		foreach ( $options as $option_index => $option_value ) {
+			if ( $option_value['disabled'] ) {
+				return;
+			}
+			return '<input type="hidden" name="' . $name . '" id="' . $id . '" value="' . esc_attr( $option_value['value'] ) . '" /><span>' . esc_html( $option_value['display'] ) . '</span>';
+		}
+	}
+
+	foreach ($options as $option_index => $option_value) {
+		if (!$none && !$selected && $no_option_selected && !$option_value['disabled']) {
+			$option_value['selected'] = true;
+			$no_option_selected = false;
+		}
+		$option_disabled = $option_value['disabled'] ? ' disabled="disabled"' : '';
+		$option_selected = $option_value['selected'] ? ' selected="selected"' : '';
+		$r .= "\n" . '<option value="' . esc_attr( $option_value['value'] ) . '"' . $option_disabled . $option_selected . '>' . esc_html( $option_value['display'] ) . '</option>' . "\n";
+	}
+	
+	$forum = $old_global;
+	if ( !$options_only )
+		$r .= '</select>' . "\n";
+
+	return $r;
+}
+
+//FAVORITES
+function favorites_link( $user_id = 0 ) {
+	echo apply_filters( 'favorites_link', get_favorites_link( $user_id ) );
+}
+
+function get_favorites_link( $user_id = 0 ) {
+	if ( !$user_id )
+		$user_id = bb_get_current_user_info( 'id' );
+	return apply_filters( 'get_favorites_link', get_profile_tab_link($user_id, 'favorites'), $user_id );
+}
+
+function user_favorites_link($add = array(), $rem = array(), $user_id = 0) {
+	global $topic, $bb_current_user;
+	if ( empty($add) || !is_array($add) )
+		$add = array('mid' => __('Add this topic to your favorites'), 'post' => __(' (%?%)'));
+	if ( empty($rem) || !is_array($rem) )
+		$rem = array( 'pre' => __('This topic is one of your %favorites% ['), 'mid' => __('&times;'), 'post' => __(']'));
+	if ( $user_id ) :
+		if ( !bb_current_user_can( 'edit_favorites_of', (int) $user_id ) )
+			return false;
+		if ( !$user = bb_get_user( bb_get_user_id( $user_id ) ) ) :
+			return false;
+		endif;
+	else :
+		if ( !bb_current_user_can('edit_favorites') )
+			return false;
+		$user =& $bb_current_user->data;
+	endif;
+
+        $url = esc_url( get_favorites_link( $user_id ) );
+	if ( $is_fav = is_user_favorite( $user->ID, $topic->topic_id ) ) :
+		$rem = preg_replace('|%(.+)%|', "<a href='$url'>$1</a>", $rem);
+		$favs = array('fav' => '0', 'topic_id' => $topic->topic_id);
+		$pre  = ( is_array($rem) && isset($rem['pre'])  ) ? $rem['pre']  : '';
+		$mid  = ( is_array($rem) && isset($rem['mid'])  ) ? $rem['mid']  : ( is_string($rem) ? $rem : '' );
+		$post = ( is_array($rem) && isset($rem['post']) ) ? $rem['post'] : '';
+	elseif ( false === $is_fav ) :
+		$add = preg_replace('|%(.+)%|', "<a href='$url'>$1</a>", $add);
+		$favs = array('fav' => '1', 'topic_id' => $topic->topic_id);
+		$pre  = ( is_array($add) && isset($add['pre'])  ) ? $add['pre']  : '';
+		$mid  = ( is_array($add) && isset($add['mid'])  ) ? $add['mid']  : ( is_string($add) ? $add : '' );
+		$post = ( is_array($add) && isset($add['post']) ) ? $add['post'] : '';
+	endif;
+
+	$url = esc_url(  bb_nonce_url( add_query_arg( $favs, get_favorites_link( $user_id ) ), 'toggle-favorite_' . $topic->topic_id ) );
+
+	if (  !is_null($is_fav) )
+		echo "<span id='favorite-$topic->topic_id'>$pre<a href='$url' class='dim:favorite-toggle:favorite-$topic->topic_id:is-favorite'>$mid</a>$post</span>";
+}
+
+function favorites_rss_link( $id = 0, $context = 0 ) {
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_FEED;
+	}
+	echo apply_filters('favorites_rss_link', get_favorites_rss_link( $id, $context ), $context, $id);
+}
+
+function get_favorites_rss_link( $id = 0, $context = 0 ) {
+	$user = bb_get_user( bb_get_user_id( $id ) );
+	
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_FEED;
+	}
+	
+	$rewrite = bb_get_option( 'mod_rewrite' );
+	if ( $rewrite ) {
+		if ( $rewrite === 'slugs' ) {
+			$column = 'user_nicename';
+		} else {
+			$column = 'ID';
+		}
+		$link = bb_get_uri('rss/profile/' . $user->$column, null, $context);
+	} else {
+		$link = bb_get_uri('rss.php', array('profile' => $user->ID), $context);
+	}
+	return apply_filters( 'get_favorites_rss_link', $link, $user->ID, $context );
+}
+
+function favorites_pages( $args = null )
+{
+	$defaults = array( 'before' => '', 'after' => '' );
+	$args = wp_parse_args( $args, $defaults );
+
+	global $page, $user, $favorites_total;
+	if ( $pages = apply_filters( 'favorites_pages', get_page_number_links( $page, $favorites_total ), $user->user_id ) ) {
+		echo $args['before'] . $pages . $args['after'];
+	}
+}
+
+//VIEWS
+function view_name( $view = '' ) { // Filtration should be done at bb_register_view()
+	echo get_view_name( $view );
+}
+
+function get_view_name( $_view = '' ) {
+	global $view, $bb_views;
+	if ( $_view )
+		$v = bb_slug_sanitize($_view);
+	else
+		$v =& $view;
+
+	if ( isset($bb_views[$v]) )
+		return $bb_views[$v]['title'];
+}
+
+function view_pages() {
+	global $page, $view_count;
+	echo apply_filters( 'view_pages', get_page_number_links( $page, $view_count ) );
+}
+
+function view_link( $_view = false, $page = 1, $context = BB_URI_CONTEXT_A_HREF ) {
+	echo get_view_link( $_view, $page, $context );
+}
+
+function get_view_link( $_view = false, $page = 1, $context = BB_URI_CONTEXT_A_HREF ) {
+	global $view, $bb_views;
+	if ( $_view )
+		$v = bb_slug_sanitize($_view);
+	else
+		$v =& $view;
+	
+	if (!$context || !is_integer($context)) {
+		$context = BB_URI_CONTEXT_A_HREF;
+	}
+	
+	if ( !array_key_exists($v, $bb_views) )
+		return bb_get_uri(null, null, $context);
+	if ( bb_get_option('mod_rewrite') ) {
+		$page = ( 1 < $page ) ? '/page/' . $page : '';
+		$link = bb_get_uri('view/' . $v . $page, null, $context);
+	} else {
+		$query = array(
+			'view' => $v,
+			'page' => ( 1 < $page ) ? $page : false,
+		);
+		$link = bb_get_uri('view.php', $query, $context);
+	}
+
+	return apply_filters( 'get_view_link', $link, $v, $page, $context );
+}
+
+function _bb_parse_time_function_args( $args ) {
+	if ( is_numeric($args) )
+		$args = array('id' => $args);
+	elseif ( $args && is_string($args) && false === strpos($args, '=') )
+		$args = array('format' => $args);
+
+	$defaults = array( 'id' => 0, 'format' => 'since', 'more' => 0, 'localize' => true );
+	return wp_parse_args( $args, $defaults );
+}
+
+function _bb_time_function_return( $time, $args ) {
+	$time = bb_gmtstrtotime( $time );
+
+	switch ( $format = $args['format'] ) :
+	case 'since' :
+		return bb_since( $time, $args['more'] );
+		break;
+	case 'timestamp' :
+		$format = 'U';
+		break;
+	case 'mysql' :
+		$format = 'Y-m-d H:i:s';
+		break;
+	endswitch;
+
+	if ( $args['localize'] ) {
+		return bb_gmdate_i18n( $format, $time );
+	} else {
+		return gmdate( $format, $time );
+	}
+}
+
+function bb_template_scripts() {
+	if ( bb_is_topic() && bb_is_user_logged_in() )
+		wp_enqueue_script( 'topic' );
+	elseif ( bb_is_profile() && bb_is_user_logged_in() ) {
+		global $self;
+		if ($self == 'profile-edit.php') {
+			wp_enqueue_script( 'profile-edit' );
+		}
+	}
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-topic-tags.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-topic-tags.php
new file mode 100644
index 0000000000000000000000000000000000000000..022c02178a2a6cc0daef7435e7ad9df40d35898e
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-topic-tags.php
@@ -0,0 +1,490 @@
+<?php
+
+/* Tags */
+
+/**
+ * bb_add_topic_tag() - Adds a single tag to a topic.
+ *
+ * @param int $topic_id
+ * @param string $tag The (unsanitized) full name of the tag to be added
+ * @return int|bool The TT_ID of the new bb_topic_tag or false on failure
+ */
+function bb_add_topic_tag( $topic_id, $tag ) {
+	$tt_ids = bb_add_topic_tags( $topic_id, $tag );
+	if ( is_array( $tt_ids ) )
+		return $tt_ids[0];
+	return false;
+}
+
+/**
+ * bb_add_topic_tag() - Adds a multiple tags to a topic.
+ *
+ * @param int $topic_id
+ * @param array|string $tags The (unsanitized) full names of the tag to be added.  CSV or array.
+ * @return array|bool The TT_IDs of the new bb_topic_tags or false on failure
+ */
+function bb_add_topic_tags( $topic_id, $tags ) {
+	global $wp_taxonomy_object;
+	$topic_id = (int) $topic_id;
+	if ( !$topic = get_topic( $topic_id ) )
+		return false;
+	if ( !bb_current_user_can( 'add_tag_to', $topic_id ) )
+		return false;
+
+	$user_id = bb_get_current_user_info( 'id' );
+
+	$tags = apply_filters( 'bb_add_topic_tags', $tags, $topic_id );
+
+	if ( !is_array( $tags ) )
+		$tags = explode(',', (string) $tags);
+
+	$tt_ids = $wp_taxonomy_object->set_object_terms( $topic->topic_id, $tags, 'bb_topic_tag', array( 'append' => true, 'user_id' => $user_id ) );
+
+	if ( is_array($tt_ids) ) {
+		global $bbdb;
+		$bbdb->query( $bbdb->prepare(
+			"UPDATE $bbdb->topics SET tag_count = tag_count + %d WHERE topic_id = %d", count( $tt_ids ), $topic->topic_id
+		) );
+		wp_cache_delete( $topic->topic_id, 'bb_topic' );
+		foreach ( $tt_ids as $tt_id )
+			do_action('bb_tag_added', $tt_id, $user_id, $topic_id);
+		return $tt_ids;
+	}
+	return false;
+}
+
+/**
+ * bb_create_tag() - Creates a single bb_topic_tag.
+ *
+ * @param string $tag The (unsanitized) full name of the tag to be created
+ * @return int|bool The TT_ID of the new bb_topic_tags or false on failure
+ */
+function bb_create_tag( $tag ) {
+	global $wp_taxonomy_object;
+
+	if ( list($term_id, $tt_id) = $wp_taxonomy_object->is_term( $tag, 'bb_topic_tag' ) )
+		return $tt_id;
+
+	list($term_id, $tt_id) = $wp_taxonomy_object->insert_term( $tag, 'bb_topic_tag' );
+
+	if ( is_wp_error($term_id) || is_wp_error($tt_id) || !$tt_id )
+		return false;
+
+	return $tt_id;
+}
+
+/**
+ * bb_remove_topic_tag() - Removes a single bb_topic_tag by a user from a topic.
+ *
+ * @param int $tt_id The TT_ID of the bb_topic_tag to be removed
+ * @param int $user_id
+ * @param int $topic_id
+ * @return array|false The TT_IDs of the users bb_topic_tags on that topic or false on failure
+ */
+function bb_remove_topic_tag( $tt_id, $user_id, $topic_id ) {
+	global $wp_taxonomy_object;
+	$tt_id   = (int) $tt_id;
+	$user_id  = (int) $user_id;
+	$topic_id = (int) $topic_id;
+	if ( !$topic = get_topic( $topic_id ) )
+		return false;
+	if ( !bb_current_user_can( 'edit_tag_by_on', $user_id, $topic_id ) )
+		return false;
+
+	$_tag = bb_get_tag( $tt_id );
+
+	do_action('bb_pre_tag_removed', $tt_id, $user_id, $topic_id);
+	$current_tag_ids = $wp_taxonomy_object->get_object_terms( $topic_id, 'bb_topic_tag', array( 'user_id' => $user_id, 'fields' => 'tt_ids' ) );
+	if ( !is_array($current_tag_ids) )
+		return false;
+
+	$current_tag_ids = array_map( 'intval', $current_tag_ids );
+
+	if ( false === $pos = array_search( $tt_id, $current_tag_ids ) )
+		return false;
+
+	unset($current_tag_ids[$pos]);
+
+	$tt_ids = $wp_taxonomy_object->set_object_terms( $topic_id, array_values($current_tag_ids), 'bb_topic_tag', array( 'user_id' => $user_id ) );
+	if ( is_array( $tt_ids ) ) {
+		global $bbdb;
+		$bbdb->query( $bbdb->prepare(
+			"UPDATE $bbdb->topics SET tag_count = %d WHERE topic_id = %d", count( $tt_ids ), $topic_id
+		) );
+		wp_cache_delete( $topic_id, 'bb_topic' );
+
+		// Count is updated at set_object_terms()
+		if ( $_tag && 2 > $_tag->tag_count ) {
+			bb_destroy_tag( $_tag->term_taxonomy_id );
+		}
+	} elseif ( is_wp_error( $tt_ids ) ) {
+		return false;
+	}
+	return $tt_ids;
+}
+
+/**
+ * bb_remove_topic_tag() - Removes all bb_topic_tags from a topic.
+ *
+ * @param int $topic_id
+ * @return bool
+ */
+function bb_remove_topic_tags( $topic_id ) {
+	global $wp_taxonomy_object;
+	$topic_id = (int) $topic_id;
+	if ( !$topic_id || !get_topic( $topic_id ) )
+		return false;
+
+	$_tags = bb_get_topic_tags( $topic_id );
+
+	do_action( 'bb_pre_remove_topic_tags', $topic_id );
+
+	$wp_taxonomy_object->delete_object_term_relationships( $topic_id, 'bb_topic_tag' );
+
+	global $bbdb;
+	$bbdb->query( $bbdb->prepare(
+		"UPDATE $bbdb->topics SET tag_count = 0 WHERE topic_id = %d", $topic_id
+	) );
+	wp_cache_delete( $topic_id, 'bb_topic' );
+
+	if ( $_tags ) {
+		foreach ( $_tags as $_tag ) {
+			// Count is updated at delete_object_term_relationships()
+			if ( 2 > $_tag->tag_count ) {
+				bb_destroy_tag( $_tag->term_taxonomy_id );
+			}
+		}
+	}
+
+	return true;
+}
+
+/**
+ * bb_destroy_tag() - Completely removes a bb_topic_tag.
+ *
+ * @param int $tt_id The TT_ID of the tag to destroy
+ * @return bool
+ */
+function bb_destroy_tag( $tt_id, $recount_topics = true ) {
+	global $wp_taxonomy_object;
+
+	$tt_id = (int) $tt_id;
+
+	if ( !$tag = bb_get_tag( $tt_id ) )
+		return false;
+
+	$topic_ids = bb_get_tagged_topic_ids( $tag->term_id );
+
+	$return = $wp_taxonomy_object->delete_term( $tag->term_id, 'bb_topic_tag' );
+
+	if ( is_wp_error($return) )
+		return false;
+
+	if ( !is_wp_error( $topic_ids ) && is_array( $topic_ids ) ) {
+		global $bbdb;
+		$bbdb->query(
+			"UPDATE $bbdb->topics SET tag_count = tag_count - 1 WHERE topic_id IN (" . join( ',', $topic_ids ) . ")"
+		);
+		foreach ( $topic_ids as $topic_id ) {
+			wp_cache_delete( $topic_id, 'bb_topic' );
+		}
+	}
+
+	return $return;
+}
+
+/**
+ * bb_get_tag_id() - Returns the id of the specified or global tag.
+ *
+ * @param mixed $id The TT_ID, tag name of the desired tag, or 0 for the global tag
+ * @return int 
+ */
+function bb_get_tag_id( $id = 0 ) {
+	global $tag;
+	if ( $id ) {
+		$_tag = bb_get_tag( $id );
+	} else {
+		$_tag =& $tag;
+	}
+	return (int) $_tag->tag_id;
+}
+
+/**
+ * bb_get_tag() - Returns the specified tag.  If $user_id and $topic_id are passed, will check to see if that tag exists on that topic by that user.
+ *
+ * @param mixed $id The TT_ID or tag name of the desired tag
+ * @param int $user_id (optional)
+ * @param int $topic_id (optional)
+ * @return object Term object (back-compat)
+ */
+function bb_get_tag( $id, $user_id = 0, $topic_id = 0 ) {
+	global $wp_taxonomy_object;
+	$user_id  = (int) $user_id;
+	$topic_id = (int) $topic_id;
+
+	$term = false;
+	if ( is_integer( $id ) ) {
+		$tt_id = (int) $id;
+	} else {
+		if ( !$term = $wp_taxonomy_object->get_term_by( 'slug', $id, 'bb_topic_tag' ) )
+			return false;
+		$tt_id = (int) $term->term_taxonomy_id;
+	}
+
+	if ( $user_id && $topic_id ) {
+		$args = array( 'user_id' => $user_id, 'fields' => 'tt_ids' );
+		$cache_id = $topic_id . serialize( $args );
+
+		$tt_ids = wp_cache_get( $cache_id, 'bb_topic_tag_terms' );
+		if ( empty( $tt_ids ) ) {
+			$tt_ids = $wp_taxonomy_object->get_object_terms( $topic_id, 'bb_topic_tag', $args );
+			wp_cache_set( $cache_id, $tt_ids, 'bb_topic_tag_terms' );
+		}
+		if ( !in_array( $tt_id, $tt_ids ) )
+			return false;
+	}
+
+	if ( !$term )
+		$term = $wp_taxonomy_object->get_term_by( 'tt_id', $tt_id, 'bb_topic_tag' );
+
+	_bb_make_tag_compat( $term );
+
+	return $term;
+}
+
+/**
+ * bb_get_topic_tags() - Returns all of the bb_topic_tags associated with the specified topic.
+ *
+ * @param int $topic_id
+ * @param mixed $args
+ * @return array|false Term objects (back-compat), false on failure
+ */
+function bb_get_topic_tags( $topic_id = 0, $args = null ) {
+	global $wp_taxonomy_object;
+
+	if ( !$topic = get_topic( get_topic_id( $topic_id ) ) )
+		return false;
+
+	$topic_id = (int) $topic->topic_id;
+
+	$cache_id = $topic_id . serialize( $args );
+
+	$terms = wp_cache_get( $cache_id, 'bb_topic_tag_terms' );
+	if ( empty( $terms ) ) {
+		$terms = $wp_taxonomy_object->get_object_terms( (int) $topic->topic_id, 'bb_topic_tag', $args );
+		wp_cache_set( $cache_id, $terms, 'bb_topic_tag_terms' );
+	}
+
+	if ( is_wp_error( $terms ) )
+		return false;
+
+	for ( $i = 0; isset($terms[$i]); $i++ )
+		_bb_make_tag_compat( $terms[$i] );
+
+	return $terms;
+}
+
+function bb_get_user_tags( $topic_id, $user_id ) {
+	$tags = bb_get_topic_tags( $topic_id );
+	if ( !is_array( $tags ) )
+		return;
+	$user_tags = array();
+
+	foreach ( $tags as $tag ) :
+		if ( $tag->user_id == $user_id )
+			$user_tags[] = $tag;
+	endforeach;
+	return $user_tags;
+}
+
+function bb_get_other_tags( $topic_id, $user_id ) {
+	$tags = bb_get_topic_tags( $topic_id );
+	if ( !is_array( $tags ) )
+		return;
+	$other_tags = array();
+
+	foreach ( $tags as $tag ) :
+		if ( $tag->user_id != $user_id )
+			$other_tags[] = $tag;
+	endforeach;
+	return $other_tags;
+}
+
+function bb_get_public_tags( $topic_id ) {
+	$tags = bb_get_topic_tags( $topic_id );
+	if ( !is_array( $tags ) )
+		return;
+	$used_tags   = array();
+	$public_tags = array();
+
+	foreach ( $tags as $tag ) :
+		if ( !in_array($tag->tag_id, $used_tags) ) :
+			$public_tags[] = $tag;
+			$used_tags[]   = $tag->tag_id;
+		endif;
+	endforeach;
+	return $public_tags;
+}
+
+function bb_get_tagged_topic_ids( $tag_id ) {
+	global $wp_taxonomy_object, $tagged_topic_count;
+	
+	if ( $topic_ids = (array) $wp_taxonomy_object->get_objects_in_term( $tag_id, 'bb_topic_tag', array( 'field' => 'tt_id' ) ) ) {
+		$tagged_topic_count = count($topic_ids);
+		return apply_filters('get_tagged_topic_ids', $topic_ids);
+	} else {
+		$tagged_topic_count = 0;
+		return false;
+	}
+}
+
+function get_tagged_topics( $args ) {
+	$defaults = array( 'tag_id' => false, 'page' => 1, 'number' => false );
+	if ( is_numeric( $args ) )
+		$args = array( 'tag_id' => $args );
+	else
+		$args = wp_parse_args( $args ); // Make sure it's an array
+	if ( 1 < func_num_args() )
+		$args['page'] = func_get_arg(1);
+	if ( 2 < func_num_args() )
+		$args['number'] = func_get_arg(2);
+
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	$q = array('tag_id' => (int) $tag_id, 'page' => (int) $page, 'per_page' => (int) $number);
+
+	$query = new BB_Query( 'topic', $q, 'get_tagged_topics' );
+	return $query->results;
+}
+
+function get_tagged_topic_posts( $args ) {
+	$defaults = array( 'tag_id' => false, 'page' => 1, 'number' => false );
+	if ( is_numeric( $args ) )
+		$args = array( 'tag_id' => $args );
+	else
+		$args = wp_parse_args( $args ); // Make sure it's an array
+	if ( 1 < func_num_args() )
+		$args['page'] = func_get_arg(1);
+	if ( 2 < func_num_args() )
+		$args['number'] = func_get_arg(2);
+
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	$q = array('tag_id' => (int) $tag_id, 'page' => (int) $page, 'per_page' => (int) $number);
+
+	$query = new BB_Query( 'post', $q, 'get_tagged_topic_posts' );
+	return $query->results;
+}
+
+/**
+ * bb_get_top_tags() - Returns most popular tags.
+ *
+ * @param mixed $args
+ * @return array|false Term objects (back-compat), false on failure
+ */
+function bb_get_top_tags( $args = null ) {
+	global $wp_taxonomy_object;
+
+	$args = wp_parse_args( $args, array( 'number' => 40 ) );
+	$args['order'] = 'DESC';
+	$args['orderby'] = 'count';
+
+	$terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag', $args );
+	if ( is_wp_error( $terms ) )
+		return false;
+
+	for ( $i = 0; isset($terms[$i]); $i++ )
+		_bb_make_tag_compat( $terms[$i] );
+
+	return $terms;
+}
+
+function _bb_make_tag_compat( &$tag ) {
+	if ( is_object($tag) && isset($tag->term_id) ) {
+		$tag->tag_id    =& $tag->term_taxonomy_id;
+		$tag->tag       =& $tag->slug;
+		$tag->raw_tag   =& $tag->name;
+		$tag->tag_count =& $tag->count;
+	} elseif ( is_array($tag) && isset($tag['term_id']) ) {
+		$tag->tag_id    =& $tag['term_taxonomy_id'];
+		$tag->tag       =& $tag['slug'];
+		$tag->raw_tag   =& $tag['name'];
+		$tag->tag_count =& $tag['count'];
+	}
+}
+
+function bb_rename_tag( $tag_id, $tag_name ) {
+	if ( !bb_current_user_can( 'manage_tags' ) ) {
+		return false;
+	}
+
+	$tag_id = (int) $tag_id;
+	$raw_tag = bb_trim_for_db( $tag_name, 50 );
+	$tag_name = tag_sanitize( $tag_name ); 
+
+	if ( empty( $tag_name ) ) {
+		return false;
+	}
+
+	if ( $existing_tag = bb_get_tag( $tag_name ) ) {
+		if ( $existing_tag->term_id !== $tag_id ) {
+			return false;
+		}
+	}
+
+	if ( !$old_tag = bb_get_tag( $tag_id ) ) {
+		return false;
+	}
+
+	global $wp_taxonomy_object;
+	$ret = $wp_taxonomy_object->update_term( $tag_id, 'bb_topic_tag', array( 'name' => $raw_tag, 'slug' => $tag_name ) );
+
+	if ( $ret && !is_wp_error( $ret ) ) {
+		do_action( 'bb_tag_renamed', $tag_id, $old_tag->raw_tag, $raw_tag );
+		return bb_get_tag( $tag_id );
+	}
+	return false;
+}
+
+// merge $old_id into $new_id.
+function bb_merge_tags( $old_id, $new_id ) {
+	if ( !bb_current_user_can( 'manage_tags' ) ) {
+		return false;
+	}
+
+	$old_id = (int) $old_id;
+	$new_id = (int) $new_id;
+
+	if ( $old_id == $new_id ) {
+		return false;
+	}
+
+	do_action( 'bb_pre_merge_tags', $old_id, $new_id );
+
+	// Get all topics tagged with old tag
+	$old_topics = bb_get_tagged_topic_ids( $old_id );
+
+	// Get all toics tagged with new tag
+	$new_topics = bb_get_tagged_topic_ids( $new_id );
+
+	// Get intersection of those topics
+	$both_topics = array_intersect( $old_topics, $new_topics );
+
+	// Discard the intersection from the old tags topics
+	$old_topics = array_diff( $old_topics, $both_topics );
+
+	// Add the remainder of the old tag topics to the new tag
+	if ( count( $old_topics ) ) {
+		$new_tag = bb_get_tag( $new_id );
+		foreach ( $old_topics as $old_topic ) {
+			bb_add_topic_tag( $old_topic, $new_tag->slug );
+		}
+	}
+	
+	// Destroy the old tag
+	$old_tag = bb_destroy_tag( $old_id );
+
+	return array( 'destroyed' => $old_tag, 'old_count' => count( $old_topics ), 'diff_count' => count( $both_topics ) );
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-topics.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-topics.php
new file mode 100644
index 0000000000000000000000000000000000000000..92db5329846e83672c58a463112be179a2f38369
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-topics.php
@@ -0,0 +1,453 @@
+<?php
+
+/* Topics */
+
+function get_topic( $id, $cache = true ) {
+	global $bbdb;
+
+	if ( !is_numeric($id) ) {
+		list($slug, $sql) = bb_get_sql_from_slug( 'topic', $id );
+		$id = wp_cache_get( $slug, 'bb_topic_slug' );
+	}
+
+	// not else
+	if ( is_numeric($id) ) {
+		$id = (int) $id;
+		$sql = "topic_id = $id";
+	}
+
+	if ( 0 === $id || !$sql )
+		return false;
+
+	// &= not =&
+	$cache &= 'AND topic_status = 0' == $where = apply_filters( 'get_topic_where', 'AND topic_status = 0' );
+
+	if ( ( $cache || !$where ) && is_numeric($id) && false !== $topic = wp_cache_get( $id, 'bb_topic' ) )
+		return $topic;
+
+	// $where is NOT bbdb:prepared
+	$topic = $bbdb->get_row( "SELECT * FROM $bbdb->topics WHERE $sql $where" );
+	$topic = bb_append_meta( $topic, 'topic' );
+
+	if ( $cache ) {
+		wp_cache_set( $topic->topic_id, $topic, 'bb_topic' );
+		wp_cache_add( $topic->topic_slug, $topic->topic_id, 'bb_topic_slug' );
+	}
+
+	return $topic;
+}
+
+function bb_get_topic_from_uri( $uri ) {
+	// Extract the topic id or slug of the uri
+	if ( 'topic' === bb_get_path(0, false, $uri) ) {
+		$topic_id_or_slug = bb_get_path(1, false, $uri);
+	} else {
+		if ($parsed_uri = parse_url($uri)) {
+			if (preg_match('@/topic\.php$@'  ,$parsed_uri['path'])) {
+				$args = wp_parse_args($parsed_uri['query']);
+				if (isset($args['id'])) {
+					$topic_id_or_slug = $args['id'];
+				}
+			}
+		}
+	}
+
+	if ( !$topic_id_or_slug )
+		return false;
+
+	return get_topic( $topic_id_or_slug );
+}
+
+function get_latest_topics( $args = null ) {
+	$defaults = array( 'forum' => false, 'page' => 1, 'exclude' => false, 'number' => false );
+	if ( is_numeric( $args ) )
+		$args = array( 'forum' => $args );
+	else
+		$args = wp_parse_args( $args ); // Make sure it's an array
+	if ( 1 < func_num_args() )
+		$args['page'] = func_get_arg(1);
+	if ( 2 < func_num_args() )
+		$args['exclude'] = func_get_arg(2);
+
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	if ( $exclude ) {
+		$exclude = '-' . str_replace(',', '-,', $exclude);
+		$exclude = str_replace('--', '-', $exclude);
+		if ( $forum )
+			$forum = (string) $forum . ",$exclude";
+		else
+			$forum = $exclude;
+	}
+
+	$q = array(
+		'forum_id' => $forum,
+		'page' => $page,
+		'per_page' => $number,
+		'index_hint' => 'USE INDEX (`forum_time`)'
+	);
+
+	if ( bb_is_front() )
+		$q['sticky'] = '-2';
+	elseif ( bb_is_forum() || bb_is_view() )
+		$q['sticky'] = 0;
+
+	// Last param makes filters back compat
+	$query = new BB_Query( 'topic', $q, 'get_latest_topics' );
+	return $query->results;
+}
+
+function get_sticky_topics( $forum = false, $display = 1 ) {
+	if ( 1 != $display ) // Why is this even here?
+		return false;
+
+	$q = array(
+		'forum_id' => $forum,
+		'sticky' => bb_is_front() ? 'super' : 'sticky'
+	);
+
+	$query = new BB_Query( 'topic', $q, 'get_sticky_topics' );
+	return $query->results;
+}
+
+function get_recent_user_threads( $user_id ) {
+	global $page;
+	$q = array( 'page' => $page, 'topic_author_id' => $user_id, 'order_by' => 't.topic_time');
+
+	$query = new BB_Query( 'topic', $q, 'get_recent_user_threads' );
+
+	return $query->results;
+}
+
+function bb_insert_topic( $args = null ) {
+	global $bbdb;
+
+	if ( !$args = wp_parse_args( $args ) )
+		return false;
+
+	$fields = array_keys( $args );
+
+	if ( isset($args['topic_id']) && false !== $args['topic_id'] ) {
+		$update = true;
+		if ( !$topic_id = (int) get_topic_id( $args['topic_id'] ) )
+			return false;
+		// Get from db, not cache.  Good idea?  Prevents trying to update meta_key names in the topic table (get_topic() returns appended topic obj)
+		$topic = $bbdb->get_row( $bbdb->prepare( "SELECT * FROM $bbdb->topics WHERE topic_id = %d", $topic_id ) );
+		$defaults = get_object_vars( $topic );
+		unset($defaults['topic_id']);
+
+		// Only update the args we passed
+		$fields = array_intersect( $fields, array_keys($defaults) );
+		if ( in_array( 'topic_poster', $fields ) )
+			$fields[] = 'topic_poster_name';
+		if ( in_array( 'topic_last_poster', $fields ) )
+			$fields[] = 'topic_last_poster_name';
+	} else {
+		$topic_id = false;
+		$update = false;
+
+		$now = bb_current_time('mysql');
+		$current_user_id = bb_get_current_user_info( 'id' );
+
+		$defaults = array(
+			'topic_title' => '',
+			'topic_slug' => '',
+			'topic_poster' => $current_user_id, // accepts ids
+			'topic_poster_name' => '', // accept names
+			'topic_last_poster' => $current_user_id, // accepts ids
+			'topic_last_poster_name' => '', // accept names
+			'topic_start_time' => $now,
+			'topic_time' => $now,
+			'topic_open' => 1,
+			'forum_id' => 0 // accepts ids or slugs
+		);
+
+		// Insert all args
+		$fields = array_keys($defaults);
+	}
+
+	$defaults['tags'] = false; // accepts array or comma delimited string
+	extract( wp_parse_args( $args, $defaults ) );
+	unset($defaults['tags']);
+
+	if ( !$forum = bb_get_forum( $forum_id ) )
+		return false;
+	$forum_id = (int) $forum->forum_id;
+
+	if ( !$user = bb_get_user( $topic_poster ) )
+		if ( !$user = bb_get_user( $topic_poster_name, array( 'by' => 'login' ) ) )
+			return false;
+	$topic_poster = $user->ID;
+	$topic_poster_name = $user->user_login;
+
+	if ( !$last_user = bb_get_user( $topic_last_poster ) )
+		if ( !$last_user = bb_get_user( $topic_last_poster_name, array( 'by' => 'login' ) ) )
+			return false;
+	$topic_last_poster = $last_user->ID;
+	$topic_last_poster_name = $last_user->user_login;
+
+	if ( in_array( 'topic_title', $fields ) ) {
+		$topic_title = apply_filters( 'pre_topic_title', $topic_title, $topic_id );
+		if ( strlen($topic_title) < 1 )
+			return false;
+	}
+
+	if ( in_array( 'topic_slug', $fields ) ) {
+		$slug_sql = $update ?
+			"SELECT topic_slug FROM $bbdb->topics WHERE topic_slug = %s AND topic_id != %d" :
+			"SELECT topic_slug FROM $bbdb->topics WHERE topic_slug = %s";
+
+		$topic_slug = $_topic_slug = bb_slug_sanitize( $topic_slug ? $topic_slug : wp_specialchars_decode( $topic_title, ENT_QUOTES ) );
+		if ( strlen( $_topic_slug ) < 1 )
+			$topic_slug = $_topic_slug = '0';
+
+		while ( is_numeric($topic_slug) || $existing_slug = $bbdb->get_var( $bbdb->prepare( $slug_sql, $topic_slug, $topic_id ) ) )
+			$topic_slug = bb_slug_increment( $_topic_slug, $existing_slug );
+	}
+
+	if ( $update ) {
+		$bbdb->update( $bbdb->topics, compact( $fields ), compact( 'topic_id' ) );
+		wp_cache_delete( $topic_id, 'bb_topic' );
+		if ( in_array( 'topic_slug', $fields ) )
+			wp_cache_delete( $topic->topic_slug, 'bb_topic_slug' );
+		wp_cache_flush( 'bb_query' );
+		wp_cache_flush( 'bb_cache_posts_post_ids' );
+		do_action( 'bb_update_topic', $topic_id );
+	} else {
+		$bbdb->insert( $bbdb->topics, compact( $fields ) );
+		$topic_id = $bbdb->insert_id;
+		$bbdb->query( $bbdb->prepare( "UPDATE $bbdb->forums SET topics = topics + 1 WHERE forum_id = %d", $forum_id ) );
+		wp_cache_delete( $forum_id, 'bb_forum' );
+		wp_cache_flush( 'bb_forums' );
+		wp_cache_flush( 'bb_query' );
+		wp_cache_flush( 'bb_cache_posts_post_ids' );
+		do_action( 'bb_new_topic', $topic_id );
+	}
+
+	if ( !empty( $tags ) )
+		bb_add_topic_tags( $topic_id, $tags );
+
+	do_action( 'bb_insert_topic', $topic_id, $args, compact( array_keys($args) ) ); // topic_id, what was passed, what was used
+
+	return $topic_id;
+}
+
+// Deprecated: expects $title to be pre-escaped
+function bb_new_topic( $title, $forum, $tags = '' ) {
+	$title = stripslashes( $title );
+	$tags  = stripslashes( $tags );
+	$forum = (int) $forum;
+	return bb_insert_topic( array( 'topic_title' => $title, 'forum_id' => $forum, 'tags' => $tags ) );
+}
+
+// Deprecated: expects $title to be pre-escaped
+function bb_update_topic( $title, $topic_id ) {
+	$title = stripslashes( $title );
+	return bb_insert_topic( array( 'topic_title' => $title, 'topic_id' => $topic_id ) );
+}
+
+function bb_delete_topic( $topic_id, $new_status = 0 ) {
+	global $bbdb;
+	$topic_id = (int) $topic_id;
+	add_filter( 'get_topic_where', 'bb_no_where' );
+	if ( $topic = get_topic( $topic_id ) ) {
+		$new_status = (int) $new_status;
+		$old_status = (int) $topic->topic_status;
+		if ( $new_status == $old_status )
+			return;
+
+		if ( 0 != $old_status && 0 == $new_status )
+			add_filter('get_thread_where', 'bb_no_where');
+		$poster_ids = array();
+		$posts = get_thread( $topic_id, array( 'per_page' => -1, 'order' => 'DESC' ) );
+		if ( $posts && count( $posts ) ) {
+			foreach ( $posts as $post ) {
+				_bb_delete_post( $post->post_id, $new_status );
+				$poster_ids[] = $post->poster_id;
+			}
+		}
+		if ( 0 != $old_status && 0 == $new_status )
+			remove_filter('get_thread_where', 'bb_no_where');
+
+		if ( count( $poster_ids ) )
+			foreach ( array_unique( $poster_ids ) as $id )
+				if ( $user = bb_get_user( $id ) )
+					bb_update_usermeta( $user->ID, $bbdb->prefix . 'topics_replied', ( $old_status ? $user->topics_replied + 1 : $user->topics_replied - 1 ) );
+
+		if ( $ids = $bbdb->get_col( "SELECT user_id, meta_value FROM $bbdb->usermeta WHERE meta_key = 'favorites' and FIND_IN_SET('$topic_id', meta_value) > 0" ) )
+			foreach ( $ids as $id )
+				bb_remove_user_favorite( $id, $topic_id );
+
+		switch ( $new_status ) {
+			case 0: // Undeleting
+				$bbdb->update( $bbdb->topics, array( 'topic_status' => $new_status ), compact( 'topic_id' ) );
+				$topic_posts = (int) $bbdb->get_var( $bbdb->prepare(
+					"SELECT COUNT(*) FROM $bbdb->posts WHERE topic_id = %d AND post_status = 0", $topic_id
+				) );
+				$all_posts = (int) $bbdb->get_var( $bbdb->prepare(
+					"SELECT COUNT(*) FROM $bbdb->posts WHERE topic_id = %d", $topic_id
+				) );
+				bb_update_topicmeta( $topic_id, 'deleted_posts', $all_posts - $topic_posts );
+				$bbdb->query( $bbdb->prepare(
+					"UPDATE $bbdb->forums SET topics = topics + 1, posts = posts + %d WHERE forum_id = %d", $topic_posts, $topic->forum_id
+				) );
+				$bbdb->update( $bbdb->topics, compact( 'topic_posts' ), compact( 'topic_id' ) );
+				bb_topic_set_last_post( $topic_id );
+				bb_update_post_positions( $topic_id );
+				break;
+
+			default: // Other statuses (like Delete and Bozo)
+				bb_remove_topic_tags( $topic_id );
+				$bbdb->update( $bbdb->topics, array( 'topic_status' => $new_status, 'tag_count' => 0 ), compact( 'topic_id' ) );
+				$bbdb->query( $bbdb->prepare(
+					"UPDATE $bbdb->forums SET topics = topics - 1, posts = posts - %d WHERE forum_id = %d", $topic->topic_posts, $topic->forum_id
+				) );
+				break;
+		}
+
+		do_action( 'bb_delete_topic', $topic_id, $new_status, $old_status );
+		wp_cache_delete( $topic_id, 'bb_topic' );
+		wp_cache_delete( $topic->topic_slug, 'bb_topic_slug' );
+		wp_cache_delete( $topic_id, 'bb_thread' );
+		wp_cache_delete( $topic->forum_id, 'bb_forum' );
+		wp_cache_flush( 'bb_forums' );
+		wp_cache_flush( 'bb_query' );
+		wp_cache_flush( 'bb_cache_posts_post_ids' );
+		return $topic_id;
+	} else {
+		return false;
+	}
+}
+
+function bb_move_topic( $topic_id, $forum_id ) {
+	global $bbdb;
+	$topic = get_topic( $topic_id );
+	$forum = bb_get_forum( $forum_id );
+	$topic_id = (int) $topic->topic_id;
+	$forum_id = (int) $forum->forum_id;
+
+	if ( $topic && $forum && $topic->forum_id != $forum_id ) {
+		$bbdb->update( $bbdb->posts, compact( 'forum_id' ), compact( 'topic_id' ) );
+		$bbdb->update( $bbdb->topics, compact( 'forum_id' ), compact( 'topic_id' ) );
+		$bbdb->query( $bbdb->prepare(
+			"UPDATE $bbdb->forums SET topics = topics + 1, posts = posts + %d WHERE forum_id = %d", $topic->topic_posts, $forum_id
+		) );
+		$bbdb->query( $bbdb->prepare( 
+			"UPDATE $bbdb->forums SET topics = topics - 1, posts = posts - %d WHERE forum_id = %d", $topic->topic_posts, $topic->forum_id
+		) );
+		wp_cache_flush( 'bb_post' );
+		wp_cache_delete( $topic_id, 'bb_topic' );
+		wp_cache_delete( $forum_id, 'bb_forum' );
+		wp_cache_flush( 'bb_forums' );
+		wp_cache_flush( 'bb_query' );
+		wp_cache_flush( 'bb_cache_posts_post_ids' );
+
+		do_action( 'bb_move_topic', $topic_id, $forum_id, $topic->forum_id );
+
+		return $forum_id;
+	}
+	return false;
+}
+
+function bb_topic_set_last_post( $topic_id ) {
+	global $bbdb;
+	$topic_id = (int) $topic_id;
+	$old_post = $bbdb->get_row( $bbdb->prepare(
+		"SELECT post_id, poster_id, post_time FROM $bbdb->posts WHERE topic_id = %d AND post_status = 0 ORDER BY post_time DESC LIMIT 1", $topic_id
+	) );
+	$old_poster = bb_get_user( $old_post->poster_id );
+	wp_cache_delete( $topic_id, 'bb_topic' );
+	return $bbdb->update( $bbdb->topics, array( 'topic_time' => $old_post->post_time, 'topic_last_poster' => $old_post->poster_id, 'topic_last_poster_name' => $old_poster->login_name, 'topic_last_post_id' => $old_post->post_id ), compact( 'topic_id' ) );
+}
+
+function bb_close_topic( $topic_id ) {
+	global $bbdb;
+	$topic_id = (int) $topic_id;
+	wp_cache_delete( $topic_id, 'bb_topic' );
+	$r = $bbdb->update( $bbdb->topics, array( 'topic_open' => 0 ), compact( 'topic_id' ) );
+	do_action('close_topic', $topic_id, $r);
+	return $r;
+}
+
+function bb_open_topic( $topic_id ) {
+	global $bbdb;
+	$topic_id = (int) $topic_id;
+	wp_cache_delete( $topic_id, 'bb_topic' );
+	$r = $bbdb->update( $bbdb->topics, array( 'topic_open' => 1 ), compact( 'topic_id' ) );
+	do_action('open_topic', $topic_id, $r);
+	return $r;
+}
+
+function bb_stick_topic( $topic_id, $super = 0 ) {
+	global $bbdb;
+	$topic_id = (int) $topic_id;
+	$stick = 1 + abs((int) $super);
+	wp_cache_delete( $topic_id, 'bb_topic' );
+	$r = $bbdb->update( $bbdb->topics, array( 'topic_sticky' => $stick ), compact( 'topic_id' ) );
+	do_action('stick_topic', $topic_id, $r);
+	return $r;
+}
+
+function bb_unstick_topic( $topic_id ) {
+	global $bbdb;
+	$topic_id = (int) $topic_id;
+	wp_cache_delete( $topic_id, 'bb_topic' );
+	$r = $bbdb->update( $bbdb->topics, array( 'topic_sticky' => 0 ), compact( 'topic_id' ) );
+	do_action('unstick_topic', $topic_id, $r);
+	return $r;
+}
+
+function topic_is_open( $topic_id = 0 ) {
+	$topic = get_topic( get_topic_id( $topic_id ) );
+	return 1 == $topic->topic_open;
+}
+
+function topic_is_sticky( $topic_id = 0 ) {
+	$topic = get_topic( get_topic_id( $topic_id ) );
+	return '0' !== $topic->topic_sticky;
+}
+
+function bb_update_topic_voices( $topic_id )
+{
+	if ( !$topic_id ) {
+		return;
+	}
+
+	$topic_id = abs( (int) $topic_id );
+
+	global $bbdb;
+	if ( $voices = $bbdb->get_col( $bbdb->prepare( "SELECT DISTINCT poster_id FROM $bbdb->posts WHERE topic_id = %s AND post_status = '0';", $topic_id ) ) ) {
+		$voices = count( $voices );
+		bb_update_topicmeta( $topic_id, 'voices_count', $voices );
+	}
+}
+
+/* Thread */
+
+// Thread, topic?  Guh-wah?
+// A topic is the container, the thread is it's contents (the posts)
+
+function get_thread( $topic_id, $args = null ) {
+	$defaults = array( 'page' => 1, 'order' => 'ASC' );
+	if ( is_numeric( $args ) )
+		$args = array( 'page' => $args );
+	if ( @func_get_arg(2) )
+		$defaults['order'] = 'DESC';
+
+	$args = wp_parse_args( $args, $defaults );
+	$args['topic_id'] = $topic_id;
+
+	$query = new BB_Query( 'post', $args, 'get_thread' );
+	return $query->results;
+}
+
+// deprecated
+function get_thread_post_ids( $topic_id ) {
+	$return = array( 'post' => array(), 'poster' => array() );
+	foreach ( get_thread( $topic_id, array( 'per_page' => -1 ) ) as $post ) {
+		$return['post'][] = $post->post_id;
+		$return['poster'][] = $post->poster_id;
+	}
+	return $return;
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-users.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-users.php
new file mode 100644
index 0000000000000000000000000000000000000000..cab6e52bd43175f8e5838a2e740302262e35f3fd
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-users.php
@@ -0,0 +1,440 @@
+<?php
+
+/* Users */
+
+function bb_block_current_user() {
+	global $bbdb;
+	if ( $id = bb_get_current_user_info( 'id' ) )
+		bb_update_usermeta( $id, $bbdb->prefix . 'been_blocked', 1 ); // Just for logging.
+	bb_die(__("You've been blocked.  If you think a mistake has been made, contact this site's administrator."));
+}
+
+function bb_get_user( $user_id, $args = null ) {
+	global $wp_users_object;
+	$user = $wp_users_object->get_user( $user_id, $args );
+	if ( is_wp_error($user) )
+		return false;
+	return $user;
+}
+
+function bb_cache_users( $ids ) {
+	global $wp_users_object;
+	$wp_users_object->get_user( $ids );
+}
+
+function bb_get_user_by_nicename( $nicename ) {
+	global $wp_users_object;
+	$user = $wp_users_object->get_user( $nicename, array( 'by' => 'nicename' ) );
+	if ( is_wp_error($user) )
+		return false;
+	return $user;
+}
+
+function bb_delete_user( $user_id, $reassign = 0 ) {
+	global $wp_users_object, $bbdb;
+
+	if ( !$user = bb_get_user( $user_id ) )
+		return false;
+
+	if ( $reassign ) {
+		if ( !$new_user = bb_get_user( $reassign ) )
+			return false;
+		$bbdb->update( $bbdb->posts, array( 'poster_id' => $new_user->ID ), array( 'poster_id' => $user->ID ) );
+		$bbdb->update( $bbdb->term_relationships, array( 'user_id' => $new_user->ID ), array( 'user_id' => $user->ID ) );
+		$bbdb->update( $bbdb->topics, array( 'topic_poster' => $new_user->ID, 'topic_poster_name' => $new_user->user_login), array( 'topic_poster' => $user->ID ) );
+		$bbdb->update( $bbdb->topics, array( 'topic_last_poster' => $new_user->ID, 'topic_last_poster_name' => $new_user->user_login ), array( 'topic_last_poster' => $user->ID ) );
+		bb_update_topics_replied( $new_user->ID );
+		wp_cache_flush( 'bb_post' );
+		wp_cache_flush( 'bb_thread' );
+		wp_cache_flush( 'bb_topic_tag' );
+		wp_cache_flush( 'bb_topic' );
+	}
+
+	do_action( 'bb_delete_user', $user->ID, $reassign );
+
+	$wp_users_object->delete_user( $user->ID );
+
+	return true;
+}
+
+function bb_update_topics_replied( $user_id ) {
+	global $bbdb;
+
+	$user_id = (int) $user_id;
+
+	if ( !$user = bb_get_user( $user_id ) )
+		return false;
+
+	$topics_replied = (int) $bbdb->get_var( $bbdb->prepare( "SELECT COUNT(DISTINCT topic_id) FROM $bbdb->posts WHERE post_status = '0' AND poster_id = %d", $user_id ) );
+	return bb_update_usermeta( $user_id, $bbdb->prefix . 'topics_replied', $topics_replied );
+}
+
+function bb_update_user_status( $user_id, $user_status = 0 ) {
+	global $wp_users_object;
+	$user = bb_get_user( $user_id );
+	$user_status = (int) $user_status;
+	$wp_users_object->update_user( $user->ID, compact( 'user_status' ) );
+}
+
+function bb_trusted_roles() {
+	return apply_filters( 'bb_trusted_roles', array('moderator', 'administrator', 'keymaster') );
+}
+
+function bb_is_trusted_user( $user ) { // ID, user_login, WP_User, DB user obj
+	if ( is_numeric($user) || is_string($user) )
+		$user = new BP_User( $user );
+	elseif ( is_object($user) && is_a($user, 'BP_User') ); // Intentional
+	elseif ( is_object($user) && isset($user->ID) && isset($user->user_login) ) // Make sure it's actually a user object
+		$user = new BP_User( $user->ID );
+	else
+		return;
+
+	if ( !$user->ID )
+		return;
+
+	return apply_filters( 'bb_is_trusted_user', (bool) array_intersect(bb_trusted_roles(), $user->roles), $user->ID );
+}
+
+function bb_apply_wp_role_map_to_user( $user, $reload = true ) {
+	// Expects only user ids
+	if ( !is_numeric( $user ) ) {
+		return;
+	}
+
+	$user = (int) $user;
+
+	if ( !$wordpress_table_prefix = bb_get_option('wp_table_prefix') ) {
+		return;
+	}
+
+	if ( $wordpress_mu_primary_blog_id = bb_get_option( 'wordpress_mu_primary_blog_id' ) ) {
+		$wordpress_table_prefix .= $wordpress_mu_primary_blog_id . '_';
+	}
+
+	if ( !$wordpress_roles_map = bb_get_option( 'wp_roles_map' ) ) {
+		return;
+	}
+
+	global $bbdb;
+	global $wp_roles;
+	global $bb;
+
+	static $bbpress_roles_map = false;
+
+	if ( !$bbpress_roles_map ) {
+		$bbpress_roles_map = array();
+		foreach ( $wp_roles->get_names() as $_bbpress_role => $_bbpress_rolename ) {
+			$bbpress_roles_map[$_bbpress_role] = 'subscriber';
+		}
+		unset( $_bbpress_role, $_bbpress_rolename );
+		$bbpress_roles_map = array_merge( $bbpress_roles_map, array_flip( $wordpress_roles_map ) );
+		unset( $bbpress_roles_map['inactive'], $bbpress_roles_map['blocked'] );
+	}
+
+	static $wordpress_userlevel_map = array(
+		'administrator' => 10,
+		'editor' => 7,
+		'author' => 2,
+		'contributor' => 1,
+		'subscriber' => 0
+	);
+
+	$bbpress_roles = bb_get_usermeta( $user, $bbdb->prefix . 'capabilities' );
+	$wordpress_roles = bb_get_usermeta( $user, $wordpress_table_prefix . 'capabilities' );
+
+	if ( !$bbpress_roles && is_array( $wordpress_roles ) ) {
+		$bbpress_roles_new = array();
+
+		foreach ( $wordpress_roles as $wordpress_role => $wordpress_role_value ) {
+			if ( $wordpress_roles_map[strtolower( $wordpress_role )] && $wordpress_role_value ) {
+				$bbpress_roles_new[$wordpress_roles_map[strtolower( $wordpress_role )]] = true;
+			}
+		}
+
+		if ( count( $bbpress_roles_new ) ) {
+			bb_update_usermeta( $user, $bbdb->prefix . 'capabilities', $bbpress_roles_new );
+			if ( $reload ) {
+				header( 'Location: ' . bb_get_uri( null, null, BB_URI_CONTEXT_HEADER ) );
+				exit;
+			}
+		}
+	} elseif ( !$wordpress_roles && is_array( $bbpress_roles ) ) {
+		$wordpress_roles_new = array();
+
+		foreach ( $bbpress_roles as $bbpress_role => $bbpress_role_value ) {
+			if ( $bbpress_roles_map[strtolower( $bbpress_role )] && $bbpress_role_value ) {
+				$wordpress_roles_new[$bbpress_roles_map[strtolower( $bbpress_role )]] = true;
+				$wordpress_userlevels_new[] = $wordpress_userlevel_map[$bbpress_roles_map[strtolower( $bbpress_role )]];
+			}
+		}
+
+		if ( count( $wordpress_roles_new ) ) {
+			bb_update_usermeta( $user, $wordpress_table_prefix . 'capabilities', $wordpress_roles_new );
+			bb_update_usermeta( $user, $wordpress_table_prefix . 'user_level', max( $wordpress_userlevels_new ) );
+		}
+	}
+}
+
+function bb_apply_wp_role_map_to_orphans() {
+	if ( !$wordpress_table_prefix = bb_get_option('wp_table_prefix') ) {
+		return;
+	}
+
+	if ( $wordpress_mu_primary_blog_id = bb_get_option( 'wordpress_mu_primary_blog_id' ) ) {
+		$wordpress_table_prefix .= $wordpress_mu_primary_blog_id . '_';
+	}
+
+	$role_query = <<<EOQ
+		SELECT
+			ID
+		FROM
+			`%1\$s`
+		LEFT JOIN `%2\$s` AS bbrole
+			ON ID = bbrole.user_id
+			AND bbrole.meta_key = '%3\$scapabilities'
+		LEFT JOIN `%2\$s` AS wprole
+			ON ID = wprole.user_id
+			AND wprole.meta_key = '%4\$scapabilities'
+		WHERE
+			bbrole.meta_key IS NULL OR
+			bbrole.meta_value IS NULL OR
+			wprole.meta_key IS NULL OR
+			wprole.meta_value IS NULL
+		ORDER BY
+			ID
+EOQ;
+
+	global $bbdb;
+
+	$role_query = $bbdb->prepare( $role_query, $bbdb->users, $bbdb->usermeta, $bbdb->prefix, $wordpress_table_prefix );
+
+	if ( $user_ids = $bbdb->get_col( $role_query ) ) {
+		foreach ( $user_ids as $user_id ) {
+			bb_apply_wp_role_map_to_user( $user_id, false );
+		}
+	}
+}
+
+/**
+ * Updates a user's details in the database
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since 0.7.2
+ * @global bbdb $bbdb
+ *
+ * @param int $user_id
+ * @param string $user_email
+ * @param string $user_url
+ * @return int
+ */
+function bb_update_user( $user_id, $user_email, $user_url, $display_name ) {
+	global $wp_users_object;
+
+	$user_id = (int) $user_id;
+	$user_url = bb_fix_link( $user_url );
+
+	$wp_users_object->update_user( $user_id, compact( 'user_email', 'user_url', 'display_name' ) );
+
+	do_action('bb_update_user', $user_id);
+	return $user_id;
+}
+
+/**
+ * Sends a reset password email
+ *
+ * Sends an email to the email address specified in the user's profile
+ * prompting them to change their password.
+ *
+ * @since 0.7.2
+ * @global bbdb $bbdb
+ *
+ * @param string $user_login
+ * @return bool
+ */
+function bb_reset_email( $user_login ) {
+	global $bbdb;
+
+	$user_login = sanitize_user( $user_login, true );
+
+	if ( !$user = $bbdb->get_row( $bbdb->prepare( "SELECT * FROM $bbdb->users WHERE user_login = %s", $user_login ) ) )
+		return new WP_Error('user_does_not_exist', __('The specified user does not exist.'));
+
+	$resetkey = substr(md5(bb_generate_password()), 0, 15);
+	bb_update_usermeta( $user->ID, 'newpwdkey', $resetkey );
+
+	$message = sprintf(
+		__("If you wanted to reset your password, you may do so by visiting the following address:\n\n%s\n\nIf you don't want to reset your password, just ignore this email. Thanks!"),
+		bb_get_uri(
+			'bb-reset-password.php',
+			array('key' => $resetkey),
+			BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_BB_USER_FORMS
+		)
+	);
+
+	$mail_result = bb_mail(
+		bb_get_user_email( $user->ID ),
+		bb_get_option('name') . ': ' . __('Password Reset'),
+		$message
+	);
+
+	if (!$mail_result) {
+		return new WP_Error('sending_mail_failed', __('The email containing the password reset link could not be sent.'));
+	} else {
+		return true;
+	}
+}
+
+/**
+ * Handles the resetting of users' passwords
+ *
+ * Handles resetting a user's password, prompted by an email sent by
+ * {@see bb_reset_email()}
+ *
+ * @since 0.7.2
+ * @global bbdb $bbdb
+ *
+ * @param string $key
+ * @return unknown
+ */
+function bb_reset_password( $key ) {
+	global $bbdb;
+	$key = sanitize_user( $key, true );
+	if ( empty( $key ) )
+		return new WP_Error('key_not_found', __('Key not found.'));
+	if ( !$user_id = $bbdb->get_var( $bbdb->prepare( "SELECT user_id FROM $bbdb->usermeta WHERE meta_key = 'newpwdkey' AND meta_value = %s", $key ) ) )
+		return new WP_Error('key_not_found', __('Key not found.'));
+	if ( $user = new BP_User( $user_id ) ) {
+		if ( bb_has_broken_pass( $user->ID ) )
+			bb_block_current_user();
+		if ( !$user->has_cap( 'change_user_password', $user->ID ) )
+			return new WP_Error('permission_denied', __('You are not allowed to change your password.'));
+		$newpass = bb_generate_password();
+		bb_update_user_password( $user->ID, $newpass );
+		if (!bb_send_pass( $user->ID, $newpass )) {
+			return new WP_Error('sending_mail_failed', __('The email containing the new password could not be sent.'));
+		} else {
+			bb_update_usermeta( $user->ID, 'newpwdkey', '' );
+			return true;
+		}
+	} else {
+		return new WP_Error('key_not_found', __('Key not found.'));
+	}
+}
+
+/**
+ * Updates a user's password in the database
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since 0.7.2
+ * @global bbdb $bbdb
+ *
+ * @param int $user_id
+ * @param string $password
+ * @return int
+ */
+function bb_update_user_password( $user_id, $password ) {
+	global $wp_users_object;
+
+	$user_id = (int) $user_id;
+
+	$wp_users_object->set_password( $password, $user_id );
+
+	do_action('bb_update_user_password', $user_id);
+	return $user_id;
+}
+
+/**
+ * Sends an email with the user's new password
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since 0.7.2
+ * @global bbdb $bbdb {@internal Not used}}
+ *
+ * @param int|string $user
+ * @param string $pass
+ * @return bool
+ */
+function bb_send_pass( $user, $pass ) {
+	if ( !$user = bb_get_user( $user ) )
+		return false;
+
+	$message = __("Your username is: %1\$s \nYour password is: %2\$s \nYou can now log in: %3\$s \n\nEnjoy!");
+
+	return bb_mail(
+		bb_get_user_email( $user->ID ),
+		bb_get_option('name') . ': ' . __('Password'),
+		sprintf($message, $user->user_login, $pass, bb_get_uri(null, null, BB_URI_CONTEXT_TEXT))
+	);
+}
+
+
+
+/* Favorites */
+
+function get_user_favorites( $user_id, $topics = false ) {
+	$user = bb_get_user( $user_id );
+	if ( !empty($user->favorites) ) {
+		if ( $topics )
+			$query = new BB_Query( 'topic', array('favorites' => $user_id, 'index_hint' => 'USE INDEX (`forum_time`)'), 'get_user_favorites' );
+		else
+			$query = new BB_Query( 'post', array('favorites' => $user_id), 'get_user_favorites' );
+		return $query->results;
+	}
+}
+
+function is_user_favorite( $user_id = 0, $topic_id = 0 ) {
+	if ( $user_id )
+		$user = bb_get_user( $user_id );
+	else
+	 	global $user;
+	if ( $topic_id )
+		$topic = get_topic( $topic_id );
+	else
+		global $topic;
+	if ( !$user || !$topic )
+		return;
+
+	if ( isset($user->favorites) )
+	        return in_array($topic->topic_id, explode(',', $user->favorites));
+	return false;
+}
+
+function bb_add_user_favorite( $user_id, $topic_id ) {
+	global $bbdb;
+	$user_id = (int) $user_id;
+	$topic_id = (int) $topic_id;
+	$user = bb_get_user( $user_id );
+	$topic = get_topic( $topic_id );
+	if ( !$user || !$topic )
+		return false;
+
+	$fav = $user->favorites ? explode(',', $user->favorites) : array();
+	if ( ! in_array( $topic_id, $fav ) ) {
+		$fav[] = $topic_id;
+		$fav = implode(',', $fav);
+		bb_update_usermeta( $user->ID, $bbdb->prefix . 'favorites', $fav);
+	}
+	do_action('bb_add_user_favorite', $user_id, $topic_id);
+	return true;
+}
+
+function bb_remove_user_favorite( $user_id, $topic_id ) {
+	global $bbdb;
+	$user_id = (int) $user_id;
+	$topic_id = (int) $topic_id;
+	$user = bb_get_user( $user_id );
+	if ( !$user )
+		return false;
+
+	$fav = explode(',', $user->favorites);
+	if ( is_int( $pos = array_search($topic_id, $fav) ) ) {
+		array_splice($fav, $pos, 1);
+		$fav = implode(',', $fav);
+		bb_update_usermeta( $user->ID, $bbdb->prefix . 'favorites', $fav);
+	}
+	do_action('bb_remove_user_favorite', $user_id, $topic_id);
+	return true;
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/jquery/hoverIntent.js b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/jquery/hoverIntent.js
new file mode 100644
index 0000000000000000000000000000000000000000..5cbf9782b2002983645e4eed2e432fd589ee6ae9
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/jquery/hoverIntent.js
@@ -0,0 +1,128 @@
+/**
+* hoverIntent is similar to jQuery's built-in "hover" function except that
+* instead of firing the onMouseOver event immediately, hoverIntent checks
+* to see if the user's mouse has slowed down (beneath the sensitivity
+* threshold) before firing the onMouseOver event.
+* 
+* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
+* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
+* 
+* hoverIntent is currently available for use in all personal or commercial 
+* projects under both MIT and GPL licenses. This means that you can choose 
+* the license that best suits your project, and use it accordingly.
+* 
+* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
+* $("ul li").hoverIntent( showNav , hideNav );
+* 
+* // advanced usage receives configuration object only
+* $("ul li").hoverIntent({
+*	sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
+*	interval: 100,   // number = milliseconds of polling interval
+*	over: showNav,  // function = onMouseOver callback (required)
+*	timeout: 0,   // number = milliseconds delay before onMouseOut function call
+*	out: hideNav    // function = onMouseOut callback (required)
+* });
+* 
+* @param  f  onMouseOver function || An object with configuration options
+* @param  g  onMouseOut function  || Nothing (use configuration options object)
+* @author    Brian Cherne <brian@cherne.net>
+*/
+(function($) {
+	$.fn.hoverIntent = function(f,g) {
+		// default configuration options
+		var cfg = {
+			sensitivity: 7,
+			interval: 100,
+			timeout: 0
+		};
+		// override configuration options with user supplied object
+		cfg = $.extend(cfg, g ? { over: f, out: g } : f );
+
+		// instantiate variables
+		// cX, cY = current X and Y position of mouse, updated by mousemove event
+		// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
+		var cX, cY, pX, pY;
+
+		// A private function for getting mouse position
+		var track = function(ev) {
+			cX = ev.pageX;
+			cY = ev.pageY;
+		};
+
+		// A private function for comparing current and previous mouse position
+		var compare = function(ev,ob) {
+			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
+			// compare mouse positions to see if they've crossed the threshold
+			if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
+				$(ob).unbind("mousemove",track);
+				// set hoverIntent state to true (so mouseOut can be called)
+				ob.hoverIntent_s = 1;
+				return cfg.over.apply(ob,[ev]);
+			} else {
+				// set previous coordinates for next time
+				pX = cX; pY = cY;
+				// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
+				ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
+			}
+		};
+
+		// A private function for delaying the mouseOut function
+		var delay = function(ev,ob) {
+			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
+			ob.hoverIntent_s = 0;
+			return cfg.out.apply(ob,[ev]);
+		};
+		
+		// workaround for Mozilla bug: not firing mouseout/mouseleave on absolute positioned elements over textareas and input type="text"
+		var handleHover = function(e) {
+			var t = this;
+			
+			// next two lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
+			var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
+			while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
+			if ( p == this ) {
+				if ( $.browser.mozilla ) {
+					if ( e.type == "mouseout" ) {
+						t.mtout = setTimeout( function(){doHover(e,t);}, 30 );
+					} else {
+						if (t.mtout) { t.mtout = clearTimeout(t.mtout); }
+					}
+				}
+				return;
+			} else {
+				if (t.mtout) { t.mtout = clearTimeout(t.mtout); }
+				doHover(e,t);
+			}
+		};
+
+		// A private function for handling mouse 'hovering'
+		var doHover = function(e,ob) {
+
+			// copy objects to be passed into t (required for event object to be passed in IE)
+			var ev = jQuery.extend({},e);
+
+			// cancel hoverIntent timer if it exists
+			if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
+
+			// else e.type == "onmouseover"
+			if (e.type == "mouseover") {
+				// set "previous" X and Y position based on initial entry point
+				pX = ev.pageX; pY = ev.pageY;
+				// update "current" X and Y position based on mousemove
+				$(ob).bind("mousemove",track);
+				// start polling interval (self-calling timeout) to compare mouse coordinates over time
+				if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
+
+			// else e.type == "onmouseout"
+			} else {
+				// unbind expensive mousemove event
+				$(ob).unbind("mousemove",track);
+				// if hoverIntent state is true, then call the mouseOut function after the specified delay
+				if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
+			}
+		};
+
+		// bind the function to the two event listeners
+		return this.mouseover(handleHover).mouseout(handleHover);
+	};
+})(jQuery);
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/jquery/interface.js b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/jquery/interface.js
new file mode 100644
index 0000000000000000000000000000000000000000..d0692162be18add7042a22065ceed893ec2f4bea
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/jquery/interface.js
@@ -0,0 +1,12 @@
+/**
+ * Interface Elements for jQuery
+ * 
+ * http://interface.eyecon.ro
+ * 
+ * Copyright (c) 2006 Stefan Petre
+ * Dual licensed under the MIT (MIT-LICENSE.txt) 
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *   
+ *
+ */
+ eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('k.f2={2r:u(M){E q.1E(u(){if(!M.aR||!M.aZ)E;D el=q;el.2l={aq:M.aq||cO,aR:M.aR,aZ:M.aZ,8e:M.8e||\'fV\',aJ:M.aJ||\'fV\',2Y:M.2Y&&2g M.2Y==\'u\'?M.2Y:I,3i:M.2Y&&2g M.3i==\'u\'?M.3i:I,7U:M.7U&&2g M.7U==\'u\'?M.7U:I,as:k(M.aR,q),8f:k(M.aZ,q),H:M.H||8J,67:M.67||0};el.2l.8f.2G().B(\'W\',\'9R\').eq(0).B({W:el.2l.aq+\'U\',19:\'2B\'}).2T();el.2l.as.1E(u(2N){q.7X=2N}).gC(u(){k(q).2R(el.2l.aJ)},u(){k(q).4i(el.2l.aJ)}).1J(\'5h\',u(e){if(el.2l.67==q.7X)E;el.2l.as.eq(el.2l.67).4i(el.2l.8e).2T().eq(q.7X).2R(el.2l.8e).2T();el.2l.8f.eq(el.2l.67).5w({W:0},el.2l.H,u(){q.14.19=\'1o\';if(el.2l.3i){el.2l.3i.1D(el,[q])}}).2T().eq(q.7X).1Y().5w({W:el.2l.aq},el.2l.H,u(){q.14.19=\'2B\';if(el.2l.2Y){el.2l.2Y.1D(el,[q])}}).2T();if(el.2l.7U){el.2l.7U.1D(el,[q,el.2l.8f.K(q.7X),el.2l.as.K(el.2l.67),el.2l.8f.K(el.2l.67)])}el.2l.67=q.7X}).eq(0).2R(el.2l.8e).2T();k(q).B(\'W\',k(q).B(\'W\')).B(\'2U\',\'2K\')})}};k.fn.gN=k.f2.2r;k.aA={2r:u(M){E q.1E(u(){D el=q;D 7E=2*18.2Q/f1;D an=2*18.2Q;if(k(el).B(\'Y\')!=\'2s\'&&k(el).B(\'Y\')!=\'1P\'){k(el).B(\'Y\',\'2s\')}el.1l={1R:k(M.1R,q),2F:M.2F,6q:M.6q,aD:M.aD,an:an,1N:k.1a.2o(q),Y:k.1a.3w(q),26:18.2Q/2,bi:M.bi,8p:M.6r,6r:[],aG:I,7E:2*18.2Q/f1};el.1l.fB=(el.1l.1N.w-el.1l.2F)/2;el.1l.7D=(el.1l.1N.h-el.1l.6q-el.1l.6q*el.1l.8p)/2;el.1l.2D=2*18.2Q/el.1l.1R.1N();el.1l.ba=el.1l.1N.w/2;el.1l.b9=el.1l.1N.h/2-el.1l.6q*el.1l.8p;D ak=1h.3F(\'22\');k(ak).B({Y:\'1P\',3I:1,Q:0,O:0});k(el).1S(ak);el.1l.1R.1E(u(2N){a6=k(\'1T\',q).K(0);W=T(el.1l.6q*el.1l.8p);if(k.3a.4t){3E=1h.3F(\'1T\');k(3E).B(\'Y\',\'1P\');3E.2J=a6.2J;3E.14.5E=\'gE 9n:9w.9y.cC(1G=60, 14=1, gB=0, gA=0, gv=0, gF=0)\'}P{3E=1h.3F(\'3E\');if(3E.fD){4L=3E.fD("2d");3E.14.Y=\'1P\';3E.14.W=W+\'U\';3E.14.Z=el.1l.2F+\'U\';3E.W=W;3E.Z=el.1l.2F;4L.gu();4L.gO(0,W);4L.gk(1,-1);4L.gp(a6,0,0,el.1l.2F,W);4L.6H();4L.gm="gG-4l";D ap=4L.hy(0,0,0,W);ap.fs(1,"fr(1V, 1V, 1V, 1)");ap.fs(0,"fr(1V, 1V, 1V, 0.6)");4L.hx=ap;if(hA.hB.3J(\'hw\')!=-1){4L.hv()}P{4L.hu(0,0,el.1l.2F,W)}}}el.1l.6r[2N]=3E;k(ak).1S(3E)}).1J(\'9z\',u(e){el.1l.aG=1b;el.1l.H=el.1l.7E*0.1*el.1l.H/18.3S(el.1l.H);E I}).1J(\'8B\',u(e){el.1l.aG=I;E I});k.aA.7T(el);el.1l.H=el.1l.7E*0.2;el.1l.ht=1X.6V(u(){el.1l.26+=el.1l.H;if(el.1l.26>an)el.1l.26=0;k.aA.7T(el)},20);k(el).1J(\'8B\',u(){el.1l.H=el.1l.7E*0.2*el.1l.H/18.3S(el.1l.H)}).1J(\'3D\',u(e){if(el.1l.aG==I){1s=k.1a.4a(e);fz=el.1l.1N.w-1s.x+el.1l.Y.x;el.1l.H=el.1l.bi*el.1l.7E*(el.1l.1N.w/2-fz)/(el.1l.1N.w/2)}})})},7T:u(el){el.1l.1R.1E(u(2N){b8=el.1l.26+2N*el.1l.2D;x=el.1l.fB*18.5H(b8);y=el.1l.7D*18.83(b8);f9=T(2a*(el.1l.7D+y)/(2*el.1l.7D));fk=(el.1l.7D+y)/(2*el.1l.7D);Z=T((el.1l.2F-el.1l.aD)*fk+el.1l.aD);W=T(Z*el.1l.6q/el.1l.2F);q.14.Q=el.1l.b9+y-W/2+"U";q.14.O=el.1l.ba+x-Z/2+"U";q.14.Z=Z+"U";q.14.W=W+"U";q.14.3I=f9;el.1l.6r[2N].14.Q=T(el.1l.b9+y+W-1-W/2)+"U";el.1l.6r[2N].14.O=T(el.1l.ba+x-Z/2)+"U";el.1l.6r[2N].14.Z=Z+"U";el.1l.6r[2N].14.W=T(W*el.1l.8p)+"U"})}};k.fn.hI=k.aA.2r;k.23({G:{c8:u(p,n,1W,1H,1m){E((-18.5H(p*18.2Q)/2)+0.5)*1H+1W},hK:u(p,n,1W,1H,1m){E 1H*(n/=1m)*n*n+1W},fl:u(p,n,1W,1H,1m){E-1H*((n=n/1m-1)*n*n*n-1)+1W},hm:u(p,n,1W,1H,1m){if((n/=1m/2)<1)E 1H/2*n*n*n*n+1W;E-1H/2*((n-=2)*n*n*n-2)+1W},8l:u(p,n,1W,1H,1m){if((n/=1m)<(1/2.75)){E 1H*(7.aB*n*n)+1W}P if(n<(2/2.75)){E 1H*(7.aB*(n-=(1.5/2.75))*n+.75)+1W}P if(n<(2.5/2.75)){E 1H*(7.aB*(n-=(2.25/2.75))*n+.gY)+1W}P{E 1H*(7.aB*(n-=(2.h2/2.75))*n+.gX)+1W}},cr:u(p,n,1W,1H,1m){if(k.G.8l)E 1H-k.G.8l(p,1m-n,0,1H,1m)+1W;E 1W+1H},gW:u(p,n,1W,1H,1m){if(k.G.cr&&k.G.8l)if(n<1m/2)E k.G.cr(p,n*2,0,1H,1m)*.5+1W;E k.G.8l(p,n*2-1m,0,1H,1m)*.5+1H*.5+1W;E 1W+1H},gQ:u(p,n,1W,1H,1m){D a,s;if(n==0)E 1W;if((n/=1m)==1)E 1W+1H;a=1H*0.3;p=1m*.3;if(a<18.3S(1H)){a=1H;s=p/4}P{s=p/(2*18.2Q)*18.cb(1H/a)}E-(a*18.6b(2,10*(n-=1))*18.83((n*1m-s)*(2*18.2Q)/p))+1W},gT:u(p,n,1W,1H,1m){D a,s;if(n==0)E 1W;if((n/=1m/2)==2)E 1W+1H;a=1H*0.3;p=1m*.3;if(a<18.3S(1H)){a=1H;s=p/4}P{s=p/(2*18.2Q)*18.cb(1H/a)}E a*18.6b(2,-10*n)*18.83((n*1m-s)*(2*18.2Q)/p)+1H+1W},gV:u(p,n,1W,1H,1m){D a,s;if(n==0)E 1W;if((n/=1m/2)==2)E 1W+1H;a=1H*0.3;p=1m*.3;if(a<18.3S(1H)){a=1H;s=p/4}P{s=p/(2*18.2Q)*18.cb(1H/a)}if(n<1){E-.5*(a*18.6b(2,10*(n-=1))*18.83((n*1m-s)*(2*18.2Q)/p))+1W}E a*18.6b(2,-10*(n-=1))*18.83((n*1m-s)*(2*18.2Q)/p)*.5+1H+1W}}});k.6n={2r:u(M){E q.1E(u(){D el=q;el.1F={1R:k(M.1R,q),1Z:k(M.1Z,q),1M:k.1a.3w(q),2F:M.2F,ax:M.ax,7Y:M.7Y,ge:M.ge,51:M.51,6x:M.6x};k.6n.aH(el,0);k(1X).1J(\'gU\',u(){el.1F.1M=k.1a.3w(el);k.6n.aH(el,0);k.6n.7T(el)});k.6n.7T(el);el.1F.1R.1J(\'9z\',u(){k(el.1F.ax,q).K(0).14.19=\'2B\'}).1J(\'8B\',u(){k(el.1F.ax,q).K(0).14.19=\'1o\'});k(1h).1J(\'3D\',u(e){D 1s=k.1a.4a(e);D 5s=0;if(el.1F.51&&el.1F.51==\'cv\')D aI=1s.x-el.1F.1M.x-(el.4c-el.1F.2F*el.1F.1R.1N())/2-el.1F.2F/2;P if(el.1F.51&&el.1F.51==\'2L\')D aI=1s.x-el.1F.1M.x-el.4c+el.1F.2F*el.1F.1R.1N();P D aI=1s.x-el.1F.1M.x;D fP=18.6b(1s.y-el.1F.1M.y-el.5W/2,2);el.1F.1R.1E(u(2N){45=18.ez(18.6b(aI-2N*el.1F.2F,2)+fP);45-=el.1F.2F/2;45=45<0?0:45;45=45>el.1F.7Y?el.1F.7Y:45;45=el.1F.7Y-45;bB=el.1F.6x*45/el.1F.7Y;q.14.Z=el.1F.2F+bB+\'U\';q.14.O=el.1F.2F*2N+5s+\'U\';5s+=bB});k.6n.aH(el,5s)})})},aH:u(el,5s){if(el.1F.51)if(el.1F.51==\'cv\')el.1F.1Z.K(0).14.O=(el.4c-el.1F.2F*el.1F.1R.1N())/2-5s/2+\'U\';P if(el.1F.51==\'O\')el.1F.1Z.K(0).14.O=-5s/el.1F.1R.1N()+\'U\';P if(el.1F.51==\'2L\')el.1F.1Z.K(0).14.O=(el.4c-el.1F.2F*el.1F.1R.1N())-5s/2+\'U\';el.1F.1Z.K(0).14.Z=el.1F.2F*el.1F.1R.1N()+5s+\'U\'},7T:u(el){el.1F.1R.1E(u(2N){q.14.Z=el.1F.2F+\'U\';q.14.O=el.1F.2F*2N+\'U\'})}};k.fn.hi=k.6n.2r;k.N={1c:S,8R:S,3A:S,2I:S,4y:S,cl:S,1d:S,2h:S,1R:S,5o:u(){k.N.8R.5o();if(k.N.3A){k.N.3A.2G()}},4w:u(){k.N.1R=S;k.N.2h=S;k.N.4y=k.N.1d.2y;if(k.N.1c.B(\'19\')==\'2B\'){if(k.N.1d.1f.fx){3m(k.N.1d.1f.fx.1u){1e\'c6\':k.N.1c.7a(k.N.1d.1f.fx.1m,k.N.5o);1r;1e\'1z\':k.N.1c.fq(k.N.1d.1f.fx.1m,k.N.5o);1r;1e\'a7\':k.N.1c.g3(k.N.1d.1f.fx.1m,k.N.5o);1r}}P{k.N.1c.2G()}if(k.N.1d.1f.3i)k.N.1d.1f.3i.1D(k.N.1d,[k.N.1c,k.N.3A])}P{k.N.5o()}1X.bH(k.N.2I)},dQ:u(){D 1d=k.N.1d;D 4d=k.N.aY(1d);if(1d&&4d.3o!=k.N.4y&&4d.3o.1g>=1d.1f.aL){k.N.4y=4d.3o;k.N.cl=4d.3o;81={2n:k(1d).1p(\'hj\')||\'2n\',2y:4d.3o};k.hl({1u:\'hk\',81:k.hf(81),he:u(fZ){1d.1f.4e=k(\'3o\',fZ);1N=1d.1f.4e.1N();if(1N>0){D 5p=\'\';1d.1f.4e.1E(u(2N){5p+=\'<8P 4I="\'+k(\'2y\',q).3g()+\'" 8K="\'+2N+\'" 14="9b: ad;">\'+k(\'3g\',q).3g()+\'</8P>\'});if(1d.1f.aU){D 3M=k(\'2y\',1d.1f.4e.K(0)).3g();1d.2y=4d.3j+3M+1d.1f.3N+4d.66;k.N.6J(1d,4d.3o.1g!=3M.1g?(4d.3j.1g+4d.3o.1g):3M.1g,4d.3o.1g!=3M.1g?(4d.3j.1g+3M.1g):3M.1g)}if(1N>0){k.N.cj(1d,5p)}P{k.N.4w()}}P{k.N.4w()}},5N:1d.1f.aN})}},cj:u(1d,5p){k.N.8R.3x(5p);k.N.1R=k(\'8P\',k.N.8R.K(0));k.N.1R.9z(k.N.di).1J(\'5h\',k.N.dj);D Y=k.1a.3w(1d);D 1N=k.1a.2o(1d);k.N.1c.B(\'Q\',Y.y+1N.hb+\'U\').B(\'O\',Y.x+\'U\').2R(1d.1f.aM);if(k.N.3A){k.N.3A.B(\'19\',\'2B\').B(\'Q\',Y.y+1N.hb+\'U\').B(\'O\',Y.x+\'U\').B(\'Z\',k.N.1c.B(\'Z\')).B(\'W\',k.N.1c.B(\'W\'))}k.N.2h=0;k.N.1R.K(0).3l=1d.1f.7H;k.N.8Q(1d,1d.1f.4e.K(0),\'7J\');if(k.N.1c.B(\'19\')==\'1o\'){if(1d.1f.bV){D cp=k.1a.aT(1d,1b);D cm=k.1a.6U(1d,1b);k.N.1c.B(\'Z\',1d.4c-(k.dF?(cp.l+cp.r+cm.l+cm.r):0)+\'U\')}if(1d.1f.fx){3m(1d.1f.fx.1u){1e\'c6\':k.N.1c.7f(1d.1f.fx.1m);1r;1e\'1z\':k.N.1c.fo(1d.1f.fx.1m);1r;1e\'a7\':k.N.1c.gb(1d.1f.fx.1m);1r}}P{k.N.1c.1Y()}if(k.N.1d.1f.2Y)k.N.1d.1f.2Y.1D(k.N.1d,[k.N.1c,k.N.3A])}},dO:u(){D 1d=q;if(1d.1f.4e){k.N.4y=1d.2y;k.N.cl=1d.2y;D 5p=\'\';1d.1f.4e.1E(u(2N){2y=k(\'2y\',q).3g().6c();fY=1d.2y.6c();if(2y.3J(fY)==0){5p+=\'<8P 4I="\'+k(\'2y\',q).3g()+\'" 8K="\'+2N+\'" 14="9b: ad;">\'+k(\'3g\',q).3g()+\'</8P>\'}});if(5p!=\'\'){k.N.cj(1d,5p);q.1f.9x=1b;E}}1d.1f.4e=S;q.1f.9x=I},6J:u(2n,26,2T){if(2n.b1){D 6t=2n.b1();6t.hp(1b);6t.dI("ck",26);6t.ha("ck",-2T+26);6t.8C()}P if(2n.aF){2n.aF(26,2T)}P{if(2n.5q){2n.5q=26;2n.dN=2T}}2n.6K()},f0:u(2n){if(2n.5q)E 2n.5q;P if(2n.b1){D 6t=1h.6J.dZ();D eX=6t.h9();E 0-eX.dI(\'ck\',-h6)}},aY:u(2n){D 4P={2y:2n.2y,3j:\'\',66:\'\',3o:\'\'};if(2n.1f.aQ){D 8N=I;D 5q=k.N.f0(2n)||0;D 4T=4P.2y.7C(2n.1f.3N);24(D i=0;i<4T.1g;i++){if((4P.3j.1g+4T[i].1g>=5q||5q==0)&&!8N){if(4P.3j.1g<=5q)4P.3o=4T[i];P 4P.66+=4T[i]+(4T[i]!=\'\'?2n.1f.3N:\'\');8N=1b}P if(8N){4P.66+=4T[i]+(4T[i]!=\'\'?2n.1f.3N:\'\')}if(!8N){4P.3j+=4T[i]+(4T.1g>1?2n.1f.3N:\'\')}}}P{4P.3o=4P.2y}E 4P},bU:u(e){1X.bH(k.N.2I);D 1d=k.N.aY(q);D 3K=e.7L||e.7K||-1;if(/13|27|35|36|38|40|9/.48(3K)&&k.N.1R){if(1X.2k){1X.2k.bT=1b;1X.2k.c0=I}P{e.aP();e.aW()}if(k.N.2h!=S)k.N.1R.K(k.N.2h||0).3l=\'\';P k.N.2h=-1;3m(3K){1e 9:1e 13:if(k.N.2h==-1)k.N.2h=0;D 2h=k.N.1R.K(k.N.2h||0);D 3M=2h.5C(\'4I\');q.2y=1d.3j+3M+q.1f.3N+1d.66;k.N.4y=1d.3o;k.N.6J(q,1d.3j.1g+3M.1g+q.1f.3N.1g,1d.3j.1g+3M.1g+q.1f.3N.1g);k.N.4w();if(q.1f.68){4u=T(2h.5C(\'8K\'))||0;k.N.8Q(q,q.1f.4e.K(4u),\'68\')}if(q.7W)q.7W(I);E 3K!=13;1r;1e 27:q.2y=1d.3j+k.N.4y+q.1f.3N+1d.66;q.1f.4e=S;k.N.4w();if(q.7W)q.7W(I);E I;1r;1e 35:k.N.2h=k.N.1R.1N()-1;1r;1e 36:k.N.2h=0;1r;1e 38:k.N.2h--;if(k.N.2h<0)k.N.2h=k.N.1R.1N()-1;1r;1e 40:k.N.2h++;if(k.N.2h==k.N.1R.1N())k.N.2h=0;1r}k.N.8Q(q,q.1f.4e.K(k.N.2h||0),\'7J\');k.N.1R.K(k.N.2h||0).3l=q.1f.7H;if(k.N.1R.K(k.N.2h||0).7W)k.N.1R.K(k.N.2h||0).7W(I);if(q.1f.aU){D aK=k.N.1R.K(k.N.2h||0).5C(\'4I\');q.2y=1d.3j+aK+q.1f.3N+1d.66;if(k.N.4y.1g!=aK.1g)k.N.6J(q,1d.3j.1g+k.N.4y.1g,1d.3j.1g+aK.1g)}E I}k.N.dO.1D(q);if(q.1f.9x==I){if(1d.3o!=k.N.4y&&1d.3o.1g>=q.1f.aL)k.N.2I=1X.9T(k.N.dQ,q.1f.54);if(k.N.1R){k.N.4w()}}E 1b},8Q:u(2n,3o,1u){if(2n.1f[1u]){D 81={};ar=3o.f3(\'*\');24(i=0;i<ar.1g;i++){81[ar[i].4Y]=ar[i].7c.h4}2n.1f[1u].1D(2n,[81])}},di:u(e){if(k.N.1R){if(k.N.2h!=S)k.N.1R.K(k.N.2h||0).3l=\'\';k.N.1R.K(k.N.2h||0).3l=\'\';k.N.2h=T(q.5C(\'8K\'))||0;k.N.1R.K(k.N.2h||0).3l=k.N.1d.1f.7H}},dj:u(2k){1X.bH(k.N.2I);2k=2k||k.2k.gS(1X.2k);2k.aP();2k.aW();D 1d=k.N.aY(k.N.1d);D 3M=q.5C(\'4I\');k.N.1d.2y=1d.3j+3M+k.N.1d.1f.3N+1d.66;k.N.4y=q.5C(\'4I\');k.N.6J(k.N.1d,1d.3j.1g+3M.1g+k.N.1d.1f.3N.1g,1d.3j.1g+3M.1g+k.N.1d.1f.3N.1g);k.N.4w();if(k.N.1d.1f.68){4u=T(q.5C(\'8K\'))||0;k.N.8Q(k.N.1d,k.N.1d.1f.4e.K(4u),\'68\')}E I},eJ:u(e){3K=e.7L||e.7K||-1;if(/13|27|35|36|38|40/.48(3K)&&k.N.1R){if(1X.2k){1X.2k.bT=1b;1X.2k.c0=I}P{e.aP();e.aW()}E I}},2r:u(M){if(!M.aN||!k.1a){E}if(!k.N.1c){if(k.3a.4t){k(\'2e\',1h).1S(\'<3A 14="19:1o;Y:1P;5E:9n:9w.9y.cC(1G=0);" id="ds" 2J="ek:I;" ej="0" ep="cD"></3A>\');k.N.3A=k(\'#ds\')}k(\'2e\',1h).1S(\'<22 id="dr" 14="Y: 1P; Q: 0; O: 0; z-cZ: h3; 19: 1o;"><9h 14="6w: 0;8F: 0; h1-14: 1o; z-cZ: h0;">&7k;</9h></22>\');k.N.1c=k(\'#dr\');k.N.8R=k(\'9h\',k.N.1c)}E q.1E(u(){if(q.4Y!=\'ch\'&&q.5C(\'1u\')!=\'3g\')E;q.1f={};q.1f.aN=M.aN;q.1f.aL=18.3S(T(M.aL)||1);q.1f.aM=M.aM?M.aM:\'\';q.1f.7H=M.7H?M.7H:\'\';q.1f.68=M.68&&M.68.1K==2A?M.68:S;q.1f.2Y=M.2Y&&M.2Y.1K==2A?M.2Y:S;q.1f.3i=M.3i&&M.3i.1K==2A?M.3i:S;q.1f.7J=M.7J&&M.7J.1K==2A?M.7J:S;q.1f.bV=M.bV||I;q.1f.aQ=M.aQ||I;q.1f.3N=q.1f.aQ?(M.3N||\', \'):\'\';q.1f.aU=M.aU?1b:I;q.1f.54=18.3S(T(M.54)||aC);if(M.fx&&M.fx.1K==7M){if(!M.fx.1u||!/c6|1z|a7/.48(M.fx.1u)){M.fx.1u=\'1z\'}if(M.fx.1u==\'1z\'&&!k.fx.1z)E;if(M.fx.1u==\'a7\'&&!k.fx.61)E;M.fx.1m=18.3S(T(M.fx.1m)||8J);if(M.fx.1m>q.1f.54){M.fx.1m=q.1f.54-2a}q.1f.fx=M.fx}q.1f.4e=S;q.1f.9x=I;k(q).1p(\'bU\',\'eN\').6K(u(){k.N.1d=q;k.N.4y=q.2y}).dH(k.N.eJ).6y(k.N.bU).5B(u(){k.N.2I=1X.9T(k.N.4w,hM)})})}};k.fn.hR=k.N.2r;k.1y={2I:S,4Q:S,29:S,2D:10,26:u(el,4J,2D,eG){k.1y.4Q=el;k.1y.29=4J;k.1y.2D=T(2D)||10;k.1y.2I=1X.6V(k.1y.eF,T(eG)||40)},eF:u(){24(i=0;i<k.1y.29.1g;i++){if(!k.1y.29[i].2X){k.1y.29[i].2X=k.23(k.1a.7G(k.1y.29[i]),k.1a.74(k.1y.29[i]),k.1a.6z(k.1y.29[i]))}P{k.1y.29[i].2X.t=k.1y.29[i].3d;k.1y.29[i].2X.l=k.1y.29[i].3c}if(k.1y.4Q.A&&k.1y.4Q.A.7q==1b){69={x:k.1y.4Q.A.2v,y:k.1y.4Q.A.2q,1C:k.1y.4Q.A.1B.1C,hb:k.1y.4Q.A.1B.hb}}P{69=k.23(k.1a.7G(k.1y.4Q),k.1a.74(k.1y.4Q))}if(k.1y.29[i].2X.t>0&&k.1y.29[i].2X.y+k.1y.29[i].2X.t>69.y){k.1y.29[i].3d-=k.1y.2D}P if(k.1y.29[i].2X.t<=k.1y.29[i].2X.h&&k.1y.29[i].2X.t+k.1y.29[i].2X.hb<69.y+69.hb){k.1y.29[i].3d+=k.1y.2D}if(k.1y.29[i].2X.l>0&&k.1y.29[i].2X.x+k.1y.29[i].2X.l>69.x){k.1y.29[i].3c-=k.1y.2D}P if(k.1y.29[i].2X.l<=k.1y.29[i].2X.hP&&k.1y.29[i].2X.l+k.1y.29[i].2X.1C<69.x+69.1C){k.1y.29[i].3c+=k.1y.2D}}},8o:u(){1X.5T(k.1y.2I);k.1y.4Q=S;k.1y.29=S;24(i in k.1y.29){k.1y.29[i].2X=S}}};k.11={1c:S,F:S,4U:u(){E q.1E(u(){if(q.9I){q.A.5e.3q(\'5v\',k.11.bN);q.A=S;q.9I=I;if(k.3a.4t){q.bE="eN"}P{q.14.hq=\'\';q.14.e1=\'\';q.14.e7=\'\'}}})},bN:u(e){if(k.11.F!=S){k.11.9A(e);E I}D C=q.3U;k(1h).1J(\'3D\',k.11.bX).1J(\'5P\',k.11.9A);C.A.1s=k.1a.4a(e);C.A.4B=C.A.1s;C.A.7q=I;C.A.ho=q!=q.3U;k.11.F=C;if(C.A.5i&&q!=q.3U){bS=k.1a.3w(C.31);bQ=k.1a.2o(C);bR={x:T(k.B(C,\'O\'))||0,y:T(k.B(C,\'Q\'))||0};dx=C.A.4B.x-bS.x-bQ.1C/2-bR.x;dy=C.A.4B.y-bS.y-bQ.hb/2-bR.y;k.3b.5c(C,[dx,dy])}E k.7n||I},ea:u(e){D C=k.11.F;C.A.7q=1b;D 9G=C.14;C.A.7V=k.B(C,\'19\');C.A.4n=k.B(C,\'Y\');if(!C.A.cz)C.A.cz=C.A.4n;C.A.2c={x:T(k.B(C,\'O\'))||0,y:T(k.B(C,\'Q\'))||0};C.A.9B=0;C.A.ai=0;if(k.3a.4t){D bW=k.1a.6U(C,1b);C.A.9B=bW.l||0;C.A.ai=bW.t||0}C.A.1B=k.23(k.1a.3w(C),k.1a.2o(C));if(C.A.4n!=\'2s\'&&C.A.4n!=\'1P\'){9G.Y=\'2s\'}k.11.1c.5o();D 5g=C.fI(1b);k(5g).B({19:\'2B\',O:\'2P\',Q:\'2P\'});5g.14.5K=\'0\';5g.14.5z=\'0\';5g.14.5k=\'0\';5g.14.5j=\'0\';k.11.1c.1S(5g);D 3Y=k.11.1c.K(0).14;if(C.A.bD){3Y.Z=\'9F\';3Y.W=\'9F\'}P{3Y.W=C.A.1B.hb+\'U\';3Y.Z=C.A.1B.1C+\'U\'}3Y.19=\'2B\';3Y.5K=\'2P\';3Y.5z=\'2P\';3Y.5k=\'2P\';3Y.5j=\'2P\';k.23(C.A.1B,k.1a.2o(5g));if(C.A.2V){if(C.A.2V.O){C.A.2c.x+=C.A.1s.x-C.A.1B.x-C.A.2V.O;C.A.1B.x=C.A.1s.x-C.A.2V.O}if(C.A.2V.Q){C.A.2c.y+=C.A.1s.y-C.A.1B.y-C.A.2V.Q;C.A.1B.y=C.A.1s.y-C.A.2V.Q}if(C.A.2V.2L){C.A.2c.x+=C.A.1s.x-C.A.1B.x-C.A.1B.hb+C.A.2V.2L;C.A.1B.x=C.A.1s.x-C.A.1B.1C+C.A.2V.2L}if(C.A.2V.4D){C.A.2c.y+=C.A.1s.y-C.A.1B.y-C.A.1B.hb+C.A.2V.4D;C.A.1B.y=C.A.1s.y-C.A.1B.hb+C.A.2V.4D}}C.A.2v=C.A.2c.x;C.A.2q=C.A.2c.y;if(C.A.8s||C.A.2p==\'94\'){8U=k.1a.6U(C.31,1b);C.A.1B.x=C.8t+(k.3a.4t?0:k.3a.7I?-8U.l:8U.l);C.A.1B.y=C.8G+(k.3a.4t?0:k.3a.7I?-8U.t:8U.t);k(C.31).1S(k.11.1c.K(0))}if(C.A.2p){k.11.c5(C);C.A.5t.2p=k.11.ce}if(C.A.5i){k.3b.ct(C)}3Y.O=C.A.1B.x-C.A.9B+\'U\';3Y.Q=C.A.1B.y-C.A.ai+\'U\';3Y.Z=C.A.1B.1C+\'U\';3Y.W=C.A.1B.hb+\'U\';k.11.F.A.9E=I;if(C.A.gx){C.A.5t.6a=k.11.c7}if(C.A.3I!=I){k.11.1c.B(\'3I\',C.A.3I)}if(C.A.1G){k.11.1c.B(\'1G\',C.A.1G);if(1X.71){k.11.1c.B(\'5E\',\'8V(1G=\'+C.A.1G*2a+\')\')}}if(C.A.7O){k.11.1c.2R(C.A.7O);k.11.1c.K(0).7c.14.19=\'1o\'}if(C.A.4o)C.A.4o.1D(C,[5g,C.A.2c.x,C.A.2c.y]);if(k.1x&&k.1x.8D>0){k.1x.ed(C)}if(C.A.46==I){9G.19=\'1o\'}E I},c5:u(C){if(C.A.2p.1K==b0){if(C.A.2p==\'94\'){C.A.28=k.23({x:0,y:0},k.1a.2o(C.31));D 8S=k.1a.6U(C.31,1b);C.A.28.w=C.A.28.1C-8S.l-8S.r;C.A.28.h=C.A.28.hb-8S.t-8S.b}P if(C.A.2p==\'1h\'){D bY=k.1a.bm();C.A.28={x:0,y:0,w:bY.w,h:bY.h}}}P if(C.A.2p.1K==7F){C.A.28={x:T(C.A.2p[0])||0,y:T(C.A.2p[1])||0,w:T(C.A.2p[2])||0,h:T(C.A.2p[3])||0}}C.A.28.dx=C.A.28.x-C.A.1B.x;C.A.28.dy=C.A.28.y-C.A.1B.y},9H:u(F){if(F.A.8s||F.A.2p==\'94\'){k(\'2e\',1h).1S(k.11.1c.K(0))}k.11.1c.5o().2G().B(\'1G\',1);if(1X.71){k.11.1c.B(\'5E\',\'8V(1G=2a)\')}},9A:u(e){k(1h).3q(\'3D\',k.11.bX).3q(\'5P\',k.11.9A);if(k.11.F==S){E}D F=k.11.F;k.11.F=S;if(F.A.7q==I){E I}if(F.A.44==1b){k(F).B(\'Y\',F.A.4n)}D 9G=F.14;if(F.5i){k.11.1c.B(\'9b\',\'8j\')}if(F.A.7O){k.11.1c.4i(F.A.7O)}if(F.A.6N==I){if(F.A.fx>0){if(!F.A.1O||F.A.1O==\'4j\'){D x=12 k.fx(F,{1m:F.A.fx},\'O\');x.1L(F.A.2c.x,F.A.8y)}if(!F.A.1O||F.A.1O==\'49\'){D y=12 k.fx(F,{1m:F.A.fx},\'Q\');y.1L(F.A.2c.y,F.A.8v)}}P{if(!F.A.1O||F.A.1O==\'4j\')F.14.O=F.A.8y+\'U\';if(!F.A.1O||F.A.1O==\'49\')F.14.Q=F.A.8v+\'U\'}k.11.9H(F);if(F.A.46==I){k(F).B(\'19\',F.A.7V)}}P if(F.A.fx>0){F.A.9E=1b;D dh=I;if(k.1x&&k.1t&&F.A.44){dh=k.1a.3w(k.1t.1c.K(0))}k.11.1c.5w({O:dh?dh.x:F.A.1B.x,Q:dh?dh.y:F.A.1B.y},F.A.fx,u(){F.A.9E=I;if(F.A.46==I){F.14.19=F.A.7V}k.11.9H(F)})}P{k.11.9H(F);if(F.A.46==I){k(F).B(\'19\',F.A.7V)}}if(k.1x&&k.1x.8D>0){k.1x.eO(F)}if(k.1t&&F.A.44){k.1t.fC(F)}if(F.A.2Z&&(F.A.8y!=F.A.2c.x||F.A.8v!=F.A.2c.y)){F.A.2Z.1D(F,F.A.b3||[0,0,F.A.8y,F.A.8v])}if(F.A.3T)F.A.3T.1D(F);E I},c7:u(x,y,dx,dy){if(dx!=0)dx=T((dx+(q.A.gx*dx/18.3S(dx))/2)/q.A.gx)*q.A.gx;if(dy!=0)dy=T((dy+(q.A.gy*dy/18.3S(dy))/2)/q.A.gy)*q.A.gy;E{dx:dx,dy:dy,x:0,y:0}},ce:u(x,y,dx,dy){dx=18.3L(18.3r(dx,q.A.28.dx),q.A.28.w+q.A.28.dx-q.A.1B.1C);dy=18.3L(18.3r(dy,q.A.28.dy),q.A.28.h+q.A.28.dy-q.A.1B.hb);E{dx:dx,dy:dy,x:0,y:0}},bX:u(e){if(k.11.F==S||k.11.F.A.9E==1b){E}D F=k.11.F;F.A.4B=k.1a.4a(e);if(F.A.7q==I){45=18.ez(18.6b(F.A.1s.x-F.A.4B.x,2)+18.6b(F.A.1s.y-F.A.4B.y,2));if(45<F.A.6M){E}P{k.11.ea(e)}}D dx=F.A.4B.x-F.A.1s.x;D dy=F.A.4B.y-F.A.1s.y;24(D i in F.A.5t){D 3y=F.A.5t[i].1D(F,[F.A.2c.x+dx,F.A.2c.y+dy,dx,dy]);if(3y&&3y.1K==7M){dx=i!=\'7R\'?3y.dx:(3y.x-F.A.2c.x);dy=i!=\'7R\'?3y.dy:(3y.y-F.A.2c.y)}}F.A.2v=F.A.1B.x+dx-F.A.9B;F.A.2q=F.A.1B.y+dy-F.A.ai;if(F.A.5i&&(F.A.3H||F.A.2Z)){k.3b.3H(F,F.A.2v,F.A.2q)}if(F.A.4m)F.A.4m.1D(F,[F.A.2c.x+dx,F.A.2c.y+dy]);if(!F.A.1O||F.A.1O==\'4j\'){F.A.8y=F.A.2c.x+dx;k.11.1c.K(0).14.O=F.A.2v+\'U\'}if(!F.A.1O||F.A.1O==\'49\'){F.A.8v=F.A.2c.y+dy;k.11.1c.K(0).14.Q=F.A.2q+\'U\'}if(k.1x&&k.1x.8D>0){k.1x.al(F)}E I},2r:u(o){if(!k.11.1c){k(\'2e\',1h).1S(\'<22 id="e8"></22>\');k.11.1c=k(\'#e8\');D el=k.11.1c.K(0);D 4J=el.14;4J.Y=\'1P\';4J.19=\'1o\';4J.9b=\'8j\';4J.eu=\'1o\';4J.2U=\'2K\';if(1X.71){el.bE="e4"}P{4J.gi=\'1o\';4J.e7=\'1o\';4J.e1=\'1o\'}}if(!o){o={}}E q.1E(u(){if(q.9I||!k.1a)E;if(1X.71){q.gh=u(){E I};q.gj=u(){E I}}D el=q;D 5e=o.3v?k(q).gf(o.3v):k(q);if(k.3a.4t){5e.1E(u(){q.bE="e4"})}P{5e.B(\'-gI-7R-8C\',\'1o\');5e.B(\'7R-8C\',\'1o\');5e.B(\'-gH-7R-8C\',\'1o\')}q.A={5e:5e,6N:o.6N?1b:I,46:o.46?1b:I,44:o.44?o.44:I,5i:o.5i?o.5i:I,8s:o.8s?o.8s:I,3I:o.3I?T(o.3I)||0:I,1G:o.1G?2m(o.1G):I,fx:T(o.fx)||S,6R:o.6R?o.6R:I,5t:{},1s:{},4o:o.4o&&o.4o.1K==2A?o.4o:I,3T:o.3T&&o.3T.1K==2A?o.3T:I,2Z:o.2Z&&o.2Z.1K==2A?o.2Z:I,1O:/49|4j/.48(o.1O)?o.1O:I,6M:o.6M?T(o.6M)||0:0,2V:o.2V?o.2V:I,bD:o.bD?1b:I,7O:o.7O||I};if(o.5t&&o.5t.1K==2A)q.A.5t.7R=o.5t;if(o.4m&&o.4m.1K==2A)q.A.4m=o.4m;if(o.2p&&((o.2p.1K==b0&&(o.2p==\'94\'||o.2p==\'1h\'))||(o.2p.1K==7F&&o.2p.1g==4))){q.A.2p=o.2p}if(o.2O){q.A.2O=o.2O}if(o.6a){if(2g o.6a==\'gz\'){q.A.gx=T(o.6a)||1;q.A.gy=T(o.6a)||1}P if(o.6a.1g==2){q.A.gx=T(o.6a[0])||1;q.A.gy=T(o.6a[1])||1}}if(o.3H&&o.3H.1K==2A){q.A.3H=o.3H}q.9I=1b;5e.1E(u(){q.3U=el});5e.1J(\'5v\',k.11.bN)})}};k.fn.23({aS:k.11.4U,7t:k.11.2r});k.1x={du:u(5J,5G,7Q,7S){E 5J<=k.11.F.A.2v&&(5J+7Q)>=(k.11.F.A.2v+k.11.F.A.1B.w)&&5G<=k.11.F.A.2q&&(5G+7S)>=(k.11.F.A.2q+k.11.F.A.1B.h)?1b:I},cV:u(5J,5G,7Q,7S){E!(5J>(k.11.F.A.2v+k.11.F.A.1B.w)||(5J+7Q)<k.11.F.A.2v||5G>(k.11.F.A.2q+k.11.F.A.1B.h)||(5G+7S)<k.11.F.A.2q)?1b:I},1s:u(5J,5G,7Q,7S){E 5J<k.11.F.A.4B.x&&(5J+7Q)>k.11.F.A.4B.x&&5G<k.11.F.A.4B.y&&(5G+7S)>k.11.F.A.4B.y?1b:I},5r:I,3Q:{},8D:0,3P:{},ed:u(C){if(k.11.F==S){E}D i;k.1x.3Q={};D bJ=I;24(i in k.1x.3P){if(k.1x.3P[i]!=S){D 1j=k.1x.3P[i].K(0);if(k(k.11.F).is(\'.\'+1j.1i.a)){if(1j.1i.m==I){1j.1i.p=k.23(k.1a.7G(1j),k.1a.74(1j));1j.1i.m=1b}if(1j.1i.ac){k.1x.3P[i].2R(1j.1i.ac)}k.1x.3Q[i]=k.1x.3P[i];if(k.1t&&1j.1i.s&&k.11.F.A.44){1j.1i.el=k(\'.\'+1j.1i.a,1j);C.14.19=\'1o\';k.1t.cT(1j);1j.1i.ay=k.1t.8x(k.1p(1j,\'id\')).7l;C.14.19=C.A.7V;bJ=1b}if(1j.1i.9i){1j.1i.9i.1D(k.1x.3P[i].K(0),[k.11.F])}}}}if(bJ){k.1t.26()}},dS:u(){k.1x.3Q={};24(i in k.1x.3P){if(k.1x.3P[i]!=S){D 1j=k.1x.3P[i].K(0);if(k(k.11.F).is(\'.\'+1j.1i.a)){1j.1i.p=k.23(k.1a.7G(1j),k.1a.74(1j));if(1j.1i.ac){k.1x.3P[i].2R(1j.1i.ac)}k.1x.3Q[i]=k.1x.3P[i];if(k.1t&&1j.1i.s&&k.11.F.A.44){1j.1i.el=k(\'.\'+1j.1i.a,1j);C.14.19=\'1o\';k.1t.cT(1j);C.14.19=C.A.7V}}}}},al:u(e){if(k.11.F==S){E}k.1x.5r=I;D i;D bK=I;D eQ=0;24(i in k.1x.3Q){D 1j=k.1x.3Q[i].K(0);if(k.1x.5r==I&&k.1x[1j.1i.t](1j.1i.p.x,1j.1i.p.y,1j.1i.p.1C,1j.1i.p.hb)){if(1j.1i.hc&&1j.1i.h==I){k.1x.3Q[i].2R(1j.1i.hc)}if(1j.1i.h==I&&1j.1i.7x){bK=1b}1j.1i.h=1b;k.1x.5r=1j;if(k.1t&&1j.1i.s&&k.11.F.A.44){k.1t.1c.K(0).3l=1j.1i.eV;k.1t.al(1j)}eQ++}P if(1j.1i.h==1b){if(1j.1i.7y){1j.1i.7y.1D(1j,[e,k.11.1c.K(0).7c,1j.1i.fx])}if(1j.1i.hc){k.1x.3Q[i].4i(1j.1i.hc)}1j.1i.h=I}}if(k.1t&&!k.1x.5r&&k.11.F.44){k.1t.1c.K(0).14.19=\'1o\'}if(bK){k.1x.5r.1i.7x.1D(k.1x.5r,[e,k.11.1c.K(0).7c])}},eO:u(e){D i;24(i in k.1x.3Q){D 1j=k.1x.3Q[i].K(0);if(1j.1i.ac){k.1x.3Q[i].4i(1j.1i.ac)}if(1j.1i.hc){k.1x.3Q[i].4i(1j.1i.hc)}if(1j.1i.s){k.1t.7s[k.1t.7s.1g]=i}if(1j.1i.9l&&1j.1i.h==1b){1j.1i.h=I;1j.1i.9l.1D(1j,[e,1j.1i.fx])}1j.1i.m=I;1j.1i.h=I}k.1x.3Q={}},4U:u(){E q.1E(u(){if(q.9j){if(q.1i.s){id=k.1p(q,\'id\');k.1t.5L[id]=S;k(\'.\'+q.1i.a,q).aS()}k.1x.3P[\'d\'+q.c2]=S;q.9j=I;q.f=S}})},2r:u(o){E q.1E(u(){if(q.9j==1b||!o.3C||!k.1a||!k.11){E}q.1i={a:o.3C,ac:o.9J||I,hc:o.a5||I,eV:o.58||I,9l:o.gq||o.9l||I,7x:o.7x||o.dC||I,7y:o.7y||o.fO||I,9i:o.9i||I,t:o.6I&&(o.6I==\'du\'||o.6I==\'cV\')?o.6I:\'1s\',fx:o.fx?o.fx:I,m:I,h:I};if(o.cQ==1b&&k.1t){id=k.1p(q,\'id\');k.1t.5L[id]=q.1i.a;q.1i.s=1b;if(o.2Z){q.1i.2Z=o.2Z;q.1i.ay=k.1t.8x(id).7l}}q.9j=1b;q.c2=T(18.6o()*c9);k.1x.3P[\'d\'+q.c2]=k(q);k.1x.8D++})}};k.fn.23({dR:k.1x.4U,do:k.1x.2r});k.gD=k.1x.dS;k.3B={1c:S,8L:u(){3g=q.2y;if(!3g)E;14={dz:k(q).B(\'dz\')||\'\',4A:k(q).B(\'4A\')||\'\',8Z:k(q).B(\'8Z\')||\'\',dP:k(q).B(\'dP\')||\'\',dT:k(q).B(\'dT\')||\'\',dU:k(q).B(\'dU\')||\'\',c3:k(q).B(\'c3\')||\'\',dY:k(q).B(\'dY\')||\'\'};k.3B.1c.B(14);3x=k.3B.dX(3g);3x=3x.4E(12 bb("\\\\n","g"),"<br />");k.3B.1c.3x(\'gL\');ci=k.3B.1c.K(0).4c;k.3B.1c.3x(3x);Z=k.3B.1c.K(0).4c+ci;if(q.6l.2M&&Z>q.6l.2M[0]){Z=q.6l.2M[0]}q.14.Z=Z+\'U\';if(q.4Y==\'cf\'){W=k.3B.1c.K(0).5W+ci;if(q.6l.2M&&W>q.6l.2M[1]){W=q.6l.2M[1]}q.14.W=W+\'U\'}},dX:u(3g){cg={\'&\':\'&gK;\',\'<\':\'&gJ;\',\'>\':\'&gt;\',\'"\':\'&gs;\'};24(i in cg){3g=3g.4E(12 bb(i,\'g\'),cg[i])}E 3g},2r:u(2M){if(k.3B.1c==S){k(\'2e\',1h).1S(\'<22 id="dE" 14="Y: 1P; Q: 0; O: 0; 3n: 2K;"></22>\');k.3B.1c=k(\'#dE\')}E q.1E(u(){if(/cf|ch/.48(q.4Y)){if(q.4Y==\'ch\'){dB=q.5C(\'1u\');if(!/3g|gr/.48(dB)){E}}if(2M&&(2M.1K==bn||(2M.1K==7F&&2M.1g==2))){if(2M.1K==bn)2M=[2M,2M];P{2M[0]=T(2M[0])||8J;2M[1]=T(2M[1])||8J}q.6l={2M:2M}}k(q).5B(k.3B.8L).6y(k.3B.8L).dH(k.3B.8L);k.3B.8L.1D(q)}})}};k.fn.kc=k.3B.2r;k.4K=u(e){if(/^kd$|^ke$|^ka$|^6L$|^k9$|^k5$|^k4$|^k6$|^k7$|^2e$|^k8$|^kf$|^kg$|^kn$|^ko$|^kp$|^kq$/i.48(e.9N))E I;P E 1b};k.fx.a0=u(e,65){D c=e.7c;D cs=c.14;cs.Y=65.Y;cs.5K=65.3G.t;cs.5j=65.3G.l;cs.5k=65.3G.b;cs.5z=65.3G.r;cs.Q=65.Q+\'U\';cs.O=65.O+\'U\';e.31.ew(c,e);e.31.km(e)};k.fx.9P=u(e){if(!k.4K(e))E I;D t=k(e);D es=e.14;D 73=I;if(t.B(\'19\')==\'1o\'){5Y=t.B(\'3n\');t.B(\'3n\',\'2K\').1Y();73=1b}D V={};V.Y=t.B(\'Y\');V.1q=k.1a.2o(e);V.3G=k.1a.cy(e);D co=e.4Z?e.4Z.ei:t.B(\'hU\');V.Q=T(t.B(\'Q\'))||0;V.O=T(t.B(\'O\'))||0;D eo=\'kl\'+T(18.6o()*c9);D 6u=1h.3F(/^1T$|^br$|^kh$|^hr$|^8C$|^kj$|^8T$|^3A$|^kk$|^k3$|^k2$|^9h$|^dl$|^jM$/i.48(e.9N)?\'22\':e.9N);k.1p(6u,\'id\',eo);D jN=k(6u).2R(\'jO\');D 4h=6u.14;D Q=0;D O=0;if(V.Y==\'2s\'||V.Y==\'1P\'){Q=V.Q;O=V.O}4h.Q=Q+\'U\';4h.O=O+\'U\';4h.Y=V.Y!=\'2s\'&&V.Y!=\'1P\'?\'2s\':V.Y;4h.W=V.1q.hb+\'U\';4h.Z=V.1q.1C+\'U\';4h.5K=V.3G.t;4h.5z=V.3G.r;4h.5k=V.3G.b;4h.5j=V.3G.l;4h.2U=\'2K\';if(k.3a.4t){4h.ei=co}P{4h.jK=co}if(k.3a=="4t"){es.5E="8V(1G="+0.ex*2a+")"}es.1G=0.ex;e.31.ew(6u,e);6u.jF(e);es.5K=\'2P\';es.5z=\'2P\';es.5k=\'2P\';es.5j=\'2P\';es.Y=\'1P\';es.eu=\'1o\';es.Q=\'2P\';es.O=\'2P\';if(73){t.2G();es.3n=5Y}E{V:V,3p:k(6u)}};k.fx.8E={jE:[0,1V,1V],jG:[eD,1V,1V],jH:[e6,e6,jI],jP:[0,0,0],ks:[0,0,1V],jY:[dv,42,42],jZ:[0,1V,1V],k0:[0,0,7w],k1:[0,7w,7w],jX:[cn,cn,cn],jS:[0,2a,0],jR:[jT,jU,eb],jV:[7w,0,7w],kr:[85,eb,47],kP:[1V,eA,0],kN:[kO,50,kx],kF:[7w,0,0],kD:[ku,f8,kt],ky:[kH,0,9C],kL:[1V,0,1V],kM:[1V,kJ,0],kv:[0,6C,0],kA:[75,0,kE],kC:[eD,eB,eA],kG:[kI,kB,eB],kw:[e0,1V,1V],kz:[eL,kK,eL],kQ:[9C,9C,9C],jC:[1V,iy,iz],iA:[1V,1V,e0],iB:[0,1V,0],ix:[1V,0,1V],iv:[6C,0,0],iq:[0,0,6C],ip:[6C,6C,0],ir:[1V,dv,0],it:[1V,ah,iu],iC:[6C,0,6C],iD:[1V,0,0],iK:[ah,ah,ah],iL:[1V,1V,1V],iM:[1V,1V,0]};k.fx.6D=u(4x,dm){if(k.fx.8E[4x])E{r:k.fx.8E[4x][0],g:k.fx.8E[4x][1],b:k.fx.8E[4x][2]};P if(2W=/^6Y\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*\\)$/.a4(4x))E{r:T(2W[1]),g:T(2W[2]),b:T(2W[3])};P if(2W=/6Y\\(\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*\\)$/.a4(4x))E{r:2m(2W[1])*2.55,g:2m(2W[2])*2.55,b:2m(2W[3])*2.55};P if(2W=/^#([a-fA-79-9])([a-fA-79-9])([a-fA-79-9])$/.a4(4x))E{r:T("77"+2W[1]+2W[1]),g:T("77"+2W[2]+2W[2]),b:T("77"+2W[3]+2W[3])};P if(2W=/^#([a-fA-79-9]{2})([a-fA-79-9]{2})([a-fA-79-9]{2})$/.a4(4x))E{r:T("77"+2W[1]),g:T("77"+2W[2]),b:T("77"+2W[3])};P E dm==1b?I:{r:1V,g:1V,b:1V}};k.fx.dD={5Q:1,5b:1,5O:1,4S:1,4D:1,4A:1,W:1,O:1,c3:1,iI:1,5k:1,5j:1,5z:1,5K:1,8b:1,6x:1,8c:1,av:1,1G:1,iE:1,iF:1,5n:1,4X:1,5U:1,5M:1,2L:1,jD:1,Q:1,Z:1,3I:1};k.fx.dA={7i:1,iG:1,iH:1,io:1,im:1,4x:1,i2:1};k.fx.8A=[\'i3\',\'i4\',\'i5\',\'i1\'];k.fx.cc={\'cd\':[\'2E\',\'dK\'],\'a8\':[\'2E\',\'bh\'],\'6w\':[\'6w\',\'\'],\'8F\':[\'8F\',\'\']};k.fn.23({5w:u(5X,H,G,J){E q.1w(u(){D a1=k.H(H,G,J);D e=12 k.dM(q,a1,5X)})},c4:u(H,J){E q.1w(u(){D a1=k.H(H,J);D e=12 k.c4(q,a1)})},8o:u(2D){E q.1E(u(){if(q.6d)k.by(q,2D)})},i0:u(2D){E q.1E(u(){if(q.6d)k.by(q,2D);if(q.1w&&q.1w[\'fx\'])q.1w.fx=[]})}});k.23({c4:u(2f,M){D z=q,3t;z.2D=u(){if(k.fQ(M.21))M.21.1D(2f)};z.2I=6V(u(){z.2D()},M.1m);2f.6d=z},G:{c8:u(p,n,1W,1H,1m){E((-18.5H(p*18.2Q)/2)+0.5)*1H+1W}},dM:u(2f,M,5X){D z=q,3t;D y=2f.14;D fR=k.B(2f,"2U");D 72=k.B(2f,"19");D 2j={};z.9O=(12 7g()).7z();M.G=M.G&&k.G[M.G]?M.G:\'c8\';z.ag=u(2w,43){if(k.fx.dD[2w]){if(43==\'1Y\'||43==\'2G\'||43==\'3R\'){if(!2f.6v)2f.6v={};D r=2m(k.6E(2f,2w));2f.6v[2w]=r&&r>-c9?r:(2m(k.B(2f,2w))||0);43=43==\'3R\'?(72==\'1o\'?\'1Y\':\'2G\'):43;M[43]=1b;2j[2w]=43==\'1Y\'?[0,2f.6v[2w]]:[2f.6v[2w],0];if(2w!=\'1G\')y[2w]=2j[2w][0]+(2w!=\'3I\'&&2w!=\'8Z\'?\'U\':\'\');P k.1p(y,"1G",2j[2w][0])}P{2j[2w]=[2m(k.6E(2f,2w)),2m(43)||0]}}P if(k.fx.dA[2w])2j[2w]=[k.fx.6D(k.6E(2f,2w)),k.fx.6D(43)];P if(/^6w$|8F$|2E$|a8$|cd$/i.48(2w)){D m=43.4E(/\\s+/g,\' \').4E(/6Y\\s*\\(\\s*/g,\'6Y(\').4E(/\\s*,\\s*/g,\',\').4E(/\\s*\\)/g,\')\').d5(/([^\\s]+)/g);3m(2w){1e\'6w\':1e\'8F\':1e\'cd\':1e\'a8\':m[3]=m[3]||m[1]||m[0];m[2]=m[2]||m[0];m[1]=m[1]||m[0];24(D i=0;i<k.fx.8A.1g;i++){D 64=k.fx.cc[2w][0]+k.fx.8A[i]+k.fx.cc[2w][1];2j[64]=2w==\'a8\'?[k.fx.6D(k.6E(2f,64)),k.fx.6D(m[i])]:[2m(k.6E(2f,64)),2m(m[i])]}1r;1e\'2E\':24(D i=0;i<m.1g;i++){D bd=2m(m[i]);D a9=!hX(bd)?\'dK\':(!/cu|1o|2K|hY|hZ|i6|i7|ii|ij|ik|il/i.48(m[i])?\'bh\':I);if(a9){24(D j=0;j<k.fx.8A.1g;j++){64=\'2E\'+k.fx.8A[j]+a9;2j[64]=a9==\'bh\'?[k.fx.6D(k.6E(2f,64)),k.fx.6D(m[i])]:[2m(k.6E(2f,64)),bd]}}P{y[\'ie\']=m[i]}}1r}}P{y[2w]=43}E I};24(p in 5X){if(p==\'14\'){D 5f=k.bl(5X[p]);24(7A in 5f){q.ag(7A,5f[7A])}}P if(p==\'3l\'){if(1h.af)24(D i=0;i<1h.af.1g;i++){D 7e=1h.af[i].7e||1h.af[i].i9||S;if(7e){24(D j=0;j<7e.1g;j++){if(7e[j].i8==\'.\'+5X[p]){D 6X=12 bb(\'\\.\'+5X[p]+\' {\');D 5Z=7e[j].14.9X;D 5f=k.bl(5Z.4E(6X,\'\').4E(/}/g,\'\'));24(7A in 5f){q.ag(7A,5f[7A])}}}}}}P{q.ag(p,5X[p])}}y.19=72==\'1o\'?\'2B\':72;y.2U=\'2K\';z.2D=u(){D t=(12 7g()).7z();if(t>M.1m+z.9O){5T(z.2I);z.2I=S;24(p in 2j){if(p=="1G")k.1p(y,"1G",2j[p][1]);P if(2g 2j[p][1]==\'8T\')y[p]=\'6Y(\'+2j[p][1].r+\',\'+2j[p][1].g+\',\'+2j[p][1].b+\')\';P y[p]=2j[p][1]+(p!=\'3I\'&&p!=\'8Z\'?\'U\':\'\')}if(M.2G||M.1Y)24(D p in 2f.6v)if(p=="1G")k.1p(y,p,2f.6v[p]);P y[p]="";y.19=M.2G?\'1o\':(72!=\'1o\'?72:\'2B\');y.2U=fR;2f.6d=S;if(k.fQ(M.21))M.21.1D(2f)}P{D n=t-q.9O;D 8w=n/M.1m;24(p in 2j){if(2g 2j[p][1]==\'8T\'){y[p]=\'6Y(\'+T(k.G[M.G](8w,n,2j[p][0].r,(2j[p][1].r-2j[p][0].r),M.1m))+\',\'+T(k.G[M.G](8w,n,2j[p][0].g,(2j[p][1].g-2j[p][0].g),M.1m))+\',\'+T(k.G[M.G](8w,n,2j[p][0].b,(2j[p][1].b-2j[p][0].b),M.1m))+\')\'}P{D bz=k.G[M.G](8w,n,2j[p][0],(2j[p][1]-2j[p][0]),M.1m);if(p=="1G")k.1p(y,"1G",bz);P y[p]=bz+(p!=\'3I\'&&p!=\'8Z\'?\'U\':\'\')}}}};z.2I=6V(u(){z.2D()},13);2f.6d=z},by:u(2f,2D){if(2D)2f.6d.9O-=iO;P{1X.5T(2f.6d.2I);2f.6d=S;k.2H(2f,"fx")}}});k.bl=u(5Z){D 5f={};if(2g 5Z==\'4V\'){5Z=5Z.6c().7C(\';\');24(D i=0;i<5Z.1g;i++){6X=5Z[i].7C(\':\');if(6X.1g==2){5f[k.g6(6X[0].4E(/\\-(\\w)/g,u(m,c){E c.jo()}))]=k.g6(6X[1])}}}E 5f};k.fn.23({g3:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.61(q,H,J,\'4F\',G)})},gb:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.61(q,H,J,\'4r\',G)})},jl:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.61(q,H,J,\'fJ\',G)})},jk:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.61(q,H,J,\'O\',G)})},jg:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.61(q,H,J,\'2L\',G)})},jf:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.61(q,H,J,\'fh\',G)})}});k.fx.61=u(e,H,J,2S,G){if(!k.4K(e)){k.2H(e,\'1n\');E I}D z=q;z.el=k(e);z.1N=k.1a.2o(e);z.G=2g J==\'4V\'?J:G||S;if(!e.4s)e.4s=z.el.B(\'19\');if(2S==\'fJ\'){2S=z.el.B(\'19\')==\'1o\'?\'4r\':\'4F\'}P if(2S==\'fh\'){2S=z.el.B(\'19\')==\'1o\'?\'2L\':\'O\'}z.el.1Y();z.H=H;z.J=2g J==\'u\'?J:S;z.fx=k.fx.9P(e);z.2S=2S;z.21=u(){if(z.J&&z.J.1K==2A){z.J.1D(z.el.K(0))}if(z.2S==\'4r\'||z.2S==\'2L\'){z.el.B(\'19\',z.el.K(0).4s==\'1o\'?\'2B\':z.el.K(0).4s)}P{z.el.2G()}k.fx.a0(z.fx.3p.K(0),z.fx.V);k.2H(z.el.K(0),\'1n\')};3m(z.2S){1e\'4F\':63=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G,z.21),\'W\');63.1L(z.fx.V.1q.hb,0);1r;1e\'4r\':z.fx.3p.B(\'W\',\'9R\');z.el.1Y();63=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G,z.21),\'W\');63.1L(0,z.fx.V.1q.hb);1r;1e\'O\':63=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G,z.21),\'Z\');63.1L(z.fx.V.1q.1C,0);1r;1e\'2L\':z.fx.3p.B(\'Z\',\'9R\');z.el.1Y();63=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G,z.21),\'Z\');63.1L(0,z.fx.V.1q.1C);1r}};k.fn.ji=u(5D,J){E q.1w(\'1n\',u(){if(!k.4K(q)){k.2H(q,\'1n\');E I}D e=12 k.fx.f4(q,5D,J);e.bp()})};k.fx.f4=u(e,5D,J){D z=q;z.el=k(e);z.el.1Y();z.J=J;z.5D=T(5D)||40;z.V={};z.V.Y=z.el.B(\'Y\');z.V.Q=T(z.el.B(\'Q\'))||0;z.V.O=T(z.el.B(\'O\'))||0;if(z.V.Y!=\'2s\'&&z.V.Y!=\'1P\'){z.el.B(\'Y\',\'2s\')}z.3V=5;z.5y=1;z.bp=u(){z.5y++;z.e=12 k.fx(z.el.K(0),{1m:jj,21:u(){z.e=12 k.fx(z.el.K(0),{1m:80,21:u(){z.5D=T(z.5D/2);if(z.5y<=z.3V)z.bp();P{z.el.B(\'Y\',z.V.Y).B(\'Q\',z.V.Q+\'U\').B(\'O\',z.V.O+\'U\');k.2H(z.el.K(0),\'1n\');if(z.J&&z.J.1K==2A){z.J.1D(z.el.K(0))}}}},\'Q\');z.e.1L(z.V.Q-z.5D,z.V.Q)}},\'Q\');z.e.1L(z.V.Q,z.V.Q-z.5D)}};k.fn.23({jy:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'4r\',\'4l\',G)})},jz:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'4r\',\'in\',G)})},jA:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'4r\',\'3R\',G)})},jB:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'4F\',\'4l\',G)})},jx:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'4F\',\'in\',G)})},jw:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'4F\',\'3R\',G)})},js:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'O\',\'4l\',G)})},jt:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'O\',\'in\',G)})},ju:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'O\',\'3R\',G)})},jv:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'2L\',\'4l\',G)})},je:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'2L\',\'in\',G)})},jd:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'2L\',\'3R\',G)})}});k.fx.4f=u(e,H,J,2S,1u,G){if(!k.4K(e)){k.2H(e,\'1n\');E I}D z=q;z.el=k(e);z.G=2g J==\'4V\'?J:G||S;z.V={};z.V.Y=z.el.B(\'Y\');z.V.Q=z.el.B(\'Q\');z.V.O=z.el.B(\'O\');if(!e.4s)e.4s=z.el.B(\'19\');if(1u==\'3R\'){1u=z.el.B(\'19\')==\'1o\'?\'in\':\'4l\'}z.el.1Y();if(z.V.Y!=\'2s\'&&z.V.Y!=\'1P\'){z.el.B(\'Y\',\'2s\')}z.1u=1u;J=2g J==\'u\'?J:S;8H=1;3m(2S){1e\'4F\':z.e=12 k.fx(z.el.K(0),k.H(H-15,z.G,J),\'Q\');z.62=2m(z.V.Q)||0;z.9K=z.fG;8H=-1;1r;1e\'4r\':z.e=12 k.fx(z.el.K(0),k.H(H-15,z.G,J),\'Q\');z.62=2m(z.V.Q)||0;z.9K=z.fG;1r;1e\'2L\':z.e=12 k.fx(z.el.K(0),k.H(H-15,z.G,J),\'O\');z.62=2m(z.V.O)||0;z.9K=z.fy;1r;1e\'O\':z.e=12 k.fx(z.el.K(0),k.H(H-15,z.G,J),\'O\');z.62=2m(z.V.O)||0;z.9K=z.fy;8H=-1;1r}z.e2=12 k.fx(z.el.K(0),k.H(H,z.G,u(){z.el.B(z.V);if(z.1u==\'4l\'){z.el.B(\'19\',\'1o\')}P z.el.B(\'19\',z.el.K(0).4s==\'1o\'?\'2B\':z.el.K(0).4s);k.2H(z.el.K(0),\'1n\')}),\'1G\');if(1u==\'in\'){z.e.1L(z.62+2a*8H,z.62);z.e2.1L(0,1)}P{z.e.1L(z.62,z.62+2a*8H);z.e2.1L(1,0)}};k.fn.23({j0:u(H,W,J,G){E q.1w(\'1n\',u(){12 k.fx.9L(q,H,W,J,\'fp\',G)})},iW:u(H,W,J,G){E q.1w(\'1n\',u(){12 k.fx.9L(q,H,W,J,\'9M\',G)})},iV:u(H,W,J,G){E q.1w(\'1n\',u(){12 k.fx.9L(q,H,W,J,\'3R\',G)})}});k.fx.9L=u(e,H,W,J,1u,G){if(!k.4K(e)){k.2H(e,\'1n\');E I}D z=q;z.el=k(e);z.G=2g J==\'4V\'?J:G||S;z.J=2g J==\'u\'?J:S;if(1u==\'3R\'){1u=z.el.B(\'19\')==\'1o\'?\'9M\':\'fp\'}z.H=H;z.W=W&&W.1K==bn?W:20;z.fx=k.fx.9P(e);z.1u=1u;z.21=u(){if(z.J&&z.J.1K==2A){z.J.1D(z.el.K(0))}if(z.1u==\'9M\'){z.el.1Y()}P{z.el.2G()}k.fx.a0(z.fx.3p.K(0),z.fx.V);k.2H(z.el.K(0),\'1n\')};if(z.1u==\'9M\'){z.el.1Y();z.fx.3p.B(\'W\',z.W+\'U\').B(\'Z\',\'9R\');z.ef=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G,u(){z.ef=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G,z.21),\'W\');z.ef.1L(z.W,z.fx.V.1q.hb)}),\'Z\');z.ef.1L(0,z.fx.V.1q.1C)}P{z.ef=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G,u(){z.ef=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G,z.21),\'Z\');z.ef.1L(z.fx.V.1q.1C,0)}),\'W\');z.ef.1L(z.fx.V.1q.hb,z.W)}};k.fn.iR=u(H,4x,J,G){E q.1w(\'fv\',u(){q.6W=k(q).1p("14")||\'\';G=2g J==\'4V\'?J:G||S;J=2g J==\'u\'?J:S;D 9S=k(q).B(\'7i\');D 8I=q.31;7d(9S==\'cu\'&&8I){9S=k(8I).B(\'7i\');8I=8I.31}k(q).B(\'7i\',4x);if(2g q.6W==\'8T\')q.6W=q.6W["9X"];k(q).5w({\'7i\':9S},H,G,u(){k.2H(q,\'fv\');if(2g k(q).1p("14")==\'8T\'){k(q).1p("14")["9X"]="";k(q).1p("14")["9X"]=q.6W}P{k(q).1p("14",q.6W)}if(J)J.1D(q)})})};k.fn.23({iT:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.5m(q,H,J,\'49\',\'6g\',G)})},iU:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.5m(q,H,J,\'4j\',\'6g\',G)})},j1:u(H,J,G){E q.1w(\'1n\',u(){if(k.B(q,\'19\')==\'1o\'){12 k.fx.5m(q,H,J,\'4j\',\'6Z\',G)}P{12 k.fx.5m(q,H,J,\'4j\',\'6g\',G)}})},j2:u(H,J,G){E q.1w(\'1n\',u(){if(k.B(q,\'19\')==\'1o\'){12 k.fx.5m(q,H,J,\'49\',\'6Z\',G)}P{12 k.fx.5m(q,H,J,\'49\',\'6g\',G)}})},j9:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.5m(q,H,J,\'49\',\'6Z\',G)})},ja:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.5m(q,H,J,\'4j\',\'6Z\',G)})}});k.fx.5m=u(e,H,J,2S,1u,G){if(!k.4K(e)){k.2H(e,\'1n\');E I}D z=q;D 73=I;z.el=k(e);z.G=2g J==\'4V\'?J:G||S;z.J=2g J==\'u\'?J:S;z.1u=1u;z.H=H;z.2i=k.1a.2o(e);z.V={};z.V.Y=z.el.B(\'Y\');z.V.19=z.el.B(\'19\');if(z.V.19==\'1o\'){5Y=z.el.B(\'3n\');z.el.1Y();73=1b}z.V.Q=z.el.B(\'Q\');z.V.O=z.el.B(\'O\');if(73){z.el.2G();z.el.B(\'3n\',5Y)}z.V.Z=z.2i.w+\'U\';z.V.W=z.2i.h+\'U\';z.V.2U=z.el.B(\'2U\');z.2i.Q=T(z.V.Q)||0;z.2i.O=T(z.V.O)||0;if(z.V.Y!=\'2s\'&&z.V.Y!=\'1P\'){z.el.B(\'Y\',\'2s\')}z.el.B(\'2U\',\'2K\').B(\'W\',1u==\'6Z\'&&2S==\'49\'?1:z.2i.h+\'U\').B(\'Z\',1u==\'6Z\'&&2S==\'4j\'?1:z.2i.w+\'U\');z.21=u(){z.el.B(z.V);if(z.1u==\'6g\')z.el.2G();P z.el.1Y();k.2H(z.el.K(0),\'1n\')};3m(2S){1e\'49\':z.eh=12 k.fx(z.el.K(0),k.H(H-15,z.G,J),\'W\');z.et=12 k.fx(z.el.K(0),k.H(z.H,z.G,z.21),\'Q\');if(z.1u==\'6g\'){z.eh.1L(z.2i.h,0);z.et.1L(z.2i.Q,z.2i.Q+z.2i.h/2)}P{z.eh.1L(0,z.2i.h);z.et.1L(z.2i.Q+z.2i.h/2,z.2i.Q)}1r;1e\'4j\':z.eh=12 k.fx(z.el.K(0),k.H(H-15,z.G,J),\'Z\');z.et=12 k.fx(z.el.K(0),k.H(z.H,z.G,z.21),\'O\');if(z.1u==\'6g\'){z.eh.1L(z.2i.w,0);z.et.1L(z.2i.O,z.2i.O+z.2i.w/2)}P{z.eh.1L(0,z.2i.w);z.et.1L(z.2i.O+z.2i.w/2,z.2i.O)}1r}};k.fn.bg=u(H,3V,J){E q.1w(\'1n\',u(){if(!k.4K(q)){k.2H(q,\'1n\');E I}D fx=12 k.fx.bg(q,H,3V,J);fx.bf()})};k.fx.bg=u(el,H,3V,J){D z=q;z.3V=3V;z.5y=1;z.el=el;z.H=H;z.J=J;k(z.el).1Y();z.bf=u(){z.5y++;z.e=12 k.fx(z.el,k.H(z.H,u(){z.ef=12 k.fx(z.el,k.H(z.H,u(){if(z.5y<=z.3V)z.bf();P{k.2H(z.el,\'1n\');if(z.J&&z.J.1K==2A){z.J.1D(z.el)}}}),\'1G\');z.ef.1L(0,1)}),\'1G\');z.e.1L(1,0)}};k.fn.23({jb:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.6G(q,H,1,2a,1b,J,\'fa\',G)})},jc:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.6G(q,H,2a,1,1b,J,\'b4\',G)})},j8:u(H,J,G){E q.1w(\'1n\',u(){D G=G||\'fl\';12 k.fx.6G(q,H,2a,f8,1b,J,\'6h\',G)})},6G:u(H,57,30,6H,J,G){E q.1w(\'1n\',u(){12 k.fx.6G(q,H,57,30,6H,J,\'6G\',G)})}});k.fx.6G=u(e,H,57,30,6H,J,1u,G){if(!k.4K(e)){k.2H(e,\'1n\');E I}D z=q;z.el=k(e);z.57=T(57)||2a;z.30=T(30)||2a;z.G=2g J==\'4V\'?J:G||S;z.J=2g J==\'u\'?J:S;z.1m=k.H(H).1m;z.6H=6H||S;z.2i=k.1a.2o(e);z.V={Z:z.el.B(\'Z\'),W:z.el.B(\'W\'),4A:z.el.B(\'4A\')||\'2a%\',Y:z.el.B(\'Y\'),19:z.el.B(\'19\'),Q:z.el.B(\'Q\'),O:z.el.B(\'O\'),2U:z.el.B(\'2U\'),4S:z.el.B(\'4S\'),5O:z.el.B(\'5O\'),5Q:z.el.B(\'5Q\'),5b:z.el.B(\'5b\'),5M:z.el.B(\'5M\'),5U:z.el.B(\'5U\'),5n:z.el.B(\'5n\'),4X:z.el.B(\'4X\')};z.Z=T(z.V.Z)||e.4c||0;z.W=T(z.V.W)||e.5W||0;z.Q=T(z.V.Q)||0;z.O=T(z.V.O)||0;1q=[\'em\',\'U\',\'j7\',\'%\'];24(i in 1q){if(z.V.4A.3J(1q[i])>0){z.fg=1q[i];z.4A=2m(z.V.4A)}if(z.V.4S.3J(1q[i])>0){z.fc=1q[i];z.bw=2m(z.V.4S)||0}if(z.V.5O.3J(1q[i])>0){z.fe=1q[i];z.bc=2m(z.V.5O)||0}if(z.V.5Q.3J(1q[i])>0){z.fL=1q[i];z.bA=2m(z.V.5Q)||0}if(z.V.5b.3J(1q[i])>0){z.g8=1q[i];z.bt=2m(z.V.5b)||0}if(z.V.5M.3J(1q[i])>0){z.g4=1q[i];z.bx=2m(z.V.5M)||0}if(z.V.5U.3J(1q[i])>0){z.g9=1q[i];z.bv=2m(z.V.5U)||0}if(z.V.5n.3J(1q[i])>0){z.gc=1q[i];z.bj=2m(z.V.5n)||0}if(z.V.4X.3J(1q[i])>0){z.fK=1q[i];z.b7=2m(z.V.4X)||0}}if(z.V.Y!=\'2s\'&&z.V.Y!=\'1P\'){z.el.B(\'Y\',\'2s\')}z.el.B(\'2U\',\'2K\');z.1u=1u;3m(z.1u){1e\'fa\':z.4b=z.Q+z.2i.h/2;z.5a=z.Q;z.4k=z.O+z.2i.w/2;z.59=z.O;1r;1e\'b4\':z.5a=z.Q+z.2i.h/2;z.4b=z.Q;z.59=z.O+z.2i.w/2;z.4k=z.O;1r;1e\'6h\':z.5a=z.Q-z.2i.h/4;z.4b=z.Q;z.59=z.O-z.2i.w/4;z.4k=z.O;1r}z.be=I;z.t=(12 7g).7z();z.4w=u(){5T(z.2I);z.2I=S};z.2D=u(){if(z.be==I){z.el.1Y();z.be=1b}D t=(12 7g).7z();D n=t-z.t;D p=n/z.1m;if(t>=z.1m+z.t){9T(u(){o=1;if(z.1u){t=z.5a;l=z.59;if(z.1u==\'6h\')o=0}z.bs(z.30,l,t,1b,o)},13);z.4w()}P{o=1;if(!k.G||!k.G[z.G]){s=((-18.5H(p*18.2Q)/2)+0.5)*(z.30-z.57)+z.57}P{s=k.G[z.G](p,n,z.57,(z.30-z.57),z.1m)}if(z.1u){if(!k.G||!k.G[z.G]){t=((-18.5H(p*18.2Q)/2)+0.5)*(z.5a-z.4b)+z.4b;l=((-18.5H(p*18.2Q)/2)+0.5)*(z.59-z.4k)+z.4k;if(z.1u==\'6h\')o=((-18.5H(p*18.2Q)/2)+0.5)*(-0.9Y)+0.9Y}P{t=k.G[z.G](p,n,z.4b,(z.5a-z.4b),z.1m);l=k.G[z.G](p,n,z.4k,(z.59-z.4k),z.1m);if(z.1u==\'6h\')o=k.G[z.G](p,n,0.9Y,-0.9Y,z.1m)}}z.bs(s,l,t,I,o)}};z.2I=6V(u(){z.2D()},13);z.bs=u(4q,O,Q,fM,1G){z.el.B(\'W\',z.W*4q/2a+\'U\').B(\'Z\',z.Z*4q/2a+\'U\').B(\'O\',O+\'U\').B(\'Q\',Q+\'U\').B(\'4A\',z.4A*4q/2a+z.fg);if(z.bw)z.el.B(\'4S\',z.bw*4q/2a+z.fc);if(z.bc)z.el.B(\'5O\',z.bc*4q/2a+z.fe);if(z.bA)z.el.B(\'5Q\',z.bA*4q/2a+z.fL);if(z.bt)z.el.B(\'5b\',z.bt*4q/2a+z.g8);if(z.bx)z.el.B(\'5M\',z.bx*4q/2a+z.g4);if(z.bv)z.el.B(\'5U\',z.bv*4q/2a+z.g9);if(z.bj)z.el.B(\'5n\',z.bj*4q/2a+z.gc);if(z.b7)z.el.B(\'4X\',z.b7*4q/2a+z.fK);if(z.1u==\'6h\'){if(1X.71)z.el.K(0).14.5E="8V(1G="+1G*2a+")";z.el.K(0).14.1G=1G}if(fM){if(z.6H){z.el.B(z.V)}if(z.1u==\'b4\'||z.1u==\'6h\'){z.el.B(\'19\',\'1o\');if(z.1u==\'6h\'){if(1X.71)z.el.K(0).14.5E="8V(1G="+2a+")";z.el.K(0).14.1G=1}}P z.el.B(\'19\',\'2B\');if(z.J)z.J.1D(z.el.K(0));k.2H(z.el.K(0),\'1n\')}}};k.fn.23({9U:u(H,1O,G){o=k.H(H);E q.1w(\'1n\',u(){12 k.fx.9U(q,o,1O,G)})},j6:u(H,1O,G){E q.1E(u(){k(\'a[@3h*="#"]\',q).5h(u(e){fW=q.3h.7C(\'#\');k(\'#\'+fW[1]).9U(H,1O,G);E I})})}});k.fx.9U=u(e,o,1O,G){D z=q;z.o=o;z.e=e;z.1O=/fT|gd/.48(1O)?1O:I;z.G=G;p=k.1a.3w(e);s=k.1a.6z();z.4w=u(){5T(z.2I);z.2I=S;k.2H(z.e,\'1n\')};z.t=(12 7g).7z();s.h=s.h>s.ih?(s.h-s.ih):s.h;s.w=s.w>s.iw?(s.w-s.iw):s.w;z.5a=p.y>s.h?s.h:p.y;z.59=p.x>s.w?s.w:p.x;z.4b=s.t;z.4k=s.l;z.2D=u(){D t=(12 7g).7z();D n=t-z.t;D p=n/z.o.1m;if(t>=z.o.1m+z.t){z.4w();9T(u(){z.d3(z.5a,z.59)},13)}P{if(!z.1O||z.1O==\'fT\'){if(!k.G||!k.G[z.G]){9V=((-18.5H(p*18.2Q)/2)+0.5)*(z.5a-z.4b)+z.4b}P{9V=k.G[z.G](p,n,z.4b,(z.5a-z.4b),z.o.1m)}}P{9V=z.4b}if(!z.1O||z.1O==\'gd\'){if(!k.G||!k.G[z.G]){9W=((-18.5H(p*18.2Q)/2)+0.5)*(z.59-z.4k)+z.4k}P{9W=k.G[z.G](p,n,z.4k,(z.59-z.4k),z.o.1m)}}P{9W=z.4k}z.d3(9V,9W)}};z.d3=u(t,l){1X.j4(l,t)};z.2I=6V(u(){z.2D()},13)};k.fn.cY=u(3V,J){E q.1w(\'1n\',u(){if(!k.4K(q)){k.2H(q,\'1n\');E I}D e=12 k.fx.cY(q,3V,J);e.cG()})};k.fx.cY=u(e,3V,J){D z=q;z.el=k(e);z.el.1Y();z.3V=T(3V)||3;z.J=J;z.5y=1;z.V={};z.V.Y=z.el.B(\'Y\');z.V.Q=T(z.el.B(\'Q\'))||0;z.V.O=T(z.el.B(\'O\'))||0;if(z.V.Y!=\'2s\'&&z.V.Y!=\'1P\'){z.el.B(\'Y\',\'2s\')}z.cG=u(){z.5y++;z.e=12 k.fx(z.el.K(0),{1m:60,21:u(){z.e=12 k.fx(z.el.K(0),{1m:60,21:u(){z.e=12 k.fx(e,{1m:60,21:u(){if(z.5y<=z.3V)z.cG();P{z.el.B(\'Y\',z.V.Y).B(\'Q\',z.V.Q+\'U\').B(\'O\',z.V.O+\'U\');k.2H(z.el.K(0),\'1n\');if(z.J&&z.J.1K==2A){z.J.1D(z.el.K(0))}}}},\'O\');z.e.1L(z.V.O-20,z.V.O)}},\'O\');z.e.1L(z.V.O+20,z.V.O-20)}},\'O\');z.e.1L(z.V.O,z.V.O+20)}};k.fn.23({fo:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'4F\',\'in\',G)})},fq:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'4F\',\'4l\',G)})},iY:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'4F\',\'3R\',G)})},iX:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'4r\',\'in\',G)})},jr:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'4r\',\'4l\',G)})},jq:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'4r\',\'3R\',G)})},jp:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'O\',\'in\',G)})},jn:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'O\',\'4l\',G)})},jm:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'O\',\'3R\',G)})},iP:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'2L\',\'in\',G)})},ic:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'2L\',\'4l\',G)})},ib:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'2L\',\'3R\',G)})}});k.fx.1z=u(e,H,J,2S,1u,G){if(!k.4K(e)){k.2H(e,\'1n\');E I}D z=q;z.el=k(e);z.G=2g J==\'4V\'?J:G||S;z.J=2g J==\'u\'?J:S;if(1u==\'3R\'){1u=z.el.B(\'19\')==\'1o\'?\'in\':\'4l\'}if(!e.4s)e.4s=z.el.B(\'19\');z.el.1Y();z.H=H;z.fx=k.fx.9P(e);z.1u=1u;z.2S=2S;z.21=u(){if(z.1u==\'4l\')z.el.B(\'3n\',\'2K\');k.fx.a0(z.fx.3p.K(0),z.fx.V);if(z.1u==\'in\'){z.el.B(\'19\',z.el.K(0).4s==\'1o\'?\'2B\':z.el.K(0).4s)}P{z.el.B(\'19\',\'1o\');z.el.B(\'3n\',\'dd\')}if(z.J&&z.J.1K==2A){z.J.1D(z.el.K(0))}k.2H(z.el.K(0),\'1n\')};3m(z.2S){1e\'4F\':z.ef=12 k.fx(z.el.K(0),k.H(z.H,z.G,z.21),\'Q\');z.7v=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G),\'W\');if(z.1u==\'in\'){z.ef.1L(-z.fx.V.1q.hb,0);z.7v.1L(0,z.fx.V.1q.hb)}P{z.ef.1L(0,-z.fx.V.1q.hb);z.7v.1L(z.fx.V.1q.hb,0)}1r;1e\'4r\':z.ef=12 k.fx(z.el.K(0),k.H(z.H,z.G,z.21),\'Q\');if(z.1u==\'in\'){z.ef.1L(z.fx.V.1q.hb,0)}P{z.ef.1L(0,z.fx.V.1q.hb)}1r;1e\'O\':z.ef=12 k.fx(z.el.K(0),k.H(z.H,z.G,z.21),\'O\');z.7v=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G),\'Z\');if(z.1u==\'in\'){z.ef.1L(-z.fx.V.1q.1C,0);z.7v.1L(0,z.fx.V.1q.1C)}P{z.ef.1L(0,-z.fx.V.1q.1C);z.7v.1L(z.fx.V.1q.1C,0)}1r;1e\'2L\':z.ef=12 k.fx(z.el.K(0),k.H(z.H,z.G,z.21),\'O\');if(z.1u==\'in\'){z.ef.1L(z.fx.V.1q.1C,0)}P{z.ef.1L(0,z.fx.V.1q.1C)}1r}};k.3f=S;k.fn.ig=u(o){E q.1w(\'1n\',u(){12 k.fx.dG(q,o)})};k.fx.dG=u(e,o){if(k.3f==S){k(\'2e\',1h).1S(\'<22 id="3f"></22>\');k.3f=k(\'#3f\')}k.3f.B(\'19\',\'2B\').B(\'Y\',\'1P\');D z=q;z.el=k(e);if(!o||!o.30){E}if(o.30.1K==b0&&1h.9e(o.30)){o.30=1h.9e(o.30)}P if(!o.30.dq){E}if(!o.1m){o.1m=g5}z.1m=o.1m;z.30=o.30;z.8r=o.3l;z.21=o.21;if(z.8r){k.3f.2R(z.8r)}z.a3=0;z.a2=0;if(k.dF){z.a3=(T(k.3f.B(\'5b\'))||0)+(T(k.3f.B(\'5O\'))||0)+(T(k.3f.B(\'4X\'))||0)+(T(k.3f.B(\'5U\'))||0);z.a2=(T(k.3f.B(\'4S\'))||0)+(T(k.3f.B(\'5Q\'))||0)+(T(k.3f.B(\'5M\'))||0)+(T(k.3f.B(\'5n\'))||0)}z.26=k.23(k.1a.3w(z.el.K(0)),k.1a.2o(z.el.K(0)));z.2T=k.23(k.1a.3w(z.30),k.1a.2o(z.30));z.26.1C-=z.a3;z.26.hb-=z.a2;z.2T.1C-=z.a3;z.2T.hb-=z.a2;z.J=o.21;k.3f.B(\'Z\',z.26.1C+\'U\').B(\'W\',z.26.hb+\'U\').B(\'Q\',z.26.y+\'U\').B(\'O\',z.26.x+\'U\').5w({Q:z.2T.y,O:z.2T.x,Z:z.2T.1C,W:z.2T.hb},z.1m,u(){if(z.8r)k.3f.4i(z.8r);k.3f.B(\'19\',\'1o\');if(z.21&&z.21.1K==2A){z.21.1D(z.el.K(0),[z.30])}k.2H(z.el.K(0),\'1n\')})};k.1v={M:{2E:10,ec:\'1Q/iJ.eZ\',e3:\'<1T 2J="1Q/6g.da" />\',eW:0.8,d8:\'iN a6\',dc:\'57\',3W:8J},jQ:I,jW:I,6j:S,8m:I,8k:I,d1:u(2k){if(!k.1v.8k||k.1v.8m)E;D 3K=2k.7L||2k.7K||-1;3m(3K){1e 35:if(k.1v.6j)k.1v.26(S,k(\'a[@4I=\'+k.1v.6j+\']:jJ\').K(0));1r;1e 36:if(k.1v.6j)k.1v.26(S,k(\'a[@4I=\'+k.1v.6j+\']:jL\').K(0));1r;1e 37:1e 8:1e 33:1e 80:1e kb:D 9p=k(\'#87\');if(9p.K(0).53!=S){9p.K(0).53.1D(9p.K(0))}1r;1e 38:1r;1e 39:1e 34:1e 32:1e gl:1e 78:D 9k=k(\'#88\');if(9k.K(0).53!=S){9k.K(0).53.1D(9k.K(0))}1r;1e 40:1r;1e 27:k.1v.au();1r}},7q:u(M){if(M)k.23(k.1v.M,M);if(1X.2k){k(\'2e\',1h).1J(\'6y\',k.1v.d1)}P{k(1h).1J(\'6y\',k.1v.d1)}k(\'a\').1E(u(){el=k(q);en=el.1p(\'4I\')||\'\';e9=el.1p(\'3h\')||\'\';ev=/\\.da|\\.gw|\\.8X|\\.eZ|\\.gn/g;if(e9.6c().d5(ev)!=S&&en.6c().3J(\'eU\')==0){el.1J(\'5h\',k.1v.26)}});if(k.3a.4t){3A=1h.3F(\'3A\');k(3A).1p({id:\'cN\',2J:\'ek:I;\',ej:\'cD\',ep:\'cD\'}).B({19:\'1o\',Y:\'1P\',Q:\'0\',O:\'0\',5E:\'9n:9w.9y.cC(1G=0)\'});k(\'2e\').1S(3A)}8n=1h.3F(\'22\');k(8n).1p(\'id\',\'cP\').B({Y:\'1P\',19:\'1o\',Q:\'0\',O:\'0\',1G:0}).1S(1h.8M(\' \')).1J(\'5h\',k.1v.au);6A=1h.3F(\'22\');k(6A).1p(\'id\',\'eK\').B({4X:k.1v.M.2E+\'U\'}).1S(1h.8M(\' \'));cE=1h.3F(\'22\');k(cE).1p(\'id\',\'dg\').B({4X:k.1v.M.2E+\'U\',5n:k.1v.M.2E+\'U\'}).1S(1h.8M(\' \'));cF=1h.3F(\'a\');k(cF).1p({id:\'gg\',3h:\'#\'}).B({Y:\'1P\',2L:k.1v.M.2E+\'U\',Q:\'0\'}).1S(k.1v.M.e3).1J(\'5h\',k.1v.au);7m=1h.3F(\'22\');k(7m).1p(\'id\',\'cM\').B({Y:\'2s\',cA:\'O\',6w:\'0 9F\',3I:1}).1S(6A).1S(cE).1S(cF);2b=1h.3F(\'1T\');2b.2J=k.1v.M.ec;k(2b).1p(\'id\',\'eM\').B({Y:\'1P\'});4G=1h.3F(\'a\');k(4G).1p({id:\'87\',3h:\'#\'}).B({Y:\'1P\',19:\'1o\',2U:\'2K\',ey:\'1o\'}).1S(1h.8M(\' \'));4M=1h.3F(\'a\');k(4M).1p({id:\'88\',3h:\'#\'}).B({Y:\'1P\',2U:\'2K\',ey:\'1o\'}).1S(1h.8M(\' \'));1Z=1h.3F(\'22\');k(1Z).1p(\'id\',\'eE\').B({19:\'1o\',Y:\'2s\',2U:\'2K\',cA:\'O\',6w:\'0 9F\',Q:\'0\',O:\'0\',3I:2}).1S([2b,4G,4M]);6F=1h.3F(\'22\');k(6F).1p(\'id\',\'ao\').B({19:\'1o\',Y:\'1P\',2U:\'2K\',Q:\'0\',O:\'0\',cA:\'cv\',7i:\'cu\',hC:\'0\'}).1S([1Z,7m]);k(\'2e\').1S(8n).1S(6F)},26:u(e,C){el=C?k(C):k(q);9t=el.1p(\'4I\');D 6B,4u,4G,4M;if(9t!=\'eU\'){k.1v.6j=9t;8Y=k(\'a[@4I=\'+9t+\']\');6B=8Y.1N();4u=8Y.cZ(C?C:q);4G=8Y.K(4u-1);4M=8Y.K(4u+1)}89=el.1p(\'3h\');6A=el.1p(\'4g\');3O=k.1a.6z();8n=k(\'#cP\');if(!k.1v.8k){k.1v.8k=1b;if(k.3a.4t){k(\'#cN\').B(\'W\',18.3r(3O.ih,3O.h)+\'U\').B(\'Z\',18.3r(3O.iw,3O.w)+\'U\').1Y()}8n.B(\'W\',18.3r(3O.ih,3O.h)+\'U\').B(\'Z\',18.3r(3O.iw,3O.w)+\'U\').1Y().fX(cO,k.1v.M.eW,u(){k.1v.cw(89,6A,3O,6B,4u,4G,4M)});k(\'#ao\').B(\'Z\',18.3r(3O.iw,3O.w)+\'U\')}P{k(\'#87\').K(0).53=S;k(\'#88\').K(0).53=S;k.1v.cw(89,6A,3O,6B,4u,4G,4M)}E I},cw:u(89,gP,3O,6B,4u,4G,4M){k(\'#cW\').bk();aX=k(\'#87\');aX.2G();aO=k(\'#88\');aO.2G();2b=k(\'#eM\');1Z=k(\'#eE\');6F=k(\'#ao\');7m=k(\'#cM\').B(\'3n\',\'2K\');k(\'#eK\').3x(6A);k.1v.8m=1b;if(6B)k(\'#dg\').3x(k.1v.M.d8+\' \'+(4u+1)+\' \'+k.1v.M.dc+\' \'+6B);if(4G){aX.K(0).53=u(){q.5B();k.1v.26(S,4G);E I}}if(4M){aO.K(0).53=u(){q.5B();k.1v.26(S,4M);E I}}2b.1Y();82=k.1a.2o(1Z.K(0));56=18.3r(82.1C,2b.K(0).Z+k.1v.M.2E*2);6f=18.3r(82.hb,2b.K(0).W+k.1v.M.2E*2);2b.B({O:(56-2b.K(0).Z)/2+\'U\',Q:(6f-2b.K(0).W)/2+\'U\'});1Z.B({Z:56+\'U\',W:6f+\'U\'}).1Y();dw=k.1a.bm();6F.B(\'Q\',3O.t+(dw.h/15)+\'U\');if(6F.B(\'19\')==\'1o\'){6F.1Y().7f(k.1v.M.3W)}6k=12 9s;k(6k).1p(\'id\',\'cW\').1J(\'hJ\',u(){56=6k.Z+k.1v.M.2E*2;6f=6k.W+k.1v.M.2E*2;2b.2G();1Z.5w({W:6f},82.hb!=6f?k.1v.M.3W:1,u(){1Z.5w({Z:56},82.1C!=56?k.1v.M.3W:1,u(){1Z.bG(6k);k(6k).B({Y:\'1P\',O:k.1v.M.2E+\'U\',Q:k.1v.M.2E+\'U\'}).7f(k.1v.M.3W,u(){db=k.1a.2o(7m.K(0));if(4G){aX.B({O:k.1v.M.2E+\'U\',Q:k.1v.M.2E+\'U\',Z:56/2-k.1v.M.2E*3+\'U\',W:6f-k.1v.M.2E*2+\'U\'}).1Y()}if(4M){aO.B({O:56/2+k.1v.M.2E*2+\'U\',Q:k.1v.M.2E+\'U\',Z:56/2-k.1v.M.2E*3+\'U\',W:6f-k.1v.M.2E*2+\'U\'}).1Y()}7m.B({Z:56+\'U\',Q:-db.hb+\'U\',3n:\'dd\'}).5w({Q:-1},k.1v.M.3W,u(){k.1v.8m=I})})})})});6k.2J=89},au:u(){k(\'#cW\').bk();k(\'#ao\').2G();k(\'#cM\').B(\'3n\',\'2K\');k(\'#cP\').fX(cO,0,u(){k(q).2G();if(k.3a.4t){k(\'#cN\').2G()}});k(\'#87\').K(0).53=S;k(\'#88\').K(0).53=S;k.1v.6j=S;k.1v.8k=I;k.1v.8m=I;E I}};k.R={1A:S,41:S,F:S,1s:S,1q:S,Y:S,9a:u(e){k.R.F=(q.d0)?q.d0:q;k.R.1s=k.1a.4a(e);k.R.1q={Z:T(k(k.R.F).B(\'Z\'))||0,W:T(k(k.R.F).B(\'W\'))||0};k.R.Y={Q:T(k(k.R.F).B(\'Q\'))||0,O:T(k(k.R.F).B(\'O\'))||0};k(1h).1J(\'3D\',k.R.cR).1J(\'5P\',k.R.cK);if(2g k.R.F.1k.g2===\'u\'){k.R.F.1k.g2.1D(k.R.F)}E I},cK:u(e){k(1h).3q(\'3D\',k.R.cR).3q(\'5P\',k.R.cK);if(2g k.R.F.1k.fN===\'u\'){k.R.F.1k.fN.1D(k.R.F)}k.R.F=S},cR:u(e){if(!k.R.F){E}1s=k.1a.4a(e);7p=k.R.Y.Q-k.R.1s.y+1s.y;7r=k.R.Y.O-k.R.1s.x+1s.x;7p=18.3r(18.3L(7p,k.R.F.1k.8g-k.R.1q.W),k.R.F.1k.7h);7r=18.3r(18.3L(7r,k.R.F.1k.8h-k.R.1q.Z),k.R.F.1k.70);if(2g k.R.F.1k.4m===\'u\'){D 8a=k.R.F.1k.4m.1D(k.R.F,[7r,7p]);if(2g 8a==\'hh\'&&8a.1g==2){7r=8a[0];7p=8a[1]}}k.R.F.14.Q=7p+\'U\';k.R.F.14.O=7r+\'U\';E I},26:u(e){k(1h).1J(\'3D\',k.R.8j).1J(\'5P\',k.R.8o);k.R.1A=q.1A;k.R.41=q.41;k.R.1s=k.1a.4a(e);k.R.1q={Z:T(k(q.1A).B(\'Z\'))||0,W:T(k(q.1A).B(\'W\'))||0};k.R.Y={Q:T(k(q.1A).B(\'Q\'))||0,O:T(k(q.1A).B(\'O\'))||0};if(k.R.1A.1k.4o){k.R.1A.1k.4o.1D(k.R.1A,[q])}E I},8o:u(){k(1h).3q(\'3D\',k.R.8j).3q(\'5P\',k.R.8o);if(k.R.1A.1k.3T){k.R.1A.1k.3T.1D(k.R.1A,[k.R.41])}k.R.1A=S;k.R.41=S},6i:u(dx,az){E 18.3L(18.3r(k.R.1q.Z+dx*az,k.R.1A.1k.av),k.R.1A.1k.6x)},6m:u(dy,az){E 18.3L(18.3r(k.R.1q.W+dy*az,k.R.1A.1k.8c),k.R.1A.1k.8b)},fb:u(W){E 18.3L(18.3r(W,k.R.1A.1k.8c),k.R.1A.1k.8b)},8j:u(e){if(k.R.1A==S){E}1s=k.1a.4a(e);dx=1s.x-k.R.1s.x;dy=1s.y-k.R.1s.y;1I={Z:k.R.1q.Z,W:k.R.1q.W};2z={Q:k.R.Y.Q,O:k.R.Y.O};3m(k.R.41){1e\'e\':1I.Z=k.R.6i(dx,1);1r;1e\'fj\':1I.Z=k.R.6i(dx,1);1I.W=k.R.6m(dy,1);1r;1e\'w\':1I.Z=k.R.6i(dx,-1);2z.O=k.R.Y.O-1I.Z+k.R.1q.Z;1r;1e\'5F\':1I.Z=k.R.6i(dx,-1);2z.O=k.R.Y.O-1I.Z+k.R.1q.Z;1I.W=k.R.6m(dy,1);1r;1e\'76\':1I.W=k.R.6m(dy,-1);2z.Q=k.R.Y.Q-1I.W+k.R.1q.W;1I.Z=k.R.6i(dx,-1);2z.O=k.R.Y.O-1I.Z+k.R.1q.Z;1r;1e\'n\':1I.W=k.R.6m(dy,-1);2z.Q=k.R.Y.Q-1I.W+k.R.1q.W;1r;1e\'at\':1I.W=k.R.6m(dy,-1);2z.Q=k.R.Y.Q-1I.W+k.R.1q.W;1I.Z=k.R.6i(dx,1);1r;1e\'s\':1I.W=k.R.6m(dy,1);1r}if(k.R.1A.1k.4v){if(k.R.41==\'n\'||k.R.41==\'s\')4p=1I.W*k.R.1A.1k.4v;P 4p=1I.Z;4W=k.R.fb(4p*k.R.1A.1k.4v);4p=4W/k.R.1A.1k.4v;3m(k.R.41){1e\'n\':1e\'76\':1e\'at\':2z.Q+=1I.W-4W;1r}3m(k.R.41){1e\'76\':1e\'w\':1e\'5F\':2z.O+=1I.Z-4p;1r}1I.W=4W;1I.Z=4p}if(2z.Q<k.R.1A.1k.7h){4W=1I.W+2z.Q-k.R.1A.1k.7h;2z.Q=k.R.1A.1k.7h;if(k.R.1A.1k.4v){4p=4W/k.R.1A.1k.4v;3m(k.R.41){1e\'76\':1e\'w\':1e\'5F\':2z.O+=1I.Z-4p;1r}1I.Z=4p}1I.W=4W}if(2z.O<k.R.1A.1k.70){4p=1I.Z+2z.O-k.R.1A.1k.70;2z.O=k.R.1A.1k.70;if(k.R.1A.1k.4v){4W=4p*k.R.1A.1k.4v;3m(k.R.41){1e\'n\':1e\'76\':1e\'at\':2z.Q+=1I.W-4W;1r}1I.W=4W}1I.Z=4p}if(2z.Q+1I.W>k.R.1A.1k.8g){1I.W=k.R.1A.1k.8g-2z.Q;if(k.R.1A.1k.4v){1I.Z=1I.W/k.R.1A.1k.4v}}if(2z.O+1I.Z>k.R.1A.1k.8h){1I.Z=k.R.1A.1k.8h-2z.O;if(k.R.1A.1k.4v){1I.W=1I.Z*k.R.1A.1k.4v}}D 6p=I;if(k.R.1A.1k.f7){6p=k.R.1A.1k.f7.1D(k.R.1A,[1I,2z]);if(6p){if(6p.1q){k.23(1I,6p.1q)}if(6p.Y){k.23(2z,6p.Y)}}}8d=k.R.1A.14;8d.O=2z.O+\'U\';8d.Q=2z.Q+\'U\';8d.Z=1I.Z+\'U\';8d.W=1I.W+\'U\';E I},2r:u(M){if(!M||!M.3Z||M.3Z.1K!=7M){E}E q.1E(u(){D el=q;el.1k=M;el.1k.av=M.av||10;el.1k.8c=M.8c||10;el.1k.6x=M.6x||6P;el.1k.8b=M.8b||6P;el.1k.7h=M.7h||-aC;el.1k.70=M.70||-aC;el.1k.8h=M.8h||6P;el.1k.8g=M.8g||6P;d6=k(el).B(\'Y\');if(!(d6==\'2s\'||d6==\'1P\')){el.14.Y=\'2s\'}fS=/n|at|e|fj|s|5F|w|76/g;24(i in el.1k.3Z){if(i.6c().d5(fS)!=S){if(el.1k.3Z[i].1K==b0){3v=k(el.1k.3Z[i]);if(3v.1N()>0){el.1k.3Z[i]=3v.K(0)}}if(el.1k.3Z[i].4Y){el.1k.3Z[i].1A=el;el.1k.3Z[i].41=i;k(el.1k.3Z[i]).1J(\'5v\',k.R.26)}}}if(el.1k.5S){if(2g el.1k.5S===\'4V\'){aV=k(el.1k.5S);if(aV.1N()>0){aV.1E(u(){q.d0=el});aV.1J(\'5v\',k.R.9a)}}P if(el.1k.5S==1b){k(q).1J(\'5v\',k.R.9a)}}})},4U:u(){E q.1E(u(){D el=q;24(i in el.1k.3Z){el.1k.3Z[i].1A=S;el.1k.3Z[i].41=S;k(el.1k.3Z[i]).3q(\'5v\',k.R.26)}if(el.1k.5S){if(2g el.1k.5S===\'4V\'){3v=k(el.1k.5S);if(3v.1N()>0){3v.3q(\'5v\',k.R.9a)}}P if(el.1k.5S==1b){k(q).3q(\'5v\',k.R.9a)}}el.1k=S})}};k.fn.23({hz:k.R.2r,hs:k.R.4U});k.2C=S;k.7n=I;k.3k=S;k.7o=[];k.9v=u(e){D 3K=e.7L||e.7K||-1;if(3K==17||3K==16){k.7n=1b}};k.9u=u(e){k.7n=I};k.dL=u(e){q.f.1s=k.1a.4a(e);q.f.1M=k.23(k.1a.3w(q),k.1a.2o(q));q.f.3e=k.1a.6z(q);q.f.1s.x-=q.f.1M.x;q.f.1s.y-=q.f.1M.y;k(q).1S(k.2C.K(0));if(q.f.hc)k.2C.2R(q.f.hc).B(\'19\',\'2B\');k.2C.B({19:\'2B\',Z:\'2P\',W:\'2P\'});if(q.f.o){k.2C.B(\'1G\',q.f.o)}k.3k=q;k.96=I;k.7o=[];q.f.el.1E(u(){q.1M={x:q.8t+(q.4Z&&!k.3a.7I?T(q.4Z.5b)||0:0)+(k.3k.3c||0),y:q.8G+(q.4Z&&!k.3a.7I?T(q.4Z.4S)||0:0)+(k.3k.3d||0),1C:q.4c,hb:q.5W};if(q.s==1b){if(k.7n==I){q.s=I;k(q).4i(k.3k.f.7j)}P{k.96=1b;k.7o[k.7o.1g]=k.1p(q,\'id\')}}});k.am.1D(q,[e]);k(1h).1J(\'3D\',k.am).1J(\'5P\',k.cX);E I};k.am=u(e){if(!k.3k)E;k.fd.1D(k.3k,[e])};k.fd=u(e){if(!k.3k)E;D 1s=k.1a.4a(e);D 3e=k.1a.6z(k.3k);1s.x+=3e.l-q.f.3e.l-q.f.1M.x;1s.y+=3e.t-q.f.3e.t-q.f.1M.y;D 93=18.3L(1s.x,q.f.1s.x);D 5F=18.3L(18.3S(1s.x-q.f.1s.x),18.3S(q.f.3e.w-93));D 99=18.3L(1s.y,q.f.1s.y);D 9g=18.3L(18.3S(1s.y-q.f.1s.y),18.3S(q.f.3e.h-99));if(q.3d>0&&1s.y-20<q.3d){D 3X=18.3L(3e.t,10);99-=3X;9g+=3X;q.3d-=3X}P if(q.3d+q.f.1M.h<q.f.3e.h&&1s.y+20>q.3d+q.f.1M.h){D 3X=18.3L(q.f.3e.h-q.3d,10);q.3d+=3X;if(q.3d!=3e.t)9g+=3X}if(q.3c>0&&1s.x-20<q.3c){D 3X=18.3L(3e.l,10);93-=3X;5F+=3X;q.3c-=3X}P if(q.3c+q.f.1M.w<q.f.3e.w&&1s.x+20>q.3c+q.f.1M.w){D 3X=18.3L(q.f.3e.w-q.3c,10);q.3c+=3X;if(q.3c!=3e.l)5F+=3X}k.2C.B({O:93+\'U\',Q:99+\'U\',Z:5F+\'U\',W:9g+\'U\'});k.2C.l=93+q.f.3e.l;k.2C.t=99+q.f.3e.t;k.2C.r=k.2C.l+5F;k.2C.b=k.2C.t+9g;k.96=I;q.f.el.1E(u(){aw=k.7o.3J(k.1p(q,\'id\'));if(!(q.1M.x>k.2C.r||(q.1M.x+q.1M.1C)<k.2C.l||q.1M.y>k.2C.b||(q.1M.y+q.1M.hb)<k.2C.t)){k.96=1b;if(q.s!=1b){q.s=1b;k(q).2R(k.3k.f.7j)}if(aw!=-1){q.s=I;k(q).4i(k.3k.f.7j)}}P if((q.s==1b)&&(aw==-1)){q.s=I;k(q).4i(k.3k.f.7j)}P if((!q.s)&&(k.7n==1b)&&(aw!=-1)){q.s=1b;k(q).2R(k.3k.f.7j)}});E I};k.cX=u(e){if(!k.3k)E;k.g0.1D(k.3k,[e])};k.g0=u(e){k(1h).3q(\'3D\',k.am).3q(\'5P\',k.cX);if(!k.3k)E;k.2C.B(\'19\',\'1o\');if(q.f.hc)k.2C.4i(q.f.hc);k.3k=I;k(\'2e\').1S(k.2C.K(0));if(k.96==1b){if(q.f.98)q.f.98(k.cJ(k.1p(q,\'id\')))}P{if(q.f.9d)q.f.9d(k.cJ(k.1p(q,\'id\')))}k.7o=[]};k.cJ=u(s){D h=\'\';D o=[];if(a=k(\'#\'+s)){a.K(0).f.el.1E(u(){if(q.s==1b){if(h.1g>0){h+=\'&\'}h+=s+\'[]=\'+k.1p(q,\'id\');o[o.1g]=k.1p(q,\'id\')}})}E{7l:h,o:o}};k.fn.gZ=u(o){if(!k.2C){k(\'2e\',1h).1S(\'<22 id="2C"></22>\').1J(\'7B\',k.9v).1J(\'6y\',k.9u);k.2C=k(\'#2C\');k.2C.B({Y:\'1P\',19:\'1o\'});if(1X.2k){k(\'2e\',1h).1J(\'7B\',k.9v).1J(\'6y\',k.9u)}P{k(1h).1J(\'7B\',k.9v).1J(\'6y\',k.9u)}}if(!o){o={}}E q.1E(u(){if(q.eP)E;q.eP=1b;q.f={a:o.3C,o:o.1G?2m(o.1G):I,7j:o.eS?o.eS:I,hc:o.58?o.58:I,98:o.98?o.98:I,9d:o.9d?o.9d:I};q.f.el=k(\'.\'+o.3C);k(q).1J(\'5v\',k.dL).B(\'Y\',\'2s\')})};k.3b={bM:1,eH:u(3t){D 3t=3t;E q.1E(u(){q.4z.6s.1E(u(ab){k.3b.5c(q,3t[ab])})})},K:u(){D 3t=[];q.1E(u(cL){if(q.bI){3t[cL]=[];D C=q;D 1q=k.1a.2o(q);q.4z.6s.1E(u(ab){D x=q.8t;D y=q.8G;92=T(x*2a/(1q.w-q.4c));91=T(y*2a/(1q.h-q.5W));3t[cL][ab]=[92||0,91||0,x||0,y||0]})}});E 3t},ct:u(C){C.A.fu=C.A.28.w-C.A.1B.1C;C.A.fw=C.A.28.h-C.A.1B.hb;if(C.9r.4z.bC){9Z=C.9r.4z.6s.K(C.bF+1);if(9Z){C.A.28.w=(T(k(9Z).B(\'O\'))||0)+C.A.1B.1C;C.A.28.h=(T(k(9Z).B(\'Q\'))||0)+C.A.1B.hb}9Q=C.9r.4z.6s.K(C.bF-1);if(9Q){D cU=T(k(9Q).B(\'O\'))||0;D cH=T(k(9Q).B(\'O\'))||0;C.A.28.x+=cU;C.A.28.y+=cH;C.A.28.w-=cU;C.A.28.h-=cH}}C.A.g7=C.A.28.w-C.A.1B.1C;C.A.eC=C.A.28.h-C.A.1B.hb;if(C.A.2O){C.A.gx=((C.A.28.w-C.A.1B.1C)/C.A.2O)||1;C.A.gy=((C.A.28.h-C.A.1B.hb)/C.A.2O)||1;C.A.fU=C.A.g7/C.A.2O;C.A.fH=C.A.eC/C.A.2O}C.A.28.dx=C.A.28.x-C.A.2c.x;C.A.28.dy=C.A.28.y-C.A.2c.y;k.11.1c.B(\'9b\',\'ad\')},3H:u(C,x,y){if(C.A.2O){fE=T(x/C.A.fU);92=fE*2a/C.A.2O;ft=T(y/C.A.fH);91=ft*2a/C.A.2O}P{92=T(x*2a/C.A.fu);91=T(y*2a/C.A.fw)}C.A.b3=[92||0,91||0,x||0,y||0];if(C.A.3H)C.A.3H.1D(C,C.A.b3)},eI:u(2k){3K=2k.7L||2k.7K||-1;3m(3K){1e 35:k.3b.5c(q.3U,[ae,ae]);1r;1e 36:k.3b.5c(q.3U,[-ae,-ae]);1r;1e 37:k.3b.5c(q.3U,[-q.3U.A.gx||-1,0]);1r;1e 38:k.3b.5c(q.3U,[0,-q.3U.A.gy||-1]);1r;1e 39:k.3b.5c(q.3U,[q.3U.A.gx||1,0]);1r;1e 40:k.11.5c(q.3U,[0,q.3U.A.gy||1]);1r}},5c:u(C,Y){if(!C.A){E}C.A.1B=k.23(k.1a.3w(C),k.1a.2o(C));C.A.2c={x:T(k.B(C,\'O\'))||0,y:T(k.B(C,\'Q\'))||0};C.A.4n=k.B(C,\'Y\');if(C.A.4n!=\'2s\'&&C.A.4n!=\'1P\'){C.14.Y=\'2s\'}k.11.c5(C);k.3b.ct(C);dx=T(Y[0])||0;dy=T(Y[1])||0;2v=C.A.2c.x+dx;2q=C.A.2c.y+dy;if(C.A.2O){3y=k.11.c7.1D(C,[2v,2q,dx,dy]);if(3y.1K==7M){dx=3y.dx;dy=3y.dy}2v=C.A.2c.x+dx;2q=C.A.2c.y+dy}3y=k.11.ce.1D(C,[2v,2q,dx,dy]);if(3y&&3y.1K==7M){dx=3y.dx;dy=3y.dy}2v=C.A.2c.x+dx;2q=C.A.2c.y+dy;if(C.A.5i&&(C.A.3H||C.A.2Z)){k.3b.3H(C,2v,2q)}2v=!C.A.1O||C.A.1O==\'4j\'?2v:C.A.2c.x||0;2q=!C.A.1O||C.A.1O==\'49\'?2q:C.A.2c.y||0;C.14.O=2v+\'U\';C.14.Q=2q+\'U\'},2r:u(o){E q.1E(u(){if(q.bI==1b||!o.3C||!k.1a||!k.11||!k.1x){E}5x=k(o.3C,q);if(5x.1N()==0){E}D 4N={2p:\'94\',5i:1b,3H:o.3H&&o.3H.1K==2A?o.3H:S,2Z:o.2Z&&o.2Z.1K==2A?o.2Z:S,3v:q,1G:o.1G||I};if(o.2O&&T(o.2O)){4N.2O=T(o.2O)||1;4N.2O=4N.2O>0?4N.2O:1}if(5x.1N()==1)5x.7t(4N);P{k(5x.K(0)).7t(4N);4N.3v=S;5x.7t(4N)}5x.7B(k.3b.eI);5x.1p(\'bM\',k.3b.bM++);q.bI=1b;q.4z={};q.4z.er=4N.er;q.4z.2O=4N.2O;q.4z.6s=5x;q.4z.bC=o.bC?1b:I;bZ=q;bZ.4z.6s.1E(u(2N){q.bF=2N;q.9r=bZ});if(o.3t&&o.3t.1K==7F){24(i=o.3t.1g-1;i>=0;i--){if(o.3t[i].1K==7F&&o.3t[i].1g==2){el=q.4z.6s.K(i);if(el.4Y){k.3b.5c(el,o.3t[i])}}}}})}};k.fn.23({hN:k.3b.2r,hS:k.3b.eH,hG:k.3b.K});k.2u={5I:[],eg:u(){q.5B();X=q.31;id=k.1p(X,\'id\');if(k.2u.5I[id]!=S){1X.5T(k.2u.5I[id])}1z=X.L.3u+1;if(X.L.1Q.1g<1z){1z=1}1Q=k(\'1T\',X.L.5u);X.L.3u=1z;if(1Q.1N()>0){1Q.7a(X.L.3W,k.2u.95)}},dp:u(){q.5B();X=q.31;id=k.1p(X,\'id\');if(k.2u.5I[id]!=S){1X.5T(k.2u.5I[id])}1z=X.L.3u-1;1Q=k(\'1T\',X.L.5u);if(1z<1){1z=X.L.1Q.1g}X.L.3u=1z;if(1Q.1N()>0){1Q.7a(X.L.3W,k.2u.95)}},2I:u(c){X=1h.9e(c);if(X.L.6o){1z=X.L.3u;7d(1z==X.L.3u){1z=1+T(18.6o()*X.L.1Q.1g)}}P{1z=X.L.3u+1;if(X.L.1Q.1g<1z){1z=1}}1Q=k(\'1T\',X.L.5u);X.L.3u=1z;if(1Q.1N()>0){1Q.7a(X.L.3W,k.2u.95)}},go:u(o){D X;if(o&&o.1K==7M){if(o.2b){X=1h.9e(o.2b.X);5N=1X.hn.3h.7C("#");o.2b.6S=S;if(5N.1g==2){1z=T(5N[1]);1Y=5N[1].4E(1z,\'\');if(k.1p(X,\'id\')!=1Y){1z=1}}P{1z=1}}if(o.90){o.90.5B();X=o.90.31.31;id=k.1p(X,\'id\');if(k.2u.5I[id]!=S){1X.5T(k.2u.5I[id])}5N=o.90.3h.7C("#");1z=T(5N[1]);1Y=5N[1].4E(1z,\'\');if(k.1p(X,\'id\')!=1Y){1z=1}}if(X.L.1Q.1g<1z||1z<1){1z=1}X.L.3u=1z;52=k.1a.2o(X);dt=k.1a.aT(X);d9=k.1a.6U(X);if(X.L.3z){X.L.3z.o.B(\'19\',\'1o\')}if(X.L.3s){X.L.3s.o.B(\'19\',\'1o\')}if(X.L.2b){y=T(dt.t)+T(d9.t);if(X.L.1U){if(X.L.1U.5A==\'Q\'){y+=X.L.1U.4C.hb}P{52.h-=X.L.1U.4C.hb}}if(X.L.2x){if(X.L.2x&&X.L.2x.6Q==\'Q\'){y+=X.L.2x.4C.hb}P{52.h-=X.L.2x.4C.hb}}if(!X.L.c1){X.L.df=o.2b?o.2b.W:(T(X.L.2b.B(\'W\'))||0);X.L.c1=o.2b?o.2b.Z:(T(X.L.2b.B(\'Z\'))||0)}X.L.2b.B(\'Q\',y+(52.h-X.L.df)/2+\'U\');X.L.2b.B(\'O\',(52.1C-X.L.c1)/2+\'U\');X.L.2b.B(\'19\',\'2B\')}1Q=k(\'1T\',X.L.5u);if(1Q.1N()>0){1Q.7a(X.L.3W,k.2u.95)}P{aj=k(\'a\',X.L.1U.o).K(1z-1);k(aj).2R(X.L.1U.5R);D 1T=12 9s();1T.X=k.1p(X,\'id\');1T.1z=1z-1;1T.2J=X.L.1Q[X.L.3u-1].2J;if(1T.21){1T.6S=S;k.2u.19.1D(1T)}P{1T.6S=k.2u.19}if(X.L.2x){X.L.2x.o.3x(X.L.1Q[1z-1].6L)}}}},95:u(){X=q.31.31;X.L.5u.B(\'19\',\'1o\');if(X.L.1U.5R){aj=k(\'a\',X.L.1U.o).4i(X.L.1U.5R).K(X.L.3u-1);k(aj).2R(X.L.1U.5R)}D 1T=12 9s();1T.X=k.1p(X,\'id\');1T.1z=X.L.3u-1;1T.2J=X.L.1Q[X.L.3u-1].2J;if(1T.21){1T.6S=S;k.2u.19.1D(1T)}P{1T.6S=k.2u.19}if(X.L.2x){X.L.2x.o.3x(X.L.1Q[X.L.3u-1].6L)}},19:u(){X=1h.9e(q.X);if(X.L.3z){X.L.3z.o.B(\'19\',\'1o\')}if(X.L.3s){X.L.3s.o.B(\'19\',\'1o\')}52=k.1a.2o(X);y=0;if(X.L.1U){if(X.L.1U.5A==\'Q\'){y+=X.L.1U.4C.hb}P{52.h-=X.L.1U.4C.hb}}if(X.L.2x){if(X.L.2x&&X.L.2x.6Q==\'Q\'){y+=X.L.2x.4C.hb}P{52.h-=X.L.2x.4C.hb}}hg=k(\'.ca\',X);y=y+(52.h-q.W)/2;x=(52.1C-q.Z)/2;X.L.5u.B(\'Q\',y+\'U\').B(\'O\',x+\'U\').3x(\'<1T 2J="\'+q.2J+\'" />\');X.L.5u.7f(X.L.3W);3s=X.L.3u+1;if(3s>X.L.1Q.1g){3s=1}3z=X.L.3u-1;if(3z<1){3z=X.L.1Q.1g}X.L.3s.o.B(\'19\',\'2B\').B(\'Q\',y+\'U\').B(\'O\',x+2*q.Z/3+\'U\').B(\'Z\',q.Z/3+\'U\').B(\'W\',q.W+\'U\').1p(\'4g\',X.L.1Q[3s-1].6L);X.L.3s.o.K(0).3h=\'#\'+3s+k.1p(X,\'id\');X.L.3z.o.B(\'19\',\'2B\').B(\'Q\',y+\'U\').B(\'O\',x+\'U\').B(\'Z\',q.Z/3+\'U\').B(\'W\',q.W+\'U\').1p(\'4g\',X.L.1Q[3z-1].6L);X.L.3z.o.K(0).3h=\'#\'+3z+k.1p(X,\'id\')},2r:u(o){if(!o||!o.1Z||k.2u.5I[o.1Z])E;D 1Z=k(\'#\'+o.1Z);D el=1Z.K(0);if(el.14.Y!=\'1P\'&&el.14.Y!=\'2s\'){el.14.Y=\'2s\'}el.14.2U=\'2K\';if(1Z.1N()==0)E;el.L={};el.L.1Q=o.1Q?o.1Q:[];el.L.6o=o.6o&&o.6o==1b||I;97=el.f3(\'hL\');24(i=0;i<97.1g;i++){7Z=el.L.1Q.1g;el.L.1Q[7Z]={2J:97[i].2J,6L:97[i].4g||97[i].hD||\'\'}}if(el.L.1Q.1g==0){E}el.L.4n=k.23(k.1a.3w(el),k.1a.2o(el));el.L.b5=k.1a.aT(el);el.L.bu=k.1a.6U(el);t=T(el.L.b5.t)+T(el.L.bu.t);b=T(el.L.b5.b)+T(el.L.bu.b);k(\'1T\',el).bk();el.L.3W=o.3W?o.3W:g5;if(o.5A||o.9f||o.5R){el.L.1U={};1Z.1S(\'<22 6T="g1"></22>\');el.L.1U.o=k(\'.g1\',el);if(o.9f){el.L.1U.9f=o.9f;el.L.1U.o.2R(o.9f)}if(o.5R){el.L.1U.5R=o.5R}el.L.1U.o.B(\'Y\',\'1P\').B(\'Z\',el.L.4n.w+\'U\');if(o.5A&&o.5A==\'Q\'){el.L.1U.5A=\'Q\';el.L.1U.o.B(\'Q\',t+\'U\')}P{el.L.1U.5A=\'4D\';el.L.1U.o.B(\'4D\',b+\'U\')}el.L.1U.aE=o.aE?o.aE:\' \';24(D i=0;i<el.L.1Q.1g;i++){7Z=T(i)+1;el.L.1U.o.1S(\'<a 3h="#\'+7Z+o.1Z+\'" 6T="gR" 4g="\'+el.L.1Q[i].6L+\'">\'+7Z+\'</a>\'+(7Z!=el.L.1Q.1g?el.L.1U.aE:\'\'))}k(\'a\',el.L.1U.o).1J(\'5h\',u(){k.2u.go({90:q})});el.L.1U.4C=k.1a.2o(el.L.1U.o.K(0))}if(o.6Q||o.9c){el.L.2x={};1Z.1S(\'<22 6T="dn">&7k;</22>\');el.L.2x.o=k(\'.dn\',el);if(o.9c){el.L.2x.9c=o.9c;el.L.2x.o.2R(o.9c)}el.L.2x.o.B(\'Y\',\'1P\').B(\'Z\',el.L.4n.w+\'U\');if(o.6Q&&o.6Q==\'Q\'){el.L.2x.6Q=\'Q\';el.L.2x.o.B(\'Q\',(el.L.1U&&el.L.1U.5A==\'Q\'?el.L.1U.4C.hb+t:t)+\'U\')}P{el.L.2x.6Q=\'4D\';el.L.2x.o.B(\'4D\',(el.L.1U&&el.L.1U.5A==\'4D\'?el.L.1U.4C.hb+b:b)+\'U\')}el.L.2x.4C=k.1a.2o(el.L.2x.o.K(0))}if(o.9D){el.L.3s={9D:o.9D};1Z.1S(\'<a 3h="#2\'+o.1Z+\'" 6T="eY">&7k;</a>\');el.L.3s.o=k(\'.eY\',el);el.L.3s.o.B(\'Y\',\'1P\').B(\'19\',\'1o\').B(\'2U\',\'2K\').B(\'4A\',\'eR\').2R(el.L.3s.9D);el.L.3s.o.1J(\'5h\',k.2u.eg)}if(o.9o){el.L.3z={9o:o.9o};1Z.1S(\'<a 3h="#0\'+o.1Z+\'" 6T="ee">&7k;</a>\');el.L.3z.o=k(\'.ee\',el);el.L.3z.o.B(\'Y\',\'1P\').B(\'19\',\'1o\').B(\'2U\',\'2K\').B(\'4A\',\'eR\').2R(el.L.3z.9o);el.L.3z.o.1J(\'5h\',k.2u.dp)}1Z.bG(\'<22 6T="ca"></22>\');el.L.5u=k(\'.ca\',el);el.L.5u.B(\'Y\',\'1P\').B(\'Q\',\'2P\').B(\'O\',\'2P\').B(\'19\',\'1o\');if(o.2b){1Z.bG(\'<22 6T="dW" 14="19: 1o;"><1T 2J="\'+o.2b+\'" /></22>\');el.L.2b=k(\'.dW\',el);el.L.2b.B(\'Y\',\'1P\');D 1T=12 9s();1T.X=o.1Z;1T.2J=o.2b;if(1T.21){1T.6S=S;k.2u.go({2b:1T})}P{1T.6S=u(){k.2u.go({2b:q})}}}P{k.2u.go({1Z:el})}if(o.cS){fi=T(o.cS)*aC}k.2u.5I[o.1Z]=o.cS?1X.6V(\'k.2u.2I(\\\'\'+o.1Z+\'\\\')\',fi):S}};k.X=k.2u.2r;k.1t={7s:[],5L:{},1c:I,7u:S,26:u(){if(k.11.F==S){E}D 4O,3G,c,cs;k.1t.1c.K(0).3l=k.11.F.A.6R;4O=k.1t.1c.K(0).14;4O.19=\'2B\';k.1t.1c.1B=k.23(k.1a.3w(k.1t.1c.K(0)),k.1a.2o(k.1t.1c.K(0)));4O.Z=k.11.F.A.1B.1C+\'U\';4O.W=k.11.F.A.1B.hb+\'U\';3G=k.1a.cy(k.11.F);4O.5K=3G.t;4O.5z=3G.r;4O.5k=3G.b;4O.5j=3G.l;if(k.11.F.A.46==1b){c=k.11.F.fI(1b);cs=c.14;cs.5K=\'2P\';cs.5z=\'2P\';cs.5k=\'2P\';cs.5j=\'2P\';cs.19=\'2B\';k.1t.1c.5o().1S(c)}k(k.11.F).f5(k.1t.1c.K(0));k.11.F.14.19=\'1o\'},fC:u(e){if(!e.A.44&&k.1x.5r.cQ){if(e.A.3T)e.A.3T.1D(F);k(e).B(\'Y\',e.A.cz||e.A.4n);k(e).aS();k(k.1x.5r).f6(e)}k.1t.1c.4i(e.A.6R).3x(\'&7k;\');k.1t.7u=S;D 4O=k.1t.1c.K(0).14;4O.19=\'1o\';k.1t.1c.f5(e);if(e.A.fx>0){k(e).7f(e.A.fx)}k(\'2e\').1S(k.1t.1c.K(0));D 86=[];D 8q=I;24(D i=0;i<k.1t.7s.1g;i++){D 1j=k.1x.3P[k.1t.7s[i]].K(0);D id=k.1p(1j,\'id\');D 8i=k.1t.8x(id);if(1j.1i.ay!=8i.7l){1j.1i.ay=8i.7l;if(8q==I&&1j.1i.2Z){8q=1j.1i.2Z}8i.id=id;86[86.1g]=8i}}k.1t.7s=[];if(8q!=I&&86.1g>0){8q(86)}},al:u(e,o){if(!k.11.F)E;D 6e=I;D i=0;if(e.1i.el.1N()>0){24(i=e.1i.el.1N();i>0;i--){if(e.1i.el.K(i-1)!=k.11.F){if(!e.5V.b2){if((e.1i.el.K(i-1).1M.y+e.1i.el.K(i-1).1M.hb/2)>k.11.F.A.2q){6e=e.1i.el.K(i-1)}P{1r}}P{if((e.1i.el.K(i-1).1M.x+e.1i.el.K(i-1).1M.1C/2)>k.11.F.A.2v&&(e.1i.el.K(i-1).1M.y+e.1i.el.K(i-1).1M.hb/2)>k.11.F.A.2q){6e=e.1i.el.K(i-1)}}}}}if(6e&&k.1t.7u!=6e){k.1t.7u=6e;k(6e).h5(k.1t.1c.K(0))}P if(!6e&&(k.1t.7u!=S||k.1t.1c.K(0).31!=e)){k.1t.7u=S;k(e).1S(k.1t.1c.K(0))}k.1t.1c.K(0).14.19=\'2B\'},cT:u(e){if(k.11.F==S){E}e.1i.el.1E(u(){q.1M=k.23(k.1a.74(q),k.1a.7G(q))})},8x:u(s){D i;D h=\'\';D o={};if(s){if(k.1t.5L[s]){o[s]=[];k(\'#\'+s+\' .\'+k.1t.5L[s]).1E(u(){if(h.1g>0){h+=\'&\'}h+=s+\'[]=\'+k.1p(q,\'id\');o[s][o[s].1g]=k.1p(q,\'id\')})}P{24(a in s){if(k.1t.5L[s[a]]){o[s[a]]=[];k(\'#\'+s[a]+\' .\'+k.1t.5L[s[a]]).1E(u(){if(h.1g>0){h+=\'&\'}h+=s[a]+\'[]=\'+k.1p(q,\'id\');o[s[a]][o[s[a]].1g]=k.1p(q,\'id\')})}}}}P{24(i in k.1t.5L){o[i]=[];k(\'#\'+i+\' .\'+k.1t.5L[i]).1E(u(){if(h.1g>0){h+=\'&\'}h+=i+\'[]=\'+k.1p(q,\'id\');o[i][o[i].1g]=k.1p(q,\'id\')})}}E{7l:h,o:o}},fF:u(e){if(!e.dq){E}E q.1E(u(){if(!q.5V||!k(e).is(\'.\'+q.5V.3C))k(e).2R(q.5V.3C);k(e).7t(q.5V.A)})},4U:u(){E q.1E(u(){k(\'.\'+q.5V.3C).aS();k(q).dR();q.5V=S;q.fm=S})},2r:u(o){if(o.3C&&k.1a&&k.11&&k.1x){if(!k.1t.1c){k(\'2e\',1h).1S(\'<22 id="e5">&7k;</22>\');k.1t.1c=k(\'#e5\');k.1t.1c.K(0).14.19=\'1o\'}q.do({3C:o.3C,9J:o.9J?o.9J:I,a5:o.a5?o.a5:I,58:o.58?o.58:I,7x:o.7x||o.dC,7y:o.7y||o.fO,cQ:1b,2Z:o.2Z||o.ia,fx:o.fx?o.fx:I,46:o.46?1b:I,6I:o.6I?o.6I:\'cV\'});E q.1E(u(){D A={6N:o.6N?1b:I,ff:6P,1G:o.1G?2m(o.1G):I,6R:o.58?o.58:I,fx:o.fx?o.fx:I,44:1b,46:o.46?1b:I,3v:o.3v?o.3v:S,2p:o.2p?o.2p:S,4o:o.4o&&o.4o.1K==2A?o.4o:I,4m:o.4m&&o.4m.1K==2A?o.4m:I,3T:o.3T&&o.3T.1K==2A?o.3T:I,1O:/49|4j/.48(o.1O)?o.1O:I,6M:o.6M?T(o.6M)||0:I,2V:o.2V?o.2V:I};k(\'.\'+o.3C,q).7t(A);q.fm=1b;q.5V={3C:o.3C,6N:o.6N?1b:I,ff:6P,1G:o.1G?2m(o.1G):I,6R:o.58?o.58:I,fx:o.fx?o.fx:I,44:1b,46:o.46?1b:I,3v:o.3v?o.3v:S,2p:o.2p?o.2p:S,b2:o.b2?1b:I,A:A}})}}};k.fn.23({j3:k.1t.2r,f6:k.1t.fF,iS:k.1t.4U});k.iZ=k.1t.8x;k.2t={6O:S,7b:I,9m:S,6K:u(e){k.2t.7b=1b;k.2t.1Y(e,q,1b)},cq:u(e){if(k.2t.6O!=q)E;k.2t.7b=I;k.2t.2G(e,q)},1Y:u(e,el,7b){if(k.2t.6O!=S)E;if(!el){el=q}k.2t.6O=el;1M=k.23(k.1a.3w(el),k.1a.2o(el));8u=k(el);4g=8u.1p(\'4g\');3h=8u.1p(\'3h\');if(4g){k.2t.9m=4g;8u.1p(\'4g\',\'\');k(\'#eT\').3x(4g);if(3h)k(\'#bL\').3x(3h.4E(\'jh://\',\'\'));P k(\'#bL\').3x(\'\');1c=k(\'#8z\');if(el.4H.3l){1c.K(0).3l=el.4H.3l}P{1c.K(0).3l=\'\'}bo=k.1a.2o(1c.K(0));ga=7b&&el.4H.Y==\'bO\'?\'4D\':el.4H.Y;3m(ga){1e\'Q\':2q=1M.y-bo.hb;2v=1M.x;1r;1e\'O\':2q=1M.y;2v=1M.x-bo.1C;1r;1e\'2L\':2q=1M.y;2v=1M.x+1M.1C;1r;1e\'bO\':k(\'2e\').1J(\'3D\',k.2t.3D);1s=k.1a.4a(e);2q=1s.y+15;2v=1s.x+15;1r;ad:2q=1M.y+1M.hb;2v=1M.x;1r}1c.B({Q:2q+\'U\',O:2v+\'U\'});if(el.4H.54==I){1c.1Y()}P{1c.7f(el.4H.54)}if(el.4H.2Y)el.4H.2Y.1D(el);8u.1J(\'8B\',k.2t.2G).1J(\'5B\',k.2t.cq)}},3D:u(e){if(k.2t.6O==S){k(\'2e\').3q(\'3D\',k.2t.3D);E}1s=k.1a.4a(e);k(\'#8z\').B({Q:1s.y+15+\'U\',O:1s.x+15+\'U\'})},2G:u(e,el){if(!el){el=q}if(k.2t.7b!=1b&&k.2t.6O==el){k.2t.6O=S;k(\'#8z\').7a(1);k(el).1p(\'4g\',k.2t.9m).3q(\'8B\',k.2t.2G).3q(\'5B\',k.2t.cq);if(el.4H.3i)el.4H.3i.1D(el);k.2t.9m=S}},2r:u(M){if(!k.2t.1c){k(\'2e\').1S(\'<22 id="8z"><22 id="eT"></22><22 id="bL"></22></22>\');k(\'#8z\').B({Y:\'1P\',3I:6P,19:\'1o\'});k.2t.1c=1b}E q.1E(u(){if(k.1p(q,\'4g\')){q.4H={Y:/Q|4D|O|2L|bO/.48(M.Y)?M.Y:\'4D\',3l:M.3l?M.3l:I,54:M.54?M.54:I,2Y:M.2Y&&M.2Y.1K==2A?M.2Y:I,3i:M.3i&&M.3i.1K==2A?M.3i:I};D el=k(q);el.1J(\'9z\',k.2t.1Y);el.1J(\'6K\',k.2t.6K)}})}};k.fn.hO=k.2t.2r;k.84={bq:u(e){3K=e.7L||e.7K||-1;if(3K==9){if(1X.2k){1X.2k.bT=1b;1X.2k.c0=I}P{e.aP();e.aW()}if(q.b1){1h.6J.dZ().3g="\\t";q.dV=u(){q.6K();q.dV=S}}P if(q.aF){26=q.5q;2T=q.dN;q.2y=q.2y.hd(0,26)+"\\t"+q.2y.h8(2T);q.aF(26+1,26+1);q.6K()}E I}},4U:u(){E q.1E(u(){if(q.7P&&q.7P==1b){k(q).3q(\'7B\',k.84.bq);q.7P=I}})},2r:u(){E q.1E(u(){if(q.4Y==\'cf\'&&(!q.7P||q.7P==I)){k(q).1J(\'7B\',k.84.bq);q.7P=1b}})}};k.fn.23({j5:k.84.2r,hH:k.84.4U});k.1a={3w:u(e){D x=0;D y=0;D es=e.14;D bP=I;if(k(e).B(\'19\')==\'1o\'){D 5Y=es.3n;D 9q=es.Y;bP=1b;es.3n=\'2K\';es.19=\'2B\';es.Y=\'1P\'}D el=e;7d(el){x+=el.8t+(el.4Z&&!k.3a.7I?T(el.4Z.5b)||0:0);y+=el.8G+(el.4Z&&!k.3a.7I?T(el.4Z.4S)||0:0);el=el.dJ}el=e;7d(el&&el.4Y&&el.4Y.6c()!=\'2e\'){x-=el.3c||0;y-=el.3d||0;el=el.31}if(bP==1b){es.19=\'1o\';es.Y=9q;es.3n=5Y}E{x:x,y:y}},7G:u(el){D x=0,y=0;7d(el){x+=el.8t||0;y+=el.8G||0;el=el.dJ}E{x:x,y:y}},2o:u(e){D w=k.B(e,\'Z\');D h=k.B(e,\'W\');D 1C=0;D hb=0;D es=e.14;if(k(e).B(\'19\')!=\'1o\'){1C=e.4c;hb=e.5W}P{D 5Y=es.3n;D 9q=es.Y;es.3n=\'2K\';es.19=\'2B\';es.Y=\'1P\';1C=e.4c;hb=e.5W;es.19=\'1o\';es.Y=9q;es.3n=5Y}E{w:w,h:h,1C:1C,hb:hb}},74:u(el){E{1C:el.4c||0,hb:el.5W||0}},bm:u(e){D h,w,de;if(e){w=e.8W;h=e.8O}P{de=1h.5d;w=1X.d4||aa.d4||(de&&de.8W)||1h.2e.8W;h=1X.cB||aa.cB||(de&&de.8O)||1h.2e.8O}E{w:w,h:h}},6z:u(e){D t=0,l=0,w=0,h=0,iw=0,ih=0;if(e&&e.9N.6c()!=\'2e\'){t=e.3d;l=e.3c;w=e.d7;h=e.d2;iw=0;ih=0}P{if(1h.5d){t=1h.5d.3d;l=1h.5d.3c;w=1h.5d.d7;h=1h.5d.d2}P if(1h.2e){t=1h.2e.3d;l=1h.2e.3c;w=1h.2e.d7;h=1h.2e.d2}iw=aa.d4||1h.5d.8W||1h.2e.8W||0;ih=aa.cB||1h.5d.8O||1h.2e.8O||0}E{t:t,l:l,w:w,h:h,iw:iw,ih:ih}},cy:u(e,7N){D el=k(e);D t=el.B(\'5K\')||\'\';D r=el.B(\'5z\')||\'\';D b=el.B(\'5k\')||\'\';D l=el.B(\'5j\')||\'\';if(7N)E{t:T(t)||0,r:T(r)||0,b:T(b)||0,l:T(l)};P E{t:t,r:r,b:b,l:l}},aT:u(e,7N){D el=k(e);D t=el.B(\'5M\')||\'\';D r=el.B(\'5U\')||\'\';D b=el.B(\'5n\')||\'\';D l=el.B(\'4X\')||\'\';if(7N)E{t:T(t)||0,r:T(r)||0,b:T(b)||0,l:T(l)};P E{t:t,r:r,b:b,l:l}},6U:u(e,7N){D el=k(e);D t=el.B(\'4S\')||\'\';D r=el.B(\'5O\')||\'\';D b=el.B(\'5Q\')||\'\';D l=el.B(\'5b\')||\'\';if(7N)E{t:T(t)||0,r:T(r)||0,b:T(b)||0,l:T(l)||0};P E{t:t,r:r,b:b,l:l}},4a:u(2k){D x=2k.hT||(2k.gM+(1h.5d.3c||1h.2e.3c))||0;D y=2k.ki||(2k.iQ+(1h.5d.3d||1h.2e.3d))||0;E{x:x,y:y}},cI:u(4R,cx){cx(4R);4R=4R.7c;7d(4R){k.1a.cI(4R,cx);4R=4R.hQ}},h7:u(4R){k.1a.cI(4R,u(el){24(D 1p in el){if(2g el[1p]===\'u\'){el[1p]=S}}})},hV:u(el,1O){D 5l=k.1a.6z();D b6=k.1a.2o(el);if(!1O||1O==\'49\')k(el).B({Q:5l.t+((18.3r(5l.h,5l.ih)-5l.t-b6.hb)/2)+\'U\'});if(!1O||1O==\'4j\')k(el).B({O:5l.l+((18.3r(5l.w,5l.iw)-5l.l-b6.1C)/2)+\'U\'})},hW:u(el,dk){D 1Q=k(\'1T[@2J*="8X"]\',el||1h),8X;1Q.1E(u(){8X=q.2J;q.2J=dk;q.14.5E="9n:9w.9y.hE(2J=\'"+8X+"\')"})}};[].3J||(7F.hF.3J=u(v,n){n=(n==S)?0:n;D m=q.1g;24(D i=n;i<m;i++)if(q[i]==v)E i;E-1});',62,1293,'||||||||||||||||||||jQuery||||||this||||function||||||dragCfg|css|elm|var|return|dragged|easing|speed|false|callback|get|ss|options|iAuto|left|else|top|iResize|null|parseInt|px|oldStyle|height|slideshow|position|width||iDrag|new||style||||Math|display|iUtil|true|helper|subject|case|autoCFG|length|document|dropCfg|iEL|resizeOptions|carouselCfg|duration|interfaceFX|none|attr|sizes|break|pointer|iSort|type|ImageBox|queue|iDrop|iAutoscroller|slide|resizeElement|oC|wb|apply|each|fisheyeCfg|opacity|delta|newSizes|bind|constructor|custom|pos|size|axis|absolute|images|items|append|img|slideslinks|255|firstNum|window|show|container||complete|div|extend|for||start||cont|elsToScroll|100|loader|oR||body|elem|typeof|selectedItem|oldP|props|event|accordionCfg|parseFloat|field|getSize|containment|ny|build|relative|iTooltip|islideshow|nx|tp|slideCaption|value|newPosition|Function|block|selectHelper|step|border|itemWidth|hide|dequeue|timer|src|hidden|right|limit|nr|fractions|0px|PI|addClass|direction|end|overflow|cursorAt|result|parentData|onShow|onChange|to|parentNode|||||||||browser|iSlider|scrollLeft|scrollTop|scr|transferHelper|text|href|onHide|pre|selectdrug|className|switch|visibility|item|wrapper|unbind|max|nextslide|values|currentslide|handle|getPosition|html|newCoords|prevslide|iframe|iExpander|accept|mousemove|canvas|createElement|margins|onSlide|zIndex|indexOf|pressedKey|min|valueToAdd|multipleSeparator|pageSize|zones|highlighted|toggle|abs|onStop|dragElem|times|fadeDuration|diff|dhs|handlers||resizeDirection||vp|so|distance|ghosting||test|vertically|getPointer|startTop|offsetWidth|subjectValue|lastSuggestion|DropOutDirectiont|title|wrs|removeClass|horizontally|startLeft|out|onDrag|oP|onStart|nWidth|percent|down|ifxFirstDisplay|msie|iteration|ratio|clear|color|lastValue|slideCfg|fontSize|currentPointer|dimm|bottom|replace|up|prevImage|tooltipCFG|rel|els|fxCheckTag|context|nextImage|params|shs|fieldData|elToScroll|nodeEl|borderTopWidth|chunks|destroy|string|nHeight|paddingLeft|tagName|currentStyle||halign|slidePos|onclick|delay||containerW|from|helperclass|endLeft|endTop|borderLeftWidth|dragmoveBy|documentElement|dhe|newStyles|clonedEl|click|si|marginLeft|marginBottom|clientScroll|OpenClose|paddingBottom|empty|toWrite|selectionStart|overzone|toAdd|onDragModifier|holder|mousedown|animate|toDrag|cnt|marginRight|linksPosition|blur|getAttribute|hight|filter|sw|zoney|cos|slideshows|zonex|marginTop|collected|paddingTop|url|borderRightWidth|mouseup|borderBottomWidth|activeLinkClass|dragHandle|clearInterval|paddingRight|sortCfg|offsetHeight|prop|oldVisibility|styles||BlindDirection|point|fxh|nmp|old|post|currentPanel|onSelect|elementData|grid|pow|toLowerCase|animationHandler|cur|containerH|close|puff|getWidth|currentRel|imageEl|Expander|getHeight|iFisheye|random|newDimensions|itemHeight|reflections|sliders|selRange|wr|orig|margin|maxWidth|keyup|getScroll|captionText|totalImages|128|parseColor|curCSS|outerContainer|Scale|restore|tolerance|selection|focus|caption|snapDistance|revert|current|3000|captionPosition|hpc|onload|class|getBorder|setInterval|oldStyleAttr|rule|rgb|open|minLeft|ActiveXObject|oldDisplay|restoreStyle|getSizeLite||nw|0x||F0|fadeOut|focused|firstChild|while|cssRules|fadeIn|Date|minTop|backgroundColor|sc|nbsp|hash|captionEl|selectKeyHelper|selectCurrent|newTop|init|newLeft|changed|Draggable|inFrontOf|efx|139|onHover|onOut|getTime|np|keydown|split|radiusY|increment|Array|getPositionLite|selectClass|opera|onHighlight|keyCode|charCode|Object|toInteger|frameClass|hasTabsEnabled|zonew|user|zoneh|positionItems|onClick|oD|scrollIntoView|accordionPos|proximity|indic||data|containerSize|sin|iTTabs||ts|ImageBoxPrevImage|ImageBoxNextImage|imageSrc|newPos|maxHeight|minHeight|elS|activeClass|panels|maxBottom|maxRight|ser|move|opened|bounceout|animationInProgress|overlay|stop|reflectionSize|fnc|classname|insideParent|offsetLeft|jEl|nRy|pr|serialize|nRx|tooltipHelper|cssSides|mouseout|select|count|namedColors|padding|offsetTop|directionIncrement|parentEl|400|dir|expand|createTextNode|finishedPre|clientHeight|li|applyOn|content|contBorders|object|parentBorders|alpha|clientWidth|png|gallery|fontWeight|link|yproc|xproc|sx|parent|showImage|selectedone|imgs|onselect|sy|startDrag|cursor|captionClass|onselectstop|getElementById|linksClass|sh|ul|onActivate|isDroppable|nextEl|onDrop|oldTitle|progid|prevslideClass|prevEl|oldPosition|SliderContainer|Image|linkRel|selectKeyUp|selectKeyDown|DXImageTransform|inCache|Microsoft|mouseover|dragstop|diffX|211|nextslideClass|prot|auto|dEs|hidehelper|isDraggable|activeclass|unit|DoFold|unfold|nodeName|startTime|buildWrapper|prev|1px|oldColor|setTimeout|ScrollTo|st|sl|cssText|9999|next|destroyWrapper|opt|diffHeight|diffWidth|exec|hoverclass|image|blind|borderColor|sideEnd|self|key||default|2000|styleSheets|getValues|192|diffY|lnk|reflexions|checkhover|selectcheck|maxRotation|ImageBoxOuterContainer|gradient|panelHeight|childs|headers|ne|hideImage|minWidth|iIndex|itemsText|os|side|iCarousel|5625|1000|itemMinWidth|linksSeparator|setSelectionRange|protectRotation|positionContainer|posx|hoverClass|valToAdd|minchars|helperClass|source|nextImageEl|preventDefault|multiple|headerSelector|DraggableDestroy|getPadding|autofill|handleEl|stopPropagation|prevImageEl|getFieldValues|panelSelector|String|createTextRange|floats|lastSi|shrink|oPad|windowSize|paddingLeftSize|angle|paddingY|paddingX|RegExp|borderRightSize|floatVal|firstStep|pulse|Pulsate|Color|rotationSpeed|paddingBottomSize|remove|parseStyle|getClient|Number|helperSize|bounce|doTab||zoom|borderLeftSize|oBor|paddingRightSize|borderTopSize|paddingTopSize|stopAnim|pValue|borderBottomSize|extraWidth|restricted|autoSize|unselectable|SliderIteration|prepend|clearTimeout|isSlider|oneIsSortable|applyOnHover|tooltipURL|tabindex|draginit|mouse|restoreStyles|sliderSize|sliderPos|parentPos|cancelBubble|autocomplete|inputWidth|oldBorder|dragmove|clnt|sliderEl|returnValue|loaderWidth|idsa|letterSpacing|pause|getContainment|fade|snapToGrid|linear|10000|slideshowHolder|asin|cssSidesEnd|borderWidth|fitToContainer|TEXTAREA|entities|INPUT|spacer|writeItems|character|currentValue|paddings|169|oldFloat|borders|hidefocused|bouncein||modifyContainer|transparent|center|loadImage|func|getMargins|initialPosition|textAlign|innerHeight|Alpha|no|captionImages|closeEl|shake|prevTop|traverseDOM|Selectserialize|stopDrag|slider|ImageBoxCaption|ImageBoxIframe|300|ImageBoxOverlay|sortable|moveDrag|autoplay|measure|prevLeft|intersect|ImageBoxCurrentImage|selectstop|Shake|index|dragEl|keyPressed|scrollHeight|scroll|innerWidth|match|elPosition|scrollWidth|textImage|slideBor|jpg|captionSize|textImageFrom|visible||loaderHeight|ImageBoxCaptionImages||hoverItem|clickItem|emptyGIF||notColor|slideshowCaption|Droppable|goprev|childNodes|autocompleteHelper|autocompleteIframe|slidePad|fit|165|clientSize|||fontFamily|colorCssProps|elType|onhover|cssProps|expanderHelper|boxModel|itransferTo|keypress|moveStart|offsetParent|Width|selectstart|fxe|selectionEnd|checkCache|fontStyle|update|DroppableDestroy|remeasure|fontStretch|fontVariant|onblur|slideshowLoader|htmlEntities|wordSpacing|createRange|224|KhtmlUserSelect||closeHTML|on|sortHelper|245|userSelect|dragHelper|hrefAttr|dragstart|107|loaderSRC|highlight|slideshowPrevslide||gonext||styleFloat|frameborder|javascript|||relAttr|wid|scrolling||onslide|||listStyle|imageTypes|insertBefore|999|textDecoration|sqrt|140|230|maxy|240|ImageBoxContainer|doScroll|interval|set|dragmoveByKey|protect|ImageBoxCaptionText|144|ImageBoxLoader|off|checkdrop|isSelectable|hlt|30px|selectedclass|tooltipTitle|imagebox|shc|overlayOpacity|selRange2|slideshowNextSlide|gif|getSelectionStart|360|iAccordion|getElementsByTagName|iBounce|after|SortableAddItem|onResize|150|itemZIndex|grow|getHeightMinMax|borderTopUnit|selectcheckApply|borderRightUnit|zindex|fontUnit|togglehor|time|se|parte|easeout|isSortable||SlideInUp|fold|SlideOutUp|rgba|addColorStop|yfrac|containerMaxx|interfaceColorFX|containerMaxy||leftUnit|mousex||radiusX|check|getContext|xfrac|addItem|topUnit|fracH|cloneNode|togglever|paddingLeftUnit|borderBottomUnit|finish|onDragStop|onout|posy|isFunction|oldOverflow|directions|vertical|fracW|fakeAccordionClass|parts|fadeTo|inputValue|xml|selectstopApply|slideshowLinks|onDragStart|BlindUp|paddingTopUnit|500|trim|maxx|borderLeftUnit|paddingRightUnit|filteredPosition|BlindDown|paddingBottomUnit|horizontal|valign|find|ImageBoxClose|onselectstart|mozUserSelect|ondragstart|scale|110|globalCompositeOperation|bmp||drawImage|ondrop|password|quot||save|starty|jpeg|||number|startx|finishOpacity|hover|recallDroppables|flipv|finishx|destination|khtml|moz|lt|amp|pW|clientX|Accordion|translate|captiontext|elasticin|slideshowLink|fix|elasticout|resize|elasticboth|bounceboth|984375|9375|Selectable|30002|list|625|30001|nodeValue|before|100000|purgeEvents|substr|duplicate|moveEnd|||substring|success|param|par|array|Fisheye|name|POST|ajax|easeboth|location|fromHandler|collapse|MozUserSelect||ResizableDestroy|rotationTimer|fillRect|fill|WebKit|fillStyle|createLinearGradient|Resizable|navigator|appVersion|lineHeigt|alt|AlphaImageLoader|prototype|SliderGetValues|DisableTabs|Carousel|load|easein|IMG|200|Slider|ToolTip|wh|nextSibling|Autocomplete|SliderSetValues|pageX|float|centerEl|fixPNG|isNaN|dotted|dashed|stopAll|Left|outlineColor|Top|Right|Bottom|solid|double|selectorText|rules|onchange|SlideToggleRight|SlideOutRight||borderStyle||TransferTo||groove|ridge|inset|outset|borderTopColor||borderRightColor|olive|navy|orange||pink|203|maroon||magenta|182|193|lightyellow|lime|purple|red|outlineOffset|outlineWidth|borderBottomColor|borderLeftColor|lineHeight|loading|silver|white|yellow|Showing|100000000|SlideInRight|clientY|Highlight|SortableDestroy|CloseVertically|CloseHorizontally|FoldToggle|UnFold|SlideInDown|SlideToggleUp|SortSerialize|Fold|SwitchHorizontally|SwitchVertically|Sortable|scrollTo|EnableTabs|ScrollToAnchors|pt|Puff|OpenVertically|OpenHorizontally|Grow|Shrink|DropToggleRight|DropInRight|BlindToggleHorizontally|BlindRight|http|Bounce|120|BlindLeft|BlindToggleVertically|SlideToggleLeft|SlideOutLeft|toUpperCase|SlideInLeft|SlideToggleDown|SlideOutDown|DropOutLeft|DropInLeft|DropToggleLeft|DropOutRight|DropToggleUp|DropInUp|DropOutDown|DropInDown|DropToggleDown|DropOutUp|lightpink|textIndent|aqua|appendChild|azure|beige|220|last|cssFloat|first|ol|wrapEl|fxWrapper|black|imageLoaded|darkkhaki|darkgreen|189|183|darkmagenta|firstResize|darkgrey|brown|cyan|darkblue|darkcyan|table|form|col|tfoot|colgroup|th|header|thead|tbody|112|Autoexpand|tr|td|script|frame|input|pageY|textarea|button|w_|removeChild|frameset|option|optgroup|meta|darkolivegreen|blue|122|233|green|lightcyan|204|darkviolet|lightgreen|indigo|216|khaki|darksalmon|130|darkred|lightblue|148|173|215|238|fuchsia|gold|darkorchid|153|darkorange|lightgrey'.split('|'),0,{}))
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/jquery/jquery.color.js b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/jquery/jquery.color.js
new file mode 100644
index 0000000000000000000000000000000000000000..1dffbd5c7b3c6064c0eacc65fc7e0bdf4f90d128
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/jquery/jquery.color.js
@@ -0,0 +1,128 @@
+/*
+ * jQuery Color Animations
+ * Copyright 2007 John Resig
+ * Released under the MIT and GPL licenses.
+ */
+
+(function(jQuery){
+
+    // We override the animation for all of these color styles
+    jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
+        jQuery.fx.step[attr] = function(fx){
+            if ( fx.state == 0 ) {
+                fx.start = getColor( fx.elem, attr );
+                fx.end = getRGB( fx.end );
+            }
+
+            fx.elem.style[attr] = "rgb(" + [
+                Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
+                Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
+                Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
+            ].join(",") + ")";
+        }
+    });
+
+    // Color Conversion functions from highlightFade
+    // By Blair Mitchelmore
+    // http://jquery.offput.ca/highlightFade/
+
+    // Parse strings looking for color tuples [255,255,255]
+    function getRGB(color) {
+        var result;
+
+        // Check if we're already dealing with an array of colors
+        if ( color && color.constructor == Array && color.length == 3 )
+            return color;
+
+        // Look for rgb(num,num,num)
+        if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
+            return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
+
+        // Look for rgb(num%,num%,num%)
+        if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
+            return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
+
+        // Look for #a0b1c2
+        if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
+            return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
+
+        // Look for #fff
+        if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
+            return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
+
+        // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
+        if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
+            return colors['transparent']
+
+        // Otherwise, we're most likely dealing with a named color
+        return colors[jQuery.trim(color).toLowerCase()];
+    }
+
+    function getColor(elem, attr) {
+        var color;
+
+        do {
+            color = jQuery.curCSS(elem, attr);
+
+            // Keep going until we find an element that has color, or we hit the body
+            if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
+                break;
+
+            attr = "backgroundColor";
+        } while ( elem = elem.parentNode );
+
+        return getRGB(color);
+    };
+
+    // Some named colors to work with
+    // From Interface by Stefan Petre
+    // http://interface.eyecon.ro/
+
+    var colors = {
+        aqua:[0,255,255],
+        azure:[240,255,255],
+        beige:[245,245,220],
+        black:[0,0,0],
+        blue:[0,0,255],
+        brown:[165,42,42],
+        cyan:[0,255,255],
+        darkblue:[0,0,139],
+        darkcyan:[0,139,139],
+        darkgrey:[169,169,169],
+        darkgreen:[0,100,0],
+        darkkhaki:[189,183,107],
+        darkmagenta:[139,0,139],
+        darkolivegreen:[85,107,47],
+        darkorange:[255,140,0],
+        darkorchid:[153,50,204],
+        darkred:[139,0,0],
+        darksalmon:[233,150,122],
+        darkviolet:[148,0,211],
+        fuchsia:[255,0,255],
+        gold:[255,215,0],
+        green:[0,128,0],
+        indigo:[75,0,130],
+        khaki:[240,230,140],
+        lightblue:[173,216,230],
+        lightcyan:[224,255,255],
+        lightgreen:[144,238,144],
+        lightgrey:[211,211,211],
+        lightpink:[255,182,193],
+        lightyellow:[255,255,224],
+        lime:[0,255,0],
+        magenta:[255,0,255],
+        maroon:[128,0,0],
+        navy:[0,0,128],
+        olive:[128,128,0],
+        orange:[255,165,0],
+        pink:[255,192,203],
+        purple:[128,0,128],
+        violet:[128,0,128],
+        red:[255,0,0],
+        silver:[192,192,192],
+        white:[255,255,255],
+        yellow:[255,255,0],
+        transparent: [255,255,255]
+    };
+
+})(jQuery);
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/jquery/jquery.js b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/jquery/jquery.js
new file mode 100644
index 0000000000000000000000000000000000000000..82f3e9ef4f8011b809de5a31e5cf9b6c8927ffee
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/jquery/jquery.js
@@ -0,0 +1,33 @@
+/*
+ * jQuery 1.2.6 - New Wave Javascript
+ *
+ * Copyright (c) 2008 John Resig (jquery.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
+ * $Rev: 5685 $
+ */
+(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else
+return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
+return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
+selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
+return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
+this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
+return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
+jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&&copy&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
+script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else
+for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else
+for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
+jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
+ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&&notxml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else
+while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else
+while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
+for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
+jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else
+xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
+jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
+for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
+s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
+e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();
+jQuery.noConflict();
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/jquery/password-strength-meter.js b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/jquery/password-strength-meter.js
new file mode 100644
index 0000000000000000000000000000000000000000..27152f8d6b7c9062a01b8a5dc64b88f2b7bb019e
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/jquery/password-strength-meter.js
@@ -0,0 +1,80 @@
+// Password strength meter
+// This jQuery plugin is written by firas kassem [2007.04.05]
+// Firas Kassem  phiras.wordpress.com || phiras at gmail {dot} com
+// for more information : http://phiras.wordpress.com/2007/04/08/password-strength-meter-a-jquery-plugin/
+
+var shortPass = pwsL10n.short
+var badPass = pwsL10n.bad
+var goodPass = pwsL10n.good
+var strongPass = pwsL10n.strong
+
+
+function passwordStrength(password,username) {
+    score = 0
+
+    //password < 4
+    if (password.length < 4 ) { return shortPass }
+
+    //password == username
+    if (password.toLowerCase()==username.toLowerCase()) return badPass
+
+    //password length
+    score += password.length * 4
+    score += ( checkRepetition(1,password).length - password.length ) * 1
+    score += ( checkRepetition(2,password).length - password.length ) * 1
+    score += ( checkRepetition(3,password).length - password.length ) * 1
+    score += ( checkRepetition(4,password).length - password.length ) * 1
+
+    //password has 3 numbers
+    if (password.match(/(.*[0-9].*[0-9].*[0-9])/))  score += 5
+
+    //password has 2 symbols
+    if (password.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)) score += 5
+
+    //password has Upper and Lower chars
+    if (password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/))  score += 10
+
+    //password has number and chars
+    if (password.match(/([a-zA-Z])/) && password.match(/([0-9])/))  score += 15
+    //
+    //password has number and symbol
+    if (password.match(/([!,@,#,$,%,^,&,*,?,_,~])/) && password.match(/([0-9])/))  score += 15
+
+    //password has char and symbol
+    if (password.match(/([!,@,#,$,%,^,&,*,?,_,~])/) && password.match(/([a-zA-Z])/))  score += 15
+
+    //password is just numbers or chars
+    if (password.match(/^\w+$/) || password.match(/^\d+$/) )  score -= 10
+
+    //verifing 0 < score < 100
+    if ( score < 0 )  score = 0
+    if ( score > 100 )  score = 100
+
+    if (score < 34 )  return badPass
+    if (score < 68 )  return goodPass
+    return strongPass
+}
+
+
+// checkRepetition(1,'aaaaaaabcbc')   = 'abcbc'
+// checkRepetition(2,'aaaaaaabcbc')   = 'aabc'
+// checkRepetition(2,'aaaaaaabcdbcd') = 'aabcd'
+
+function checkRepetition(pLen,str) {
+    res = ""
+    for ( i=0; i<str.length ; i++ ) {
+        repeated=true
+        for (j=0;j < pLen && (j+i+pLen) < str.length;j++)
+            repeated=repeated && (str.charAt(j+i)==str.charAt(j+i+pLen))
+        if (j<pLen) repeated=false
+        if (repeated) {
+            i+=pLen-1
+            repeated=false
+        }
+        else {
+            res+=str.charAt(i)
+        }
+    }
+    return res
+}
+
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/profile-edit.js b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/profile-edit.js
new file mode 100644
index 0000000000000000000000000000000000000000..718185070dd463890f58f461f9652e90f5acfffb
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/profile-edit.js
@@ -0,0 +1,38 @@
+function check_pass_strength () {
+	var pass = jQuery('#pass1').val();
+	var user = jQuery('#user_login').val();
+
+	// get the result as an object, i'm tired of typing it
+	var res = jQuery('#pass-strength-result');
+
+	var strength = passwordStrength(pass, user);
+
+	jQuery(res).removeClass('short bad good strong');
+
+	if ( strength == pwsL10n.bad ) {
+		jQuery(res).addClass('bad');
+		jQuery(res).html( pwsL10n.bad );
+	}
+	else if ( strength == pwsL10n.good ) {
+		jQuery(res).addClass('good');
+		jQuery(res).html( pwsL10n.good );
+	}
+	else if ( strength == pwsL10n.strong ) {
+		jQuery(res).addClass('strong');
+		jQuery(res).html( pwsL10n.strong );
+	}
+	else {
+		// this catches 'Too short' and the off chance anything else comes along
+		jQuery(res).addClass('short');
+		jQuery(res).html( pwsL10n.short );
+	}
+}
+
+jQuery(function($) { 
+	$('#pass1').keyup( check_pass_strength ) 
+	$('.color-palette').click(function(){$(this).siblings('input[name=admin_color]').attr('checked', 'checked')});
+});
+
+jQuery(document).ready( function() {
+	jQuery('#pass1,#pass2').attr('autocomplete','off');
+});
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/topic.js b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/topic.js
new file mode 100644
index 0000000000000000000000000000000000000000..e010e367f8a0c4ae90bc99fc087ec6e9e4aef7f2
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/topic.js
@@ -0,0 +1,60 @@
+bbTopicJS = jQuery.extend( {
+	currentUserId: '0',
+	topicId: '0',
+	favoritesLink: '',
+	isFav: 0,
+	confirmPostDelete: 'Are you sure you wanna delete this post?',
+	favLinkYes: 'favorites',
+	favLinkNo: '?',
+	favYes: 'This topic is one of your %favLinkYes% [%favDel%]',
+	favNo: '%favAdd% (%favLinkNo%)',
+	favDel: 'x',
+	favAdd: 'Add this topic to your favorites'
+}, bbTopicJS );
+
+bbTopicJS.isFav = parseInt( bbTopicJS.isFav );
+
+jQuery( function($) {
+	// Tags
+	var tagsDelBefore = function( s ) {
+		s.data['topic_id'] = bbTopicJS.topicId;
+		return s;
+	};
+	$('#tags-list').wpList( { alt: '', delBefore: tagsDelBefore } );
+
+	// Favorites
+	var favoritesToggle = $('#favorite-toggle')
+		.addClass( 'list:favorite' )
+		.wpList( { alt: '', dimAfter: favLinkSetup } );
+
+	var favoritesToggleSpan = favoritesToggle.children( 'span' )
+		[bbTopicJS.isFav ? 'addClass' : 'removeClass' ]( 'is-favorite' );
+	
+
+	function favLinkSetup() {
+		bbTopicJS.isFav = favoritesToggleSpan.is('.is-favorite');
+		var aLink = "<a href='" + bbTopicJS.favoritesLink + "'>";
+		var aDim  = "<a href='" + favoritesToggleSpan.find( 'a[class^="dim:"]' ).attr( 'href' ) + "' class='dim:favorite-toggle:" + favoritesToggleSpan.attr( 'id' ) + ":is-favorite'>";
+		if ( bbTopicJS.isFav ) {
+			html = bbTopicJS.favYes
+				.replace( /%favLinkYes%/, aLink + bbTopicJS.favLinkYes + "</a>" )
+				.replace( /%favDel%/, aDim + bbTopicJS.favDel + "</a>" );
+		} else {
+			html = bbTopicJS.favNo
+				.replace( /%favLinkNo%/, aLink + bbTopicJS.favLinkNo + "</a>" )
+				.replace( /%favAdd%/, aDim + bbTopicJS.favAdd + "</a>" );
+		}
+		favoritesToggleSpan.html( html );
+		favoritesToggle.get(0).wpList.process( favoritesToggle );
+	}
+
+	// Posts
+	var postConfirm = function(e,s,a) {
+		if ( 'delete' != a ) {
+			return true;
+		}
+		return confirm( bbTopicJS[ $('#' + s.element).is('.deleted') ? 'confirmPostUnDelete' : 'confirmPostDelete'] );
+	};
+
+	$('#thread').addClass( 'list:post' ).wpList( { alt: 'alt', altOffset: 1, confirm: postConfirm } );
+} );
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/wp-ajax-response.js b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/wp-ajax-response.js
new file mode 100644
index 0000000000000000000000000000000000000000..81483e29c852b39f5cf7b91bca4aafabd4b62bac
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/wp-ajax-response.js
@@ -0,0 +1,64 @@
+var wpAjax = jQuery.extend( {
+	unserialize: function( s ) {
+		var r = {}, q, pp, i, p;
+		if ( !s ) { return r; }
+		q = s.split('?'); if ( q[1] ) { s = q[1]; }
+		pp = s.split('&');
+		for ( i in pp ) {
+			if ( jQuery.isFunction(pp.hasOwnProperty) && !pp.hasOwnProperty(i) ) { continue; }
+			p = pp[i].split('=');
+			r[p[0]] = p[1];
+		}
+		return r;
+	},
+	parseAjaxResponse: function( x, r, e ) { // 1 = good, 0 = strange (bad data?), -1 = you lack permission
+		var parsed = {}, re = jQuery('#' + r).html(''), err = '';
+
+		if ( x && typeof x == 'object' && x.getElementsByTagName('wp_ajax') ) {
+			parsed.responses = [];
+			parsed.errors = false;
+			jQuery('response', x).each( function() {
+				var th = jQuery(this), child = jQuery(this.firstChild), response;
+				response = { action: th.attr('action'), what: child.get(0).nodeName, id: child.attr('id'), oldId: child.attr('old_id'), position: child.attr('position') };
+				response.data = jQuery( 'response_data', child ).text();
+				response.supplemental = {};
+				if ( !jQuery( 'supplemental', child ).children().each( function() {
+					response.supplemental[this.nodeName] = jQuery(this).text();
+				} ).size() ) { response.supplemental = false }
+				response.errors = [];
+				if ( !jQuery('wp_error', child).each( function() {
+					var code = jQuery(this).attr('code'), anError, errorData, formField;
+					anError = { code: code, message: this.firstChild.nodeValue, data: false };
+					errorData = jQuery('wp_error_data[code="' + code + '"]', x);
+					if ( errorData ) { anError.data = errorData.get(); }
+					formField = jQuery( 'form-field', errorData ).text();
+					if ( formField ) { code = formField; }
+					if ( e ) { wpAjax.invalidateForm( jQuery('#' + e + ' :input[name="' + code + '"]' ).parents('.form-field:first') ); }
+					err += '<p>' + anError.message + '</p>';
+					response.errors.push( anError );
+					parsed.errors = true;
+				} ).size() ) { response.errors = false; }
+				parsed.responses.push( response );
+			} );
+			if ( err.length ) { re.html( '<div class="error">' + err + '</div>' ); }
+			return parsed;
+		}
+		if ( isNaN(x) ) { return !re.html('<div class="error"><p>' + x + '</p></div>'); }
+		x = parseInt(x,10);
+		if ( -1 == x ) { return !re.html('<div class="error"><p>' + wpAjax.noPerm + '</p></div>'); }
+		else if ( 0 === x ) { return !re.html('<div class="error"><p>' + wpAjax.broken  + '</p></div>'); }
+		return true;
+	},
+	invalidateForm: function ( selector ) {
+		return jQuery( selector ).addClass( 'form-invalid' ).change( function() { jQuery(this).removeClass( 'form-invalid' ); } );
+	},
+	validateForm: function( selector ) {
+		selector = jQuery( selector );
+		return !wpAjax.invalidateForm( selector.find('.form-required').filter( function() { return jQuery('input:visible', this).val() == ''; } ) ).size();
+	}
+}, wpAjax || { noPerm: 'You do not have permission to do that.', broken: 'An unidentified error has occurred.' } );
+
+// Basic form validation
+jQuery(document).ready( function($){
+	$('form.validate').submit( function() { return wpAjax.validateForm( $(this) ); } );
+});
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/wp-lists.js b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/wp-lists.js
new file mode 100644
index 0000000000000000000000000000000000000000..cacc92f08e9ee75552bb793db674045772999115
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/js/wp-lists.js
@@ -0,0 +1,372 @@
+(function($) {
+var currentFormEl = false, fs = {add:'ajaxAdd',del:'ajaxDel',dim:'ajaxDim',process:'process',recolor:'recolor'}, wpList;
+
+wpList = {
+	settings: {
+		url: wpListL10n.url, type: 'POST',
+		response: 'ajax-response',
+
+		what: '',
+		alt: 'alternate', altOffset: 0,
+		addColor: null, delColor: null, dimAddColor: null, dimDelColor: null,
+
+		confirm: null,
+		addBefore: null, addAfter: null,
+		delBefore: null, delAfter: null,
+		dimBefore: null, dimAfter: null
+	},
+
+	nonce: function(e,s) {
+		var url = wpAjax.unserialize(e.attr('href'));
+		return s.nonce || url._ajax_nonce || $('#' + s.element + ' input[name=_ajax_nonce]').val() || url._wpnonce || $('#' + s.element + ' input[name=_wpnonce]').val() || 0;
+	},
+
+	parseClass: function(e,t) {
+		var c = [], cl;
+		try {
+			cl = $(e).attr('class') || '';
+			cl = cl.match(new RegExp(t+':[\\S]+'));
+			if ( cl ) { c = cl[0].split(':'); }
+		} catch(r) {}
+		return c;
+	},
+
+	pre: function(e,s,a) {
+		var bg, r;
+		s = $.extend( {}, this.wpList.settings, {
+			element: null,
+			nonce: 0,
+			target: e.get(0)
+		}, s || {} );
+		if ( $.isFunction( s.confirm ) ) {
+			if ( 'add' != a ) {
+				bg = $('#' + s.element).css('backgroundColor');
+				$('#' + s.element).css('backgroundColor', '#FF9966');
+			}
+			r = s.confirm.call(this,e,s,a,bg);
+			if ( 'add' != a ) { $('#' + s.element).css('backgroundColor', bg ); }
+			if ( !r ) { return false; }
+		}
+		return s;
+	},
+
+	ajaxAdd: function( e, s ) {
+		e = $(e);
+		s = s || {};
+		var list = this, cls = wpList.parseClass(e,'add'), es, valid, formData;
+		s = wpList.pre.call( list, e, s, 'add' );
+
+		s.element = cls[2] || e.attr( 'id' ) || s.element || null;
+		if ( cls[3] ) { s.addColor = '#' + cls[3]; }
+		else { s.addColor = s.addColor || '#FFFF33'; }
+
+		if ( !s ) { return false; }
+
+		if ( !e.is("[class^=add:" + list.id + ":]") ) { return !wpList.add.call( list, e, s ); }
+
+		if ( !s.element ) { return true; }
+
+		s.action = 'add-' + s.what;
+
+		s.nonce = wpList.nonce(e,s);
+
+		es = $('#' + s.element + ' :input').not('[name=_ajax_nonce], [name=_wpnonce], [name=action]');
+		valid = wpAjax.validateForm( '#' + s.element );
+		if ( !valid ) { return false; }
+
+		s.data = $.param( $.extend( { _ajax_nonce: s.nonce, action: s.action }, wpAjax.unserialize( cls[4] || '' ) ) );
+		formData = $.isFunction(es.fieldSerialize) ? es.fieldSerialize() : es.serialize();
+		if ( formData ) { s.data += '&' + formData; }
+
+		if ( $.isFunction(s.addBefore) ) {
+			s = s.addBefore( s );
+			if ( !s ) { return true; }
+		}
+		if ( !s.data.match(/_ajax_nonce=[a-f0-9]+/) ) { return true; }
+
+		s.success = function(r) {
+			var res = wpAjax.parseAjaxResponse(r, s.response, s.element), o;
+			if ( !res || res.errors ) { return false; }
+
+			if ( true === res ) { return true; }
+
+			jQuery.each( res.responses, function() {
+				wpList.add.call( list, this.data, $.extend( {}, s, { // this.firstChild.nodevalue
+					pos: this.position || 0,
+					id: this.id || 0,
+					oldId: this.oldId || null
+				} ) );
+			} );
+
+			if ( $.isFunction(s.addAfter) ) {
+				o = this.complete;
+				this.complete = function(x,st) {
+					var _s = $.extend( { xml: x, status: st, parsed: res }, s );
+					s.addAfter( r, _s );
+					if ( $.isFunction(o) ) { o(x,st); }
+				};
+			}
+			list.wpList.recolor();
+			wpList.clear.call(list,'#' + s.element);
+		};
+
+		$.ajax( s );
+		return false;
+	},
+
+	ajaxDel: function( e, s ) {
+		e = $(e); s = s || {};
+		var list = this, cls = wpList.parseClass(e,'delete'), element, anim;
+		s = wpList.pre.call( list, e, s, 'delete' );
+
+		s.element = cls[2] || s.element || null;
+		if ( cls[3] ) { s.delColor = '#' + cls[3]; }
+		else { s.delColor = s.delColor || '#FF3333'; }
+
+		if ( !s || !s.element ) { return false; }
+
+		s.action = 'delete-' + s.what;
+
+		s.nonce = wpList.nonce(e,s);
+
+		s.data = $.extend(
+			{ action: s.action, id: s.element.split('-').pop(), _ajax_nonce: s.nonce },
+			wpAjax.unserialize( cls[4] || '' )
+		);
+
+		if ( $.isFunction(s.delBefore) ) {
+			s = s.delBefore( s );
+			if ( !s ) { return true; }
+		}
+		if ( !s.data._ajax_nonce ) { return true; }
+
+		element = $('#' + s.element);
+
+		if ( 'none' != s.delColor ) {
+			anim = 'slideUp';
+			if ( element.css( 'display' ).match(/table/) )
+				anim = 'fadeOut'; // Can't slideup table rows and other table elements.  Known jQuery bug
+			element
+				.animate( { backgroundColor: s.delColor }, 'fast'  )[anim]( 'fast' )
+				.queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
+		} else {
+			list.wpList.recolor();
+		}
+
+		s.success = function(r) {
+			var res = wpAjax.parseAjaxResponse(r, s.response, s.element), o;
+			if ( !res || res.errors ) {
+				element.stop().stop().css( 'backgroundColor', '#FF3333' ).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
+				return false;
+			}
+			if ( $.isFunction(s.delAfter) ) {
+				o = this.complete;
+				this.complete = function(x,st) {
+					element.queue( function() {
+						var _s = $.extend( { xml: x, status: st, parsed: res }, s );
+						s.delAfter( r, _s );
+						if ( $.isFunction(o) ) { o(x,st); }
+					} ).dequeue();
+				};
+			}
+		};
+		$.ajax( s );
+		return false;
+	},
+
+	ajaxDim: function( e, s ) {
+		if ( $(e).parent().css('display') == 'none' ) // Prevent hidden links from being clicked by hotkeys
+			return false;
+		e = $(e); s = s || {};
+		var list = this, cls = wpList.parseClass(e,'dim'), element, isClass, color, dimColor;
+		s = wpList.pre.call( list, e, s, 'dim' );
+
+		s.element = cls[2] || s.element || null;
+		s.dimClass =  cls[3] || s.dimClass || null;
+		if ( cls[4] ) { s.dimAddColor = '#' + cls[4]; }
+		else { s.dimAddColor = s.dimAddColor || '#FFFF33'; }
+		if ( cls[5] ) { s.dimDelColor = '#' + cls[5]; }
+		else { s.dimDelColor = s.dimDelColor || '#FF3333'; }
+
+		if ( !s || !s.element || !s.dimClass ) { return true; }
+
+		s.action = 'dim-' + s.what;
+
+		s.nonce = wpList.nonce(e,s);
+
+		s.data = $.extend(
+			{ action: s.action, id: s.element.split('-').pop(), dimClass: s.dimClass, _ajax_nonce : s.nonce },
+			wpAjax.unserialize( cls[6] || '' )
+		);
+
+		if ( $.isFunction(s.dimBefore) ) {
+			s = s.dimBefore( s );
+			if ( !s ) { return true; }
+		}
+
+		element = $('#' + s.element);
+		isClass = element.toggleClass(s.dimClass).is('.' + s.dimClass);
+		color = wpList.getColor( element );
+		element.toggleClass( s.dimClass )
+		dimColor = isClass ? s.dimAddColor : s.dimDelColor;
+		if ( 'none' != dimColor ) {
+			element
+				.animate( { backgroundColor: dimColor }, 'fast' )
+				.queue( function() { element.toggleClass(s.dimClass); $(this).dequeue(); } )
+				.animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } );
+		}
+
+		if ( !s.data._ajax_nonce ) { return true; }
+
+		s.success = function(r) {
+			var res = wpAjax.parseAjaxResponse(r, s.response, s.element), o;
+			if ( !res || res.errors ) {
+				element.stop().stop().css( 'backgroundColor', '#FF3333' )[isClass?'removeClass':'addClass'](s.dimClass).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
+				return false;
+			}
+			if ( $.isFunction(s.dimAfter) ) {
+				o = this.complete;
+				this.complete = function(x,st) {
+					element.queue( function() {
+						var _s = $.extend( { xml: x, status: st, parsed: res }, s );
+						s.dimAfter( r, _s );
+						if ( $.isFunction(o) ) { o(x,st); }
+					} ).dequeue();
+				};
+			}
+		};
+
+		$.ajax( s );
+		return false;
+	},
+
+	// From jquery.color.js: jQuery Color Animation by John Resig
+	getColor: function( el ) {
+		if ( el.constructor == Object )
+			el = el.get(0);
+		var elem = el, color, rgbaTrans = new RegExp( "rgba\\(\\s*0,\\s*0,\\s*0,\\s*0\\s*\\)", "i" );
+		do {
+			color = jQuery.curCSS(elem, 'backgroundColor');
+			if ( color != '' && color != 'transparent' && !color.match(rgbaTrans) || jQuery.nodeName(elem, "body") )
+				break;
+		} while ( elem = elem.parentNode );
+		return color || '#ffffff';
+	},
+
+	add: function( e, s ) {
+		e = $(e);
+
+		var list = $(this), old = false, _s = { pos: 0, id: 0, oldId: null }, ba, ref, color;
+		if ( 'string' == typeof s ) { s = { what: s }; }
+		s = $.extend(_s, this.wpList.settings, s);
+		if ( !e.size() || !s.what ) { return false; }
+		if ( s.oldId ) { old = $('#' + s.what + '-' + s.oldId); }
+		if ( s.id && ( s.id != s.oldId || !old || !old.size() ) ) { $('#' + s.what + '-' + s.id).remove(); }
+
+		if ( old && old.size() ) {
+			old.replaceWith(e);
+		} else if ( isNaN(s.pos) ) {
+			ba = 'after';
+			if ( '-' == s.pos.substr(0,1) ) {
+				s.pos = s.pos.substr(1);
+				ba = 'before';
+			}
+			ref = list.find( '#' + s.pos );
+			if ( 1 === ref.size() ) { ref[ba](e); }
+			else { list.append(e); }
+		} else if ( s.pos < 0 ) {
+			list.prepend(e);
+		} else {
+			list.append(e);
+		}
+
+		if ( s.alt ) {
+			if ( ( list.children(':visible').index( e[0] ) + s.altOffset ) % 2 ) { e.removeClass( s.alt ); }
+			else { e.addClass( s.alt ); }
+		}
+
+		if ( 'none' != s.addColor ) {
+			color = wpList.getColor( e );
+			e.css( 'backgroundColor', s.addColor ).animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } );
+		}
+		list.each( function() { this.wpList.process( e ); } );
+		return e;
+	},
+
+	clear: function(e) {
+		var list = this, t, tag;
+		e = $(e);
+		if ( list.wpList && e.parents( '#' + list.id ).size() ) { return; }
+		e.find(':input').each( function() {
+			if ( $(this).parents('.form-no-clear').size() )
+				return;
+			t = this.type.toLowerCase();
+			tag = this.tagName.toLowerCase();
+			if ( 'text' == t || 'password' == t || 'textarea' == tag ) { this.value = ''; }
+			else if ( 'checkbox' == t || 'radio' == t ) { this.checked = false; }
+			else if ( 'select' == tag ) { this.selectedIndex = null; }
+		});
+	},
+
+	process: function(el) {
+		var list = this;
+		$("[class^=add:" + list.id + ":]", el || null)
+			.filter('form').submit( function() { return list.wpList.add(this); } ).end()
+			.not('form').click( function() { return list.wpList.add(this); } ).each( function() {
+				var addEl = this, c = wpList.parseClass(this,'add')[2] || addEl.id, forms = [], ins = [];
+				if ( !c ) { return; }
+				// this is all really inefficient
+				$('#' + c + ' :input').focus( function() { currentFormEl = this; } ).blur( function() { currentFormEl = false; } ).each( function() {
+					ins.push(this);
+					var f = $(this).parents('form:first').get(0);
+					if ( $.inArray(f,forms) < 0 ) { forms.push(f); }
+				} );
+				$(forms).submit( function() {
+					if ( 0 <= $.inArray(currentFormEl,ins) ) {
+						$(addEl).trigger( 'click' );
+						$(currentFormEl).focus();
+						return false;
+					}
+				} );
+			} );
+		$("[class^=delete:" + list.id + ":]", el || null).click( function() { return list.wpList.del(this); } );
+		$("[class^=dim:" + list.id + ":]", el || null).click( function() { return list.wpList.dim(this); } );
+	},
+
+	recolor: function() {
+		var list = this, items, eo;
+		if ( !list.wpList.settings.alt ) { return; }
+		items = $('.list-item:visible', list);
+		if ( !items.size() ) { items = $(list).children(':visible'); }
+		eo = [':even',':odd'];
+		if ( list.wpList.settings.altOffset % 2 ) { eo.reverse(); }
+		items.filter(eo[0]).addClass(list.wpList.settings.alt).end().filter(eo[1]).removeClass(list.wpList.settings.alt);
+	},
+
+	init: function() {
+		var lists = this;
+		lists.wpList.process = function(a) {
+			lists.each( function() {
+				this.wpList.process(a);
+			} );
+		};
+		lists.wpList.recolor = function() {
+			lists.each( function() {
+				this.wpList.recolor();
+			} );
+		};
+	}
+};
+
+$.fn.wpList = function( settings ) {
+	this.each( function() {
+		var _this = this;
+		this.wpList = { settings: $.extend( {}, wpList.settings, { what: wpList.parseClass(this,'list')[1] || '' }, settings ) };
+		$.each( fs, function(i,f) { _this.wpList[i] = function( e, s ) { return wpList[f].call( _this, e, s ); }; } );
+	} );
+	wpList.init.call(this);
+	this.wpList.process();
+	return this;
+};
+
+})(jQuery);
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-load.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-load.php
new file mode 100644
index 0000000000000000000000000000000000000000..9d63ddbcf882106c59dcc487a5ec9912b29d5f19
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-load.php
@@ -0,0 +1,182 @@
+<?php
+/**
+ * Initialises the most fundamental parts of bbPress
+ *
+ * You should not have to change this file, all configuration
+ * should be possible in bb-config.php
+ *
+ * @package bbPress
+ */
+
+
+
+/**
+ * Low level reasons to die
+ */
+
+// Die if PHP is not new enough
+if ( version_compare( PHP_VERSION, '4.3', '<' ) ) {
+	die( sprintf( 'Your server is running PHP version %s but bbPress requires at least 4.3', PHP_VERSION ) );
+}
+
+
+
+// Modify error reporting levels to exclude PHP notices
+error_reporting( E_ALL ^ E_NOTICE );
+
+
+
+/**
+ * bb_timer_start() - PHP 4 standard microtime start capture
+ *
+ * @access private
+ * @global int $bb_timestart Seconds and Microseconds added together from when function is called
+ * @return bool Always returns true
+ */
+function bb_timer_start()
+{
+	global $bb_timestart;
+	$mtime = explode( ' ', microtime() );
+	$bb_timestart = $mtime[1] + $mtime[0];
+	return true;
+}
+bb_timer_start();
+
+
+
+// Server detection
+
+/**
+ * Whether the server software is Apache or something else
+ * @global bool $is_apache
+ */
+$is_apache = ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== false || strpos( $_SERVER['SERVER_SOFTWARE'], 'LiteSpeed' ) !== false);
+
+/**
+ * Whether the server software is IIS or something else
+ * @global bool $is_IIS
+ */
+$is_IIS = ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) !== false || strpos( $_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer' ) !== false );
+
+/**
+ * Whether the server software is IIS 7.X
+ * @global bool $is_iis7
+ */
+$is_iis7 = ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/7.' ) !== false );
+
+
+
+/**
+ * Stabilise $_SERVER variables in various PHP environments
+ */
+
+// Fix for IIS, which doesn't set REQUEST_URI
+if ( empty( $_SERVER['REQUEST_URI'] ) ) {
+
+	// IIS Mod-Rewrite
+	if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
+		$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
+	}
+	// IIS Isapi_Rewrite
+	else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
+		$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
+	}
+	else
+	{
+		// Use ORIG_PATH_INFO if there is no PATH_INFO
+		if ( !isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO']) )
+			$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
+
+		// Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
+		if ( isset($_SERVER['PATH_INFO']) ) {
+			if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
+				$_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
+			else
+				$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
+		}
+
+		// Append the query string if it exists and isn't null
+		if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
+			$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
+		}
+	}
+}
+
+// Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
+if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) )
+	$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
+
+// Fix for Dreamhost and other PHP as CGI hosts
+if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false)
+	unset($_SERVER['PATH_INFO']);
+
+// Fix empty PHP_SELF
+$PHP_SELF = $_SERVER['PHP_SELF'];
+if ( empty($PHP_SELF) )
+	$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
+
+
+
+/**
+ * bbPress logging level constants - same as constants from BP_Log class
+ */
+define( 'BB_LOG_NONE',    0 );
+define( 'BB_LOG_FAIL',    1 );
+define( 'BB_LOG_ERROR',   2 );
+define( 'BB_LOG_WARNING', 4 );
+define( 'BB_LOG_NOTICE',  8 );
+define( 'BB_LOG_DEBUG',   16 );
+
+/**
+ * Combination of all errors (excluding none and debug)
+ */
+define( 'BB_LOG_ALL', BB_LOG_FAIL + BB_LOG_ERROR + BB_LOG_WARNING + BB_LOG_NOTICE );
+
+/**
+ * Define temporary $_bb_path as this files directory, then check for the special BB_PATH config file
+ * which allows override of BB_PATH, but only outside of core files
+ */
+$_bb_path = dirname( __FILE__ ) . '/';
+$_bb_config_path = dirname( $_bb_path ) . '/bb-config-path.php';
+if ( file_exists( $_bb_config_path ) ) {
+	include_once( $_bb_config_path );
+}
+if ( !defined( 'BB_PATH' ) ) {
+	define( 'BB_PATH', $_bb_path );
+}
+unset( $_bb_path, $_bb_config_path );
+
+/**
+ * The bbPress includes path relative to BB_PATH
+ */
+define( 'BB_INC', 'bb-includes/' );
+
+// Initialise $bb object
+$bb = new StdClass();
+
+if ( file_exists( BB_PATH . 'bb-config.php') ) {
+
+	// The config file resides in BB_PATH
+	require_once( BB_PATH . 'bb-config.php');
+
+	// Load bb-settings.php
+	require_once( BB_PATH . 'bb-settings.php' );
+
+} elseif ( file_exists( dirname( BB_PATH ) . '/bb-config.php') ) {
+
+	// The config file resides one level below BB_PATH
+	require_once( dirname( BB_PATH ) . '/bb-config.php' );
+
+	// Load bb-settings.php
+	require_once( BB_PATH . 'bb-settings.php' );
+
+} elseif ( !defined( 'BB_INSTALLING' ) || !BB_INSTALLING ) {
+
+	// The config file doesn't exist and we aren't on the installation page
+
+	// Cut to the chase, go to the installer and use it to deal with errors
+	$install_uri = preg_replace( '|(/bb-admin)?/[^/]+?$|', '/', $_SERVER['PHP_SELF'] ) . 'bb-admin/install.php';
+	header( 'Location: ' . $install_uri );
+	die();
+
+}
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-login.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-login.php
new file mode 100644
index 0000000000000000000000000000000000000000..4b6b2888a0059e3ad93be694c8303e7887acb153
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-login.php
@@ -0,0 +1,104 @@
+<?php
+// Load bbPress.
+require('./bb-load.php');
+
+// Redirect to an SSL page if required.
+bb_ssl_redirect();
+
+// Get the referer.
+$ref = wp_get_referer();
+if ( !$re = $_POST['re'] ? $_POST['re'] : $_GET['re'] ) {
+	$re = $ref;
+}
+
+// Grab the URL for comparison.
+$home_url = parse_url( bb_get_uri( null, null, BB_URI_CONTEXT_TEXT ) );
+$home_path = $home_url['path'];
+
+// Don't ever redirect to the register page or the password reset page.
+if ( !$re || false !== strpos( $re, $home_path . 'register.php' ) || false !== strpos( $re, $home_path . 'bb-reset-password.php' ) ) {
+	$re = bb_get_uri( null, null, BB_URI_CONTEXT_HEADER );
+}
+
+// Don't cache this page at all.
+nocache_headers();
+
+// If this page was accessed using SSL, make sure the redirect is a full URL
+// so that we don't end up on an SSL page again (unless the whole site is
+// under SSL).
+if ( is_ssl() && 0 === strpos( $re, '/' ) ) {
+	$re = bb_get_uri( $re , null, BB_URI_CONTEXT_HEADER );
+}
+
+// Logout requested.
+if ( isset( $_GET['logout'] ) ) {
+	bb_logout();
+	bb_safe_redirect( $re );
+	exit;
+}
+
+// User is already logged in.
+if ( bb_is_user_logged_in() ) {
+	bb_safe_redirect( $re );
+	exit;
+}
+
+// Get the user from the login details.
+$user = bb_login( @$_POST['user_login'], @$_POST['password'], @$_POST['remember'] );
+
+// User logged in successfully.
+if ( $user && !is_wp_error( $user ) ) {
+	bb_safe_redirect( $re );
+	exit;
+}
+
+// Grab the error returned if there is one.
+if ( is_wp_error( $user ) ) {
+	$bb_login_error =& $user;
+} else {
+	$bb_login_error = new WP_Error;
+}
+
+// Whether we allow login by email address or not.
+$email_login = bb_get_option( 'email_login' );
+
+// Find out if the user actually exists.
+$error_data = $bb_login_error->get_error_data();
+if ( isset( $error_data['unique'] ) && false === $error_data['unique'] ) {
+	$user_exists = true;
+} else {
+	$user_exists = isset( $_POST['user_login'] ) && $_POST['user_login'] && (bool) bb_get_user( $_POST['user_login'], array( 'by' => 'login' ) );
+}
+unset( $error_data );
+
+if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) ) {
+	// If the user doesn't exist then add that error.
+	if ( !$user_exists ) {
+		if ( isset( $_POST['user_login'] ) && $_POST['user_login'] ) {
+			$bb_login_error->add( 'user_login', __( 'User does not exist.' ) );
+		} else {
+			$bb_login_error->add( 'user_login', $email_login ? __( 'Enter a username or email address.' ) : __( 'Enter a username.' ) );
+		}
+	}
+
+	// If the password was wrong then add that error.
+	if ( !$bb_login_error->get_error_code() ) {
+		$bb_login_error->add( 'password', __( 'Incorrect password.' ) );
+	}
+}
+
+// If trying to log in with email address, don't leak whether or not email address exists in the db.
+// is_email() is not perfect, usernames can be valid email addresses potentially.
+if ( $email_login && $bb_login_error->get_error_codes() && false !== is_email( $_POST['user_login'] ) ) {
+	$bb_login_error = new WP_Error( 'user_login', __( 'Username and Password do not match.' ) );
+}
+
+// Sanitze variables for display.
+$user_login = esc_attr( sanitize_user( @$_POST['user_login'], true ) );
+$remember_checked = @$_POST['remember'] ? ' checked="checked"' : '';
+$re = esc_url( $re );
+$re = $redirect_to = esc_attr( $re );
+
+// Load the template.
+bb_load_template( 'login.php', array( 'user_exists', 'user_login', 'remember_checked', 'redirect_to', 're', 'bb_login_error' ) );
+exit;
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-plugins/akismet.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-plugins/akismet.php
new file mode 100644
index 0000000000000000000000000000000000000000..13fd91d971e5724582b2a8c800637537c97b58e8
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-plugins/akismet.php
@@ -0,0 +1,492 @@
+<?php
+/*
+Plugin Name: Akismet
+Plugin URI: http://akismet.com/
+Description: Akismet checks posts against the Akismet web service to see if they look like spam or not. You need a <a href="http://wordpress.com/api-keys/">WordPress.com API key</a> to use this service.
+Author: Michael Adams
+Version: 1.1
+Author URI: http://blogwaffe.com/
+*/
+
+
+
+$bb_ksd_api_host = bb_get_option( 'akismet_key' ) . '.rest.akismet.com';
+$bb_ksd_api_port = 80;
+$bb_ksd_user_agent = 'bbPress/' . bb_get_option( 'version' ) . ' | bbAkismet/'. bb_get_option( 'version' );
+
+function bb_akismet_verify_key( $key )
+{
+	global $bb_ksd_api_port;
+	$blog = urlencode( bb_get_uri( null, null, BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_AKISMET ) );
+	$response = bb_ksd_http_post( 'key=' . $key . '&blog=' . $blog, 'rest.akismet.com', '/1.1/verify-key', $bb_ksd_api_port );
+	if ( 'valid' == $response[1] ) {
+		return true;
+	} else {
+		return false;
+	}
+}
+
+// Returns array with headers in $response[0] and entity in $response[1]
+function bb_ksd_http_post( $request, $host, $path, $port = 80 )
+{
+	global $bb_ksd_user_agent;
+
+	$http_request  = 'POST ' . $path . ' HTTP/1.0' . "\r\n";
+	$http_request .= 'Host: ' . $host . "\r\n";
+	$http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' . "\r\n"; // for now
+	$http_request .= 'Content-Length: ' . strlen($request) . "\r\n";
+	$http_request .= 'User-Agent: ' . $bb_ksd_user_agent . "\r\n";
+	$http_request .= "\r\n";
+	$http_request .= $request;
+	$response = '';
+	if ( false != ( $fs = @fsockopen( $host, $port, $errno, $errstr, 10 ) ) ) {
+		fwrite( $fs, $http_request );
+
+		while ( !feof( $fs ) ) {
+			$response .= fgets( $fs, 1160 ); // One TCP-IP packet
+		}
+		fclose( $fs );
+		$response = explode( "\r\n\r\n", $response, 2 );
+	}
+	return $response;
+}
+
+function bb_ksd_configuration_page()
+{
+?>
+<h2><?php _e( 'Akismet Settings' ); ?></h2>
+<?php do_action( 'bb_admin_notices' ); ?>
+
+<form class="settings" method="post" action="<?php bb_uri( 'bb-admin/admin-base.php', array( 'plugin' => 'bb_ksd_configuration_page'), BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN ); ?>">
+	<fieldset>
+		<p><?php printf( __( 'For many people, <a href="%s">Akismet</a> will greatly reduce or even completely eliminate the spam you get on your site. If one does happen to get through, simply mark it as "spam" and Akismet will learn from the mistakes.' ), 'http://akismet.com/' ); ?></p>
+
+<?php
+	$after = '';
+	if ( false !== $key = bb_get_option( 'akismet_key' ) ) {
+		if ( bb_akismet_verify_key( $key ) ) {
+			$after = __( 'This key is valid' );
+		} else {
+			bb_delete_option( 'akismet_key' );
+		}
+	}
+
+	bb_option_form_element( 'akismet_key', array(
+		'title' => __( 'WordPress.com API Key' ),
+		'attributes' => array( 'maxlength' => 12 ),
+		'after' => $after,
+		'note' => sprintf( __( 'If you don\'t have a WordPress.com API Key, you can get one at <a href="%s">WordPress.com</a>' ), 'http://wordpress.com/api-keys/' )
+	) );
+
+	bb_option_form_element( 'akismet_stats', array(
+		'title' => __( 'Enable stats page' ),
+		'type' => 'checkbox',
+		'options' => array(
+			1 => __( 'Create a page that shows spam statistics.' )
+		),
+		'note' => __( 'This page will be viewable by moderators or higher.' )
+	) );
+?>
+
+	</fieldset>
+	<fieldset class="submit">
+		<?php bb_nonce_field( 'options-akismet-update' ); ?>
+		<input type="hidden" name="action" value="update-akismet-settings" />
+		<input class="submit" type="submit" name="submit" value="<?php _e('Save Changes') ?>" />
+	</fieldset>
+</form>
+<?php
+}
+
+function bb_ksd_configuration_page_add()
+{
+	bb_admin_add_submenu( __( 'Akismet' ), 'moderate', 'bb_ksd_configuration_page', 'options-general.php' );
+}
+add_action( 'bb_admin_menu_generator', 'bb_ksd_configuration_page_add' );
+
+function bb_ksd_configuration_page_process()
+{
+	if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && $_POST['action'] == 'update-akismet-settings') {
+		bb_check_admin_referer( 'options-akismet-update' );
+
+		$goback = remove_query_arg( array( 'invalid-akismet', 'updated-akismet' ), wp_get_referer() );
+
+		if ( !isset( $_POST['akismet_stats'] ) ) {
+			$_POST['akismet_stats'] = false;
+		}
+
+		if ( true === (bool) $_POST['akismet_stats'] ) {
+			bb_update_option( 'akismet_stats', 1 );
+		} else {
+			bb_delete_option( 'akismet_stats' );
+		}
+
+		if ( $_POST['akismet_key'] ) {
+			$value = stripslashes_deep( trim( $_POST['akismet_key'] ) );
+			if ( $value ) {
+				if ( bb_akismet_verify_key( $value ) ) {
+					bb_update_option( 'akismet_key', $value );
+				} else {
+					$goback = add_query_arg( 'invalid-akismet', 'true', $goback );
+					bb_safe_redirect( $goback );
+					exit;
+				}
+			} else {
+				bb_delete_option( 'akismet_key' );
+			}
+		} else {
+			bb_delete_option( 'akismet_key' );
+		}
+
+		$goback = add_query_arg( 'updated-akismet', 'true', $goback );
+		bb_safe_redirect( $goback );
+		exit;
+	}
+
+	if ( !empty( $_GET['updated-akismet'] ) ) {
+		bb_admin_notice( __( '<strong>Settings saved.</strong>' ) );
+	}
+
+	if ( !empty( $_GET['invalid-akismet'] ) ) {
+		bb_admin_notice( __( '<strong>The key you attempted to enter is invalid. Reverting to previous setting.</strong>' ), 'error' );
+	}
+
+	global $bb_admin_body_class;
+	$bb_admin_body_class = ' bb-admin-settings';
+}
+add_action( 'bb_ksd_configuration_page_pre_head', 'bb_ksd_configuration_page_process' );
+
+// Bail here if no key is set
+if ( !bb_get_option( 'akismet_key' ) ) {
+	return;
+}
+
+function bb_ksd_stats_script()
+{
+?>
+<style>
+	#bb-ksd-stats-frame {
+		-moz-box-shadow: 0 0 15px rgb(255, 255, 255);
+		-webkit-box-shadow: 0 0 15px rgb(255, 255, 255);
+		box-shadow: 0 0 15px rgb(255, 255, 255);
+		margin-top: 16px;
+		width: 100%;
+		height: 700px;
+		border-width: 0;
+	}
+</style>
+<script type="text/javascript">
+	function resizeIframe() {
+		var height = document.documentElement.clientHeight;
+		height -= document.getElementById('bb-ksd-stats-frame').offsetTop;
+		height -= 60;
+		document.getElementById('bb-ksd-stats-frame').style.height = height +"px";
+	};
+	function resizeIframeInit() {
+		document.getElementById('bb-ksd-stats-frame').onload = resizeIframe;
+		window.onresize = resizeIframe;
+	}
+	addLoadEvent(resizeIframeInit);
+</script>
+<?php
+}
+
+function bb_ksd_stats_display_pre_head()
+{
+	if ( !bb_get_option( 'akismet_stats' ) ) {
+		return;
+	}
+	add_action( 'bb_admin_head', 'bb_ksd_stats_script' );
+}
+add_action( 'bb_ksd_stats_display_pre_head', 'bb_ksd_stats_display_pre_head' );
+
+function bb_ksd_stats_display()
+{
+	$site = urlencode( bb_get_uri( null, null, BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_AKISMET ) );
+	$url = "http://".bb_get_option( 'akismet_key' ).".web.akismet.com/1.0/user-stats.php?blog={$site}&amp;type=forum";
+?>
+	<iframe src="<?php echo $url; ?>" id="bb-ksd-stats-frame"></iframe>
+<?php
+}
+
+function bb_ksd_stats_page()
+{
+	if ( !bb_get_option( 'akismet_stats' ) ) {
+		return;
+	}
+	if ( function_exists( 'bb_admin_add_submenu' ) ) {
+		bb_admin_add_submenu( __( 'Akismet Stats' ), 'use_keys', 'bb_ksd_stats_display', 'index.php' );
+	}
+}
+add_action( 'bb_admin_menu_generator', 'bb_ksd_stats_page' );
+
+function bb_ksd_submit( $submit, $type = false )
+{
+	global $bb_ksd_api_host;
+	global $bb_ksd_api_port;
+
+	switch ( $type ) {
+		case 'ham':
+		case 'spam':
+			$path = '/1.1/submit-' . $type;
+
+			$bb_post = bb_get_post( $submit );
+			if ( !$bb_post ) {
+				return;
+			}
+			$user = bb_get_user( $bb_post->poster_id );
+			if ( bb_is_trusted_user( $user->ID ) ) {
+				return;
+			}
+
+			$_submit = array(
+				'blog' => bb_get_uri( null, null, BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_AKISMET ),
+				'user_ip' => $bb_post->poster_ip,
+				'permalink' => get_topic_link( $bb_post->topic_id ), // First page
+				'comment_type' => 'forum',
+				'comment_author' => get_user_name( $user->ID ),
+				'comment_author_email' =>  bb_get_user_email( $user->ID ),
+				'comment_author_url' => get_user_link( $user->ID ),
+				'comment_content' => $bb_post->post_text,
+				'comment_date_gmt' => $bb_post->post_time
+			);
+			break;
+
+		case 'hammer':
+		case 'spammer':
+			$path = '/1.1/submit-' . substr( $type, 0, -3 );
+
+			$user = bb_get_user( $submit );
+			if ( !$user ) {
+				return;
+			}
+			if ( bb_is_trusted_user( $user->ID ) ) {
+				return;
+			}
+
+			$_submit = array(
+				'blog' => bb_get_uri( null, null, BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_AKISMET ),
+				'permalink' => get_user_profile_link( $user->ID ),
+				'comment_type' => 'profile',
+				'comment_author' => get_user_name( $user->ID ),
+				'comment_author_email' =>  bb_get_user_email( $user->ID ),
+				'comment_author_url' => get_user_link( $user->ID ),
+				'comment_content' => $user->occ . ' ' . $user->interests,
+				'comment_date_gmt' => $user->user_registered
+			);
+			break;
+
+		default:
+			if ( bb_is_trusted_user( bb_get_current_user() ) ) {
+				return;
+			}
+
+			$path = '/1.1/comment-check';
+
+			$_submit = array(
+				'blog' => bb_get_uri( null, null, BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_AKISMET ),
+				'user_ip' => preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] ),
+				'user_agent' => $_SERVER['HTTP_USER_AGENT'],
+				'referrer' => $_SERVER['HTTP_REFERER'],
+				'comment_type' => isset($_POST['topic_id']) ? 'forum' : 'profile',
+				'comment_author' => bb_get_current_user_info( 'name' ),
+				'comment_author_email' => bb_get_current_user_info( 'email' ),
+				'comment_author_url' => bb_get_current_user_info( 'url' ),
+				'comment_content' => $submit
+			);
+			if ( isset( $_POST['topic_id'] ) ) {
+				$_submit['permalink'] = get_topic_link( $_POST['topic_id'] ); // First page
+			}
+			break;
+	}
+
+	$query_string = '';
+	foreach ( $_submit as $key => $data ) {
+		$query_string .= $key . '=' . urlencode( stripslashes( $data ) ) . '&';
+	}
+	return bb_ksd_http_post( $query_string, $bb_ksd_api_host, $path, $bb_ksd_api_port );
+}
+
+function bb_ksd_submit_ham( $post_id )
+{
+	bb_ksd_submit( $post_id, 'ham' );
+}
+
+function bb_ksd_submit_spam( $post_id )
+{
+	bb_ksd_submit( $post_id, 'spam' );
+}
+
+function bb_ksd_check_post( $post_text )
+{
+	global $bb_current_user;
+	global $bb_ksd_pre_post_status;
+
+	// Don't filter content from users with a trusted role
+	if ( in_array( $bb_current_user->roles[0], bb_trusted_roles() ) ) {
+		return $post_text;
+	}
+
+	$response = bb_ksd_submit( $post_text );
+	if ( 'true' == $response[1] ) {
+		$bb_ksd_pre_post_status = '2';
+	}
+	bb_akismet_delete_old();
+	return $post_text;
+}
+add_action( 'pre_post', 'bb_ksd_check_post', 1 );
+
+function bb_ksd_check_profile( $user_id )
+{
+	global $bb_current_user, $user_obj;
+	$bb_current_id = bb_get_current_user_info( 'id' );
+	bb_set_current_user( $user_id );
+	if ( $bb_current_id && $bb_current_id != $user_id ) {
+		if ( $user_obj->data->is_bozo && !$bb_current_user->data->is_bozo ) {
+			bb_ksd_submit( $user_id, 'hammer' );
+		}
+		if ( !$user_obj->data->is_bozo && $bb_current_user->data->is_bozo ) {
+			bb_ksd_submit( $user_id, 'spammer' );
+		}
+	} else {
+		$response = bb_ksd_submit( $bb_current_user->data->occ . ' ' . $bb_current_user->data->interests );
+		if ( 'true' == $response[1] && function_exists( 'bb_bozon' ) ) {
+			bb_bozon( bb_get_current_user_info( 'id' ) );
+		}
+	}
+	bb_set_current_user( (int) $bb_current_id );
+}
+add_action( 'register_user', 'bb_ksd_check_profile', 1);
+add_action( 'profile_edited', 'bb_ksd_check_profile', 1);
+
+function bb_ksd_new_post( $post_id )
+{
+	global $bb_ksd_pre_post_status;
+	if ( '2' != $bb_ksd_pre_post_status ) {
+		return;
+	}
+	$bb_post = bb_get_post( $post_id );
+	$topic = get_topic( $bb_post->topic_id );
+	if ( 0 == $topic->topic_posts ) {
+		bb_delete_topic( $topic->topic_id, 2 );
+	}
+}
+add_filter( 'bb_new_post', 'bb_ksd_new_post' );
+
+function bb_akismet_delete_old()
+{
+	// Delete old every 20
+	$n = mt_rand( 1, 20 );
+	if ( $n % 20 ) {
+		return;
+	}
+	global $bbdb;
+	$now = bb_current_time( 'mysql' );
+	$posts = (array) $bbdb->get_col( $bbdb->prepare(
+		"SELECT post_id FROM $bbdb->posts WHERE DATE_SUB(%s, INTERVAL 15 DAY) > post_time AND post_status = '2'",
+		$now
+	) );
+	foreach ( $posts as $post ) {
+		bb_delete_post( $post, 1 );
+	}
+}
+
+function bb_ksd_pre_post_status( $post_status )
+{
+	global $bb_ksd_pre_post_status;
+	if ( '2' == $bb_ksd_pre_post_status ) {
+		$post_status = $bb_ksd_pre_post_status;
+	}
+	return $post_status;
+}
+add_filter( 'pre_post_status', 'bb_ksd_pre_post_status' );
+
+function bb_ksd_delete_post( $post_id, $new_status, $old_status )
+{
+	// Don't report post deletion
+	if ( 1 == $new_status ) {
+		return;
+	}
+	// Don't report no change in post status
+	if ( $new_status == $old_status ) {
+		return;
+	}
+	// It's being marked as spam, so report it
+	if ( 2 == $new_status ) {
+		bb_ksd_submit_spam( $post_id );
+		return;
+	}
+	// It's not spam (and not being deleted), so it's ham now
+	if ( 2 == $old_status ) {
+		bb_ksd_submit_ham( $post_id );
+		return;
+	}
+}
+add_action( 'bb_delete_post', 'bb_ksd_delete_post', 10, 3);
+
+function bb_ksd_post_delete_link( $parts, $args )
+{
+	if ( !bb_current_user_can( 'moderate' ) ) {
+		return $parts;
+	}
+	$bb_post = bb_get_post( get_post_id( $args['post_id'] ) );
+
+	if ( 2 == $bb_post->post_status ) {
+		$query = array(
+			'id'     => $bb_post->post_id,
+			'status' => 0,
+			'view'   => 'all'
+		);
+		$display = __('Not Spam');
+	} else {
+		$query = array(
+			'id'     => $bb_post->post_id,
+			'status' => 2
+		);
+		$display = __('Spam');
+	}
+	$uri = bb_get_uri( 'bb-admin/delete-post.php', $query, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN );
+	$uri = esc_url( bb_nonce_url( $uri, 'delete-post_' . $bb_post->post_id ) );
+	if ( !is_array( $parts ) ) {
+		$parts = array();
+		$before = '';
+		$after = '';
+	} else {
+		$before = $args['last_each']['before'];
+		$after = $args['last_each']['after'];
+	}
+
+	// Make sure that the last tag in $before gets a class (if it's there)
+	if ( preg_match( '/.*(<[^>]+>)[^<]*/', $before, $_node ) ) {
+		if ( preg_match( '/class=(\'|")(.*)\1/U', $_node[1], $_class ) ) {
+			$before = str_replace( $_class[0], 'class=' . $_class[1] . 'before-post-spam-link ' . $_class[2] . $_class[1], $before );
+		} else {
+			$before = preg_replace( '/(.*)<([a-z0-9_-]+)(\s?)([^>]*)>([^<]*)/i', '$1<$2 class="before-post-spam-link"$3$4>$5', $before, 1 );
+		}
+	}
+
+	$parts[] = $before . '<a class="post-spam-link" href="' . $uri . '" >' . $display . '</a>' . $after;
+	return $parts;
+}
+add_filter( 'bb_post_admin', 'bb_ksd_post_delete_link', 10, 2 );
+
+function bb_ksd_add_post_status_to_forms( $stati, $type )
+{
+	if ( 'post' === $type ) {
+		$stati['2'] = __( 'Spam' );
+	}
+	return $stati;
+}
+add_filter( 'bb_query_form_post_status', 'bb_ksd_add_post_status_to_forms', 10, 2 );
+
+function bb_ksd_post_del_class( $classes, $post_id, $post )
+{
+	if ( '2' === (string) $post->post_status ) {
+		if ( $classes ) {
+			return $classes . ' spam';
+		}
+		return 'spam';
+	}
+	return $classes;
+}
+add_filter( 'post_del_class', 'bb_ksd_post_del_class', 10, 3 );
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-plugins/bozo.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-plugins/bozo.php
new file mode 100644
index 0000000000000000000000000000000000000000..5510998abfef7564873d00f8d7a424877ff8b13d
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-plugins/bozo.php
@@ -0,0 +1,373 @@
+<?php
+/*
+Plugin Name: Bozo Users
+Plugin URI: http://bbpress.org/
+Description: Allows moderators to mark certain users as a "bozo". Bozo users can post, but their content is only visible to themselves.
+Author: Michael Adams
+Version: 1.1
+Author URI: http://blogwaffe.com/
+*/
+
+function bb_bozo_posts( $where ) {
+	if ( !$id = bb_get_current_user_info( 'id' ) )
+		return $where;
+
+	return preg_replace(
+		'/(\w+\.)?post_status = ["\']?0["\']?/',
+		"( \\1post_status = 0 OR \\1post_status > 1 AND \\1poster_id = '$id' )",
+	$where);
+}
+
+function bb_bozo_topics( $where ) {
+	if ( !$id = bb_get_current_user_info( 'id' ) )
+		return $where;
+
+	return preg_replace(
+		'/(\w+\.)?topic_status = ["\']?0["\']?/',
+		"( \\1topic_status = 0 OR \\1topic_status > 1 AND \\1topic_poster = '$id' )",
+	$where);
+}
+
+// Gets those users with the bozo bit.  Does not grab users who have been bozoed on a specific topic.
+// NOT bbdb::prepared
+function bb_get_bozos( $page = 1 ) {
+	global $bbdb, $bb_last_countable_query;
+	$page = (int) $page;
+	$limit = (int) bb_get_option('page_topics');
+	if ( 1 < $page )
+		$limit = ($limit * ($page - 1)) . ", $limit";
+	$bb_last_countable_query = "SELECT user_id FROM $bbdb->usermeta WHERE meta_key='is_bozo' AND meta_value='1' ORDER BY umeta_id DESC LIMIT $limit";
+	if ( $ids = (array) $bbdb->get_col( $bb_last_countable_query ) )
+		bb_cache_users( $ids );
+	return $ids;
+}
+
+function bb_current_user_is_bozo( $topic_id = false ) {
+	global $bb_current_user;
+	if ( bb_current_user_can('browse_deleted') && 'all' == @$_GET['view'] )
+		return false;
+	$is_bozo = isset($bb_current_user->data->is_bozo) && $bb_current_user->data->is_bozo;
+	if ( !$topic_id || $is_bozo )
+		return $is_bozo;
+
+	global $topic;
+	$topic = get_topic( $topic_id );
+	$id = bb_get_current_user_info( 'id' );
+	return isset($topic->bozos[$id]) && $topic->bozos[$id];
+}
+
+function bb_bozo_pre_permalink() {
+	if ( bb_is_topic() )
+		add_filter( 'get_topic_where', 'bb_bozo_topics' );
+}
+
+function bb_bozo_post_permalink() {
+	if ( bb_is_topic() )
+		remove_filter( 'get_topic_where', 'bb_bozo_topics' );
+}
+
+function bb_bozo_latest_filter() {
+	global $bb_current_user;
+	if ( isset($bb_current_user->data->bozo_topics) && $bb_current_user->data->bozo_topics )
+		add_filter( 'get_latest_topics_where', 'bb_bozo_topics' );
+}
+
+function bb_bozo_topic_db_filter() {
+	global $topic, $topic_id;
+	if ( bb_current_user_is_bozo( $topic->topic_id ? $topic->topic_id : $topic_id ) ) {
+		add_filter( 'get_thread_where', 'bb_bozo_posts' );
+		add_filter( 'get_thread_post_ids_where', 'bb_bozo_posts' );
+	}
+}
+
+function bb_bozo_profile_db_filter() {
+	global $user;
+	if ( bb_get_current_user_info( 'id' ) == $user->ID && @is_array($user->bozo_topics) )
+		add_filter( 'get_recent_user_replies_where', 'bb_bozo_posts' );
+}
+
+function bb_bozo_recount_topics() {
+	global $bbdb;
+	global $messages;
+	if ( isset($_POST['topic-bozo-posts']) && 1 == $_POST['topic-bozo-posts'] ):
+		$old = (array) $bbdb->get_col("SELECT object_id FROM $bbdb->meta WHERE object_type = 'bb_topic' AND meta_key = 'bozos'");
+		$old = array_flip($old);
+		$messages[] = __('Counted the number of bozo posts in each topic');
+		if ( $topics = (array) $bbdb->get_col("SELECT topic_id, poster_id, COUNT(post_id) FROM $bbdb->posts WHERE post_status > 1 GROUP BY topic_id, poster_id") ) :
+			$unique_topics = array_unique($topics);
+			$posters = (array) $bbdb->get_col('', 1);
+			$counts = (array) $bbdb->get_col('', 2);
+			foreach ($unique_topics as $i):
+				$bozos = array();
+				$indices = array_keys($topics, $i);
+				foreach ( $indices as $index )
+					$bozos[(int) $posters[$index]] = (int) $counts[$index]; 
+				if ( $bozos ) :
+					bb_update_topicmeta( $i, 'bozos', $bozos );
+					unset($indices, $index, $old[$i]);
+				endif;
+			endforeach;
+			unset($topics, $i, $counts, $posters, $bozos);
+		endif;
+		if ( $old ) :
+			$old = join(',', array_map('intval', array_flip($old)));
+			$bbdb->query("DELETE FROM $bbdb->meta WHERE object_type = 'bb_topic' AND object_id IN ($old) AND meta_key = 'bozos'");
+		endif;
+	endif;
+}
+
+function bb_bozo_recount_users() {
+	global $bbdb;
+	global $messages;
+	if ( isset($_POST['topics-replied-with-bozos']) && 1 == $_POST['topics-replied-with-bozos'] ) :
+		$messages[] = __('Counted each bozo user&#039;s total posts as well as the total topics to which they have replied');
+		if ( $users = (array) $bbdb->get_col("SELECT ID FROM $bbdb->users") ) :
+			$no_bozos = array();
+			$bozo_mkey = $bbdb->prefix . 'bozo_topics';
+			foreach ( $users as $user ) :
+				$topics_replied = (int) $bbdb->get_var( $bbdb->prepare(
+					"SELECT COUNT(DISTINCT topic_id) FROM $bbdb->posts WHERE post_status = 0 AND poster_id = %d",
+					$user
+				) );
+				bb_update_usermeta( $user, $bbdb->prefix. 'topics_replied', $topics_replied );
+				$bozo_keys = (array) $bbdb->get_col( $bbdb->prepare(
+					"SELECT topic_id, COUNT(post_id) FROM $bbdb->posts WHERE post_status > 1 AND poster_id = %d GROUP BY topic_id",
+					$user
+				) );
+				$bozo_values = (array) $bbdb->get_col('', 1);
+				if ( $c = count($bozo_keys) ) :
+					for ( $i=0; $i < $c; $i++ )
+						$bozo_topics[(int) $bozo_keys[$i]] = (int) $bozo_values[$i];
+					bb_update_usermeta( $user, $bozo_mkey, $bozo_topics );
+				else :
+					$no_bozos[] = (int) $user;
+				endif;
+			endforeach;
+			if ( $no_bozos ) :
+				$no_bozos = join(',', $no_bozos);
+				$bbdb->query( $bbdb->prepare(
+					"DELETE FROM $bbdb->usermeta WHERE user_id IN ($no_bozos) AND meta_key = %s",
+					$bozo_mkey
+				) );
+			endif;
+			unset($users, $user, $topics_replied, $bozo_keys, $bozo_values, $bozo_topics);
+		endif;
+	endif;
+}
+
+function bb_bozo_post_del_class( $classes, $post_id, $post )
+{
+	if ( 1 < $post->post_status && bb_current_user_can('browse_deleted') ) {
+		if ( $classes ) {
+			return $classes . ' bozo';
+		}
+		return 'bozo';
+	}
+	return $classes;
+}
+
+function bb_bozo_add_recount_list() {
+	global $recount_list;
+	$recount_list[21] = array('topics-replied-with-bozos', __('Count each bozo user&#039;s total posts as well as the total topics to which they have replied'), 'bb_bozo_recount_users');
+	$recount_list[22] = array('topic-bozo-posts', __('Count the number of bozo posts in each topic'), 'bb_bozo_recount_topics');
+	return;
+}
+
+function bb_bozo_topic_pages_add( $add ) {
+	global $topic;
+	if ( isset($_GET['view']) && 'all' == $_GET['view'] && bb_current_user_can('browse_deleted') ) :
+		$add += @array_sum($topic->bozos);
+	endif;
+	if ( bb_current_user_is_bozo( $topic->topic_id ) )
+		$add += $topic->bozos[bb_get_current_user_info( 'id' )];
+	return $add;
+}
+
+function bb_bozo_get_topic_posts( $topic_posts ) {
+	global $topic;
+	if ( bb_current_user_is_bozo( $topic->topic_id ) )
+		$topic_posts += $topic->bozos[bb_get_current_user_info( 'id' )];
+	return $topic_posts;
+}
+
+function bb_bozo_new_post( $post_id ) {
+	$bb_post = bb_get_post( $post_id );
+	if ( 1 < $bb_post->post_status )
+		bb_bozon( $bb_post->poster_id, $bb_post->topic_id );
+	$topic = get_topic( $bb_post->topic_id, false );
+	if ( 0 == $topic->topic_posts )
+		bb_delete_topic( $topic->topic_id, 2 );
+}
+
+function bb_bozo_pre_post_status( $status, $post_id, $topic_id ) {
+	if ( !$post_id && bb_current_user_is_bozo() )
+		$status = 2;
+	elseif ( bb_current_user_is_bozo( $topic_id ) )
+		$status = 2;
+	return $status;
+}
+
+function bb_bozo_delete_post( $post_id, $new_status, $old_status ) {
+	$bb_post = bb_get_post( $post_id );
+	if ( 1 < $new_status && 2 > $old_status )
+		bb_bozon( $bb_post->poster_id, $bb_post->topic_id );
+	elseif ( 2 > $new_status && 1 < $old_status )
+		bb_fermion( $bb_post->poster_id, $bb_post->topic_id );
+}
+
+function bb_bozon( $user_id, $topic_id = 0 ) {
+	global $bbdb;
+
+	$user_id = (int) $user_id;
+	$topic_id = (int) $topic_id;
+
+	if ( !$topic_id )
+		bb_update_usermeta( $user_id, 'is_bozo', 1 );
+	else {
+		$topic = get_topic( $topic_id );
+		$user = bb_get_user( $user_id );
+
+		if ( isset($topic->bozos[$user_id]) )
+			$topic->bozos[$user_id]++;
+		elseif ( is_array($topic->bozos) )
+			$topic->bozos[$user_id] = 1;
+		else
+			$topic->bozos = array($user_id => 1);
+		bb_update_topicmeta( $topic_id, 'bozos', $topic->bozos );
+		
+		if ( isset($user->bozo_topics[$topic_id]) )
+			$user->bozo_topics[$topic_id]++;
+		elseif ( is_array($user->bozo_topics) )
+			$user->bozo_topics[$topic_id] = 1;
+		else
+			$user->bozo_topics = array($topic_id => 1);
+		bb_update_usermeta( $user_id, $bbdb->prefix . 'bozo_topics', $user->bozo_topics );
+	}
+}
+
+function bb_fermion( $user_id, $topic_id = 0 ) {
+	global $bbdb;
+
+	$user_id = (int) $user_id;
+	$topic_id = (int) $topic_id;
+
+	if ( !$topic_id )
+		bb_delete_usermeta( $user_id, 'is_bozo' );
+	else {
+		$topic = get_topic( $topic_id );
+		$user = bb_get_user( $user_id );
+		if ( --$topic->bozos[$user_id] < 1 )
+			unset($topic->bozos[$user_id]);
+		bb_update_topicmeta( $topic_id, 'bozos', $topic->bozos );
+		
+		if ( --$user->bozo_topics[$topic_id] < 1 )
+			unset($user->bozo_topics[$topic_id]);
+		bb_update_usermeta( $user_id, $bbdb->prefix . 'bozo_topics', $user->bozo_topics );
+	}
+}
+
+function bb_bozo_profile_admin_keys( $a ) {
+	$a['is_bozo'] = array(
+		0,							// Required
+		__('This user is a bozo'),	// Label
+		'checkbox',					// Type
+		'1',						// Value
+		''							// Default when not set
+	);
+	return $a;
+}
+
+
+
+function bb_bozo_get_bozo_user_ids()
+{
+	global $bbdb;
+	$sql = "SELECT `user_id` FROM `$bbdb->usermeta` WHERE `meta_key` = 'is_bozo' AND `meta_value` = '1';";
+	$user_ids = $bbdb->get_col( $sql, 0 );
+	if ( is_wp_error( $user_ids ) || empty( $user_ids ) ) {
+		return false;
+	}
+	return $user_ids;
+}
+
+function bb_bozo_user_search_description( $description, $h2_search, $h2_role, $user_search_object )
+{
+	if ( is_array( $user_search_object->roles ) && in_array( 'bozo', $user_search_object->roles ) ) {
+		return sprintf( '%1$s%2$s that are bozos', $h2_search, $h2_role );
+	}
+	return $description;
+}
+add_filter( 'bb_user_search_description', 'bb_bozo_user_search_description', 10, 4 );
+
+function bb_bozo_user_search_form_add_inputs( $r, $user_search_object )
+{
+	$checked = '';
+	if ( is_array( $user_search_object->roles ) && in_array( 'bozo', $user_search_object->roles ) ) {
+		$checked = ' checked="checked"';
+	}
+	
+	$r .= "\t" . '<div>' . "\n";
+	$r .= "\t\t" . '<label for="userbozo">' . __('Bozos only') . '</label>' . "\n";
+	$r .= "\t\t" . '<div>' . "\n";
+	$r .= "\t\t\t" . '<input class="checkbox-input" type="checkbox" name="userrole[]" id="userbozo" value="bozo"' . $checked . ' />' . "\n";
+	$r .= "\t\t" . '</div>' . "\n";
+	$r .= "\t" . '</div>' . "\n";
+
+	return $r;
+}
+add_filter( 'bb_user_search_form_inputs', 'bb_bozo_user_search_form_add_inputs', 10, 2 );
+
+function bb_bozo_user_search_role_user_ids( $role_user_ids, $roles, $args )
+{
+	if ( !in_array( 'bozo', $roles ) ) {
+		return $role_user_ids;
+	}
+
+	$bozo_user_ids = bb_bozo_get_bozo_user_ids();
+
+	if ( 1 === count( $roles ) ) {
+		return $bozo_user_ids;
+	}
+
+	global $bbdb;
+	$role_meta_key = $bbdb->escape( $bbdb->prefix . 'capabilities' );
+	$role_sql_terms = array();
+	foreach ( $roles as $role ) {
+		if ( 'bozo' === $role ) {
+			continue;
+		}
+		$role_sql_terms[] = "`meta_value` LIKE '%" . $bbdb->escape( like_escape( $role ) ) . "%'";
+	}
+	$role_sql_terms = join( ' OR ', $role_sql_terms );
+	$role_sql = "SELECT `user_id` FROM `$bbdb->usermeta` WHERE `meta_key` = '$role_meta_key' AND ($role_sql_terms);";
+	$role_user_ids = $bbdb->get_col( $role_sql, 0 );
+	if ( is_wp_error( $role_user_ids ) || empty( $role_user_ids ) ) {
+		return array();
+	}
+
+	return array_intersect( $bozo_user_ids, $role_user_ids );
+}
+add_filter( 'bb_user_search_role_user_ids', 'bb_bozo_user_search_role_user_ids', 10, 3 );
+
+
+
+
+add_filter( 'pre_post_status', 'bb_bozo_pre_post_status', 5, 3 );
+add_action( 'bb_new_post', 'bb_bozo_new_post', 5 );
+add_action( 'bb_delete_post', 'bb_bozo_delete_post', 5, 3 );
+
+add_action( 'pre_permalink', 'bb_bozo_pre_permalink' );
+add_action( 'post_permalink', 'bb_bozo_post_permalink' );
+add_action( 'bb_index.php_pre_db', 'bb_bozo_latest_filter' );
+add_action( 'bb_forum.php_pre_db', 'bb_bozo_latest_filter' );
+add_action( 'bb_topic.php_pre_db', 'bb_bozo_topic_db_filter' );
+add_action( 'bb_profile.php_pre_db', 'bb_bozo_profile_db_filter' );
+
+add_action( 'bb_recount_list', 'bb_bozo_add_recount_list' );
+add_action( 'topic_pages_add', 'bb_bozo_topic_pages_add' );
+
+add_filter( 'post_del_class', 'bb_bozo_post_del_class', 10, 3 );
+add_filter( 'get_topic_posts', 'bb_bozo_get_topic_posts' );
+
+add_filter( 'get_profile_admin_keys', 'bb_bozo_profile_admin_keys' );
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-plugins/hello.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-plugins/hello.php
new file mode 100644
index 0000000000000000000000000000000000000000..4ab4d438be590ba7bd02f44b584da5e7dbdf7399
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-plugins/hello.php
@@ -0,0 +1,84 @@
+<?php
+/**
+ * @package Hello_Louie
+ * @author Matt Mullenweg
+ * @version 1.0
+ */
+/*
+Plugin Name: Hello Louie
+Plugin URI: http://bbpress.org/
+Description: A tip of the hat to the venerable Hello Dolly plugin from WordPress. When activated you will randomly see a lyric from Frank Sinatra's 1964 rendition of "Hello Dolly" in the upper right of your admin screen on every page. This version includes a rewritten second verse as a tribute to Louis Armstrong.
+Author: Matt Mullenweg
+Version: 1.0
+Author URI: http://ma.tt/
+*/
+
+function hello_louie_get_lyric() {
+	/** These are the lyrics to Frank Sinatra's version of "Hello Dolly" from the album "It Might as Well Be Swing" */
+	$lyrics = "Hello Dolly
+Well hello Dolly
+It's so nice to have you back where you belong
+You're lookin' swell, Dolly
+We can tell, Dolly
+You're still glowin', you're still crowin'
+You're still goin' strong
+We feel the room swayin'
+'Cause the band's playin'
+One of your old favorite songs from way back when
+Take her wrap, fellas
+Find her an empty lap, fellas
+Dolly'll never go away
+Dolly'll never go away
+Hello Satch
+This is Francis, Louie
+It's so nice to see you back where you belong
+You're back on top, Louie
+Never stop, Louie
+You're still singin', you're still swingin'
+You're still goin' strong
+You get the room swayin'
+When you start in playin'
+One of your great songs, or songs from way back when
+Blow your horn, Louie
+Sing up a great big song, Louie
+Promise you won't go away
+Promise you won't go away
+Promise you won't go away again, ooh yeah";
+
+	// Here we split it into lines
+	$lyrics = explode("\n", $lyrics);
+
+	// And then randomly choose a line
+	return wptexturize( $lyrics[ mt_rand(0, count($lyrics) - 1) ] );
+}
+
+// This just echoes the chosen line, we'll position it later
+function hello_louie() {
+	$chosen = hello_louie_get_lyric();
+	echo "<p id='dolly'>$chosen</p>";
+}
+
+// Now we set that function up to execute when the admin_footer action is called
+add_action('bb_admin_footer', 'hello_louie');
+
+// We need some CSS to position the paragraph
+function louie_css() {
+	// This makes sure that the positioning is also good for right-to-left languages
+	global $bb_locale;
+	$x = ( isset( $bb_locale->text_direction ) && 'rtl' == $bb_locale->text_direction ) ? 'left' : 'right';
+
+	echo "
+	<style type='text/css'>
+	#dolly {
+		position: absolute;
+		top: 4.4em;
+		margin: 0;
+		padding: 0;
+		$x: 15px;
+		font-size: 11px;
+	}
+	</style>
+	";
+}
+
+add_action('bb_admin_head', 'louie_css');
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-plugins/readme.txt b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-plugins/readme.txt
new file mode 100644
index 0000000000000000000000000000000000000000..1458032a864f5f079f870f647d017618ad080d4f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-plugins/readme.txt
@@ -0,0 +1,3 @@
+This directory is reserved for plugins distributed with the bbPress core package.
+
+If you wish to install more plugins, you should create a new directory called "my-plugins" in the base directory of your bbPress installation and install them there, not here.
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-post.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-post.php
new file mode 100644
index 0000000000000000000000000000000000000000..acb97563ddf2747e951b3bd52c0559f13637c094
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-post.php
@@ -0,0 +1,61 @@
+<?php
+require('./bb-load.php');
+
+bb_auth('logged_in');
+
+if ( $throttle_time = bb_get_option( 'throttle_time' ) )
+	if ( isset($bb_current_user->data->last_posted) && time() < $bb_current_user->data->last_posted + $throttle_time && !bb_current_user_can('throttle') )
+		bb_die(__('Slow down; you move too fast.'));
+
+if ( !$post_content = trim($_POST['post_content']) )
+	bb_die(__('You need to actually submit some content!'));
+
+if ( isset($_POST['topic']) && $forum_id = (int) $_POST['forum_id'] ) {
+	if ( !bb_current_user_can('write_posts') )
+		bb_die(__('You are not allowed to post.  Are you logged in?'));
+
+	if ( !bb_current_user_can( 'write_topic', $forum_id ) )
+		bb_die(__('You are not allowed to write new topics.'));
+
+	bb_check_admin_referer( 'create-topic' );
+
+	$topic = trim( $_POST['topic'] );
+	$tags  = trim( $_POST['tags']  );
+
+	if ('' == $topic)
+		bb_die(__('Please enter a topic title'));
+
+	$topic_id = bb_new_topic( $topic, $forum_id, $tags );
+
+} elseif ( isset($_POST['topic_id'] ) ) {
+	$topic_id = (int) $_POST['topic_id'];
+	bb_check_admin_referer( 'create-post_' . $topic_id );
+}
+
+if ( !bb_current_user_can( 'write_post', $topic_id ) )
+	bb_die(__('You are not allowed to post.  Are you logged in?'));
+
+if ( !topic_is_open( $topic_id ) )
+	bb_die(__('This topic has been closed'));
+
+$post_id = bb_new_post( $topic_id, $_POST['post_content'] );
+
+$tags  = trim( $_POST['tags']  );
+bb_add_topic_tags( $topic_id, $tags );
+
+$link = get_post_link($post_id);
+
+$topic = get_topic( $topic_id, false );
+
+if ( $topic->topic_posts )
+	$link = add_query_arg( 'replies', $topic->topic_posts, $link );
+
+// This action used to be bb_post.php, changed to avoid conflict in bb_load_template()
+do_action( 'bb-post.php', $post_id );
+if ($post_id)
+	wp_redirect( $link );
+else
+	wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
+exit;
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-reset-password.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-reset-password.php
new file mode 100644
index 0000000000000000000000000000000000000000..87b74a8e4b100d2814de88153e5cd517648d1bf3
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-reset-password.php
@@ -0,0 +1,24 @@
+<?php
+require('./bb-load.php');
+
+$error = false;
+
+if ( $_POST ) {
+	$action = 'send_key';
+	$user_login = sanitize_user( $_POST['user_login'], true );
+	if ( empty( $user_login ) ) {
+		$error = __('No username specified');
+	} else {
+		$send_key_result = bb_reset_email( $user_login );
+		if ( is_wp_error( $send_key_result ) )
+			$error = $send_key_result->get_error_message();
+	}
+} elseif ( isset( $_GET['key'] ) ) {
+	$action = 'reset_password';
+	$reset_pasword_result = bb_reset_password( $_GET['key'] );
+	if ( is_wp_error( $reset_pasword_result ) )
+		$error = $reset_pasword_result->get_error_message();
+}
+
+bb_load_template( 'password-reset.php', array('action', 'error') );
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-settings.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-settings.php
new file mode 100644
index 0000000000000000000000000000000000000000..b06a5a5e0203af3da88b9184a36a19d482d50e4b
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-settings.php
@@ -0,0 +1,1219 @@
+<?php
+/**
+ * Used to setup and fix common variables and include
+ * the bbPress and BackPress procedural and class libraries.
+ *
+ * You should not have to change this file, all configuration
+ * should be possible in bb-config.php
+ *
+ * @package bbPress
+ */
+
+
+
+// Die if called directly
+if ( !defined( 'BB_PATH' ) ) {
+	die( 'This file cannot be called directly.' );
+}
+
+
+
+/**
+ * bb_unregister_GLOBALS() - Turn register globals off
+ *
+ * @access private
+ * @return null Will return null if register_globals PHP directive was disabled
+ */
+function bb_unregister_GLOBALS()
+{
+	if ( !ini_get( 'register_globals' ) ) {
+		return;
+	}
+
+	if ( isset($_REQUEST['GLOBALS']) ) {
+		die( 'GLOBALS overwrite attempt detected' );
+	}
+
+	// Variables that shouldn't be unset
+	$noUnset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'bb_table_prefix', 'bb' );
+
+	$input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() );
+	foreach ( $input as $k => $v ) {
+		if ( !in_array( $k, $noUnset ) && isset( $GLOBALS[$k] ) ) {
+			$GLOBALS[$k] = NULL;
+			unset( $GLOBALS[$k] );
+		}
+	}
+}
+bb_unregister_GLOBALS();
+
+
+
+/**
+ * Let bbPress know what we are up to at the moment
+ */
+
+/**
+ * Whether the current script is in the admin area or not
+ */
+if ( !defined( 'BB_IS_ADMIN' ) ) {
+	define( 'BB_IS_ADMIN', false );
+} elseif ( BB_IS_ADMIN ) {
+	$bb_hardcoded = (array) $bb;
+}
+
+/**
+ * Whether the current script is part of the installation process or not
+ * @since 1.0
+ */
+if ( !defined( 'BB_INSTALLING' ) ) {
+	define( 'BB_INSTALLING', false );
+}
+
+/**
+ * Whether to load deprecated routines, constants and functions
+ * @since 1.0
+ */
+if ( !defined( 'BB_LOAD_DEPRECATED' ) ) {
+	define( 'BB_LOAD_DEPRECATED', true );
+}
+
+
+
+/**
+ * Remove filters and action that have been set by an included WordPress install
+ */
+if ( defined( 'ABSPATH' ) ) {
+	$wp_filter = array();
+	$wp_actions = array();
+	$merged_filters = array();
+	$wp_current_filter = array();
+}
+
+
+
+/**
+ * Define include paths and load core BackPress libraries
+ */
+
+/**
+ * The full path to the BackPress libraries
+ */
+if ( !defined( 'BACKPRESS_PATH' ) ) {
+	define( 'BACKPRESS_PATH', BB_PATH . BB_INC . 'backpress/' );
+}
+
+// Load logging class
+require_once( BACKPRESS_PATH . 'class.bp-log.php' );
+$bb_log = new BP_Log();
+if ( defined( 'BB_LOG_LEVEL' ) ) {
+	$bb_log->set_level( BB_LOG_LEVEL );
+}
+if ( defined( 'BB_LOG_TYPE' ) ) {
+	$bb_log->set_type( BB_LOG_TYPE );
+}
+if ( defined( 'BB_LOG_FILENAME' ) ) {
+	$bb_log->set_filename( BB_LOG_FILENAME );
+}
+$bb_log->notice('Logging started');
+
+// Load core BackPress functions
+require_once( BACKPRESS_PATH . 'functions.core.php' );
+require_once( BACKPRESS_PATH . 'functions.compat.php' );
+require_once( BACKPRESS_PATH . 'functions.formatting.php' );
+
+// WP_Error
+if ( !class_exists( 'WP_Error' ) ) {
+	require_once( BACKPRESS_PATH . 'class.wp-error.php' );
+}
+
+
+
+/**
+ * Set up database parameters based on config and initialise
+ */
+
+/**
+ * Define the full path to the database class
+ */
+if ( !defined( 'BB_DATABASE_CLASS_INCLUDE' ) ) {
+	define( 'BB_DATABASE_CLASS_INCLUDE', BACKPRESS_PATH . 'class.bpdb-multi.php' );
+}
+
+/**
+ * Define the name of the database class
+ */
+if ( !defined( 'BB_DATABASE_CLASS' ) ) {
+	define( 'BB_DATABASE_CLASS', 'BPDB_Multi' );
+}
+
+if ( in_array( BB_DATABASE_CLASS, array( 'BPDB', 'BPDB_Multi' ) ) ) {
+	/**
+	 * Define BackPress Database errors if not already done - no localisation at this stage
+	 */
+	if ( !defined( 'BPDB__CONNECT_ERROR_MESSAGE' ) ) {
+		define( 'BPDB__CONNECT_ERROR_MESSAGE', 'ERROR: Could not establish a database connection' );
+	}
+	if ( !defined( 'BPDB__CONNECT_ERROR_MESSAGE' ) ) {
+		define( 'BPDB__SELECT_ERROR_MESSAGE', 'ERROR: Can\'t select database.' );
+	}
+	if ( !defined( 'BPDB__ERROR_STRING' ) ) {
+		define( 'BPDB__ERROR_STRING', 'ERROR: bbPress database error - "%s" for query "%s" via caller "%s"' );
+	}
+	if ( !defined( 'BPDB__ERROR_HTML' ) ) {
+		define( 'BPDB__ERROR_HTML', '<div id="error"><p class="bpdberror"><strong>Database error:</strong> [%s]<br /><code>%s</code><br />Caller: %s</p></div>' );
+	}
+	if ( !defined( 'BPDB__DB_VERSION_ERROR' ) ) {
+		define( 'BPDB__DB_VERSION_ERROR', 'ERROR: bbPress requires MySQL 4.0.0 or higher' );
+	}
+	if ( !defined( 'BPDB__PHP_EXTENSION_MISSING' ) ) {
+		define( 'BPDB__PHP_EXTENSION_MISSING', 'ERROR: bbPress requires The MySQL PHP extension' );
+	}
+}
+
+// Load the database class
+if ( BB_DATABASE_CLASS_INCLUDE ) {
+	require_once( BB_DATABASE_CLASS_INCLUDE );
+}
+
+// Die if there is no database table prefix
+if ( !$bb_table_prefix ) {
+	die( 'You must specify a table prefix in your <code>bb-config.php</code> file.' );
+}
+
+// Setup the global database connection
+$bbdb_class = BB_DATABASE_CLASS;
+$bbdb =& new $bbdb_class( array(
+	'name' => BBDB_NAME,
+	'user' => BBDB_USER,
+	'password' => BBDB_PASSWORD,
+	'host' => BBDB_HOST,
+	'charset' => defined( 'BBDB_CHARSET' ) ? BBDB_CHARSET : false,
+	'collate' => defined( 'BBDB_COLLATE' ) ? BBDB_COLLATE : false
+) );
+unset( $bbdb_class );
+
+/**
+ * bbPress tables
+ */
+$bbdb->tables = array(
+	'forums'             => false,
+	'meta'               => false,
+	'posts'              => false,
+	'tagged'             => false, // Deprecated
+	'tags'               => false, // Deprecated
+	'terms'              => false,
+	'term_relationships' => false,
+	'term_taxonomy'      => false,
+	'topics'             => false,
+	'topicmeta'          => false, // Deprecated
+	'users'              => false,
+	'usermeta'           => false
+);
+
+// Set the prefix on the tables
+if ( is_wp_error( $bbdb->set_prefix( $bb_table_prefix ) ) ) {
+	die( 'Your table prefix may only contain letters, numbers and underscores.' );
+}
+
+// Set a site id if there isn't one already
+if ( !isset( $bb->site_id ) ) {
+	$bb->site_id = 1;
+}
+
+
+
+/**
+ * Load core bbPress libraries
+ */
+
+require_once( BB_PATH . BB_INC . 'functions.bb-core.php' );
+require_once( BB_PATH . BB_INC . 'functions.bb-forums.php' );
+require_once( BB_PATH . BB_INC . 'functions.bb-topics.php' );
+require_once( BB_PATH . BB_INC . 'functions.bb-posts.php' );
+require_once( BB_PATH . BB_INC . 'functions.bb-topic-tags.php' );
+require_once( BB_PATH . BB_INC . 'functions.bb-users.php' );
+require_once( BB_PATH . BB_INC . 'functions.bb-meta.php' );
+require_once( BB_PATH . BB_INC . 'class.bb-query.php' );
+require_once( BB_PATH . BB_INC . 'class.bb-walker.php' );
+
+
+
+/**
+ * Load API and object handling BackPress libraries
+ */
+
+// Plugin API
+if ( !function_exists( 'add_filter' ) ) {
+	require_once( BACKPRESS_PATH . 'functions.plugin-api.php' );
+}
+
+// Shortcodes API
+if ( !function_exists( 'add_shortcode' ) ) {
+	require_once( BACKPRESS_PATH . 'functions.shortcodes.php' );
+} else {
+	remove_all_shortcodes();
+}
+
+
+
+/**
+ * Define the full path to the object cache functions include
+ */
+$_internal_object_cache_functions_include = BACKPRESS_PATH . 'loader.wp-object-cache.php';
+$_memcached_object_cache_functions_include = BACKPRESS_PATH . 'loader.wp-object-cache-memcached.php';
+if ( !defined( 'BB_OBJECT_CACHE_FUNCTIONS_INCLUDE' ) ) {
+	if ( defined( 'BB_OBJECT_CACHE_TYPE' ) && 'memcached' === BB_OBJECT_CACHE_TYPE ) {
+		define( 'BB_OBJECT_CACHE_FUNCTIONS_INCLUDE', $_memcached_object_cache_functions_include );
+	} else {
+		define( 'BB_OBJECT_CACHE_FUNCTIONS_INCLUDE', $_internal_object_cache_functions_include );
+	}
+}
+
+// See if a caching class is already loaded (by WordPress)
+if ( function_exists( 'wp_cache_init' ) ) {
+	if ( isset( $_wp_using_ext_object_cache ) ) {
+		$_bb_using_ext_object_cache = $_wp_using_ext_object_cache;
+	} else {
+		$_bb_using_ext_object_cache = false;
+	}
+} elseif ( BB_OBJECT_CACHE_FUNCTIONS_INCLUDE ) {
+	// Load the object cache class
+	require_once( BB_OBJECT_CACHE_FUNCTIONS_INCLUDE );
+	if ( BB_OBJECT_CACHE_FUNCTIONS_INCLUDE === $_internal_object_cache_functions_include ) {
+		$_bb_using_ext_object_cache = false;
+	} else {
+		$_bb_using_ext_object_cache = true;
+	}
+}
+unset( $_internal_object_cache_functions_include );
+
+// Instantiate the $wp_object_cache object using wp_cache_init()
+if ( function_exists( 'wp_cache_init' ) ) {
+	// Clear WordPress cache if it exists already - maybe should save and re-load?
+	unset( $wp_object_cache );
+	wp_cache_init();
+	if ( function_exists( 'wp_cache_add_global_groups' ) ) {
+		wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'useremail', 'usernicename' ) );
+	}
+}
+
+
+
+/**
+ * Load mapping class for BackPress to store options
+ */
+require_once( BB_PATH . BB_INC . 'class.bp-options.php' );
+require_once( BACKPRESS_PATH . 'functions.bp-options.php' );
+
+
+
+/**
+ * Load WP_Http class
+ */
+if ( !class_exists( 'WP_Http' ) ) {
+	require_once( BACKPRESS_PATH . 'class.wp-http.php' );
+}
+
+
+
+/**
+ * Determine language settings and load i10n libraries as required
+ */
+
+/**
+ * The full path to the directory containing language files
+ */
+if ( !defined( 'BB_LANG_DIR' ) ) {
+	if ( BB_LOAD_DEPRECATED && defined( 'BBLANGDIR' ) ) {
+		// User has set old constant
+		bb_log_deprecated( 'constant', 'BBLANGDIR', 'BB_LANG_DIR' );
+		define( 'BB_LANG_DIR', BBLANGDIR );
+	} else {
+		define( 'BB_LANG_DIR', BB_PATH . 'my-languages/' ); // absolute path with trailing slash
+	}
+}
+
+/**
+ * The language in which to display bbPress
+ */
+if ( BB_LOAD_DEPRECATED && !defined( 'BB_LANG' ) && defined( 'BBLANG' ) && '' != BBLANG ) {
+	// User has set old constant
+	bb_log_deprecated( 'constant', 'BBLANG', 'BB_LANG' );
+	define( 'BB_LANG', BBLANG );
+}
+if ( !class_exists( 'MO' ) ) {
+	require_once( BACKPRESS_PATH . 'pomo/mo.php' );
+}
+
+// Is WordPress loaded
+if ( !defined( 'BB_IS_WP_LOADED') ) {
+	define( 'BB_IS_WP_LOADED', defined( 'DB_NAME' ) );
+}
+
+// Only load this if WordPress isn't loaded
+if ( !BB_IS_WP_LOADED ) {
+	require_once( BACKPRESS_PATH . 'functions.kses.php' );
+}
+require_once( BB_PATH . BB_INC . 'functions.bb-l10n.php' );
+
+
+
+/**
+ * Routines related to installation
+ */
+
+// Load BB_CHANNELS_INCLUDE if it exists, must be done before the install is completed
+if ( defined( 'BB_CHANNELS_INCLUDE' ) && file_exists( BB_CHANNELS_INCLUDE ) && !is_dir( BB_CHANNELS_INCLUDE ) ) {
+	require_once( BB_CHANNELS_INCLUDE );
+}
+
+// If there is no forum table in the database then redirect to the installer
+if ( !BB_INSTALLING && !bb_is_installed() ) {
+	$link = preg_replace( '|(/bb-admin)?/[^/]+?$|', '/', $_SERVER['PHP_SELF'] ) . 'bb-admin/install.php';
+	require_once( BB_PATH . BB_INC . 'functions.bb-pluggable.php' );
+	wp_redirect( $link );
+	die();
+}
+
+// Setup some variables in the $bb class if they don't exist - some of these are deprecated
+if ( BB_LOAD_DEPRECATED ) {
+	foreach ( array( 'use_cache' => false, 'debug' => false ) as $o => $oo ) {
+		if ( !isset( $bb->$o ) ) {
+			$bb->$o = $oo;
+		} else {
+			bb_log_deprecated( 'variable', '$bb->' . $o );
+		}
+	}
+	unset( $o, $oo );
+}
+
+// Disable plugins during installation
+if ( BB_INSTALLING ) {
+	foreach ( array('active_plugins') as $i ) {
+		$bb->$i = false;
+	}
+	unset( $i );
+}
+
+
+
+/**
+ * Load additional bbPress libraries
+ */
+
+require_once( BB_PATH . BB_INC . 'functions.bb-formatting.php' );
+require_once( BB_PATH . BB_INC . 'functions.bb-template.php' );
+require_once( BB_PATH . BB_INC . 'functions.bb-capabilities.php' );
+require_once( BB_PATH . BB_INC . 'class.bb-pingbacks.php' );
+
+
+
+// Cache options from the database
+if ( !isset( $bb->load_options ) ) {
+	$bb->load_options = true;
+}
+if ( $bb->load_options ) {
+	$bbdb->suppress_errors();
+	bb_cache_all_options();
+	$bbdb->suppress_errors( false );
+}
+
+/**
+ * Set the URI and derivitaves
+ */
+if ( $bb->uri = bb_get_option( 'uri' ) ) {
+	$bb->uri = rtrim( trim( $bb->uri ), " \t\n\r\0\x0B/" ) . '/';
+	
+	if ( preg_match( '@^(https?://[^/]+)((?:/.*)*/{1,1})$@i', $bb->uri, $matches ) ) {
+		// Used when setting up cookie domain
+		$bb->domain = $matches[1];
+		// Used when setting up cookie paths
+		$bb->path = $matches[2];
+	}
+	unset( $matches );
+} elseif ( BB_LOAD_DEPRECATED ) {
+	// Backwards compatibility
+	// These were never set in the database
+	if ( isset( $bb->domain ) ) {
+		bb_log_deprecated( 'variable', '$bb->domain', '$bb->uri' );
+		$bb->domain = rtrim( trim( $bb->domain ), " \t\n\r\0\x0B/" );
+	}
+	if ( isset( $bb->path ) ) {
+		bb_log_deprecated( 'variable', '$bb->path', '$bb->uri' );
+		$bb->path = trim( $bb->path );
+		if ( $bb->path != '/' ) $bb->path = '/' . trim( $bb->path, " \t\n\r\0\x0B/" ) . '/';
+	}
+	// We need both to build a uri
+	if ( $bb->domain && $bb->path ) {
+		$bb->uri = $bb->domain . $bb->path;
+	}
+}
+
+// Die if no URI
+if ( !BB_INSTALLING && !$bb->uri ) {
+	bb_die( __( 'Could not determine site URI' ) );
+}
+
+/**
+ * BB_FORCE_SSL_USER_FORMS - Whether to force use of ssl on user forms like login, registration and profile editing
+ */
+if ( !defined( 'BB_FORCE_SSL_USER_FORMS' ) ) {
+	define( 'BB_FORCE_SSL_USER_FORMS', false );
+}
+force_ssl_login( BB_FORCE_SSL_USER_FORMS );
+
+/**
+ * BB_FORCE_SSL_ADMIN - Whether to force use of ssl in the admin area
+ */
+if ( !defined( 'BB_FORCE_SSL_ADMIN' ) ) {
+	define( 'BB_FORCE_SSL_ADMIN', false );
+}
+force_ssl_admin( BB_FORCE_SSL_ADMIN );
+
+// Load default filters
+require_once( BB_PATH . BB_INC . 'defaults.bb-filters.php' );
+
+// Load default scripts
+require_once( BB_PATH . BB_INC . 'functions.bb-script-loader.php' );
+
+// Sanitise external input
+$_GET    = bb_global_sanitize( $_GET );
+$_POST   = bb_global_sanitize( $_POST );
+$_COOKIE = bb_global_sanitize( $_COOKIE, false );
+$_SERVER = bb_global_sanitize( $_SERVER );
+
+
+
+/**
+ * Define theme and plugin constants
+ */
+
+/**
+ * Full path to the location of the core plugins directory
+ */
+define( 'BB_CORE_PLUGIN_DIR', BB_PATH . 'bb-plugins/' );
+
+/**
+ * Full URL of the core plugins directory
+ */
+define( 'BB_CORE_PLUGIN_URL', $bb->uri . 'bb-plugins/' );
+
+/**
+ * Full path to the location of the core themes directory
+ */
+define( 'BB_CORE_THEME_DIR', BB_PATH . 'bb-templates/' );
+
+/**
+ * Full URL of the core themes directory
+ */
+define( 'BB_CORE_THEME_URL', $bb->uri . 'bb-templates/' );
+
+/**
+ * The default theme
+ */
+define( 'BB_DEFAULT_THEME', 'core#kakumei' );
+
+/**
+ * Full path to the location of the default theme directory
+ */
+define( 'BB_DEFAULT_THEME_DIR', BB_CORE_THEME_DIR . 'kakumei/' );
+
+/**
+ * Full URL of the default theme directory
+ */
+define( 'BB_DEFAULT_THEME_URL', BB_CORE_THEME_URL . 'kakumei/' );
+
+/**
+ * Full path to the location of the user plugins directory
+ */
+if ( !defined( 'BB_PLUGIN_DIR' ) ) {
+	if ( BB_LOAD_DEPRECATED && defined( 'BBPLUGINDIR' ) ) {
+		// User has set old constant
+		bb_log_deprecated( 'constant', 'BBPLUGINDIR', 'BB_PLUGIN_DIR' );
+		define( 'BB_PLUGIN_DIR', BBPLUGINDIR );
+	} else {
+		define( 'BB_PLUGIN_DIR', BB_PATH . 'my-plugins/' );
+	}
+}
+
+/**
+ * Full URL of the user plugins directory
+ */
+if ( !defined( 'BB_PLUGIN_URL' ) ) {
+	if ( BB_LOAD_DEPRECATED && defined( 'BBPLUGINURL' ) ) {
+		// User has set old constant
+		bb_log_deprecated( 'constant', 'BBPLUGINURL', 'BB_PLUGIN_URL' );
+		define( 'BB_PLUGIN_URL', BBPLUGINURL );
+	} else {
+		define( 'BB_PLUGIN_URL', $bb->uri . 'my-plugins/' );
+	}
+}
+
+/**
+ * Full path to the location of the user themes directory
+ */
+if ( !defined( 'BB_THEME_DIR' ) ) {
+	if ( BB_LOAD_DEPRECATED && defined( 'BBTHEMEDIR' ) ) {
+		// User has set old constant
+		bb_log_deprecated( 'constant', 'BBTHEMEDIR', 'BB_THEME_DIR' );
+		define( 'BB_THEME_DIR', BBTHEMEDIR );
+	} else {
+		define( 'BB_THEME_DIR', BB_PATH . 'my-templates/' );
+	}
+}
+
+/**
+ * Full URL of the user themes directory
+ */
+if ( !defined( 'BB_THEME_URL' ) ) {
+	if ( BB_LOAD_DEPRECATED && defined( 'BBTHEMEURL' ) ) {
+		// User has set old constant
+		bb_log_deprecated( 'constant', 'BBTHEMEURL', 'BB_THEME_URL' );
+		define( 'BB_THEME_URL', BBTHEMEURL );
+	} else {
+		define( 'BB_THEME_URL', $bb->uri . 'my-templates/' );
+	}
+}
+
+/**
+ * Look-up arrays provide easier access to arbitrary plugin and theme locations
+ */
+$_default_plugin_locations = array(
+	'core' => array(
+		'dir' => BB_CORE_PLUGIN_DIR,
+		'url' => BB_CORE_PLUGIN_URL,
+		'cap' => 'manage_plugins'
+	),
+	'user' => array(
+		'dir' => BB_PLUGIN_DIR,
+		'url' => BB_PLUGIN_URL,
+		'cap' => 'manage_plugins'
+	)
+);
+
+if ( isset( $bb->plugin_locations ) && is_array( $bb->plugin_locations ) ) {
+	$bb->plugin_locations = array_merge( $_default_plugin_locations, $bb->plugin_locations );
+} else {
+	$bb->plugin_locations = $_default_plugin_locations;
+}
+
+// Don't accept a plugin location called "all". Unlikely, but really not desirable.
+if ( isset( $bb->plugin_locations['all'] ) ) {
+	unset( $bb->plugin_locations['all'] );
+}
+
+$_default_theme_locations = array(
+	'core' => array(
+		'dir' => BB_CORE_THEME_DIR,
+		'url' => BB_CORE_THEME_URL,
+		'cap' => 'manage_themes'
+	),
+	'user' => array(
+		'dir' => BB_THEME_DIR,
+		'url' => BB_THEME_URL,
+		'cap' => 'manage_themes'
+	)
+);
+
+if ( isset( $bb->theme_locations ) && is_array( $bb->theme_locations ) ) {
+	$bb->theme_locations = array_merge( $_default_theme_locations, $bb->theme_locations );
+} else {
+	$bb->theme_locations = $_default_theme_locations;
+}
+
+
+
+/**
+ * Add custom tables if present
+ */
+
+// Resolve the various ways custom user tables might be setup
+bb_set_custom_user_tables();
+
+// Add custom databases if required
+if ( isset( $bb->custom_databases ) ) {
+	foreach ( $bb->custom_databases as $connection => $database ) {
+		$bbdb->add_db_server( $connection, $database );
+	}
+}
+unset( $connection, $database );
+
+// Add custom tables if required
+if ( isset( $bb->custom_tables ) ) {
+	$bbdb->tables = array_merge( $bbdb->tables, $bb->custom_tables );
+	if ( is_wp_error( $bbdb->set_prefix( $bbdb->prefix ) ) ) {
+		die( __( 'Your user table prefix may only contain letters, numbers and underscores.' ) );
+	}
+}
+
+
+
+/**
+ * Sort out cookies so they work with WordPress (if required)
+ * Note that database integration is no longer a pre-requisite for cookie integration
+ */
+
+$bb->wp_siteurl = bb_get_option( 'wp_siteurl' );
+if ( $bb->wp_siteurl ) {
+	$bb->wp_siteurl = rtrim( trim( $bb->wp_siteurl ), " \t\n\r\0\x0B/" );
+}
+
+$bb->wp_home = bb_get_option( 'wp_home' );
+if ( $bb->wp_home ) {
+	$bb->wp_home = rtrim( trim( $bb->wp_home ), " \t\n\r\0\x0B/" );
+}
+
+$bb->wp_cookies_integrated = false;
+$bb->cookiedomain = bb_get_option( 'cookiedomain' );
+$bb->cookiepath = bb_get_option( 'cookiepath' );
+$bb->wordpress_mu_primary_blog_id = bb_get_option( 'wordpress_mu_primary_blog_id' );
+
+if ( $bb->wp_siteurl && $bb->wp_home ) {
+	if ( $bb->cookiedomain ) {
+		$bb->wp_cookies_integrated = true;
+	} else {
+		$cookiedomain = bb_get_common_domains( $bb->uri, $bb->wp_home );
+		if ( bb_match_domains( $bb->uri, $bb->wp_home ) ) {
+			if ( $bb->wordpress_mu_primary_blog_id ) {
+				$bb->cookiedomain = '.' . $cookiedomain;
+			}
+			if ( !$bb->cookiepath ) {
+				$bb->cookiepath = bb_get_common_paths( $bb->uri, $bb->wp_home );
+			}
+			$bb->wp_cookies_integrated = true;
+		} elseif ( $cookiedomain && strpos( $cookiedomain, '.' ) !== false ) {
+			$bb->cookiedomain = '.' . $cookiedomain;
+			if ( !$bb->cookiepath ) {
+				$bb->cookiepath = bb_get_common_paths( $bb->uri, $bb->wp_home );
+			}
+			$bb->wp_cookies_integrated = true;
+		}
+		unset( $cookiedomain );
+	}
+}
+
+define( 'BB_HASH', $bb->wp_cookies_integrated ? md5( $bb->wp_siteurl ) : md5( $bb->uri ) );
+
+if ( BB_LOAD_DEPRECATED ) {
+	// Deprecated setting
+	$bb->usercookie = bb_get_option( 'usercookie' );
+	if ( !$bb->usercookie ) {
+		$bb->usercookie = ( $bb->wp_cookies_integrated ? 'wordpressuser_' : 'bb_user_' ) . BB_HASH;
+	} else {
+		bb_log_deprecated( 'variable', '$bb->usercookie' );
+	}
+
+	// Deprecated setting
+	$bb->passcookie = bb_get_option( 'passcookie' );
+	if ( !$bb->passcookie ) {
+		$bb->passcookie = ( $bb->wp_cookies_integrated ? 'wordpresspass_' : 'bb_pass_' ) . BB_HASH;
+	} else {
+		bb_log_deprecated( 'variable', '$bb->passcookie' );
+	}
+}
+
+$bb->authcookie = bb_get_option( 'authcookie' );
+if ( !$bb->authcookie ) {
+	$bb->authcookie = ( $bb->wp_cookies_integrated ? 'wordpress_' : 'bbpress_' ) . BB_HASH;
+}
+
+$bb->secure_auth_cookie = bb_get_option( 'secure_auth_cookie' );
+if ( !$bb->secure_auth_cookie ) {
+	$bb->secure_auth_cookie = ( $bb->wp_cookies_integrated ? 'wordpress_sec_' : 'bbpress_sec_' ) . BB_HASH;
+}
+
+$bb->logged_in_cookie = bb_get_option( 'logged_in_cookie' );
+if ( !$bb->logged_in_cookie ) {
+	$bb->logged_in_cookie = ( $bb->wp_cookies_integrated ? 'wordpress_logged_in_' : 'bbpress_logged_in_' ) . BB_HASH;
+}
+
+// Cookie path was set before integration logic above
+if ( !$bb->cookiepath ) {
+	$bb->cookiepath = $bb->wp_cookies_integrated ? preg_replace( '|https?://[^/]+|i', '', $bb->wp_home ) : $bb->path;
+}
+$bb->cookiepath = rtrim( trim( $bb->cookiepath ), " \t\n\r\0\x0B/" ) . '/';
+
+$bb->admin_cookie_path = bb_get_option( 'admin_cookie_path' );
+if ( !$bb->admin_cookie_path ) {
+	$bb->admin_cookie_path = $bb->path . 'bb-admin';
+}
+$bb->admin_cookie_path = rtrim( trim( $bb->admin_cookie_path ), " \t\n\r\0\x0B/" );
+
+if ( BB_LOAD_DEPRECATED ) {
+	$_plugin_cookie_paths = bb_get_option( 'plugin_cookie_paths' );
+
+	// Deprecated settings
+	if ( $_plugin_cookie_paths ) {
+		if ( isset( $_plugin_cookie_paths['core'] ) && $_plugin_cookie_paths['core'] ) {
+			$bb->core_plugins_cookie_path = $_plugin_cookie_paths['core'];
+		}
+		if ( isset( $_plugin_cookie_paths['user'] ) && $_plugin_cookie_paths['user'] ) {
+			$bb->user_plugins_cookie_path = $_plugin_cookie_paths['user'];
+		}
+	} else {
+		if ( $bb->core_plugins_cookie_path = bb_get_option( 'core_plugins_cookie_path' ) ) {
+			bb_log_deprecated( 'variable', '$bb->core_plugins_cookie_path', '$bb->plugin_cookie_paths[\'core\']' );
+		}
+		if ( $bb->user_plugins_cookie_path = bb_get_option( 'user_plugins_cookie_path' ) ) {
+			bb_log_deprecated( 'variable', '$bb->core_plugins_cookie_path', '$bb->plugin_cookie_paths[\'user\']' );
+		}
+	}
+
+	if ( !$bb->core_plugins_cookie_path && isset( $bb->plugin_locations['core']['url'] ) && $bb->plugin_locations['core']['url'] ) {
+		$bb->core_plugins_cookie_path = preg_replace( '|https?://[^/]+|i', '', $bb->plugin_locations['core']['url'] );
+	}
+	$bb->core_plugins_cookie_path = rtrim( trim( $bb->core_plugins_cookie_path ), " \t\n\r\0\x0B/" );
+
+	if ( !$bb->user_plugins_cookie_path && isset( $bb->plugin_locations['user']['url'] ) && $bb->plugin_locations['user']['url'] ) {
+		$bb->user_plugins_cookie_path = preg_replace( '|https?://[^/]+|i', '', $bb->plugin_locations['user']['url'] );
+	}
+	$bb->user_plugins_cookie_path = rtrim( trim( $bb->user_plugins_cookie_path ), " \t\n\r\0\x0B/" );
+
+	if ( !$_plugin_cookie_paths ) {
+		$bb->plugin_cookie_paths = array();
+	}
+	if ( !isset( $_plugin_cookie_paths['core'] ) ) {
+		$bb->plugin_cookie_paths['core'] = $bb->core_plugins_cookie_path;
+	}
+	if ( !isset( $_plugin_cookie_paths['user'] ) ) {
+		$bb->plugin_cookie_paths['user'] = $bb->user_plugins_cookie_path;
+	}
+}
+
+$bb->sitecookiepath = bb_get_option( 'sitecookiepath' );
+$_bb_sitecookiepath = $bb->sitecookiepath;
+if ( !$bb->sitecookiepath && $bb->wp_cookies_integrated ) {
+	$bb->sitecookiepath = preg_replace( '|https?://[^/]+|i', '', $bb->wp_siteurl );
+	$_bb_sitecookiepath = $bb->sitecookiepath;
+}
+$bb->sitecookiepath = rtrim( trim( $bb->sitecookiepath ), " \t\n\r\0\x0B/" ) . '/';
+
+$bb->wp_admin_cookie_path = bb_get_option( 'wp_admin_cookie_path' );
+if ( !$bb->wp_admin_cookie_path && $bb->wp_cookies_integrated ) {
+	if ( $bb->wordpress_mu_primary_blog_id ) {
+		$bb->wp_admin_cookie_path = $_bb_sitecookiepath;
+	} else {
+		$bb->wp_admin_cookie_path = $_bb_sitecookiepath . '/wp-admin';
+	}
+}
+$bb->wp_admin_cookie_path = rtrim( trim( $bb->wp_admin_cookie_path ), " \t\n\r\0\x0B/" );
+
+$bb->wp_plugins_cookie_path = bb_get_option( 'wp_plugins_cookie_path' );
+if ( !$bb->wp_plugins_cookie_path && $bb->wp_cookies_integrated ) {
+	// This is a best guess only, should be manually set to match WP_PLUGIN_URL
+	$bb->wp_plugins_cookie_path = $_bb_sitecookiepath . '/wp-content/plugins';
+}
+$bb->wp_plugins_cookie_path = rtrim( trim( $bb->wp_plugins_cookie_path ), " \t\n\r\0\x0B/" );
+unset( $_bb_sitecookiepath );
+
+/**
+ * Should be exactly the same as the default value of the KEYS in bb-config-sample.php
+ * @since 1.0
+ */
+$bb_default_secret_key = 'put your unique phrase here';
+
+
+
+/**
+ * Initialise localisation
+ */
+
+// Load the default text localization domain.
+bb_load_default_textdomain();
+
+// Pull in locale data after loading text domain.
+require_once( BB_PATH . BB_INC . 'class.bb-locale.php' );
+
+/**
+ * Localisation object
+ */
+$bb_locale = new BB_Locale();
+
+
+
+/**
+ * Remaining BackPress
+ */
+
+// WP_Pass
+if ( !class_exists( 'WP_Pass' ) ) {
+	require_once( BACKPRESS_PATH . 'class.wp-pass.php' );
+}
+
+// WP_Users
+if ( !class_exists( 'WP_Users' ) ) {
+	require_once( BACKPRESS_PATH . 'class.wp-users.php' );
+	$wp_users_object = new WP_Users( $bbdb );
+}
+
+if ( !class_exists( 'BP_Roles' ) ) {
+	require_once( BACKPRESS_PATH . 'class.bp-roles.php' );
+}
+
+/**
+ * BP_Roles object
+ */
+$wp_roles = new BP_Roles( $bbdb );
+
+// BP_User
+if ( !class_exists( 'BP_User' ) ) {
+	require_once( BACKPRESS_PATH . 'class.bp-user.php' );
+}
+
+// WP_Auth
+if ( !class_exists( 'WP_Auth' ) ) {
+	require_once( BACKPRESS_PATH . 'class.wp-auth.php' );
+
+	$cookies = array();
+
+	$cookies['logged_in'][] = array(
+		'domain' => $bb->cookiedomain,
+		'path' => $bb->cookiepath,
+		'name' => $bb->logged_in_cookie
+	);
+
+	if ( $bb->sitecookiepath && $bb->cookiepath != $bb->sitecookiepath ) {
+		$cookies['logged_in'][] = array(
+			'domain' => $bb->cookiedomain,
+			'path' => $bb->sitecookiepath,
+			'name' => $bb->logged_in_cookie
+		);
+	}
+
+	$cookies['auth'][] = array(
+		'domain' => $bb->cookiedomain,
+		'path' => $bb->admin_cookie_path,
+		'name' => $bb->authcookie
+	);
+
+	$cookies['secure_auth'][] = array(
+		'domain' => $bb->cookiedomain,
+		'path' => $bb->admin_cookie_path,
+		'name' => $bb->secure_auth_cookie,
+		'secure' => true
+	);
+
+	$_plugin_cookie_paths = bb_get_option( 'plugin_cookie_paths' );
+	foreach ( $bb->plugin_locations as $_name => $_data ) {
+		if ( isset( $_data['cookie_path'] ) && !empty( $_data['cookie_path'] ) ) {
+			$_cookie_path = $_data['cookie_path'];
+		} elseif ( !$_plugin_cookie_paths || !isset( $_plugin_cookie_paths[$_name] ) || !$_plugin_cookie_paths[$_name] ) {
+			$_cookie_path = preg_replace( '|https?://[^/]+|i', '', $_data['url'] );
+		} else {
+			$_cookie_path = $_plugin_cookie_paths[$_name];
+		}
+		$_cookie_path = rtrim( trim( $_cookie_path ), " \t\n\r\0\x0B/" );
+
+		if ( !$_cookie_path ) {
+			continue;
+		}
+
+		$cookies['auth'][] = array(
+			'domain' => $bb->cookiedomain,
+			'path' => $_cookie_path,
+			'name' => $bb->authcookie
+		);
+
+		$cookies['secure_auth'][] = array(
+			'domain' => $bb->cookiedomain,
+			'path' => $_cookie_path,
+			'name' => $bb->secure_auth_cookie,
+			'secure' => true
+		);
+	}
+	unset( $_plugin_cookie_paths, $_type, $_data, $_cookie_path );
+
+	if ( $bb->wp_admin_cookie_path ) {
+		$cookies['auth'][] = array(
+			'domain' => $bb->cookiedomain,
+			'path' => $bb->wp_admin_cookie_path,
+			'name' => $bb->authcookie
+		);
+
+		$cookies['secure_auth'][] = array(
+			'domain' => $bb->cookiedomain,
+			'path' => $bb->wp_admin_cookie_path,
+			'name' => $bb->secure_auth_cookie,
+			'secure' => true
+		);
+	}
+
+	if ( $bb->wp_plugins_cookie_path ) {
+		$cookies['auth'][] = array(
+			'domain' => $bb->cookiedomain,
+			'path' => $bb->wp_plugins_cookie_path,
+			'name' => $bb->authcookie
+		);
+
+		$cookies['secure_auth'][] = array(
+			'domain' => $bb->cookiedomain,
+			'path' => $bb->wp_plugins_cookie_path,
+			'name' => $bb->secure_auth_cookie,
+			'secure' => true
+		);
+	}
+
+	/**
+	 * The current cookie version
+	 *
+	 * Version 1 is for WordPress >= 2.6 and < 2.8
+	 * Version 2 is for Wordpress >= 2.8
+	 */
+	if ( !defined( 'WP_AUTH_COOKIE_VERSION' ) ) {
+		define( 'WP_AUTH_COOKIE_VERSION', 2 );
+	}
+
+	/**
+	 * WP_Auth object
+	 */
+	$wp_auth_object = new WP_Auth( $bbdb, $wp_users_object, $cookies );
+
+	unset( $cookies );
+}
+
+/**
+ * Current user object
+ */
+$bb_current_user =& $wp_auth_object->current;
+
+// WP_Scripts/WP_Styles
+if ( !class_exists( 'WP_Dependencies' ) ) {
+	require_once( BACKPRESS_PATH . 'class.wp-dependencies.php' );
+}
+
+if ( !class_exists( 'WP_Scripts' ) ) {
+	require_once( BACKPRESS_PATH . 'class.wp-scripts.php' );
+	require_once( BACKPRESS_PATH . 'functions.wp-scripts.php' );
+} else {
+	unset( $wp_scripts );
+}
+
+if ( !class_exists( 'WP_Styles' ) ) {
+	require_once( BACKPRESS_PATH . 'class.wp-styles.php' );
+	require_once( BACKPRESS_PATH . 'functions.wp-styles.php' );
+} else {
+	unset( $wp_styles );
+}
+
+
+
+// WP_Taxonomy
+if ( !class_exists( 'WP_Taxonomy' ) ) {
+	require_once( BACKPRESS_PATH . 'class.wp-taxonomy.php' );
+}
+if ( !class_exists( 'BB_Taxonomy' ) ) {
+	require_once( BB_PATH . BB_INC . 'class.bb-taxonomy.php' );
+}
+if ( !isset( $wp_taxonomy_object ) ) {
+	// Clean slate
+	$wp_taxonomy_object = new BB_Taxonomy( $bbdb );
+} elseif ( !is_a( $wp_taxonomy_object, 'BB_Taxonomy' ) ) {
+	// exists, but it's not good enough, translate it
+
+	// preserve the references
+	$tax =& $wp_taxonomy_object->taxonomies;
+	$wp_taxonomy_object = new BB_Taxonomy( $bbdb );
+	$wp_taxonomy_object->taxonomies =& $tax;
+	unset( $tax );
+}
+$wp_taxonomy_object->register_taxonomy( 'bb_topic_tag', 'bb_topic' );
+
+do_action( 'bb_options_loaded' );
+
+
+
+/**
+ * Load deprecated constants and functions
+ */
+
+// Skip loading of deprecated stuff unless specifically requested
+if ( BB_LOAD_DEPRECATED ) {
+	/**
+	 * Define deprecated constants for plugin compatibility
+	 * $deprecated_constants below is a complete array of old constants and their replacements
+	 */
+	$deprecated_constants = array(
+		'BBPATH'      => 'BB_PATH',
+		'BBINC'       => 'BB_INC',
+		'BBLANG'      => 'BB_LANG',
+		'BBLANGDIR'   => 'BB_LANG_DIR',
+		'BBPLUGINDIR' => 'BB_PLUGIN_DIR',
+		'BBPLUGINURL' => 'BB_PLUGIN_URL',
+		'BBTHEMEDIR'  => 'BB_THEME_DIR',
+		'BBTHEMEURL'  => 'BB_THEME_URL',
+		'BBHASH'      => 'BB_HASH'
+	);
+	foreach ( $deprecated_constants as $old => $new ) {
+		// only define if new one is defined
+		if ( !defined( $old ) && defined( $new ) ) {
+			define( $old, constant( $new ) );
+		} elseif ( defined( $old ) ) {
+			bb_log_deprecated( 'constant', $old, $new );
+		}
+	}
+
+	$deprecated_constants = array(
+		'USER_BBDB_NAME'         => 'user_bbdb_name',
+		'USER_BBDB_USER'         => 'user_bbdb_user',
+		'USER_BBDB_PASSWORD'     => 'user_bbdb_password',
+		'USER_BBDB_HOST'         => 'user_bbdb_host',
+		'USER_BBDB_CHARSET'      => 'user_bbdb_charset',
+		'CUSTOM_USER_TABLE'      => 'custom_user_table',
+		'CUSTOM_USER_META_TABLE' => 'custom_user_meta_table',
+	);
+	foreach ( $deprecated_constants as $old => $new ) {
+		if ( !defined( $old ) ) {
+			define( $old, $bb->$new );
+		} else {
+			bb_log_deprecated( 'constant', $old, '$bb->' . $new );
+		}
+	}
+	unset($deprecated_constants, $old, $new);
+
+	/**
+	 * Load deprecated functions
+	 */
+	require_once( BB_PATH . BB_INC . 'functions.bb-deprecated.php' );
+
+	/**
+	 * Old cache global object for backwards compatibility
+	 */
+	$bb_cache = new BB_Cache();
+}
+
+
+
+/**
+ * Load active template functions.php file
+ */
+$template_functions_include = bb_get_active_theme_directory() . 'functions.php';
+if ( file_exists( $template_functions_include ) ) {
+	require_once( $template_functions_include );
+}
+unset( $template_functions_include );
+
+
+
+/**
+ * Load Plugins
+ */
+
+// Skip plugin loading in "safe" mode
+if ( $bb->plugin_locations && ( !isset( $bb->safemode ) || $bb->safemode !== true ) ) {
+	// Autoloaded "underscore" plugins
+	foreach ( $bb->plugin_locations as $_name => $_data ) {
+		foreach ( bb_glob( $_data['dir'] . '_*.php' ) as $_plugin ) {
+			require_once( $_plugin );
+		}
+		unset( $_plugin );
+	}
+	unset( $_name, $_data );
+	do_action( 'bb_underscore_plugins_loaded' );
+
+	// Normal plugins
+	if ( $_plugins = bb_get_option( 'active_plugins' ) ) {
+		foreach ( (array) $_plugins as $_plugin ) {
+			if ( !preg_match( '/^([a-z0-9_-]+)#((?:[a-z0-9\/\\_-]+.)+)(php)$/i', $_plugin, $_matches ) ) {
+				// The plugin entry in the database is invalid
+				continue;
+			}
+
+			$_directory = $bb->plugin_locations[$_matches[1]]['dir'];
+			$_plugin = $_matches[2] . $_matches[3];
+
+			if ( !$_plugin ) {
+				// Not likely
+				continue;
+			}
+
+			if ( validate_file( $_plugin ) ) {
+				// $plugin has .., :, etc.
+				continue;
+			}
+
+			if ( !file_exists( $_directory . $_plugin ) ) {
+				// The plugin isn't there
+				continue;
+			}
+
+			require_once( $_directory . $_plugin );
+		}
+	}
+	unset( $_plugins, $_plugin, $_directory );
+	do_action( 'bb_plugins_loaded' );
+}
+
+require_once( BB_PATH . BB_INC . 'functions.bb-pluggable.php' );
+
+
+
+/**
+ * Reference to $wp_roles
+ */
+$bb_roles =& $wp_roles;
+do_action( 'bb_got_roles' );
+
+
+
+/**
+ * Create an API hook to run on shutdown
+ */
+
+function bb_shutdown_action_hook() {
+	do_action( 'bb_shutdown' );
+}
+register_shutdown_function( 'bb_shutdown_action_hook' );
+
+
+/**
+ * Get details of the current user
+ */
+
+bb_current_user();
+
+
+
+/**
+ * Initialise CRON
+ */
+
+if ( !function_exists( 'wp_schedule_single_event' ) ) {
+	require_once( BACKPRESS_PATH . 'functions.wp-cron.php' );
+}
+if ( ( !defined('DOING_CRON') || !DOING_CRON ) ) {
+	wp_cron();
+}
+
+
+
+/**
+ * The currently viewed page number
+ */
+$page = bb_get_uri_page();
+
+
+
+/**
+ * Initialisation complete API hook
+ */
+
+do_action( 'bb_init' );
+
+
+
+/**
+ * Block user if they deserve it
+ */
+
+if ( bb_is_user_logged_in() && bb_has_broken_pass() ) {
+	bb_block_current_user();
+}
+
+
+
+/**
+ * Send HTTP headers
+ */
+
+bb_send_headers();
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei-blue/images/page_header_bblogo.png b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei-blue/images/page_header_bblogo.png
new file mode 100644
index 0000000000000000000000000000000000000000..3f63763cdf8daefdd0f40ba3314317f78930fc2f
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei-blue/images/page_header_bblogo.png differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei-blue/screenshot.png b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei-blue/screenshot.png
new file mode 100644
index 0000000000000000000000000000000000000000..45eafdbd5a0fa84b72324b39825aea0058cc19bf
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei-blue/screenshot.png differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei-blue/style-rtl.css b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei-blue/style-rtl.css
new file mode 100644
index 0000000000000000000000000000000000000000..1d03f457ff626bdaf66ff0f348146d616eed34c9
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei-blue/style-rtl.css
@@ -0,0 +1 @@
+@import url('../kakumei/style-rtl.css');
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei-blue/style.css b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei-blue/style.css
new file mode 100644
index 0000000000000000000000000000000000000000..0b0391bde9e76b1e6b2688cbd42e8f38946ebcb3
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei-blue/style.css
@@ -0,0 +1,29 @@
+/*
+Theme Name: Kakumei Blue
+Theme URI: http://bbpress.org/
+Description: The "revolutionized" new face of bbPress... in blue.
+Version: 1.0
+Author: <a href="http://avalonstar.com">Bryan Veloso</a> with updates by <a href="http://unlettered.org">Sam Bauers</a>
+Author URI: 
+*/
+
+
+@import url('../kakumei/style.css');
+
+a { color: #32689b; text-decoration: none; }
+a:hover { color: #001364; }
+#header { background-image: url('images/page_header_bblogo.png'); }
+#header div.search input.submit:hover { color: #001364; }
+#header div.search input.submit:active { border-color: #001364; }
+form.login input.submit:hover { color: #001364; }
+form.login input.submit:active { border-color: #001364; }
+input#tagformsub:hover { color: #001364; }
+input#tagformsub:active { border-color: #001364; }
+.sticky { background: #adb9e1; }
+#thread li.pingback { background-color: #d8dcf2; border-color: #d8dcf2; }
+#thread li.pingback .threadpost { background-color: #d8dcf2; }
+#latest tr:hover, #forumlist tr:hover, #favorites tr:hover { background: #d8dcf2; }
+#profile-menu li a:hover { background: #d8dcf2; }
+a.prev.page-numbers:hover, a.next.page-numbers:hover { color: #001364; }
+p.submit input:hover { color: #001364; }
+p.submit input:active { border-color: #001364; }
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/404.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/404.php
new file mode 100644
index 0000000000000000000000000000000000000000..5ea67f1eaa8cf182cb251c7fa06c4dbab2985548
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/404.php
@@ -0,0 +1,9 @@
+<?php bb_get_header(); ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <?php _e('Page not found!'); ?></div>
+
+<h2 id="http404"><?php _e('Page not found!'); ?></h2>
+
+<p><?php _e('I\'m sorry, but there is nothing at this URL.'); ?></p>
+
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/edit-form.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/edit-form.php
new file mode 100644
index 0000000000000000000000000000000000000000..cb62b89b12189ea33e0259f7c3d830f69276e091
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/edit-form.php
@@ -0,0 +1,19 @@
+
+<?php if ( $topic_title ) : ?>
+<p role="main">
+  <label><?php _e('Topic:'); ?><br />
+
+  <input name="topic" type="text" id="topic" size="50" maxlength="80"  value="<?php echo esc_attr( get_topic_title() ); ?>" />
+</label>
+</p>
+<?php endif; do_action( 'edit_form_pre_post' ); ?>
+<p><label><?php _e('Post:'); ?><br />
+  <textarea name="post_content" cols="50" rows="8" id="post_content"><?php echo apply_filters('edit_text', get_post_text() ); ?></textarea>
+  </label>
+</p>
+<p class="submit">
+<input type="submit" name="Submit" value="<?php echo esc_attr__( 'Edit Post &raquo;' ); ?>" />
+<input type="hidden" name="post_id" value="<?php post_id(); ?>" />
+<input type="hidden" name="topic_id" value="<?php topic_id(); ?>" />
+</p>
+<p><?php _e('Allowed markup:'); ?> <code><?php allowed_markup(); ?></code>. <br /><?php _e('Put code in between <code>`backticks`</code>.'); ?></p>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/edit-post.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/edit-post.php
new file mode 100644
index 0000000000000000000000000000000000000000..f6bd5057e253bd76d7ffccea94067713194b59c1
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/edit-post.php
@@ -0,0 +1,6 @@
+<?php bb_get_header(); ?>
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <?php _e('Edit Post'); ?></div>
+
+<?php edit_form(); ?>
+
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/favorites.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/favorites.php
new file mode 100644
index 0000000000000000000000000000000000000000..223e72a59a4c5b8181b7b0b5d52acddee5c8c689
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/favorites.php
@@ -0,0 +1,54 @@
+<?php bb_get_header(); ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <a href="<?php user_profile_link( $user_id ); ?>"><?php echo get_user_display_name( $user_id ); ?></a> &raquo; <?php _e('Favorites'); ?></div>
+
+<h2 id="userlogin" role="main"><?php echo get_user_display_name( $user->ID ); ?> <small>(<?php echo get_user_name( $user->ID ); ?>)</small> <?php _e( 'favorites' ); ?><?php if ( $topics ) printf( __( ' - %d' ), $favorites_total ); ?></h2>
+
+<p><?php _e( 'Favorites allow members to create a custom <abbr title="Really Simple Syndication">RSS</abbr> feed which pulls recent replies to the topics they specify.' ); ?></p>
+<?php if ( bb_current_user_can( 'edit_favorites_of', $user_id ) ) : ?>
+<p><?php _e( 'To add topics to your list of favorites, just click the "Add to Favorites" link found on that topic&#8217;s page.' ); ?></p>
+<?php endif; ?>
+
+<?php if ( $topics ) : ?>
+
+<table id="favorites">
+<tr>
+	<th><?php _e('Topic'); ?></th>
+	<th><?php _e('Posts'); ?></th>
+	<!-- <th><?php _e('Voices'); ?></th> -->
+	<th><?php _e('Last Poster'); ?></th>
+	<th><?php _e('Freshness'); ?></th>
+<?php if ( bb_current_user_can( 'edit_favorites_of', $user_id ) ) : ?>
+	<th><?php _e('Remove'); ?></th>
+<?php endif; ?>
+</tr>
+
+<?php foreach ( $topics as $topic ) : ?>
+<tr<?php topic_class(); ?>>
+	<td><?php bb_topic_labels(); ?> <a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></td>
+	<td class="num"><?php topic_posts(); ?></td>
+	<!-- <td class="num"><?php bb_topic_voices(); ?></td> -->
+	<td class="num"><?php topic_last_poster(); ?></td>
+	<td class="num"><a href="<?php topic_last_post_link(); ?>"><?php topic_time(); ?></a></td>
+<?php if ( bb_current_user_can( 'edit_favorites_of', $user_id ) ) : ?>
+	<td class="num">[<?php user_favorites_link('', array('mid'=>'&times;'), $user_id); ?>]</td>
+<?php endif; ?>
+</tr>
+<?php endforeach; ?>
+</table>
+
+<p class="rss-link"><a href="<?php favorites_rss_link( $user_id ); ?>" class="rss-link"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr> feed for these favorites'); ?></a></p>
+
+<?php favorites_pages( array( 'before' => '<div class="nav">', 'after' => '</div>' ) ); ?>
+
+<?php else: if ( $user_id == bb_get_current_user_info( 'id' ) ) : ?>
+
+<p><?php _e('You currently have no favorites.'); ?></p>
+
+<?php else : ?>
+
+<p><?php echo get_user_name( $user_id ); ?> <?php _e('currently has no favorites.'); ?></p>
+
+<?php endif; endif; ?>
+
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/footer.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/footer.php
new file mode 100644
index 0000000000000000000000000000000000000000..a24d10f41d701400e19756d9a6c741933b40e572
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/footer.php
@@ -0,0 +1,22 @@
+		</div>
+	</div>
+	<div id="footer" role="contentinfo">
+		<p><?php printf(__('%1$s is proudly powered by <a href="%2$s">bbPress</a>.'), bb_option('name'), "http://bbpress.org") ?></p>
+
+		<!-- If you like showing off the fact that your server rocks -->
+		<!-- <p class="showoff">
+<?php
+global $bbdb;
+printf(
+__( 'This page generated in %s seconds, using %d queries.' ),
+bb_number_format_i18n( bb_timer_stop(), 2 ),
+bb_number_format_i18n( $bbdb->num_queries )
+);
+?>
+		</p> -->
+	</div>
+
+<?php do_action('bb_foot'); ?>
+
+</body>
+</html>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/forum.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/forum.php
new file mode 100644
index 0000000000000000000000000000000000000000..5ce4941a8c4611badcd2e62db0d76fe48b167186
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/forum.php
@@ -0,0 +1,67 @@
+<?php bb_get_header(); ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a><?php bb_forum_bread_crumb(); ?></div>
+
+<?php if ( $topics || $stickies ) : ?>
+
+<table id="latest" role="main">
+<tr>
+	<th><?php _e('Topic'); ?> &#8212; <?php bb_new_topic_link(); ?></th>
+	<th><?php _e('Posts'); ?></th>
+	<!-- <th><?php _e('Voices'); ?></th> -->
+	<th><?php _e('Last Poster'); ?></th>
+	<th><?php _e('Freshness'); ?></th>
+</tr>
+
+<?php if ( $stickies ) : foreach ( $stickies as $topic ) : ?>
+<tr<?php topic_class(); ?>>
+	<td><?php bb_topic_labels(); ?> <big><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></big><?php topic_page_links(); ?></td>
+	<td class="num"><?php topic_posts(); ?></td>
+	<!-- <td class="num"><?php bb_topic_voices(); ?></td> -->
+	<td class="num"><?php topic_last_poster(); ?></td>
+	<td class="num"><a href="<?php topic_last_post_link(); ?>"><?php topic_time(); ?></a></td>
+</tr>
+<?php endforeach; endif; ?>
+
+<?php if ( $topics ) : foreach ( $topics as $topic ) : ?>
+<tr<?php topic_class(); ?>>
+	<td><?php bb_topic_labels(); ?> <a href="<?php topic_link(); ?>"><?php topic_title(); ?></a><?php topic_page_links(); ?></td>
+	<td class="num"><?php topic_posts(); ?></td>
+	<!-- <td class="num"><?php bb_topic_voices(); ?></td> -->
+	<td class="num"><?php topic_last_poster(); ?></td>
+	<td class="num"><a href="<?php topic_last_post_link(); ?>"><?php topic_time(); ?></a></td>
+</tr>
+<?php endforeach; endif; ?>
+</table>
+<p class="rss-link"><a href="<?php bb_forum_posts_rss_link(); ?>" class="rss-link"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr> feed for this forum'); ?></a></p>
+<?php forum_pages( array( 'before' => '<div class="nav">', 'after' => '</div>' ) ); ?>
+<?php endif; ?>
+
+<?php if ( bb_forums( $forum_id ) ) : ?>
+<h2><?php _e('Subforums'); ?></h2>
+<table id="forumlist">
+
+<tr>
+	<th><?php _e('Main Theme'); ?></th>
+	<th><?php _e('Topics'); ?></th>
+	<th><?php _e('Posts'); ?></th>
+</tr>
+
+<?php while ( bb_forum() ) : ?>
+<?php if (bb_get_forum_is_category()) : ?>
+<tr<?php bb_forum_class('bb-category'); ?>>
+	<td colspan="3"><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><?php forum_description( array( 'before' => '<small> &#8211; ', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?></td>
+</tr>
+<?php continue; endif; ?>
+<tr<?php bb_forum_class(); ?>>
+	<td><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><?php forum_description( array( 'before' => '<small> &#8211; ', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?></td>
+	<td class="num"><?php forum_topics(); ?></td>
+	<td class="num"><?php forum_posts(); ?></td>
+</tr>
+<?php endwhile; ?>
+</table>
+<?php endif; ?>
+
+<?php post_form(); ?>
+
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/front-page.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/front-page.php
new file mode 100644
index 0000000000000000000000000000000000000000..b8f80279be29c1adec80ce5309a5d6ab00b22dab
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/front-page.php
@@ -0,0 +1,90 @@
+<?php bb_get_header(); ?>
+
+<?php if ( $forums ) : ?>
+
+<div id="hottags" role="main">
+<h2><?php _e('Hot Tags'); ?></h2>
+<p class="frontpageheatmap"><?php bb_tag_heat_map(); ?></p>
+</div>
+
+<div id="discussions">
+<?php if ( $topics || $super_stickies ) : ?>
+
+<h2><?php _e('Latest Discussions'); ?></h2>
+
+<table id="latest">
+<tr>
+	<th><?php _e('Topic'); ?> &#8212; <?php bb_new_topic_link(); ?></th>
+	<th><?php _e('Posts'); ?></th>
+	<!-- <th><?php _e('Voices'); ?></th> -->
+	<th><?php _e('Last Poster'); ?></th>
+	<th><?php _e('Freshness'); ?></th>
+</tr>
+
+<?php if ( $super_stickies ) : foreach ( $super_stickies as $topic ) : ?>
+<tr<?php topic_class(); ?>>
+	<td><?php bb_topic_labels(); ?> <big><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></big><?php topic_page_links(); ?></td>
+	<td class="num"><?php topic_posts(); ?></td>
+	<!-- <td class="num"><?php bb_topic_voices(); ?></td> -->
+	<td class="num"><?php topic_last_poster(); ?></td>
+	<td class="num"><a href="<?php topic_last_post_link(); ?>"><?php topic_time(); ?></a></td>
+</tr>
+<?php endforeach; endif; // $super_stickies ?>
+
+<?php if ( $topics ) : foreach ( $topics as $topic ) : ?>
+<tr<?php topic_class(); ?>>
+	<td><?php bb_topic_labels(); ?> <a href="<?php topic_link(); ?>"><?php topic_title(); ?></a><?php topic_page_links(); ?></td>
+	<td class="num"><?php topic_posts(); ?></td>
+	<!-- <td class="num"><?php bb_topic_voices(); ?></td> -->
+	<td class="num"><?php topic_last_poster(); ?></td>
+	<td class="num"><a href="<?php topic_last_post_link(); ?>"><?php topic_time(); ?></a></td>
+</tr>
+<?php endforeach; endif; // $topics ?>
+</table>
+<?php bb_latest_topics_pages( array( 'before' => '<div class="nav">', 'after' => '</div>' ) ); ?>
+<?php endif; // $topics or $super_stickies ?>
+
+<?php if ( bb_forums() ) : ?>
+<h2><?php _e('Forums'); ?></h2>
+<table id="forumlist">
+
+<tr>
+	<th><?php _e('Main Theme'); ?></th>
+	<th><?php _e('Topics'); ?></th>
+	<th><?php _e('Posts'); ?></th>
+</tr>
+<?php while ( bb_forum() ) : ?>
+<?php if (bb_get_forum_is_category()) : ?>
+<tr<?php bb_forum_class('bb-category'); ?>>
+	<td colspan="3"><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><?php forum_description( array( 'before' => '<small> &#8211; ', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?></td>
+</tr>
+<?php continue; endif; ?>
+<tr<?php bb_forum_class(); ?>>
+	<td><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><?php forum_description( array( 'before' => '<small> &#8211; ', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?></td>
+	<td class="num"><?php forum_topics(); ?></td>
+	<td class="num"><?php forum_posts(); ?></td>
+</tr>
+<?php endwhile; ?>
+</table>
+<?php endif; // bb_forums() ?>
+
+<?php if ( bb_is_user_logged_in() ) : ?>
+<div id="viewdiv">
+<h2><?php _e('Views'); ?></h2>
+<ul id="views">
+<?php foreach ( bb_get_views() as $the_view => $title ) : ?>
+<li class="view"><a href="<?php view_link( $the_view ); ?>"><?php view_name( $the_view ); ?></a></li>
+<?php endforeach; ?>
+</ul>
+</div>
+<?php endif; // bb_is_user_logged_in() ?>
+
+</div>
+
+<?php else : // $forums ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <?php _e('Add New Topic'); ?></div>
+
+<?php post_form(); endif; // $forums ?>
+
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/header.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/header.php
new file mode 100644
index 0000000000000000000000000000000000000000..97ba0e457bdda49a93ec3743e17b41412081bda6
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/header.php
@@ -0,0 +1,40 @@
+<?php
+$_head_profile_attr = '';
+if ( bb_is_profile() ) {
+	global $self;
+	if ( !$self ) {
+		$_head_profile_attr = ' profile="http://www.w3.org/2006/03/hcard"';
+	}
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"<?php bb_language_attributes( '1.1' ); ?>>
+<head<?php echo $_head_profile_attr; ?>>
+	<meta http-equiv="X-UA-Compatible" content="IE=8" />
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<title><?php bb_title() ?></title>
+	<link rel="stylesheet" href="<?php bb_stylesheet_uri(); ?>" type="text/css" />
+<?php if ( 'rtl' == bb_get_option( 'text_direction' ) ) : ?>
+	<link rel="stylesheet" href="<?php bb_stylesheet_uri( 'rtl' ); ?>" type="text/css" />
+<?php endif; ?>
+
+<?php bb_feed_head(); ?>
+
+<?php bb_head(); ?>
+
+</head>
+<body id="<?php bb_location(); ?>">
+	<div id="wrapper">
+		<div id="header" role="banner">
+			<h1><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a></h1>
+			<?php if ( bb_get_option('description') ) : ?><p class="description"><?php bb_option('description'); ?></p><?php endif; ?>
+
+<?php if ( !in_array( bb_get_location(), array( 'login-page', 'register-page' ) ) ) login_form(); ?>
+
+			<div class="search">
+<?php search_form(); ?>
+			</div>
+		</div>
+		<div id="main">
+
+<?php if ( bb_is_profile() ) profile_menu(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/images/feed-icon-16x16.gif b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/images/feed-icon-16x16.gif
new file mode 100755
index 0000000000000000000000000000000000000000..b0e4adf1d517547adb01c44d4b91dc78c170b6a5
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/images/feed-icon-16x16.gif differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/images/page-links-background.gif b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/images/page-links-background.gif
new file mode 100644
index 0000000000000000000000000000000000000000..5ef0cd4a2d5a7a43aca5a95af7a4930174b591d9
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/images/page-links-background.gif differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/images/page_header_bblogo.png b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/images/page_header_bblogo.png
new file mode 100755
index 0000000000000000000000000000000000000000..5270560dffbc658448af42892250a9e9b4c549d7
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/images/page_header_bblogo.png differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/images/page_header_tile.png b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/images/page_header_tile.png
new file mode 100755
index 0000000000000000000000000000000000000000..b9e89f22bafa0a35c39eb9c123155de35497716d
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/images/page_header_tile.png differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/logged-in.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/logged-in.php
new file mode 100644
index 0000000000000000000000000000000000000000..e2b8b69b85679cd2e0e725710a167841a7f2f5a2
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/logged-in.php
@@ -0,0 +1,5 @@
+<p class="login">
+	<?php printf(__('Welcome, %1$s'), bb_get_profile_link(bb_get_current_user_info( 'name' )));?>
+	<?php bb_admin_link( 'before= | ' );?>
+	| <?php bb_logout_link(); ?>
+</p>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/login-form.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/login-form.php
new file mode 100644
index 0000000000000000000000000000000000000000..f5cef5241ace8e7f1d2325a990df803bacb2f304
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/login-form.php
@@ -0,0 +1,33 @@
+<form class="login" method="post" action="<?php bb_uri( 'bb-login.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_USER_FORMS ); ?>">
+	<p>
+		<?php
+	printf(
+		__( '<a href="%1$s">Register</a> or log in - <a href="%2$s">lost password?</a>' ),
+		bb_get_uri( 'register.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_USER_FORMS ),
+		bb_get_uri( 'bb-login.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_USER_FORMS )
+	);
+	?>
+
+	</p>
+	<div>
+		<label>
+			<?php _e('Username'); ?><br />
+			<input name="user_login" type="text" id="quick_user_login" size="13" maxlength="40" value="<?php if (!is_bool($user_login)) echo $user_login; ?>" tabindex="1" />
+		</label>
+		<label>
+			<?php _e( 'Password' ); ?><br />
+			<input name="password" type="password" id="quick_password" size="13" maxlength="40" tabindex="2" />
+		</label>
+		<input name="re" type="hidden" value="<?php echo $re; ?>" />
+		<?php wp_referer_field(); ?>
+
+		<input type="submit" name="Submit" class="submit" value="<?php echo esc_attr__( 'Log in &raquo;' ); ?>" tabindex="4" />
+	</div>
+	<div class="remember">
+		<label>
+			<input name="remember" type="checkbox" id="quick_remember" value="1" tabindex="3"<?php echo $remember_checked; ?> />
+			<?php _e('Remember me'); ?>
+
+		</label>
+	</div>
+</form>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/login.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/login.php
new file mode 100644
index 0000000000000000000000000000000000000000..ff4446cd3a52d85a501aae44bda0b6541d271ec6
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/login.php
@@ -0,0 +1,75 @@
+<?php bb_get_header(); ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <?php _e('Log in'); ?></div>
+
+<h2 id="userlogin" role="main"><?php isset($_POST['user_login']) ? _e('Log in Failed') : _e('Log in') ; ?></h2>
+
+<form method="post" action="<?php bb_uri('bb-login.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_USER_FORMS); ?>">
+<fieldset>
+<table>
+<?php
+	$user_login_error = $bb_login_error->get_error_message( 'user_login' );
+	$user_email_error = $bb_login_error->get_error_message( 'user_email' );
+	$user_password_error = $bb_login_error->get_error_message( 'password' );
+?>
+	<tr valign="top" class="form-field <?php if ( $user_login_error || $user_email_error ) echo ' form-invalid error'; ?>">
+		<th scope="row">
+			<label for="user_login"><?php _e('Username'); ?></label>
+			<?php if ( $user_login_error ) echo "<em>$user_login_error</em>"; ?>
+			<?php if ( $user_email_error ) echo "<em>$user_email_error</em>"; ?>
+		</th>
+		<td>
+			<input name="user_login" id="user_login" type="text" value="<?php echo $user_login; ?>" />
+		</td>
+	</tr>
+	<tr valign="top" class="form-field <?php if ( $user_password_error ) echo 'form-invalid error'; ?>">
+		<th scope="row">
+			<label for="password"><?php _e('Password'); ?></label>
+			<?php if ( $user_password_error ) echo "<em>$user_password_error</em>"; ?>
+		</th>
+		<td>
+			<input name="password" id="password" type="password" />
+		</td>
+	</tr>
+
+	<tr valign="top" class="form-field">
+		<th scope="row"><label for="remember"><?php _e('Remember me'); ?></label></th>
+		<td><input name="remember" type="checkbox" id="remember" value="1"<?php echo $remember_checked; ?> /></td>
+	</tr>
+	<tr>
+		<th scope="row">&nbsp;</th>
+		<td>
+			<input name="re" type="hidden" value="<?php echo $redirect_to; ?>" />
+			<input type="submit" value="<?php echo esc_attr( isset($_POST['user_login']) ? __('Try Again &raquo;'): __('Log in &raquo;') ); ?>" />
+			<?php wp_referer_field(); ?>
+		</td>
+	</tr>
+</table>
+
+</fieldset>
+</form>
+
+<h2 id="passwordrecovery"><?php _e( 'Password Recovery' ); ?></h2>
+<form method="post" action="<?php bb_uri('bb-reset-password.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_USER_FORMS); ?>">
+<fieldset>
+	<p><?php _e('To recover your password, enter your information below.'); ?></p>
+	<table>
+		<tr valign="top" class="form-field">
+			<th scope="row">
+				<label for="user_login_reset_password"><?php _e( 'Username' ); ?></label>
+			</th>
+			<td>
+				<input name="user_login" id="user_login_reset_password" type="text" value="<?php echo $user_login; ?>" />
+			</td>
+		</tr>
+		<tr valign="top">
+			<th scope="row"></th>
+			<td>
+				<input type="submit" value="<?php echo esc_attr__( 'Recover Password &raquo;' ); ?>" />
+			</td>
+		</tr>
+	</table>
+</fieldset>
+</form>
+
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/password-reset.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/password-reset.php
new file mode 100644
index 0000000000000000000000000000000000000000..aa379f32e56bdfdcd49f4cb384c743c22a5061a3
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/password-reset.php
@@ -0,0 +1,20 @@
+<?php bb_get_header(); ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <?php _e('Log in'); ?></div>
+
+<h2 role="main"><?php _e('Password Reset'); ?></h2>
+
+<?php if ( $error ) : ?>
+<p class="notice error"><?php echo $error; ?></p>
+<?php else : ?>
+<?php switch ( $action ) : ?>
+<?php case ( 'send_key' ) : ?>
+<p class="notice"><?php _e('An email has been sent to the address we have on file for you. If you don&#8217;t get anything within a few minutes, or your email has changed, you may want to get in touch with the webmaster or forum administrator here.'); ?></p>
+<?php break; ?>
+<?php case ( 'reset_password' ) : ?>
+<p class="notice"><?php _e('Your password has been reset and a new one has been mailed to you.'); ?></p>
+<?php break; ?>
+<?php endswitch; ?>
+<?php endif; ?>
+
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/post-form.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/post-form.php
new file mode 100644
index 0000000000000000000000000000000000000000..9652d21dbb1a544e2a70f6b9aac187b1ae01c1d0
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/post-form.php
@@ -0,0 +1,29 @@
+<?php if ( !bb_is_topic() ) : ?>
+<p id="post-form-title-container">
+	<label for="topic"><?php _e('Title'); ?>
+		<input name="topic" type="text" id="topic" size="50" maxlength="80" tabindex="1" />
+	</label>
+</p>
+<?php endif; do_action( 'post_form_pre_post' ); ?>
+<p id="post-form-post-container">
+	<label for="post_content"><?php _e('Post'); ?>
+		<textarea name="post_content" cols="50" rows="8" id="post_content" tabindex="3"></textarea>
+	</label>
+</p>
+<p id="post-form-tags-container">
+	<label for="tags-input"><?php printf(__('Tags (comma seperated)'), bb_get_tag_page_link()) ?>
+		<input id="tags-input" name="tags" type="text" size="50" maxlength="100" value="<?php bb_tag_name(); ?>" tabindex="4" />
+	</label>
+</p>
+<?php if ( bb_is_tag() || bb_is_front() ) : ?>
+<p id="post-form-forum-container">
+	<label for="forum-id"><?php _e('Forum'); ?>
+		<?php bb_new_topic_forum_dropdown(); ?>
+	</label>
+</p>
+<?php endif; ?>
+<p id="post-form-submit-container" class="submit">
+  <input type="submit" id="postformsub" name="Submit" value="<?php echo esc_attr__( 'Send Post &raquo;' ); ?>" tabindex="4" />
+</p>
+
+<p id="post-form-allowed-container" class="allowed"><?php _e('Allowed markup:'); ?> <code><?php allowed_markup(); ?></code>. <br /><?php _e('You can also put code in between backtick ( <code>`</code> ) characters.'); ?></p>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/post.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/post.php
new file mode 100644
index 0000000000000000000000000000000000000000..e2e577f0fc9ea70cded5edd30ba8062be11b7c16
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/post.php
@@ -0,0 +1,13 @@
+		<div id="position-<?php post_position(); ?>">
+			<div class="threadauthor">
+				<?php post_author_avatar_link(); ?>
+				<p>
+					<strong><?php post_author_link(); ?></strong><br />
+					<small><?php post_author_title_link(); ?></small>
+				</p>
+			</div>
+			<div class="threadpost">
+				<div class="post"><?php post_text(); ?></div>
+				<div class="poststuff"><?php printf( __('Posted %s ago'), bb_get_post_time() ); ?> <a href="<?php post_anchor_link(); ?>">#</a> <?php bb_post_admin(); ?></div>
+			</div>
+		</div>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/profile-base.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/profile-base.php
new file mode 100644
index 0000000000000000000000000000000000000000..0feffce3e76244a01eb0db81a17a1987256be423
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/profile-base.php
@@ -0,0 +1,8 @@
+<?php bb_get_header(); ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <a href="<?php user_profile_link( $user_id ); ?>"><?php echo get_user_display_name( $user_id ); ?></a> &raquo; <?php echo $profile_page_title; ?></div>
+<h2 role="main"><?php echo get_user_name( $user->ID ); ?></h2>
+
+<?php bb_profile_base_content(); ?>
+
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/profile-edit.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/profile-edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..8a8ac4d71c485f1635f2f75e1e7b3234a3633ed9
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/profile-edit.php
@@ -0,0 +1,36 @@
+<?php bb_get_header(); ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <a href="<?php user_profile_link( $user_id ); ?>"><?php echo get_user_display_name( $user_id ); ?></a> &raquo; <?php _e('Edit Profile'); ?></div>
+<h2 id="userlogin" role="main"><?php echo get_user_display_name( $user->ID ); ?> <small>(<?php echo get_user_name( $user->ID ); ?>)</small></h2>
+<form method="post" action="<?php profile_tab_link( $user->ID, 'edit', BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_USER_FORMS ); ?>">
+<fieldset>
+<legend><?php _e('Profile Info'); ?></legend>
+<?php bb_profile_data_form(); ?>
+</fieldset>
+
+<?php if ( bb_current_user_can( 'edit_users' ) ) : ?>
+<fieldset>
+<legend><?php _e('Administration'); ?></legend>
+<?php bb_profile_admin_form(); ?>
+</fieldset>
+<?php endif; ?>
+
+<?php if ( bb_current_user_can( 'change_user_password', $user->ID ) ) : ?>
+<fieldset>
+<legend><?php _e('Password'); ?></legend>
+<p><?php _e('To change your password, enter a new password twice below:'); ?></p>
+<?php bb_profile_password_form(); ?>
+</fieldset>
+<?php endif; ?>
+<p class="submit right">
+  <input type="submit" name="Submit" value="<?php echo esc_attr__( 'Update Profile &raquo;' ); ?>" />
+</p>
+</form>
+<form method="post" action="<?php profile_tab_link($user->ID, 'edit');  ?>">
+<p class="submit left">
+<?php bb_nonce_field( 'edit-profile_' . $user->ID ); ?>
+<?php user_delete_button(); ?>
+</p>
+</form>
+
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/profile.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/profile.php
new file mode 100644
index 0000000000000000000000000000000000000000..00dff4049adf7bdb57e7816813fb1dc075bb6053
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/profile.php
@@ -0,0 +1,87 @@
+<?php bb_get_header(); ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <a href="<?php user_profile_link( $user_id ); ?>"><?php echo get_user_display_name( $user_id ); ?></a> &raquo; <?php _e('Profile') ?></div>
+
+<div class="vcard" role="main">
+
+<?php if ( $avatar = bb_get_avatar( $user->ID ) ) : ?>
+<div id="useravatar"><?php echo $avatar; ?></div>
+<?php unset($avatar); endif; ?>
+<h2 id="userlogin"><span class="fn"><?php echo get_user_display_name( $user->ID ); ?></span> <small>(<span class="nickname"><?php echo get_user_name( $user->ID ); ?></span>)</small></h2>
+
+<?php if ( $updated ) : ?>
+<div class="notice">
+<p><?php _e('Profile updated'); ?>. <a href="<?php profile_tab_link( $user_id, 'edit' ); ?>"><?php _e('Edit again &raquo;'); ?></a></p>
+</div>
+<?php elseif ( $user_id == bb_get_current_user_info( 'id' ) ) : ?>
+<p>
+<?php _e('This is how your profile appears to a logged in member.'); ?>
+
+<?php if (bb_current_user_can( 'edit_user', $user->ID )) : ?>
+<?php printf(__('You may <a href="%1$s">edit this information</a>.'), esc_attr( get_profile_tab_link( $user_id, 'edit' ) ) ); ?>
+<?php endif; ?>
+</p>
+
+<?php if (bb_current_user_can( 'edit_favorites_of', $user->ID )) : ?>
+<p><?php printf(__('You can also <a href="%1$s">manage your favorites</a> and subscribe to your favorites&#8217; <a href="%2$s"><abbr title="Really Simple Syndication">RSS</abbr> feed</a>.'), esc_attr( get_favorites_link() ), esc_attr( get_favorites_rss_link() )); ?></p>
+<?php endif; ?>
+<?php endif; ?>
+
+<?php bb_profile_data(); ?>
+
+</div>
+
+<h3 id="useractivity"><?php _e('User Activity') ?></h3>
+
+<div id="user-replies" class="user-recent"><h4><?php _e('Recent Replies'); ?></h4>
+<?php if ( $posts ) : ?>
+<ol>
+<?php foreach ($posts as $bb_post) : $topic = get_topic( $bb_post->topic_id ) ?>
+<li<?php alt_class('replies'); ?>>
+	<a href="<?php topic_link(); ?>"><?php topic_title(); ?></a> -
+	<?php if ( $user->ID == bb_get_current_user_info( 'id' ) ) printf(__('You last replied: %s ago'), bb_get_post_time()); else printf(__('User last replied: %s ago'), bb_get_post_time()); ?> |
+
+	<span class="freshness"><?php
+		if ( bb_get_post_time( 'timestamp' ) < get_topic_time( 'timestamp' ) )
+			printf(__('Most recent reply: %s ago'), get_topic_time());
+		else
+			_e('No replies since');
+	?></span>
+</li>
+<?php endforeach; ?>
+</ol>
+<?php else : if ( $page ) : ?>
+<p><?php _e('No more replies.') ?></p>
+<?php else : ?>
+<p><?php _e('No replies yet.') ?></p>
+<?php endif; endif; ?>
+</div>
+
+<div id="user-threads" class="user-recent">
+<h4><?php _e('Topics Started') ?></h4>
+<?php if ( $topics ) : ?>
+<ol>
+<?php foreach ($topics as $topic) : ?>
+<li<?php alt_class('topics'); ?>>
+	<a href="<?php topic_link(); ?>"><?php topic_title(); ?></a> -
+	<?php printf(__('Started: %s ago'), get_topic_start_time()); ?> |
+
+	<span class="freshness"><?php
+		if ( get_topic_start_time( 'timestamp' ) < get_topic_time( 'timestamp' ) )
+			printf(__('Most recent reply: %s ago'), get_topic_time());
+		else
+			_e('No replies.');
+	?></span>
+</li>
+<?php endforeach; ?>
+</ol>
+<?php else : if ( $page ) : ?>
+<p><?php _e('No more topics posted.') ?></p>
+<?php else : ?>
+<p><?php _e('No topics posted yet.') ?></p>
+<?php endif; endif;?>
+</div>
+
+<?php profile_pages( array( 'before' => '<div class="nav">', 'after' => '</div>' ) ); ?>
+
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/register-success.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/register-success.php
new file mode 100644
index 0000000000000000000000000000000000000000..76562f302ecc1bfea28f5855206ff25e13b80e5f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/register-success.php
@@ -0,0 +1,9 @@
+<?php bb_get_header(); ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <?php _e('Register'); ?></div>
+
+<h2 id="register" role="main"><?php _e('Great!'); ?></h2>
+
+<p><?php printf(__('Your registration as <strong>%s</strong> was successful. Within a few minutes you should receive an email with your password.'), $user_login) ?></p>
+
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/register.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/register.php
new file mode 100644
index 0000000000000000000000000000000000000000..1e39877ce5d093f1b48fd92cdfaad3e4b717f465
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/register.php
@@ -0,0 +1,83 @@
+<?php bb_get_header(); ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <?php _e('Register'); ?></div>
+
+<h2 id="register" role="main"><?php _e('Registration'); ?></h2>
+
+<?php if ( !bb_is_user_logged_in() ) : ?>
+
+<form method="post" action="<?php bb_uri('register.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_USER_FORMS); ?>">
+
+<fieldset>
+<legend><?php _e('Profile Information'); ?></legend>
+
+<p><?php _e("Your password will be emailed to the address you provide."); ?></p>
+
+<?php
+
+$user_login_error = $bb_register_error->get_error_message( 'user_login' );
+
+?>
+
+<table width="100%">
+	<tr class="form-field form-required required<?php if ( $user_login_error ) echo ' form-invalid error'; ?>">
+		<th scope="row">
+			<label for="user_login"><?php _e('Username'); ?></label>
+			<?php if ( $user_login_error ) echo "<em>$user_login_error</em>"; ?>
+		</th>
+		<td>
+			<input name="user_login" type="text" id="user_login" size="30" maxlength="30" value="<?php echo $user_login; ?>" />
+		</td>
+	</tr>
+
+<?php
+
+if ( is_array($profile_info_keys) ) :
+	foreach ( $profile_info_keys as $key => $label ) :
+		$class = 'form-field';
+		if ( $label[0] ) {
+			$class .= ' form-required required';
+		}
+		if ( $profile_info_key_error = $bb_register_error->get_error_message( $key ) )
+			$class .= ' form-invalid error';
+
+?>
+
+	<tr class="<?php echo $class; ?>">
+		<th scope="row">
+			<label for="<?php echo $key; ?>"><?php echo $label[1]; ?></label>
+			<?php if ( $profile_info_key_error ) echo "<em>$profile_info_key_error</em>"; ?>
+		</th>
+		<td>
+			<input name="<?php echo $key; ?>" type="text" id="<?php echo $key; ?>" size="30" maxlength="140" value="<?php echo $$key; ?>" />
+		</td>
+	</tr>
+
+<?php
+
+	endforeach; // profile_info_keys
+endif; // profile_info_keys
+
+?>
+
+</table>
+
+<p class="required-message"><?php _e('These items are <span class="required">required</span>.') ?></p>
+
+</fieldset>
+
+<?php do_action('extra_profile_info', $user); ?>
+
+<p class="submit">
+	<input type="submit" name="Submit" value="<?php echo esc_attr__( 'Register &raquo;' ); ?>" />
+</p>
+
+</form>
+
+<?php else : ?>
+
+<p><?php _e('You&#8217;re already logged in, why do you need to register?'); ?></p>
+
+<?php endif; ?>
+
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/rss2.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/rss2.php
new file mode 100644
index 0000000000000000000000000000000000000000..b102afced9b71f94d91e06980c8e6a4c866e9b4a
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/rss2.php
@@ -0,0 +1,37 @@
+<?php
+header( 'Content-Type: text/xml; charset=UTF-8' );
+echo '<' . '?xml version="1.0" encoding="UTF-8"?' . '>' . "\n";
+bb_generator( 'comment' );
+?>
+<rss version="2.0"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:atom="http://www.w3.org/2005/Atom">
+	<channel>
+		<title><?php echo $title; ?></title>
+		<link><?php echo $link; ?></link>
+		<description><?php echo $description; ?></description>
+		<language><?php esc_html( bb_option('language') ); ?></language>
+		<pubDate><?php echo gmdate('D, d M Y H:i:s +0000'); ?></pubDate>
+		<?php bb_generator( 'rss2' ); ?>
+		<textInput>
+			<title><![CDATA[<?php _e('Search'); ?>]]></title>
+			<description><![CDATA[<?php _e('Search all topics from these forums.'); ?>]]></description>
+			<name>q</name>
+			<link><?php bb_uri('search.php'); ?></link>
+		</textInput>
+		<atom:link href="<?php echo $link_self; ?>" rel="self" type="application/rss+xml" />
+
+<?php foreach ($posts as $bb_post) : ?>
+		<item>
+			<title><?php post_author(); ?> <?php _e('on')?> "<?php topic_title( $bb_post->topic_id ); ?>"</title>
+			<link><?php post_link(); ?></link>
+			<pubDate><?php bb_post_time('D, d M Y H:i:s +0000', array( 'localize' => false ) ); ?></pubDate>
+			<dc:creator><?php post_author(); ?></dc:creator>
+			<guid isPermaLink="false"><?php post_id(); ?>@<?php bb_uri(); ?></guid>
+			<description><?php post_text(); ?></description>
+		</item>
+<?php endforeach; ?>
+
+	</channel>
+</rss>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/screenshot.png b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/screenshot.png
new file mode 100644
index 0000000000000000000000000000000000000000..3b37de95b39f225a7acc8c5272131518c5b3a9be
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/screenshot.png differ
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/search-form.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/search-form.php
new file mode 100644
index 0000000000000000000000000000000000000000..fbd480762b543cfd60006f7bc014c421d5568f25
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/search-form.php
@@ -0,0 +1,7 @@
+<form class="search-form" role="search" action="<?php bb_uri('search.php', null, BB_URI_CONTEXT_FORM_ACTION); ?>" method="get">
+	<p>
+		<label class="hidden" for="q"><?php _e('Search:'); ?></label>
+		<input class="text" type="text" size="14" maxlength="100" name="q" id="q" />
+		<input class="submit" type="submit" value="<?php echo esc_attr__( 'Search &raquo;' ); ?>" />
+	</p>
+</form>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/search.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/search.php
new file mode 100644
index 0000000000000000000000000000000000000000..d8430d9e4d6b5fbc089807e867c15c6a82ef6728
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/search.php
@@ -0,0 +1,45 @@
+<?php bb_get_header(); ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <?php _e('Search')?></div>
+<?php bb_topic_search_form(); ?>
+
+<?php if ( !empty ( $q ) ) : ?>
+<h3 id="search-for"><?php _e('Search for')?> &#8220;<?php echo esc_html($q); ?>&#8221;</h3>
+<?php endif; ?>
+
+<?php if ( $recent ) : ?>
+<div id="results-recent" class="search-results">
+	<h4><?php _e('Recent Posts')?></h4>
+	<ol>
+<?php foreach ( $recent as $bb_post ) : ?>
+		<li<?php alt_class( 'recent' ); ?>>
+			<a href="<?php post_link(); ?>"><?php topic_title($bb_post->topic_id); ?></a>
+			<span class="freshness"><?php printf( __('Posted %s'), bb_datetime_format_i18n( bb_get_post_time( array( 'format' => 'timestamp' ) ) ) ); ?></span>
+			<p><?php echo bb_show_context($q, $bb_post->post_text); ?></p>
+		</li>
+<?php endforeach; ?>
+	</ol>
+</div>
+<?php endif; ?>
+
+<?php if ( $relevant ) : ?>
+<div id="results-relevant" class="search-results">
+	<h4><?php _e('Relevant posts')?></h4>
+	<ol>
+<?php foreach ( $relevant as $bb_post ) : ?>
+		<li<?php alt_class( 'relevant' ); ?>>
+			<a href="<?php post_link(); ?>"><?php topic_title($bb_post->topic_id); ?></a>
+			<span class="freshness"><?php printf( __('Posted %s'), bb_datetime_format_i18n( bb_get_post_time( array( 'format' => 'timestamp' ) ) ) ); ?></span>
+			<p><?php post_text(); ?></p>
+		</li>
+<?php endforeach; ?>
+	</ol>
+</div>
+<?php endif; ?>
+
+<?php if ( $q && !$recent && !$relevant ) : ?>
+<p><?php _e('No results found.') ?></p>
+<?php endif; ?>
+<br />
+<p><?php printf(__('You may also try your <a href="http://google.com/search?q=site:%1$s %2$s">search at Google</a>'), bb_get_uri(null, null, BB_URI_CONTEXT_TEXT), urlencode($q)) ?></p>
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/stats.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/stats.php
new file mode 100644
index 0000000000000000000000000000000000000000..0fe3374b7561842f9c0c79c8e9c45d29e9bb736e
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/stats.php
@@ -0,0 +1,21 @@
+<?php bb_get_header(); ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <?php _e('Statistics'); ?></div>
+
+<dl role="main">
+	<dt><?php _e('Registered Users'); ?></dt>
+	<dd><strong><?php total_users(); ?></strong></dd>
+	<dt><?php _e('Posts'); ?></dt>
+	<dd><strong><?php total_posts(); ?></strong></dd>
+</dl>
+
+<?php if ($popular) : ?>
+<h3><?php _e('Most Popular Topics'); ?></h3>
+<ol>
+<?php foreach ($popular as $topic) : ?>
+<li><?php bb_topic_labels(); ?> <a href="<?php topic_link(); ?>"><?php topic_title(); ?></a> &#8212; <?php topic_posts(); ?> posts</li>
+<?php endforeach; ?>
+
+<?php endif; ?>
+</ol>
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/style-rtl.css b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/style-rtl.css
new file mode 100644
index 0000000000000000000000000000000000000000..1aa408af3066e247b074b6f464ae69ca687499cd
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/style-rtl.css
@@ -0,0 +1,189 @@
+/* Globals 
+=================================== */
+
+body { font-family: Tahoma, 'Trebuchet MS', 'Lucida Grande', Verdana, Tahoma, Arial; }
+
+pre, code { font-family: Tahoma, Monaco, 'Courier New', monospace; }
+
+.left { float: right; }
+
+.right { float: left; }
+
+/* Structure
+=================================== */
+
+#header { background-position: -43px bottom; }
+
+#header h1 {
+	font-family: Tahoma, Georgia;
+	text-align: left;
+	left: 53px;
+	right: auto;
+}
+
+#header div.search {
+	float: left;
+}
+
+#header p.description {
+	font-family: Tahoma, Georgia;
+	text-align: left;
+	left: 53px;
+	right: auto;
+}
+
+#footer {
+	font-family: Tahoma, Georgia;
+	text-align: left;
+}
+
+/* Login Form
+=================================== */
+
+.login { 
+	right: 0;
+	left: auto;
+}
+
+.login label {
+	float: right;
+	padding-left: 10px;
+	padding-right: 0;
+}
+
+form.login input.submit { float: right; }
+
+
+/* Front Page
+=================================== */
+
+#front-page #hottags {
+	right: 0;
+	left: auto;
+	width: 150px;
+}
+
+#front-page #discussions {
+	margin-right: 170px;
+	margin-left: 0;
+}
+
+#front-page #discussions ul { padding: 0 14px 0 0; }
+
+/* Topic Page
+=================================== */
+
+.infobox ul { margin: 10px 20px 10px 0; }
+
+#topic-info {
+	float: right;
+	padding: 0 0 0 1em;
+}
+
+#topic-tags {
+	border-right: 1px solid #ccc;
+	border-left: none;
+	float: left;
+	padding: 0 1em 0 0;
+}
+
+#thread li ol, #thread li ul {
+	margin-right: 40px;
+	margin-left: 0;
+}
+
+.threadauthor { float: right; }
+
+.threadauthor small { font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; }
+
+.threadpost { margin: 0 140px 0 0; }
+
+#thread .post blockquote {
+	margin: 0 4ex 0 0;
+	padding: 0 1ex 0 0;
+	border-right: 5px solid #ccc;
+	border-left: none;
+}
+
+.poststuff { font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; }
+
+.num, #forumlist small { font-family: Tahoma, Verdana,Arial,Helvetica,sans-serif; }
+
+#manage-tags li { float: right; }
+
+p.submit { text-align: left; }
+
+.rss-link {
+	background-position: 100% 50%;
+}
+
+/* Other
+=================================== */
+
+#front-search { float: left; }
+
+#forumlist tr td div.nest {
+	padding-right: 2.5ex;
+	padding-left: 0;
+}
+
+#latest th, #forumlist th, #favorites th {
+	text-align: right;
+	font-family: Tahoma, Verdana,Arial,Helvetica,sans-serif;
+}
+
+/* Profile Page
+=================================== */
+
+#profile-menu {
+	left: 0;
+	right: auto;
+}
+
+#profile-menu li {
+	margin-left: 0;
+	margin-right: 3px;
+}
+
+.user-recent ol { margin: 5px 28px 0 0; }
+
+/* Search
+=================================== */
+
+#topic-search-form fieldset {
+	padding: 10px 10px 10px 0;
+}
+
+#topic-search-form div label {
+	float: right;
+	text-align: left;
+	padding-right: 0;
+	padding-left: 1em;
+}
+
+#topic-search-form div div {
+	float: right;
+}
+
+.search-results ol { margin: 5px 28px 0 0; }
+
+/* Profile Edit
+=================================== */
+
+#login-page fieldset,
+#register-page fieldset,
+#profile-page fieldset {
+	padding: 10px 10px 10px 0;
+}
+
+#login-page fieldset table,
+#register-page fieldset table,
+#profile-page fieldset table {
+	text-align: right;
+}
+
+#login-page fieldset table th,
+#register-page fieldset table th,
+#profile-page fieldset table th {
+	text-align: left;
+}
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/style.css b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/style.css
new file mode 100644
index 0000000000000000000000000000000000000000..e8fab9d8f5e5830701ee03f317d1eac710d36b0e
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/style.css
@@ -0,0 +1,996 @@
+/*
+Theme Name: Kakumei
+Theme URI: http://bbpress.org/
+Description: The "revolutionized" new face of bbPress.
+Version: 1.0
+Author: <a href="http://avalonstar.com">Bryan Veloso</a> with updates by <a href="http://unlettered.org">Sam Bauers</a>
+Author URI: 
+*/
+
+/* Globals 
+=================================== */
+
+* { margin: 0; padding: 0; }
+
+body {
+	margin-bottom: 50px;
+	background-color: #fff;
+	font: 62.5% 'Trebuchet MS', 'Lucida Grande', Verdana, Tahoma, Arial;
+}
+
+a { color: #2e6e15; text-decoration: none; }
+a:hover { color: #006400; }
+
+.alt { background-color: #fff; }
+
+pre, code { font: 1.0em Monaco, 'Courier New', monospace; }
+
+pre, p { margin-bottom: 1.0em; }
+
+.left { float: left; }
+
+.right { float: right; }
+
+.delete:hover {
+	background-color: #c00;
+	color: #fff;
+}
+
+h1 { font-size: 2em; }
+
+h2 { font-size: 1.3em; }
+
+fieldset {
+	border-width: 0;
+	padding: 0;
+	margin: 0;
+}
+
+img.avatar { border: 1px solid #ddd; }
+
+.bozo { background-color: #eeee88; }
+
+.alt.bozo { background-color: #ffff99; }
+
+.deleted { background-color: #ee8888; }
+
+.alt.deleted { background-color: #ff9999; }
+
+/* Structure
+=================================== */
+
+#wrapper {
+	background: #fff url('images/page_header_tile.png') repeat-x 0px -15px;
+}
+
+#header {
+	background: url('images/page_header_bblogo.png') no-repeat bottom right; /* Remove to get rid of bb emblem. */
+	margin: 0 auto 10px;
+	width: 760px;
+	height: 116px;
+	position: relative;
+}
+
+#header h1 {
+	font-family: Georgia;
+	font-style: italic;
+	overflow: auto;
+	position: absolute;
+	display: block;
+	color: #444;
+	text-align: right;
+	letter-spacing: -1px;
+	right: 53px;
+	bottom: 26px;
+	padding: 6px;
+	z-index: 2;
+}
+
+#header p.description {
+	font-size: 1.2em;
+	font-family: Georgia;
+	font-style: italic;
+	overflow: auto;
+	position: absolute;
+	display: block;
+	color: #666;
+	text-align: right;
+	right: 53px;
+	bottom: 13px;
+	padding: 6px;
+	z-index: 2;
+}
+
+#header p { margin-bottom: 0; }
+
+#header h1 a { color: #555; text-decoration: none; }
+#header h1 a:hover { color: #666; }
+
+#header div.search {
+	float: right;
+	padding: 4px;
+	background-color: #aaa;
+	-moz-border-radius-bottomleft: 4px;
+	-khtml-border-bottom-left-radius: 4px;
+	-webkit-border-bottom-left-radius: 4px;
+	border-bottom-left-radius: 4px;
+	-moz-border-radius-bottomright: 4px;
+	-khtml-border-bottom-right-radius: 4px;
+	-webkit-border-bottom-right-radius: 4px;
+	border-bottom-right-radius: 4px;
+}
+
+#header div.search input {
+	border: 1px solid #999;
+	background-color: #fdfdfd;
+	padding: 2px;
+	line-height: 14px;
+	font-size: 12px;
+	margin: 0;
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+}
+
+#header div.search input.submit {
+	background-color: #ccc;
+	line-height: 15px;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+	padding: 2px 4px;
+}
+
+#header div.search input.submit:hover {
+	background-color: #ddd;
+	color: rgb(0, 100, 0);
+}
+
+#header div.search input.submit:active {
+	border-color: rgb(0, 100, 0);
+}
+
+#main {
+	font-size: 1.2em;
+	width: 760px;
+	margin: 0 auto 25px;
+	position: relative;
+}
+
+.bbcrumb {
+	text-transform: uppercase;
+	font-size: 0.9em;
+	letter-spacing: 1px;
+	padding: 5px 0 20px;
+	font-weight: bold;
+}
+
+#footer {
+	font-family: Georgia;
+	font-style: italic;
+	border-top: 1px solid #ccc;
+	margin: auto;
+	color: #666;
+	font-size: 1.0em;
+	padding-top: 10px;
+	clear: both;
+	text-align: right;
+	width: 760px;
+}
+
+#footer p.showoff {
+	color: #888;
+}
+
+.notice {
+	border: 1px solid #4c9545;
+	background-color: #abd8a2;
+	color: #4c9545;
+	font-size: 1.1em;
+	font-weight: bold;
+	padding: 10px 15px;
+	margin: 0 0 1.1em;
+}
+
+.notice.error {
+	border-color: #852424;
+	background-color: #ca8a8a;
+	color: #5d2424;
+}
+
+.notice p { margin-bottom: 0; }
+
+/* Login Form
+=================================== */
+
+.login {
+	position: absolute;
+	bottom: 31px;
+	left: 0;
+	font-weight: normal;
+	color: #444;
+	width: 100%;
+	z-index: 1;
+	font-size: 12px;
+}
+
+form.login {
+	bottom: 15px;
+}
+
+.login p { padding: 0 0 8px; }
+
+.login label {
+	display: block;
+	float: left;
+	padding-right: 10px;
+	line-height: 14px;
+}
+
+form.login input {
+	border: 1px solid #999;
+	padding: 2px;
+	line-height: 14px;
+	font-size: 12px;
+	margin: 0;
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+}
+
+form.login input.submit {
+	background-color: #ccc;
+	float: left;
+	margin-top: 14px;
+	margin-bottom: -10px;
+	display: block;
+	line-height: 15px;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+	padding: 2px 4px;
+}
+
+form.login input.submit:hover {
+	background-color: #ddd;
+	color: rgb(0, 100, 0);
+}
+
+form.login input.submit:active {
+	border-color: rgb(0, 100, 0);
+}
+
+div.remember label {
+	clear: both;
+	padding: 0;
+	margin: 6px 0 0 0;
+	line-height: 12px;
+}
+
+form.login input#remember {
+	border-width: 0;
+	padding: 0;
+	margin: 0;
+	vertical-align: baseline;
+}
+
+/* Front Page
+=================================== */
+
+#front-page #hottags {
+	position: absolute;
+	top: 0;
+	left: 0;
+	width: 150px;
+	overflow: hidden;
+}
+
+#front-page #discussions {
+	margin-left: 170px;
+	width: 590px;
+}
+
+.frontpageheatmap {
+	font-weight: normal;
+	line-height: 30px;
+	padding-bottom: 10px;
+}
+
+#front-page #main h2, #forum-page #main h2, h2.post-form, #userlogin, #currentfavorites, #register, #passwordrecovery {
+	color: #555;
+	border-bottom: 1px solid #ddd;
+	margin: 0 0 10px;
+	padding: 0 0 5px;
+}
+
+#front-page #discussions ul { padding: 0 0 0 14px; }
+
+.sticky { background-color: #a1d29a; }
+
+/* Page navigation
+=================================== */
+
+a.page-numbers,
+span.page-numbers {
+	border-right: 1px solid #bbbbbb;
+	border-bottom: 1px solid #bbbbbb;
+	padding: 4px 4px 2px 5px;
+	margin-left: 5px;
+	background-image: url('images/page-links-background.gif');
+	background-repeat: no-repeat;
+	background-position: 0 0;
+}
+
+span.page-numbers.current {
+	color: #ffffff;
+	background-position: 0 -100px;
+}
+
+#latest a.page-numbers {
+	font-size: 0.8em;
+	padding: 3px 3px 1px 4px;
+	margin-left: 3px;
+}
+
+a.prev.page-numbers,
+a.next.page-numbers,
+span.page-numbers.dots {
+	border-width: 0;
+	padding: 0 4px;
+	background-image: none;
+}
+
+span.page-numbers.dots {
+	padding: 0;
+}
+
+a.page-numbers:hover {
+	background-position: 0 -100px;
+}
+
+a.prev.page-numbers:hover,
+a.next.page-numbers:hover {
+	color: #006400;
+}
+
+/* Topic Page
+=================================== */
+
+.infobox {
+	border: 1px solid #ccc;
+	border-width: 1px 0;
+	padding: 1em 0;
+}
+
+.infobox ul {
+	margin: 10px 0 10px 20px;
+	padding: 0;
+	list-style-type: disc;
+}
+
+.infobox ul li { padding-bottom: 3px; }
+
+#topic-info {
+	float: left;
+	padding: 0 1em 0 0;
+}
+
+#topic-tags {
+	border-left: 1px solid #ccc;
+	float: right;
+	padding: 0 0 0 1em;
+}
+
+#tag-form p {
+	margin-bottom: 0;
+}
+
+input#tag {
+	border: 1px solid #999;
+	padding: 2px;
+	line-height: 14px;
+	font-size: 12px;
+	margin: 0;
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+}
+
+input#tagformsub {
+	border: 1px solid #999;
+	line-height: 14px;
+	font-size: 12px;
+	margin: 0;
+	line-height: 15px;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+	padding: 2px 4px;
+}
+
+input#tagformsub:hover {
+	background-color: #ddd;
+	color: rgb(0, 100, 0);
+}
+
+input#tagformsub:active {
+	border-color: rgb(0, 100, 0);
+}
+
+.nav {
+	margin: 15px 0;
+	padding: 12px 0;
+	text-align: center;
+}
+
+#thread {
+	list-style: none;
+	margin: 2em 0 0 0;
+	padding: 0;
+}
+
+#thread li {
+	line-height: 1.5em;
+	clear: both;
+	/* Hack to force padding on .threadauthor on IE */
+	border-top: 1px solid #fff;
+}
+
+#thread li ol, #thread li ul { margin-left: 40px; }
+
+#thread li ol li, #thread li ul li { padding: 0; }
+
+.threadauthor {
+	float: left;
+	padding: 1em 1em 0 1em;
+	width: 120px;
+}
+
+.threadauthor p { margin: 0; }
+
+.threadauthor small { font: 11px Verdana, Arial, Helvetica, sans-serif; }
+
+.threadpost {
+	padding: 1.5em 1em;
+	margin-left: 140px;
+	background-color: #eee;
+	-moz-border-radius: 6px;
+	-khtml-border-radius: 6px;
+	-webkit-border-radius: 6px;
+	border-radius: 6px;
+}
+
+#thread li.alt .threadpost { background-color: transparent; }
+
+#thread li.deleted { background-color: transparent; }
+
+#thread li.deleted .threadpost { background-color: #ee8888; }
+
+#thread li.alt.deleted .threadpost { background-color: #ff9999; }
+
+#thread li .post-undelete-link, #thread li.deleted .post-delete-link { display: none; }
+#thread li.deleted .post-undelete-link { display: inline; }
+
+#thread li.deleted .before-post-delete-link, #thread li .before-post-undelete-link { display: none; }
+#thread li.deleted span.before-post-undelete-link { display: inline; }
+#thread li.deleted div.before-post-undelete-link { display: block; }
+#thread li.deleted li.before-post-undelete-link { display: block; }
+
+#thread li.pingback {
+	margin-left: 140px;
+	margin-top: 2px;
+	margin-bottom: 2px;
+	background-color: #e4f3e1;
+	-moz-border-radius: 6px;
+	-khtml-border-radius: 6px;
+	-webkit-border-radius: 6px;
+	border-radius: 6px;
+	border: 0.2em solid #e4f3e1;
+}
+
+#thread li.pingback.alt {
+	background-color: #fff;
+}
+
+#thread li.pingback .threadpost {
+	background-color: #e4f3e1;
+}
+
+#thread li.pingback.alt .threadpost {
+	background-color: #fff;
+}
+
+#thread li.pingback .threadauthor {
+	float: none;
+	padding: 0.9em 0.9em 0;
+	width: auto;
+}
+
+#thread li.pingback .threadauthor strong {
+	font-weight: normal;
+}
+
+#thread li.pingback .threadauthor small {
+	color: #333;
+}
+
+#thread li.pingback .threadpost {
+	margin-left: 0;
+	padding: 0.5em 0.9em 1.5em;
+}
+
+#thread li.pingback .post {
+	font-style: italic;
+	color: #333;
+	margin: 0 0 0 2.4em;
+	padding: 0 0 0 0.8em;
+	border-left: 3px dotted #ccc;
+}
+
+#thread .post {
+	_height: 90px; /* Hack to fix broken .alt coloring in IE6 */
+}
+
+#thread .post blockquote {
+	margin: 0 0 0 2.4em;
+	padding: 0 0 0 0.8em;
+	border-left: 3px solid #ccc;
+}
+
+#thread .post li { clear:none; }
+
+.poststuff {
+	clear:both;
+	_clear: none; /* Hack to fix broken .alt coloring in IE6 */
+	border-top: 1px dotted #ccc;
+	margin: 10px 0 0;
+	padding: 5px 0 0;
+	font: 10px Verdana, Arial, Helvetica, sans-serif;
+	text-transform: uppercase;
+}
+
+.num, #forumlist small {
+	font: 11px Verdana,Arial,Helvetica,sans-serif;
+	text-align: center;
+	white-space: nowrap;
+}
+
+h2.post-form {
+	border-bottom-width: 0;
+	margin-bottom: 2px;
+}
+
+.postform {
+	background-color: #f0f0f0;
+	padding: 1em;
+	margin-bottom: 1em;
+	-moz-border-radius: 6px;
+	-khtml-border-radius: 6px;
+	-webkit-border-radius: 6px;
+	border-radius: 6px;
+}
+
+.postform textarea {
+	height: 12em;
+	margin: 5px 0;
+	padding: 5px;
+	width: 724px;
+	max-width: 724px;
+	border: 1px solid #ccc;
+	display: block;
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+}
+
+.postform label { display: block; }
+
+.postform #topic,
+.postform #tags-input {
+	margin: 5px 0;
+	padding: 5px;
+	width: 724px;
+	border: 1px solid #ccc;
+	display: block;
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+}
+
+.postform p#post-form-forum-container label span {
+	font-weight: bold;
+	font-style: italic;
+}
+
+#manage-tags {
+	margin: 10px 0;
+	list-style: none;
+}
+
+#manage-tags li {
+	float: left;
+	width: 200px;
+	padding-bottom: 10px;
+}
+
+p.submit { text-align: right; }
+
+p.allowed { margin-bottom: 0; }
+
+.topiclink { display: block; }
+
+.topictitle {
+	font-size: 26px;
+	font-weight: normal;
+	display: inline;
+}
+
+p.rss-link {
+	text-align: right;
+}
+
+a.rss-link {
+	padding: 6px 0 6px 20px;
+	background-image: url('images/feed-icon-16x16.gif');
+	background-repeat: no-repeat;
+	background-position: 0 50%;
+}
+
+#topic-move { margin-top: 1em; }
+
+/* Other
+=================================== */
+
+#content .frontpageheatmap a {
+	font-weight: normal;
+	text-decoration: none;
+}
+
+#content .infobox li { margin-bottom: 2px; }
+
+#content .nav a {
+	border: 1px solid #ccc;
+	font-weight: normal;
+}
+#content .nav a:hover {
+	border: 1px solid #999;
+}
+#content a:visited {
+	font-weight: normal;
+}
+
+#front-search {
+	float: right;
+	margin-top: -8px;
+}
+
+#latest td, #forumlist td, #favorites td { padding: 5px 10px; }
+
+#forumlist tr td div.nest {
+	padding-left: 2.5ex;
+}
+
+#latest tr:hover, #forumlist tr:hover, #favorites tr:hover { background-color: #e4f3e1; }
+
+#latest th, #forumlist th, #favorites th {
+	text-align: left;
+	background-color: rgb(102, 102, 102);
+	font: 11px Verdana,Arial,Helvetica,sans-serif;
+	font-weight: normal;
+	padding: 5px 9px;
+	color: rgb(255, 255, 255);
+}
+
+#latest th a, #forumlist th a, #favorites th a {
+	color: rgb(200, 200, 200);
+	font-style: italic;
+}
+
+#latest th a:hover, #forumlist th a:hover, #favorites th a:hover {
+	color: rgb(255, 255, 255);
+}
+
+tr.bb-category td {
+	background-color: #ddd;
+}
+
+#latest, #forumlist, #favorites {
+	background-color: #f7f7f7;
+	margin-bottom: 3em;
+	width: 100%;
+}
+
+#latest, #forumlist {
+	margin-top: -0.9em;
+}
+
+#discussions .nav {
+	margin-top: -2em;
+	margin-bottom: 1em;
+}
+
+/* Profile Page
+=================================== */
+
+#profile-menu {
+	list-style: none;
+	position: absolute;
+	right: 0;
+}
+
+#profile-menu li {
+	display: inline;
+	margin-left: 3px;
+}
+
+#profile-menu li a {
+	font-size: 1.1em;
+	background-color: #ddd;
+	padding: 4px 7px;
+	border-top: 3px double #9e9e9e;
+	position: relative;
+	top: -10px;
+	-moz-border-radius-bottomleft: 6px;
+	-khtml-border-bottom-left-radius: 6px;
+	-webkit-border-bottom-left-radius: 6px;
+	border-bottom-left-radius: 6px;
+	-moz-border-radius-bottomright: 6px;
+	-khtml-border-bottom-right-radius: 6px;
+	-webkit-border-bottom-right-radius: 6px;
+	border-bottom-right-radius: 6px;
+}
+
+#profile-menu li.current a {
+	background-color: #bbb;
+	border-top: 1px solid #9e9e9e;
+}
+
+#profile-menu li a:hover {
+	background-color: #e4f3e1;
+}
+
+#useravatar { margin-bottom: 1em; }
+
+#useravatar img { display: block; border-width: 3px; border-style: double; }
+
+#userinfo { margin-top: 10px; }
+
+#userinfo dt { font-weight: bold; }
+
+#userinfo dd { margin: 0 0 5px; } 
+
+#useractivity { margin: 15px 0 5px; }
+
+.user-recent { margin: 0 0 10px; }
+
+.user-recent ol { margin: 5px 0 0 28px; }
+
+.user-recent ol li { margin: 0 0 3px; }
+
+/* Search
+=================================== */
+
+#topic-search-form fieldset {
+	border-top: 3px double #ccc;
+	border-bottom: 1px solid #ccc;
+	border-left: none;
+	border-right: none;
+	padding: 10px 0 10px 10px;
+	margin-bottom: 15px;
+	background-color: #f6f6f6;
+}
+
+#topic-search-form div {
+	clear: both;
+}
+
+#topic-search-form div label {
+	display: block;
+	float: left;
+	padding: 5px;
+	text-align: right;
+	width: 20%;
+	vertical-align: top;
+	padding-right: 1em;
+	font-weight: bold;
+}
+
+#topic-search-form div div {
+	display: block;
+	float: left;
+	clear: none;
+	padding: 5px;
+}
+
+#topic-search-form div div input {
+	width: 280px;
+	border: 1px solid #ccc;
+	padding: 2px;
+	line-height: 14px;
+	font-size: 12px;
+	margin: 0;
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+}
+
+#search-for { margin: 15px 0 5px; }
+
+.search-results { margin: 0 0 10px; }
+
+.search-results ol { margin: 5px 0 0 28px; }
+
+.search-results ol li { margin: 0 0 3px; }
+
+/* Login, Register, Profile Edit
+=================================== */
+
+#login-page fieldset,
+#register-page fieldset,
+#profile-page fieldset {
+	border-top: 3px double #ccc;
+	border-bottom: 1px solid #ccc;
+	border-left: none;
+	border-right: none;
+	padding: 10px 0 10px 10px;
+	margin-bottom: 15px;
+	background-color: #f6f6f6;
+}
+
+#login-page legend,
+#register-page legend,
+#profile-page legend {
+	font-weight: bold;
+	padding: 0 15px;
+}
+
+#login-page fieldset table,
+#register-page fieldset table,
+#profile-page fieldset table {
+	text-align: left;
+	margin: 0 15px;
+	width: 95%;
+	border-collapse: collapse;
+}
+
+#login-page fieldset table th,
+#register-page fieldset table th,
+#profile-page fieldset table th {
+	padding: 5px;
+	text-align: right;
+	width: 20%;
+	vertical-align: top;
+	padding-right: 1em;
+}
+
+#login-page fieldset table tr.error th em,
+#register-page fieldset table tr.error th em,
+#profile-page fieldset table tr.error th em {
+	position: absolute;
+	/* fieldset:padding-left + table:margin-left + table:width + td:padding-left + input:width + input:padding-right */
+	left: 458px; /* 10 + 15 + 20% * ( 95% * (760 - 10)  ) + 5 + 280 + 5 */
+	margin-left: 1em; /* th:padding-right = 1em */
+	color: red;
+	font-style: normal;
+}
+
+#login-page fieldset table td,
+#register-page fieldset table td,
+#profile-page fieldset table td {
+	padding: 5px;
+}
+
+#login-page fieldset table td p,
+#register-page fieldset table td p,
+#profile-page fieldset table td p{
+	margin: 5px 0;
+}
+
+#login-page fieldset input[type=text],
+#register-page fieldset input[type=text],
+#profile-page fieldset input[type=text],
+#login-page fieldset input[type=password],
+#profile-page fieldset input[type=password] {
+	width: 280px;
+	border: 1px solid #ccc;
+	padding: 2px;
+	line-height: 14px;
+	font-size: 12px;
+	margin: 0;
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+}
+
+#login-page fieldset p,
+#register-page fieldset p,
+#profile-page fieldset p {
+	font-size: 11px;
+	margin: 10px 16px;
+}
+
+#login-page tr.form-required label:before,
+#register-page tr.form-required label:before,
+#profile-page tr.form-required label:before,
+p.required-message:before {
+	content: ' * ';
+	color: red;
+	vertical-align: 10%;
+}
+
+.form-invalid {
+	background-color: #ffebe8 !important;
+}
+
+.form-invalid input {
+	padding: 1px;
+	border: 1px solid #c00 !important;
+}
+
+.hidden {
+	display: none;
+}
+
+#pass-strength-result {
+	padding: 2px;
+	text-align: center;
+	width: 280px;
+	border: 1px solid #ccc;
+	background-color: #e3e3e3;
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+}
+
+#pass-strength-result.bad {
+	background-color: #ffeff7;
+	border-color: #c69;
+}
+
+#pass-strength-result.good {
+	background-color: #effff4;
+	border-color: #66cc87;
+}
+
+#pass-strength-result.short {
+	background-color: #e3e3e3;
+}
+
+#pass-strength-result.strong {
+	background-color: #59ef86;
+	border-color: #319f52;
+}
+
+p.submit input {
+	background-color: #ccc;
+	border: 1px solid #999;
+	padding: 2px 4px;
+	line-height: 14px;
+	font-size: 12px;
+	margin: 0;
+	line-height: 15px;
+	-moz-border-radius: 4px;
+	-khtml-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+}
+
+p.submit input:hover {
+	background-color: #ddd;
+	color: rgb(0, 100, 0);
+}
+
+p.submit input:active {
+	border-color: rgb(0, 100, 0);
+}
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/tag-single.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/tag-single.php
new file mode 100644
index 0000000000000000000000000000000000000000..1178d0f0b898328f62a857e8f9b08ea3142febd3
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/tag-single.php
@@ -0,0 +1,41 @@
+<?php bb_get_header(); ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <a href="<?php bb_tag_page_link(); ?>"><?php _e('Tags'); ?></a> &raquo; <?php bb_tag_name(); ?></div>
+
+<?php do_action('tag_above_table'); ?>
+
+<?php if ( $topics ) : ?>
+
+<table id="latest" role="main">
+<tr>
+	<th><?php _e('Topic'); ?> &#8212; <?php bb_new_topic_link(); ?></th>
+	<th><?php _e('Posts'); ?></th>
+	<!-- <th><?php _e('Voices'); ?></th> -->
+	<th><?php _e('Last Poster'); ?></th>
+	<th><?php _e('Freshness'); ?></th>
+</tr>
+
+<?php foreach ( $topics as $topic ) : ?>
+<tr<?php topic_class(); ?>>
+	<td><?php bb_topic_labels(); ?> <a href="<?php topic_link(); ?>"><?php topic_title(); ?></a><?php topic_page_links(); ?></td>
+	<td class="num"><?php topic_posts(); ?></td>
+	<!-- <td class="num"><?php bb_topic_voices(); ?></td> -->
+	<td class="num"><?php topic_last_poster(); ?></td>
+	<td class="num"><a href="<?php topic_last_post_link(); ?>"><?php topic_time(); ?></a></td>
+</tr>
+<?php endforeach; ?>
+</table>
+
+<p class="rss-link"><a href="<?php bb_tag_posts_rss_link(); ?>" class="rss-link"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr> link for this tag') ?></a></p>
+
+<?php tag_pages( array( 'before' => '<div class="nav">', 'after' => '</div>' ) ); ?>
+
+<?php endif; ?>
+
+<?php post_form(); ?>
+
+<?php do_action('tag_below_table'); ?>
+
+<?php manage_tags_forms(); ?>
+
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/tags.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/tags.php
new file mode 100644
index 0000000000000000000000000000000000000000..91e9f9f007b4b7b2c13d9039b936637f84d8e537
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/tags.php
@@ -0,0 +1,11 @@
+<?php bb_get_header(); ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <?php _e('Tags'); ?></div>
+
+<p role="main"><?php _e('This is a collection of tags that are currently popular on the forums.'); ?></p>
+
+<div id="hottags">
+<?php bb_tag_heat_map( 9, 38, 'pt', 80 ); ?>
+</div>
+
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/topic-tags.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/topic-tags.php
new file mode 100644
index 0000000000000000000000000000000000000000..7c82740f3a1f5fc9ae0caec75dd890608563e7b2
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/topic-tags.php
@@ -0,0 +1,16 @@
+<div id="topic-tags">
+<p><?php _e('Tags:'); ?></p>
+
+<?php if ( bb_get_topic_tags() ) : ?>
+
+<?php bb_list_tags(); ?>
+
+<?php else : ?>
+
+<p><?php printf(__('No <a href="%s">tags</a> yet.'), bb_get_tag_page_link() ); ?></p>
+
+<?php endif; ?>
+
+<?php tag_form(); ?>
+
+</div>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/topic.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/topic.php
new file mode 100644
index 0000000000000000000000000000000000000000..2b81780638c2988ea53bc1142a95e9005cb1ce33
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/topic.php
@@ -0,0 +1,57 @@
+<?php bb_get_header(); ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a><?php bb_forum_bread_crumb(); ?></div>
+<div class="infobox" role="main">
+
+<div id="topic-info">
+<span id="topic_labels"><?php bb_topic_labels(); ?></span>
+<h2<?php topic_class( 'topictitle' ); ?>><?php topic_title(); ?></h2>
+<span id="topic_posts">(<?php topic_posts_link(); ?>)</span>
+<span id="topic_voices">(<?php printf( _n( '%s voice', '%s voices', bb_get_topic_voices() ), bb_get_topic_voices() ); ?>)</span>
+
+<ul class="topicmeta">
+	<li><?php printf(__('Started %1$s ago by %2$s'), get_topic_start_time(), get_topic_author()) ?></li>
+<?php if ( 1 < get_topic_posts() ) : ?>
+	<li><?php printf(__('<a href="%1$s">Latest reply</a> from %2$s'), esc_attr( get_topic_last_post_link() ), get_topic_last_poster()) ?></li>
+<?php endif; ?>
+<?php if ( bb_is_user_logged_in() ) : ?>
+	<li<?php echo $class;?> id="favorite-toggle"><?php user_favorites_link(); ?></li>
+<?php endif; do_action('topicmeta'); ?>
+</ul>
+</div>
+
+<?php topic_tags(); ?>
+
+<div style="clear:both;"></div>
+</div>
+<?php do_action('under_title'); ?>
+<?php if ($posts) : ?>
+<?php topic_pages( array( 'before' => '<div class="nav">', 'after' => '</div>' ) ); ?>
+<div id="ajax-response"></div>
+<ol id="thread" class="list:post">
+
+<?php foreach ($posts as $bb_post) : $del_class = post_del_class(); ?>
+	<li id="post-<?php post_id(); ?>"<?php alt_class('post', $del_class); ?>>
+<?php bb_post_template(); ?>
+	</li>
+<?php endforeach; ?>
+
+</ol>
+<div class="clearit"><br style=" clear: both;" /></div>
+<p class="rss-link"><a href="<?php topic_rss_link(); ?>" class="rss-link"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr> feed for this topic') ?></a></p>
+<?php topic_pages( array( 'before' => '<div class="nav">', 'after' => '</div>' ) ); ?>
+<?php endif; ?>
+<?php if ( topic_is_open( $bb_post->topic_id ) ) : ?>
+<?php post_form(); ?>
+<?php else : ?>
+<h2><?php _e('Topic Closed') ?></h2>
+<p><?php _e('This topic has been closed to new replies.') ?></p>
+<?php endif; ?>
+<?php if ( bb_current_user_can( 'delete_topic', get_topic_id() ) || bb_current_user_can( 'close_topic', get_topic_id() ) || bb_current_user_can( 'stick_topic', get_topic_id() ) || bb_current_user_can( 'move_topic', get_topic_id() ) ) : ?>
+
+<div class="admin">
+<?php bb_topic_admin(); ?>
+</div>
+
+<?php endif; ?>
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/view.php b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/view.php
new file mode 100644
index 0000000000000000000000000000000000000000..738362e5fa929c5b2df31ba04dc63dfd6097385e
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/kakumei/view.php
@@ -0,0 +1,44 @@
+<?php bb_get_header(); ?>
+
+<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <?php view_name(); ?></div>
+
+<?php if ( $topics || $stickies ) : ?>
+
+<table id="latest" role="main">
+<tr>
+	<th><?php _e('Topic'); ?></th>
+	<th><?php _e('Posts'); ?></th>
+	<!-- <th><?php _e('Voices'); ?></th> -->
+	<th><?php _e('Last Poster'); ?></th>
+	<th><?php _e('Freshness'); ?></th>
+</tr>
+
+<?php if ( $stickies ) : foreach ( $stickies as $topic ) : ?>
+<tr<?php topic_class(); ?>>
+	<td><?php bb_topic_labels(); ?> <big><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></big></td>
+	<td class="num"><?php topic_posts(); ?></td>
+	<!-- <td class="num"><?php bb_topic_voices(); ?></td> -->
+	<td class="num"><?php topic_last_poster(); ?></td>
+	<td class="num"><a href="<?php topic_last_post_link(); ?>"><?php topic_time(); ?></a></td>
+</tr>
+<?php endforeach; endif; ?>
+
+<?php if ( $topics ) : foreach ( $topics as $topic ) : ?>
+<tr<?php topic_class(); ?>>
+	<td><?php bb_topic_labels(); ?> <a href="<?php topic_link(); ?>"><?php topic_title(); ?></a><?php topic_page_links(); ?></td>
+	<td class="num"><?php topic_posts(); ?></td>
+	<!-- <td class="num"><?php bb_topic_voices(); ?></td> -->
+	<td class="num"><?php topic_last_poster(); ?></td>
+	<td class="num"><a href="<?php topic_last_post_link(); ?>"><?php topic_time(); ?></a></td>
+</tr>
+<?php endforeach; endif; ?>
+</table>
+
+<p class="rss-link"><a href="<?php bb_view_rss_link(); ?>" class="rss-link"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr> feed for this view'); ?></a></p>
+
+<div class="nav">
+<?php view_pages(); ?>
+</div>
+<?php endif; ?>
+
+<?php bb_get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/readme.txt b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/readme.txt
new file mode 100644
index 0000000000000000000000000000000000000000..12f28e0066122425b2440eda7cfa7c91cefe361d
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/bb-templates/readme.txt
@@ -0,0 +1,3 @@
+This directory is reserved for themes distributed with the bbPress core package.
+
+If you wish to install more themes, you should create a new directory called "my-templates" in the base directory of your bbPress installation and install them there, not here.
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/edit.php b/wp-content/plugins/buddypress/bp-forums/bbpress/edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..90592173cb965439f4fad94a04fd2aa267ee224e
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/edit.php
@@ -0,0 +1,28 @@
+<?php
+require('./bb-load.php');
+
+bb_auth('logged_in');
+
+$post_id = (int) $_GET['id'];
+
+$bb_post  = bb_get_post( $post_id );
+
+if ( !$bb_post || !bb_current_user_can( 'edit_post', $post_id ) ) {
+	wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
+	die();
+}
+
+if ( 0 != $bb_post->post_status && 'all' == $_GET['view'] ) // We're trying to edit a deleted post
+	add_filter('bb_is_first_where', 'bb_no_where');
+
+$topic = get_topic( $bb_post->topic_id );
+
+if ( bb_is_first( $bb_post->post_id ) && bb_current_user_can( 'edit_topic', $topic->topic_id ) ) 
+	$topic_title = $topic->topic_title;
+else 
+	$topic_title = false;
+
+
+bb_load_template( 'edit-post.php', array('topic_title') );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/favorites.php b/wp-content/plugins/buddypress/bp-forums/bbpress/favorites.php
new file mode 100644
index 0000000000000000000000000000000000000000..1cab01c2e7b9fe63d66be5a520f55baa091f1453
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/favorites.php
@@ -0,0 +1,49 @@
+<?php
+require_once('./bb-load.php');
+
+if ( isset( $_GET['fav'] ) && isset( $_GET['topic_id'] ) ) {
+	bb_auth( 'logged_in' );
+
+	if ( !bb_current_user_can( 'edit_favorites_of', $user_id ) ) {
+		bb_die( __( 'You cannot edit those favorites. How did you get here?' ) );
+	}
+
+	$fav = (int) $_GET['fav'];
+	$topic_id = (int) $_GET['topic_id'];
+
+	bb_check_admin_referer( 'toggle-favorite_' . $topic_id );
+
+	$topic = get_topic( $topic_id );
+	if ( !$topic || 0 != $topic->topic_status ) {
+		exit;
+	}
+
+	if ( $fav ) {
+		bb_add_user_favorite( $user_id, $topic_id );
+	} else {
+		bb_remove_user_favorite( $user_id, $topic_id );
+	}
+
+	$ref = wp_get_referer();
+	if ( false !== strpos( $ref, bb_get_uri( null, null, BB_URI_CONTEXT_TEXT ) ) ) {
+		bb_safe_redirect( $ref );
+	} else {
+		wp_redirect( get_topic_link( $topic_id ) );
+	}
+	exit;
+}
+
+if ( !bb_is_profile() ) {
+	$sendto = get_profile_tab_link( $user->ID, 'favorites' );
+	wp_redirect( $sendto );
+	exit;
+}
+
+if ( $topics = get_user_favorites( $user->ID, true ) ) {
+	bb_cache_last_posts( $topics );
+}
+
+$favorites_total = isset( $user->favorites ) ? count( explode( ',', $user->favorites ) ) : 0;
+
+bb_load_template( 'favorites.php', array( 'favorites_total', 'self' ) );
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/forum.php b/wp-content/plugins/buddypress/bp-forums/bbpress/forum.php
new file mode 100644
index 0000000000000000000000000000000000000000..a963f82ea2684d92ca896afb35d1f17d79b60c7b
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/forum.php
@@ -0,0 +1,26 @@
+<?php
+
+require_once('./bb-load.php');
+
+$forum_id = 0;
+
+bb_repermalink();
+
+if ( !$forum )
+	bb_die(__('Forum not found.'));
+
+$bb_db_override = false;
+do_action( 'bb_forum.php_pre_db', $forum_id );
+
+if ( !$bb_db_override ) :
+	if ( $topics = get_latest_topics( $forum_id, $page ) ) {
+		bb_cache_last_posts( $topics );
+	}
+	if ( $stickies = get_sticky_topics( $forum_id, $page ) ) {
+		bb_cache_last_posts( $stickies );
+	}
+endif;
+
+bb_load_template( 'forum.php', array('bb_db_override', 'stickies'), $forum_id );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/index.php b/wp-content/plugins/buddypress/bp-forums/bbpress/index.php
new file mode 100644
index 0000000000000000000000000000000000000000..b21a2d1041183eafa50e1143ce77585e79ab5fb6
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/index.php
@@ -0,0 +1,24 @@
+<?php
+
+require('./bb-load.php');
+
+bb_repermalink();
+
+$bb_db_override = false;
+do_action( 'bb_index.php_pre_db' );
+
+if ( isset($_GET['new']) && '1' == $_GET['new'] ) :
+	$forums = false;
+elseif ( !$bb_db_override ) :
+	$forums = bb_get_forums(); // Comment to hide forums
+	if ( $topics = get_latest_topics( false, $page ) ) {
+		bb_cache_last_posts( $topics );
+	}
+	if ( $super_stickies = get_sticky_topics() ) {
+		bb_cache_last_posts( $super_stickies );
+	}
+endif;
+
+bb_load_template( 'front-page.php', array('bb_db_override', 'super_stickies') );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/license.txt b/wp-content/plugins/buddypress/bp-forums/bbpress/license.txt
new file mode 100644
index 0000000000000000000000000000000000000000..7e14f3854fa4209e6aebfaf8c2b9f414b3b75b85
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/license.txt
@@ -0,0 +1,339 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/page.php b/wp-content/plugins/buddypress/bp-forums/bbpress/page.php
new file mode 100644
index 0000000000000000000000000000000000000000..7726408369f8566f97a94f7c23cf500e931f8f5f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/page.php
@@ -0,0 +1,3 @@
+<?php
+include('./index.php');
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/profile-base.php b/wp-content/plugins/buddypress/bp-forums/bbpress/profile-base.php
new file mode 100644
index 0000000000000000000000000000000000000000..84cabdcf512b62691bb944f8280639b7a15e8fd0
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/profile-base.php
@@ -0,0 +1,19 @@
+<?php
+require_once('./bb-load.php');
+
+$user_id = bb_get_current_user_info( 'id' );
+
+if ( !bb_is_profile() ) {
+	$sendto = get_profile_tab_link( $user_id, 'edit' );
+	wp_redirect( $sendto );
+	exit;
+}
+
+do_action($self . '_pre_head');
+
+
+if ( is_callable($self) )
+	bb_load_template( 'profile-base.php', array('self'), $user_id );
+
+exit;
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/profile-edit.php b/wp-content/plugins/buddypress/bp-forums/bbpress/profile-edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..f47f1b5bce0507e756ac598cf6654b4d1a33598f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/profile-edit.php
@@ -0,0 +1,175 @@
+<?php
+require_once( './bb-load.php' );
+
+// Redirect if we require SSL and it isn't
+bb_ssl_redirect();
+
+// Authenticate against the "logged_in" cookie
+bb_auth( 'logged_in' );
+
+// Check that the current user can do this, if not kick them to the front page
+if ( !bb_current_user_can( 'edit_user', $user_id ) ) {
+	$sendto = bb_get_uri( null, null, BB_URI_CONTEXT_HEADER );
+	wp_redirect( $sendto );
+	exit;
+}
+
+// Store the current user id
+$bb_current_id = bb_get_current_user_info( 'id' );
+
+// I don't know how this would ever get triggered
+if ( !bb_is_profile() ) {
+	$sendto = get_profile_tab_link( $bb_current_id, 'edit' );
+	wp_redirect( $sendto );
+	exit;
+}
+
+// Set some low capabilities if the current user has none
+if ( !isset( $user->capabilities ) ) {
+	$user->capabilities = array( 'inactive' => true );
+}
+
+// Store the profile info keys
+$profile_info_keys = bb_get_profile_info_keys( 'profile-edit' );
+
+// Store additional keys if the current user has access to them
+if ( bb_current_user_can('edit_users') ) {
+	$profile_admin_keys = bb_get_profile_admin_keys( 'profile-edit' );
+	$assignable_caps = bb_get_assignable_caps();
+}
+
+// Instantiate the error object
+$errors = new WP_Error;
+
+if ( 'post' == strtolower($_SERVER['REQUEST_METHOD']) ) {
+	$_POST = stripslashes_deep( $_POST );
+	bb_check_admin_referer( 'edit-profile_' . $user_id );
+
+	// Fix the URL before sanitizing it
+	$user_url = bb_fix_link( $_POST['user_url'] );
+
+	// Sanitize the profile info keys and check for missing required data
+	foreach ( $profile_info_keys as $key => $label ) {
+		$$key = apply_filters( 'sanitize_profile_info', $_POST[$key], $key, $_POST[$key] );
+		if ( !$$key && $label[0] == 1 ) {
+			$errors->add( $key, sprintf( __( '%s is required.' ), esc_html( $label[1] ) ) );
+			$$key = false;
+		}
+	}
+
+	// Find out if we have a valid email address
+	if ( isset( $user_email ) && !$user_email = is_email( $user_email ) ) {
+		$errors->add( 'user_email', __( 'Invalid email address' ), array( 'data' => $_POST['user_email'] ) );
+	}
+
+	// Deal with errors for users who can edit others data
+	if ( bb_current_user_can('edit_users') ) {
+		// If we are deleting just do it and redirect
+		if ( isset($_POST['delete-user']) && $_POST['delete-user'] && $bb_current_id != $user->ID ) {
+			bb_delete_user( $user->ID );
+			wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
+			exit;
+		}
+
+		// Get the user object
+		$user_obj = new BP_User( $user->ID );
+
+		// Store the new role
+		$role = $_POST['role'];
+
+		// Deal with errors with the role
+		if ( !isset($wp_roles->role_objects[$role]) ) {
+			$errors->add( 'role', __( 'Invalid Role' ) );
+		} elseif ( !bb_current_user_can( 'keep_gate' ) && ( 'keymaster' == $role || 'keymaster' == $user_obj->roles[0] ) ) {
+			$errors->add( 'role', __( 'You are not the Gate Keeper.' ) );
+		} elseif ( 'keymaster' == $user_obj->roles[0] && 'keymaster' != $role && $bb_current_id == $user->ID ) {
+			$errors->add( 'role', __( 'You are Keymaster, so you may not demote yourself.' ) );
+		}
+
+		// Sanitize the profile admin keys and check for missing required data
+		foreach ( $profile_admin_keys as $key => $label ) {
+			if ( isset( $$key ) )
+				continue;
+
+			$$key = apply_filters( 'sanitize_profile_admin', $_POST[$key], $key, $_POST[$key] );
+			if ( !$$key && $label[0] == 1 ) {
+				$errors->add( $key, sprintf( __( '%s is required.' ), esc_html( $label[1] ) ) );
+				$$key = false;
+			}
+		}
+
+		// Create variable for the requested roles
+		foreach ( $assignable_caps as $cap => $label ) {
+			if ( isset($$cap) )
+				continue;
+
+			$$cap = ( isset($_POST[$cap]) && $_POST[$cap] ) ? 1 : 0;
+		}
+	}
+
+	// Deal with errors generated from the password form
+	if ( bb_current_user_can( 'change_user_password', $user->ID ) ) {
+		if ( ( !empty($_POST['pass1']) || !empty($_POST['pass2']) ) && $_POST['pass1'] !== $_POST['pass2'] ) {
+			$errors->add( 'pass', __( 'You must enter the same password twice.' ) );
+		} elseif( !empty($_POST['pass1']) && !bb_current_user_can( 'change_user_password', $user->ID ) ) {
+			$errors->add( 'pass', __( "You are not allowed to change this user's password." ) );
+		}
+	}
+
+	// If there are no errors then update the records
+	if ( !$errors->get_error_codes() ) {
+		do_action('before_profile_edited', $user->ID);
+		
+		if ( bb_current_user_can( 'edit_user', $user->ID ) ) {
+			// All these are always set at this point
+			bb_update_user( $user->ID, $user_email, $user_url, $display_name );
+
+			// Add user meta data
+			foreach( $profile_info_keys as $key => $label ) {
+				if ( 'display_name' == $key || 'ID' == $key || strpos($key, 'user_') === 0 )
+					continue;
+				if ( $$key != '' || isset($user->$key) )
+					bb_update_usermeta( $user->ID, $key, $$key );
+			}
+		}
+
+		if ( bb_current_user_can( 'edit_users' ) ) {
+			if ( !array_key_exists($role, $user->capabilities) ) {
+				$user_obj->set_role($role); // Only support one role for now
+				if ( 'blocked' == $role && 'blocked' != $old_role )
+					bb_break_password( $user->ID );
+				elseif ( 'blocked' != $role && 'blocked' == $old_role )
+					bb_fix_password( $user->ID );
+			}
+			foreach( $profile_admin_keys as $key => $label )
+				if ( $$key != ''  || isset($user->$key) )
+					bb_update_usermeta( $user->ID, $key, $$key );
+			foreach( $assignable_caps as $cap => $label ) {
+				if ( ( !$already = array_key_exists($cap, $user->capabilities) ) && $$cap) {
+					$user_obj->add_cap($cap);
+				} elseif ( !$$cap && $already ) {
+					$user_obj->remove_cap($cap);
+				}
+			}
+		}
+
+		if ( bb_current_user_can( 'change_user_password', $user->ID ) && !empty($_POST['pass1']) ) {
+			$_POST['pass1'] = addslashes($_POST['pass1']);
+			bb_update_user_password( $user->ID, $_POST['pass1'] );
+
+			if ( bb_get_current_user_info( 'ID' ) == $user->ID ) {
+				bb_clear_auth_cookie();
+				bb_set_auth_cookie( $user->ID );
+			}
+		}
+		
+		do_action('profile_edited', $user->ID);
+
+		wp_redirect( add_query_arg( 'updated', 'true', get_user_profile_link( $user->ID ) ) );
+		exit;
+	}
+}
+
+bb_load_template( 'profile-edit.php', array('profile_info_keys', 'profile_admin_keys', 'assignable_caps', 'user_email', 'bb_roles', 'errors', 'self') );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/profile.php b/wp-content/plugins/buddypress/bp-forums/bbpress/profile.php
new file mode 100644
index 0000000000000000000000000000000000000000..79dfb7ab34d3ba0c60468c80308ba9ff621d44e9
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/profile.php
@@ -0,0 +1,31 @@
+<?php
+require_once('./bb-load.php');
+
+bb_repermalink(); // The magic happens here.
+
+if ( $self ) {
+	if ( strpos($self, '.php') !== false ) {
+		require($self);
+	} else {
+		require( BB_PATH . 'profile-base.php' );
+	}
+	return;
+}
+
+$reg_time = bb_gmtstrtotime( $user->user_registered );
+$profile_info_keys = bb_get_profile_info_keys();
+
+if ( !isset( $_GET['updated'] ) )
+	$updated = false;
+else
+	$updated = true;
+
+do_action( 'bb_profile.php_pre_db', $user_id );
+
+if ( isset($user->is_bozo) && $user->is_bozo && $user->ID != bb_get_current_user_info( 'id' ) && !bb_current_user_can( 'moderate' ) )
+	$profile_info_keys = array();
+
+$posts = bb_get_recent_user_replies( $user_id );
+$topics = get_recent_user_threads( $user_id );
+
+bb_load_template( 'profile.php', array('reg_time', 'profile_info_keys', 'updated', 'threads'), $user_id );
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/readme.txt b/wp-content/plugins/buddypress/bp-forums/bbpress/readme.txt
new file mode 100644
index 0000000000000000000000000000000000000000..a9648f5b952d0b3f0be34b3582e360aa76415560
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/readme.txt
@@ -0,0 +1,22 @@
+bbPress is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+bbPress is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more
+details.
+
+You should have received a copy of the GNU General Public License in a file
+named "license.txt" along with this program; if not, you may request a copy by
+writing to:
+
+	Free Software Foundation, Inc.
+	51 Franklin St, Fifth Floor
+	Boston, MA
+	02110-1301 USA
+
+The license is also available for viewing on the world wide web at:
+
+	http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/register.php b/wp-content/plugins/buddypress/bp-forums/bbpress/register.php
new file mode 100644
index 0000000000000000000000000000000000000000..99c2437069d0cf9e8f35a9c41d212f80299bc8c2
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/register.php
@@ -0,0 +1,72 @@
+<?php
+require('./bb-load.php');
+
+bb_ssl_redirect();
+
+$profile_info_keys = bb_get_profile_info_keys();
+
+unset($profile_info_keys['first_name']);
+unset($profile_info_keys['last_name']);
+unset($profile_info_keys['display_name']);
+
+$user_login = '';
+$user_safe = true;
+
+$bb_register_error = new WP_Error;
+
+$_globals = array('profile_info_keys', 'user_safe', 'user_login', 'user_email', 'user_url', 'bad_input', 'bb_register_error');
+$_globals = array_merge($_globals, array_keys($profile_info_keys));
+
+if ( $_POST && 'post' == strtolower($_SERVER['REQUEST_METHOD']) ) {
+	$_POST = stripslashes_deep( $_POST );
+	$_POST['user_login'] = trim( $_POST['user_login'] );
+	$user_login = sanitize_user( $_POST['user_login'], true );
+	if ( $user_login !== $_POST['user_login'] ) {
+		$bad_input = true;
+		if ( $user_login ) {
+			$bb_register_error->add( 'user_login', sprintf( __( '%s is an invalid username. How\'s this one?' ), esc_html( $_POST['user_login'] ) ) );
+		} else {
+			$bb_register_error->add( 'user_login', sprintf( __( '%s is an invalid username.' ), esc_html( $_POST['user_login'] ) ) );
+		}
+	}
+
+	foreach ( $profile_info_keys as $key => $label ) {
+		if ( is_string($$key) )
+			$$key = esc_attr( $$key );
+		elseif ( is_null($$key) )
+			$$key = esc_attr( $_POST[$key] );
+
+		if ( !$$key && $label[0] == 1 ) {
+			$bad_input = true;
+			$$key = false;
+			$bb_register_error->add( $key, sprintf( __( '%s is required' ), $label[1] ) );
+		}
+	}
+
+	if ( !$bad_input ) {
+		$user_id = bb_new_user( $user_login, $_POST['user_email'], $_POST['user_url'] );
+		if ( is_wp_error( $user_id ) ) { // error
+			foreach ( $user_id->get_error_codes() as $code )
+				$bb_register_error->add( $code, $user_id->get_error_message( $code ) );
+			if ( $bb_register_error->get_error_message( 'user_login' ) )
+				$user_safe = false;
+		} elseif ( $user_id ) { // success
+			foreach( $profile_info_keys as $key => $label )
+				if ( strpos($key, 'user_') !== 0 && $$key !== '' )
+					bb_update_usermeta( $user_id, $key, $$key );
+			do_action('register_user', $user_id);
+
+			bb_load_template( 'register-success.php', $_globals );
+			exit;	
+		} // else failure
+	}
+}
+
+if ( isset( $_GET['user'] ) )
+	$user_login = sanitize_user( $_GET['user'], true ) ;
+elseif ( isset( $_POST['user_login'] ) && !is_string($user_login) )
+	$user_login = '';
+
+bb_load_template( 'register.php', $_globals );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/rss.php b/wp-content/plugins/buddypress/bp-forums/bbpress/rss.php
new file mode 100644
index 0000000000000000000000000000000000000000..3fdde284f34d224ee7cdbcc7a0d1db0e9a5c883f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/rss.php
@@ -0,0 +1,203 @@
+<?php
+require('./bb-load.php');
+
+// Determine the type of feed and the id of the object
+if ( isset($_GET['view']) || bb_get_path() == 'view' ) {
+	
+	// View
+	$feed = 'view';
+	$feed_id = isset($_GET['view']) ? $_GET['view'] : bb_get_path(2);
+	
+} elseif ( isset($_GET['topic']) || bb_get_path() == 'topic' ) {
+	
+	// Topic
+	$feed = 'topic';
+	$topic = get_topic(isset($_GET['topic']) ? $_GET['topic'] : bb_get_path(2));
+	$feed_id = $topic->topic_id;
+	
+} elseif ( isset($_GET['profile']) || bb_get_path() == 'profile' ) {
+	
+	// Profile
+	$feed = 'profile';
+	$feed_id = isset($_GET['profile']) ? $_GET['profile'] : bb_get_path(2);
+	
+} elseif ( isset($_GET['tag']) || bb_get_path() == 'tags' ) {
+	
+	if ( isset($_GET['topics']) || bb_get_path(3) == 'topics' ) {
+		// Tag recent topics
+		$feed = 'tag-topics';
+	} else {
+		// Tag recent posts
+		$feed = 'tag-posts';
+	}
+	$feed_id = isset($_GET['tag']) ? $_GET['tag'] : bb_get_path(2);
+	
+} elseif ( isset($_GET['forum']) || bb_get_path() == 'forum' ) {
+	
+	if ( isset($_GET['topics']) || bb_get_path(3) == 'topics' ) {
+		// Forum recent topics
+		$feed = 'forum-topics';
+	} else {
+		// Forum recent posts
+		$feed = 'forum-posts';
+	}
+	$forum = bb_get_forum(isset($_GET['forum']) ? $_GET['forum'] : bb_get_path(2));
+	$feed_id = $forum->forum_id;
+	
+} elseif ( isset($_GET['topics']) || bb_get_path() == 'topics' ) {
+	
+	// Recent topics
+	$feed = 'all-topics';
+	
+} else {
+	
+	// Recent posts
+	$feed = 'all-posts';
+	
+}
+
+// Initialise the override variable
+$bb_db_override = false;
+do_action( 'bb_rss.php_pre_db' );
+
+if ( !$bb_db_override ) {
+	
+	// Get the posts and the title for the given feed
+	switch ($feed) {
+		case 'view':
+			if ( !isset($bb_views[$feed_id]) )
+				die();
+			if ( !$bb_views[$feed_id]['feed'] )
+				die();
+			if ( !$topics_object = new BB_Query( 'topic', $bb_views[$feed_id]['query'], "bb_view_$feed_id" ) )
+				die();
+			
+			$topics = $topics_object->results;
+			if ( !$topics || !is_array($topics) )
+				die();
+			
+			$posts = array();
+			foreach ($topics as $topic) {
+				$posts[] = bb_get_first_post($topic->topic_id);
+			}
+			
+			$title = esc_html( sprintf( __( '%1$s &raquo; View: %2$s' ), bb_get_option( 'name' ), $bb_views[$feed_id]['title'] ) );
+			$link = get_view_link($feed_id);
+			$link_self = bb_get_view_rss_link($feed_id);
+			break;
+		
+		case 'topic':
+			if ( !$topic = get_topic ( $feed_id ) )
+				die();
+			if ( !$posts = get_thread( $feed_id, 0, 1 ) )
+				die();
+			$title = esc_html( sprintf( __( '%1$s &raquo; Topic: %2$s' ), bb_get_option( 'name' ), get_topic_title() ) );
+			$link = get_topic_link($feed_id);
+			$link_self = get_topic_rss_link($feed_id);
+			break;
+		
+		case 'profile':
+			if ( bb_get_option( 'mod_rewrite' ) === 'slugs' ) {
+				$user = bb_get_user_by_nicename( $feed_id );
+			} else {
+				$user = bb_get_user( $feed_id );
+			}
+			if ( !$user ) {
+				die();
+			}
+			if ( !$posts = get_user_favorites( $user->ID ) ) {
+				die();
+			}
+			$title = esc_html( sprintf( __( '%1$s &raquo; User Favorites: %2$s' ), bb_get_option( 'name' ), $user->user_login ) );
+			$link = bb_get_profile_link($feed_id);
+			$link_self = get_favorites_rss_link($feed_id);
+			break;
+		
+		case 'tag-topics':
+			if ( !$tag = bb_get_tag( $feed_id ) )
+				die();
+			if ( !$topics = get_tagged_topics( array( 'tag_id' => $tag->tag_id, 'page' => 0 ) ) )
+				die();
+			
+			$posts = array();
+			foreach ($topics as $topic) {
+				$posts[] = bb_get_first_post($topic->topic_id);
+			}
+			
+			$title = esc_html( sprintf( __( '%1$s &raquo; Tag: %2$s - Recent Topics' ), bb_get_option( 'name' ), bb_get_tag_name() ) );
+			$link = bb_get_tag_link($feed_id);
+			$link_self = bb_get_tag_topics_rss_link($feed_id);
+			break;
+		
+		case 'tag-posts':
+			if ( !$tag = bb_get_tag( $feed_id ) )
+				die();
+			if ( !$posts = get_tagged_topic_posts( array( 'tag_id' => $tag->tag_id, 'page' => 0 ) ) )
+				die();
+			$title = esc_html( sprintf( __( '%1$s &raquo; Tag: %2$s - Recent Posts' ), bb_get_option( 'name' ), bb_get_tag_name() ) );
+			$link = bb_get_tag_link($feed_id);
+			$link_self = bb_get_tag_posts_rss_link($feed_id);
+			break;
+		
+		case 'forum-topics':
+			if ( !$topics = get_latest_topics( $feed_id ) )
+				die();
+			
+			$posts = array();
+			foreach ($topics as $topic) {
+				$posts[] = bb_get_first_post($topic->topic_id);
+			}
+			
+			$title = esc_html( sprintf( __( '%1$s &raquo; Forum: %2$s - Recent Topics' ), bb_get_option( 'name' ), get_forum_name( $feed_id ) ) );
+			$link = get_forum_link($feed_id);
+			$link_self = bb_get_forum_topics_rss_link($feed_id);
+			break;
+		
+		case 'forum-posts':
+			if ( !$posts = bb_get_latest_forum_posts( $feed_id ) )
+				die();
+			$title = esc_html( sprintf( __( '%1$s &raquo; Forum: %2$s - Recent Posts' ), bb_get_option( 'name' ), get_forum_name( $feed_id ) ) );
+			$link = get_forum_link($feed_id);
+			$link_self = bb_get_forum_posts_rss_link($feed_id);
+			break;
+		
+		// Get just the first post from the latest topics
+		case 'all-topics':
+			if ( !$topics = get_latest_topics() )
+				die();
+			
+			$posts = array();
+			foreach ($topics as $topic) {
+				$posts[] = bb_get_first_post($topic->topic_id);
+			}
+			
+			$title = esc_html( sprintf( __( '%1$s &raquo; Recent Topics' ), bb_get_option( 'name' ) ) );
+			$link = bb_get_uri();
+			$link_self = bb_get_topics_rss_link();
+			break;
+		
+		// Get latest posts by default
+		case 'all-posts':
+		default:
+			if ( !$posts = bb_get_latest_posts( 35 ) )
+				die();
+			$title = esc_html( sprintf( __( '%1$s &raquo; Recent Posts' ), bb_get_option( 'name' ) ) );
+			$link = bb_get_uri();
+			$link_self = bb_get_posts_rss_link();
+			break;
+	}
+}
+
+bb_send_304( $posts[0]->post_time );
+
+if (!$description = esc_html( bb_get_option('description') )) {
+	$description = $title;
+}
+$title = apply_filters( 'bb_title_rss', $title, $feed );
+$description = apply_filters( 'bb_description_rss', $description, $feed );
+$posts = apply_filters( 'bb_posts_rss', $posts, $feed );
+$link_self = apply_filters( 'bb_link_self_rss', $link_self, $feed );
+
+bb_load_template( 'rss2.php', array('bb_db_override', 'title', 'description', 'link', 'link_self'), $feed );
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/search.php b/wp-content/plugins/buddypress/bp-forums/bbpress/search.php
new file mode 100644
index 0000000000000000000000000000000000000000..d455dd608164ea1d4a302bb3be21f473567886ad
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/search.php
@@ -0,0 +1,37 @@
+<?php
+require_once('./bb-load.php');
+
+if ( !$q = trim( @$_GET['search'] ) )
+	$q = trim( @$_GET['q'] );
+
+$bb_query_form = new BB_Query_Form;
+
+if ( $q = stripslashes( $q ) ) {
+	add_filter( 'bb_recent_search_fields',   create_function( '$f', 'return $f . ", MAX(post_time) AS post_time";' ) );
+	add_filter( 'bb_recent_search_group_by', create_function( '', 'return "t.topic_id";' ) );
+	$bb_query_form->BB_Query_Form( 'post', array(), array( 'per_page' => 5, 'post_status' => 0, 'topic_status' => 0, 'post_text' => $q, 'forum_id', 'tag', 'topic_author', 'post_author' ), 'bb_recent_search' );
+	$recent = $bb_query_form->results;
+
+	$bb_query_form->BB_Query_Form( 'topic', array( 'search' => $q ), array( 'post_status' => 0, 'topic_status' => 0, 'search', 'forum_id', 'tag', 'topic_author', 'post_author' ), 'bb_relevant_search' );
+	$relevant = $bb_query_form->results;
+
+	$q = $bb_query_form->get( 'search' );
+}
+
+do_action( 'do_search', $q );
+
+// Cache topics
+// NOT bbdb::prepared
+if ( $recent ) :
+	$topic_ids = array();
+	foreach ($recent as $bb_post) {
+		$topic_ids[] = (int) $bb_post->topic_id;
+	}
+	$topic_ids = join($topic_ids);
+	if ( $topics = $bbdb->get_results("SELECT * FROM $bbdb->topics WHERE topic_id IN ($topic_ids)") )
+		$topics = bb_append_meta( $topics, 'topic' );
+endif;
+
+bb_load_template( 'search.php', array('q', 'recent', 'relevant'), $q );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/statistics.php b/wp-content/plugins/buddypress/bp-forums/bbpress/statistics.php
new file mode 100644
index 0000000000000000000000000000000000000000..7b1a6052c1aa4f4c71c24c078b24da09d7498e54
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/statistics.php
@@ -0,0 +1,13 @@
+<?php
+
+require('./bb-load.php');
+
+require_once( BB_PATH . BB_INC . 'functions.bb-statistics.php' );
+
+$popular = get_popular_topics();
+
+$bb->static_title = __('Statistics');
+
+bb_load_template( 'stats.php', array('popular') );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/tag-add.php b/wp-content/plugins/buddypress/bp-forums/bbpress/tag-add.php
new file mode 100644
index 0000000000000000000000000000000000000000..d2c82d0c51e031753fdeb499623f8e7b7f137b70
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/tag-add.php
@@ -0,0 +1,25 @@
+<?php
+require('./bb-load.php');
+
+bb_auth('logged_in');
+
+if ( !bb_is_user_logged_in() )
+	bb_die(__('You need to be logged in to add a tag.'));
+
+$topic_id = (int) @$_POST['id' ];
+$page     = (int) @$_POST['page'];
+$tag      =       @$_POST['tag'];
+$tag      =       stripslashes( $tag );
+
+bb_check_admin_referer( 'add-tag_' . $topic_id );
+
+$topic = get_topic ( $topic_id );
+if ( !$topic )
+	bb_die(__('Topic not found.'));
+
+if ( bb_add_topic_tags( $topic_id, $tag ) )
+	wp_redirect( get_topic_link( $topic_id, $page ) );
+else
+	bb_die(__('The tag was not added.  Either the tag name was invalid or the topic is closed.'));
+exit;
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/tag-remove.php b/wp-content/plugins/buddypress/bp-forums/bbpress/tag-remove.php
new file mode 100644
index 0000000000000000000000000000000000000000..9135a217e164bf4408c5f7b117ccd784b185e9ef
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/tag-remove.php
@@ -0,0 +1,27 @@
+<?php
+require('./bb-load.php');
+
+bb_auth('logged_in');
+
+$tag_id = (int) @$_GET['tag'];
+$user_id = (int) @$_GET['user'];
+$topic_id = (int) @$_GET['topic'];
+
+bb_check_admin_referer( 'remove-tag_' . $tag_id . '|' . $topic_id );
+
+$tag    =  bb_get_tag ( $tag_id );
+$topic	=  get_topic ( $topic_id );
+$user	=  bb_get_user( $user_id );
+
+if ( !$tag || !$topic )
+	bb_die(__('Invalid tag or topic.'));
+
+if ( false !== bb_remove_topic_tag( $tag_id, $user_id, $topic_id ) ) {
+	if ( !$redirect = wp_get_referer() )
+		$redirect = get_topic_link( $topic_id );
+	bb_safe_redirect( $redirect );
+} else {
+	bb_die(__('The tag was not removed.'));
+}
+exit;
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/tags.php b/wp-content/plugins/buddypress/bp-forums/bbpress/tags.php
new file mode 100644
index 0000000000000000000000000000000000000000..5e349c2155797091889aec300cb5534a36991239
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/tags.php
@@ -0,0 +1,22 @@
+<?php
+require_once('./bb-load.php');
+
+bb_repermalink();
+
+// Temporary, refactor this!
+
+if ( !$tag && $tag_name )
+	bb_die(__('Tag not found'));
+
+if ( $tag_name && $tag ) :
+
+	if ( $topics = get_tagged_topics($tag->tag_id, $page) ) {
+		bb_cache_last_posts( $topics );
+	}
+
+	bb_load_template( 'tag-single.php', array('tag', 'tag_name', 'topics'), $tag->tag_id );
+else :
+
+	bb_load_template( 'tags.php' );
+endif;
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/topic.php b/wp-content/plugins/buddypress/bp-forums/bbpress/topic.php
new file mode 100644
index 0000000000000000000000000000000000000000..42d182f127e4ae67540f844fafe494cdb5e0631a
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/topic.php
@@ -0,0 +1,49 @@
+<?php
+require_once('./bb-load.php');
+$topic_id = 0;
+
+$view_deleted = false;
+if ( bb_current_user_can('browse_deleted') && 'all' == @$_GET['view'] ) {
+	add_filter('get_topic_where', 'bb_no_where');
+	$view_deleted = true;
+}
+
+bb_repermalink();
+
+if ( !$topic )
+	bb_die(__('Topic not found.'));
+
+if ( $view_deleted ) {
+	add_filter('get_thread_where', create_function('', 'return "p.topic_id = ' . $topic_id . '";'));
+	add_filter('get_thread_post_ids', create_function('', 'return "p.topic_id = ' . $topic_id . '";'));
+	add_filter('post_edit_uri', 'bb_make_link_view_all');
+}
+
+$bb_db_override = false;
+do_action( 'bb_topic.php_pre_db', $topic_id );
+
+if ( !$bb_db_override ) :
+	$posts = get_thread( $topic_id, $page );
+	$forum = bb_get_forum ( $topic->forum_id );
+
+	$tags  = bb_get_topic_tags ( $topic_id );
+	if ( $tags && $bb_current_id = bb_get_current_user_info( 'id' ) ) {
+		$user_tags  = bb_get_user_tags   ( $topic_id, $bb_current_id );
+		$other_tags = bb_get_other_tags  ( $topic_id, $bb_current_id );
+		$public_tags = bb_get_public_tags( $topic_id );
+	} elseif ( is_array($tags) ) {
+		$user_tags  = false;
+		$other_tags = bb_get_public_tags( $topic_id );
+		$public_tags =& $other_tags;
+	} else {
+		$user_tags = $other_tags = $public_tags = false;
+	}
+
+	$list_start = ($page - 1) * bb_get_option('page_topics') + 1;
+
+	bb_post_author_cache($posts);
+endif;
+
+bb_load_template( 'topic.php', array('bb_db_override', 'user_tags', 'other_tags', 'list_start'), $topic_id );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/view.php b/wp-content/plugins/buddypress/bp-forums/bbpress/view.php
new file mode 100644
index 0000000000000000000000000000000000000000..ea078c923f9693ac3568cc99d9af947be7c243f0
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/view.php
@@ -0,0 +1,28 @@
+<?php
+require_once('./bb-load.php');
+
+bb_repermalink();
+
+$view = bb_slug_sanitize($view);
+
+$sticky_count = $topic_count = 0;
+$stickies = $topics = $view_count = false;
+
+if ( isset($bb_views[$view]) ) {
+	if ( $bb_views[$view]['sticky'] ) {
+		$sticky_query = bb_view_query( $view, array('sticky' => '-no') ); // -no = yes
+		$stickies     = $sticky_query->results;
+		$sticky_count = $sticky_query->found_rows;
+	}
+	$topic_query = bb_view_query( $view, array('count' => true) );
+	$topics      = $topic_query->results;
+	$topic_count = $topic_query->found_rows;
+
+	$view_count = max($sticky_count, $topic_count);
+}
+
+do_action( 'bb_custom_view', $view, $page );
+
+bb_load_template( 'view.php', array('view_count', 'stickies'), $view );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bbpress/xmlrpc.php b/wp-content/plugins/buddypress/bp-forums/bbpress/xmlrpc.php
new file mode 100644
index 0000000000000000000000000000000000000000..6a205239f145a2fb11079b1d7752db5417bc3841
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bbpress/xmlrpc.php
@@ -0,0 +1,4087 @@
+<?php
+/**
+ * XML-RPC protocol support for bbPress
+ *
+ * @since 1.0
+ * @package bbPress
+ */
+
+
+
+/**
+ * Whether this is an XML-RPC Request
+ *
+ * @since 1.0
+ * @var bool
+ */
+define( 'XMLRPC_REQUEST', true );
+
+// Get rid of cookies sent by some browser-embedded clients
+$_COOKIE = array();
+
+// A bug in PHP < 5.2.2 makes $HTTP_RAW_POST_DATA not set by default
+if ( !isset( $HTTP_RAW_POST_DATA ) ) {
+	$HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
+}
+
+// Fix for mozBlog and other cases where '<?xml' isn't on the very first line
+if ( isset( $HTTP_RAW_POST_DATA ) ) {
+	$HTTP_RAW_POST_DATA = trim( $HTTP_RAW_POST_DATA );
+}
+
+// Load bbPress
+require_once( './bb-load.php' );
+
+
+
+// If the service discovery data is requested then return it and exit
+if ( isset( $_GET['rsd'] ) ) {
+	header( 'Content-Type: text/xml; charset=UTF-8', true );
+	echo '<?xml version="1.0" encoding="UTF-8"?'.'>' . "\n";
+	echo '<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">' . "\n";
+	echo '	<service>' . "\n";
+	echo '		<engineName>bbPress</engineName>' . "\n";
+	echo '		<engineLink>http://bbpress.org/</engineLink>' . "\n";
+	echo '		<homePageLink>' . bb_get_uri() . '</homePageLink>' . "\n";
+	echo '		<apis>' . "\n";
+	echo '			<api name="bbPress" blogID="1" preferred="true" apiLink="' . bb_get_uri( 'xmlrpc.php' ) . '" />' . "\n";
+	echo '		</apis>' . "\n";
+	echo '	</service>' . "\n";
+	echo '</rsd>' . "\n";
+	exit;
+}
+
+
+
+// Load the XML-RPC server/client classes
+require_once( BACKPRESS_PATH . '/class.ixr.php' );
+
+
+
+/**
+ * XML-RPC server class to allow for remote publishing
+ *
+ * @since 1.0
+ * @package bbPress
+ * @subpackage Publishing
+ * @uses class IXR_Server
+ */
+class BB_XMLRPC_Server extends IXR_Server
+{
+	/**
+	 * Stores the last error generated by the class
+	 *
+	 * @since 1.0
+	 * @var object|boolean An instance of the IXR_Error class or false if no error exists
+	 */
+	var $error = false;
+
+	/**
+	 * Site options which can be manipulated using XML-RPC
+	 *
+	 * @since 1.0
+	 * @var array
+	 */
+	var $site_options = array();
+
+	/**
+	 * Whether read-only methods require authentication
+	 *
+	 * @since 1.0
+	 * @var boolean
+	 **/
+	var $auth_readonly = false;
+
+	/**
+	 * Whether user switching is allowed
+	 *
+	 * @since 1.0
+	 * @var boolean
+	 **/
+	var $allow_user_switching = false;
+
+	/**
+	 * Initialises the XML-RPC server
+	 *
+	 * @since 1.0
+	 * @return void
+	 */
+	function BB_XMLRPC_Server()
+	{
+		// bbPress publishing API
+		if ( bb_get_option( 'enable_xmlrpc' ) ) {
+			$this->methods = array(
+				// - Demo
+				'demo.sayHello'         => 'this:sayHello',
+				'demo.addTwoNumbers'    => 'this:addTwoNumbers',
+				// - Forums
+				'bb.getForumCount'      => 'this:bb_getForumCount',
+				'bb.getForums'          => 'this:bb_getForums',
+				'bb.getForum'           => 'this:bb_getForum',
+				'bb.newForum'           => 'this:bb_newForum',
+				'bb.editForum'          => 'this:bb_editForum',
+				'bb.deleteForum'        => 'this:bb_deleteForum',
+				// - Topics
+				'bb.getTopicCount'      => 'this:bb_getTopicCount',
+				'bb.getTopics'          => 'this:bb_getTopics',
+				'bb.getTopic'           => 'this:bb_getTopic',
+				'bb.newTopic'           => 'this:bb_newTopic',
+				'bb.editTopic'          => 'this:bb_editTopic',
+				'bb.deleteTopic'        => 'this:bb_deleteTopic',        // Also undeletes
+				'bb.moveTopic'          => 'this:bb_moveTopic',
+				'bb.stickTopic'         => 'this:bb_stickTopic',         // Also unsticks
+				'bb.closeTopic'         => 'this:bb_closeTopic',         // Also opens
+				'bb.getTopicStatusList' => 'this:bb_getTopicStatusList',
+				// - Posts (replies)
+				'bb.getPostCount'      => 'this:bb_getPostCount',
+				'bb.getPosts'          => 'this:bb_getPosts',
+				'bb.getPost'           => 'this:bb_getPost',
+				'bb.newPost'           => 'this:bb_newPost',
+				'bb.editPost'          => 'this:bb_editPost',
+				'bb.deletePost'        => 'this:bb_deletePost',          // Also undeletes
+				'bb.getPostStatusList' => 'this:bb_getPostStatusList',
+				// - Topic Tags
+				'bb.getHotTopicTags'   => 'this:bb_getHotTopicTags',
+				'bb.getTopicTagCount'  => 'this:bb_getTopicTagCount',
+				'bb.getTopicTags'      => 'this:bb_getTopicTags',
+				'bb.getTopicTag'       => 'this:bb_getTopicTag',
+				'bb.addTopicTags'      => 'this:bb_addTopicTags',
+				'bb.removeTopicTags'   => 'this:bb_removeTopicTags',
+				'bb.renameTopicTag'    => 'this:bb_renameTopicTag',
+				'bb.mergeTopicTags'    => 'this:bb_mergeTopicTags',
+				'bb.destroyTopicTag'   => 'this:bb_destroyTopicTag',
+				// - Options
+				'bb.getOptions'        => 'this:bb_getOptions',
+				'bb.setOptions'        => 'this:bb_setOptions'
+			);
+		}
+
+		// Pingback
+		if ( bb_get_option( 'enable_pingback' ) ) {
+			$this->methods = array_merge( $this->methods, array(
+				'pingback.ping' => 'this:pingback_ping',
+				'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks'
+			) );
+		}
+
+		// Tells read-only methods whether they require authentication or not
+		$this->auth_readonly = apply_filters( 'bb_xmlrpc_auth_readonly', $this->auth_readonly );
+
+		// Whether or not to allow user switching
+		$this->allow_user_switching = bb_get_option( 'bb_xmlrpc_allow_user_switching' );
+
+		$this->initialise_site_option_info();
+		$this->methods = apply_filters( 'bb_xmlrpc_methods', $this->methods );
+		$this->IXR_Server( $this->methods );
+	}
+
+
+
+	/**
+	 * Utility methods
+	 */
+
+	/**
+	 * Checks the user credentials supplied in the request to make sure they are valid
+	 *
+	 * @since 1.0
+	 * @return integer|boolean The user id if the user is valid, otherwise false
+	 * @param string $user_login The users login
+	 * @param string $user_pass The users password in plain text
+	 * @param string $capability The capability to check (optional)
+	 * @param string $message The message to pass back in the error if the capability check fails (optional)
+	 */
+	function authenticate( $user_login, $user_pass, $capability = 'read', $message = false )
+	{
+		if ( is_array( $user_login ) ) {
+			$auth_user_login = (string) $user_login[0];
+			$switch_user_login = (string) $user_login[1];
+		} else {
+			$auth_user_login = (string) $user_login;
+			$switch_user_login = false;
+		}
+		
+		// Check the login
+		$user = bb_check_login( $auth_user_login, $user_pass );
+		if ( !$user || is_wp_error( $user ) ) {
+			$this->error = new IXR_Error( 403, __( 'Authentication failed.' ) );
+			return false;
+		}
+
+		// Set the current user
+		$user = bb_set_current_user( $user->ID );
+
+		// Make sure they are allowed to do this
+		if ( !bb_current_user_can( $capability ) ) {
+			if ( !$message ) {
+				$message = __( 'You do not have permission to read this.' );
+			}
+			$this->error = new IXR_Error( 403, $message );
+			return false;
+		}
+
+		// Switch the user if requested and allowed
+		if ( $switch_user_login && $this->allow_user_switching && bb_current_user_can( 'edit_users' ) ) {
+			$user = $this->switch_user( $switch_user_login, $capability, $message );
+		}
+
+		return $user;
+	}
+
+	/**
+	 * Switches the currently active user for incognito actions
+	 *
+	 * @since 1.0
+	 * @return integer|boolean The user id if the user is valid, otherwise false
+	 * @param string $user_login The users login
+	 * @param string $capability The capability to check (optional)
+	 * @param string $message The message to pass back in the error if the capability check fails (optional)
+	 */
+	function switch_user( $user_login, $capability = 'read', $message = false )
+	{
+		// Just get the user, authentication has already been established by the 
+		$user = bb_get_user( $user_login, array( 'by' => 'login' ) );
+		if ( !$user || is_wp_error( $user ) ) {
+			$this->error = new IXR_Error( 400, __( 'User switching failed, the requested user does not exist.' ) );
+			return false;
+		}
+
+		// Set the current user
+		$user = bb_set_current_user( $user->ID );
+
+		// Make sure they are allowed to do this
+		if ( !bb_current_user_can( $capability ) ) {
+			if ( !$message ) {
+				$message = __( 'You do not have permission to read this.' );
+			}
+			$this->error = new IXR_Error( 403, $message );
+			return false;
+		}
+
+		return $user;
+	}
+
+	/**
+	 * Sanitises data from XML-RPC request parameters
+	 *
+	 * @since 1.0
+	 * @return mixed The sanitised variable, should come back with the same type
+	 * @param $array mixed The variable to be sanitised
+	 * @uses $bbdb BackPress database class instance
+	 */
+	function escape( &$array )
+	{
+		global $bbdb;
+
+		if ( !is_array( $array ) ) {
+			// Escape it
+			$array = $bbdb->escape( $array );
+		} elseif ( count( $array ) ) {
+			foreach ( (array) $array as $k => $v ) {
+				if ( is_array( $v ) ) {
+					// Recursively sanitize arrays
+					$this->escape( $array[$k] );
+				} elseif ( is_object( $v ) ) {
+					// Don't sanitise objects - shouldn't happen anyway
+				} else {
+					// Escape it
+					$array[$k] = $bbdb->escape( $v );
+				}
+			}
+		}
+
+		return $array;
+	}
+
+	/**
+	 * Prepares forum data for return in an XML-RPC object
+	 *
+	 * @since 1.0
+	 * @return array The prepared forum data
+	 * @param array|object The unprepared forum data
+	 **/
+	function prepare_forum( $forum )
+	{
+		// Cast to an array
+		$_forum = (array) $forum;
+		// Set the URI
+		$_forum['forum_uri'] = get_forum_link( $_forum['forum_id'] );
+		// Give this a definite value
+		if ( !isset( $_forum['forum_is_category'] ) ) {
+			$_forum['forum_is_category'] = 0;
+		}
+		// Allow plugins to modify the data
+		return apply_filters( 'bb_xmlrpc_prepare_forum', $_forum, (array) $forum );
+	}
+
+	/**
+	 * Prepares topic data for return in an XML-RPC object
+	 *
+	 * @since 1.0
+	 * @return array The prepared topic data
+	 * @param array|object The unprepared topic data
+	 **/
+	function prepare_topic( $topic )
+	{
+		// Cast to an array
+		$_topic = (array) $topic;
+		// Set the URI
+		$_topic['topic_uri'] = get_topic_link( $_topic['topic_id'] );
+		// Set readable times
+		$_topic['topic_start_time_since'] = bb_since( $_topic['topic_start_time'] );
+		$_topic['topic_time_since'] = bb_since( $_topic['topic_time'] );
+		// Set the display names
+		$_topic['topic_poster_display_name'] = get_user_display_name( $_topic['topic_poster'] );
+		$_topic['topic_last_poster_display_name'] = get_user_display_name( $_topic['topic_last_poster'] );
+		// Remove some sensitive user ids
+		unset(
+			$_topic['topic_poster'],
+			$_topic['topic_last_poster']
+		);
+		// Allow plugins to modify the data
+		return apply_filters( 'bb_xmlrpc_prepare_topic', $_topic, (array) $topic );
+	}
+
+	/**
+	 * Prepares post data for return in an XML-RPC object
+	 *
+	 * @since 1.0
+	 * @return array The prepared post data
+	 * @param array|object The unprepared post data
+	 **/
+	function prepare_post( $post )
+	{
+		// Cast to an array
+		$_post = (array) $post;
+		// Set the URI
+		$_post['post_uri'] = get_post_link( $_post['post_id'] );
+		// Set readable times
+		$_post['post_time_since'] = bb_since( $_post['post_time'] );
+		// Set the display names
+		$_post['poster_display_name'] = get_user_display_name( $_post['poster_id'] );
+		// Remove some sensitive data
+		unset(
+			$_post['poster_id'],
+			$_post['poster_ip'],
+			$_post['pingback_queued']
+		);
+		// Allow plugins to modify the data
+		return apply_filters( 'bb_xmlrpc_prepare_post', $_post, (array) $post );
+	}
+
+	/**
+	 * Prepares topic tag data for return in an XML-RPC object
+	 *
+	 * @since 1.0
+	 * @return array The prepared topic tag data
+	 * @param array|object The unprepared topic tag data
+	 **/
+	function prepare_topic_tag( $tag )
+	{
+		// Cast to an array
+		$_tag = (array) $tag;
+		// Set the URI
+		$_tag['topic_tag_uri'] = bb_get_tag_link( $tag );
+		// Consistent nomenclature
+		$_tag['topic_tag_name'] = (string) $_tag['name'];
+		$_tag['topic_tag_slug'] = (string) $_tag['slug'];
+		$_tag['topic_tag_count'] = (int) $_tag['count'];
+		// Remove some sensitive data
+		unset(
+			$_tag['object_id'],
+			$_tag['name'],
+			$_tag['slug'],
+			$_tag['count'],
+			$_tag['term_id'],
+			$_tag['term_group'],
+			$_tag['term_taxonomy_id'],
+			$_tag['taxonomy'],
+			$_tag['description'],
+			$_tag['parent'],
+			$_tag['count'],
+			$_tag['user_id'],
+			$_tag['tag_id'],
+			$_tag['tag'],
+			$_tag['raw_tag'],
+			$_tag['tag_count']
+		);
+		// Allow plugins to modify the data
+		return apply_filters( 'bb_xmlrpc_prepare_topic_tag', $_tag, (array) $tag );
+	}
+
+
+
+	/**
+	 * bbPress publishing API - Demo XML-RPC methods
+	 */
+
+	/**
+	 * Hello world demo function for XML-RPC
+	 *
+	 * @since 1.0
+	 * @return string The phrase 'Hello!'
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 *
+	 * XML-RPC request to get a greeting
+	 * <methodCall>
+	 *     <methodName>demo.sayHello</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function sayHello( $args )
+	{
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		if ( $this->auth_readonly && !$this->authenticate( $username, $password ) ) {
+			return $this->error;
+		}
+
+		return 'Hello!';
+	}
+
+	/**
+	 * Adds two numbers together as a demo of XML-RPC
+	 *
+	 * @since 1.0
+	 * @return integer The sum of the two supplied numbers
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer $args[2] The first number to be added
+	 * @param integer $args[3] The second number to be added
+	 *
+	 * XML-RPC request to get the sum of two numbers
+	 * <methodCall>
+	 *     <methodName>demo.addTwoNumbers</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>5</int></value></param>
+	 *         <param><value><int>102</int></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function addTwoNumbers( $args )
+	{
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		if ( $this->auth_readonly && !$this->authenticate( $username, $password ) ) {
+			return $this->error;
+		}
+
+		$number1 = (int) $args[2];
+		$number2 = (int) $args[3];
+
+		return ( $number1 + $number2 );
+	}
+
+
+
+	/**
+	 * bbPress publishing API - Forum XML-RPC methods
+	 */
+
+	/**
+	 * Returns a numerical count of forums
+	 *
+	 * @since 1.0
+	 * @return integer|object The number of forums when successfully executed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer|string $args[2] The parent forum's id or slug (optional)
+	 * @param integer $args[3] The depth of child forums to retrieve (optional)
+	 *
+	 * XML-RPC request to get a count of all forums in the bbPress instance
+	 * <methodCall>
+	 *     <methodName>bb.getForumCount</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to get a count of all child forums in the forum with id number 34
+	 * <methodCall>
+	 *     <methodName>bb.getForumCount</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>34</int></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to get a count of all child forums in the forum with slug "first-forum"
+	 * <methodCall>
+	 *     <methodName>bb.getForumCount</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>first-forum</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to get a count of all child forums in the forum with id number 34 no more than 2 forums deep in the hierarchy
+	 * <methodCall>
+	 *     <methodName>bb.getForumCount</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>34</int></value></param>
+	 *         <param><value><int>2</int></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_getForumCount( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.getForumCount' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		if ( $this->auth_readonly ) {
+			$user = $this->authenticate( $username, $password );
+		}
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.getForumCount' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Setup an array to store arguments to pass to bb_get_forums() function
+		$get_forums_args = array(
+			'child_of' => 0,
+			'hierarchical' => 0,
+			'depth' => 0
+		);
+
+		// Can be numeric id or slug
+		$forum_id = isset( $args[2] ) ? $args[2] : false;
+
+		if ( $forum_id ) {
+			// Check for bad data
+			if ( !is_string( $forum_id ) && !is_integer( $forum_id ) ) {
+				$this->error = new IXR_Error( 400, __( 'The forum id is invalid.' ) );
+				return $this->error;
+			}
+			// Check the requested forum exists
+			if ( !$forum = bb_get_forum( $forum_id ) ) {
+				$this->error = new IXR_Error( 400, __( 'The forum does not exist.' ) );
+				return $this->error;
+			}
+			// Add the specific forum to the arguments
+			$get_forums_args['child_of'] = (int) $forum->forum_id;
+		}
+
+		// Can only be an integer
+		$depth = (int) $args[3];
+
+		if ( $depth > 0 ) {
+			// Add the depth to traverse to the arguments
+			$get_forums_args['depth'] = $depth;
+			// Only make it hierarchical if the depth > 1
+			if ( $depth > 1 ) {
+				$get_forums_args['hierarchical'] = 1;
+			}
+		}
+
+		// Get the forums. Return 0 when no forums exist
+		if ( !$forums = bb_get_forums( $get_forums_args ) ) {
+			$count = 0;
+		} else {
+			$count = count( $forums );
+		}
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.getForumCount' );
+
+		// Return a count of the forums
+		return $count;
+	}
+
+	/**
+	 * Returns details of multiple forums
+	 *
+	 * @since 1.0
+	 * @return array|object An array containing details of all returned forums when successfully executed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer|string $args[2] The parent forum's id or slug (optional)
+	 * @param integer $args[3] The depth of child forums to retrieve (optional)
+	 *
+	 * XML-RPC request to get all forums in the bbPress instance
+	 * <methodCall>
+	 *     <methodName>bb.getForums</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to get all child forums in the forum with id number 34
+	 * <methodCall>
+	 *     <methodName>bb.getForums</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>34</int></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to get all child forums in the forum with slug "first-forum"
+	 * <methodCall>
+	 *     <methodName>bb.getForums</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>first-forum</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to get all child forums in the forum with id number 34 no more than 2 forums deep in the hierarchy
+	 * <methodCall>
+	 *     <methodName>bb.getForums</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>34</int></value></param>
+	 *         <param><value><int>2</int></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_getForums( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.getForums' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		if ( $this->auth_readonly ) {
+			$user = $this->authenticate( $username, $password );
+		}
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.getForums' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Setup an array to store arguments to pass to bb_get_forums() function
+		$get_forums_args = array(
+			'child_of' => 0,
+			'hierarchical' => 0,
+			'depth' => 0
+		);
+
+		// Can be numeric id or slug
+		$forum_id = isset( $args[2] ) ? $args[2] : false;
+
+		if ( $forum_id ) {
+			// Check for bad data
+			if ( !is_string( $forum_id ) && !is_integer( $forum_id ) ) {
+				$this->error = new IXR_Error( 400, __( 'The forum id is invalid.' ) );
+				return $this->error;
+			}
+			// First check the requested forum exists
+			if ( !$forum = bb_get_forum( $forum_id ) ) {
+				$this->error = new IXR_Error( 400, __( 'The forum does not exist.' ) );
+				return $this->error;
+			}
+			// Add the specific forum to the arguments
+			$get_forums_args['child_of'] = (int) $forum->forum_id;
+		}
+
+		// Can only be an integer
+		$depth = (int) $args[3];
+
+		if ( $depth > 0 ) {
+			// Add the depth to traverse to to the arguments
+			$get_forums_args['depth'] = $depth;
+			// Only make it hierarchical if the depth > 1
+			if ( $depth > 1 ) {
+				$get_forums_args['hierarchical'] = 1;
+			}
+		}
+
+		// Get the forums. Return an error when no forums exist
+		if ( !$forums = bb_get_forums( $get_forums_args ) ) {
+			$this->error = new IXR_Error( 404, __( 'No forums found.' ) );
+			return $this->error;
+		}
+
+		// Only include "safe" data in the array
+		$_forums = array();
+		foreach ( $forums as $forum ) {
+			$_forums[] = $this->prepare_forum( $forum );
+		}
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.getForums' );
+
+		// Return the forums
+		return $_forums;
+	}
+
+	/**
+	 * Returns details of a forum
+	 *
+	 * @since 1.0
+	 * @return array|object An array containing details of the returned forum when successfully executed or an IXR_Error object on failure
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer|string $args[2] The forum's id or slug
+	 *
+	 * XML-RPC request to get the forum with id number 34
+	 * <methodCall>
+	 *     <methodName>bb.getForum</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>34</int></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to get the forum with slug "first-forum"
+	 * <methodCall>
+	 *     <methodName>bb.getForum</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>first-forum</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_getForum( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.getForum' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		if ( $this->auth_readonly ) {
+			$user = $this->authenticate( $username, $password );
+		}
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.getForum' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can be numeric id or slug
+		$forum_id = isset( $args[2] ) ? $args[2] : false;
+
+		// Check for bad data
+		if ( !$forum_id || ( !is_string( $forum_id ) && !is_integer( $forum_id ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The forum id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested forum exists
+		if ( !$forum = bb_get_forum( $forum_id ) ) {
+			$this->error = new IXR_Error( 404, __( 'No forum found.' ) );
+			return $this->error;
+		}
+
+		// Only include "safe" data in the array
+		$forum = $this->prepare_forum( $forum );
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.getForum' );
+
+		// Return the forums
+		return $forum;
+	}
+
+	/**
+	 * Creates a new forum
+	 *
+	 * @since 1.0
+	 * @return array|object The forum data when successfully created or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param array $args[2] The values for the various settings in the new forum
+	 * @param string $args[2]['name'] The name of the forum
+	 * @param string $args[2]['description'] The description of the forum (optional)
+	 * @param integer|string $args[2]['parent_id'] The unique id of the parent forum for this forum (optional)
+	 * @param integer $args[2]['order'] The position of the forum in the forum list (optional)
+	 * @param integer $args[2]['is_category'] Whether the forum is simply a container category (optional)
+	 *
+	 * XML-RPC request to create a new sub-forum called "A new forum" inside the parent forum with id 2
+	 * <methodCall>
+	 *     <methodName>bb.newForum</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><struct>
+	 *             <member>
+	 *                 <name>name</name>
+	 *                 <value><string>A new forum</string></value>
+	 *             </member>
+	 *             <member>
+	 *                 <name>parent_id</name>
+	 *                 <value><integer>2</integer></value>
+	 *             </member>
+	 *         </struct></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_newForum( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.newForum' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'manage_forums', __( 'You do not have permission to manage forums.' ) );
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.newForum' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Make sure there is something for us to do
+		if ( !$args[2] || !is_array( $args[2] ) || !count( $args[2] ) ) {
+			$this->error = new IXR_Error( 400, __( 'The forum data is invalid.' ) );
+			return $this->error;
+		}
+
+		$structure = (array) $args[2];
+
+		// Minimum requirement is a name for the new forum
+		if ( !isset( $structure['name'] ) || !$structure['name'] ) {
+			$this->error = new IXR_Error( 400, __( 'The forum name is invalid.' ) );
+			return $this->error;
+		}
+
+		// Inject structure into an array suitable for bb_new_forum()
+		$bb_new_forum_args = array(
+			'forum_name' => (string) $structure['name'],
+			'forum_desc' => (string) $structure['description'],
+			'forum_parent' => (int) $structure['parent_id'],
+			'forum_order' => (int) $structure['order'],
+			'forum_is_category' => (int) $structure['is_category']
+		);
+
+		// Remove empty settings so that changes to the defaults in bb_new_forum() are honoured
+		$bb_new_forum_args = array_filter( $bb_new_forum_args );
+
+		// Leave the require until the very end
+		require_once( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );
+
+		// Create the forum
+		if ( !$forum_id = (int) bb_new_forum( $bb_new_forum_args ) ) {
+			$this->error = new IXR_Error( 500, __( 'The forum could not be created.' ) );
+			return $this->error;
+		}
+
+		// Only include "safe" data in the array
+		$forum = $this->prepare_forum( bb_get_forum( $forum_id ) );
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.newForum' );
+
+		return $forum;
+	}
+
+	/**
+	 * Edits an existing forum
+	 *
+	 * @since 1.0
+	 * @return array|object The forum data when successfully edited or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param array $args[2] The values for the various settings in the new forum, at least one must be specified
+	 * @param integer|string $args[2]['forum_id'] The unique id of the forum to be edited
+	 * @param string $args[2]['name'] The name of the forum (optional)
+	 * @param string $args[2]['slug'] The slug for the forum (optional)
+	 * @param string $args[2]['description'] The description of the forum (optional)
+	 * @param integer $args[2]['parent_id'] The unique id of the parent forum for this forum (optional)
+	 * @param integer $args[2]['order'] The position of the forum in the forum list (optional)
+	 * @param integer $args[2]['is_category'] Whether the forum is simply a container category (optional)
+	 *
+	 * XML-RPC request to edit a forum with id 11, changing the description
+	 * <methodCall>
+	 *     <methodName>bb.editForum</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><struct>
+	 *             <member>
+	 *                 <name>forum_id</name>
+	 *                 <value><integer>11</integer></value>
+	 *             </member>
+	 *             <member>
+	 *                 <name>description</name>
+	 *                 <value><string>This is a great forum for all sorts of reasons.</string></value>
+	 *             </member>
+	 *         </struct></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_editForum( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.editForum' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'manage_forums', __( 'You do not have permission to manage forums.' ) );
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.editForum' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Make sure there is something for us to do
+		if ( !$args[2] || !is_array( $args[2] ) || !count( $args[2] ) ) {
+			$this->error = new IXR_Error( 400, __( 'The forum data is invalid.' ) );
+			return $this->error;
+		}
+
+		$structure = (array) $args[2];
+
+		// Can be numeric id or slug
+		$forum_id = isset( $structure['forum_id'] ) ? $structure['forum_id'] : false;
+
+		// Check for bad data
+		if ( !$forum_id || ( !is_string( $forum_id ) && !is_integer( $forum_id ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The forum id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested forum exists
+		if ( !$forum = bb_get_forum( $forum_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No forum found.' ) );
+			return $this->error;
+		}
+
+		// Cast the forum object as an array
+		$forum = (array) $forum;
+		// The forum id may have been a slug, so make sure it's an integer here
+		$forum_id = (int) $forum['forum_id'];
+
+		// Remove some unneeded indexes
+		unset( $forum['topics'] );
+		unset( $forum['posts'] );
+
+		// Add one if it isn't there
+		if ( !isset( $forum['forum_is_category'] ) ) {
+			$forum['forum_is_category'] = 0;
+		}
+
+		// Validate the name for the forum
+		if ( isset( $structure['name'] ) && !$structure['name'] ) {
+			$this->error = new IXR_Error( 400, __( 'The forum name is invalid.' ) );
+			return $this->error;
+		}
+
+		// Inject structure into an array suitable for bb_update_forum()
+		$bb_update_forum_args = array(
+			'forum_name' => $structure['name']
+		);
+
+		// Slug cannot be blank
+		if ( isset( $structure['slug'] ) && $structure['slug'] !== '' ) {
+			$bb_update_forum_args['forum_slug'] = $structure['slug'];
+		}
+
+		// Description can be nothing
+		if ( isset( $structure['description'] ) ) {
+			$bb_update_forum_args['forum_desc'] = $structure['description'];
+		}
+
+		// Parent forum ID must be an integer and it can be 0
+		if ( isset( $structure['parent_id'] ) && is_integer( $structure['parent_id'] ) ) {
+			$bb_update_forum_args['forum_parent'] = $structure['parent_id'];
+		}
+
+		// Order must be an integer and it can be 0
+		if ( isset( $structure['order'] ) && is_integer( $structure['order'] ) ) {
+			$bb_update_forum_args['forum_order'] = $structure['order'];
+		}
+
+		// Category flag must be an integer and it can be 0
+		if ( isset( $structure['is_category'] ) && is_integer( $structure['is_category'] ) ) {
+			$bb_update_forum_args['forum_is_category'] = $structure['is_category'];
+		}
+
+		// Merge the changes into the existing data for the forum
+		$bb_update_forum_args = wp_parse_args( $bb_update_forum_args, $forum );
+
+		// Leave the require until the very end
+		require_once( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );
+
+		// Update the forum
+		if ( !bb_update_forum( $bb_update_forum_args ) ) {
+			$this->error = new IXR_Error( 500, __( 'The forum could not be edited.' ) );
+			return $this->error;
+		}
+
+		// Only include "safe" data in the array
+		$forum = $this->prepare_forum( bb_get_forum( $forum_id ) );
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.editForum' );
+
+		return $forum;
+	}
+
+	/**
+	 * Deletes a forum
+	 *
+	 * @since 1.0
+	 * @return integer|object 1 when successfully deleted or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer|string $args[2] The unique id of the forum to be deleted
+	 *
+	 * XML-RPC request to delete a forum with the slug "naughty-forum"
+	 * <methodCall>
+	 *     <methodName>bb.deleteForum</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>naughty-forum</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_deleteForum( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.deleteForum' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'delete_forums', __( 'You do not have permission to delete forums.' ) );
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.deleteForum' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can be numeric id or slug
+		$forum_id = isset( $args[2] ) ? $args[2] : false;
+
+		// Check for bad data
+		if ( !$forum_id || ( !is_string( $forum_id ) && !is_integer( $forum_id ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The forum id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested forum exists
+		if ( !$forum = bb_get_forum( $forum_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No forum found.' ) );
+			return $this->error;
+		}
+
+		// Cast the forum object as an array
+		$forum = (array) $forum;
+		// The forum id may have been a slug, so make sure it's an integer here
+		$forum_id = (int) $forum['forum_id'];
+
+		// Make sure they are allowed to delete this forum specifically
+		if ( !bb_current_user_can( 'delete_forum', $forum_id ) ) {
+			$this->error = new IXR_Error( 403, __( 'You do not have permission to delete this forum.' ) );
+			return $this->error;
+		}
+
+		// Leave the require until the very end
+		require_once( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );
+
+		// Delete the forum
+		if ( !bb_delete_forum( $forum_id ) ) {
+			$this->error = new IXR_Error( 500, __( 'The forum could not be deleted.' ) );
+			return $this->error;
+		}
+
+		$result = 1;
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.deleteForum' );
+
+		return $result;
+	}
+
+
+
+	/**
+	 * bbPress publishing API - Topic XML-RPC methods
+	 */
+
+	/**
+	 * Returns a numerical count of topics
+	 *
+	 * @since 1.0
+	 * @return integer|object The number of topics when successfully executed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer|string $args[2] The forum id or slug (optional)
+	 *
+	 * XML-RPC request to get a count of all topics in the bbPress instance
+	 * <methodCall>
+	 *     <methodName>bb.getTopicCount</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to get a count of all topics in the forum with id number 34
+	 * <methodCall>
+	 *     <methodName>bb.getTopicCount</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>34</int></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to get a count of all topics in the forum with slug "first-forum"
+	 * <methodCall>
+	 *     <methodName>bb.getTopicCount</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>first-forum</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_getTopicCount( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.getTopicCount' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		if ( $this->auth_readonly ) {
+			$user = $this->authenticate( $username, $password );
+		}
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.getTopicCount' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can be numeric id or slug
+		if ( isset( $args[2] ) && $forum_id = $args[2] ) {
+			// Check for bad data
+			if ( !is_string( $forum_id ) && !is_integer( $forum_id ) ) {
+				$this->error = new IXR_Error( 400, __( 'The forum id is invalid.' ) );
+				return $this->error;
+			}
+			// Check the requested forum exists
+			if ( !$forum = bb_get_forum( $forum_id ) ) {
+				$this->error = new IXR_Error( 400, __( 'The forum does not exist.' ) );
+				return $this->error;
+			}
+
+			// OK, let's trust the count in the forum table
+			$count = (int) $forum->topics;
+		} else {
+			// Get all forums
+			$forums = bb_get_forums();
+	
+			// Return an error when no forums exist
+			if ( !$forums ) {
+				$this->error = new IXR_Error( 400, __( 'No forums found.' ) );
+				return $this->error;
+			}
+
+			// Count the topics
+			$count = 0;
+			foreach ( $forums as $forum ) {
+				$count += (int) $forum->topics;
+			}
+		}
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.getTopicCount' );
+
+		// Return the count of topics
+		return $count;
+	}
+
+	/**
+	 * Returns details of the latest topics
+	 *
+	 * @since 1.0
+	 * @return array|object The topics when successfully executed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer|string $args[2] The forum id or slug (optional)
+	 * @param integer $args[3] The number of topics to return (optional)
+	 * @param integer $args[4] The number of the page to return (optional)
+	 *
+	 * XML-RPC request to get all topics in the bbPress instance
+	 * <methodCall>
+	 *     <methodName>bb.getTopics</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to get all topics in the forum with id number 34
+	 * <methodCall>
+	 *     <methodName>bb.getTopics</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>34</int></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to get topics 6 to 10 in the forum with slug "first-forum"
+	 * <methodCall>
+	 *     <methodName>bb.getTopics</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>first-forum</string></value></param>
+	 *         <param><value><int>5</int></value></param>
+	 *         <param><value><int>2</int></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_getTopics( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.getTopics' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		if ( $this->auth_readonly ) {
+			$user = $this->authenticate( $username, $password );
+		}
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.getTopics' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Setup an array to store arguments to pass to get_topics() function
+		$get_topics_args = array(
+			'forum' => false,
+			'number' => false,
+			'page' => false
+		);
+
+		// Can be numeric id or slug
+		if ( isset( $args[2] ) && $forum_id = $args[2] ) {
+			// Check for bad data
+			if ( !is_string( $forum_id ) && !is_integer( $forum_id ) ) {
+				$this->error = new IXR_Error( 400, __( 'The forum id is invalid.' ) );
+				return $this->error;
+			}
+			// Check the requested forum exists
+			if ( !$forum = bb_get_forum( $forum_id ) ) {
+				$this->error = new IXR_Error( 400, __( 'The forum does not exist.' ) );
+				return $this->error;
+			}
+
+			// The forum id may have been a slug, so make sure it's an integer here
+			$get_topics_args['forum'] = (int) $forum->forum_id;
+		}
+
+		// Can only be an integer
+		if ( isset( $args[3] ) && $number = (int) $args[3] ) {
+			$get_topics_args['number'] = $number;
+		}
+
+		// Can only be an integer
+		if ( isset( $args[4] ) && $page = (int) $args[4] ) {
+			$get_topics_args['page'] = $page;
+		}
+
+		// Get the topics
+		if ( !$topics = get_latest_topics( $get_topics_args ) ) {
+			$this->error = new IXR_Error( 400, __( 'No topics found.' ) );
+			return $this->error;
+		}
+
+		// Only include "safe" data in the array
+		$_topics = array();
+		foreach ( $topics as $topic ) {
+			$_topics[] = $this->prepare_topic( $topic );
+		}
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.getTopics' );
+
+		// Return the topics
+		return $_topics;
+	}
+
+	/**
+	 * Returns details of a topic
+	 *
+	 * @since 1.0
+	 * @return array|object An array containing details of the returned topic when successfully executed or an IXR_Error object on failure
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer|string $args[2] The topic's id or slug
+	 *
+	 * XML-RPC request to get the topic with id number 105
+	 * <methodCall>
+	 *     <methodName>bb.getTopic</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>105</int></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to get the topic with slug "cheesy-biscuits"
+	 * <methodCall>
+	 *     <methodName>bb.getTopic</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>cheesy-biscuits</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_getTopic( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.getTopic' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		if ( $this->auth_readonly ) {
+			$user = $this->authenticate( $username, $password );
+		}
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.getTopic' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can be numeric id or slug
+		$topic_id = isset( $args[2] ) ? $args[2] : false;
+
+		// Check for bad data
+		if ( !$topic_id || ( !is_string( $topic_id ) && !is_integer( $topic_id ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The topic id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested topic exists
+		if ( !$topic = get_topic( $topic_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No topic found.' ) );
+			return $this->error;
+		}
+
+		// Only include "safe" data in the array
+		$topic = $this->prepare_topic( $topic );
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.getTopic' );
+
+		// Return the topic
+		return $topic;
+	}
+
+	/**
+	 * Creates a new topic
+	 *
+	 * @since 1.0
+	 * @return array|object The topic data when successfully created or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param array $args[2] The values for the various parameters in the new topic
+	 * @param string $args[2]['title'] The title of the topic
+	 * @param string $args[2]['text'] The text of the topic
+	 * @param integer|string $args[2]['forum_id'] The unique id of the forum which will contain this topic, slugs are OK to use too
+	 * @param string|array $args[2]['tags'] A comma delimited string or an array of tags to add to the topic (optional)
+	 *
+	 * XML-RPC request to create a new topic called "Insane monkeys" inside the forum with id 2
+	 * <methodCall>
+	 *     <methodName>bb.newTopic</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><struct>
+	 *             <member>
+	 *                 <name>title</name>
+	 *                 <value><string>Insane monkeys</string></value>
+	 *             </member>
+	 *             <member>
+	 *                 <name>text</name>
+	 *                 <value><string>I just saw some insane monkeys eating bananas, did anyone else see that?</string></value>
+	 *             </member>
+	 *             <member>
+	 *                 <name>forum_id</name>
+	 *                 <value><integer>2</integer></value>
+	 *             </member>
+	 *             <member>
+	 *                 <name>tags</name>
+	 *                 <value><string>monkeys, bananas</string></value>
+	 *             </member>
+	 *         </struct></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_newTopic( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.newTopic' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'write_topics', __( 'You do not have permission to write topics.' ) );
+
+		// Additionally they need to be able to write posts
+		if ( !$this->error && !bb_current_user_can( 'write_posts' ) ) {
+			$this->error = new IXR_Error( 403, __( 'You do not have permission to write posts.' ) );
+		}
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.newTopic' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Make sure there is something for us to do
+		if ( !$args[2] || !is_array( $args[2] ) || !count( $args[2] ) ) {
+			$this->error = new IXR_Error( 400, __( 'The topic data is invalid.' ) );
+			return $this->error;
+		}
+
+		$structure = (array) $args[2];
+
+		// Can be numeric id or slug
+		$forum_id = isset( $structure['forum_id'] ) ? $structure['forum_id'] : false;
+
+		// Check for bad data
+		if ( !$forum_id || ( !is_string( $forum_id ) && !is_integer( $forum_id ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The forum id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested forum exists
+		if ( !$forum = bb_get_forum( $forum_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No forum found.' ) );
+			return $this->error;
+		}
+
+		// The forum id may have been a slug, so make sure it's an integer here
+		$forum_id = (int) $forum->forum_id;
+
+		// Make sure they are allowed to write topics to this forum
+		if ( !bb_current_user_can( 'write_topic', $forum_id ) ) {
+			$this->error = new IXR_Error( 403, __( 'You do not have permission to write topics to this forum.' ) );
+			return $this->error;
+		}
+
+		// The topic requires a title
+		if ( !isset( $structure['title'] ) || !$structure['title'] ) {
+			$this->error = new IXR_Error( 400, __( 'The topic title is invalid.' ) );
+			return $this->error;
+		}
+
+		// The topic requires text
+		if ( !isset( $structure['text'] ) || !$structure['text'] ) {
+			$this->error = new IXR_Error( 400, __( 'The topic text is invalid.' ) );
+			return $this->error;
+		}
+
+		// Inject structure into an array suitable for bb_insert_topic()
+		$bb_insert_topic_args = array(
+			'topic_title' => (string) $structure['title'],
+			'forum_id' => $forum_id,
+			'tags' => (string) trim( $structure['tags'] )
+		);
+
+		// Remove empty settings so that changes to the defaults in bb_insert_topic() are honoured
+		$bb_insert_topic_args = array_filter( $bb_insert_topic_args );
+
+		// Create the topic
+		if ( !$topic_id = bb_insert_topic( $bb_insert_topic_args ) ) {
+			$this->error = new IXR_Error( 500, __( 'The topic could not be created.' ) );
+			return $this->error;
+		}
+
+		// Inject structure into an array suitable for bb_insert_post()
+		$bb_insert_post_args = array(
+			'topic_id' => (int) $topic_id,
+			'post_text' => (string) $structure['text']
+		);
+
+		// Create the post
+		if ( !$post_id = bb_insert_post( $bb_insert_post_args ) ) {
+			$this->error = new IXR_Error( 500, __( 'The post could not be created.' ) );
+			return $this->error;
+		}
+
+		// Only include "safe" data in the array
+		$topic = $this->prepare_topic( get_topic( $topic_id ) );
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.newTopic' );
+
+		return $topic;
+	}
+
+	/**
+	 * Edits an existing topic
+	 *
+	 * @since 1.0
+	 * @return array|object The topic data when successfully edited or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param array $args[2] The values for the various parameters in the edited topic
+	 * @param integer|string $args[2]['topic_id'] The topic's id or slug
+	 * @param string $args[2]['title'] The title of the topic
+	 * @param string $args[2]['text'] The text of the topic
+	 *
+	 * XML-RPC request to edit the title of a topic with the slug "insane-monkeys"
+	 * <methodCall>
+	 *     <methodName>bb.editTopic</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><struct>
+	 *             <member>
+	 *                 <name>topic_id</name>
+	 *                 <value><string>insane-monkeys</string></value>
+	 *             </member>
+	 *             <member>
+	 *                 <name>title</name>
+	 *                 <value><string>Very insane monkeys</string></value>
+	 *             </member>
+	 *         </struct></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_editTopic( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.editTopic' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'edit_topics', __( 'You do not have permission to edit topics.' ) );
+
+		// Additionally they need to be able to edit posts
+		if ( !$this->error && !bb_current_user_can( 'edit_posts' ) ) {
+			$this->error = new IXR_Error( 403, __( 'You do not have permission to edit posts.' ) );
+		}
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.editTopic' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Make sure there is something for us to do
+		if ( !$args[2] || !is_array( $args[2] ) || !count( $args[2] ) ) {
+			$this->error = new IXR_Error( 400, __( 'The topic data is invalid.' ) );
+			return $this->error;
+		}
+
+		$structure = (array) $args[2];
+
+		// Can be numeric id or slug
+		$topic_id = isset( $structure['topic_id'] ) ? $structure['topic_id'] : false;
+
+		// Check for bad data
+		if ( !$topic_id || ( !is_string( $topic_id ) && !is_integer( $topic_id ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The topic id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested topic exists
+		if ( !$topic = get_topic( $topic_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No topic found.' ) );
+			return $this->error;
+		}
+
+		// The topic id may have been a slug, so make sure it's an integer here
+		$topic_id = (int) $topic->topic_id;
+
+		// Make sure they are allowed to edit this topic
+		if ( !bb_current_user_can( 'edit_topic', $topic_id ) ) {
+			$this->error = new IXR_Error( 403, __( 'You do not have permission to edit this topic.' ) );
+			return $this->error;
+		}
+
+		// Get the first post in the topic (that's where the content is)
+		if ( !$post = bb_get_first_post( $topic_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No posts found.' ) );
+			return $this->error;
+		}
+
+		$post_id = (int) $post->post_id;
+
+		// Make sure they are allowed to edit this post
+		if ( !bb_current_user_can( 'edit_post', $post_id ) ) {
+			$this->error = new IXR_Error( 403, __( 'You do not have permission to edit this post.' ) );
+			return $this->error;
+		}
+
+		// The topic requires a title
+		if ( isset( $structure['title'] ) && !$structure['title'] ) {
+			$this->error = new IXR_Error( 400, __( 'The topic title is invalid.' ) );
+			return $this->error;
+		}
+
+		// The topic requires text
+		if ( isset( $structure['text'] ) && !$structure['text'] ) {
+			$this->error = new IXR_Error( 400, __( 'The topic text is invalid.' ) );
+			return $this->error;
+		}
+
+		if ( $structure['title'] ) {
+			if ( !bb_insert_topic( array( 'topic_title' => (string) $structure['title'], 'topic_id' => $topic_id ) ) ) {
+				$this->error = new IXR_Error( 500, __( 'The topic could not be edited.' ) );
+				return $this->error;
+			}
+		}
+
+		if ( $structure['text'] ) {
+			if ( !bb_insert_post( array( 'post_text' => (string) $structure['text'], 'post_id' => $post_id, 'topic_id'=> $topic_id ) ) ) {
+				$this->error = new IXR_Error( 500, __( 'The post could not be edited.' ) );
+				return $this->error;
+			}
+		}
+
+		// Only include "safe" data in the array
+		$topic = $this->prepare_topic( get_topic( $topic_id ) );
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.editTopic' );
+
+		return $topic;
+	}
+
+	/**
+	 * Deletes a topic
+	 *
+	 * @since 1.0
+	 * @return integer|object 0 if already changed, 1 when successfully changed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer|string $args[2] The unique id of the topic to be deleted
+	 * @param integer $args[3] 1 deletes the topic, 0 undeletes the topic
+	 *
+	 * XML-RPC request to delete a topic with id of 34
+	 * <methodCall>
+	 *     <methodName>bb.deleteTopic</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><integer>34</integer></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_deleteTopic( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.deleteTopic' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'delete_topics', __( 'You do not have permission to delete topics.' ) );
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.deleteTopic' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can be numeric id or slug
+		$topic_id = isset( $args[2] ) ? $args[2] : false;
+
+		// Check for bad data
+		if ( !$topic_id || ( !is_string( $topic_id ) && !is_integer( $topic_id ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The topic id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested topic exists
+		if ( !$topic = get_topic( $topic_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No topic found.' ) );
+			return $this->error;
+		}
+
+		// The topic id may have been a slug, so make sure it's an integer here
+		$topic_id = (int) $topic->topic_id;
+
+		$delete = isset( $args[3] ) ? (int) $args[3] : 1;
+
+		// Don't do anything if already set that way
+		if ( $delete === (int) $topic->topic_status ) {
+			return 0;
+		}
+
+		// Make sure they are allowed to delete this topic
+		if ( !bb_current_user_can( 'delete_topic', $topic_id ) ) {
+			$this->error = new IXR_Error( 403, __( 'You do not have permission to delete this topic.' ) );
+			return $this->error;
+		}
+
+		// Delete the topic
+		if ( !bb_delete_topic( $topic_id, $delete ) ) {
+			$this->error = new IXR_Error( 500, __( 'The topic could not be deleted.' ) );
+			return $this->error;
+		}
+
+		$result = 1;
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.deleteTopic' );
+
+		return $result;
+	}
+
+	/**
+	 * Moves a topic to a different forum
+	 *
+	 * @since 1.0
+	 * @return integer|object the forum id where the topic lives after the method is called or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer|string $args[2] The unique id of the topic to be moved
+	 * @param integer|string $args[3] The unique id of the forum to be moved to
+	 *
+	 * XML-RPC request to move the topic with id of 34 to forum with slug of "better-forum"
+	 * <methodCall>
+	 *     <methodName>bb.moveTopic</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><integer>34</integer></value></param>
+	 *         <param><value><string>better-forum</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_moveTopic( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.moveTopic' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'move_topics', __( 'You do not have permission to move topics.' ) );
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.moveTopic' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can be numeric id or slug
+		$topic_id = isset( $args[2] ) ? $args[2] : false;
+
+		// Check for bad data
+		if ( !$topic_id || ( !is_string( $topic_id ) && !is_integer( $topic_id ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The topic id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested topic exists
+		if ( !$topic = get_topic( $topic_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No topic found.' ) );
+			return $this->error;
+		}
+
+		// The topic id may have been a slug, so make sure it's an integer here
+		$topic_id = (int) $topic->topic_id;
+
+		// Can be numeric id or slug
+		$forum_id = isset( $args[3] ) ? $args[3] : false;
+
+		// Check for bad data
+		if ( !$forum_id || ( !is_string( $forum_id ) && !is_integer( $forum_id ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The forum id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested topic exists
+		if ( !$forum = bb_get_forum( $forum_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No forum found.' ) );
+			return $this->error;
+		}
+
+		// The forum id may have been a slug, so make sure it's an integer here
+		$forum_id = (int) $forum->forum_id;
+
+		// Only move it if it isn't already there
+		if ( $forum_id !== (int) $topic->forum_id ) {
+			// Make sure they are allowed to move this topic specifically to this forum
+			if ( !bb_current_user_can( 'move_topic', $topic_id, $forum_id ) ) {
+				$this->error = new IXR_Error( 403, __( 'You are not allowed to move this topic to this forum.' ) );
+				return $this->error;
+			}
+
+			// Move the topic
+			if ( !bb_move_topic( $topic_id, $forum_id ) ) {
+				$this->error = new IXR_Error( 500, __( 'The topic could not be moved.' ) );
+				return $this->error;
+			}
+		}
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.moveTopic' );
+
+		return $forum_id;
+	}
+
+	/**
+	 * Sticks a topic to the top of a forum or the front page
+	 *
+	 * @since 1.0
+	 * @return integer|object 0 if it is already stuck to the desired location, 1 when successfully stuck or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer|string $args[2] The unique id of the topic to be stuck
+	 * @param integer $args[3] 0 unsticks, 1 sticks, 2 sticks to front (optional)
+	 *
+	 * XML-RPC request to stick the topic with id of 34 to the front page
+	 * <methodCall>
+	 *     <methodName>bb.stickTopic</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><integer>34</integer></value></param>
+	 *         <param><value><integer>1</integer></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_stickTopic( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.stickTopic' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'stick_topics', __( 'You do not have permission to stick topics.' ) );
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.stickTopic' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can be numeric id or slug
+		$topic_id = isset( $args[2] ) ? $args[2] : false;
+
+		// Check for bad data
+		if ( !$topic_id || ( !is_string( $topic_id ) && !is_integer( $topic_id ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The topic id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested topic exists
+		if ( !$topic = get_topic( $topic_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No topic found.' ) );
+			return $this->error;
+		}
+
+		// The topic id may have been a slug, so make sure it's an integer here
+		$topic_id = (int) $topic->topic_id;
+
+		// Make sure they are allowed to stick this topic
+		if ( !bb_current_user_can( 'stick_topic', $topic_id ) ) {
+			$this->error = new IXR_Error( 403, __( 'You do not have permission to stick this topic.' ) );
+			return $this->error;
+		}
+
+		// Stick to where?
+		$where = isset( $args[3] ) ? (int) $args[3] : 1;
+
+		// Forget it if it's already there
+		if ( $where === (int) $topic->topic_sticky ) {
+			return 0;
+		}
+
+		// Stick the topic
+		if ( !bb_stick_topic( $topic_id, $where ) ) {
+			$this->error = new IXR_Error( 500, __( 'The topic could not be stuck.' ) );
+			return $this->error;
+		}
+
+		$result = 1;
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.stickTopic' );
+
+		return $result;
+	}
+
+
+
+	/**
+	 * Closes a topic
+	 *
+	 * @since 1.0
+	 * @return integer|object 0 when already changed, 1 when successfully changed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer|string $args[2] The unique id of the topic to be closed
+	 * @param integer $args[2] 0 closes, 1 opens (optional)
+	 *
+	 * XML-RPC request to close the topic with slug of "really-old-topic"
+	 * <methodCall>
+	 *     <methodName>bb.closeTopic</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>really-old-topic</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to open the topic with slug of "really-old-topic"
+	 * <methodCall>
+	 *     <methodName>bb.closeTopic</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>really-old-topic</string></value></param>
+	 *         <param><value><integer>1</integer></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_closeTopic( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.closeTopic' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'close_topics', __( 'You do not have permission to close topics.' ) );
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.closeTopic' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can be numeric id or slug
+		$topic_id = isset( $args[2] ) ? $args[2] : false;
+
+		// Check for bad data
+		if ( !$topic_id || ( !is_string( $topic_id ) && !is_integer( $topic_id ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The topic id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested topic exists
+		if ( !$topic = get_topic( $topic_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No topic found.' ) );
+			return $this->error;
+		}
+
+		// The topic id may have been a slug, so make sure it's an integer here
+		$topic_id = (int) $topic->topic_id;
+
+		// Make sure they are allowed to close this topic
+		if ( !bb_current_user_can( 'close_topic', $topic_id ) ) {
+			$this->error = new IXR_Error( 403, __( 'You do not have permission to close this topic.' ) );
+			return $this->error;
+		}
+
+		// Open or close?
+		$close = isset( $args[3] ) ? (int) $args[3] : 0;
+
+		// Forget it if it's already matching
+		if ( $close === (int) $topic->topic_open ) {
+			return 0;
+		}
+
+		// Close the topic
+		if ( !$close && !bb_close_topic( $topic_id ) ) {
+			$this->error = new IXR_Error( 500, __( 'The topic could not be closed.' ) );
+			return $this->error;
+		}
+
+		// Open the topic
+		if ( $close && !bb_open_topic( $topic_id ) ) {
+			$this->error = new IXR_Error( 500, __( 'The topic could not be opened.' ) );
+			return $this->error;
+		}
+
+		$result = 1;
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.closeTopic' );
+
+		return $result;
+	}
+
+
+
+	/**
+	 * bbPress publishing API - Post XML-RPC methods
+	 */
+
+	/**
+	 * Returns a numerical count of posts
+	 *
+	 * @since 1.0
+	 * @return integer|object The number of topics when successfully executed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer|string $args[2] The topic id or slug
+	 *
+	 * XML-RPC request to get a count of all posts in the topic with slug "countable-topic"
+	 * <methodCall>
+	 *     <methodName>bb.getPostCount</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>countable-topic</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_getPostCount( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.getPostCount' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		if ( $this->auth_readonly ) {
+			$user = $this->authenticate( $username, $password );
+		}
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.getPostCount' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can be numeric id or slug
+		$topic_id = isset( $args[2] ) ? $args[2] : false;
+
+		// Check for bad data
+		if ( !$topic_id || ( !is_string( $topic_id ) && !is_integer( $topic_id ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The topic id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested topic exists
+		if ( !$topic = get_topic( $topic_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No topic found.' ) );
+			return $this->error;
+		}
+
+		// OK, let's trust the count in the topic table
+		$count = $topic->topic_posts;
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.getPostCount' );
+
+		// Return the count of posts
+		return $count;
+	}
+
+	/**
+	 * Returns details of the posts in a given topic
+	 *
+	 * @since 1.0
+	 * @return array|object The posts when successfully executed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer|string $args[2] The topic id or slug
+	 * @param integer $args[3] The number of posts to return (optional)
+	 * @param integer $args[4] The number of the page to return (optional)
+	 *
+	 * XML-RPC request to get all posts in the topic with id number 53
+	 * <methodCall>
+	 *     <methodName>bb.getPosts</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>53</int></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to get the latest 5 posts in the topic with id number 341
+	 * <methodCall>
+	 *     <methodName>bb.getPosts</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>341</int></value></param>
+	 *         <param><value><int>5</int></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to get posts 11 to 20 in the topic with slug "long-topic"
+	 * <methodCall>
+	 *     <methodName>bb.getPosts</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>long-topic</string></value></param>
+	 *         <param><value><int>10</int></value></param>
+	 *         <param><value><int>2</int></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_getPosts( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.getPosts' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		if ( $this->auth_readonly ) {
+			$user = $this->authenticate( $username, $password );
+		}
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.getPosts' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can be numeric id or slug
+		$topic_id = isset( $args[2] ) ? $args[2] : false;
+
+		// Check for bad data
+		if ( !$topic_id || ( !is_string( $topic_id ) && !is_integer( $topic_id ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The topic id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested topic exists
+		if ( !$topic = get_topic( $topic_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No topic found.' ) );
+			return $this->error;
+		}
+
+		// The topic id may have been a slug, so make sure it's an integer here
+		$topic_id = (int) $topic->topic_id;
+
+		// Setup an array to store arguments to pass to get_thread() function
+		$get_thread_args = array();
+
+		// Can only be an integer
+		if ( isset( $args[3] ) && $per_page = (int) $args[3] ) {
+			$get_thread_args['per_page'] = $per_page;
+		}
+
+		// Can only be an integer
+		if ( isset( $args[4] ) && $page = (int) $args[4] ) {
+			$get_thread_args['page'] = $page;
+		}
+
+		// Get the posts
+		if ( !$posts = get_thread( $topic_id, $get_thread_args ) ) {
+			$this->error = new IXR_Error( 500, __( 'No posts found.' ) );
+			return $this->error;
+		}
+
+		// Only include "safe" data in the array
+		$_posts = array();
+		foreach ( $posts as $post ) {
+			$_posts[] = $this->prepare_post( $post );
+		}
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.getPosts' );
+
+		// Return the posts
+		return $_posts;
+	}
+
+	/**
+	 * Returns details of a post
+	 *
+	 * @since 1.0
+	 * @return array|object An array containing details of the returned post when successfully executed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer $args[2] The post's id
+	 *
+	 * XML-RPC request to get the post with id number 32
+	 * <methodCall>
+	 *     <methodName>bb.getPost</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>32</int></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_getPost( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.getPost' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		if ( $this->auth_readonly ) {
+			$user = $this->authenticate( $username, $password );
+		}
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.getPost' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can be numeric id or slug
+		$post_id = isset( $args[2] ) ? (int) $args[2] : false;
+
+		// Check for bad data
+		if ( !$post_id ) {
+			$this->error = new IXR_Error( 400, __( 'The post id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested post exists
+		if ( !$post = bb_get_post( $post_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No post found.' ) );
+			return $this->error;
+		}
+
+		// Only include "safe" data in the array
+		$_post = $this->prepare_post( $post );
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.getPost' );
+
+		// Return the post
+		return $_post;
+	}
+
+	/**
+	 * Creates a new post in a given topic
+	 *
+	 * @since 1.0
+	 * @return array|object The post data when successfully created or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param array $args[2] The values for the various parameters in the new topic
+	 * @param string $args[2]['text'] The text of the topic
+	 * @param integer|string $args[2]['topic_id'] The unique id of the topic which will contain this topic, slugs are OK to use too
+	 *
+	 * XML-RPC request to create a new post in the topic with slug "totally-worth-it"
+	 * <methodCall>
+	 *     <methodName>bb.newPost</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><struct>
+	 *             <member>
+	 *                 <name>text</name>
+	 *                 <value><string>I agree, it is totally worth it.</string></value>
+	 *             </member>
+	 *             <member>
+	 *                 <name>topic_id</name>
+	 *                 <value><string>totally-worth-it</string></value>
+	 *             </member>
+	 *         </struct></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_newPost( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.newPost' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'write_posts', __( 'You do not have permission to write posts.' ) );
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.newPost' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Make sure there is something for us to do
+		if ( !$args[2] || !is_array( $args[2] ) || !count( $args[2] ) ) {
+			$this->error = new IXR_Error( 400, __( 'The post data is invalid.' ) );
+			return $this->error;
+		}
+
+		$structure = (array) $args[2];
+
+		// Can be numeric id or slug
+		$topic_id = isset( $structure['topic_id'] ) ? $structure['topic_id'] : false;
+
+		// Check for bad data
+		if ( !$topic_id || ( !is_string( $topic_id ) && !is_integer( $topic_id ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The topic id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested topic exists
+		if ( !$topic = get_topic( $topic_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No topic found.' ) );
+			return $this->error;
+		}
+
+		// The topic id may have been a slug, so make sure it's an integer here
+		$topic_id = (int) $topic->topic_id;
+
+		// Make sure they are allowed to write posts to this topic
+		if ( !bb_current_user_can( 'write_post', $topic_id ) ) {
+			$this->error = new IXR_Error( 403, __( 'You do not have permission to write posts to this topic.' ) );
+			return $this->error;
+		}
+
+		// The post requires text
+		if ( !isset( $structure['text'] ) || !$structure['text'] ) {
+			$this->error = new IXR_Error( 400, __( 'The post text is invalid.' ) );
+			return $this->error;
+		}
+
+		// Inject structure into an array suitable for bb_insert_post()
+		$bb_insert_post_args = array(
+			'topic_id' => $topic_id,
+			'post_text' => (string) $structure['text']
+		);
+
+		// Create the post
+		if ( !$post_id = bb_insert_post( $bb_insert_post_args ) ) {
+			$this->error = new IXR_Error( 500, __( 'The post could not be created.' ) );
+			return $this->error;
+		}
+
+		// Only include "safe" data in the array
+		$post = $this->prepare_forum( bb_get_post( $post_id ) );
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.newPost' );
+
+		return $post;
+	}
+
+	/**
+	 * Edits an existing post
+	 *
+	 * @since 1.0
+	 * @return array|object The post data when successfully edited or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param array $args[2] The values for the various parameters in the new topic
+	 * @param integer $args[2]['post_id'] The unique id of the post
+	 * @param string $args[2]['text'] The text of the topic
+	 *
+	 * XML-RPC request to edit the text of the post with an id of 452
+	 * <methodCall>
+	 *     <methodName>bb.editPost</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><struct>
+	 *             <member>
+	 *                 <name>post_id</name>
+	 *                 <value><int>452</int></value>
+	 *             </member>
+	 *             <member>
+	 *                 <name>text</name>
+	 *                 <value><string>For now I will withhold my opinion.</string></value>
+	 *             </member>
+	 *         </struct></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_editPost( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.editPost' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'edit_posts', __( 'You do not have permission to edit posts.' ) );
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.editPost' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Make sure there is something for us to do
+		if ( !$args[2] || !is_array( $args[2] ) || !count( $args[2] ) ) {
+			$this->error = new IXR_Error( 400, __( 'The post data is invalid.' ) );
+			return $this->error;
+		}
+
+		$structure = (array) $args[2];
+
+		// Can be numeric id or slug
+		$post_id = isset( $structure['post_id'] ) ? (int) $structure['post_id'] : false;
+
+		// Check for bad data
+		if ( !$post_id ) {
+			$this->error = new IXR_Error( 400, __( 'The post id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested topic exists
+		if ( !$post = bb_get_post( $post_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No post found.' ) );
+			return $this->error;
+		}
+
+		// Re-assign the post id
+		$post_id = (int) $post->post_id;
+
+		// Make sure they are allowed to edit this post
+		if ( !bb_current_user_can( 'edit_post', $post_id ) ) {
+			$this->error = new IXR_Error( 403, __( 'You do not have permission to edit this post.' ) );
+			return $this->error;
+		}
+
+		// The post requires text
+		if ( !isset( $structure['text'] ) || !$structure['text'] ) {
+			$this->error = new IXR_Error( 400, __( 'The post text is invalid.' ) );
+			return $this->error;
+		}
+
+		// Inject structure into an array suitable for bb_insert_post()
+		$bb_insert_post_args = array(
+			'post_id' => $post_id,
+			'post_text' => (string) $structure['text']
+		);
+
+		// Create the post
+		if ( !$post_id = bb_insert_post( $bb_insert_post_args ) ) {
+			$this->error = new IXR_Error( 500, __( 'The post could not be edited.' ) );
+			return $this->error;
+		}
+
+		// Only include "safe" data in the array
+		$post = $this->prepare_forum( bb_get_post( $post_id ) );
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.editPost' );
+
+		return $post;
+	}
+
+	/**
+	 * Deletes an existing post
+	 *
+	 * @since 1.0
+	 * @return integer|object 1 when successfully deleted, 0 when already deleted or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param array $args[2] The unique id of the post
+	 * @param array $args[3] 1 deletes the post, 0 undeletes the post (optional)
+	 *
+	 * XML-RPC request to delete the post with an id of 4301
+	 * <methodCall>
+	 *     <methodName>bb.editPost</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>4301</int></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_deletePost( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.deletePost' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'delete_posts', __( 'You do not have permission to delete posts.' ) );
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.deletePost' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can be numeric id or slug
+		$post_id = isset( $args[2] ) ? (int) $args[2] : false;
+
+		// Check for bad data
+		if ( !$post_id ) {
+			$this->error = new IXR_Error( 400, __( 'The post id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested topic exists
+		if ( !$post = bb_get_post( $post_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No post found.' ) );
+			return $this->error;
+		}
+
+		// Re-assign the post id
+		$post_id = (int) $post->post_id;
+
+		// Make sure they are allowed to delete this post
+		if ( !bb_current_user_can( 'delete_post', $post_id ) ) {
+			$this->error = new IXR_Error( 403, __( 'You do not have permission to delete this post.' ) );
+			return $this->error;
+		}
+
+		$status = isset( $args[3] ) ? (int) $args[3] : 1;
+
+		if ( $status === (int) $post->post_status ) {
+			return 0;
+		}
+
+		// Delete the post
+		if ( !$post_id = bb_delete_post( $post_id, $status ) ) {
+			$this->error = new IXR_Error( 500, __( 'The post could not be edited.' ) );
+			return $this->error;
+		}
+
+		$result = 1;
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.deletePost' );
+
+		return $result;
+	}
+
+
+
+	/**
+	 * bbPress publishing API - Topic Tag XML-RPC methods
+	 */
+
+	/**
+	 * Returns the hot tags in order of hotness in a given forum or all hot tags
+	 *
+	 * @since 1.0
+	 * @return integer|object The tag data when successfully executed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer $args[2] The number of tags to return (optional)
+	 * @param integer|string $args[3] The forum id or slug (optional)
+	 *
+	 * XML-RPC request to get the 20 hottest tags in the forum with slug "hawtness"
+	 * <methodCall>
+	 *     <methodName>bb.getTopicTags</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>20</int></value></param>
+	 *         <param><value><string>hawtness</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_getHotTopicTags( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.getHotTopicTags' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		if ( $this->auth_readonly ) {
+			$user = $this->authenticate( $username, $password );
+		}
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.getHotTopicTags' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Must be a number
+		$per_page = isset( $args[2] ) ? (integer) $args[2] : false;
+
+		// Can be numeric id or slug
+		$forum_id = isset( $args[3] ) ? $args[3] : false;
+
+		if ( $forum_id ) {
+			// Check for bad data
+			if ( !is_string( $forum_id ) && !is_integer( $forum_id ) ) {
+				$this->error = new IXR_Error( 400, __( 'The forum id is invalid.' ) );
+				return $this->error;
+			}
+
+			// Check the requested forum exists
+			if ( !$forum = bb_get_forum( $forum_id ) ) {
+				$this->error = new IXR_Error( 404, __( 'No forum found.' ) );
+				return $this->error;
+			}
+
+			global $bbdb;
+			$topic_ids = $bbdb->get_col( $bbdb->prepare( "SELECT topic_id FROM `" . $bbdb->topics . "` WHERE `topic_status` = 0 AND `topic_open` = 1 AND `tag_count` > 0 AND `forum_id` = %s;", $forum_id ) );
+
+			if ( !count( $topic_ids ) ) {
+				$this->error = new IXR_Error( 400, __( 'No topics found.' ) );
+				return $this->error;
+			}
+
+			global $wp_taxonomy_object;
+			$tags = $wp_taxonomy_object->get_object_terms( $topic_ids, 'bb_topic_tag', array( 'fields' => 'all_with_object_id', 'orderby' => 'count', 'order' => 'DESC' ) );
+
+			if ( !$tags || is_wp_error( $tags ) ) {
+				$this->error = new IXR_Error( 500, __( 'Could not retrieve hot topic tags.' ) );
+				return $this->error;
+			}
+			if ( !count( $tags ) ) {
+				$this->error = new IXR_Error( 500, __( 'No hot topic tags found.' ) );
+				return $this->error;
+			}
+			global $bb_log;
+			$bb_log->debug($tags);
+
+			for ( $i = 0; isset( $tags[$i] ); $i++ ) {
+				_bb_make_tag_compat( $tags[$i] );
+			}
+			$bb_log->debug($tags);
+
+			// Only include "safe" data in the array
+			$_tags = array();
+			foreach ( $tags as $tag ) {
+				$_tag = $this->prepare_topic_tag( $tag );
+				if ( !in_array( $_tag, $_tags ) ) {
+					$_tags[] = $_tag;
+				}
+			}
+
+			if ( $per_page ) {
+				$_tags = array_slice( $_tags, 0, $per_page );
+			}
+		} else {
+			if ( !$tags = bb_get_top_tags( array( 'get' => 'all', 'number' => $per_page ) ) ) {
+				$this->error = new IXR_Error( 500, __( 'No hot topic tags found.' ) );
+				return $this->error;
+			}
+
+			// Only include "safe" data in the array
+			$_tags = array();
+			foreach ( $tags as $tag ) {
+				$_tags[] = $this->prepare_topic_tag( $tag );
+			}
+		}
+
+		do_action( 'bb_xmlrpc_call', 'bb.getHotTopicTags' );
+
+		return $_tags;
+	}
+
+	/**
+	 * Returns a numerical count of tags in a given topic or all tags
+	 *
+	 * @since 1.0
+	 * @return integer|object The number of topics when successfully executed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer|string $args[2] The topic id or slug (optional)
+	 *
+	 * XML-RPC request to get a count of all tags in the topic with slug "woot-frist-topic"
+	 * <methodCall>
+	 *     <methodName>bb.getTopicTagCount</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>woot-frist-topic</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_getTopicTagCount( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.getTopicTagCount' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		if ( $this->auth_readonly ) {
+			$user = $this->authenticate( $username, $password );
+		}
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.getTopicTagCount' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can be numeric id or slug
+		$topic_id = isset( $args[2] ) ? $args[2] : false;
+
+		// Check for bad data
+		if ( $topic_id ) {
+			if ( !is_string( $topic_id ) && !is_integer( $topic_id ) ) {
+				$this->error = new IXR_Error( 400, __( 'The topic id is invalid.' ) );
+				return $this->error;
+			}
+
+			// Check the requested topic exists
+			if ( !$topic = get_topic( $topic_id ) ) {
+				$this->error = new IXR_Error( 400, __( 'No topic found.' ) );
+				return $this->error;
+			}
+
+			// The topic id may have been a slug, so make sure it's an integer here
+			$topic_id = (int) $topic->topic_id;
+
+			// Now get the tags
+			if ( !$tags = bb_get_topic_tags( $topic_id ) ) {
+				$tags = array();
+			}
+
+			// Count the tags
+			$count = count( $tags );
+		} else {
+			global $wp_taxonomy_object;
+			$count = $wp_taxonomy_object->count_terms( 'bb_topic_tag' );
+			if ( is_wp_error( $count ) ) {
+				$this->error = new IXR_Error( 500, __( 'Could not get a count of all topic tags.' ) );
+				return $this->error;
+			}
+		}
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.getTopicTagCount' );
+
+		// Return the count of tags
+		return $count;
+	}
+
+	/**
+	 * Returns the tags in a given topic or all tags
+	 *
+	 * @since 1.0
+	 * @return integer|object The tag data when successfully executed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param integer|string $args[2] The topic id or slug (optional)
+	 *
+	 * XML-RPC request to get all tags in the topic with slug "woot-frist-topic"
+	 * <methodCall>
+	 *     <methodName>bb.getTopicTags</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>woot-frist-topic</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_getTopicTags( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.getTopicTags' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		if ( $this->auth_readonly ) {
+			$user = $this->authenticate( $username, $password );
+		}
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.getTopicTags' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can be numeric id or slug
+		$topic_id = isset( $args[2] ) ? $args[2] : false;
+
+		// Check for bad data
+		if ( $topic_id ) {
+			if ( !is_string( $topic_id ) && !is_integer( $topic_id ) ) {
+				$this->error = new IXR_Error( 400, __( 'The topic id is invalid.' ) );
+				return $this->error;
+			}
+
+			// Check the requested topic exists
+			if ( !$topic = get_topic( $topic_id ) ) {
+				$this->error = new IXR_Error( 400, __( 'No topic found.' ) );
+				return $this->error;
+			}
+
+			// The topic id may have been a slug, so make sure it's an integer here
+			$topic_id = (int) $topic->topic_id;
+
+			// Now get the tags
+			if ( !$tags = bb_get_topic_tags( $topic_id ) ) {
+				$this->error = new IXR_Error( 500, __( 'No topic tags found.' ) );
+				return $this->error;
+			}
+		} else {
+			global $wp_taxonomy_object;
+			$tags = $wp_taxonomy_object->get_terms( 'bb_topic_tag', array( 'get' => 'all' ) );
+			if ( is_wp_error( $tags ) ) {
+				$this->error = new IXR_Error( 500, __( 'Could not retrieve all topic tags.' ) );
+				return $this->error;
+			}
+			for ( $i = 0; isset( $tags[$i] ); $i++ ) {
+				_bb_make_tag_compat( $tags[$i] );
+			}
+		}
+
+		// Only include "safe" data in the array
+		$_tags = array();
+		foreach ( $tags as $tag ) {
+			$_tags[] = $this->prepare_topic_tag( $tag );
+		}
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.getTopicTags' );
+
+		// Return the tags
+		return $_tags;
+	}
+
+	/**
+	 * Returns the topics which are tagged with the given tag
+	 *
+	 * @since 1.0
+	 * @return integer|object The topic data when successfully executed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param string $args[2] The tag name or slug
+	 * @param integer $args[3] The number of topics to return (optional)
+	 * @param integer $args[4] The number of the page to return (optional)
+	 *
+	 * XML-RPC request to get the latest 10 topics tagged with the tag "apples"
+	 * <methodCall>
+	 *     <methodName>bb.getTopicTag</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>apples</string></value></param>
+	 *         <param><value><string>10</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_getTopicTag( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.getTopicTag' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		if ( $this->auth_readonly ) {
+			$user = $this->authenticate( $username, $password );
+		}
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.getTopicTag' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can only be a string
+		$tag_id = isset( $args[2] ) ? (string) $args[2] : false;
+
+		// Check for bad data
+		if ( !$tag_id ) {
+			$this->error = new IXR_Error( 400, __( 'The tag id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested topic exists
+		if ( !$tag = bb_get_tag( $tag_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No tag found.' ) );
+			return $this->error;
+		}
+
+		// Get the numeric tag id
+		$tag_id = (int) $tag->tag_id;
+
+		// Setup an array to store arguments to pass to get_tagged_topics() function
+		$get_topics_args = array(
+			'tag_id' => false,
+			'number' => false,
+			'page' => false
+		);
+
+		// Can only be an integer
+		if ( isset( $args[3] ) && $number = (int) $args[3] ) {
+			$get_topics_args['number'] = $number;
+		}
+
+		// Can only be an integer
+		if ( isset( $args[4] ) && $page = (int) $args[4] ) {
+			$get_topics_args['page'] = $page;
+		}
+
+		// Now get the topics
+		if ( !$topics = get_tagged_topics( $tag_id ) ) {
+			$this->error = new IXR_Error( 500, __( 'No topics found.' ) );
+			return $this->error;
+		}
+
+		// Only include "safe" data in the array
+		$_topics = array();
+		foreach ( $topics as $topic ) {
+			$_topics[] = $this->prepare_topic( $topic );
+		}
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.getTopicTag' );
+
+		// Return the topics
+		return $_topics;
+	}
+
+	/**
+	 * Adds the specified tags to the specified topic
+	 *
+	 * @since 1.0
+	 * @return array|object The tags which were added when successfully executed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param string|integer $args[2] The topic id or slug
+	 * @param string|array $args[3] The tags to add to the topic
+	 *
+	 * XML-RPC request to add the tag "banana" to the topic with id 219
+	 * <methodCall>
+	 *     <methodName>bb.addTopicTags</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>219</int></value></param>
+	 *         <param><value><string>banana</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to add the tags "banana" and "man" to the topic with id 219
+	 * <methodCall>
+	 *     <methodName>bb.addTopicTags</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>219</int></value></param>
+	 *         <param><value><string>banana, man</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to add the tags "banana" and "man" to the topic with id 219 using an array
+	 * <methodCall>
+	 *     <methodName>bb.addTopicTags</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>219</int></value></param>
+	 *         <param><value><array>
+	 *             <data><value><string>banana</string></value></data>
+	 *             <data><value><string>man</string></value></data>
+	 *         </array></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_addTopicTags( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.addTopicTags' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'edit_tags', __( 'You do not have permission to edit tags.' ) );
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.addTopicTags' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can be numeric id or slug
+		$topic_id = isset( $args[2] ) ? $args[2] : false;
+
+		// Check for bad data
+		if ( !$topic_id || ( !is_string( $topic_id ) && !is_integer( $topic_id ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The topic id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested topic exists
+		if ( !$topic = get_topic( $topic_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No topic found.' ) );
+			return $this->error;
+		}
+
+		// The topic id may have been a slug, so make sure it's an integer here
+		$topic_id = (int) $topic->topic_id;
+
+		// Make sure they are allowed to add tags to this topic
+		if ( !bb_current_user_can( 'add_tag_to', $topic_id ) ) {
+			$this->error = new IXR_Error( 403, __( 'You do not have permission to add tags to this topic.' ) );
+			return $this->error;
+		}
+
+		$tags = isset( $args[3] ) ? $args[3] : false;
+
+		// Check for bad data
+		if ( !$tags || ( !is_string( $tags ) && !is_array( $tags ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The tag data is invalid.' ) );
+			return $this->error;
+		}
+
+		// Add the tags
+		if ( !$tag_ids = bb_add_topic_tags( $topic_id, $tags ) ) {
+			$this->error = new IXR_Error( 500, __( 'The tags could not be added.' ) );
+			return $this->error;
+		}
+
+		// Only include "safe" data in the array
+		$_tags = array();
+		foreach ( $tag_ids as $tag_id ) {
+			$_tags[] = $this->prepare_topic_tag( bb_get_tag( $tag_id ) );
+		}
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.addTopicTags' );
+
+		// Return the tags which were added as an array
+		return $_tags;
+	}
+
+	/**
+	 * Removes the specified tags from the specified topic
+	 *
+	 * @since 1.0
+	 * @return integer|object 1 when successfully executed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param string|integer $args[2] The topic id or slug
+	 * @param string|array $args[3] The tags to remove from the topic
+	 *
+	 * XML-RPC request to remove the tag "banana" to the topic with id 219
+	 * <methodCall>
+	 *     <methodName>bb.removeTopicTags</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>219</int></value></param>
+	 *         <param><value><string>banana</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to remove the tags "banana" and "man" to the topic with id 219
+	 * <methodCall>
+	 *     <methodName>bb.removeTopicTags</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>219</int></value></param>
+	 *         <param><value><string>banana, man</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to remove the tags "banana" and "man" to the topic with id 219 using an array
+	 * <methodCall>
+	 *     <methodName>bb.removeTopicTags</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><int>219</int></value></param>
+	 *         <param><value><array>
+	 *             <data><value><string>banana</string></value></data>
+	 *             <data><value><string>man</string></value></data>
+	 *         </array></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_removeTopicTags( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.removeTopicTags' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'edit_tags', __( 'You do not have permission to edit tags.' ) );
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.removeTopicTags' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can be numeric id or slug
+		$topic_id = isset( $args[2] ) ? $args[2] : false;
+
+		// Check for bad data
+		if ( !$topic_id || ( !is_string( $topic_id ) && !is_integer( $topic_id ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The topic id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested topic exists
+		if ( !$topic = get_topic( $topic_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No topic found.' ) );
+			return $this->error;
+		}
+
+		// The topic id may have been a slug, so make sure it's an integer here
+		$topic_id = (int) $topic->topic_id;
+
+		// Make sure they are allowed to add tags to this topic
+		if ( !bb_current_user_can( 'add_tag_to', $topic_id ) ) {
+			$this->error = new IXR_Error( 403, __( 'You do not have permission to remove tags from this topic.' ) );
+			return $this->error;
+		}
+
+		$tags = isset( $args[3] ) ? $args[3] : false;
+
+		// Check for bad data
+		if ( !$tags || ( !is_string( $tags ) && !is_array( $tags ) ) ) {
+			$this->error = new IXR_Error( 400, __( 'The tag data is invalid.' ) );
+			return $this->error;
+		}
+
+		// Add the tags
+		if ( !bb_remove_topic_tags( $topic_id, $tags ) ) {
+			$this->error = new IXR_Error( 500, __( 'The tags could not be removed.' ) );
+			return $this->error;
+		}
+
+		$result = 1;
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.removeTopicTags' );
+
+		// Return the result
+		return $result;
+	}
+
+	/**
+	 * Renames the specified tag to a new tag name
+	 *
+	 * @since 1.0
+	 * @return array|object The tag data when successfully renamed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param string $args[2] The tag name or slug
+	 * @param string $args[3] The new tag name (slug is auto-generated)
+	 *
+	 * XML-RPC request to rename the tag "banana" to "bananas"
+	 * <methodCall>
+	 *     <methodName>bb.renameTopicTag</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>banana</string></value></param>
+	 *         <param><value><string>bananas</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_renameTopicTag( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.renameTopicTag' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'manage_tags', __( 'You do not have permission to manage tags.' ) );
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.renameTopicTag' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can only be a string
+		$tag_id = isset( $args[2] ) ? (string) $args[2] : false;
+
+		// Check for bad data
+		if ( !$tag_id ) {
+			$this->error = new IXR_Error( 400, __( 'The tag id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested tag exists
+		if ( !$tag = bb_get_tag( $tag_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No tag found.' ) );
+			return $this->error;
+		}
+
+		// Get the numeric tag id
+		$tag_id = (int) $tag->tag_id;
+
+		// Can only be a string
+		$tag_name = isset( $args[3] ) ? (string) $args[3] : false;
+
+		// Check for bad data
+		if ( !$tag_name || $tag_name == $tag->tag_name ) {
+			$this->error = new IXR_Error( 400, __( 'The tag name is invalid.' ) );
+			return $this->error;
+		}
+
+		// Rename the tag
+		if ( !$new_tag = bb_rename_tag( $tag_id, $tag_name ) ) {
+			$this->error = new IXR_Error( 500, __( 'The tag could not be renamed.' ) );
+			return $this->error;
+		}
+
+		// Only include "safe" data in the array
+		$new_tag = $this->prepare_topic_tag( $new_tag );
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.renameTopicTag' );
+
+		// Return the tag
+		return $new_tag;
+	}
+
+	/**
+	 * Merges the specified tags
+	 *
+	 * @since 1.0
+	 * @return array|object The tag data when successfully merged or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param string $args[2] The old tag name or slug to be destroyed
+	 * @param string $args[3] The new tag name or slug where the old tag will be merged to
+	 *
+	 * XML-RPC request to merge the tag "banana" into the tag "apple"
+	 * <methodCall>
+	 *     <methodName>bb.mergeTopicTags</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>banana</string></value></param>
+	 *         <param><value><string>apple</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_mergeTopicTags( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.mergeTopicTags' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'manage_tags', __( 'You do not have permission to manage tags.' ) );
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.mergeTopicTags' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can only be strings
+		$old_tag_id = isset( $args[2] ) ? (string) $args[2] : false;
+		$new_tag_id = isset( $args[3] ) ? (string) $args[3] : false;
+
+		// Check for bad data
+		if ( !$old_tag_id ) {
+			$this->error = new IXR_Error( 400, __( 'The old tag id is invalid.' ) );
+			return $this->error;
+		}
+		if ( !$new_tag_id ) {
+			$this->error = new IXR_Error( 400, __( 'The new tag id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested tags exist
+		if ( !$old_tag = bb_get_tag( $old_tag_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No old tag found.' ) );
+			return $this->error;
+		}
+		if ( !$new_tag = bb_get_tag( $new_tag_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No new tag found.' ) );
+			return $this->error;
+		}
+
+		// Get the numeric tag ids
+		$old_tag_id = (int) $old_tag->tag_id;
+		$new_tag_id = (int) $new_tag->tag_id;
+
+		// Rename the tag
+		if ( !$result = bb_rename_tag( $old_tag_id, $new_tag_id ) ) {
+			$this->error = new IXR_Error( 500, __( 'The tags could not be merged.' ) );
+			return $this->error;
+		}
+
+		// Get the merged tag
+		$new_tag = bb_get_tag( $new_tag_id );
+
+		// Only include "safe" data in the array
+		$new_tag = $this->prepare_topic_tag( $new_tag );
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.mergeTopicTags' );
+
+		// Return the tag
+		return $new_tag;
+	}
+
+	/**
+	 * Destroys the specified tag
+	 *
+	 * @since 1.0
+	 * @return integer|object 1 when successfully deleted or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param string $args[2] The tag name or slug to be destroyed
+	 *
+	 * XML-RPC request to destroy the tag "banana"
+	 * <methodCall>
+	 *     <methodName>bb.destroyTopicTag</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><string>banana</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_destroyTopicTag( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.destroyTopicTag' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'manage_tags', __( 'You do not have permission to manage tags.' ) );
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.destroyTopicTag' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Can only be a string
+		$tag_id = isset( $args[2] ) ? (string) $args[2] : false;
+
+		// Check for bad data
+		if ( !$tag_id ) {
+			$this->error = new IXR_Error( 400, __( 'The tag id is invalid.' ) );
+			return $this->error;
+		}
+
+		// Check the requested tag exists
+		if ( !$tag = bb_get_tag( $tag_id ) ) {
+			$this->error = new IXR_Error( 400, __( 'No tag found.' ) );
+			return $this->error;
+		}
+
+		// Get the numeric tag id
+		$tag_id = (int) $tag->tag_id;
+
+		// Destroy the tag
+		if ( !$result = bb_destroy_tag( $tag_id ) ) {
+			$this->error = new IXR_Error( 500, __( 'The tag could not be destroyed.' ) );
+			return $this->error;
+		}
+
+		$result = 1;
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.destroyTopicTag' );
+
+		// Return the tag
+		return $result;
+	}
+
+
+
+	/**
+	 * bbPress publishing API - Options XML-RPC methods
+	 */
+
+	/**
+	 * Initialises site options which can be manipulated using XML-RPC
+	 *
+	 * @since 1.0
+	 * @return void
+	 */
+	function initialise_site_option_info()
+	{
+		$this->site_options = array(
+			// Read only options
+			'software_name'		=> array(
+				'desc'			=> __( 'Software Name' ),
+				'readonly'		=> true,
+				'value'			=> 'bbPress'
+			),
+			'software_version'	=> array(
+				'desc'			=> __( 'Software Version' ),
+				'readonly'		=> true,
+				'option'		=> 'version'
+			),
+			'site_url'			=> array(
+				'desc'			=> __( 'Site URL' ),
+				'readonly'		=> true,
+				'option'		=> 'uri'
+			),
+
+			// Updatable options
+			'site_name'		=> array(
+				'desc'			=> __( 'Site Name' ),
+				'readonly'		=> false,
+				'option'		=> 'name'
+			),
+			'site_description'	=> array(
+				'desc'			=> __( 'Site Description' ),
+				'readonly'		=> false,
+				'option'		=> 'description'
+			),
+			'time_zone'			=> array(
+				'desc'			=> __( 'Time Zone' ),
+				'readonly'		=> false,
+				'option'		=> 'gmt_offset'
+			),
+			'datetime_format'	=> array(
+				'desc'			=> __( 'Date/Time Format' ),
+				'readonly'		=> false,
+				'option'		=> 'datetime_format'
+			),
+			'date_format'		=> array(
+				'desc'			=> __( 'Date Format' ),
+				'readonly'		=> false,
+				'option'		=> 'date_format'
+			)
+		);
+
+		$this->site_options = apply_filters( 'xmlrpc_site_options', $this->site_options );
+	}
+
+	/**
+	 * Compiles site options into an array suitable to be passed back through the XML-RPC server
+	 *
+	 * @since 1.0
+	 * @return array The site options in an array
+	 * @param array $options An array of options to fetch and return
+	 */
+	function _getOptions( $options )
+	{
+		$data = array();
+		foreach ( $options as $option ) {
+			if ( array_key_exists( $option, $this->site_options ) ) {
+				$data[$option] = $this->site_options[$option];
+
+				// Is the value static or dynamic?
+				if ( isset( $data[$option]['option'] ) ) {
+					$data[$option]['value'] = bb_get_option( $data[$option]['option'] );
+					unset( $data[$option]['option'] );
+				}
+			}
+		}
+
+		return $data;
+	}
+
+	/**
+	 * Gets the specified site options
+	 *
+	 * @since 1.0
+	 * @return array|object An array containing the specified options when successfully executed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param array $args[2] The options to be retrieved, when omitted the method returns all options (optional)
+	 *
+	 * XML-RPC request to get all site options
+	 * <methodCall>
+	 *     <methodName>bb.getOptions</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 *
+	 * XML-RPC request to get the site name and site description
+	 * <methodCall>
+	 *     <methodName>bb.getOptions</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><array>
+	 *             <data><value><string>site_name</string></value></data>
+	 *             <data><value><string>site_description</string></value></data>
+	 *         </array></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_getOptions( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.getOptions' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		if ( $this->auth_readonly ) {
+			$user = $this->authenticate( $username, $password );
+		}
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.getOptions' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// If there are parameters supplied then make sure they are in an array
+		$options = isset( $args[2] ) ? (array) $args[2] : false;
+
+		// If no specific options where asked for, return all of them
+		if ( !$options || !count( $options ) ) {
+			$options = array_keys( $this->site_options );
+		}
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.getOptions' );
+
+		return $this->_getOptions( $options );
+	}
+
+	/**
+	 * Sets the specified site options to the specified values
+	 *
+	 * @since 1.0
+	 * @return array|object An array containing the specified options when successfully executed or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The username for authentication
+	 * @param string $args[1] The password for authentication
+	 * @param array $args[2] The options to be updated along with the new value of the option
+	 *
+	 * XML-RPC request to set the site name and site description
+	 * <methodCall>
+	 *     <methodName>bb.setOptions</methodName>
+	 *     <params>
+	 *         <param><value><string>joeblow</string></value></param>
+	 *         <param><value><string>123password</string></value></param>
+	 *         <param><value><struct>
+	 *             <member>
+	 *                 <name>site_name</name>
+	 *                 <value><string>Awesome forums</string></value>
+	 *             </member>
+	 *             <member>
+	 *                 <name>site_description</name>
+	 *                 <value><string>My totally awesome forums will kick your butt</string></value>
+	 *             </member>
+	 *         </struct></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function bb_setOptions( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'bb.setOptions' );
+
+		// Escape args
+		$this->escape( $args );
+
+		// Get the login credentials
+		$username = $args[0];
+		$password = (string) $args[1];
+
+		// Check the user is valid
+		$user = $this->authenticate( $username, $password, 'manage_options', __( 'You are not allowed to manage options.' ) );
+
+		do_action( 'bb_xmlrpc_call_authenticated', 'bb.setOptions' );
+
+		// If an error was raised by authentication or by an action then return it
+		if ( $this->error ) {
+			return $this->error;
+		}
+
+		// Make sure there is something for us to do
+		if ( !$args[2] || !is_array( $args[2] ) || !count( $args[2] ) ) {
+			$this->error = new IXR_Error( 400, __( 'The options data is invalid.' ) );
+			return $this->error;
+		}
+
+		$options = (array) $args[2];
+
+		// Update the requested options
+		foreach( $options as $o_name => $o_value ) {
+			$option_names[] = $o_name;
+
+			// If there is no value set skip it
+			if ( empty( $o_value ) ) {
+				continue;
+			}
+
+			// If the option doesn't exist skip it
+			if ( !array_key_exists( $o_name, $this->site_options ) ) {
+				continue;
+			}
+
+			// If the option is readonly skip it
+			if ( $this->site_options[$o_name]['readonly'] == true ) {
+				continue;
+			}
+
+			// Everything is good, update the option
+			bb_update_option( $this->site_options[$o_name]['option'], $o_value );
+		}
+
+		$_options = $this->_getOptions( $option_names );
+
+		do_action( 'bb_xmlrpc_call_return', 'bb.setOptions' );
+
+		// Now return the updated values
+		return $_options;
+	}
+
+
+
+	/**
+	 * Pingback XML-RPC methods
+	 */
+
+	/**
+	 * Processes pingback requests
+	 *
+	 * @since 1.0
+	 * @link http://www.hixie.ch/specs/pingback/pingback
+	 * @return string|object A message of success or an IXR_Error object on failure
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The full URI of the post where the pingback is being sent from
+	 * @param string $args[1] The full URI of the post where the pingback is being sent to
+	 *
+	 * XML-RPC request to register a pingback
+	 * <methodCall>
+	 *     <methodName>pingback.ping</methodName>
+	 *     <params>
+	 *         <param><value><string>http://example.org/2008/09/post-containing-a-link/</string></value></param>
+	 *         <param><value><string>http://example.com/2008/08/post-being-linked-to/</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function pingback_ping( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'pingback.ping' );
+
+		$this->escape( $args );
+
+		// No particular need to sanitise
+		$link_from = (string) $args[0];
+		$link_to   = (string) $args[1];
+
+		// Tidy up ampersands in the URLs
+		$link_from = str_replace( '&amp;', '&', $link_from );
+		$link_to   = str_replace( '&amp;', '&', $link_to );
+		$link_to   = str_replace( '&', '&amp;', $link_to );
+
+		// Check if the topic linked to is in our site - a little more strict than WordPress, doesn't pull out the www if added
+		if ( !bb_match_domains( $link_to, bb_get_uri() ) ) {
+			// These are not the droids you are looking for
+			$this->error = new IXR_Error( 0, __( 'This is not the site you are trying to pingback.' ) );
+			return $this->error;
+		}
+
+		// Get the topic
+		if ( $topic_to = bb_get_topic_from_uri( $link_to ) ) {
+			// Topics shouldn't ping themselves
+			if ( $topic_from = bb_get_topic_from_uri( $link_from ) ) {
+				if ( $topic_from->topic_id === $topic_to->topic_id ) {
+					$this->error = new IXR_Error( 0, __( 'The source URL and the target URL cannot both point to the same resource.' ) );
+					return $this->error;
+				}
+			}
+		} else {
+			$this->error = new IXR_Error ( 33, __( 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.' ) );
+			return $this->error;
+		}
+
+		// Let's check that the remote site didn't already pingback this entry
+		$query = new BB_Query( 'post', array( 'topic_id' => $topic_to->topic_id, 'append_meta' => true ), 'get_thread' );
+		$posts_to = $query->results;
+		unset( $query );
+
+		// Make sure we have some posts in the topic, this error should never happen really
+		if ( !$posts_to || !is_array( $posts_to ) || !count( $posts_to ) ) {
+			$this->error = new IXR_Error( 0, __( 'The specified target topic does not contain any posts.' ) );
+			return $this->error;
+		}
+
+		// Check if we already have a pingback from this URL
+		foreach ( $posts_to as $post ) {
+			if ( isset( $post->pingback_uri ) && trim( $post->pingback_uri ) === trim( $link_from ) ) {
+				$this->error = new IXR_Error( 48, __( 'The pingback has already been registered.' ) );
+				return $this->error;
+			}
+		}
+		unset( $posts_to, $post );
+
+		// Give time for the server sending the pingback to finish publishing it's post
+		sleep(1);
+
+		// Let's check the remote site for valid URL and content
+		$link_from_source = wp_remote_fopen( $link_from );
+		if ( !$link_from_source ) {
+			$this->error = new IXR_Error( 16, __( 'The source URL does not exist.' ) );
+			return $this->error;
+		}
+
+		// Allow plugins to filter here
+		$link_from_source = apply_filters( 'bb_pre_remote_source', $link_from_source, $link_to );
+
+		// Work around bug in strip_tags()
+		$link_from_source = str_replace( '<!DOC', '<DOC', $link_from_source );
+
+		// Normalize spaces
+		$link_from_source = preg_replace( '/[\s\r\n\t]+/', ' ', $link_from_source );
+
+		// Turn certain elements to double line returns
+		$link_from_source = preg_replace( "/ <(h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^>]*>/", "\n\n", $link_from_source );
+
+		// Find the title of the page
+		preg_match( '|<title>([^<]*?)</title>|is', $link_from_source, $link_from_title );
+		$link_from_title = $link_from_title[1];
+		if ( empty( $link_from_title ) ) {
+			$this->error = new IXR_Error( 32, __( 'We cannot find a title on that page.' ) );
+			return $this->error;
+		}
+
+		// Strip out all tags except anchors
+		$link_from_source = strip_tags( $link_from_source, '<a>' ); // just keep the tag we need
+
+		// Split the source into paragraphs
+		$link_from_paragraphs = explode( "\n\n", $link_from_source );
+
+		// Prepare the link to search for in preg_match() once here
+		$preg_target = preg_quote( $link_to );
+
+		// Loop through the paragraphs looking for the context for the url
+		foreach ( $link_from_paragraphs as $link_from_paragraph ) {
+			// The url exists
+			if ( strpos( $link_from_paragraph, $link_to ) !== false ) {
+				// But is it in an anchor tag
+				preg_match(
+					"|<a[^>]+?" . $preg_target . "[^>]*>([^>]+?)</a>|",
+					$link_from_paragraph,
+					$context
+				);
+				// If the URL isn't in an anchor tag, keep looking
+				if ( empty( $context ) ) {
+					continue;
+				}
+
+				// We're going to use this fake tag to mark the context in a bit
+				// the marker is needed in case the link text appears more than once in the paragraph
+				$excerpt = preg_replace( '|\</?wpcontext\>|', '', $link_from_paragraph );
+
+				// Prevent really long link text
+				if ( strlen( $context[1] ) > 100 ) {
+					$context[1] = substr( $context[1], 0, 100 ) . '...';
+				}
+
+				// Set up the marker around the context
+				$marker = '<wpcontext>' . $context[1] . '</wpcontext>';
+				// Swap out the link for our marker
+				$excerpt = str_replace( $context[0], $marker, $excerpt );
+				// Strip all tags except for our context marker
+				$excerpt = trim( strip_tags( $excerpt, '<wpcontext>' ) );
+				// Make the marker safe for use in regexp
+				$preg_marker = preg_quote( $marker );
+				// Reduce the excerpt to only include 100 characters on either side of the link
+				$excerpt = preg_replace( "|.*?\s(.{0,100}" . $preg_marker . "{0,100})\s.*|s", '$1', $excerpt );
+				// Strip tags again, to remove the marker wrapper
+				$excerpt = strip_tags( $excerpt );
+				break;
+			}
+		}
+
+		 // Make sure the link to the target was found in the excerpt
+		if ( empty( $context ) ) {
+			$this->error = new IXR_Error( 17, __( 'The source URL does not contain a link to the target URL, and so cannot be used as a source.' ) );
+			return $this->error;
+		}
+
+		// Add whacky prefix and suffix to the excerpt and sanitize
+		$excerpt = '[...] ' . esc_html( $excerpt ) . ' [...]';
+		$this->escape( $excerpt );
+
+		// Build an array of post data to insert then insert a new post
+		$postdata = array(
+			'topic_id' => $topic_to->topic_id,
+			'post_text' => $excerpt,
+			'poster_id' => 0,
+		);
+		if ( !$post_ID = bb_insert_post( $postdata ) ) {
+			$this->error = new IXR_Error( 0, __( 'The pingback could not be added.' ) );
+			return $this->error;
+		}
+
+		// Add meta to let us know where the pingback came from
+		$link_from = str_replace( '&', '&amp;', $link_from );
+		$this->escape( $link_from );
+		bb_update_postmeta( $post_ID, 'pingback_uri', $link_from );
+
+		// Add the title to meta
+		$this->escape( $link_from_title );
+		bb_update_postmeta( $post_ID, 'pingback_title', $link_from_title );
+
+		// Action for plugins and what not
+		do_action( 'bb_pingback_post', $post_ID );
+
+		// Return success message, complete with emoticon
+		return sprintf( __( 'Pingback from %1$s to %2$s registered. Keep the web talking! :-)' ), $link_from, $link_to );
+	}
+
+
+
+	/**
+	 * Returns an array of URLs that pingbacked the given URL
+	 *
+	 * @since 1.0
+	 * @link http://www.aquarionics.com/misc/archives/blogite/0198.html
+	 * @return array The array of URLs that pingbacked the given topic
+	 * @param array $args Arguments passed by the XML-RPC call
+	 * @param string $args[0] The full URI of the post where the pingback is being sent from
+	 * @param string $args[1] The full URI of the post where the pingback is being sent to
+	 *
+	 * XML-RPC request to get all pingbacks on a topic
+	 * <methodCall>
+	 *     <methodName>pingback.ping</methodName>
+	 *     <params>
+	 *         <param><value><string>http://example.com/2008/08/post-tobe-queried/</string></value></param>
+	 *     </params>
+	 * </methodCall>
+	 */
+	function pingback_extensions_getPingbacks( $args )
+	{
+		do_action( 'bb_xmlrpc_call', 'pingback.extensions.getPingbacks' );
+
+		$this->escape( $args );
+
+		// Don't accept arrays of arguments
+		if ( is_array( $args ) ) {
+			$this->error = new IXR_Error( 404, __( 'The requested method only accepts one parameter.' ) );
+			return $this->error;
+		} else {
+			$url = (string) $args;
+		}
+
+		// Tidy up ampersands in the URI
+		$url = str_replace( '&amp;', '&', $url );
+		$url = str_replace( '&', '&amp;', $url );
+
+		// Check if the URI is in our site
+		if ( !bb_match_domains( $url, bb_get_uri() ) ) {
+			// These are not the droids you are looking for
+			$this->error = new IXR_Error( 0, __( 'The specified target URL is not on this domain.' ) );
+			return $this->error;
+		}
+
+		// Make sure the specified URI is in fact associated with a topic
+		if ( !$topic = bb_get_topic_from_uri( $url ) ) {
+			$this->error = new IXR_Error( 33, __( 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.' ) );
+			return $this->error;
+		}
+
+		// Grab the posts from the topic
+		$query = new BB_Query( 'post', array( 'topic_id' => $topic_to->topic_id, 'append_meta' => true ), 'get_thread' );
+		$posts_to = $query->results;
+		unset( $query );
+
+		// Check for pingbacks in the post meta data
+		$pingbacks = array();
+		foreach ( $posts_to as $post ) {
+			if ( isset( $post->pingback_uri ) ) {
+				$pingbacks[] = $post->pingback_uri;
+			}
+		}
+		unset( $post );
+
+		// This will return an empty array on failure
+		return $pingbacks;
+	}
+}
+
+
+
+/**
+ * Initialises the XML-RPC server
+ *
+ * @since 1.0
+ * @var object The instance of the XML-RPC server class
+ */
+$bb_xmlrpc_server = new BB_XMLRPC_Server();
diff --git a/wp-content/plugins/buddypress/bp-forums/bp-forums-admin.php b/wp-content/plugins/buddypress/bp-forums/bp-forums-admin.php
new file mode 100644
index 0000000000000000000000000000000000000000..cbed8d981fa2c7032411c5035fae8680333cde30
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bp-forums-admin.php
@@ -0,0 +1,258 @@
+<?php
+
+function bp_forums_bbpress_admin() {
+	global $bp;
+?>
+	<div class="wrap">
+
+		<h2><?php _e( 'Forums Setup', 'buddypress' ) ?></h2>
+
+		<?php if ( isset( $_POST['submit'] ) ) : ?>
+			<div id="message" class="updated fade">
+				<p><?php _e( 'Settings Saved.', 'buddypress' ) ?></p>
+			</div>
+		<?php endif; ?>
+
+		<?php
+
+		if ( isset( $_REQUEST['reinstall'] ) || !bp_forums_is_installed_correctly() ) {
+			update_site_option( 'bb-config-location', false );
+			bp_forums_bbpress_install_wizard();
+		} else { ?>
+			<p><?php printf( __( 'bbPress forum integration in BuddyPress has been set up correctly. If you are having problems you can <a href="%s" title="Reinstall bbPress">re-install</a>', 'buddypress' ), site_url( 'wp-admin/admin.php?page=bb-forums-setup&reinstall=1' ) ); ?>
+			<p><?php _e( 'NOTE: The forums directory will only work if your bbPress tables are in the same database as your WordPress tables. If you are not using an existing bbPress install you can ignore this message.', 'buddypress' ) ?></p>
+		<?php
+		}
+		?>
+	</div>
+<?php
+}
+
+function bp_forums_bbpress_install_wizard() {
+	$post_url = site_url( 'wp-admin/admin.php?page=bb-forums-setup' );
+
+	switch( $_REQUEST['step'] ) {
+		case 'existing':
+			if ( 1 == (int)$_REQUEST['doinstall'] ) {
+				if ( !bp_forums_configure_existing_install() ) {
+					_e( 'The bb-config.php file was not found at that location, please try again.', 'buddypress' );
+				} else {
+					?>
+					<h3><?php _e( 'Forums were set up correctly using your existing bbPress install!', 'buddypress' ) ?></h3>
+					<p><?php _e( 'BuddyPress will now use its internal copy of bbPress to run the forums on your site. If you wish, you can remove your old bbPress installation files, as long as you keep the bb-config.php file in the same location.', 'buddypress' ) ?></p><?php
+				}
+			} else {
+				?>
+					<form action="" method="post">
+						<h3><?php _e( 'Existing bbPress Installation', 'buddypress' ) ?></h3>
+						<p><?php _e( "BuddyPress can make use of your existing bbPress install. Just provide the location of your <code>bb-config.php</code> file, and BuddyPress will do the rest.", 'buddypress' ) ?></p>
+						<p><label><code>bb-config.php</code> file location:</label><br /><input style="width: 50%" type="text" name="bbconfigloc" id="bbconfigloc" value="<?php echo str_replace( 'buddypress', '', $_SERVER['DOCUMENT_ROOT'] ) ?>" /></p>
+						<p><input type="submit" class="button-primary" value="<?php _e( 'Complete Installation', 'buddypress' ) ?>" /></p>
+						<input type="hidden" name="step" value="existing" />
+						<input type="hidden" name="doinstall" value="1" />
+						<?php wp_nonce_field( 'bp_forums_existing_install_init' ) ?>
+					</form>
+				<?php
+			}
+		break;
+
+		case 'new':
+			if ( 1 == (int)$_REQUEST['doinstall'] ) {
+				$result = bp_forums_bbpress_install();
+
+				switch ( $result ) {
+					case 1:
+						_e( 'All done! Configuration settings have been saved to the file <code>bb-config.php</code> in the root of your WordPress install.', 'buddypress' );
+						break;
+					default:
+						// Just write the contents to screen
+						_e( 'A configuration file could not be created. No problem, but you will need to save the text shown below into a file named <code>bb-config.php</code> in the root directory of your WordPress installation before you can start using the forum functionality.', 'buddypress' );
+						?><code style="display:block; margin-top: 30px;"><pre><?php echo htmlspecialchars( $result ) ?></pre></code><?php
+						break;
+				}
+			} else {
+			?>
+				<h3><?php _e( 'New bbPress Installation', 'buddypress' ) ?></h3>
+				<p><?php _e( "You've decided to set up a new installation of bbPress for forum management in BuddyPress. This is very simple and is usually just a one click
+				process. When you're ready, hit the link below.", 'buddypress' ) ?></p>
+				<p><a class="button-primary" href="<?php echo wp_nonce_url( $post_url . '&step=new&doinstall=1', 'bp_forums_new_install_init' ) ?>"><?php _e( 'Complete Installation', 'buddypress' ) ?></a></p>
+			<?php
+			}
+		break;
+
+		default:
+			if ( !file_exists( BP_PLUGIN_DIR . '/bp-forums/bbpress/' ) ) { ?>
+				<div id="message" class="error">
+					<p><?php printf( __( 'bbPress files were not found. To install the forums component you must download a copy of bbPress and make sure it is in the folder: "%s"', 'buddypress' ), 'wp-content/plugins/buddypress/bp-forums/bbpress/' ) ?></p>
+				</div>
+			<?php } else { ?>
+
+				<p><?php _e( 'Forums in BuddyPress make use of a bbPress installation to function. You can choose to either let BuddyPress set up a new bbPress install, or use an already existing bbPress install. Please choose one of the options below.', 'buddypress' ) ?></p>
+
+				<a class="button" href="<?php echo $post_url . '&step=new' ?>"><?php _e( 'Set up a new bbPress installation', 'buddypress' ) ?></a> &nbsp;
+				<a class="button" href="<?php echo $post_url . '&step=existing' ?>"><?php _e( 'Use an existing bbPress installation', 'buddypress' ) ?></a>
+
+			<?php }
+		break;
+	}
+}
+
+function bp_forums_configure_existing_install() {
+	global $wpdb, $bbdb;
+
+	check_admin_referer( 'bp_forums_existing_install_init' );
+
+	/* Sanitize $_REQUEST['bbconfigloc'] */
+	$_REQUEST['bbconfigloc'] = apply_filters( 'bp_forums_bbconfig_location', $_REQUEST['bbconfigloc'] );
+
+	if ( false === strpos( $_REQUEST['bbconfigloc'], 'bb-config.php' ) ) {
+		if ( '/' != substr( $_REQUEST['bbconfigloc'], -1, 1 ) )
+			$_REQUEST['bbconfigloc'] .= '/';
+
+		$_REQUEST['bbconfigloc'] .= 'bb-config.php';
+	}
+
+	if ( !file_exists( $_REQUEST['bbconfigloc'] ) )
+		return false;
+
+	update_site_option( 'bb-config-location', $_REQUEST['bbconfigloc'] );
+
+	return true;
+}
+
+function bp_forums_bbpress_install() {
+	global $wpdb, $bbdb, $bp;
+
+	check_admin_referer( 'bp_forums_new_install_init' );
+
+	/* Create the bb-config.php file */
+	$initial_write = bp_forums_bbpress_write(
+		BP_PLUGIN_DIR . '/bp-forums/bbpress/bb-config-sample.php',
+		ABSPATH . 'bb-config.php',
+		array(
+			"define( 'BBDB_NAME',"  		=> array( "'bbpress'",                     	"'" . DB_NAME . "'" ),
+			"define( 'BBDB_USER',"  		=> array( "'username'",                    	"'" . DB_USER . "'" ),
+			"define( 'BBDB_PASSWO"  		=> array( "'password'",                    	"'" . DB_PASSWORD . "'" ),
+			"define( 'BBDB_HOST',"  		=> array( "'localhost'",                   	"'" . DB_HOST . "'" ),
+			"define( 'BBDB_CHARSE"  		=> array( "'utf8'",                        	"'" . DB_CHARSET . "'" ),
+			"define( 'BBDB_COLLAT"  		=> array( "''",                            	"'" . DB_COLLATE . "'" ),
+			"define( 'BB_AUTH_KEY"  		=> array( "'put your unique phrase here'",  "'" . addslashes( AUTH_KEY ) . "'" ),
+			"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_'",                          "'" . $bp->table_prefix . "bb_'" ),
+			"define( 'BB_LANG', '" 			=> array( "''",                          	"'" . WPLANG . "'" )
+		)
+	);
+
+	/* Add the custom user and usermeta entries to the config file */
+	if ( $initial_write == 1 ) {
+		$file = file_get_contents( ABSPATH . 'bb-config.php' );
+	} else {
+		$file = &$initial_write;
+	}
+
+	$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' ) . '\';';
+
+	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 ) . '\');';
+
+	if ( defined( '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\n" . 'define(\'WP_AUTH_COOKIE_VERSION\', 2);';
+	$file .= "\n\n" . '?>';
+
+	if ( $initial_write == 1 ) {
+		$file_handle = fopen( ABSPATH . 'bb-config.php', 'w' );
+		fwrite( $file_handle, $file );
+		fclose( $file_handle );
+	} else {
+		$initial_write = $file;
+	}
+
+	update_site_option( 'bb-config-location', ABSPATH . 'bb-config.php' );
+	return $initial_write;
+}
+
+function bp_forums_bbpress_write( $file_source, $file_target, $alterations ) {
+	if ( !$file_source || !file_exists( $file_source ) || !is_file( $file_source ) ) {
+		return -1;
+	}
+
+	if ( !$file_target ) {
+		$file_target = $file_source;
+	}
+
+	if ( !$alterations || !is_array( $alterations ) ) {
+		return -2;
+	}
+
+	// Get the existing lines in the file
+	$lines = file( $file_source );
+
+	// Initialise an array to store the modified lines
+	$modified_lines = array();
+
+	// Loop through the lines and modify them
+	foreach ( (array)$lines as $line ) {
+		if ( isset( $alterations[substr( $line, 0, 20 )] ) ) {
+			$alteration = $alterations[substr( $line, 0, 20 )];
+			$modified_lines[] = str_replace( $alteration[0], $alteration[1], $line );
+		} else {
+			$modified_lines[] = $line;
+		}
+	}
+
+	$writable = true;
+	if ( file_exists( $file_target ) ) {
+		if ( !is_writable( $file_target ) ) {
+			$writable = false;
+		}
+	} else {
+		$dir_target = dirname( $file_target );
+
+		if ( file_exists( $dir_target ) ) {
+			if ( !is_writable( $dir_target ) || !is_dir( $dir_target ) ) {
+				$writable = false;
+			}
+		} else {
+			$writable = false;
+		}
+	}
+
+	if ( !$writable )
+		return trim( join( null, $modified_lines ) );
+
+	// Open the file for writing - rewrites the whole file
+	$file_handle = fopen( $file_target, 'w' );
+
+	// Write lines one by one to avoid OS specific newline hassles
+	foreach ( (array)$modified_lines as $modified_line ) {
+		if ( false !== strpos( $modified_line, '?>' ) ) {
+			$modified_line = '?>';
+		}
+		fwrite( $file_handle, $modified_line );
+		if ( $modified_line == '?>' ) {
+			break;
+		}
+	}
+
+	// Close the config file
+	fclose( $file_handle );
+
+	@chmod( $file_target, 0666 );
+
+	return 1;
+}
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bp-forums-bbpress.php b/wp-content/plugins/buddypress/bp-forums/bp-forums-bbpress.php
new file mode 100644
index 0000000000000000000000000000000000000000..23db8c49a3434534af4dd3ebced4b2a4565d7696
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bp-forums-bbpress.php
@@ -0,0 +1,175 @@
+<?php
+
+function bp_forums_load_bbpress() {
+	global $bp, $wpdb, $wp_roles, $current_user, $wp_users_object;
+	global $bb, $bbdb, $bb_table_prefix, $bb_current_user;
+	global $bb_roles, $wp_taxonomy_object;
+
+	/* Return if we've already run this function. */
+	if ( is_object( $bbdb ) && is_object( $bb_roles ) )
+		return;
+
+	if ( !bp_forums_is_installed_correctly() )
+		return false;
+
+	define( 'BB_PATH', BP_PLUGIN_DIR . '/bp-forums/bbpress/' );
+	define( 'BACKPRESS_PATH', BP_PLUGIN_DIR . '/bp-forums/bbpress/bb-includes/backpress/' );
+	define( 'BB_URL', BP_PLUGIN_URL . '/bp-forums/bbpress/' );
+	define( 'BB_INC', 'bb-includes/' );
+
+	require_once( BB_PATH . BB_INC . 'class.bb-query.php' );
+	require_once( BB_PATH . BB_INC . 'class.bb-walker.php' );
+
+	require_once( BB_PATH . BB_INC . 'functions.bb-core.php' );
+	require_once( BB_PATH . BB_INC . 'functions.bb-forums.php' );
+	require_once( BB_PATH . BB_INC . 'functions.bb-topics.php' );
+	require_once( BB_PATH . BB_INC . 'functions.bb-posts.php' );
+	require_once( BB_PATH . BB_INC . 'functions.bb-topic-tags.php' );
+	require_once( BB_PATH . BB_INC . 'functions.bb-capabilities.php' );
+	require_once( BB_PATH . BB_INC . 'functions.bb-meta.php' );
+	require_once( BB_PATH . BB_INC . 'functions.bb-pluggable.php' );
+	require_once( BB_PATH . BB_INC . 'functions.bb-formatting.php' );
+	require_once( BB_PATH . BB_INC . 'functions.bb-template.php' );
+
+	require_once( BACKPRESS_PATH . 'class.wp-taxonomy.php' );
+	require_once( BB_PATH . BB_INC . 'class.bb-taxonomy.php' );
+
+	$bb = new stdClass();
+	require_once( $bp->forums->bbconfig );
+
+	// Setup the global database connection
+	$bbdb = new BPDB ( BBDB_USER, BBDB_PASSWORD, BBDB_NAME, BBDB_HOST );
+
+	/* Set the table names */
+	$bbdb->forums = $bb_table_prefix . 'forums';
+	$bbdb->meta = $bb_table_prefix . 'meta';
+	$bbdb->posts = $bb_table_prefix . 'posts';
+	$bbdb->terms = $bb_table_prefix . 'terms';
+	$bbdb->term_relationships = $bb_table_prefix . 'term_relationships';
+	$bbdb->term_taxonomy = $bb_table_prefix . 'term_taxonomy';
+	$bbdb->topics = $bb_table_prefix . 'topics';
+
+	if ( isset( $bb->custom_user_table ) )
+		$bbdb->users = $bb->custom_user_table;
+	else
+		$bbdb->users = $wpdb->users;
+
+	if ( isset( $bb->custom_user_meta_table ) )
+		$bbdb->usermeta = $bb->custom_user_meta_table;
+	else
+		$bbdb->usermeta = $wpdb->usermeta;
+
+	$bbdb->prefix = $bb_table_prefix;
+
+	define( 'BB_INSTALLING', false );
+
+	/* 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/includes/upgrade.php' );
+
+	require_once( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );
+
+	if ( is_object( $wp_roles ) ) {
+		$bb_roles = $wp_roles;
+		bb_init_roles( $bb_roles );
+	}
+
+	do_action( 'bb_got_roles' );
+	do_action( 'bb_init' );
+	do_action( 'init_roles' );
+
+	$bb_current_user = $current_user;
+	$wp_users_object = new BP_Forums_BB_Auth;
+
+	if ( !isset( $wp_taxonomy_object ) )
+		$wp_taxonomy_object = new BB_Taxonomy( $bbdb );
+
+	$wp_taxonomy_object->register_taxonomy( 'bb_topic_tag', 'bb_topic' );
+
+	// Set a site id if there isn't one already
+	if ( !isset( $bb->site_id ) )
+		$bb->site_id = BP_ROOT_BLOG;
+
+	/* Check if the tables are installed, if not, install them */
+	if ( !$tables_installed ) {
+		require_once( BB_PATH . 'bb-admin/includes/defaults.bb-schema.php' );
+
+		/* Backticks and "IF NOT EXISTS" break the dbDelta function. */
+		dbDelta( str_replace( ' IF NOT EXISTS', '', str_replace( '`', '', $bb_queries ) ) );
+
+		require_once( BB_PATH . 'bb-admin/includes/functions.bb-upgrade.php' );
+		bb_update_db_version();
+
+		/* Set the site admins as the keymasters */
+		$site_admins = get_site_option( 'site_admins', array('admin') );
+		foreach ( (array)$site_admins as $site_admin )
+			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' ) );
+
+		// Set the site URI
+		bb_update_option( 'uri', BB_URL );
+	}
+
+	register_shutdown_function( create_function( '', 'do_action("bb_shutdown");' ) );
+}
+add_action( 'bbpress_init', 'bp_forums_load_bbpress' );
+
+/* WP to bbP wrapper functions */
+function bb_get_current_user() { global $current_user; return $current_user; }
+function bb_get_user( $user_id ) { return get_userdata( $user_id ); }
+function bb_cache_users( $users ) {}
+
+/**
+ * bbPress needs this class for its usermeta manipulation.
+ */
+class BP_Forums_BB_Auth {
+	function update_meta( $args = '' ) {
+		$defaults = array( 'id' => 0, 'meta_key' => null, 'meta_value' => null, 'meta_table' => 'usermeta', 'meta_field' => 'user_id', 'cache_group' => 'users' );
+		$args = wp_parse_args( $args, $defaults );
+		extract( $args, EXTR_SKIP );
+
+		return update_user_meta( $id, $meta_key, $meta_value );
+	}
+}
+
+/**
+ * bbPress needs the DB class to be BPDB, but we want to use WPDB, so we can
+ * extend it and use this.
+ */
+class BPDB extends WPDB {
+	function escape_deep( $data ) {
+		if ( is_array( $data ) ) {
+			foreach ( (array) $data as $k => $v ) {
+				if ( is_array( $v ) ) {
+					$data[$k] = $this->_escape( $v );
+				} else {
+					$data[$k] = $this->_real_escape( $v );
+				}
+			}
+		} else {
+			$data = $this->_real_escape( $data );
+		}
+
+		return $data;
+	}
+}
+
+/* BBPress needs this function to convert vars */
+function backpress_convert_object( &$object, $output ) {
+	if ( is_array( $object ) ) {
+		foreach ( array_keys( $object ) as $key )
+			backpress_convert_object( $object[$key], $output );
+	} else {
+		switch ( $output ) {
+			case OBJECT  : break;
+			case ARRAY_A : $object = get_object_vars($object); break;
+			case ARRAY_N : $object = array_values(get_object_vars($object)); break;
+		}
+	}
+}
+
+
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-forums/bp-forums-filters.php b/wp-content/plugins/buddypress/bp-forums/bp-forums-filters.php
new file mode 100644
index 0000000000000000000000000000000000000000..3c34946c608b86f1e2d32d7162f7140c8bfae7d6
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bp-forums-filters.php
@@ -0,0 +1,113 @@
+<?php
+
+/* Apply WordPress defined filters */
+add_filter( 'bp_forums_bbconfig_location', 'wp_filter_kses', 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 );
+add_filter( 'bp_get_the_topic_post_content', 'bp_forums_filter_kses', 1 );
+
+add_filter( 'bp_get_the_topic_title', 'force_balance_tags' ); 
+add_filter( 'bp_get_the_topic_latest_post_excerpt', 'force_balance_tags' );
+add_filter( 'bp_get_the_topic_post_content', 'force_balance_tags' );
+
+add_filter( 'bp_get_the_topic_title', 'wptexturize' );
+add_filter( 'bp_get_the_topic_poster_name', 'wptexturize' );
+add_filter( 'bp_get_the_topic_last_poster_name', 'wptexturize' );
+add_filter( 'bp_get_the_topic_post_content', 'wptexturize' );
+add_filter( 'bp_get_the_topic_post_poster_name', 'wptexturize' );
+
+add_filter( 'bp_get_the_topic_title', 'convert_smilies' );
+add_filter( 'bp_get_the_topic_latest_post_excerpt', 'convert_smilies' );
+add_filter( 'bp_get_the_topic_post_content', 'convert_smilies' );
+
+add_filter( 'bp_get_the_topic_title', 'convert_chars' );
+add_filter( 'bp_get_the_topic_latest_post_excerpt', 'convert_chars' );
+add_filter( 'bp_get_the_topic_post_content', 'convert_chars' );
+
+add_filter( 'bp_get_the_topic_post_content', 'wpautop' );
+add_filter( 'bp_get_the_topic_latest_post_excerpt', 'wpautop' );
+
+add_filter( 'bp_get_the_topic_post_content', 'stripslashes_deep' );
+add_filter( 'bp_get_the_topic_title', 'stripslashes_deep' );
+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' );
+
+add_filter( 'bp_get_forum_topic_count_for_user', 'bp_core_number_format' );
+add_filter( 'bp_get_forum_topic_count', 'bp_core_number_format' );
+
+add_filter( 'bp_get_the_topic_title', 'bp_forums_make_nofollow_filter' );
+add_filter( 'bp_get_the_topic_latest_post_excerpt', 'bp_forums_make_nofollow_filter' );
+add_filter( 'bp_get_the_topic_post_content', 'bp_forums_make_nofollow_filter' );
+
+function bp_forums_filter_kses( $content ) {
+	global $allowedtags;
+
+	$forums_allowedtags = $allowedtags;
+	$forums_allowedtags['span'] = array();
+	$forums_allowedtags['span']['class'] = array();
+	$forums_allowedtags['div'] = array();
+	$forums_allowedtags['div']['class'] = array();
+	$forums_allowedtags['div']['id'] = array();
+	$forums_allowedtags['a']['class'] = array();
+	$forums_allowedtags['img'] = array();
+	$forums_allowedtags['br'] = array();
+	$forums_allowedtags['p'] = array();
+	$forums_allowedtags['img']['src'] = array();
+	$forums_allowedtags['img']['alt'] = array();
+	$forums_allowedtags['img']['class'] = array();
+	$forums_allowedtags['img']['width'] = array();
+	$forums_allowedtags['img']['height'] = array();
+	$forums_allowedtags['img']['class'] = array();
+	$forums_allowedtags['img']['id'] = array();
+	$forums_allowedtags['code'] = array();
+	$forums_allowedtags['blockquote'] = array();
+
+	$forums_allowedtags = apply_filters( 'bp_forums_allowed_tags', $forums_allowedtags );
+	return wp_kses( $content, $forums_allowedtags );
+}
+
+function bp_forums_filter_tag_link( $link, $tag, $page, $context ) {
+	global $bp;
+
+	return apply_filters( 'bp_forums_filter_tag_link', $bp->root_domain . '/' . $bp->forums->slug . '/tag/' . $tag . '/' );
+}
+add_filter( 'bb_get_tag_link', 'bp_forums_filter_tag_link', 10, 4);
+
+function bp_forums_make_nofollow_filter( $text ) {
+	return preg_replace_callback( '|<a (.+?)>|i', 'bp_forums_make_nofollow_filter_callback', $text );
+}
+	function bp_forums_make_nofollow_filter_callback( $matches ) {
+		$text = $matches[1];
+		$text = str_replace( array( ' rel="nofollow"', " rel='nofollow'"), '', $text );
+		return "<a $text rel=\"nofollow\">";
+	}
+
+/**
+ * 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' );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-forums/bp-forums-templatetags.php b/wp-content/plugins/buddypress/bp-forums/bp-forums-templatetags.php
new file mode 100644
index 0000000000000000000000000000000000000000..791240596e765b30a6f2f42c22ed4feb1894975e
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-forums/bp-forums-templatetags.php
@@ -0,0 +1,1105 @@
+<?php
+
+class BP_Forums_Template_Forum {
+	var $current_topic = -1;
+	var $topic_count;
+	var $topics;
+	var $topic;
+
+	var $forum_id;
+
+	var $in_the_loop;
+
+	var $pag_page;
+	var $pag_num;
+	var $pag_links;
+	var $total_topic_count;
+
+	var $single_topic = false;
+
+	var $sort_by;
+	var $order;
+
+	function BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, $no_stickies, $search_terms ) {
+		global $bp;
+
+		$this->pag_page     = isset( $_REQUEST['p'] ) ? intval( $_REQUEST['p'] ) : $page;
+		$this->pag_num      = isset( $_REQUEST['n'] ) ? intval( $_REQUEST['n'] ) : $per_page;
+		$this->type         = $type;
+		$this->search_terms = $search_terms;
+		$this->forum_id     = $forum_id;
+
+		switch ( $type ) {
+			case 'newest': default:
+				$this->topics = bp_forums_get_forum_topics( array( 'user_id' => $user_id, 'forum_id' => $forum_id, 'filter' => $search_terms, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $no_stickies ) );
+				break;
+
+			case 'popular':
+				$this->topics = bp_forums_get_forum_topics( array( 'user_id' => $user_id, 'type' => 'popular', 'filter' => $search_terms, 'forum_id' => $forum_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $no_stickies ) );
+				break;
+
+			case 'unreplied':
+				$this->topics = bp_forums_get_forum_topics( array( 'user_id' => $user_id, 'type' => 'unreplied', 'filter' => $search_terms, 'forum_id' => $forum_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $no_stickies ) );
+				break;
+
+			case 'tags':
+				$this->topics = bp_forums_get_forum_topics( array( 'user_id' => $user_id, 'type' => 'tags', 'filter' => $search_terms, 'forum_id' => $forum_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $no_stickies ) );
+				break;
+		}
+
+		$this->topics = apply_filters( 'bp_forums_template_topics', $this->topics, $type, $forum_id, $per_page, $max, $no_stickies );
+
+		if ( !(int)$this->topics ) {
+			$this->topic_count       = 0;
+			$this->total_topic_count = 0;
+		} else {
+			if ( $forum_id ) {
+				$topic_count = bp_forums_get_forum( $forum_id );
+				$topic_count = (int)$topic_count->topics;
+			} else if ( function_exists( 'groups_total_public_forum_topic_count' ) ) {
+				$topic_count = (int)groups_total_public_forum_topic_count( $type );
+			} else {
+				$topic_count = count( $this->topics );
+			}
+
+			if ( !$max || $max >= $topic_count ) {
+				$this->total_topic_count = $topic_count;
+			} else {
+				$this->total_topic_count = (int)$max;
+			}
+
+			if ( $max ) {
+				if ( $max >= count($this->topics) ) {
+					$this->topic_count = count( $this->topics );
+				} else {
+					$this->topic_count = (int)$max;
+				}
+			} else {
+				$this->topic_count = count( $this->topics );
+			}
+		}
+
+		$this->topic_count       = apply_filters( 'bp_forums_template_topic_count', $this->topic_count, &$topics, $type, $forum_id, $per_page, $max, $no_stickies );
+		$this->total_topic_count = apply_filters( 'bp_forums_template_total_topic_count', $this->total_topic_count, $this->topic_count, &$topics, $type, $forum_id, $per_page, $max, $no_stickies );
+
+		if ( !$no_stickies ) {
+			// Place stickies at the top - not sure why bbPress doesn't do this?
+			foreach( (array)$this->topics as $topic ) {
+				if ( 1 == (int)$topic->topic_sticky ) {
+					$stickies[] = $topic;
+				} else {
+					$standard[] = $topic;
+				}
+			}
+
+			$this->topics = array_merge( (array)$stickies, (array)$standard );
+		}
+
+		// Fetch extra information for topics, so we don't have to query inside the loop
+		$this->topics = bp_forums_get_topic_extras( &$this->topics );
+
+		if ( (int)$this->total_topic_count && (int)$this->pag_num ) {
+			$this->pag_links = paginate_links( array(
+				'base'      => add_query_arg( array( 'p' => '%#%', 'n' => $this->pag_num ) ),
+				'format'    => '',
+				'total'     => ceil( (int)$this->total_topic_count / (int)$this->pag_num),
+				'current'   => $this->pag_page,
+				'prev_text' => '&larr;',
+				'next_text' => '&rarr;',
+				'mid_size'  => 1
+			) );
+		}
+	}
+
+	function has_topics() {
+		if ( $this->topic_count )
+			return true;
+
+		return false;
+	}
+
+	function next_topic() {
+		$this->current_topic++;
+		$this->topic = $this->topics[$this->current_topic];
+
+		return $this->topic;
+	}
+
+	function rewind_topics() {
+		$this->current_topic = -1;
+		if ( $this->topic_count > 0 ) {
+			$this->topic = $this->topics[0];
+		}
+	}
+
+	function user_topics() {
+		if ( $this->current_topic + 1 < $this->topic_count ) {
+			return true;
+		} elseif ( $this->current_topic + 1 == $this->topic_count ) {
+			do_action('loop_end');
+			// Do some cleaning up after the loop
+			$this->rewind_topics();
+		}
+
+		$this->in_the_loop = false;
+		return false;
+	}
+
+	function the_topic() {
+		global $topic;
+
+		$this->in_the_loop = true;
+		$this->topic = $this->next_topic();
+		$this->topic = (object)$this->topic;
+
+		if ( $this->current_topic == 0 ) // loop has just started
+			do_action('loop_start');
+	}
+}
+
+function bp_has_forum_topics( $args = '' ) {
+	global $forum_template, $bp;
+
+	/***
+	 * Set the defaults based on the current page. Any of these will be overridden
+	 * if arguments are directly passed into the loop. Custom plugins should always
+	 * pass their parameters directly to the loop.
+	 */
+	$type = 'newest';
+	$user_id = false;
+	$forum_id = false;
+	$search_terms = false;
+	$no_stickies = 'all';
+
+	/* User filtering */
+	if ( !empty( $bp->displayed_user->id ) )
+		$user_id = $bp->displayed_user->id;
+
+	/* If we're in a single group, set this group's forum_id */
+	if ( !$forum_id && $bp->groups->current_group ) {
+		$bp->groups->current_group->forum_id = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' );
+
+		/* If it turns out there is no forum for this group, return false so we don't fetch all global topics */
+		if ( !$bp->groups->current_group->forum_id )
+			return false;
+
+		$forum_id = $bp->groups->current_group->forum_id;
+	}
+
+	/* If $_GET['fs'] is set, let's auto populate the search_terms var */
+	if ( $bp->is_directory && !empty( $_GET['fs'] ) )
+		$search_terms = $_GET['fs'];
+
+	/* Show stickies on a group forum */
+	if ( $bp->groups->current_group )
+		$no_stickies = null;
+
+	$defaults = array(
+		'type' => $type,
+		'forum_id' => $forum_id,
+		'user_id' => $user_id,
+		'page' => 1,
+		'per_page' => 20,
+		'max' => false,
+		'no_stickies' => $no_stickies,
+		'search_terms' => $search_terms
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r );
+
+	/* If we're viewing a tag URL in the directory, let's override the type and set it to tags and the filter to the tag name */
+	if ( 'tag' == $bp->current_action && !empty( $bp->action_variables[0] ) ) {
+		$search_terms = $bp->action_variables[0];
+		$type = 'tags';
+	}
+
+	$forum_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, $no_stickies, $search_terms );
+	return apply_filters( 'bp_has_topics', $forum_template->has_topics(), &$forum_template );
+}
+
+function bp_forum_topics() {
+	global $forum_template;
+	return $forum_template->user_topics();
+}
+
+function bp_the_forum_topic() {
+	global $forum_template;
+	return $forum_template->the_topic();
+}
+
+function bp_the_topic_id() {
+	echo bp_get_the_topic_id();
+}
+	function bp_get_the_topic_id() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_id', $forum_template->topic->topic_id );
+	}
+
+function bp_the_topic_title() {
+	echo bp_get_the_topic_title();
+}
+	function bp_get_the_topic_title() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_title', stripslashes( $forum_template->topic->topic_title ) );
+	}
+
+function bp_the_topic_slug() {
+	echo bp_get_the_topic_slug();
+}
+	function bp_get_the_topic_slug() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_slug', $forum_template->topic->topic_slug );
+	}
+
+function bp_the_topic_text() {
+	echo bp_get_the_topic_text();
+}
+	function bp_get_the_topic_text() {
+		global $forum_template;
+
+		$post = bb_get_first_post( (int)$forum_template->topic->topic_id, false );
+		return apply_filters( 'bp_get_the_topic_text', esc_attr( $post->post_text ) );
+	}
+
+function bp_the_topic_poster_id() {
+	echo bp_get_the_topic_poster_id();
+}
+	function bp_get_the_topic_poster_id() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_poster_id', $forum_template->topic->topic_poster );
+	}
+
+function bp_the_topic_poster_avatar( $args = '' ) {
+	echo bp_get_the_topic_poster_avatar( $args );
+}
+	function bp_get_the_topic_poster_avatar( $args = '' ) {
+		global $forum_template;
+
+		$defaults = array(
+			'type' => 'thumb',
+			'width' => false,
+			'height' => false,
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		return apply_filters( 'bp_get_the_topic_poster_avatar', bp_core_fetch_avatar( array( 'item_id' => $forum_template->topic->topic_poster, 'type' => $type, 'width' => $width, 'height' => $height ) ) );
+	}
+
+function bp_the_topic_poster_name() {
+	echo bp_get_the_topic_poster_name();
+}
+	function bp_get_the_topic_poster_name() {
+		global $forum_template;
+
+		$poster_id = ( empty( $forum_template->topic->poster_id ) ) ? $forum_template->topic->topic_poster : $forum_template->topic->poster_id;
+
+		if ( !$name = bp_core_get_userlink( $poster_id ) )
+			return __( 'Deleted User', 'buddypress' );
+
+		return apply_filters( 'bp_get_the_topic_poster_name', $name );
+	}
+
+function bp_the_topic_object_id() {
+	echo bp_get_the_topic_object_id();
+}
+	function bp_get_the_topic_object_id() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_object_id', $forum_template->topic->object_id );
+	}
+
+function bp_the_topic_object_name() {
+	echo bp_get_the_topic_object_name();
+}
+	function bp_get_the_topic_object_name() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_object_name', $forum_template->topic->object_name );
+	}
+
+function bp_the_topic_object_slug() {
+	echo bp_get_the_topic_object_slug();
+}
+	function bp_get_the_topic_object_slug() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_object_slug', $forum_template->topic->object_slug );
+	}
+
+function bp_the_topic_object_permalink() {
+	echo bp_get_the_topic_object_permalink();
+}
+	function bp_get_the_topic_object_permalink() {
+		global $bp, $forum_template;
+
+		/* Currently this will only work with group forums, extended support in the future */
+		return apply_filters( 'bp_get_the_topic_object_permalink', $bp->root_domain . '/' . BP_GROUPS_SLUG . '/' . $forum_template->topic->object_slug . '/forum/' );
+	}
+
+function bp_the_topic_last_poster_name() {
+	echo bp_get_the_topic_last_poster_name();
+}
+	function bp_get_the_topic_last_poster_name() {
+		global $forum_template;
+
+		if ( !$domain = bp_core_get_user_domain( $forum_template->topic->topic_last_poster, $forum_template->topic->topic_last_poster_nicename, $forum_template->topic->topic_last_poster_login ) )
+			return __( 'Deleted User', 'buddypress' );
+
+		return apply_filters( 'bp_get_the_topic_last_poster_name', '<a href="' . $domain . '">' . $forum_template->topic->topic_last_poster_displayname . '</a>' );
+	}
+
+function bp_the_topic_object_avatar( $args = '' ) {
+	echo bp_get_the_topic_object_avatar( $args );
+}
+	function bp_get_the_topic_object_avatar( $args = '' ) {
+		global $forum_template;
+
+		$defaults = array(
+			'type' => 'thumb',
+			'width' => false,
+			'height' => false,
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		return apply_filters( 'bp_get_the_topic_object_avatar', bp_core_fetch_avatar( array( 'item_id' => $forum_template->topic->object_id, 'type' => $type, 'object' => 'group', 'width' => $width, 'height' => $height ) ) );
+	}
+
+function bp_the_topic_last_poster_avatar( $args = '' ) {
+	echo bp_get_the_topic_last_poster_avatar( $args );
+}
+	function bp_get_the_topic_last_poster_avatar( $args = '' ) {
+		global $forum_template;
+
+		$defaults = array(
+			'type' => 'thumb',
+			'width' => false,
+			'height' => false,
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		return apply_filters( 'bp_get_the_topic_last_poster_avatar', bp_core_fetch_avatar( array( 'email' => $forum_template->topic->topic_last_poster_email, 'item_id' => $forum_template->topic->topic_last_poster, 'type' => $type, 'width' => $width, 'height' => $height ) ) );
+	}
+
+function bp_the_topic_start_time() {
+	echo bp_get_the_topic_start_time();
+}
+	function bp_get_the_topic_start_time() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_start_time', $forum_template->topic->topic_start_time );
+	}
+
+function bp_the_topic_time() {
+	echo bp_get_the_topic_time();
+}
+	function bp_get_the_topic_time() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_time', $forum_template->topic->topic_time );
+	}
+
+function bp_the_topic_forum_id() {
+	echo bp_get_the_topic_forum_id();
+}
+	function bp_get_the_topic_forum_id() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_forum_id', $forum_template->topic->topic_forum_id );
+	}
+
+function bp_the_topic_status() {
+	echo bp_get_the_topic_status();
+}
+	function bp_get_the_topic_status() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_status', $forum_template->topic->topic_status );
+	}
+
+function bp_the_topic_is_topic_open() {
+	echo bp_get_the_topic_is_topic_open();
+}
+	function bp_get_the_topic_is_topic_open() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_is_topic_open', $forum_template->topic->topic_open );
+	}
+
+function bp_the_topic_last_post_id() {
+	echo bp_get_the_topic_last_post_id();
+}
+	function bp_get_the_topic_last_post_id() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_last_post_id', $forum_template->topic->topic_last_post_id );
+	}
+
+function bp_the_topic_is_sticky() {
+	echo bp_get_the_topic_is_sticky();
+}
+	function bp_get_the_topic_is_sticky() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_is_sticky', $forum_template->topic->topic_sticky );
+	}
+
+function bp_the_topic_total_post_count() {
+	echo bp_get_the_topic_total_post_count();
+}
+	function bp_get_the_topic_total_post_count() {
+		global $forum_template;
+
+		if ( $forum_template->topic->topic_posts == 1 )
+			return apply_filters( 'bp_get_the_topic_total_post_count', sprintf( __( '%d post', 'buddypress' ), $forum_template->topic->topic_posts ) );
+		else
+			return apply_filters( 'bp_get_the_topic_total_post_count', sprintf( __( '%d posts', 'buddypress' ), $forum_template->topic->topic_posts ) );
+	}
+
+function bp_the_topic_total_posts() {
+	echo bp_get_the_topic_total_posts();
+}
+	function bp_get_the_topic_total_posts() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_total_posts', $forum_template->topic->topic_posts );
+	}
+
+function bp_the_topic_tag_count() {
+	echo bp_get_the_topic_tag_count();
+}
+	function bp_get_the_topic_tag_count() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_tag_count', $forum_template->topic->tag_count );
+	}
+
+function bp_the_topic_permalink() {
+	echo bp_get_the_topic_permalink();
+}
+	function bp_get_the_topic_permalink() {
+		global $forum_template, $bp;
+
+		if ( $forum_template->topic->object_slug )
+			$permalink = $bp->root_domain . '/' . BP_GROUPS_SLUG . '/' . $forum_template->topic->object_slug . '/';
+		else if ( $bp->is_single_item )
+			$permalink = $bp->root_domain . '/' . $bp->current_component . '/' . $bp->current_item . '/';
+		else
+			$permalink = $bp->root_domain . '/' . $bp->current_component . '/' . $bp->current_action . '/';
+
+		return apply_filters( 'bp_get_the_topic_permalink', $permalink . 'forum/topic/' . $forum_template->topic->topic_slug . '/' );
+	}
+
+function bp_the_topic_time_since_created() {
+	echo bp_get_the_topic_time_since_created();
+}
+	function bp_get_the_topic_time_since_created() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_time_since_created', bp_core_time_since( strtotime( $forum_template->topic->topic_start_time ) ) );
+	}
+
+function bp_the_topic_latest_post_excerpt( $args = '' ) {
+	echo bp_get_the_topic_latest_post_excerpt( $args );
+}
+	function bp_get_the_topic_latest_post_excerpt( $args = '' ) {
+		global $forum_template;
+
+		$defaults = array(
+			'length' => 10
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		$post = bp_forums_get_post( $forum_template->topic->topic_last_post_id );
+		$post = bp_create_excerpt( $post->post_text, $length );
+		return apply_filters( 'bp_get_the_topic_latest_post_excerpt', $post );
+	}
+
+function bp_the_topic_time_since_last_post() {
+	global $forum_template;
+
+	echo bp_get_the_topic_time_since_last_post();
+}
+	function bp_get_the_topic_time_since_last_post() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_the_topic_time_since_last_post', bp_core_time_since( strtotime( $forum_template->topic->topic_time ) ) );
+	}
+
+function bp_the_topic_is_mine() {
+	echo bp_get_the_topic_is_mine();
+}
+	function bp_get_the_topic_is_mine() {
+		global $bp, $forum_template;
+
+		return $bp->loggedin_user->id == $forum_template->topic->topic_poster;
+	}
+
+function bp_the_topic_admin_links( $args = '' ) {
+	echo bp_get_the_topic_admin_links( $args );
+}
+	function bp_get_the_topic_admin_links( $args = '' ) {
+		global $bp, $forum_template;
+
+		$defaults = array(
+			'seperator' => '|'
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		$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_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
+				$links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'unstick', 'bp_forums_unstick_topic' ) . '">' . __( 'Un-stick Topic', 'buddypress' ) . '</a>';
+
+			if ( 0 == (int)$forum_template->topic->topic_open )
+				$links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'open', 'bp_forums_open_topic' ) . '">' . __( 'Open Topic', 'buddypress' ) . '</a>';
+			else
+				$links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'close', 'bp_forums_close_topic' ) . '">' . __( 'Close Topic', 'buddypress' ) . '</a>';
+
+			$links[] = '<a class="confirm" id="topic-delete-link" href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'delete', 'bp_forums_delete_topic' ) . '">' . __( 'Delete Topic', 'buddypress' ) . '</a>';
+		}
+
+		return implode( ' ' . $seperator . ' ', (array) $links );
+	}
+
+function bp_the_topic_css_class() {
+	echo bp_get_the_topic_css_class();
+}
+
+	function bp_get_the_topic_css_class() {
+		global $forum_template;
+
+		$class = false;
+
+		if ( $forum_template->current_topic % 2 == 1 )
+			$class .= 'alt';
+
+		if ( 1 == (int)$forum_template->topic->topic_sticky )
+			$class .= ' sticky';
+
+		if ( 0 == (int)$forum_template->topic->topic_open )
+			$class .= ' closed';
+
+		return apply_filters( 'bp_get_the_topic_css_class', trim( $class ) );
+	}
+
+function bp_my_forum_topics_link() {
+	echo bp_get_my_forum_topics_link();
+}
+	function bp_get_my_forum_topics_link() {
+		global $bp;
+
+		return apply_filters( 'bp_get_my_forum_topics_link', $bp->root_domain . '/' . $bp->forums->slug . '/personal/' );
+	}
+
+function bp_unreplied_forum_topics_link() {
+	echo bp_get_unreplied_forum_topics_link();
+}
+	function bp_get_unreplied_forum_topics_link() {
+		global $bp;
+
+		return apply_filters( 'bp_get_unreplied_forum_topics_link', $bp->root_domain . '/' . $bp->forums->slug . '/unreplied/' );
+	}
+
+
+function bp_popular_forum_topics_link() {
+	echo bp_get_popular_forum_topics_link();
+}
+	function bp_get_popular_forum_topics_link() {
+		global $bp;
+
+		return apply_filters( 'bp_get_popular_forum_topics_link', $bp->root_domain . '/' . $bp->forums->slug . '/popular/' );
+	}
+
+function bp_newest_forum_topics_link() {
+	echo bp_get_newest_forum_topics_link();
+}
+	function bp_get_newest_forum_topics_link() {
+		global $bp;
+
+		return apply_filters( 'bp_get_newest_forum_topics_link', $bp->root_domain . '/' . $bp->forums->slug . '/' );
+	}
+
+function bp_forum_topic_type() {
+	echo bp_get_forum_topic_type();
+}
+	function bp_get_forum_topic_type() {
+		global $bp;
+
+		if ( !$bp->is_directory || !$bp->current_action )
+			return 'newest';
+
+
+		return apply_filters( 'bp_get_forum_topic_type', $bp->current_action );
+	}
+
+function bp_forums_tag_name() {
+	echo bp_get_forums_tag_name();
+}
+	function bp_get_forums_tag_name() {
+		global $bp;
+
+		if ( $bp->is_directory && $bp->forums->slug == $bp->current_component )
+			return apply_filters( 'bp_get_forums_tag_name', $bp->action_variables[0] );
+	}
+
+function bp_forum_pagination() {
+	echo bp_get_forum_pagination();
+}
+	function bp_get_forum_pagination() {
+		global $forum_template;
+
+		return apply_filters( 'bp_get_forum_pagination', $forum_template->pag_links );
+	}
+
+function bp_forum_pagination_count() {
+	global $bp, $forum_template;
+
+	$start_num = intval( ( $forum_template->pag_page - 1 ) * $forum_template->pag_num ) + 1;
+	$from_num = bp_core_number_format( $start_num );
+	$to_num = bp_core_number_format( ( $start_num + ( $forum_template->pag_num - 1  ) > $forum_template->total_topic_count ) ? $forum_template->total_topic_count : $start_num + ( $forum_template->pag_num - 1 ) );
+	$total = bp_core_number_format( $forum_template->total_topic_count );
+
+	$pag_filter = false;
+	if ( 'tags' == $forum_template->type && !empty( $forum_template->search_terms ) )
+		$pag_filter = sprintf( __( ' matching tag "%s"', 'buddypress' ), $forum_template->search_terms );
+
+	echo apply_filters( 'bp_forum_pagination_count', sprintf( __( 'Viewing topic %1$s to %2$s (%3$s total topics%4$s)', 'buddypress' ), $from_num, $to_num, $total, $pag_filter ) );
+?>
+<span class="ajax-loader"></span>
+<?php
+}
+
+function bp_is_edit_topic() {
+	global $bp;
+
+	if ( in_array( 'post', (array)$bp->action_variables ) && in_array( 'edit', (array)$bp->action_variables ) )
+		return false;
+
+	return true;
+}
+
+
+class BP_Forums_Template_Topic {
+	var $current_post = -1;
+	var $post_count;
+	var $posts;
+	var $post;
+
+	var $forum_id;
+	var $topic_id;
+	var $topic;
+
+	var $in_the_loop;
+
+	var $pag_page;
+	var $pag_num;
+	var $pag_links;
+	var $total_post_count;
+
+	var $single_post = false;
+
+	var $sort_by;
+	var $order;
+
+	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;
+		$this->pag_num         = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
+
+		$this->order           = $order;
+		$this->topic_id        = $topic_id;
+		$forum_template->topic = (object) bp_forums_get_topic_details( $this->topic_id );
+		$this->forum_id        = $forum_template->topic->forum_id;
+
+		$this->posts           = bp_forums_get_topic_posts( array( 'topic_id' => $this->topic_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'order' => $this->order ) );
+
+		if ( !$this->posts ) {
+			$this->post_count       = 0;
+			$this->total_post_count = 0;
+		} else {
+			if ( !$max || $max >= (int)$forum_template->topic->topic_posts ) {
+				$this->total_post_count = (int)$forum_template->topic->topic_posts;
+			} else {
+				$this->total_post_count = (int)$max;
+			}
+
+			if ( $max ) {
+				if ( $max >= count( $this->posts ) ) {
+					$this->post_count = count( $this->posts );
+				} else {
+					$this->post_count = (int)$max;
+				}
+			} else {
+				$this->post_count = count( $this->posts );
+			}
+		}
+
+		if ( (int)$this->total_post_count && (int)$this->pag_num ) {
+			$this->pag_links = paginate_links( array(
+				'base'      => add_query_arg( array( 'topic_page' => '%#%', 'num' => (int)$this->pag_num ) ),
+				'format'    => '',
+				'total'     => ceil( (int)$this->total_post_count / (int)$this->pag_num ),
+				'current'   => $this->pag_page,
+				'prev_text' => '&larr;',
+				'next_text' => '&rarr;',
+				'mid_size'  => 1
+			) );
+
+			$this->pag->total_pages = ceil( (int)$this->total_post_count / (int)$this->pag_num );
+		} else {
+			$this->pag->total_pages = 1;
+		}
+	}
+
+	function has_posts() {
+		if ( $this->post_count )
+			return true;
+
+		return false;
+	}
+
+	function next_post() {
+		$this->current_post++;
+		$this->post = $this->posts[$this->current_post];
+
+		return $this->post;
+	}
+
+	function rewind_posts() {
+		$this->current_post = -1;
+		if ( $this->post_count > 0 ) {
+			$this->post = $this->posts[0];
+		}
+	}
+
+	function user_posts() {
+		if ( $this->current_post + 1 < $this->post_count ) {
+			return true;
+		} elseif ( $this->current_post + 1 == $this->post_count ) {
+			do_action('loop_end');
+			// Do some cleaning up after the loop
+			$this->rewind_posts();
+		}
+
+		$this->in_the_loop = false;
+		return false;
+	}
+
+	function the_post() {
+		global $post;
+
+		$this->in_the_loop = true;
+		$this->post = $this->next_post();
+		$this->post = (object)$this->post;
+
+		if ( $this->current_post == 0 ) // loop has just started
+			do_action('loop_start');
+	}
+}
+
+function bp_has_forum_topic_posts( $args = '' ) {
+	global $topic_template, $bp;
+
+	$defaults = array(
+		'topic_id' => false,
+		'per_page' => 15,
+		'max'      => false,
+		'order'    => 'ASC'
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	if ( !$topic_id && $bp->current_component == $bp->groups->slug && 'forum' == $bp->current_action && 'topic' == $bp->action_variables[0] )
+		$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, $order );
+
+		// Current topic forum_id needs to match current_group forum_id
+		if ( $bp->current_component == $bp->groups->slug && $topic_template->forum_id != groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' ) )
+			return false;
+
+	} else {
+		return false;
+	}
+
+	return apply_filters( 'bp_has_topic_posts', $topic_template->has_posts(), &$topic_template );
+}
+
+function bp_forum_topic_posts() {
+	global $topic_template;
+	return $topic_template->user_posts();
+}
+
+function bp_the_forum_topic_post() {
+	global $topic_template;
+	return $topic_template->the_post();
+}
+
+function bp_the_topic_post_id() {
+	echo bp_get_the_topic_post_id();
+}
+	function bp_get_the_topic_post_id() {
+		global $topic_template;
+
+		return apply_filters( 'bp_get_the_topic_post_id', $topic_template->post->post_id );
+	}
+
+function bp_the_topic_post_content() {
+	echo bp_get_the_topic_post_content();
+}
+	function bp_get_the_topic_post_content() {
+		global $topic_template;
+
+		return apply_filters( 'bp_get_the_topic_post_content', stripslashes( $topic_template->post->post_text ) );
+	}
+
+function bp_the_topic_post_css_class() {
+	echo bp_get_the_topic_post_css_class();
+}
+
+	function bp_get_the_topic_post_css_class() {
+		global $topic_template;
+
+		$class = false;
+
+		if ( $topic_template->current_post % 2 == 1 )
+			$class .= 'alt';
+
+		if ( 1 == (int)$topic_template->post->post_status )
+			$class .= ' deleted';
+
+		if ( 0 == (int)$topic_template->post->post_status )
+			$class .= ' open';
+
+		return apply_filters( 'bp_get_the_topic_post_css_class', trim( $class ) );
+	}
+
+function bp_the_topic_post_poster_avatar( $args = '' ) {
+	echo bp_get_the_topic_post_poster_avatar( $args );
+}
+	function bp_get_the_topic_post_poster_avatar( $args = '' ) {
+		global $topic_template;
+
+		$defaults = array(
+			'type' => 'thumb',
+			'width' => 20,
+			'height' => 20,
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		return apply_filters( 'bp_get_the_topic_post_poster_avatar', bp_core_fetch_avatar( array( 'item_id' => $topic_template->post->poster_id, 'type' => $type, 'width' => $width, 'height' => $height ) ) );
+	}
+
+function bp_the_topic_post_poster_name() {
+	echo bp_get_the_topic_post_poster_name();
+}
+	function bp_get_the_topic_post_poster_name() {
+		global $topic_template;
+
+		if ( !$link = bp_core_get_user_domain( $topic_template->post->poster_id, $topic_template->post->poster_nicename, $topic_template->post->poster_login ) )
+			return __( 'Deleted User', 'buddypress' );
+
+		return apply_filters( 'bp_get_the_topic_post_poster_name', '<a href="' . $link . '" title="' . $topic_template->post->poster_name . '">' . $topic_template->post->poster_name . '</a>' );
+	}
+
+function bp_the_topic_post_poster_link() {
+	echo bp_get_the_topic_post_poster_link();
+}
+	function bp_get_the_topic_post_poster_link() {
+		global $topic_template;
+
+		return apply_filters( 'bp_the_topic_post_poster_link', bp_core_get_user_domain( $topic_template->post->poster_id, $topic_template->post->poster_nicename, $topic_template->post->poster_login ) );
+	}
+
+function bp_the_topic_post_time_since() {
+	echo bp_get_the_topic_post_time_since();
+}
+	function bp_get_the_topic_post_time_since() {
+		global $topic_template;
+
+		return apply_filters( 'bp_get_the_topic_post_time_since', bp_core_time_since( strtotime( $topic_template->post->post_time ) ) );
+	}
+
+function bp_the_topic_post_is_mine() {
+	echo bp_the_topic_post_is_mine();
+}
+	function bp_get_the_topic_post_is_mine() {
+		global $bp, $topic_template;
+
+		return $bp->loggedin_user->id == $topic_template->post->poster_id;
+	}
+
+function bp_the_topic_post_admin_links( $args = '' ) {
+	echo bp_get_the_topic_post_admin_links( $args );
+}
+	function bp_get_the_topic_post_admin_links( $args = '' ) {
+		global $topic_template;
+
+		/* Never show for the first post in a topic. */
+		if ( 0 == $topic_template->current_post && $topic_template->pag_page == 1 )
+			return;
+
+		$defaults = array(
+			'seperator' => '|'
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		if ( $_SERVER['QUERY_STRING'] )
+			$query_vars = '?' . $_SERVER['QUERY_STRING'];
+
+		$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;
+	}
+
+function bp_the_topic_post_edit_text() {
+	echo bp_get_the_topic_post_edit_text();
+}
+	function bp_get_the_topic_post_edit_text() {
+		global $bp;
+
+		$post = bp_forums_get_post( $bp->action_variables[4] );
+		return apply_filters( 'bp_get_the_topic_post_edit_text', esc_attr( $post->post_text ) );
+	}
+
+function bp_the_topic_pagination() {
+	echo bp_get_the_topic_pagination();
+}
+	function bp_get_the_topic_pagination() {
+		global $topic_template;
+
+		return apply_filters( 'bp_get_the_topic_pagination', $topic_template->pag_links );
+	}
+
+function bp_the_topic_pagination_count() {
+	global $bp, $topic_template;
+
+	$start_num = intval( ( $topic_template->pag_page - 1 ) * $topic_template->pag_num ) + 1;
+	$from_num = bp_core_number_format( $start_num );
+	$to_num = bp_core_number_format( ( $start_num + ( $topic_template->pag_num - 1  ) > $topic_template->total_post_count ) ? $topic_template->total_post_count : $start_num + ( $topic_template->pag_num - 1 ) );
+	$total = bp_core_number_format( $topic_template->total_post_count );
+
+	echo apply_filters( 'bp_the_topic_pagination_count', sprintf( __( 'Viewing post %1$s to %2$s (%3$s total posts)', 'buddypress' ), $from_num, $to_num, $total ) );
+?>
+	<span class="ajax-loader"></span>
+<?php
+}
+
+function bp_the_topic_is_last_page() {
+	echo bp_get_the_topic_is_last_page();
+}
+	function bp_get_the_topic_is_last_page() {
+		global $topic_template;
+
+		return apply_filters( 'bp_get_the_topic_is_last_page', $topic_template->pag_page == $topic_template->pag->total_pages );
+	}
+
+function bp_directory_forums_search_form() {
+	global $bp;
+
+	$search_value = __( 'Search anything...', 'buddypress' );
+	if ( !empty( $_REQUEST['fs'] ) )
+	 	$search_value = $_REQUEST['fs'];
+
+?>
+	<form action="" method="get" id="search-forums-form">
+		<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
+}
+function bp_forum_permalink() {
+	echo bp_get_forum_permalink();
+}
+	function bp_get_forum_permalink() {
+		global $bp;
+
+		if ( $bp->is_single_item )
+			$permalink = $bp->root_domain . '/' . $bp->current_component . '/' . $bp->current_item . '/';
+		else
+			$permalink = $bp->root_domain . $bp->current_component . '/' . $bp->current_action . '/';
+
+		return apply_filters( 'bp_get_forum_permalink', $permalink . 'forum' );
+	}
+
+function bp_forum_directory_permalink() {
+	echo bp_get_forum_directory_permalink();
+}
+	function bp_get_forum_directory_permalink() {
+		global $bp;
+
+		return apply_filters( 'bp_get_forum_directory_permalink', $bp->root_domain . '/' . $bp->forums->slug );
+	}
+
+function bp_forums_tag_heat_map( $args = '' ) {
+	$defaults = array(
+		'smallest' => '10',
+		'largest' => '42',
+		'sizing' => 'px',
+		'limit' => '50'
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	bb_tag_heat_map( $smallest, $largest, $sizing, $limit );
+}
+
+function bp_forum_action() {
+	echo bp_get_forum_action();
+}
+	function bp_get_forum_action() {
+		global $topic_template;
+
+		return apply_filters( 'bp_get_forum_action', $bp->root_domain . esc_attr( $_SERVER['REQUEST_URI'] ) );
+	}
+
+function bp_forum_topic_action() {
+	echo bp_get_forum_topic_action();
+}
+	function bp_get_forum_topic_action() {
+		global $bp;
+
+		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 ) {
+	echo bp_get_forum_topic_count_for_user( $user_id );
+}
+	function bp_get_forum_topic_count_for_user( $user_id = false ) {
+		return apply_filters( 'bp_get_forum_topic_count_for_user', bp_forums_total_topic_count_for_user( $user_id ) );
+	}
+
+function bp_forum_topic_count( $user_id = false ) {
+	echo bp_get_forum_topic_count( $user_id );
+}
+	function bp_get_forum_topic_count( $user_id = false ) {
+		return apply_filters( 'bp_get_forum_topic_count', bp_forums_total_topic_count( $user_id ) );
+	}
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-friends.php b/wp-content/plugins/buddypress/bp-friends.php
new file mode 100644
index 0000000000000000000000000000000000000000..b3dbc7c6a11431911653047ec81c3a868d1e4f4c
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-friends.php
@@ -0,0 +1,660 @@
+<?php
+
+define ( 'BP_FRIENDS_DB_VERSION', '1800' );
+
+/* Define the slug for the component */
+if ( !defined( 'BP_FRIENDS_SLUG' ) )
+	define ( 'BP_FRIENDS_SLUG', 'friends' );
+
+require ( BP_PLUGIN_DIR . '/bp-friends/bp-friends-classes.php' );
+require ( BP_PLUGIN_DIR . '/bp-friends/bp-friends-templatetags.php' );
+
+function friends_install() {
+	global $wpdb, $bp;
+
+	if ( !empty($wpdb->charset) )
+		$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
+
+	$sql[] = "CREATE TABLE {$bp->friends->table_name} (
+		  		id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+		  		initiator_user_id bigint(20) NOT NULL,
+		  		friend_user_id bigint(20) NOT NULL,
+		  		is_confirmed bool DEFAULT 0,
+				is_limited bool DEFAULT 0,
+		  		date_created datetime NOT NULL,
+			    KEY initiator_user_id (initiator_user_id),
+			    KEY friend_user_id (friend_user_id)
+		 	   ) {$charset_collate};";
+
+	require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
+	dbDelta($sql);
+
+	update_site_option( 'bp-friends-db-version', BP_FRIENDS_DB_VERSION );
+}
+
+function friends_setup_globals() {
+	global $bp;
+
+	/* For internal identification */
+	$bp->friends->id = 'friends';
+
+	$bp->friends->slug = BP_FRIENDS_SLUG;
+
+	$bp->friends->table_name = $bp->table_prefix . 'bp_friends';
+
+	$bp->friends->format_notification_function = 'friends_format_notifications';
+
+	/* Register this in the active components array */
+	$bp->active_components[$bp->friends->slug] = $bp->friends->id;
+
+	do_action( 'friends_setup_globals' );
+}
+add_action( 'bp_setup_globals', 'friends_setup_globals' );
+
+function friends_check_installed() {
+	global $bp;
+
+	if ( !is_super_admin() )
+		return false;
+
+	/* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
+	if ( get_site_option( 'bp-friends-db-version' ) < BP_FRIENDS_DB_VERSION )
+		friends_install();
+}
+add_action( 'admin_menu', 'friends_check_installed' );
+
+function friends_setup_nav() {
+	global $bp;
+
+	/* Add 'Friends' to the main navigation */
+	bp_core_new_nav_item( array( 'name' => sprintf( __( 'Friends <span>(%d)</span>', 'buddypress' ), friends_get_total_friend_count() ), 'slug' => $bp->friends->slug, 'position' => 60, 'screen_function' => 'friends_screen_my_friends', 'default_subnav_slug' => 'my-friends', 'item_css_id' => $bp->friends->id ) );
+
+	$friends_link = $bp->loggedin_user->domain . $bp->friends->slug . '/';
+
+	/* Add the subnav items to the friends nav item */
+	bp_core_new_subnav_item( array( 'name' => __( 'My Friends', 'buddypress' ), 'slug' => 'my-friends', 'parent_url' => $friends_link, 'parent_slug' => $bp->friends->slug, 'screen_function' => 'friends_screen_my_friends', 'position' => 10, 'item_css_id' => 'friends-my-friends' ) );
+	bp_core_new_subnav_item( array( 'name' => __( 'Requests', 'buddypress' ), 'slug' => 'requests', 'parent_url' => $friends_link, 'parent_slug' => $bp->friends->slug, 'screen_function' => 'friends_screen_requests', 'position' => 20, 'user_has_access' => bp_is_my_profile() ) );
+
+	if ( $bp->current_component == $bp->friends->slug ) {
+		if ( bp_is_my_profile() ) {
+			$bp->bp_options_title = __( 'My Friends', 'buddypress' );
+		} else {
+			$bp->bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => 'thumb' ) );
+			$bp->bp_options_title = $bp->displayed_user->fullname;
+		}
+	}
+
+	do_action( 'friends_setup_nav' );
+}
+add_action( 'bp_setup_nav', 'friends_setup_nav' );
+
+/********************************************************************************
+ * Screen Functions
+ *
+ * Screen functions are the controllers of BuddyPress. They will execute when their
+ * specific URL is caught. They will first save or manipulate data using business
+ * functions, then pass on the user to a template file.
+ */
+
+function friends_screen_my_friends() {
+	global $bp;
+
+	// Delete any friendship acceptance notifications for the user when viewing a profile
+	bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->friends->id, 'friendship_accepted' );
+
+	do_action( 'friends_screen_my_friends' );
+
+	bp_core_load_template( apply_filters( 'friends_template_my_friends', 'members/single/home' ) );
+}
+
+function friends_screen_requests() {
+	global $bp;
+
+	if ( isset($bp->action_variables) && 'accept' == $bp->action_variables[0] && is_numeric($bp->action_variables[1]) ) {
+		/* Check the nonce */
+		check_admin_referer( 'friends_accept_friendship' );
+
+		if ( friends_accept_friendship( $bp->action_variables[1] ) ) {
+			bp_core_add_message( __( 'Friendship accepted', 'buddypress' ) );
+		} else {
+			bp_core_add_message( __( 'Friendship could not be accepted', 'buddypress' ), 'error' );
+		}
+		bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
+
+	} else if ( isset($bp->action_variables) && 'reject' == $bp->action_variables[0] && is_numeric($bp->action_variables[1]) ) {
+		/* Check the nonce */
+		check_admin_referer( 'friends_reject_friendship' );
+
+		if ( friends_reject_friendship( $bp->action_variables[1] ) ) {
+			bp_core_add_message( __( 'Friendship rejected', 'buddypress' ) );
+		} else {
+			bp_core_add_message( __( 'Friendship could not be rejected', 'buddypress' ), 'error' );
+		}
+		bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
+	}
+
+	do_action( 'friends_screen_requests' );
+
+	if ( isset( $_GET['new'] ) )
+		bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->friends->id, 'friendship_request' );
+
+	bp_core_load_template( apply_filters( 'friends_template_requests', 'members/single/home' ) );
+}
+
+function friends_screen_notification_settings() {
+	global $current_user; ?>
+	<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>
+
+		<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
+}
+add_action( 'bp_notification_settings', 'friends_screen_notification_settings' );
+
+
+/********************************************************************************
+ * Action Functions
+ *
+ * Action functions are exactly the same as screen functions, however they do not
+ * have a template screen associated with them. Usually they will send the user
+ * back to the default screen after execution.
+ */
+
+function friends_action_add_friend() {
+	global $bp;
+
+	if ( $bp->current_component != $bp->friends->slug || $bp->current_action != 'add-friend' )
+		return false;
+
+	$potential_friend_id = $bp->action_variables[0];
+
+	if ( !is_numeric( $potential_friend_id ) || !isset( $potential_friend_id ) )
+		return false;
+
+	if ( $potential_friend_id == $bp->loggedin_user->id )
+		return false;
+
+	$friendship_status = BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $potential_friend_id );
+
+	if ( 'not_friends' == $friendship_status ) {
+
+		if ( !check_admin_referer( 'friends_add_friend' ) )
+			return false;
+
+		if ( !friends_add_friend( $bp->loggedin_user->id, $potential_friend_id ) ) {
+			bp_core_add_message( __( 'Friendship could not be requested.', 'buddypress' ), 'error' );
+		} else {
+			bp_core_add_message( __( 'Friendship requested', 'buddypress' ) );
+		}
+	} else if ( 'is_friend' == $friendship_status ) {
+		bp_core_add_message( __( 'You are already friends with this user', 'buddypress' ), 'error' );
+	} else {
+		bp_core_add_message( __( 'You already have a pending friendship request with this user', 'buddypress' ), 'error' );
+	}
+
+	bp_core_redirect( wp_get_referer() );
+
+	return false;
+}
+add_action( 'init', 'friends_action_add_friend' );
+
+function friends_action_remove_friend() {
+	global $bp;
+
+	if ( $bp->current_component != $bp->friends->slug || $bp->current_action != 'remove-friend' )
+		return false;
+
+	$potential_friend_id = $bp->action_variables[0];
+
+	if ( !is_numeric( $potential_friend_id ) || !isset( $potential_friend_id ) )
+		return false;
+
+	if ( $potential_friend_id == $bp->loggedin_user->id )
+		return false;
+
+	$friendship_status = BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $potential_friend_id );
+
+	if ( 'is_friend' == $friendship_status ) {
+
+		if ( !check_admin_referer( 'friends_remove_friend' ) )
+			return false;
+
+		if ( !friends_remove_friend( $bp->loggedin_user->id, $potential_friend_id ) ) {
+			bp_core_add_message( __( 'Friendship could not be canceled.', 'buddypress' ), 'error' );
+		} else {
+			bp_core_add_message( __( 'Friendship canceled', 'buddypress' ) );
+		}
+	} else if ( 'is_friends' == $friendship_status ) {
+		bp_core_add_message( __( 'You are not yet friends with this user', 'buddypress' ), 'error' );
+	} else {
+		bp_core_add_message( __( 'You have a pending friendship request with this user', 'buddypress' ), 'error' );
+	}
+
+	bp_core_redirect( wp_get_referer() );
+
+	return false;
+}
+add_action( 'init', 'friends_action_remove_friend' );
+
+
+/********************************************************************************
+ * Activity & Notification Functions
+ *
+ * These functions handle the recording, deleting and formatting of activity and
+ * notifications for the user and for this specific component.
+ */
+
+function friends_record_activity( $args = '' ) {
+	global $bp;
+
+	if ( !function_exists( 'bp_activity_add' ) )
+		return false;
+
+	$defaults = array(
+		'user_id' => $bp->loggedin_user->id,
+		'action' => '',
+		'content' => '',
+		'primary_link' => '',
+		'component' => $bp->friends->id,
+		'type' => false,
+		'item_id' => false,
+		'secondary_item_id' => false,
+		'recorded_time' => bp_core_current_time(),
+		'hide_sitewide' => false
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	return bp_activity_add( array( 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
+}
+
+function friends_delete_activity( $args ) {
+	if ( function_exists('bp_activity_delete_by_item_id') ) {
+		extract( (array)$args );
+		bp_activity_delete_by_item_id( array( 'item_id' => $item_id, 'component' => $bp->friends->id, 'type' => $type, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) );
+	}
+}
+
+function friends_register_activity_actions() {
+	global $bp;
+
+	if ( !function_exists( 'bp_activity_set_action' ) )
+		return false;
+
+	bp_activity_set_action( $bp->friends->id, 'friends_register_activity_action', __( 'New friendship created', 'buddypress' ) );
+
+	do_action( 'friends_register_activity_actions' );
+}
+add_action( 'bp_register_activity_actions', 'friends_register_activity_actions' );
+
+function friends_format_notifications( $action, $item_id, $secondary_item_id, $total_items ) {
+	global $bp;
+
+	switch ( $action ) {
+		case 'friendship_accepted':
+			if ( (int)$total_items > 1 ) {
+				return apply_filters( 'bp_friends_multiple_friendship_accepted_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/my-friends/newest" title="' . __( 'My Friends', 'buddypress' ) . '">' . sprintf( __('%d friends accepted your friendship requests', 'buddypress' ), (int)$total_items ) . '</a>', (int)$total_items );
+			} else {
+				$user_fullname = bp_core_get_user_displayname( $item_id );
+				$user_url = bp_core_get_user_domain( $item_id );
+				return apply_filters( 'bp_friends_single_friendship_accepted_notification', '<a href="' . $user_url . '?new" title="' . $user_fullname .'\'s profile">' . sprintf( __( '%s accepted your friendship request', 'buddypress' ), $user_fullname ) . '</a>', $user_fullname );
+			}
+		break;
+
+		case 'friendship_request':
+			if ( (int)$total_items > 1 ) {
+				return apply_filters( 'bp_friends_multiple_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests/?new" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have %d pending friendship requests', 'buddypress' ), (int)$total_items ) . '</a>', $total_items );
+			} else {
+				$user_fullname = bp_core_get_user_displayname( $item_id );
+				$user_url = bp_core_get_user_domain( $item_id );
+				return apply_filters( 'bp_friends_single_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests/?new" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have a friendship request from %s', 'buddypress' ), $user_fullname ) . '</a>', $user_fullname );
+			}
+		break;
+	}
+
+	do_action( 'friends_format_notifications', $action, $item_id, $secondary_item_id, $total_items );
+
+	return false;
+}
+
+
+/********************************************************************************
+ * Business Functions
+ *
+ * Business functions are where all the magic happens in BuddyPress. They will
+ * handle the actual saving or manipulation of information. Usually they will
+ * hand off to a database class for data access, then return
+ * true or false on success or failure.
+ */
+
+function friends_add_friend( $initiator_userid, $friend_userid, $force_accept = false ) {
+	global $bp;
+
+	$friendship = new BP_Friends_Friendship;
+
+	if ( (int)$friendship->is_confirmed )
+		return true;
+
+	$friendship->initiator_user_id = $initiator_userid;
+	$friendship->friend_user_id = $friend_userid;
+	$friendship->is_confirmed = 0;
+	$friendship->is_limited = 0;
+	$friendship->date_created = bp_core_current_time();
+
+	if ( $force_accept )
+		$friendship->is_confirmed = 1;
+
+	if ( $friendship->save() ) {
+
+		if ( !$force_accept ) {
+			// Add the on screen notification
+			bp_core_add_notification( $friendship->initiator_user_id, $friendship->friend_user_id, $bp->friends->id, 'friendship_request' );
+
+			// Send the email notification
+			require_once( BP_PLUGIN_DIR . '/bp-friends/bp-friends-notifications.php' );
+			friends_notification_new_request( $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id );
+
+			do_action( 'friends_friendship_requested', $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id );
+		} else {
+			do_action( 'friends_friendship_accepted', $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id );
+		}
+
+		return true;
+	}
+
+	return false;
+}
+
+function friends_remove_friend( $initiator_userid, $friend_userid ) {
+	global $bp;
+
+	$friendship_id = BP_Friends_Friendship::get_friendship_id( $initiator_userid, $friend_userid );
+	$friendship = new BP_Friends_Friendship( $friendship_id );
+
+	// Remove the activity stream item for the user who canceled the friendship
+	friends_delete_activity( array( 'item_id' => $friendship_id, 'type' => 'friendship_accepted', 'user_id' => $bp->displayed_user->id ) );
+
+	do_action( 'friends_friendship_deleted', $friendship_id, $initiator_userid, $friend_userid );
+
+	if ( $friendship->delete() ) {
+		friends_update_friend_totals( $initiator_userid, $friend_userid, 'remove' );
+
+		return true;
+	}
+
+	return false;
+}
+
+function friends_accept_friendship( $friendship_id ) {
+	global $bp;
+
+	$friendship = new BP_Friends_Friendship( $friendship_id, true, false );
+
+	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
+		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
+		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
+		friends_record_activity( array(
+			'user_id'           => $friendship->initiator_user_id,
+			'type'              => 'friendship_created',
+			'action'            => apply_filters( 'friends_activity_friendship_accepted_action', sprintf( __( '%s and %s are now friends', 'buddypress' ), $initiator_link, $friend_link ), &$friendship ),
+			'item_id'           => $friendship_id,
+			'secondary_item_id' => $friendship->friend_user_id
+		) );
+
+		// 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( __( '%s and %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
+		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 );
+
+		do_action( 'friends_friendship_accepted', $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id );
+		return true;
+	}
+
+	return false;
+}
+
+function friends_reject_friendship( $friendship_id ) {
+	$friendship = new BP_Friends_Friendship( $friendship_id, true, false );
+
+	if ( !$friendship->is_confirmed && BP_Friends_Friendship::reject( $friendship_id ) ) {
+		// 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' );
+
+		do_action( 'friends_friendship_rejected', $friendship_id, &$friendship );
+		return true;
+	}
+
+	return false;
+}
+
+function friends_check_friendship( $user_id, $possible_friend_id ) {
+	global $bp;
+
+	if ( 'is_friend' == BP_Friends_Friendship::check_is_friend( $user_id, $possible_friend_id ) )
+		return true;
+
+	return false;
+}
+
+function friends_check_friendship_status( $user_id, $possible_friend_id ) {
+	/* Returns - 'is_friend', 'not_friends', 'pending' */
+	return BP_Friends_Friendship::check_is_friend( $user_id, $possible_friend_id );
+}
+
+function friends_get_total_friend_count( $user_id = false ) {
+	global $bp;
+
+	if ( !$user_id )
+		$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_user_meta( $user_id, 'total_friend_count', true );
+		if ( empty( $count ) ) $count = 0;
+		wp_cache_set( 'bp_total_friend_count_' . $user_id, $count, 'bp' );
+	}
+
+	return apply_filters( 'friends_get_total_friend_count', $count );
+}
+
+function friends_check_user_has_friends( $user_id ) {
+	$friend_count = friends_get_total_friend_count( $user_id );
+
+	if ( empty( $friend_count ) )
+		return false;
+
+	if ( !(int)$friend_count )
+		return false;
+
+	return true;
+}
+
+function friends_get_friendship_id( $initiator_user_id, $friend_user_id ) {
+	return BP_Friends_Friendship::get_friendship_id( $initiator_user_id, $friend_user_id );
+}
+
+function friends_get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false, $filter = false ) {
+	return BP_Friends_Friendship::get_friend_user_ids( $user_id, $friend_requests_only, $assoc_arr, $filter );
+}
+
+function friends_search_friends( $search_terms, $user_id, $pag_num = 10, $pag_page = 1 ) {
+	return BP_Friends_Friendship::search_friends( $search_terms, $user_id, $pag_num, $pag_page );
+}
+
+function friends_get_friendship_request_user_ids( $user_id ) {
+	return BP_Friends_Friendship::get_friendship_request_user_ids( $user_id );
+}
+
+function friends_get_recently_active( $user_id, $per_page = false, $page = false, $filter = false ) {
+	return apply_filters( 'friends_get_recently_active', BP_Core_User::get_users( 'active', $per_page, $page, $user_id, $filter ) );
+}
+
+function friends_get_alphabetically( $user_id, $per_page = false, $page = false, $filter = false ) {
+	return apply_filters( 'friends_get_alphabetically', BP_Core_User::get_users( 'alphabetical', $per_page, $page, $user_id, $filter ) );
+}
+
+function friends_get_newest( $user_id, $per_page = false, $page = false, $filter = false ) {
+	return apply_filters( 'friends_get_newest', BP_Core_User::get_users( 'newest', $per_page, $page, $user_id, $filter ) );
+}
+
+function friends_get_bulk_last_active( $friend_ids ) {
+	return BP_Friends_Friendship::get_bulk_last_active( $friend_ids );
+}
+
+function friends_get_friends_invite_list( $user_id = false ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = $bp->loggedin_user->id;
+
+	if ( bp_has_members( 'user_id=' . $user_id . '&type=alphabetical&per_page=0' ) ) {
+		while ( bp_members() ) : bp_the_member();
+			$friends[] = array(
+				'id' => bp_get_member_user_id(),
+				'full_name' => bp_get_member_name()
+			);
+		endwhile;
+	}
+
+	if ( empty($friends) )
+		return false;
+
+	return $friends;
+}
+
+function friends_count_invitable_friends( $user_id, $group_id ) {
+	return BP_Friends_Friendship::get_invitable_friend_count( $user_id, $group_id );
+}
+
+function friends_get_friend_count_for_user( $user_id ) {
+	return BP_Friends_Friendship::total_friend_count( $user_id );
+}
+
+function friends_search_users( $search_terms, $user_id, $pag_num = false, $pag_page = false ) {
+	global $bp;
+
+	$user_ids = BP_Friends_Friendship::search_users( $search_terms, $user_id, $pag_num, $pag_page );
+
+	if ( !$user_ids )
+		return false;
+
+	for ( $i = 0; $i < count($user_ids); $i++ ) {
+		$users[] = new BP_Core_User($user_ids[$i]);
+	}
+
+	return array( 'users' => $users, 'count' => BP_Friends_Friendship::search_users_count($search_terms) );
+}
+
+function friends_is_friendship_confirmed( $friendship_id ) {
+	$friendship = new BP_Friends_Friendship( $friendship_id );
+	return $friendship->is_confirmed;
+}
+
+function friends_update_friend_totals( $initiator_user_id, $friend_user_id, $status = 'add' ) {
+	if ( 'add' == $status ) {
+		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_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 );
+	}
+}
+
+function friends_remove_data( $user_id ) {
+	BP_Friends_Friendship::delete_all_for_user($user_id);
+
+	/* Remove usermeta */
+	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' );
+
+	do_action( 'friends_remove_data', $user_id );
+}
+add_action( 'wpmu_delete_user', 'friends_remove_data' );
+add_action( 'delete_user', 'friends_remove_data' );
+add_action( 'make_spam_user', 'friends_remove_data' );
+
+
+/********************************************************************************
+ * Caching
+ *
+ * Caching functions handle the clearing of cached objects and pages on specific
+ * actions throughout BuddyPress.
+ */
+
+function friends_clear_friend_object_cache( $friendship_id ) {
+	if ( !$friendship = new BP_Friends_Friendship( $friendship_id ) )
+		return false;
+
+	wp_cache_delete( 'friends_friend_ids_' . $friendship->initiator_user_id, 'bp' );
+	wp_cache_delete( 'friends_friend_ids_' . $friendship->friend_user_id, 'bp' );
+	wp_cache_delete( 'bp_total_friend_count_' . $friendship->initiator_user_id, 'bp' );
+	wp_cache_delete( 'bp_total_friend_count_' . $friendship->friend_user_id, 'bp' );
+	wp_cache_delete( 'popular_users', 'bp' );
+
+	/* Clear the sitewide activity cache */
+	wp_cache_delete( 'sitewide_activity', 'bp' );
+}
+
+function friends_clear_friend_notifications() {
+	global $bp;
+
+	if ( isset( $_GET['new'] ) )
+		bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->friends->id, 'friendship_accepted' );
+}
+add_action( 'bp_activity_screen_my_activity', 'friends_clear_friend_notifications' );
+
+// List actions to clear object caches on
+add_action( 'friends_friendship_accepted', 'friends_clear_friend_object_cache' );
+add_action( 'friends_friendship_deleted', 'friends_clear_friend_object_cache' );
+
+// List actions to clear super cached pages on, if super cache is installed
+add_action( 'friends_friendship_rejected', 'bp_core_clear_cache' );
+add_action( 'friends_friendship_accepted', 'bp_core_clear_cache' );
+add_action( 'friends_friendship_deleted', 'bp_core_clear_cache' );
+add_action( 'friends_friendship_requested', 'bp_core_clear_cache' );
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-friends/bp-friends-classes.php b/wp-content/plugins/buddypress/bp-friends/bp-friends-classes.php
new file mode 100644
index 0000000000000000000000000000000000000000..c0b258d4b51ee70cd4ed682c8e28d32f25fc051f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-friends/bp-friends-classes.php
@@ -0,0 +1,334 @@
+<?php
+
+class BP_Friends_Friendship {
+	var $id;
+	var $initiator_user_id;
+	var $friend_user_id;
+	var $is_confirmed;
+	var $is_limited;
+	var $date_created;
+
+	var $is_request;
+	var $populate_friend_details;
+
+	var $friend;
+
+	function bp_friends_friendship( $id = null, $is_request = false, $populate_friend_details = true ) {
+		$this->is_request = $is_request;
+
+		if ( $id ) {
+			$this->id = $id;
+			$this->populate_friend_details = $populate_friend_details;
+			$this->populate( $this->id );
+		}
+	}
+
+	function populate() {
+		global $wpdb, $bp, $creds;
+
+		if ( $friendship = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->friends->table_name} WHERE id = %d", $this->id ) ) ) {
+			$this->initiator_user_id = $friendship->initiator_user_id;
+			$this->friend_user_id = $friendship->friend_user_id;
+			$this->is_confirmed = $friendship->is_confirmed;
+			$this->is_limited = $friendship->is_limited;
+			$this->date_created = $friendship->date_created;
+		}
+
+		// if running from ajax.
+		if ( !$bp->displayed_user->id )
+			$bp->displayed_user->id = $creds['current_userid'];
+
+		if ( $this->populate_friend_details ) {
+			if ( $this->friend_user_id == $bp->displayed_user->id ) {
+				$this->friend = new BP_Core_User( $this->initiator_user_id );
+			} else {
+				$this->friend = new BP_Core_User( $this->friend_user_id );
+			}
+		}
+	}
+
+	function save() {
+		global $wpdb, $bp;
+
+		$this->initiator_user_id = apply_filters( 'friends_friendship_initiator_user_id_before_save', $this->initiator_user_id, $this->id );
+		$this->friend_user_id = apply_filters( 'friends_friendship_friend_user_id_before_save', $this->friend_user_id, $this->id );
+		$this->is_confirmed = apply_filters( 'friends_friendship_is_confirmed_before_save', $this->is_confirmed, $this->id );
+		$this->is_limited = apply_filters( 'friends_friendship_is_limited_before_save', $this->is_limited, $this->id );
+		$this->date_created = apply_filters( 'friends_friendship_date_created_before_save', $this->date_created, $this->id );
+
+		do_action( 'friends_friendship_before_save', $this );
+
+		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 = %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, %s )", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created ) );
+			$this->id = $wpdb->insert_id;
+		}
+
+		do_action( 'friends_friendship_after_save', $this );
+
+		return $result;
+	}
+
+	function delete() {
+		global $wpdb, $bp;
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d", $this->id ) );
+	}
+
+	/* Static Functions */
+
+	function get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false ) {
+		global $wpdb, $bp;
+
+		if ( $friend_requests_only ) {
+			$oc_sql = $wpdb->prepare( "AND is_confirmed = 0" );
+			$friend_sql = $wpdb->prepare ( " WHERE friend_user_id = %d", $user_id );
+		} else {
+			$oc_sql = $wpdb->prepare( "AND is_confirmed = 1" );
+			$friend_sql = $wpdb->prepare ( " WHERE (initiator_user_id = %d OR friend_user_id = %d)", $user_id, $user_id );
+		}
+
+		$friends = $wpdb->get_results( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} $friend_sql $oc_sql ORDER BY date_created DESC" ) );
+
+		for ( $i = 0; $i < count($friends); $i++ ) {
+			if ( $assoc_arr )
+				$fids[] = array( 'user_id' => ( $friends[$i]->friend_user_id == $user_id ) ? $friends[$i]->initiator_user_id : $friends[$i]->friend_user_id );
+			else
+				$fids[] = ( $friends[$i]->friend_user_id == $user_id ) ? $friends[$i]->initiator_user_id : $friends[$i]->friend_user_id;
+		}
+
+		return $fids;
+	}
+
+	function get_friendship_id( $user_id, $friend_id ) {
+		global $wpdb, $bp;
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->friends->table_name} WHERE ( initiator_user_id = %d AND friend_user_id = %d ) OR ( initiator_user_id = %d AND friend_user_id = %d ) AND is_confirmed = 1", $user_id, $friend_id, $friend_id, $user_id ) );
+	}
+
+	function get_friendship_request_user_ids( $user_id ) {
+		global $wpdb, $bp;
+
+		return $wpdb->get_col( $wpdb->prepare( "SELECT initiator_user_id FROM {$bp->friends->table_name} WHERE friend_user_id = %d AND is_confirmed = 0", $user_id ) );
+	}
+
+	function total_friend_count( $user_id = false ) {
+		global $wpdb, $bp;
+
+		if ( !$user_id )
+			$user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
+
+		/* This is stored in 'total_friend_count' usermeta.
+		   This function will recalculate, update and return. */
+
+		$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 ) );
+
+		// Do not update meta if user has never had friends
+		if ( !$count && !get_user_meta( $user_id, 'total_friend_count', true ) )
+			return 0;
+
+		update_user_meta( $user_id, 'total_friend_count', (int)$count );
+		return (int)$count;
+	}
+
+	function search_friends( $filter, $user_id, $limit = null, $page = null ) {
+		global $wpdb, $bp;
+
+		// TODO: Optimize this function.
+
+		if ( !$user_id )
+			$user_id = $bp->loggedin_user->id;
+
+		$filter = like_escape( $wpdb->escape( $filter ) );
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		if ( !$friend_ids = BP_Friends_Friendship::get_friend_user_ids( $user_id ) )
+			return false;
+
+		// Get all the user ids for the current user's friends.
+		$fids = implode( ',', $friend_ids );
+
+		if ( empty($fids) )
+			return false;
+
+		// filter the user_ids based on the search criteria.
+		if ( function_exists('xprofile_install') ) {
+			$sql = "SELECT DISTINCT user_id FROM {$bp->profile->table_name_data} WHERE user_id IN ($fids) AND value LIKE '$filter%%' {$pag_sql}";
+			$total_sql = "SELECT COUNT(DISTINCT user_id) FROM {$bp->profile->table_name_data} WHERE user_id IN ($fids) AND value LIKE '$filter%%'";
+		} else {
+			$sql = "SELECT DISTINCT user_id FROM " . CUSTOM_USER_META_TABLE . " WHERE user_id IN ($fids) AND meta_key = 'nickname' AND meta_value LIKE '$filter%%' {$pag_sql}";
+			$total_sql = "SELECT COUNT(DISTINCT user_id) FROM " . CUSTOM_USER_META_TABLE . " WHERE user_id IN ($fids) AND meta_key = 'nickname' AND meta_value LIKE '$filter%%'";
+		}
+
+		$filtered_friend_ids = $wpdb->get_col($sql);
+		$total_friend_ids = $wpdb->get_var($total_sql);
+
+		if ( !$filtered_friend_ids )
+			return false;
+
+		return array( 'friends' => $filtered_friend_ids, 'total' => (int)$total_friend_ids );
+	}
+
+	function check_is_friend( $loggedin_userid, $possible_friend_userid ) {
+		global $wpdb, $bp;
+
+		if ( !$loggedin_userid || !$possible_friend_userid )
+			return false;
+
+		$result = $wpdb->get_results( $wpdb->prepare( "SELECT id, is_confirmed FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d AND friend_user_id = %d) OR (initiator_user_id = %d AND friend_user_id = %d)", $loggedin_userid, $possible_friend_userid, $possible_friend_userid, $loggedin_userid ) );
+
+		if ( $result ) {
+			if ( 0 == (int)$result[0]->is_confirmed ) {
+				return 'pending';
+			} else {
+				return 'is_friend';
+			}
+		} else {
+			return 'not_friends';
+		}
+	}
+
+	function get_bulk_last_active( $user_ids ) {
+		global $wpdb, $bp;
+
+		return $wpdb->get_results( $wpdb->prepare( "SELECT meta_value as last_activity, user_id FROM " . CUSTOM_USER_META_TABLE . " WHERE meta_key = 'last_activity' AND user_id IN ( {$user_ids} ) ORDER BY meta_value DESC" ) );
+	}
+
+	function accept($friendship_id) {
+		global $wpdb, $bp;
+
+	 	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) {
+		global $wpdb, $bp;
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d AND friend_user_id = %d", $friendship_id, $bp->loggedin_user->id ) );
+	}
+
+	function search_users( $filter, $user_id, $limit = null, $page = null ) {
+		global $wpdb, $bp;
+
+		$filter = like_escape( $wpdb->escape( $filter ) );
+
+		$usermeta_table = $wpdb->base_prefix . 'usermeta';
+		$users_table = $wpdb->base_prefix . 'users';
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		// filter the user_ids based on the search criteria.
+		if ( function_exists('xprofile_install') ) {
+			$sql = $wpdb->prepare( "SELECT DISTINCT d.user_id as id FROM {$bp->profile->table_name_data} d, $users_table u WHERE d.user_id = u.id AND d.value LIKE '$filter%%' ORDER BY d.value DESC $pag_sql" );
+		} else {
+			$sql = $wpdb->prepare( "SELECT DISTINCT user_id as id FROM $usermeta_table WHERE meta_value LIKE '$filter%%' ORDER BY d.value DESC $pag_sql" );
+		}
+
+		$filtered_fids = $wpdb->get_col($sql);
+
+		if ( !$filtered_fids )
+			return false;
+
+		return $filtered_fids;
+	}
+
+	function search_users_count( $filter ) {
+		global $wpdb, $bp;
+
+		$filter = like_escape( $wpdb->escape( $filter ) );
+
+		$usermeta_table = $wpdb->prefix . 'usermeta';
+		$users_table = $wpdb->base_prefix . 'users';
+
+		// filter the user_ids based on the search criteria.
+		if ( function_exists('xprofile_install') ) {
+			$sql = $wpdb->prepare( "SELECT COUNT(DISTINCT d.user_id) FROM {$bp->profile->table_name_data} d, $users_table u WHERE d.user_id = u.id AND d.value LIKE '$filter%%'" );
+		} else {
+			$sql = $wpdb->prepare( "SELECT COUNT(DISTINCT user_id) FROM $usermeta_table WHERE meta_value LIKE '$filter%%'" );
+		}
+
+		$user_count = $wpdb->get_col($sql);
+
+		if ( !$user_count )
+			return false;
+
+		return $user_count[0];
+	}
+
+	function sort_by_name( $user_ids ) {
+		global $wpdb, $bp;
+
+		if ( !function_exists( 'xprofile_install') )
+			return false;
+
+		return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$bp->profile->table_name_data} pd, {$bp->profile->table_name_fields} pf WHERE pf.id = pd.field_id AND pf.name = %s AND pd.user_id IN ( {$user_ids} ) ORDER BY pd.value ASC", BP_XPROFILE_FULLNAME_FIELD_NAME ) );
+	}
+
+	function get_random_friends( $user_id, $total_friends = 5 ) {
+		global $wpdb, $bp;
+
+		$sql = $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} WHERE (friend_user_id = %d || initiator_user_id = %d) && is_confirmed = 1 ORDER BY rand() LIMIT %d", $user_id, $user_id, $total_friends );
+		$results = $wpdb->get_results($sql);
+
+		for ( $i = 0; $i < count($results); $i++ ) {
+			$fids[] = ( $results[$i]->friend_user_id == $user_id ) ? $results[$i]->initiator_user_id : $results[$i]->friend_user_id;
+		}
+
+		// remove duplicates
+		if ( count($fids) > 0 )
+			return array_flip(array_flip($fids));
+		else
+			return false;
+	}
+
+	function get_invitable_friend_count( $user_id, $group_id ) {
+		global $wpdb, $bp;
+
+		$friend_ids = BP_Friends_Friendship::get_friend_user_ids( $user_id );
+
+		$invitable_count = 0;
+		for ( $i = 0; $i < count($friend_ids); $i++ ) {
+
+			if ( BP_Groups_Member::check_is_member( (int)$friend_ids[$i], $group_id ) )
+				continue;
+
+			if ( BP_Groups_Member::check_has_invite( (int)$friend_ids[$i], $group_id )  )
+				continue;
+
+			$invitable_count++;
+		}
+
+		return $invitable_count;
+	}
+
+	function get_user_ids_for_friendship( $friendship_id ) {
+		global $wpdb, $bp;
+
+		return $wpdb->get_row( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} WHERE id = %d", $friendship_id ) );
+	}
+
+	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 );
+
+		// Delete all friendships related to $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 );
+		}
+	}
+}
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-friends/bp-friends-notifications.php b/wp-content/plugins/buddypress/bp-friends/bp-friends-notifications.php
new file mode 100644
index 0000000000000000000000000000000000000000..8fd4a7ccadbd59d3761cac0d116175b8e009a2b8
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-friends/bp-friends-notifications.php
@@ -0,0 +1,82 @@
+<?php
+
+function friends_notification_new_request( $friendship_id, $initiator_id, $friend_id ) {
+	global $bp;
+
+	$initiator_name = bp_core_get_user_displayname( $initiator_id );
+
+	if ( 'no' == get_user_meta( (int)$friend_id, 'notification_friends_friendship_request', true ) )
+		return false;
+
+	$ud = get_userdata( $friend_id );
+	$initiator_ud = get_userdata( $initiator_id );
+
+	$all_requests_link = bp_core_get_user_domain( $friend_id ) . BP_FRIENDS_SLUG . '/requests/';
+	$settings_link = bp_core_get_user_domain( $friend_id ) .  BP_SETTINGS_SLUG . '/notifications';
+
+	$initiator_link = bp_core_get_user_domain( $initiator_id );
+
+	// Set up and send the message
+	$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( __(
+"%s wants to add you as a friend.
+
+To view all of your pending friendship requests: %s
+
+To view %s's profile: %s
+
+---------------------
+", 'buddypress' ), $initiator_name, $all_requests_link, $initiator_name, $initiator_link );
+
+	$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
+
+	/* Send the message */
+	$to = apply_filters( 'friends_notification_new_request_to', $to );
+	$subject = apply_filters( 'friends_notification_new_request_subject', $subject, $initiator_name );
+	$message = apply_filters( 'friends_notification_new_request_message', $message, $initiator_name, $initiator_link, $all_requests_link );
+
+	wp_mail( $to, $subject, $message );
+}
+
+function friends_notification_accepted_request( $friendship_id, $initiator_id, $friend_id ) {
+	global $bp;
+
+	$friendship = new BP_Friends_Friendship( $friendship_id, false, false );
+
+	$friend_name = bp_core_get_user_displayname( $friend_id );
+
+	if ( 'no' == get_user_meta( (int)$initiator_id, 'notification_friends_friendship_accepted', true ) )
+		return false;
+
+	$ud = get_userdata( $initiator_id );
+
+	$friend_link = bp_core_get_user_domain( $friend_id );
+	$settings_link = bp_core_get_user_domain( $initiator_id ) .  BP_SETTINGS_SLUG . '/notifications';
+
+	// Set up and send the message
+	$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( __(
+'%s accepted your friend request.
+
+To view %s\'s profile: %s
+
+---------------------
+', 'buddypress' ), $friend_name, $friend_name, $friend_link );
+
+	$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
+
+	/* Send the message */
+	$to = apply_filters( 'friends_notification_accepted_request_to', $to );
+	$subject = apply_filters( 'friends_notification_accepted_request_subject', $subject, $friend_name );
+	$message = apply_filters( 'friends_notification_accepted_request_message', $message, $friend_name, $friend_link );
+
+	wp_mail( $to, $subject, $message );
+}
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-friends/bp-friends-templatetags.php b/wp-content/plugins/buddypress/bp-friends/bp-friends-templatetags.php
new file mode 100644
index 0000000000000000000000000000000000000000..7545923b9e22965acade44f2d2724173b26f852d
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-friends/bp-friends-templatetags.php
@@ -0,0 +1,350 @@
+<?php
+
+function bp_friends_header_tabs() {
+	global $bp;
+?>
+	<li<?php if ( !isset($bp->action_variables[0]) || 'recently-active' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>/my-friends/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li>
+	<li<?php if ( 'newest' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>/my-friends/newest"><?php _e( 'Newest', 'buddypress' ) ?></a></li>
+	<li<?php if ( 'alphabetically' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>/my-friends/alphabetically""><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li>
+<?php
+	do_action( 'friends_header_tabs' );
+}
+
+function bp_friends_filter_title() {
+	global $bp;
+
+	$current_filter = $bp->action_variables[0];
+
+	switch ( $current_filter ) {
+		case 'recently-active': default:
+			_e( 'Recently Active', 'buddypress' );
+			break;
+		case 'newest':
+			_e( 'Newest', 'buddypress' );
+			break;
+		case 'alphabetically':
+			_e( 'Alphabetically', 'buddypress' );
+		break;
+	}
+}
+
+function bp_friends_random_friends() {
+	global $bp;
+
+	if ( !$friend_ids = wp_cache_get( 'friends_friend_ids_' . $bp->displayed_user->id, 'bp' ) ) {
+		$friend_ids = BP_Friends_Friendship::get_random_friends( $bp->displayed_user->id );
+		wp_cache_set( 'friends_friend_ids_' . $bp->displayed_user->id, $friend_ids, 'bp' );
+	}
+?>
+	<div class="info-group">
+		<h4><?php bp_word_or_name( __( "My Friends", 'buddypress' ), __( "%s's Friends", 'buddypress' ) ) ?>  (<?php echo BP_Friends_Friendship::total_friend_count( $bp->displayed_user->id ) ?>) <span><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>"><?php _e('See All', 'buddypress') ?> &rarr;</a></span></h4>
+
+		<?php if ( $friend_ids ) { ?>
+			<ul class="horiz-gallery">
+			<?php for ( $i = 0; $i < count( $friend_ids ); $i++ ) { ?>
+				<li>
+					<a href="<?php echo bp_core_get_user_domain( $friend_ids[$i] ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $friend_ids[$i], 'type' => 'thumb' ) ) ?></a>
+					<h5><?php echo bp_core_get_userlink($friend_ids[$i]) ?></h5>
+				</li>
+			<?php } ?>
+			</ul>
+		<?php } else { ?>
+			<div id="message" class="info">
+				<p><?php bp_word_or_name( __( "You haven't added any friend connections yet.", 'buddypress' ), __( "%s hasn't created any friend connections yet.", 'buddypress' ) ) ?></p>
+			</div>
+		<?php } ?>
+		<div class="clear"></div>
+	</div>
+<?php
+}
+
+function bp_friends_random_members( $total_members = 5 ) {
+	global $bp;
+
+	if ( !$user_ids = wp_cache_get( 'friends_random_users', 'bp' ) ) {
+		$user_ids = BP_Core_User::get_users( 'random', $total_members );
+		wp_cache_set( 'friends_random_users', $user_ids, 'bp' );
+	}
+?>
+	<?php if ( $user_ids['users'] ) { ?>
+		<ul class="item-list" id="random-members-list">
+		<?php for ( $i = 0; $i < count( $user_ids['users'] ); $i++ ) { ?>
+			<li>
+				<a href="<?php echo bp_core_get_user_domain( $user_ids['users'][$i]->user_id ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $user_ids['users'][$i]->user_id, 'type' => 'thumb' ) ) ?></a>
+				<h5><?php echo bp_core_get_userlink( $user_ids['users'][$i]->user_id ) ?></h5>
+				<?php if ( function_exists( 'xprofile_get_random_profile_data' ) ) { ?>
+					<?php $random_data = xprofile_get_random_profile_data( $user_ids['users'][$i]->user_id, true ); ?>
+					<div class="profile-data">
+						<p class="field-name"><?php echo $random_data[0]->name ?></p>
+						<?php echo $random_data[0]->value ?>
+					</div>
+				<?php } ?>
+
+				<div class="action">
+					<?php if ( function_exists( 'bp_add_friend_button' ) ) { ?>
+						<?php bp_add_friend_button( $user_ids['users'][$i]->user_id ) ?>
+					<?php } ?>
+				</div>
+			</li>
+		<?php } ?>
+		</ul>
+	<?php } else { ?>
+		<div id="message" class="info">
+			<p><?php _e( "There aren't enough site members to show a random sample just yet.", 'buddypress' ) ?></p>
+		</div>
+	<?php } ?>
+<?php
+}
+
+function bp_friend_search_form() {
+	global $friends_template, $bp;
+
+	$action = $bp->displayed_user->domain . $bp->friends->slug . '/my-friends/search/';
+	$label = __( 'Filter Friends', 'buddypress' );
+	?>
+		<form action="<?php echo $action ?>" id="friend-search-form" method="post">
+
+			<label for="friend-search-box" id="friend-search-label"><?php echo $label ?></label>
+			<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 esc_attr( $bp->displayed_user->id ) ?>" />
+
+		</form>
+	<?php
+}
+
+function bp_member_add_friend_button() {
+	global $members_template;
+
+	if ( null === $members_template->member->is_friend )
+		$friend_status = 'not_friends';
+	else
+		$friend_status = ( 0 == $members_template->member->is_friend ) ? 'pending' : 'is_friend';
+
+	echo bp_get_add_friend_button( $members_template->member->id, $friend_status );
+}
+add_action( 'bp_directory_members_actions', 'bp_member_add_friend_button' );
+
+function bp_member_total_friend_count() {
+	global $members_template;
+
+	echo bp_get_member_total_friend_count();
+}
+	function bp_get_member_total_friend_count() {
+		global $members_template;
+
+		if ( 1 == (int) $members_template->member->total_friend_count )
+			return apply_filters( 'bp_get_member_total_friend_count', sprintf( __( '%d friend', 'buddypress' ), (int) $members_template->member->total_friend_count ) );
+		else
+			return apply_filters( 'bp_get_member_total_friend_count', sprintf( __( '%d friends', 'buddypress' ), (int) $members_template->member->total_friend_count ) );
+	}
+
+/**
+ * bp_potential_friend_id( $user_id )
+ *
+ * Outputs the ID of the potential friend
+ *
+ * @uses bp_get_potential_friend_id()
+ * @param <type> $user_id
+ */
+function bp_potential_friend_id( $user_id = 0 ) {
+	echo bp_get_potential_friend_id( $user_id );
+}
+	/**
+	 * bp_get_potential_friend_id( $user_id )
+	 *
+	 * Returns the ID of the potential friend
+	 *
+	 * @global object $bp
+	 * @global object $friends_template
+	 * @param int $user_id
+	 * @return int ID of potential friend
+	 */
+	function bp_get_potential_friend_id( $user_id = 0 ) {
+		global $bp, $friends_template;
+
+		if ( empty( $user_id ) && isset( $friends_template->friendship->friend ) )
+			$user_id = $friends_template->friendship->friend->id;
+		else if ( empty( $user_id ) && !isset( $friends_template->friendship->friend ) )
+			$user_id = $bp->displayed_user->id;
+
+		return apply_filters( 'bp_get_potential_friend_id', (int)$user_id );
+	}
+
+/**
+ * bp_is_friend( $user_id )
+ *
+ * Returns - 'is_friend', 'not_friends', 'pending'
+ *
+ * @global object $bp
+ * @param int $potential_friend_id
+ * @return string
+ */
+function bp_is_friend( $user_id = 0 ) {
+	global $bp;
+
+	if ( !is_user_logged_in() )
+		return false;
+
+	if ( empty( $user_id ) )
+		$user_id = bp_get_potential_friend_id( $user_id );
+
+	if ( $bp->loggedin_user->id == $user_id )
+		return false;
+
+	return apply_filters( 'bp_is_friend', friends_check_friendship_status( $bp->loggedin_user->id, $user_id ), $user_id );
+}
+
+function bp_add_friend_button( $potential_friend_id = 0, $friend_status = false ) {
+	echo bp_get_add_friend_button( $potential_friend_id, $friend_status );
+}
+	function bp_get_add_friend_button( $potential_friend_id = 0, $friend_status = false ) {
+		global $bp, $friends_template;
+
+		if ( empty( $potential_friend_id ) )
+			$potential_friend_id = bp_get_potential_friend_id( $potential_friend_id );
+
+		$is_friend = bp_is_friend( $potential_friend_id );
+
+		if ( empty( $is_friend ) )
+			return false;
+
+		switch ( $is_friend ) {
+			case 'pending' :
+				$button = array(
+					'id'                => 'pending',
+					'component'         => 'friends',
+					'must_be_logged_in' => true,
+					'block_self'        => true,
+					'wrapper_class'     => 'friendship-button pending',
+					'wrapper_id'        => 'friendship-button-' . $potential_friend_id,
+					'link_class'        => 'requested',
+					'link_href'         => trailingslashit( $bp->loggedin_user->domain . $bp->friends->slug ),
+					'link_text'         => __( 'Friendship Requested', 'buddypress' ),
+					'link_title'        => __( 'Friendship Requested', 'buddypress' )
+				);
+				break;
+
+			case 'is_friend' :
+				$button = array(
+					'id'                => 'is_friend',
+					'component'         => 'friends',
+					'must_be_logged_in' => true,
+					'block_self'        => true,
+					'wrapper_class'     => 'friendship-button is_friend',
+					'wrapper_id'        => 'friendship-button-' . $potential_friend_id,
+					'link_class'        => '',
+					'link_href'         => wp_nonce_url( $bp->loggedin_user->domain . $bp->friends->slug . '/remove-friend/' . $potential_friend_id . '/', 'friends_remove_friend' ),
+					'link_text'         => __( 'Cancel Friendship', 'buddypress' ),
+					'link_title'        => __( 'Cancel Friendship', 'buddypress' ),
+					'link_id'           => 'friend-' . $potential_friend_id,
+					'link_rel'          => 'remove',
+					'link_class'        => 'remove'
+				);
+				break;
+
+			default:
+				$button = array(
+					'id'                => 'not_friends',
+					'component'         => 'friends',
+					'must_be_logged_in' => true,
+					'block_self'        => true,
+					'wrapper_class'     => 'friendship-button not_friends',
+					'wrapper_id'        => 'friendship-button-' . $potential_friend_id,
+					'link_class'        => '',
+					'link_href'         => wp_nonce_url( $bp->loggedin_user->domain . $bp->friends->slug . '/add-friend/' . $potential_friend_id . '/', 'friends_add_friend' ),
+					'link_text'         => __( 'Add Friend', 'buddypress' ),
+					'link_title'        => __( 'Add Friend', 'buddypress' ),
+					'link_id'           => 'friend-' . $potential_friend_id,
+					'link_rel'          => 'add',
+					'link_class'        => 'add'
+				);
+				break;
+		}
+
+		// Filter and return the HTML button
+		return bp_get_button( apply_filters( 'bp_get_add_friend_button', $button ) );
+	}
+
+function bp_get_friend_ids( $user_id = false ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
+
+	$friend_ids = friends_get_friend_user_ids( $user_id );
+
+	if ( empty( $friend_ids ) )
+		return false;
+
+	return implode( ',', friends_get_friend_user_ids( $user_id ) );
+}
+function bp_get_friendship_requests() {
+	global $bp;
+
+	return apply_filters( 'bp_get_friendship_requests', implode( ',', (array) friends_get_friendship_request_user_ids( $bp->loggedin_user->id ) ) );
+}
+
+function bp_friend_friendship_id() {
+	echo bp_get_friend_friendship_id();
+}
+	function bp_get_friend_friendship_id() {
+		global $members_template, $bp;
+
+		if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . $bp->loggedin_user->id ) ) {
+			$friendship_id = friends_get_friendship_id( $members_template->member->id, $bp->loggedin_user->id );
+			wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . $bp->loggedin_user->id, $friendship_id, 'bp' );
+		}
+
+		return apply_filters( 'bp_get_friend_friendship_id', $friendship_id );
+	}
+
+function bp_friend_accept_request_link() {
+	echo bp_get_friend_accept_request_link();
+}
+	function bp_get_friend_accept_request_link() {
+		global $members_template, $bp;
+
+		if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . $bp->loggedin_user->id ) ) {
+			$friendship_id = friends_get_friendship_id( $members_template->member->id, $bp->loggedin_user->id );
+			wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . $bp->loggedin_user->id, $friendship_id, 'bp' );
+		}
+
+		return apply_filters( 'bp_get_friend_accept_request_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->friends->slug . '/requests/accept/' . $friendship_id, 'friends_accept_friendship' ) );
+	}
+
+function bp_friend_reject_request_link() {
+	echo bp_get_friend_reject_request_link();
+}
+	function bp_get_friend_reject_request_link() {
+		global $members_template, $bp;
+
+		if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . $bp->loggedin_user->id ) ) {
+			$friendship_id = friends_get_friendship_id( $members_template->member->id, $bp->loggedin_user->id );
+			wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . $bp->loggedin_user->id, $friendship_id, 'bp' );
+		}
+
+		return apply_filters( 'bp_get_friend_reject_request_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->friends->slug . '/requests/reject/' . $friendship_id, 'friends_reject_friendship' ) );
+	}
+
+function bp_total_friend_count( $user_id = 0 ) {
+	echo bp_get_total_friend_count( $user_id );
+}
+	function bp_get_total_friend_count( $user_id = 0 ) {
+		return apply_filters( 'bp_get_total_friend_count', friends_get_total_friend_count( $user_id ) );
+	}
+	add_filter( 'bp_get_total_friend_count', 'bp_core_number_format' );
+
+function bp_friend_total_requests_count( $user_id = 0 ) {
+	echo bp_friend_get_total_requests_count( $user_id );
+}
+	function bp_friend_get_total_requests_count( $user_id = 0 ) {
+		global $bp;
+
+		if ( empty( $user_id ) )
+			$user_id = $bp->loggedin_user->id;
+
+		return apply_filters( 'bp_friend_get_total_requests_count', (int) BP_Friends_Friendship::get_friend_user_ids( $user_id, true ) );
+	}
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-groups.php b/wp-content/plugins/buddypress/bp-groups.php
new file mode 100644
index 0000000000000000000000000000000000000000..8dbd87aa46620491e3c794f5fc05f1bcdf05fd23
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-groups.php
@@ -0,0 +1,2696 @@
+<?php
+
+define ( 'BP_GROUPS_DB_VERSION', '1900' );
+
+/* Define the slug for the component */
+if ( !defined( 'BP_GROUPS_SLUG' ) )
+	define ( 'BP_GROUPS_SLUG', 'groups' );
+
+require ( BP_PLUGIN_DIR . '/bp-groups/bp-groups-classes.php' );
+require ( BP_PLUGIN_DIR . '/bp-groups/bp-groups-templatetags.php' );
+require ( BP_PLUGIN_DIR . '/bp-groups/bp-groups-widgets.php' );
+require ( BP_PLUGIN_DIR . '/bp-groups/bp-groups-filters.php' );
+
+function groups_install() {
+	global $wpdb, $bp;
+
+	if ( !empty($wpdb->charset) )
+		$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
+
+	$sql[] = "CREATE TABLE {$bp->groups->table_name} (
+	  		id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+			creator_id bigint(20) NOT NULL,
+	  		name varchar(100) NOT NULL,
+	  		slug varchar(100) NOT NULL,
+	  		description longtext NOT NULL,
+			status varchar(10) NOT NULL DEFAULT 'public',
+			enable_forum tinyint(1) NOT NULL DEFAULT '1',
+			date_created datetime NOT NULL,
+		    KEY creator_id (creator_id),
+		    KEY status (status)
+	 	   ) {$charset_collate};";
+
+	$sql[] = "CREATE TABLE {$bp->groups->table_name_members} (
+	  		id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+			group_id bigint(20) NOT NULL,
+			user_id bigint(20) NOT NULL,
+			inviter_id bigint(20) NOT NULL,
+			is_admin tinyint(1) NOT NULL DEFAULT '0',
+			is_mod tinyint(1) NOT NULL DEFAULT '0',
+			user_title varchar(100) NOT NULL,
+			date_modified datetime NOT NULL,
+			comments longtext NOT NULL,
+			is_confirmed tinyint(1) NOT NULL DEFAULT '0',
+			is_banned tinyint(1) NOT NULL DEFAULT '0',
+			invite_sent tinyint(1) NOT NULL DEFAULT '0',
+			KEY group_id (group_id),
+			KEY is_admin (is_admin),
+			KEY is_mod (is_mod),
+		 	KEY user_id (user_id),
+			KEY inviter_id (inviter_id),
+			KEY is_confirmed (is_confirmed)
+	 	   ) {$charset_collate};";
+
+	$sql[] = "CREATE TABLE {$bp->groups->table_name_groupmeta} (
+			id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+			group_id bigint(20) NOT NULL,
+			meta_key varchar(255) DEFAULT NULL,
+			meta_value longtext DEFAULT NULL,
+			KEY group_id (group_id),
+			KEY meta_key (meta_key)
+		   ) {$charset_collate};";
+
+	require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
+	dbDelta($sql);
+
+	do_action( 'groups_install' );
+
+	update_site_option( 'bp-groups-db-version', BP_GROUPS_DB_VERSION );
+}
+
+function groups_setup_globals() {
+	global $bp, $wpdb;
+
+	/* For internal identification */
+	$bp->groups->id = 'groups';
+
+	$bp->groups->slug = BP_GROUPS_SLUG;
+
+	$bp->groups->table_name           = $bp->table_prefix . 'bp_groups';
+	$bp->groups->table_name_members   = $bp->table_prefix . 'bp_groups_members';
+	$bp->groups->table_name_groupmeta = $bp->table_prefix . 'bp_groups_groupmeta';
+
+	$bp->groups->format_notification_function = 'groups_format_notifications';
+
+	/* Register this in the active components array */
+	$bp->active_components[$bp->groups->slug] = $bp->groups->id;
+
+	$bp->groups->forbidden_names = apply_filters( 'groups_forbidden_names', array( 'my-groups', 'create', 'invites', 'send-invites', 'forum', 'delete', 'add', 'admin', 'request-membership', 'members', 'settings', 'avatar', BP_GROUPS_SLUG ) );
+
+	$bp->groups->group_creation_steps = apply_filters( 'groups_create_group_steps', array(
+		'group-details' => array( 'name' => __( 'Details', 'buddypress' ), 'position' => 0 ),
+		'group-settings' => array( 'name' => __( 'Settings', 'buddypress' ), 'position' => 10 ),
+		'group-avatar' => array( 'name' => __( 'Avatar', 'buddypress' ), 'position' => 20 ),
+	) );
+
+	if ( bp_is_active( 'friends' ) )
+		$bp->groups->group_creation_steps['group-invites'] = array( 'name' => __( 'Invites', 'buddypress' ), 'position' => 30 );
+
+	$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' );
+
+function groups_setup_root_component() {
+	/* Register 'groups' as a root component */
+	bp_core_add_root_component( BP_GROUPS_SLUG );
+}
+add_action( 'bp_setup_root_components', 'groups_setup_root_component' );
+
+function groups_check_installed() {
+	/* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
+	if ( get_site_option( 'bp-groups-db-version' ) < BP_GROUPS_DB_VERSION )
+		groups_install();
+}
+add_action( 'admin_menu', 'groups_check_installed' );
+
+function groups_setup_nav() {
+	global $bp;
+
+	if ( $bp->current_component == $bp->groups->slug && $group_id = BP_Groups_Group::group_exists($bp->current_action) ) {
+
+		/* This is a single group page. */
+		$bp->is_single_item = true;
+		$bp->groups->current_group = new BP_Groups_Group( $group_id );
+
+		/* Using "item" not "group" for generic support in other components. */
+		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 );
+
+		/* If the user is not an admin, check if they are a moderator */
+		if ( !$bp->is_item_admin )
+			$bp->is_item_mod = groups_is_user_mod( $bp->loggedin_user->id, $bp->groups->current_group->id );
+
+		/* Is the logged in user a member of the group? */
+		$bp->groups->current_group->is_user_member = ( is_user_logged_in() && groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) ? true : false;
+
+		/* Should this group be visible to the logged in user? */
+		$bp->groups->current_group->is_group_visible_to_member = ( 'public' == $bp->groups->current_group->status || $is_member ) ? true : false;
+	}
+
+	/* Add 'Groups' to the main navigation */
+	bp_core_new_nav_item( array( 'name' => sprintf( __( 'Groups <span>(%d)</span>', 'buddypress' ), groups_total_groups_for_user() ), 'slug' => $bp->groups->slug, 'position' => 70, 'screen_function' => 'groups_screen_my_groups', 'default_subnav_slug' => 'my-groups', 'item_css_id' => $bp->groups->id ) );
+
+	$groups_link = $bp->loggedin_user->domain . $bp->groups->slug . '/';
+
+	/* Add the subnav items to the groups nav item */
+	bp_core_new_subnav_item( array( 'name' => __( 'My Groups', 'buddypress' ), 'slug' => 'my-groups', 'parent_url' => $groups_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_my_groups', 'position' => 10, 'item_css_id' => 'groups-my-groups' ) );
+	bp_core_new_subnav_item( array( 'name' => __( 'Invites', 'buddypress' ), 'slug' => 'invites', 'parent_url' => $groups_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_invites', 'position' => 30, 'user_has_access' => bp_is_my_profile() ) );
+
+	if ( $bp->current_component == $bp->groups->slug ) {
+
+		if ( bp_is_my_profile() && !$bp->is_single_item ) {
+
+			$bp->bp_options_title = __( 'My Groups', 'buddypress' );
+
+		} else if ( !bp_is_my_profile() && !$bp->is_single_item ) {
+
+			$bp->bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => 'thumb' ) );
+			$bp->bp_options_title = $bp->displayed_user->fullname;
+
+		} else if ( $bp->is_single_item ) {
+			// We are viewing a single group, so set up the
+			// group navigation menu using the $bp->groups->current_group global.
+
+			/* When in a single group, the first action is bumped down one because of the
+			   group name, so we need to adjust this and set the group name to current_item. */
+			$bp->current_item = $bp->current_action;
+			$bp->current_action = $bp->action_variables[0];
+			array_shift($bp->action_variables);
+
+			$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="' . 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_super_admin() )
+					$bp->groups->current_group->user_has_access = true;
+				else
+					$bp->groups->current_group->user_has_access = false;
+			} else {
+				$bp->groups->current_group->user_has_access = true;
+			}
+
+			/* Reset the existing subnav items */
+			bp_core_reset_subnav_items($bp->groups->slug);
+
+			/* Add a new default subnav item for when the groups nav is selected. */
+			bp_core_new_nav_default( array( 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_home', 'subnav_slug' => 'home' ) );
+
+			/* Add the "Home" subnav item, as this will always be present */
+			bp_core_new_subnav_item( array( 'name' => __( 'Home', 'buddypress' ), 'slug' => 'home', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_home', 'position' => 10, 'item_css_id' => 'home' ) );
+
+			/* If the user is a group mod or more, then show the group admin nav item */
+			if ( $bp->is_item_mod || $bp->is_item_admin )
+				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_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') )
+				bp_core_new_subnav_item( array( 'name' => __( 'Forum', 'buddypress' ), 'slug' => 'forum', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_forum', 'position' => 40, 'user_has_access' => $bp->groups->current_group->user_has_access, 'item_css_id' => 'forums' ) );
+
+			bp_core_new_subnav_item( array( 'name' => sprintf( __( 'Members (%s)', 'buddypress' ), number_format( $bp->groups->current_group->total_member_count ) ), 'slug' => 'members', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_members', 'position' => 60, 'user_has_access' => $bp->groups->current_group->user_has_access, 'item_css_id' => 'members'  ) );
+
+			if ( is_user_logged_in() && groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
+				if ( function_exists('friends_install') )
+					bp_core_new_subnav_item( array( 'name' => __( 'Send Invites', 'buddypress' ), 'slug' => 'send-invites', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_invite', 'item_css_id' => 'invite', 'position' => 70, 'user_has_access' => $bp->groups->current_group->user_has_access ) );
+			}
+		}
+	}
+
+	do_action( 'groups_setup_nav', $bp->groups->current_group->user_has_access );
+}
+add_action( 'bp_setup_nav', 'groups_setup_nav' );
+
+function groups_directory_groups_setup() {
+	global $bp;
+
+	if ( $bp->current_component == $bp->groups->slug && empty( $bp->current_action ) && empty( $bp->current_item ) ) {
+		$bp->is_directory = true;
+
+		do_action( 'groups_directory_groups_setup' );
+		bp_core_load_template( apply_filters( 'groups_template_directory_groups', 'groups/index' ) );
+	}
+}
+add_action( 'wp', 'groups_directory_groups_setup', 2 );
+
+function groups_setup_adminbar_menu() {
+	global $bp;
+
+	if ( !$bp->groups->current_group )
+		return false;
+
+	/* Don't show this menu to non site admins or if you're viewing your own profile */
+	if ( !is_super_admin() )
+		return false;
+	?>
+	<li id="bp-adminbar-adminoptions-menu">
+		<a href=""><?php _e( 'Admin Options', 'buddypress' ) ?></a>
+
+		<ul>
+			<li><a class="confirm" href="<?php echo wp_nonce_url( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/delete-group/', 'groups_delete_group' ) ?>&amp;delete-group-button=1&amp;delete-group-understand=1"><?php _e( "Delete Group", 'buddypress' ) ?></a></li>
+
+			<?php do_action( 'groups_adminbar_menu_items' ) ?>
+		</ul>
+	</li>
+	<?php
+}
+add_action( 'bp_adminbar_menus', 'groups_setup_adminbar_menu', 20 );
+
+
+/********************************************************************************
+ * Screen Functions
+ *
+ * Screen functions are the controllers of BuddyPress. They will execute when their
+ * specific URL is caught. They will first save or manipulate data using business
+ * functions, then pass on the user to a template file.
+ */
+
+function groups_screen_my_groups() {
+	global $bp;
+
+	if ( isset($_GET['n']) ) {
+		// Delete group request notifications for the user
+		bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->id, 'membership_request_accepted' );
+		bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->id, 'membership_request_rejected' );
+		bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->id, 'member_promoted_to_mod' );
+		bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->id, 'member_promoted_to_admin' );
+	}
+
+	do_action( 'groups_screen_my_groups' );
+
+	bp_core_load_template( apply_filters( 'groups_template_my_groups', 'members/single/home' ) );
+}
+
+function groups_screen_group_invites() {
+	global $bp;
+
+	$group_id = $bp->action_variables[1];
+
+	if ( isset($bp->action_variables) && in_array( 'accept', (array)$bp->action_variables ) && is_numeric($group_id) ) {
+		/* Check the nonce */
+		if ( !check_admin_referer( 'groups_accept_invite' ) )
+			return false;
+
+		if ( !groups_accept_invite( $bp->loggedin_user->id, $group_id ) ) {
+			bp_core_add_message( __('Group invite could not be accepted', 'buddypress'), 'error' );
+		} else {
+			bp_core_add_message( __('Group invite accepted', 'buddypress') );
+
+			/* Record this in activity streams */
+			$group = new BP_Groups_Group( $group_id );
+
+			groups_record_activity( array(
+				'action' => apply_filters( 'groups_activity_accepted_invite_action', sprintf( __( '%s joined the group %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
+			) );
+		}
+
+		bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
+
+	} else if ( isset($bp->action_variables) && in_array( 'reject', (array)$bp->action_variables ) && is_numeric($group_id) ) {
+		/* Check the nonce */
+		if ( !check_admin_referer( 'groups_reject_invite' ) )
+			return false;
+
+		if ( !groups_reject_invite( $bp->loggedin_user->id, $group_id ) ) {
+			bp_core_add_message( __('Group invite could not be rejected', 'buddypress'), 'error' );
+		} else {
+			bp_core_add_message( __('Group invite rejected', 'buddypress') );
+		}
+
+		bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
+	}
+
+	// Remove notifications
+	bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->id, 'group_invite' );
+
+	do_action( 'groups_screen_group_invites', $group_id );
+
+	bp_core_load_template( apply_filters( 'groups_template_group_invites', 'members/single/home' ) );
+}
+
+function groups_screen_group_home() {
+	global $bp;
+
+	if ( $bp->is_single_item ) {
+		if ( isset($_GET['n']) ) {
+			// Delete group request notifications for the user
+			bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->id, 'membership_request_accepted' );
+			bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->id, 'membership_request_rejected' );
+			bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->id, 'member_promoted_to_mod' );
+			bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->id, 'member_promoted_to_admin' );
+		}
+
+		do_action( 'groups_screen_group_home' );
+
+		bp_core_load_template( apply_filters( 'groups_template_group_home', 'groups/single/home' ) );
+	}
+}
+
+function groups_screen_group_forum() {
+	global $bp;
+
+	if ( $bp->is_single_item && $bp->groups->current_group->user_has_access ) {
+
+		/* Fetch the details we need */
+		$topic_slug = $bp->action_variables[1];
+		$topic_id = bp_forums_get_topic_id_from_slug( $topic_slug );
+		$forum_id = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' );
+
+		if ( $topic_slug && $topic_id ) {
+
+			/* Posting a reply */
+			if ( !$bp->action_variables[2] && isset( $_POST['submit_reply'] ) ) {
+				/* Check the nonce */
+				check_admin_referer( 'bp_forums_new_reply' );
+
+				/* Auto join this user if they are not yet a member of this group */
+				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'] ) )
+					bp_core_add_message( __( 'There was an error when replying to that topic', 'buddypress'), 'error' );
+				else
+					bp_core_add_message( __( 'Your reply was posted successfully', 'buddypress') );
+
+				if ( $_SERVER['QUERY_STRING'] )
+					$query_vars = '?' . $_SERVER['QUERY_STRING'];
+
+				bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic_slug . '/' . $query_vars . '#post-' . $post_id );
+			}
+
+			/* Sticky a topic */
+			else if ( 'stick' == $bp->action_variables[2] && ( $bp->is_item_admin || $bp->is_item_mod ) ) {
+				/* Check the nonce */
+				check_admin_referer( 'bp_forums_stick_topic' );
+
+				if ( !bp_forums_sticky_topic( array( 'topic_id' => $topic_id ) ) )
+					bp_core_add_message( __( 'There was an error when making that topic a sticky', 'buddypress' ), 'error' );
+				else
+					bp_core_add_message( __( 'The topic was made sticky successfully', 'buddypress' ) );
+
+				do_action( 'groups_stick_forum_topic', $topic_id );
+				bp_core_redirect( wp_get_referer() );
+			}
+
+			/* Un-Sticky a topic */
+			else if ( 'unstick' == $bp->action_variables[2] && ( $bp->is_item_admin || $bp->is_item_mod ) ) {
+				/* Check the nonce */
+				check_admin_referer( 'bp_forums_unstick_topic' );
+
+				if ( !bp_forums_sticky_topic( array( 'topic_id' => $topic_id, 'mode' => 'unstick' ) ) )
+					bp_core_add_message( __( 'There was an error when unsticking that topic', 'buddypress'), 'error' );
+				else
+					bp_core_add_message( __( 'The topic was unstuck successfully', 'buddypress') );
+
+				do_action( 'groups_unstick_forum_topic', $topic_id );
+				bp_core_redirect( wp_get_referer() );
+			}
+
+			/* Close a topic */
+			else if ( 'close' == $bp->action_variables[2] && ( $bp->is_item_admin || $bp->is_item_mod ) ) {
+				/* Check the nonce */
+				check_admin_referer( 'bp_forums_close_topic' );
+
+				if ( !bp_forums_openclose_topic( array( 'topic_id' => $topic_id ) ) )
+					bp_core_add_message( __( 'There was an error when closing that topic', 'buddypress'), 'error' );
+				else
+					bp_core_add_message( __( 'The topic was closed successfully', 'buddypress') );
+
+				do_action( 'groups_close_forum_topic', $topic_id );
+				bp_core_redirect( wp_get_referer() );
+			}
+
+			/* Open a topic */
+			else if ( 'open' == $bp->action_variables[2] && ( $bp->is_item_admin || $bp->is_item_mod ) ) {
+				/* Check the nonce */
+				check_admin_referer( 'bp_forums_open_topic' );
+
+				if ( !bp_forums_openclose_topic( array( 'topic_id' => $topic_id, 'mode' => 'open' ) ) )
+					bp_core_add_message( __( 'There was an error when opening that topic', 'buddypress'), 'error' );
+				else
+					bp_core_add_message( __( 'The topic was opened successfully', 'buddypress') );
+
+				do_action( 'groups_open_forum_topic', $topic_id );
+				bp_core_redirect( wp_get_referer() );
+			}
+
+			/* Delete a topic */
+			else if ( 'delete' == $bp->action_variables[2] && empty( $bp->action_variables[3] ) ) {
+				/* Fetch the topic */
+				$topic = bp_forums_get_topic_details( $topic_id );
+
+				/* Check the logged in user can delete this topic */
+				if ( !$bp->is_item_admin && !$bp->is_item_mod && (int)$bp->loggedin_user->id != (int)$topic->topic_poster )
+					bp_core_redirect( wp_get_referer() );
+
+				/* Check the nonce */
+				check_admin_referer( 'bp_forums_delete_topic' );
+
+				if ( !groups_delete_group_forum_topic( $topic_id ) )
+					bp_core_add_message( __( 'There was an error deleting the topic', 'buddypress'), 'error' );
+				else
+					bp_core_add_message( __( 'The topic was deleted successfully', 'buddypress') );
+
+				do_action( 'groups_delete_forum_topic', $topic_id );
+				bp_core_redirect( wp_get_referer() );
+			}
+
+			/* Editing a topic */
+			else if ( 'edit' == $bp->action_variables[2] && empty( $bp->action_variables[3] ) ) {
+				/* Fetch the topic */
+				$topic = bp_forums_get_topic_details( $topic_id );
+
+				/* Check the logged in user can edit this topic */
+				if ( !$bp->is_item_admin && !$bp->is_item_mod && (int)$bp->loggedin_user->id != (int)$topic->topic_poster )
+					bp_core_redirect( wp_get_referer() );
+
+				if ( isset( $_POST['save_changes'] ) ) {
+					/* Check the nonce */
+					check_admin_referer( 'bp_forums_edit_topic' );
+
+					if ( !groups_update_group_forum_topic( $topic_id, $_POST['topic_title'], $_POST['topic_text'] ) )
+						bp_core_add_message( __( 'There was an error when editing that topic', 'buddypress'), 'error' );
+					else
+						bp_core_add_message( __( 'The topic was edited successfully', 'buddypress') );
+
+					do_action( 'groups_edit_forum_topic', $topic_id );
+					bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic_slug . '/' );
+				}
+
+				bp_core_load_template( apply_filters( 'groups_template_group_forum_topic_edit', 'groups/single/home' ) );
+			}
+
+			/* Delete a post */
+			else if ( 'delete' == $bp->action_variables[2] && $post_id = $bp->action_variables[4] ) {
+				/* Fetch the post */
+				$post = bp_forums_get_post( $post_id );
+
+				/* Check the logged in user can edit this topic */
+				if ( !$bp->is_item_admin && !$bp->is_item_mod && (int)$bp->loggedin_user->id != (int)$post->poster_id )
+					bp_core_redirect( wp_get_referer() );
+
+				/* Check the nonce */
+				check_admin_referer( 'bp_forums_delete_post' );
+
+				if ( !groups_delete_group_forum_post( $bp->action_variables[4], $topic_id ) )
+					bp_core_add_message( __( 'There was an error deleting that post', 'buddypress'), 'error' );
+				else
+					bp_core_add_message( __( 'The post was deleted successfully', 'buddypress') );
+
+				do_action( 'groups_delete_forum_post', $post_id );
+				bp_core_redirect( wp_get_referer() );
+			}
+
+			/* Editing a post */
+			else if ( 'edit' == $bp->action_variables[2] && $post_id = $bp->action_variables[4] ) {
+				/* Fetch the post */
+				$post = bp_forums_get_post( $bp->action_variables[4] );
+
+				/* Check the logged in user can edit this topic */
+				if ( !$bp->is_item_admin && !$bp->is_item_mod && (int)$bp->loggedin_user->id != (int)$post->poster_id )
+					bp_core_redirect( wp_get_referer() );
+
+				if ( isset( $_POST['save_changes'] ) ) {
+					/* Check the nonce */
+					check_admin_referer( 'bp_forums_edit_post' );
+
+					if ( !$post_id = groups_update_group_forum_post( $post_id, $_POST['post_text'], $topic_id, $_GET['topic_page'] ) )
+						bp_core_add_message( __( 'There was an error when editing that post', 'buddypress'), 'error' );
+					else
+						bp_core_add_message( __( 'The post was edited successfully', 'buddypress') );
+
+					if ( $_SERVER['QUERY_STRING'] )
+						$query_vars = '?' . $_SERVER['QUERY_STRING'];
+
+					do_action( 'groups_edit_forum_post', $post_id );
+					bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic_slug . '/' . $query_vars . '#post-' . $post_id );
+				}
+
+				bp_core_load_template( apply_filters( 'groups_template_group_forum_topic_edit', 'groups/single/home' ) );
+			}
+
+			/* Standard topic display */
+			else {
+				bp_core_load_template( apply_filters( 'groups_template_group_forum_topic', 'groups/single/home' ) );
+			}
+
+		} else {
+
+			/* Posting a topic */
+			if ( isset( $_POST['submit_topic'] ) && function_exists( 'bp_forums_new_topic') ) {
+				/* Check the nonce */
+				check_admin_referer( 'bp_forums_new_topic' );
+
+				/* Auto join this user if they are not yet a member of this group */
+				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 ) )
+					bp_core_add_message( __( 'There was an error when creating the topic', 'buddypress'), 'error' );
+				else
+					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 . '/' );
+			}
+
+			do_action( 'groups_screen_group_forum', $topic_id, $forum_id );
+
+			bp_core_load_template( apply_filters( 'groups_template_group_forum', 'groups/single/home' ) );
+		}
+	}
+}
+
+function groups_screen_group_members() {
+	global $bp;
+
+	if ( $bp->is_single_item ) {
+		/* Refresh the group member count meta */
+		groups_update_groupmeta( $bp->groups->current_group->id, 'total_member_count', groups_get_total_member_count( $bp->groups->current_group->id ) );
+
+		do_action( 'groups_screen_group_members', $bp->groups->current_group->id );
+		bp_core_load_template( apply_filters( 'groups_template_group_members', 'groups/single/home' ) );
+	}
+}
+
+function groups_screen_group_invite() {
+	global $bp;
+
+	if ( $bp->is_single_item ) {
+		if ( isset($bp->action_variables) && 'send' == $bp->action_variables[0] ) {
+
+			if ( !check_admin_referer( 'groups_send_invites', '_wpnonce_send_invites' ) )
+				return false;
+
+			// Send the invites.
+			groups_send_invites( $bp->loggedin_user->id, $bp->groups->current_group->id );
+
+			bp_core_add_message( __('Group invites sent.', 'buddypress') );
+
+			do_action( 'groups_screen_group_invite', $bp->groups->current_group->id );
+
+			bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
+		} else {
+			// Show send invite page
+			bp_core_load_template( apply_filters( 'groups_template_group_invite', 'groups/single/home' ) );
+		}
+	}
+}
+
+function groups_screen_group_request_membership() {
+	global $bp;
+
+	if ( !is_user_logged_in() )
+		return false;
+
+	if ( 'private' == $bp->groups->current_group->status ) {
+		// If the user has submitted a request, send it.
+		if ( isset( $_POST['group-request-send']) ) {
+			/* Check the nonce first. */
+			if ( !check_admin_referer( 'groups_request_membership' ) )
+				return false;
+
+			if ( !groups_send_membership_request( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
+				bp_core_add_message( __( 'There was an error sending your group membership request, please try again.', 'buddypress' ), 'error' );
+			} else {
+				bp_core_add_message( __( 'Your membership request was sent to the group administrator successfully. You will be notified when the group administrator responds to your request.', 'buddypress' ) );
+			}
+			bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
+		}
+
+		do_action( 'groups_screen_group_request_membership', $bp->groups->current_group->id );
+
+		bp_core_load_template( apply_filters( 'groups_template_group_request_membership', 'groups/single/home' ) );
+	}
+}
+
+function groups_screen_group_activity_permalink() {
+	global $bp;
+
+	if ( $bp->current_component != $bp->groups->slug || $bp->current_action != $bp->activity->slug || empty( $bp->action_variables[0] ) )
+		return false;
+
+	$bp->is_single_item = true;
+
+	bp_core_load_template( apply_filters( 'groups_template_group_home', 'groups/single/home' ) );
+}
+add_action( 'wp', 'groups_screen_group_activity_permalink', 3 );
+
+function groups_screen_group_admin() {
+	global $bp;
+
+	if ( $bp->current_component != BP_GROUPS_SLUG || 'admin' != $bp->current_action )
+		return false;
+
+	if ( !empty( $bp->action_variables[0] ) )
+		return false;
+
+	bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/edit-details/' );
+}
+
+function groups_screen_group_admin_edit_details() {
+	global $bp;
+
+	if ( $bp->current_component == $bp->groups->slug && 'edit-details' == $bp->action_variables[0] ) {
+
+		if ( $bp->is_item_admin || $bp->is_item_mod  ) {
+
+			// If the edit form has been submitted, save the edited details
+			if ( isset( $_POST['save'] ) ) {
+				/* Check the nonce first. */
+				if ( !check_admin_referer( 'groups_edit_group_details' ) )
+					return false;
+
+				if ( !groups_edit_base_group_details( $_POST['group-id'], $_POST['group-name'], $_POST['group-desc'], (int)$_POST['group-notify-members'] ) ) {
+					bp_core_add_message( __( 'There was an error updating group details, please try again.', 'buddypress' ), 'error' );
+				} else {
+					bp_core_add_message( __( 'Group details were successfully updated.', 'buddypress' ) );
+				}
+
+				do_action( 'groups_group_details_edited', $bp->groups->current_group->id );
+
+				bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/edit-details/' );
+			}
+
+			do_action( 'groups_screen_group_admin_edit_details', $bp->groups->current_group->id );
+
+			bp_core_load_template( apply_filters( 'groups_template_group_admin', 'groups/single/home' ) );
+		}
+	}
+}
+add_action( 'wp', 'groups_screen_group_admin_edit_details', 4 );
+
+function groups_screen_group_admin_settings() {
+	global $bp;
+
+	if ( $bp->current_component == $bp->groups->slug && 'group-settings' == $bp->action_variables[0] ) {
+
+		if ( !$bp->is_item_admin )
+			return false;
+
+		// If the edit form has been submitted, save the edited details
+		if ( isset( $_POST['save'] ) ) {
+			$enable_forum = ( isset($_POST['group-show-forum'] ) ) ? 1 : 0;
+
+			$allowed_status = apply_filters( 'groups_allowed_status', array( 'public', 'private', 'hidden' ) );
+			$status = ( in_array( $_POST['group-status'], (array)$allowed_status ) ) ? $_POST['group-status'] : 'public';
+
+			/* Check the nonce first. */
+			if ( !check_admin_referer( 'groups_edit_group_settings' ) )
+				return false;
+
+			if ( !groups_edit_group_settings( $_POST['group-id'], $enable_forum, $status ) ) {
+				bp_core_add_message( __( 'There was an error updating group settings, please try again.', 'buddypress' ), 'error' );
+			} else {
+				bp_core_add_message( __( 'Group settings were successfully updated.', 'buddypress' ) );
+			}
+
+			do_action( 'groups_group_settings_edited', $bp->groups->current_group->id );
+
+			bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/group-settings/' );
+		}
+
+		do_action( 'groups_screen_group_admin_settings', $bp->groups->current_group->id );
+
+		bp_core_load_template( apply_filters( 'groups_template_group_admin_settings', 'groups/single/home' ) );
+	}
+}
+add_action( 'wp', 'groups_screen_group_admin_settings', 4 );
+
+function groups_screen_group_admin_avatar() {
+	global $bp;
+
+	if ( $bp->current_component == $bp->groups->slug && 'group-avatar' == $bp->action_variables[0] ) {
+
+		if ( !$bp->is_item_admin )
+			return false;
+
+		/* If the group admin has deleted the admin avatar */
+		if ( 'delete' == $bp->action_variables[1] ) {
+
+			/* Check the nonce */
+			check_admin_referer( 'bp_group_avatar_delete' );
+
+			if ( bp_core_delete_existing_avatar( array( 'item_id' => $bp->groups->current_group->id, 'object' => 'group' ) ) )
+				bp_core_add_message( __( 'Your avatar was deleted successfully!', 'buddypress' ) );
+			else
+				bp_core_add_message( __( 'There was a problem deleting that avatar, please try again.', 'buddypress' ), 'error' );
+
+		}
+
+		$bp->avatar_admin->step = 'upload-image';
+
+		if ( !empty( $_FILES ) ) {
+
+			/* Check the nonce */
+			check_admin_referer( 'bp_avatar_upload' );
+
+			/* Pass the file to the avatar upload handler */
+			if ( bp_core_avatar_handle_upload( $_FILES, 'groups_avatar_upload_dir' ) ) {
+				$bp->avatar_admin->step = 'crop-image';
+
+				/* Make sure we include the jQuery jCrop file for image cropping */
+				add_action( 'wp', 'bp_core_add_jquery_cropper' );
+			}
+
+		}
+
+		/* If the image cropping is done, crop the image and save a full/thumb version */
+		if ( isset( $_POST['avatar-crop-submit'] ) ) {
+
+			/* Check the nonce */
+			check_admin_referer( 'bp_avatar_cropstore' );
+
+			if ( !bp_core_avatar_handle_crop( array( 'object' => 'group', 'avatar_dir' => 'group-avatars', 'item_id' => $bp->groups->current_group->id, 'original_file' => $_POST['image_src'], 'crop_x' => $_POST['x'], 'crop_y' => $_POST['y'], 'crop_w' => $_POST['w'], 'crop_h' => $_POST['h'] ) ) )
+				bp_core_add_message( __( 'There was a problem cropping the avatar, please try uploading it again', 'buddypress' ) );
+			else
+				bp_core_add_message( __( 'The new group avatar was uploaded successfully!', 'buddypress' ) );
+
+		}
+
+		do_action( 'groups_screen_group_admin_avatar', $bp->groups->current_group->id );
+
+		bp_core_load_template( apply_filters( 'groups_template_group_admin_avatar', 'groups/single/home' ) );
+	}
+}
+add_action( 'wp', 'groups_screen_group_admin_avatar', 4 );
+
+function groups_screen_group_admin_manage_members() {
+	global $bp;
+
+	if ( $bp->current_component == $bp->groups->slug && 'manage-members' == $bp->action_variables[0] ) {
+
+		if ( !$bp->is_item_admin )
+			return false;
+
+		if ( 'promote' == $bp->action_variables[1] && ( 'mod' == $bp->action_variables[2] || 'admin' == $bp->action_variables[2] ) && is_numeric( $bp->action_variables[3] ) ) {
+			$user_id = $bp->action_variables[3];
+			$status = $bp->action_variables[2];
+
+			// 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 ) )
+				bp_core_add_message( __( 'There was an error when promoting that user, please try again', 'buddypress' ), 'error' );
+			else
+				bp_core_add_message( __( 'User promoted successfully', 'buddypress' ) );
+
+			do_action( 'groups_promoted_member', $user_id, $bp->groups->current_group->id );
+
+			bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
+		}
+
+		if ( 'demote' == $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_demote_member' ) )
+				return false;
+
+			// Demote a user.
+			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
+				bp_core_add_message( __( 'User demoted successfully', 'buddypress' ) );
+
+			do_action( 'groups_demoted_member', $user_id, $bp->groups->current_group->id );
+
+			bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
+		}
+
+		if ( 'ban' == $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_ban_member' ) )
+				return false;
+
+			// Ban a user.
+			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
+				bp_core_add_message( __( 'User banned successfully', 'buddypress' ) );
+
+			do_action( 'groups_banned_member', $user_id, $bp->groups->current_group->id );
+
+			bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
+		}
+
+		if ( 'unban' == $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_unban_member' ) )
+				return false;
+
+			// Remove a ban for user.
+			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
+				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( $user_id, $bp->groups->current_group->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' ) );
+	}
+}
+add_action( 'wp', 'groups_screen_group_admin_manage_members', 4 );
+
+function groups_screen_group_admin_requests() {
+	global $bp;
+
+	if ( $bp->current_component == $bp->groups->slug && 'membership-requests' == $bp->action_variables[0] ) {
+
+		/* Ask for a login if the user is coming here via an email notification */
+		if ( !is_user_logged_in() )
+			bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . $bp->root_domain . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/membership-requests/' ) );
+
+		if ( !$bp->is_item_admin || 'public' == $bp->groups->current_group->status )
+			return false;
+
+		// Remove any screen notifications
+		bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->id, 'new_membership_request' );
+
+		$request_action = $bp->action_variables[1];
+		$membership_id = $bp->action_variables[2];
+
+		if ( isset($request_action) && isset($membership_id) ) {
+			if ( 'accept' == $request_action && is_numeric($membership_id) ) {
+
+				/* Check the nonce first. */
+				if ( !check_admin_referer( 'groups_accept_membership_request' ) )
+					return false;
+
+				// Accept the membership request
+				if ( !groups_accept_membership_request( $membership_id ) ) {
+					bp_core_add_message( __( 'There was an error accepting the membership request, please try again.', 'buddypress' ), 'error' );
+				} else {
+					bp_core_add_message( __( 'Group membership request accepted', 'buddypress' ) );
+				}
+
+			} else if ( 'reject' == $request_action && is_numeric($membership_id) ) {
+				/* Check the nonce first. */
+				if ( !check_admin_referer( 'groups_reject_membership_request' ) )
+					return false;
+
+				// Reject the membership request
+				if ( !groups_reject_membership_request( $membership_id ) ) {
+					bp_core_add_message( __( 'There was an error rejecting the membership request, please try again.', 'buddypress' ), 'error' );
+				} else {
+					bp_core_add_message( __( 'Group membership request rejected', 'buddypress' ) );
+				}
+
+			}
+
+			do_action( 'groups_group_request_managed', $bp->groups->current_group->id, $request_action, $membership_id );
+
+			bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/membership-requests/' );
+		}
+
+		do_action( 'groups_screen_group_admin_requests', $bp->groups->current_group->id );
+
+		bp_core_load_template( apply_filters( 'groups_template_group_admin_requests', 'groups/single/home' ) );
+	}
+}
+add_action( 'wp', 'groups_screen_group_admin_requests', 4 );
+
+function groups_screen_group_admin_delete_group() {
+	global $bp;
+
+	if ( $bp->current_component == $bp->groups->slug && 'delete-group' == $bp->action_variables[0] ) {
+
+		if ( !$bp->is_item_admin && !is_super_admin() )
+			return false;
+
+		if ( isset( $_REQUEST['delete-group-button'] ) && isset( $_REQUEST['delete-group-understand'] ) ) {
+			/* Check the nonce first. */
+			if ( !check_admin_referer( 'groups_delete_group' ) )
+				return false;
+
+			// Group admin has deleted the group, now do it.
+			if ( !groups_delete_group( $bp->groups->current_group->id ) ) {
+				bp_core_add_message( __( 'There was an error deleting the group, please try again.', 'buddypress' ), 'error' );
+			} else {
+				bp_core_add_message( __( 'The group was deleted successfully', 'buddypress' ) );
+
+				do_action( 'groups_group_deleted', $bp->groups->current_group->id );
+
+				bp_core_redirect( $bp->loggedin_user->domain . $bp->groups->slug . '/' );
+			}
+
+			bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component );
+		}
+
+		do_action( 'groups_screen_group_admin_delete_group', $bp->groups->current_group->id );
+
+		bp_core_load_template( apply_filters( 'groups_template_group_admin_delete_group', 'groups/single/home' ) );
+	}
+}
+add_action( 'wp', 'groups_screen_group_admin_delete_group', 4 );
+
+function groups_screen_notification_settings() {
+	global $current_user; ?>
+	<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>
+
+		<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
+}
+add_action( 'bp_notification_settings', 'groups_screen_notification_settings' );
+
+
+/********************************************************************************
+ * Action Functions
+ *
+ * Action functions are exactly the same as screen functions, however they do not
+ * have a template screen associated with them. Usually they will send the user
+ * back to the default screen after execution.
+ */
+
+function groups_action_create_group() {
+	global $bp;
+
+	/* If we're not at domain.org/groups/create/ then return false */
+	if ( $bp->current_component != $bp->groups->slug || 'create' != $bp->current_action )
+		return false;
+
+	if ( !is_user_logged_in() )
+		return false;
+
+	/* Make sure creation steps are in the right order */
+	groups_action_sort_creation_steps();
+
+	/* If no current step is set, reset everything so we can start a fresh group creation */
+	if ( !$bp->groups->current_create_step = $bp->action_variables[1] ) {
+
+		unset( $bp->groups->current_create_step );
+		unset( $bp->groups->completed_create_steps );
+
+		setcookie( 'bp_new_group_id', false, time() - 1000, COOKIEPATH );
+		setcookie( 'bp_completed_create_steps', false, time() - 1000, COOKIEPATH );
+
+		$reset_steps = true;
+		bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/create/step/' . array_shift( array_keys( $bp->groups->group_creation_steps ) ) . '/' );
+	}
+
+	/* If this is a creation step that is not recognized, just redirect them back to the first screen */
+	if ( $bp->action_variables[1] && !$bp->groups->group_creation_steps[$bp->action_variables[1]] ) {
+		bp_core_add_message( __('There was an error saving group details. Please try again.', 'buddypress'), 'error' );
+		bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/create/' );
+	}
+
+	/* Fetch the currently completed steps variable */
+	if ( isset( $_COOKIE['bp_completed_create_steps'] ) && !$reset_steps )
+		$bp->groups->completed_create_steps = unserialize( stripslashes( $_COOKIE['bp_completed_create_steps'] ) );
+
+	/* Set the ID of the new group, if it has already been created in a previous step */
+	if ( isset( $_COOKIE['bp_new_group_id'] ) ) {
+		$bp->groups->new_group_id = $_COOKIE['bp_new_group_id'];
+		$bp->groups->current_group = new BP_Groups_Group( $bp->groups->new_group_id );
+	}
+
+	/* If the save, upload or skip button is hit, lets calculate what we need to save */
+	if ( isset( $_POST['save'] ) ) {
+
+		/* Check the nonce */
+		check_admin_referer( 'groups_create_save_' . $bp->groups->current_create_step );
+
+		if ( 'group-details' == $bp->groups->current_create_step ) {
+			if ( empty( $_POST['group-name'] ) || empty( $_POST['group-desc'] ) || !strlen( trim( $_POST['group-name'] ) ) || !strlen( trim( $_POST['group-desc'] ) ) ) {
+				bp_core_add_message( __( 'Please fill in all of the required fields', 'buddypress' ), 'error' );
+				bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/create/step/' . $bp->groups->current_create_step . '/' );
+			}
+
+			if ( !$bp->groups->new_group_id = groups_create_group( array( 'group_id' => $bp->groups->new_group_id, 'name' => $_POST['group-name'], 'description' => $_POST['group-desc'], 'slug' => groups_check_slug( sanitize_title( esc_attr( $_POST['group-name'] ) ) ), 'date_created' => gmdate( "Y-m-d H:i:s" ), 'status' => 'public' ) ) ) {
+				bp_core_add_message( __( 'There was an error saving group details, please try again.', 'buddypress' ), 'error' );
+				bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/create/step/' . $bp->groups->current_create_step . '/' );
+			}
+
+			groups_update_groupmeta( $bp->groups->new_group_id, 'total_member_count', 1 );
+			groups_update_groupmeta( $bp->groups->new_group_id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
+		}
+
+		if ( 'group-settings' == $bp->groups->current_create_step ) {
+			$group_status = 'public';
+			$group_enable_forum = 1;
+
+			if ( !isset($_POST['group-show-forum']) ) {
+				$group_enable_forum = 0;
+			} else {
+				/* Create the forum if enable_forum = 1 */
+				if ( function_exists( 'bp_forums_setup' ) && '' == groups_get_groupmeta( $bp->groups->new_group_id, 'forum_id' ) ) {
+					groups_new_group_forum();
+				}
+			}
+
+			if ( 'private' == $_POST['group-status'] )
+				$group_status = 'private';
+			else if ( 'hidden' == $_POST['group-status'] )
+				$group_status = 'hidden';
+
+			if ( !$bp->groups->new_group_id = groups_create_group( array( 'group_id' => $bp->groups->new_group_id, 'status' => $group_status, 'enable_forum' => $group_enable_forum ) ) ) {
+				bp_core_add_message( __( 'There was an error saving group details, please try again.', 'buddypress' ), 'error' );
+				bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/create/step/' . $bp->groups->current_create_step . '/' );
+			}
+		}
+
+		if ( 'group-invites' == $bp->groups->current_create_step ) {
+			groups_send_invites( $bp->loggedin_user->id, $bp->groups->new_group_id );
+		}
+
+		do_action( 'groups_create_group_step_save_' . $bp->groups->current_create_step );
+		do_action( 'groups_create_group_step_complete' ); // Mostly for clearing cache on a generic action name
+
+		/**
+		 * Once we have successfully saved the details for this step of the creation process
+		 * we need to add the current step to the array of completed steps, then update the cookies
+		 * holding the information
+		 */
+		if ( !in_array( $bp->groups->current_create_step, (array)$bp->groups->completed_create_steps ) )
+			$bp->groups->completed_create_steps[] = $bp->groups->current_create_step;
+
+		/* Reset cookie info */
+		setcookie( 'bp_new_group_id', $bp->groups->new_group_id, time()+60*60*24, COOKIEPATH );
+		setcookie( 'bp_completed_create_steps', serialize( $bp->groups->completed_create_steps ), time()+60*60*24, COOKIEPATH );
+
+		/* If we have completed all steps and hit done on the final step we can redirect to the completed group */
+		if ( count( $bp->groups->completed_create_steps ) == count( $bp->groups->group_creation_steps ) && $bp->groups->current_create_step == array_pop( array_keys( $bp->groups->group_creation_steps ) ) ) {
+			unset( $bp->groups->current_create_step );
+			unset( $bp->groups->completed_create_steps );
+
+			/* 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( __( '%s created the group %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
+			) );
+
+			do_action( 'groups_group_create_complete', $bp->groups->new_group_id );
+
+			bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
+		} else {
+			/**
+			 * Since we don't know what the next step is going to be (any plugin can insert steps)
+			 * we need to loop the step array and fetch the next step that way.
+			 */
+			foreach ( (array)$bp->groups->group_creation_steps as $key => $value ) {
+				if ( $key == $bp->groups->current_create_step ) {
+					$next = 1;
+					continue;
+				}
+
+				if ( $next ) {
+					$next_step = $key;
+					break;
+				}
+			}
+
+			bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/create/step/' . $next_step . '/' );
+		}
+	}
+
+	/* Group avatar is handled separately */
+	if ( 'group-avatar' == $bp->groups->current_create_step && isset( $_POST['upload'] ) ) {
+		if ( !empty( $_FILES ) && isset( $_POST['upload'] ) ) {
+			/* Normally we would check a nonce here, but the group save nonce is used instead */
+
+			/* Pass the file to the avatar upload handler */
+			if ( bp_core_avatar_handle_upload( $_FILES, 'groups_avatar_upload_dir' ) ) {
+				$bp->avatar_admin->step = 'crop-image';
+
+				/* Make sure we include the jQuery jCrop file for image cropping */
+				add_action( 'wp', 'bp_core_add_jquery_cropper' );
+			}
+		}
+
+		/* If the image cropping is done, crop the image and save a full/thumb version */
+		if ( isset( $_POST['avatar-crop-submit'] ) && isset( $_POST['upload'] ) ) {
+			/* Normally we would check a nonce here, but the group save nonce is used instead */
+
+			if ( !bp_core_avatar_handle_crop( array( 'object' => 'group', 'avatar_dir' => 'group-avatars', 'item_id' => $bp->groups->current_group->id, 'original_file' => $_POST['image_src'], 'crop_x' => $_POST['x'], 'crop_y' => $_POST['y'], 'crop_w' => $_POST['w'], 'crop_h' => $_POST['h'] ) ) )
+				bp_core_add_message( __( 'There was an error saving the group avatar, please try uploading again.', 'buddypress' ), 'error' );
+			else
+				bp_core_add_message( __( 'The group avatar was uploaded successfully!', 'buddypress' ) );
+		}
+	}
+
+ 	bp_core_load_template( apply_filters( 'groups_template_create_group', 'groups/create' ) );
+}
+add_action( 'wp', 'groups_action_create_group', 3 );
+
+function groups_action_join_group() {
+	global $bp;
+
+	if ( !$bp->is_single_item || $bp->current_component != $bp->groups->slug || $bp->current_action != 'join' )
+		return false;
+
+	// Nonce check
+	if ( !check_admin_referer( 'groups_join_group' ) )
+		return false;
+
+	// Skip if banned or already a member
+	if ( !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) && !groups_is_user_banned( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
+
+		// User wants to join a group that is not public
+		if ( $bp->groups->current_group->status != 'public' ) {
+			if ( !groups_check_user_has_invite( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
+				bp_core_add_message( __( 'There was an error joining the group.', 'buddypress' ), 'error' );
+				bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
+			}
+		}
+
+		// User wants to join any group
+		if ( !groups_join_group( $bp->groups->current_group->id ) )
+			bp_core_add_message( __( 'There was an error joining the group.', 'buddypress' ), 'error' );
+		else
+			bp_core_add_message( __( 'You joined the group!', 'buddypress' ) );
+
+		bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
+	}
+
+	bp_core_load_template( apply_filters( 'groups_template_group_home', 'groups/single/home' ) );
+}
+add_action( 'wp', 'groups_action_join_group', 3 );
+
+
+function groups_action_leave_group() {
+	global $bp;
+
+	if ( !$bp->is_single_item || $bp->current_component != $bp->groups->slug || $bp->current_action != 'leave-group' )
+		return false;
+
+	// Nonce check
+	if ( !check_admin_referer( 'groups_leave_group' ) )
+		return false;
+
+	// User wants to leave any group
+	if ( groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
+		if ( !groups_leave_group( $bp->groups->current_group->id ) ) {
+			bp_core_add_message( __( 'There was an error leaving the group.', 'buddypress' ), 'error' );
+		} else {
+			bp_core_add_message( __( 'You successfully left the group.', 'buddypress' ) );
+		}
+		bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
+	}
+
+	bp_core_load_template( apply_filters( 'groups_template_group_home', 'groups/single/home' ) );
+}
+add_action( 'wp', 'groups_action_leave_group', 3 );
+
+
+function groups_action_sort_creation_steps() {
+	global $bp;
+
+	if ( $bp->current_component != BP_GROUPS_SLUG && $bp->current_action != 'create' )
+		return false;
+
+	if ( !is_array( $bp->groups->group_creation_steps ) )
+		return false;
+
+	foreach ( (array)$bp->groups->group_creation_steps as $slug => $step ) {
+		while ( !empty( $temp[$step['position']] ) )
+			$step['position']++;
+
+		$temp[$step['position']] = array( 'name' => $step['name'], 'slug' => $slug );
+	}
+
+	/* Sort the steps by their position key */
+	ksort($temp);
+	unset($bp->groups->group_creation_steps);
+
+	foreach( (array)$temp as $position => $step )
+		$bp->groups->group_creation_steps[$step['slug']] = array( 'name' => $step['name'], 'position' => $position );
+}
+
+function groups_action_redirect_to_random_group() {
+	global $bp, $wpdb;
+
+	if ( $bp->current_component == $bp->groups->slug && isset( $_GET['random-group'] ) ) {
+		$group = groups_get_groups( array( 'type' => 'random', 'per_page' => 1 ) );
+
+		bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/' . $group['groups'][0]->slug . '/' );
+	}
+}
+add_action( 'wp', 'groups_action_redirect_to_random_group', 6 );
+
+function groups_action_group_feed() {
+	global $bp, $wp_query;
+
+	if ( !bp_is_active( 'activity' ) || $bp->current_component != $bp->groups->slug || !$bp->groups->current_group || $bp->current_action != 'feed' )
+		return false;
+
+	$wp_query->is_404 = false;
+	status_header( 200 );
+
+	if ( 'public' != $bp->groups->current_group->status ) {
+		if ( !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
+			return false;
+	}
+
+	include_once( 'bp-activity/feeds/bp-activity-group-feed.php' );
+	die;
+}
+add_action( 'wp', 'groups_action_group_feed', 3 );
+
+
+/********************************************************************************
+ * Activity & Notification Functions
+ *
+ * These functions handle the recording, deleting and formatting of activity and
+ * notifications for the user and for this specific component.
+ */
+
+function groups_register_activity_actions() {
+	global $bp;
+
+	if ( !function_exists( 'bp_activity_set_action' ) )
+		return false;
+
+	bp_activity_set_action( $bp->groups->id, 'created_group', __( 'Created a group', 'buddypress' ) );
+	bp_activity_set_action( $bp->groups->id, 'joined_group', __( 'Joined a group', 'buddypress' ) );
+	bp_activity_set_action( $bp->groups->id, 'new_forum_topic', __( 'New group forum topic', 'buddypress' ) );
+	bp_activity_set_action( $bp->groups->id, 'new_forum_post', __( 'New group forum post', 'buddypress' ) );
+
+	do_action( 'groups_register_activity_actions' );
+}
+add_action( 'bp_register_activity_actions', 'groups_register_activity_actions' );
+
+function groups_record_activity( $args = '' ) {
+	global $bp;
+
+	if ( !function_exists( 'bp_activity_add' ) )
+		return false;
+
+	/* If the group is not public, hide the activity sitewide. */
+	if ( 'public' == $bp->groups->current_group->status )
+		$hide_sitewide = false;
+	else
+		$hide_sitewide = true;
+
+	$defaults = array(
+		'id' => false,
+		'user_id' => $bp->loggedin_user->id,
+		'action' => '',
+		'content' => '',
+		'primary_link' => '',
+		'component' => $bp->groups->id,
+		'type' => false,
+		'item_id' => false,
+		'secondary_item_id' => false,
+		'recorded_time' => bp_core_current_time(),
+		'hide_sitewide' => $hide_sitewide
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r );
+
+	return bp_activity_add( array( 'id' => $id, 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
+}
+
+function groups_update_last_activity( $group_id ) {
+	groups_update_groupmeta( $group_id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
+}
+add_action( 'groups_joined_group', 'groups_update_last_activity' );
+add_action( 'groups_leave_group', 'groups_update_last_activity' );
+add_action( 'groups_created_group', 'groups_update_last_activity' );
+add_action( 'groups_new_forum_topic', 'groups_update_last_activity' );
+add_action( 'groups_new_forum_topic_post', 'groups_update_last_activity' );
+
+function groups_format_notifications( $action, $item_id, $secondary_item_id, $total_items ) {
+	global $bp;
+
+	switch ( $action ) {
+		case 'new_membership_request':
+			$group_id = $secondary_item_id;
+			$requesting_user_id = $item_id;
+
+			$group = new BP_Groups_Group( $group_id );
+
+			$group_link = bp_get_group_permalink( $group );
+
+			if ( (int)$total_items > 1 ) {
+				return apply_filters( 'bp_groups_multiple_new_membership_requests_notification', '<a href="' . $group_link . '/admin/membership-requests/?n=1" title="' . __( 'Group Membership Requests', 'buddypress' ) . '">' . sprintf( __( '%d new membership requests for the group "%s"', 'buddypress' ), (int)$total_items, $group->name ) . '</a>', $group_link, $total_items, $group->name );
+			} else {
+				$user_fullname = bp_core_get_user_displayname( $requesting_user_id );
+				return apply_filters( 'bp_groups_single_new_membership_request_notification', '<a href="' . $group_link . 'admin/membership-requests/?n=1" title="' . $user_fullname .' requests group membership">' . sprintf( __( '%s requests membership for the group "%s"', 'buddypress' ), $user_fullname, $group->name ) . '</a>', $group_link, $user_fullname, $group->name );
+			}
+		break;
+
+		case 'membership_request_accepted':
+			$group_id = $item_id;
+
+			$group = new BP_Groups_Group( $group_id );
+			$group_link = bp_get_group_permalink( $group );
+
+			if ( (int)$total_items > 1 )
+				return apply_filters( 'bp_groups_multiple_membership_request_accepted_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/?n=1" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __( '%d accepted group membership requests', 'buddypress' ), (int)$total_items, $group->name ) . '</a>', $total_items, $group_name );
+			else
+				return apply_filters( 'bp_groups_single_membership_request_accepted_notification', '<a href="' . $group_link . '?n=1">' . sprintf( __( 'Membership for group "%s" accepted', 'buddypress' ), $group->name ) . '</a>', $group_link, $group->name );
+
+		break;
+
+		case 'membership_request_rejected':
+			$group_id = $item_id;
+
+			$group = new BP_Groups_Group( $group_id );
+			$group_link = bp_get_group_permalink( $group );
+
+			if ( (int)$total_items > 1 )
+				return apply_filters( 'bp_groups_multiple_membership_request_rejected_notification', '<a href="' . site_url() . '/' . BP_MEMBERS_SLUG . '/' . $bp->groups->slug . '/?n=1" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __( '%d rejected group membership requests', 'buddypress' ), (int)$total_items, $group->name ) . '</a>', $total_items, $group->name );
+			else
+				return apply_filters( 'bp_groups_single_membership_request_rejected_notification', '<a href="' . $group_link . '?n=1">' . sprintf( __( 'Membership for group "%s" rejected', 'buddypress' ), $group->name ) . '</a>', $group_link, $group->name );
+
+		break;
+
+		case 'member_promoted_to_admin':
+			$group_id = $item_id;
+
+			$group = new BP_Groups_Group( $group_id );
+			$group_link = bp_get_group_permalink( $group );
+
+			if ( (int)$total_items > 1 )
+				return apply_filters( 'bp_groups_multiple_member_promoted_to_admin_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/?n=1" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __( 'You were promoted to an admin in %d groups', 'buddypress' ), (int)$total_items ) . '</a>', $total_items );
+			else
+				return apply_filters( 'bp_groups_single_member_promoted_to_admin_notification', '<a href="' . $group_link . '?n=1">' . sprintf( __( 'You were promoted to an admin in the group %s', 'buddypress' ), $group->name ) . '</a>', $group_link, $group->name );
+
+		break;
+
+		case 'member_promoted_to_mod':
+			$group_id = $item_id;
+
+			$group = new BP_Groups_Group( $group_id );
+			$group_link = bp_get_group_permalink( $group );
+
+			if ( (int)$total_items > 1 )
+				return apply_filters( 'bp_groups_multiple_member_promoted_to_mod_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/?n=1" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __( 'You were promoted to a mod in %d groups', 'buddypress' ), (int)$total_items ) . '</a>', $total_items );
+			else
+				return apply_filters( 'bp_groups_single_member_promoted_to_mod_notification', '<a href="' . $group_link . '?n=1">' . sprintf( __( 'You were promoted to a mod in the group %s', 'buddypress' ), $group->name ) . '</a>', $group_link, $group->name );
+
+		break;
+
+		case 'group_invite':
+			$group_id = $item_id;
+
+			$group = new BP_Groups_Group( $group_id );
+			$user_url = bp_core_get_user_domain( $user_id );
+
+			if ( (int)$total_items > 1 )
+				return apply_filters( 'bp_groups_multiple_group_invite_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/invites/?n=1" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __( 'You have %d new group invitations', 'buddypress' ), (int)$total_items ) . '</a>', $total_items );
+			else
+				return apply_filters( 'bp_groups_single_group_invite_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/invites/?n=1" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __( 'You have an invitation to the group: %s', 'buddypress' ), $group->name ) . '</a>', $group->name );
+
+		break;
+	}
+
+	do_action( 'groups_format_notifications', $action, $item_id, $secondary_item_id, $total_items );
+
+	return false;
+}
+
+
+/********************************************************************************
+ * Business Functions
+ *
+ * Business functions are where all the magic happens in BuddyPress. They will
+ * handle the actual saving or manipulation of information. Usually they will
+ * hand off to a database class for data access, then return
+ * true or false on success or failure.
+ */
+
+function groups_get_group( $args = '' ) {
+	$defaults = array(
+		'group_id' => false,
+		'load_users' => false
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	return apply_filters( 'groups_get_group', new BP_Groups_Group( $group_id, true, $load_users ) );
+}
+
+/*** Group Creation, Editing & Deletion *****************************************/
+
+function groups_create_group( $args = '' ) {
+	global $bp;
+
+	extract( $args );
+
+	/**
+	 * Possible parameters (pass as assoc array):
+	 *	'group_id'
+	 *	'creator_id'
+	 *	'name'
+	 *	'description'
+	 *	'slug'
+	 *	'status'
+	 *	'enable_forum'
+	 *	'date_created'
+	 */
+
+	if ( $group_id )
+		$group = new BP_Groups_Group( $group_id );
+	else
+		$group = new BP_Groups_Group;
+
+	if ( $creator_id )
+		$group->creator_id = $creator_id;
+	else
+		$group->creator_id = $bp->loggedin_user->id;
+
+	if ( isset( $name ) )
+		$group->name = $name;
+
+	if ( isset( $description ) )
+		$group->description = $description;
+
+	if ( isset( $slug ) && groups_check_slug( $slug ) )
+		$group->slug = $slug;
+
+	if ( isset( $status ) ) {
+		if ( groups_is_valid_status( $status ) )
+			$group->status = $status;
+	}
+
+	if ( isset( $enable_forum ) )
+		$group->enable_forum = $enable_forum;
+	else if ( !$group_id && !isset( $enable_forum ) )
+		$group->enable_forum = 1;
+
+	if ( isset( $date_created ) )
+		$group->date_created = $date_created;
+
+	if ( !$group->save() )
+		return false;
+
+	if ( !$group_id ) {
+		// If this is a new group, set up the creator as the first member and admin
+		$member = new BP_Groups_Member;
+		$member->group_id = $group->id;
+		$member->user_id = $group->creator_id;
+		$member->is_admin = 1;
+		$member->user_title = __( 'Group Admin', 'buddypress' );
+		$member->is_confirmed = 1;
+		$member->date_modified = gmdate( "Y-m-d H:i:s" );
+
+		$member->save();
+		do_action( 'groups_create_group', $group->id, $member, $group );
+
+	} else {
+		do_action( 'groups_update_group', $group->id, $group );
+	}
+
+	do_action( 'groups_created_group', $group->id );
+
+	return $group->id;
+}
+
+function groups_edit_base_group_details( $group_id, $group_name, $group_desc, $notify_members ) {
+	global $bp;
+
+	if ( empty( $group_name ) || empty( $group_desc ) )
+		return false;
+
+	$group = new BP_Groups_Group( $group_id );
+	$group->name = $group_name;
+	$group->description = $group_desc;
+
+	if ( !$group->save() )
+		return false;
+
+	if ( $notify_members ) {
+		require_once ( BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php' );
+		groups_notification_group_updated( $group->id );
+	}
+
+	do_action( 'groups_details_updated', $group->id );
+
+	return true;
+}
+
+function groups_edit_group_settings( $group_id, $enable_forum, $status ) {
+	global $bp;
+
+	$group = new BP_Groups_Group( $group_id );
+	$group->enable_forum = $enable_forum;
+
+	/***
+	 * Before we potentially switch the group status, if it has been changed to public
+	 * from private and there are outstanding membership requests, auto-accept those requests.
+	 */
+	if ( 'private' == $group->status && 'public' == $status )
+		groups_accept_all_pending_membership_requests( $group->id );
+
+	/* Now update the status */
+	$group->status = $status;
+
+	if ( !$group->save() )
+		return false;
+
+	/* If forums have been enabled, and a forum does not yet exist, we need to create one. */
+	if ( $group->enable_forum ) {
+		if ( function_exists( 'bp_forums_setup' ) && '' == groups_get_groupmeta( $group->id, 'forum_id' ) ) {
+			groups_new_group_forum( $group->id, $group->name, $group->description );
+		}
+	}
+
+	groups_update_groupmeta( $group->id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
+	do_action( 'groups_settings_updated', $group->id );
+
+	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;
+
+	// Check the user is the group admin.
+	if ( !$bp->is_item_admin )
+		return false;
+
+	// Get the group object
+	$group = new BP_Groups_Group( $group_id );
+	if ( !$group->delete() )
+		return false;
+
+	// 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 );
+
+	// Remove all notifications for any user belonging to this group
+	bp_core_delete_all_notifications_by_type( $group_id, $bp->groups->slug );
+
+	// Remove forum if component is active and current group has one
+	if ( bp_is_active( 'forums' ) && $forum_id = groups_get_groupmeta( $group_id, 'forum_id' ) ) {
+		do_action( 'bbpress_init' );
+		bb_delete_forum( $forum_id );
+	}
+
+	do_action( 'groups_delete_group', $group_id);
+
+	return true;
+}
+
+function groups_is_valid_status( $status ) {
+	global $bp;
+
+	return in_array( $status, (array)$bp->groups->valid_status );
+}
+
+function groups_check_slug( $slug ) {
+	global $bp;
+
+	if ( 'wp' == substr( $slug, 0, 2 ) )
+		$slug = substr( $slug, 2, strlen( $slug ) - 2 );
+
+	if ( in_array( $slug, (array)$bp->groups->forbidden_names ) ) {
+		$slug = $slug . '-' . rand();
+	}
+
+	if ( BP_Groups_Group::check_slug( $slug ) ) {
+		do {
+			$slug = $slug . '-' . rand();
+		}
+		while ( BP_Groups_Group::check_slug( $slug ) );
+	}
+
+	return $slug;
+}
+
+function groups_get_slug( $group_id ) {
+	$group = new BP_Groups_Group( $group_id );
+	return $group->slug;
+}
+
+/*** User Actions ***************************************************************/
+
+function groups_leave_group( $group_id, $user_id = false ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = $bp->loggedin_user->id;
+
+	/* Don't let single admins leave the group. */
+	if ( count( groups_get_group_admins( $group_id ) ) < 2 ) {
+		if ( groups_is_user_admin( $user_id, $group_id ) ) {
+			bp_core_add_message( __( 'As the only Admin, you cannot leave the group.', 'buddypress' ), 'error' );
+			return false;
+		}
+	}
+
+	$membership = new BP_Groups_Member( $user_id, $group_id );
+
+	// This is exactly the same as deleting an invite, just is_confirmed = 1 NOT 0.
+	if ( !groups_uninvite_user( $user_id, $group_id ) )
+		return false;
+
+	/* Modify group member count */
+	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_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.
+	 */
+	if ( function_exists( 'bp_activity_delete' ) && gmmktime() <= strtotime( '+5 minutes', (int)strtotime( $membership->date_modified ) ) )
+		bp_activity_delete( array( 'component' => $bp->groups->id, 'type' => 'joined_group', 'user_id' => $user_id, 'item_id' => $group_id ) );
+
+	bp_core_add_message( __( 'You successfully left the group.', 'buddypress' ) );
+
+	do_action( 'groups_leave_group', $group_id, $user_id );
+
+	return true;
+}
+
+function groups_join_group( $group_id, $user_id = false ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = $bp->loggedin_user->id;
+
+	/* Check if the user has an outstanding invite, is so delete it. */
+	if ( groups_check_user_has_invite( $user_id, $group_id ) )
+		groups_delete_invite( $user_id, $group_id );
+
+	/* Check if the user has an outstanding request, is so delete it. */
+	if ( groups_check_for_membership_request( $user_id, $group_id ) )
+		groups_delete_membership_request( $user_id, $group_id );
+
+	/* User is already a member, just return true */
+	if ( groups_is_user_member( $user_id, $group_id ) )
+		return true;
+
+	if ( !$bp->groups->current_group )
+		$bp->groups->current_group = new BP_Groups_Group( $group_id );
+
+	$new_member = new BP_Groups_Member;
+	$new_member->group_id = $group_id;
+	$new_member->user_id = $user_id;
+	$new_member->inviter_id = 0;
+	$new_member->is_admin = 0;
+	$new_member->user_title = '';
+	$new_member->date_modified = gmdate( "Y-m-d H:i:s" );
+	$new_member->is_confirmed = 1;
+
+	if ( !$new_member->save() )
+		return false;
+
+	/* Record this in activity streams */
+	groups_record_activity( array(
+		'action' => apply_filters( 'groups_activity_joined_group', sprintf( __( '%s joined the group %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
+	) );
+
+	/* Modify group meta */
+	groups_update_groupmeta( $group_id, 'total_member_count', (int) groups_get_groupmeta( $group_id, 'total_member_count') + 1 );
+	groups_update_groupmeta( $group_id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
+
+	do_action( 'groups_join_group', $group_id, $user_id );
+
+	return true;
+}
+
+/*** General Group Functions ****************************************************/
+
+function groups_check_group_exists( $group_id ) {
+	return BP_Groups_Group::group_exists( $group_id );
+}
+
+function groups_get_group_admins( $group_id ) {
+	return BP_Groups_Member::get_group_administrator_ids( $group_id );
+}
+
+function groups_get_group_mods( $group_id ) {
+	return BP_Groups_Member::get_group_moderator_ids( $group_id );
+}
+
+function groups_get_group_members( $group_id, $limit = false, $page = false ) {
+	return BP_Groups_Member::get_all_for_group( $group_id, $limit, $page );
+}
+
+function groups_get_total_member_count( $group_id ) {
+	return BP_Groups_Group::get_total_member_count( $group_id );
+}
+
+/*** Group Fetching, Filtering & Searching  *************************************/
+
+function groups_get_groups( $args = '' ) {
+	global $bp;
+
+	$defaults = array(
+		'type' => 'active', // active, newest, alphabetical, random, popular, most-forum-topics or most-forum-posts
+		'user_id' => false, // Pass a user_id to limit to only groups that this user is a member of
+		'search_terms' => false, // Limit to groups that match these search terms
+
+		'per_page' => 20, // The number of results to return per page
+		'page' => 1, // The page to return if limiting per page
+		'populate_extras' => true, // Fetch meta such as is_banned and is_member
+	);
+
+	$params = wp_parse_args( $args, $defaults );
+	extract( $params, EXTR_SKIP );
+
+	switch ( $type ) {
+		case 'active': default:
+			$groups = BP_Groups_Group::get_active( $per_page, $page, $user_id, $search_terms, $populate_extras );
+			break;
+		case 'newest':
+			$groups = BP_Groups_Group::get_newest( $per_page, $page, $user_id, $search_terms, $populate_extras );
+			break;
+		case 'popular':
+			$groups = BP_Groups_Group::get_popular( $per_page, $page, $user_id, $search_terms, $populate_extras );
+			break;
+		case 'alphabetical':
+			$groups = BP_Groups_Group::get_alphabetically( $per_page, $page, $user_id, $search_terms, $populate_extras );
+			break;
+		case 'random':
+			$groups = BP_Groups_Group::get_random( $per_page, $page, $user_id, $search_terms, $populate_extras );
+			break;
+		case 'most-forum-topics':
+			$groups = BP_Groups_Group::get_by_most_forum_topics( $per_page, $page, $user_id, $search_terms, $populate_extras );
+			break;
+		case 'most-forum-posts':
+			$groups = BP_Groups_Group::get_by_most_forum_posts( $per_page, $page, $user_id, $search_terms, $populate_extras );
+			break;
+	}
+
+	return apply_filters( 'groups_get_groups', $groups, &$params );
+}
+
+function groups_get_total_group_count() {
+	if ( !$count = wp_cache_get( 'bp_total_group_count', 'bp' ) ) {
+		$count = BP_Groups_Group::get_total_group_count();
+		wp_cache_set( 'bp_total_group_count', $count, 'bp' );
+	}
+
+	return $count;
+}
+
+function groups_get_user_groups( $user_id = false, $pag_num = false, $pag_page = false ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = $bp->displayed_user->id;
+
+	return BP_Groups_Member::get_group_ids( $user_id, $pag_num, $pag_page );
+}
+
+function groups_total_groups_for_user( $user_id = false ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
+
+	if ( !$count = wp_cache_get( 'bp_total_groups_for_user_' . $user_id, 'bp' ) ) {
+		$count = BP_Groups_Member::total_group_count( $user_id );
+		wp_cache_set( 'bp_total_groups_for_user_' . $user_id, $count, 'bp' );
+	}
+
+	return $count;
+}
+
+/*** Group Avatars *************************************************************/
+
+function groups_avatar_upload_dir( $group_id = false ) {
+	global $bp;
+
+	if ( !$group_id )
+		$group_id = $bp->groups->current_group->id;
+
+	$path = BP_AVATAR_UPLOAD_PATH . '/group-avatars/' . $group_id;
+	$newbdir = $path;
+
+	if ( !file_exists( $path ) )
+		@wp_mkdir_p( $path );
+
+	$newurl = BP_AVATAR_URL . '/group-avatars/' . $group_id;
+	$newburl = $newurl;
+	$newsubdir = '/group-avatars/' . $group_id;
+
+	return apply_filters( 'groups_avatar_upload_dir', array( 'path' => $path, 'url' => $newurl, 'subdir' => $newsubdir, 'basedir' => $newbdir, 'baseurl' => $newburl, 'error' => false ) );
+}
+
+/*** Group Member Status Checks ************************************************/
+
+function groups_is_user_admin( $user_id, $group_id ) {
+	return BP_Groups_Member::check_is_admin( $user_id, $group_id );
+}
+
+function groups_is_user_mod( $user_id, $group_id ) {
+	return BP_Groups_Member::check_is_mod( $user_id, $group_id );
+}
+
+function groups_is_user_member( $user_id, $group_id ) {
+	return BP_Groups_Member::check_is_member( $user_id, $group_id );
+}
+
+function groups_is_user_banned( $user_id, $group_id ) {
+	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 = '' ) {
+	global $bp;
+
+	$defaults = array(
+		'content' => false,
+		'user_id' => $bp->loggedin_user->id,
+		'group_id' => $bp->groups->current_group->id
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	if ( empty($content) || !strlen( trim( $content ) ) || empty($user_id) || empty($group_id) )
+		return false;
+
+	$bp->groups->current_group = new BP_Groups_Group( $group_id );
+
+	/* Be sure the user is a member of the group before posting. */
+	if ( !is_super_admin() && !groups_is_user_member( $user_id, $group_id ) )
+		return false;
+
+	/* Record this in activity streams */
+	$activity_action = sprintf( __( '%s posted an update in the group %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(
+		'user_id' => $user_id,
+		'action' => apply_filters( 'groups_activity_new_update_action', $activity_action ),
+		'content' => apply_filters( 'groups_activity_new_update_content', $activity_content ),
+		'type' => 'activity_update',
+		'item_id' => $group_id
+	) );
+
+ 	/* Require the notifications code so email notifications can be set on the 'bp_activity_posted_update' action. */
+	require_once( BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php' );
+
+	groups_update_groupmeta( $group_id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
+	do_action( 'bp_groups_posted_update', $content, $user_id, $group_id, $activity_id );
+
+	return $activity_id;
+}
+
+/*** Group Forums **************************************************************/
+
+function groups_new_group_forum( $group_id = false, $group_name = false, $group_desc = false ) {
+	global $bp;
+
+	if ( !$group_id )
+		$group_id = $bp->groups->current_group->id;
+
+	if ( !$group_name )
+		$group_name = $bp->groups->current_group->name;
+
+	if ( !$group_desc )
+		$group_desc = $bp->groups->current_group->description;
+
+	$forum_id = bp_forums_new_forum( array( 'forum_name' => $group_name, 'forum_desc' => $group_desc ) );
+
+	groups_update_groupmeta( $group_id, 'forum_id', $forum_id );
+
+	do_action( 'groups_new_group_forum', $forum_id, $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;
+
+	if ( empty( $post_text ) )
+		return false;
+
+	$post_text = apply_filters( 'group_forum_post_text_before_save', $post_text );
+	$topic_id = apply_filters( 'group_forum_post_topic_id_before_save', $topic_id );
+
+	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( __( '%s posted on the forum topic %s in the group %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 . '/';
+
+		if ( $page )
+			$primary_link .= "?topic_page=" . $page;
+
+		/* Record this in activity streams */
+		groups_record_activity( array(
+			'action' => apply_filters( 'groups_activity_new_forum_post_action', $activity_action, $post_id, $post_text, &$topic ),
+			'content' => apply_filters( 'groups_activity_new_forum_post_content', $activity_content, $post_id, $post_text, &$topic ),
+			'primary_link' => apply_filters( 'groups_activity_new_forum_post_primary_link', "{$primary_link}#post-{$post_id}" ),
+			'type' => 'new_forum_post',
+			'item_id' => $bp->groups->current_group->id,
+			'secondary_item_id' => $post_id
+		) );
+
+		do_action( 'groups_new_forum_topic_post', $bp->groups->current_group->id, $post_id );
+
+		return $post_id;
+	}
+
+	return false;
+}
+
+function groups_new_group_forum_topic( $topic_title, $topic_text, $topic_tags, $forum_id ) {
+	global $bp;
+
+	if ( empty( $topic_title ) || empty( $topic_text ) )
+		return false;
+
+	$topic_title = apply_filters( 'group_forum_topic_title_before_save', $topic_title );
+	$topic_text = apply_filters( 'group_forum_topic_text_before_save', $topic_text );
+	$topic_tags = apply_filters( 'group_forum_topic_tags_before_save', $topic_tags );
+	$forum_id = apply_filters( 'group_forum_topic_forum_id_before_save', $forum_id );
+
+	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( __( '%s started the forum topic %s in the group %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 */
+		groups_record_activity( array(
+			'action' => apply_filters( 'groups_activity_new_forum_topic_action', $activity_action, $topic_text, &$topic ),
+			'content' => apply_filters( 'groups_activity_new_forum_topic_content', $activity_content, $topic_text, &$topic ),
+			'primary_link' => apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/' ),
+			'type' => 'new_forum_topic',
+			'item_id' => $bp->groups->current_group->id,
+			'secondary_item_id' => $topic->topic_id
+		) );
+
+		do_action( 'groups_new_forum_topic', $bp->groups->current_group->id, &$topic );
+
+		return $topic;
+	}
+
+	return false;
+}
+
+function groups_update_group_forum_topic( $topic_id, $topic_title, $topic_text ) {
+	global $bp;
+
+	$topic_title = apply_filters( 'group_forum_topic_title_before_save', $topic_title );
+	$topic_text = apply_filters( 'group_forum_topic_text_before_save', $topic_text );
+
+	if ( $topic = bp_forums_update_topic( array( 'topic_title' => $topic_title, 'topic_text' => $topic_text, 'topic_id' => $topic_id ) ) ) {
+		/* Update the activity stream item */
+		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( __( '%s started the forum topic %s in the group %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 */
+		groups_record_activity( array(
+			'action' => apply_filters( 'groups_activity_new_forum_topic_action', $activity_action, $topic_text, &$topic ),
+			'content' => apply_filters( 'groups_activity_new_forum_topic_content', $activity_content, $topic_text, &$topic ),
+			'primary_link' => apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/' ),
+			'type' => 'new_forum_topic',
+			'item_id' => (int)$bp->groups->current_group->id,
+			'user_id' => (int)$topic->topic_poster,
+			'secondary_item_id' => $topic->topic_id,
+			'recorded_time' => $topic->topic_time
+		) );
+
+		do_action( 'groups_update_group_forum_topic', &$topic );
+
+		return $topic;
+	}
+
+	return false;
+}
+
+function groups_update_group_forum_post( $post_id, $post_text, $topic_id, $page = false ) {
+	global $bp;
+
+	$post_text = apply_filters( 'group_forum_post_text_before_save', $post_text );
+	$topic_id = apply_filters( 'group_forum_post_topic_id_before_save', $topic_id );
+
+	$post = bp_forums_get_post( $post_id );
+
+	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( __( '%s posted on the forum topic %s in the group %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 . '/';
+
+		if ( $page )
+			$primary_link .= "?topic_page=" . $page;
+
+		/* Fetch an existing entry and update if one exists. */
+		if ( function_exists( 'bp_activity_get_activity_id' ) )
+			$id = bp_activity_get_activity_id( array( 'user_id' => $post->poster_id, 'component' => $bp->groups->id, 'type' => 'new_forum_post', 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $post_id ) );
+
+		/* Update the entry in activity streams */
+		groups_record_activity( array(
+			'id' => $id,
+			'action' => apply_filters( 'groups_activity_new_forum_post_action', $activity_action, $post_text, &$topic, &$forum_post ),
+			'content' => apply_filters( 'groups_activity_new_forum_post_content', $activity_content, $post_text, &$topic, &$forum_post ),
+			'primary_link' => apply_filters( 'groups_activity_new_forum_post_primary_link', $primary_link . "#post-" . $post_id ),
+			'type' => 'new_forum_post',
+			'item_id' => (int)$bp->groups->current_group->id,
+			'user_id' => (int)$post->poster_id,
+			'secondary_item_id' => $post_id,
+			'recorded_time' => $post->post_time
+		) );
+
+		do_action( 'groups_update_group_forum_post', &$post, &$topic );
+
+		return $post_id;
+	}
+
+	return false;
+}
+
+function groups_delete_group_forum_topic( $topic_id ) {
+	global $bp;
+
+	if ( bp_forums_delete_topic( array( 'topic_id' => $topic_id ) ) ) {
+		/* Delete the activity stream item */
+		if ( function_exists( 'bp_activity_delete' ) ) {
+			bp_activity_delete( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $topic_id, 'component' => $bp->groups->id, 'type' => 'new_forum_topic' ) );
+		}
+
+		do_action( 'groups_delete_group_forum_topic', $topic_id );
+
+		return true;
+	}
+
+	return false;
+}
+
+function groups_delete_group_forum_post( $post_id, $topic_id ) {
+	global $bp;
+
+	if ( bp_forums_delete_post( array( 'post_id' => $post_id ) ) ) {
+		/* Delete the activity stream item */
+		if ( function_exists( 'bp_activity_delete' ) ) {
+			bp_activity_delete( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $post_id, 'component' => $bp->groups->id, 'type' => 'new_forum_post' ) );
+		}
+
+		do_action( 'groups_delete_group_forum_post', $post_id, $topic_id );
+
+		return true;
+	}
+
+	return false;
+}
+
+
+function groups_total_public_forum_topic_count( $type = 'newest' ) {
+	return apply_filters( 'groups_total_public_forum_topic_count', BP_Groups_Group::get_global_forum_topic_count( $type ) );
+}
+
+/*** Group Invitations *********************************************************/
+
+function groups_get_invites_for_user( $user_id = false, $limit = false, $page = false ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = $bp->loggedin_user->id;
+
+	return BP_Groups_Member::get_invites( $user_id, $limit, $page );
+}
+
+function groups_invite_user( $args = '' ) {
+	global $bp;
+
+	$defaults = array(
+		'user_id' => false,
+		'group_id' => false,
+		'inviter_id' => $bp->loggedin_user->id,
+		'date_modified' => gmdate( "Y-m-d H:i:s" ),
+		'is_confirmed' => 0
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+	extract( $args, EXTR_SKIP );
+
+	if ( !$user_id || !$group_id )
+		return false;
+
+	if ( !groups_is_user_member( $user_id, $group_id ) && !groups_check_user_has_invite( $user_id, $group_id ) ) {
+		$invite = new BP_Groups_Member;
+		$invite->group_id = $group_id;
+		$invite->user_id = $user_id;
+		$invite->date_modified = $date_modified;
+		$invite->inviter_id = $inviter_id;
+		$invite->is_confirmed = $is_confirmed;
+
+		if ( !$invite->save() )
+			return false;
+
+		do_action( 'groups_invite_user', $args );
+	}
+
+	return true;
+}
+
+function groups_uninvite_user( $user_id, $group_id ) {
+	global $bp;
+
+	if ( !BP_Groups_Member::delete( $user_id, $group_id ) )
+		return false;
+
+	do_action( 'groups_uninvite_user', $group_id, $user_id );
+
+	return true;
+}
+
+function groups_accept_invite( $user_id, $group_id ) {
+	global $bp;
+
+	if ( groups_is_user_member( $user_id, $group_id ) )
+		return false;
+
+	$member = new BP_Groups_Member( $user_id, $group_id );
+	$member->accept_invite();
+
+	if ( !$member->save() )
+		return false;
+
+	/* Remove request to join */
+	if ( $member->check_for_membership_request( $user_id, $group_id ) )
+		$member->delete_request( $user_id, $group_id );
+
+	/* Modify group meta */
+	groups_update_groupmeta( $group_id, 'total_member_count', (int) groups_get_groupmeta( $group_id, 'total_member_count') + 1 );
+	groups_update_groupmeta( $group_id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
+
+	bp_core_delete_notifications_for_user_by_item_id( $user_id, $group_id, $bp->groups->id, 'group_invite' );
+
+	do_action( 'groups_accept_invite', $user_id, $group_id );
+	return true;
+}
+
+function groups_reject_invite( $user_id, $group_id ) {
+	if ( !BP_Groups_Member::delete( $user_id, $group_id ) )
+		return false;
+
+	do_action( 'groups_reject_invite', $user_id, $group_id );
+
+	return true;
+}
+
+function groups_delete_invite( $user_id, $group_id ) {
+	global $bp;
+
+	$delete = BP_Groups_Member::delete_invite( $user_id, $group_id );
+
+	if ( $delete )
+		bp_core_delete_notifications_for_user_by_item_id( $user_id, $group_id, $bp->groups->id, 'group_invite' );
+
+	return $delete;
+}
+
+function groups_send_invites( $user_id, $group_id ) {
+	global $bp;
+
+	require_once ( BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php' );
+
+	if ( !$user_id )
+		$user_id = $bp->loggedin_user->id;
+
+	// Send friend invites.
+	$invited_users = groups_get_invites_for_group( $user_id, $group_id );
+	$group = new BP_Groups_Group( $group_id );
+
+	for ( $i = 0; $i < count( $invited_users ); $i++ ) {
+		$member = new BP_Groups_Member( $invited_users[$i], $group_id );
+
+		// Send the actual invite
+		groups_notification_group_invites( $group, $member, $user_id );
+
+		$member->invite_sent = 1;
+		$member->save();
+	}
+
+	do_action( 'groups_send_invites', $bp->groups->current_group->id, $invited_users );
+}
+
+function groups_get_invites_for_group( $user_id, $group_id ) {
+	return BP_Groups_Group::get_invites( $user_id, $group_id );
+}
+
+function groups_check_user_has_invite( $user_id, $group_id ) {
+	return BP_Groups_Member::check_has_invite( $user_id, $group_id );
+}
+
+function groups_delete_all_group_invites( $group_id ) {
+	return BP_Groups_Group::delete_all_invites( $group_id );
+}
+
+/*** Group Promotion & Banning *************************************************/
+
+function groups_promote_member( $user_id, $group_id, $status ) {
+	global $bp;
+
+	if ( !$bp->is_item_admin )
+		return false;
+
+	$member = new BP_Groups_Member( $user_id, $group_id );
+
+	do_action( 'groups_premote_member', $group_id, $user_id, $status );
+
+	return $member->promote( $status );
+}
+
+function groups_demote_member( $user_id, $group_id ) {
+	global $bp;
+
+	$member = new BP_Groups_Member( $user_id, $group_id );
+
+	do_action( 'groups_demote_member', $group_id, $user_id );
+
+	return $member->demote();
+}
+
+function groups_ban_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_ban_member', $group_id, $user_id );
+
+	return $member->ban();
+}
+
+function groups_unban_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_unban_member', $group_id, $user_id );
+
+	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 );
+
+	return $member->remove();
+}
+
+/*** Group Membership ****************************************************/
+
+function groups_send_membership_request( $requesting_user_id, $group_id ) {
+	global $bp;
+
+	/* Prevent duplicate requests */
+	if ( groups_check_for_membership_request( $requesting_user_id, $group_id ) )
+		return false;
+
+	/* Check if the user is already a member or is banned */
+	if ( groups_is_user_member( $requesting_user_id, $group_id ) || groups_is_user_banned( $requesting_user_id, $group_id ) )
+		return false;
+
+	$requesting_user = new BP_Groups_Member;
+	$requesting_user->group_id = $group_id;
+	$requesting_user->user_id = $requesting_user_id;
+	$requesting_user->inviter_id = 0;
+	$requesting_user->is_admin = 0;
+	$requesting_user->user_title = '';
+	$requesting_user->date_modified = gmdate( "Y-m-d H:i:s" );
+	$requesting_user->is_confirmed = 0;
+	$requesting_user->comments = $_POST['group-request-membership-comments'];
+
+	if ( $requesting_user->save() ) {
+		$admins = groups_get_group_admins( $group_id );
+
+		require_once ( BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php' );
+
+		for ( $i = 0; $i < count( $admins ); $i++ ) {
+			// Saved okay, now send the email notification
+			groups_notification_new_membership_request( $requesting_user_id, $admins[$i]->user_id, $group_id, $requesting_user->id );
+		}
+
+		do_action( 'groups_membership_requested', $requesting_user_id, $admins, $group_id, $requesting_user->id );
+
+		return true;
+	}
+
+	return false;
+}
+
+function groups_accept_membership_request( $membership_id, $user_id = false, $group_id = false ) {
+	global $bp;
+
+	if ( $user_id && $group_id )
+		$membership = new BP_Groups_Member( $user_id, $group_id );
+	else
+		$membership = new BP_Groups_Member( false, false, $membership_id );
+
+	$membership->accept_request();
+
+	if ( !$membership->save() )
+		return false;
+
+	/* Check if the user has an outstanding invite, if so delete it. */
+	if ( groups_check_user_has_invite( $membership->user_id, $membership->group_id ) )
+		groups_delete_invite( $membership->user_id, $membership->group_id );
+
+	/* Modify group member count */
+	groups_update_groupmeta( $membership->group_id, 'total_member_count', (int) groups_get_groupmeta( $membership->group_id, 'total_member_count') + 1 );
+
+	/* Record this in activity streams */
+	$group = new BP_Groups_Group( $membership->group_id );
+
+	groups_record_activity( array(
+		'action'	=> apply_filters( 'groups_activity_membership_accepted_action', sprintf( __( '%s joined the group %s', 'buddypress'), bp_core_get_userlink( $membership->user_id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . esc_attr( $group->name ) . '</a>' ), $membership->user_id, &$group ),
+		'type'		=> 'joined_group',
+		'item_id'	=> $membership->group_id,
+		'user_id'	=> $membership->user_id
+	) );
+
+	/* Send a notification to the user. */
+	require_once ( BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php' );
+	groups_notification_membership_request_completed( $membership->user_id, $membership->group_id, true );
+
+	do_action( 'groups_membership_accepted', $membership->user_id, $membership->group_id );
+
+	return true;
+}
+
+function groups_reject_membership_request( $membership_id, $user_id = false, $group_id = false ) {
+	if ( !$membership = groups_delete_membership_request( $membership_id, $user_id, $group_id ) )
+		return false;
+
+	// Send a notification to the user.
+	require_once ( BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php' );
+	groups_notification_membership_request_completed( $membership->user_id, $membership->group_id, false );
+
+	do_action( 'groups_membership_rejected', $membership->user_id, $membership->group_id );
+
+	return true;
+}
+
+function groups_delete_membership_request( $membership_id, $user_id = false, $group_id = false ) {
+	if ( $user_id && $group_id )
+		$membership = new BP_Groups_Member( $user_id, $group_id );
+	else
+		$membership = new BP_Groups_Member( false, false, $membership_id );
+
+	if ( !BP_Groups_Member::delete( $membership->user_id, $membership->group_id ) )
+		return false;
+
+	return $membership;
+}
+
+function groups_check_for_membership_request( $user_id, $group_id ) {
+	return BP_Groups_Member::check_for_membership_request( $user_id, $group_id );
+}
+
+function groups_accept_all_pending_membership_requests( $group_id ) {
+	$user_ids = BP_Groups_Member::get_all_membership_request_user_ids( $group_id );
+
+	if ( !$user_ids )
+		return false;
+
+	foreach ( (array) $user_ids as $user_id ) {
+		groups_accept_membership_request( false, $user_id, $group_id );
+	}
+
+	do_action( 'groups_accept_all_pending_membership_requests', $group_id );
+
+	return true;
+}
+
+/*** Group Meta ****************************************************/
+
+function groups_delete_groupmeta( $group_id, $meta_key = false, $meta_value = false ) {
+	global $wpdb, $bp;
+
+	if ( !is_numeric( $group_id ) )
+		return false;
+
+	$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
+
+	if ( is_array($meta_value) || is_object($meta_value) )
+		$meta_value = serialize($meta_value);
+
+	$meta_value = trim( $meta_value );
+
+	if ( !$meta_key ) {
+		$wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d", $group_id ) );
+	} else if ( $meta_value ) {
+		$wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d AND meta_key = %s AND meta_value = %s", $group_id, $meta_key, $meta_value ) );
+	} else {
+		$wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key ) );
+	}
+
+	/* Delete the cached object */
+	wp_cache_delete( 'bp_groups_groupmeta_' . $group_id . '_' . $meta_key, 'bp' );
+
+	return true;
+}
+
+function groups_get_groupmeta( $group_id, $meta_key = '') {
+	global $wpdb, $bp;
+
+	$group_id = (int) $group_id;
+
+	if ( !$group_id )
+		return false;
+
+	if ( !empty($meta_key) ) {
+		$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
+
+		if ( !$metas = wp_cache_get( 'bp_groups_groupmeta_' . $group_id . '_' . $meta_key, 'bp' ) ) {
+			$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key) );
+			wp_cache_set( 'bp_groups_groupmeta_' . $group_id . '_' . $meta_key, $metas, 'bp' );
+		}
+	} else {
+		$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d", $group_id) );
+	}
+
+	if ( empty($metas) ) {
+		if ( empty($meta_key) )
+			return array();
+		else
+			return '';
+	}
+
+	$metas = array_map('maybe_unserialize', (array)$metas);
+
+	if ( 1 == count($metas) )
+		return $metas[0];
+	else
+		return $metas;
+}
+
+function groups_update_groupmeta( $group_id, $meta_key, $meta_value ) {
+	global $wpdb, $bp;
+
+	if ( !is_numeric( $group_id ) )
+		return false;
+
+	$meta_key = preg_replace( '|[^a-z0-9_]|i', '', $meta_key );
+
+	if ( is_string($meta_value) )
+		$meta_value = stripslashes($wpdb->escape($meta_value));
+
+	$meta_value = maybe_serialize($meta_value);
+
+	if (empty($meta_value)) {
+		return groups_delete_groupmeta( $group_id, $meta_key );
+	}
+
+	$cur = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key ) );
+
+	if ( !$cur ) {
+		$wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp->groups->table_name_groupmeta . " ( group_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", $group_id, $meta_key, $meta_value ) );
+	} else if ( $cur->meta_value != $meta_value ) {
+		$wpdb->query( $wpdb->prepare( "UPDATE " . $bp->groups->table_name_groupmeta . " SET meta_value = %s WHERE group_id = %d AND meta_key = %s", $meta_value, $group_id, $meta_key ) );
+	} else {
+		return false;
+	}
+
+	/* Update the cached object and recache */
+	wp_cache_set( 'bp_groups_groupmeta_' . $group_id . '_' . $meta_key, $meta_value, 'bp' );
+
+	return true;
+}
+
+/*** Group Cleanup Functions ****************************************************/
+
+function groups_remove_data_for_user( $user_id ) {
+	BP_Groups_Member::delete_all_for_user($user_id);
+
+	do_action( 'groups_remove_data_for_user', $user_id );
+}
+add_action( 'wpmu_delete_user', 'groups_remove_data_for_user' );
+add_action( 'delete_user', 'groups_remove_data_for_user' );
+add_action( 'make_spam_user', 'groups_remove_data_for_user' );
+
+
+/********************************************************************************
+ * Caching
+ *
+ * Caching functions handle the clearing of cached objects and pages on specific
+ * actions throughout BuddyPress.
+ */
+
+function groups_clear_group_object_cache( $group_id ) {
+	wp_cache_delete( 'groups_group_nouserdata_' . $group_id, 'bp' );
+	wp_cache_delete( 'groups_group_' . $group_id, 'bp' );
+	wp_cache_delete( 'newest_groups', 'bp' );
+	wp_cache_delete( 'active_groups', 'bp' );
+	wp_cache_delete( 'popular_groups', 'bp' );
+	wp_cache_delete( 'groups_random_groups', 'bp' );
+	wp_cache_delete( 'bp_total_group_count', 'bp' );
+}
+add_action( 'groups_group_deleted', 'groups_clear_group_object_cache' );
+add_action( 'groups_settings_updated', 'groups_clear_group_object_cache' );
+add_action( 'groups_details_updated', 'groups_clear_group_object_cache' );
+add_action( 'groups_group_avatar_updated', 'groups_clear_group_object_cache' );
+add_action( 'groups_create_group_step_complete', 'groups_clear_group_object_cache' );
+
+function groups_clear_group_user_object_cache( $group_id, $user_id ) {
+	wp_cache_delete( 'bp_total_groups_for_user_' . $user_id );
+}
+add_action( 'groups_join_group', 'groups_clear_group_user_object_cache', 10, 2 );
+add_action( 'groups_leave_group', 'groups_clear_group_user_object_cache', 10, 2 );
+add_action( 'groups_ban_member', 'groups_clear_group_user_object_cache', 10, 2 );
+add_action( 'groups_unban_member', 'groups_clear_group_user_object_cache', 10, 2 );
+
+/* List actions to clear super cached pages on, if super cache is installed */
+add_action( 'groups_join_group', 'bp_core_clear_cache' );
+add_action( 'groups_leave_group', 'bp_core_clear_cache' );
+add_action( 'groups_accept_invite', 'bp_core_clear_cache' );
+add_action( 'groups_reject_invite', 'bp_core_clear_cache' );
+add_action( 'groups_invite_user', 'bp_core_clear_cache' );
+add_action( 'groups_uninvite_user', 'bp_core_clear_cache' );
+add_action( 'groups_details_updated', 'bp_core_clear_cache' );
+add_action( 'groups_settings_updated', 'bp_core_clear_cache' );
+add_action( 'groups_unban_member', 'bp_core_clear_cache' );
+add_action( 'groups_ban_member', 'bp_core_clear_cache' );
+add_action( 'groups_demote_member', 'bp_core_clear_cache' );
+add_action( 'groups_premote_member', 'bp_core_clear_cache' );
+add_action( 'groups_membership_rejected', 'bp_core_clear_cache' );
+add_action( 'groups_membership_accepted', 'bp_core_clear_cache' );
+add_action( 'groups_membership_requested', 'bp_core_clear_cache' );
+add_action( 'groups_create_group_step_complete', 'bp_core_clear_cache' );
+add_action( 'groups_created_group', 'bp_core_clear_cache' );
+add_action( 'groups_group_avatar_updated', 'bp_core_clear_cache' );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-groups/bp-groups-classes.php b/wp-content/plugins/buddypress/bp-groups/bp-groups-classes.php
new file mode 100644
index 0000000000000000000000000000000000000000..dc1797e1f37e3cee75d532ec4e91b794852dd65e
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-groups/bp-groups-classes.php
@@ -0,0 +1,1256 @@
+<?php
+
+Class BP_Groups_Group {
+	var $id;
+	var $creator_id;
+	var $name;
+	var $slug;
+	var $description;
+	var $status;
+	var $enable_forum;
+	var $date_created;
+
+	var $admins;
+	var $total_member_count;
+
+	function bp_groups_group( $id = null ) {
+		if ( $id ) {
+			$this->id = $id;
+			$this->populate();
+		}
+	}
+
+	function populate() {
+		global $wpdb, $bp;
+
+		if ( $group = $wpdb->get_row( $wpdb->prepare( "SELECT g.*, gm.meta_value as last_activity, gm2.meta_value as total_member_count FROM {$bp->groups->table_name} g, {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name_groupmeta} gm2 WHERE g.id = gm.group_id AND g.id = gm2.group_id AND gm.meta_key = 'last_activity' AND gm2.meta_key = 'total_member_count' AND g.id = %d", $this->id ) ) ) {
+			$this->id = $group->id;
+			$this->creator_id = $group->creator_id;
+			$this->name = stripslashes($group->name);
+			$this->slug = $group->slug;
+			$this->description = stripslashes($group->description);
+			$this->status = $group->status;
+			$this->enable_forum = $group->enable_forum;
+			$this->date_created = $group->date_created;
+			$this->last_activity = $group->last_activity;
+			$this->total_member_count = $group->total_member_count;
+			$this->is_member = BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $this->id );
+
+			/* Get group admins and mods */
+			$admin_mods = $wpdb->get_results( $wpdb->prepare( "SELECT u.ID as user_id, u.user_login, u.user_email, u.user_nicename, m.is_admin, m.is_mod FROM {$wpdb->users} u, {$bp->groups->table_name_members} m WHERE u.ID = m.user_id AND m.group_id = %d AND ( m.is_admin = 1 OR m.is_mod = 1 )", $this->id ) );
+			foreach( (array)$admin_mods as $user ) {
+				if ( (int)$user->is_admin )
+					$this->admins[] = $user;
+				else
+					$this->mods[] = $user;
+			}
+		}
+	}
+
+	function save() {
+		global $wpdb, $bp;
+
+		$this->creator_id = apply_filters( 'groups_group_creator_id_before_save', $this->creator_id, $this->id );
+		$this->name = apply_filters( 'groups_group_name_before_save', $this->name, $this->id );
+ 		$this->slug = apply_filters( 'groups_group_slug_before_save', $this->slug, $this->id );
+		$this->description = apply_filters( 'groups_group_description_before_save', $this->description, $this->id );
+ 		$this->status = apply_filters( 'groups_group_status_before_save', $this->status, $this->id );
+		$this->enable_forum = apply_filters( 'groups_group_enable_forum_before_save', $this->enable_forum, $this->id );
+		$this->date_created = apply_filters( 'groups_group_date_created_before_save', $this->date_created, $this->id );
+
+		do_action( 'groups_group_before_save', $this );
+
+		if ( $this->id ) {
+			$sql = $wpdb->prepare(
+				"UPDATE {$bp->groups->table_name} SET
+					creator_id = %d,
+					name = %s,
+					slug = %s,
+					description = %s,
+					status = %s,
+					enable_forum = %d,
+					date_created = %s
+				WHERE
+					id = %d
+				",
+					$this->creator_id,
+					$this->name,
+					$this->slug,
+					$this->description,
+					$this->status,
+					$this->enable_forum,
+					$this->date_created,
+					$this->id
+			);
+		} else {
+			$sql = $wpdb->prepare(
+				"INSERT INTO {$bp->groups->table_name} (
+					creator_id,
+					name,
+					slug,
+					description,
+					status,
+					enable_forum,
+					date_created
+				) VALUES (
+					%d, %s, %s, %s, %s, %d, %s
+				)",
+					$this->creator_id,
+					$this->name,
+					$this->slug,
+					$this->description,
+					$this->status,
+					$this->enable_forum,
+					$this->date_created
+			);
+		}
+
+		if ( false === $wpdb->query($sql) )
+			return false;
+
+		if ( !$this->id ) {
+			$this->id = $wpdb->insert_id;
+		}
+
+		do_action( 'groups_group_after_save', $this );
+
+		return true;
+	}
+
+	function delete() {
+		global $wpdb, $bp;
+
+		/* Delete groupmeta for the group */
+		groups_delete_groupmeta( $this->id );
+
+		/* Fetch the user IDs of all the members of the group */
+		$user_ids = BP_Groups_Member::get_group_member_ids( $this->id );
+		$user_ids = implode( ',', (array)$user_ids );
+
+		/* Modify group count usermeta for members */
+		$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->usermeta} SET meta_value = meta_value - 1 WHERE meta_key = 'total_group_count' AND user_id IN ( {$user_ids} )" ) );
+
+		/* Now delete all group member entries */
+		BP_Groups_Member::delete_all( $this->id );
+
+		do_action( 'bp_groups_delete_group', $this );
+
+		// Finally remove the group entry from the DB
+		if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name} WHERE id = %d", $this->id ) ) )
+			return false;
+
+		return true;
+	}
+
+	/* Static Functions */
+
+	function group_exists( $slug, $table_name = false ) {
+		global $wpdb, $bp;
+
+		if ( !$table_name )
+			$table_name = $bp->groups->table_name;
+
+		if ( !$slug )
+			return false;
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$table_name} WHERE slug = %s", $slug ) );
+	}
+
+	function get_id_from_slug( $slug ) {
+		return BP_Groups_Group::group_exists( $slug );
+	}
+
+	function get_invites( $user_id, $group_id ) {
+		global $wpdb, $bp;
+		return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d and is_confirmed = 0 AND inviter_id = %d", $group_id, $user_id ) );
+	}
+
+	function filter_user_groups( $filter, $user_id = false, $order = false, $limit = null, $page = null ) {
+		global $wpdb, $bp;
+
+		if ( !$user_id )
+			$user_id = $bp->displayed_user->id;
+
+		$filter = like_escape( $wpdb->escape( $filter ) );
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		// Get all the group ids for the current user's groups.
+		$gids = BP_Groups_Member::get_group_ids( $user_id );
+
+		if ( !$gids['groups'] )
+			return false;
+
+		$gids = implode( ',', $gids['groups'] );
+
+		$paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM {$bp->groups->table_name} WHERE ( name LIKE '{$filter}%%' OR description LIKE '{$filter}%%' ) AND id IN ({$gids}) {$pag_sql}" ) );
+		$total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name} WHERE ( name LIKE '{$filter}%%' OR description LIKE '{$filter}%%' ) AND id IN ({$gids})" ) );
+
+		return array( 'groups' => $paged_groups, 'total' => $total_groups );
+	}
+
+	function search_groups( $filter, $limit = null, $page = null, $sort_by = false, $order = false ) {
+		global $wpdb, $bp;
+
+		$filter = like_escape( $wpdb->escape( $filter ) );
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		if ( $sort_by && $order ) {
+			$sort_by = $wpdb->escape( $sort_by );
+			$order = $wpdb->escape( $order );
+			$order_sql = "ORDER BY $sort_by $order";
+		}
+
+		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}" );
+		$total_groups = $wpdb->get_var( "SELECT COUNT(id) FROM {$bp->groups->table_name} WHERE ( name LIKE '%%$filter%%' OR description LIKE '%%$filter%%' ) {$hidden_sq}" );
+
+		return array( 'groups' => $paged_groups, 'total' => $total_groups );
+	}
+
+	function check_slug( $slug ) {
+		global $wpdb, $bp;
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM {$bp->groups->table_name} WHERE slug = %s", $slug ) );
+	}
+
+	function get_slug( $group_id ) {
+		global $wpdb, $bp;
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM {$bp->groups->table_name} WHERE id = %d", $group_id ) );
+	}
+
+	function has_members( $group_id ) {
+		global $wpdb, $bp;
+
+		$members = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d", $group_id ) );
+
+		if ( !$members )
+			return false;
+
+		return true;
+	}
+
+	function has_membership_requests( $group_id ) {
+		global $wpdb, $bp;
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0", $group_id ) );
+	}
+
+	function get_membership_requests( $group_id, $limit = null, $page = null ) {
+		global $wpdb, $bp;
+
+		if ( $limit && $page ) {
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+		}
+
+		$paged_requests = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0 AND inviter_id = 0{$pag_sql}", $group_id ) );
+		$total_requests = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0 AND inviter_id = 0", $group_id ) );
+
+		return array( 'requests' => $paged_requests, 'total' => $total_requests );
+	}
+
+	/* TODO: Merge all these get_() functions into one. */
+
+	function get_newest( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
+		global $wpdb, $bp;
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
+			$hidden_sql = "AND g.status != 'hidden'";
+
+		if ( $search_terms ) {
+			$search_terms = like_escape( $wpdb->escape( $search_terms ) );
+			$search_sql = " AND ( g.name LIKE '%%{$search_terms}%%' OR g.description LIKE '%%{$search_terms}%%' )";
+		}
+
+		if ( $user_id ) {
+			$user_id = $wpdb->escape( $user_id );
+			$paged_groups = $wpdb->get_results( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE g.id = m.group_id AND g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' {$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0 ORDER BY g.date_created DESC {$pag_sql}" );
+			$total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT m.group_id) FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id INNER JOIN {$bp->groups->table_name} g ON m.group_id = g.id WHERE gm.meta_key = 'last_activity'{$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0" );
+		} else {
+			$paged_groups = $wpdb->get_results( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name} g 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' {$hidden_sql} {$search_sql} ORDER BY g.date_created DESC {$pag_sql}" );
+			$total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name_groupmeta} gm INNER JOIN {$bp->groups->table_name} g ON gm.group_id = g.id WHERE gm.meta_key = 'last_activity'{$hidden_sql} {$search_sql}" );
+		}
+
+		if ( !empty( $populate_extras ) ) {
+			foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
+			$group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
+			$paged_groups = BP_Groups_Group::get_group_extras( &$paged_groups, $group_ids, 'newest' );
+		}
+
+		return array( 'groups' => $paged_groups, 'total' => $total_groups );
+	}
+
+	function get_active( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
+		global $wpdb, $bp;
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
+			$hidden_sql = "AND g.status != 'hidden'";
+
+		if ( $search_terms ) {
+			$search_terms = like_escape( $wpdb->escape( $search_terms ) );
+			$search_sql = " AND ( g.name LIKE '%%{$search_terms}%%' OR g.description LIKE '%%{$search_terms}%%' )";
+		}
+
+		if ( $user_id ) {
+			$user_id = $wpdb->escape( $user_id );
+			$paged_groups = $wpdb->get_results( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE g.id = m.group_id AND g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' {$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0 ORDER BY last_activity DESC {$pag_sql}" );
+			$total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT m.group_id) FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id INNER JOIN {$bp->groups->table_name} g ON m.group_id = g.id WHERE gm.meta_key = 'last_activity'{$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0" );
+		} else {
+			$paged_groups = $wpdb->get_results( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name} g 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' {$hidden_sql} {$search_sql} ORDER BY last_activity DESC {$pag_sql}" );
+			$total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name_groupmeta} gm INNER JOIN {$bp->groups->table_name} g ON gm.group_id = g.id WHERE gm.meta_key = 'last_activity'{$hidden_sql} {$search_sql}" );
+		}
+
+		if ( !empty( $populate_extras ) ) {
+			foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
+			$group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
+			$paged_groups = BP_Groups_Group::get_group_extras( &$paged_groups, $group_ids, 'newest' );
+		}
+
+		return array( 'groups' => $paged_groups, 'total' => $total_groups );
+	}
+
+	function get_popular( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
+		global $wpdb, $bp;
+
+		if ( $limit && $page ) {
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+		}
+
+		if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
+			$hidden_sql = "AND g.status != 'hidden'";
+
+		if ( $search_terms ) {
+			$search_terms = like_escape( $wpdb->escape( $search_terms ) );
+			$search_sql = " AND ( g.name LIKE '%%{$search_terms}%%' OR g.description LIKE '%%{$search_terms}%%' )";
+		}
+
+		if ( $user_id ) {
+			$user_id = $wpdb->escape( $user_id );
+			$paged_groups = $wpdb->get_results( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE g.id = m.group_id AND g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' {$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0 ORDER BY CONVERT(gm1.meta_value, SIGNED) DESC {$pag_sql}" );
+			$total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT m.group_id) FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id INNER JOIN {$bp->groups->table_name} g ON m.group_id = g.id WHERE gm.meta_key = 'last_activity'{$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0" );
+		} else {
+			$paged_groups = $wpdb->get_results( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name} g 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' {$hidden_sql} {$search_sql} ORDER BY CONVERT(gm1.meta_value, SIGNED) DESC {$pag_sql}" );
+			$total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name} g 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' {$hidden_sql} {$search_sql}" );
+		}
+
+		if ( !empty( $populate_extras ) ) {
+			foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
+			$group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
+			$paged_groups = BP_Groups_Group::get_group_extras( &$paged_groups, $group_ids, 'newest' );
+		}
+
+		return array( 'groups' => $paged_groups, 'total' => $total_groups );
+	}
+
+	function get_alphabetically( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
+		global $wpdb, $bp;
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
+			$hidden_sql = " AND g.status != 'hidden'";
+
+		if ( $search_terms ) {
+			$search_terms = like_escape( $wpdb->escape( $search_terms ) );
+			$search_sql = " AND ( g.name LIKE '%%{$search_terms}%%' OR g.description LIKE '%%{$search_terms}%%' )";
+		}
+
+		if ( $user_id ) {
+			$user_id = $wpdb->escape( $user_id );
+			$paged_groups = $wpdb->get_results( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE g.id = m.group_id AND g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' {$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0 ORDER BY g.name ASC {$pag_sql}" );
+			$total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT m.group_id) FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id INNER JOIN {$bp->groups->table_name} g ON m.group_id = g.id WHERE gm.meta_key = 'last_activity' {$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0" );
+		} else {
+			$paged_groups = $wpdb->get_results( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name} g 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' {$hidden_sql} {$search_sql} ORDER BY g.name ASC {$pag_sql}" );
+			$total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name} g 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' {$hidden_sql} {$search_sql}" );
+		}
+
+		if ( !empty( $populate_extras ) ) {
+			foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
+			$group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
+			$paged_groups = BP_Groups_Group::get_group_extras( &$paged_groups, $group_ids, 'newest' );
+		}
+
+		return array( 'groups' => $paged_groups, 'total' => $total_groups );
+	}
+
+	function get_by_most_forum_topics( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
+		global $wpdb, $bp, $bbdb;
+
+		if ( !$bbdb )
+			do_action( 'bbpress_init' );
+
+		if ( $limit && $page ) {
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+		}
+
+		if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
+			$hidden_sql = " AND g.status != 'hidden'";
+
+		if ( $search_terms ) {
+			$search_terms = like_escape( $wpdb->escape( $search_terms ) );
+			$search_sql = " AND ( g.name LIKE '%%{$search_terms}%%' OR g.description LIKE '%%{$search_terms}%%' )";
+		}
+
+		if ( $user_id ) {
+			$user_id = $wpdb->escape( $user_id );
+			$paged_groups = $wpdb->get_results( "SELECT DISTINCT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_groupmeta} gm3, {$bp->groups->table_name_members} m, {$bbdb->forums} f, {$bp->groups->table_name} g WHERE g.id = m.group_id AND g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) AND f.topics > 0 {$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0 ORDER BY f.topics DESC {$pag_sql}" );
+			$total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_groupmeta} gm3, {$bbdb->forums} f, {$bp->groups->table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) AND f.topics > 0 {$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0" );
+		} else {
+			$paged_groups = $wpdb->get_results( "SELECT DISTINCT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_groupmeta} gm3, {$bbdb->forums} f, {$bp->groups->table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) AND f.topics > 0 {$hidden_sql} {$search_sql} ORDER BY f.topics DESC {$pag_sql}" );
+			$total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_groupmeta} gm3, {$bbdb->forums} f, {$bp->groups->table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) AND f.topics > 0 {$hidden_sql} {$search_sql}" );
+		}
+
+		if ( !empty( $populate_extras ) ) {
+			foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
+			$group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
+			$paged_groups = BP_Groups_Group::get_group_extras( &$paged_groups, $group_ids, 'newest' );
+		}
+
+		return array( 'groups' => $paged_groups, 'total' => $total_groups );
+	}
+
+	function get_by_most_forum_posts( $limit = null, $page = null, $search_terms = false, $populate_extras = true ) {
+		global $wpdb, $bp, $bbdb;
+
+		if ( !$bbdb )
+			do_action( 'bbpress_init' );
+
+		if ( $limit && $page ) {
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+		}
+
+		if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
+			$hidden_sql = " AND g.status != 'hidden'";
+
+		if ( $search_terms ) {
+			$search_terms = like_escape( $wpdb->escape( $search_terms ) );
+			$search_sql = " AND ( g.name LIKE '%%{$search_terms}%%' OR g.description LIKE '%%{$search_terms}%%' )";
+		}
+
+		if ( $user_id ) {
+			$user_id = $wpdb->escape( $user_id );
+			$paged_groups = $wpdb->get_results( "SELECT DISTINCT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_groupmeta} gm3, {$bp->groups->table_name_members} m, {$bbdb->forums} f, {$bp->groups->table_name} g WHERE g.id = m.group_id AND g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) {$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0 ORDER BY f.posts ASC {$pag_sql}" );
+			$total_groups = $wpdb->get_results( "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_groupmeta} gm3, {$bp->groups->table_name_members} m, {$bbdb->forums} f, {$bp->groups->table_name} g WHERE g.id = m.group_id AND g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) AND f.posts > 0 {$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0" );
+		} else {
+			$paged_groups = $wpdb->get_results( "SELECT DISTINCT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_groupmeta} gm3, {$bbdb->forums} f, {$bp->groups->table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) AND f.posts > 0 {$hidden_sql} {$search_sql} ORDER BY f.posts ASC {$pag_sql}" );
+			$total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_groupmeta} gm3, {$bbdb->forums} f, {$bp->groups->table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) {$hidden_sql} {$search_sql}" );
+		}
+
+		if ( !empty( $populate_extras ) ) {
+			foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
+			$group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
+			$paged_groups = BP_Groups_Group::get_group_extras( &$paged_groups, $group_ids, 'newest' );
+		}
+
+		return array( 'groups' => $paged_groups, 'total' => $total_groups );
+	}
+
+	function get_all( $limit = null, $page = null, $only_public = true, $sort_by = false, $order = false ) {
+		global $wpdb, $bp;
+
+		// Default sql WHERE conditions are blank. TODO: generic handler function.
+		$where_sql = null;
+		$where_conditions = array();
+
+		// Limit results to public status
+		if ( $only_public )
+			$where_conditions[] = $wpdb->prepare( "g.status = 'public'" );
+
+		if ( !is_super_admin() )
+			$where_conditions[] = $wpdb->prepare( "g.status != 'hidden'");
+
+		// Build where sql statement if necessary
+		if ( !empty( $where_conditions ) )
+			$where_sql = 'WHERE ' . join( ' AND ', $where_conditions );
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		if ( $sort_by && $order ) {
+			$sort_by = $wpdb->escape( $sort_by );
+			$order = $wpdb->escape( $order );
+			$order_sql = "ORDER BY g.$sort_by $order";
+
+			switch ( $sort_by ) {
+				default:
+					$sql = $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name} g {$where_sql} {$order_sql} {$pag_sql}" );
+					break;
+				case 'members':
+					$sql = $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name} g, {$bp->groups->table_name_groupmeta} gm WHERE g.id = gm.group_id AND gm.meta_key = 'total_member_count' {$hidden_sql} {$public_sql} ORDER BY CONVERT(gm.meta_value, SIGNED) {$order} {$pag_sql}" );
+					break;
+				case 'last_active':
+					$sql = $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name} g, {$bp->groups->table_name_groupmeta} gm WHERE g.id = gm.group_id AND gm.meta_key = 'last_activity' {$hidden_sql} {$public_sql} ORDER BY CONVERT(gm.meta_value, SIGNED) {$order} {$pag_sql}" );
+					break;
+			}
+		} else {
+			$sql = $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name} g {$where_sql} {$order_sql} {$pag_sql}" );
+		}
+
+		return $wpdb->get_results($sql);
+	}
+
+	function get_by_letter( $letter, $limit = null, $page = null, $populate_extras = true ) {
+		global $wpdb, $bp;
+
+		// 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_super_admin() )
+			$hidden_sql = $wpdb->prepare( " AND status != 'hidden'");
+
+		$letter = like_escape( $wpdb->escape( $letter ) );
+
+		if ( $limit && $page ) {
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+			$total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name} g 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' AND g.name LIKE '$letter%%' {$hidden_sql} {$search_sql}" ) );
+		}
+
+		$paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name} g 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' AND g.name LIKE '$letter%%' {$hidden_sql} {$search_sql} ORDER BY g.name ASC {$pag_sql}"  ) );
+
+		if ( !empty( $populate_extras ) ) {
+			foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
+			$group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
+			$paged_groups = BP_Groups_Group::get_group_extras( &$paged_groups, $group_ids, 'newest' );
+		}
+
+		return array( 'groups' => $paged_groups, 'total' => $total_groups );
+	}
+
+	function get_random( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
+		global $wpdb, $bp;
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
+			$hidden_sql = "AND g.status != 'hidden'";
+
+		if ( $search_terms ) {
+			$search_terms = like_escape( $wpdb->escape( $search_terms ) );
+			$search_sql = " AND ( g.name LIKE '%%{$search_terms}%%' OR g.description LIKE '%%{$search_terms}%%' )";
+		}
+
+		if ( $user_id ) {
+			$user_id = $wpdb->escape( $user_id );
+			$paged_groups = $wpdb->get_results( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE g.id = m.group_id AND g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' {$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0 ORDER BY rand() {$pag_sql}" );
+			$total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT m.group_id) FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id INNER JOIN {$bp->groups->table_name} g ON m.group_id = g.id WHERE gm.meta_key = 'last_activity'{$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0" );
+		} else {
+			$paged_groups = $wpdb->get_results( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name} g 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' {$hidden_sql} {$search_sql} ORDER BY rand() {$pag_sql}" );
+			$total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name_groupmeta} gm INNER JOIN {$bp->groups->table_name} g ON gm.group_id = g.id WHERE gm.meta_key = 'last_activity'{$hidden_sql} {$search_sql}" );
+		}
+
+		if ( !empty( $populate_extras ) ) {
+			foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
+			$group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
+			$paged_groups = BP_Groups_Group::get_group_extras( &$paged_groups, $group_ids, 'newest' );
+		}
+
+		return array( 'groups' => $paged_groups, 'total' => $total_groups );
+	}
+
+	function get_group_extras( $paged_groups, $group_ids, $type = false ) {
+		global $bp, $wpdb;
+
+		if ( empty( $group_ids ) )
+			return $paged_groups;
+
+		/* Fetch the logged in users status within each group */
+		$user_status = $wpdb->get_col( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id IN ( {$group_ids} ) AND is_confirmed = 1 AND is_banned = 0", $bp->loggedin_user->id ) );
+		for ( $i = 0; $i < count( $paged_groups ); $i++ ) {
+			foreach ( (array)$user_status as $group_id ) {
+				if ( $group_id == $paged_groups[$i]->id )
+					$paged_groups[$i]->is_member = true;
+			}
+		}
+
+		$user_banned = $wpdb->get_col( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_members} WHERE is_banned = 1 AND user_id = %d AND group_id IN ( {$group_ids} )", $bp->loggedin_user->id ) );
+		for ( $i = 0; $i < count( $paged_groups ); $i++ ) {
+			foreach ( (array)$user_banned as $group_id ) {
+				if ( $group_id == $paged_groups[$i]->id )
+					$paged_groups[$i]->is_banned = true;
+			}
+		}
+
+		return $paged_groups;
+	}
+
+	function delete_all_invites( $group_id ) {
+		global $wpdb, $bp;
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE group_id = %d AND invite_sent = 1", $group_id ) );
+	}
+
+	function get_total_group_count() {
+		global $wpdb, $bp;
+
+		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}" ) );
+	}
+
+	function get_global_forum_topic_count( $type ) {
+		global $bbdb, $wpdb, $bp;
+
+		if ( 'unreplied' == $type )
+			$bp->groups->filter_sql = ' AND t.topic_posts = 1';
+
+		$extra_sql = apply_filters( 'groups_total_public_forum_topic_count', $bp->groups->filter_sql, $type );
+
+		return $wpdb->get_var( "SELECT COUNT(t.topic_id) FROM {$bbdb->topics} AS t, {$bp->groups->table_name} AS g LEFT JOIN {$bp->groups->table_name_groupmeta} AS gm ON g.id = gm.group_id WHERE (gm.meta_key = 'forum_id' AND gm.meta_value = t.forum_id) AND g.status = 'public' AND t.topic_status = '0' AND t.topic_sticky != '2' {$extra_sql} " );
+	}
+
+	function get_total_member_count( $group_id ) {
+		global $wpdb, $bp;
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0", $group_id ) );
+	}
+}
+
+Class BP_Groups_Member {
+	var $id;
+	var $group_id;
+	var $user_id;
+	var $inviter_id;
+	var $is_admin;
+	var $is_mod;
+	var $is_banned;
+	var $user_title;
+	var $date_modified;
+	var $is_confirmed;
+	var $comments;
+	var $invite_sent;
+
+	var $user;
+
+	function bp_groups_member( $user_id = false, $group_id = false, $id = false, $populate = true ) {
+		if ( $user_id && $group_id && !$id ) {
+			$this->user_id = $user_id;
+			$this->group_id = $group_id;
+
+			if ( $populate )
+				$this->populate();
+		}
+
+		if ( $id ) {
+			$this->id = $id;
+
+			if ( $populate )
+				$this->populate();
+		}
+	}
+
+	function populate() {
+		global $wpdb, $bp;
+
+		if ( $this->user_id && $this->group_id && !$this->id )
+			$sql = $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $this->user_id, $this->group_id );
+
+		if ( $this->id )
+			$sql = $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name_members} WHERE id = %d", $this->id );
+
+		$member = $wpdb->get_row($sql);
+
+		if ( $member ) {
+			$this->id = $member->id;
+			$this->group_id = $member->group_id;
+			$this->user_id = $member->user_id;
+			$this->inviter_id = $member->inviter_id;
+			$this->is_admin = $member->is_admin;
+			$this->is_mod = $member->is_mod;
+			$this->is_banned = $member->is_banned;
+			$this->user_title = $member->user_title;
+			$this->date_modified = $member->date_modified;
+			$this->is_confirmed = $member->is_confirmed;
+			$this->comments = $member->comments;
+			$this->invite_sent = $member->invite_sent;
+
+			$this->user = new BP_Core_User( $this->user_id );
+		}
+	}
+
+	function save() {
+		global $wpdb, $bp;
+
+		$this->user_id = apply_filters( 'groups_member_user_id_before_save', $this->user_id, $this->id );
+		$this->group_id = apply_filters( 'groups_member_group_id_before_save', $this->group_id, $this->id );
+		$this->inviter_id = apply_filters( 'groups_member_inviter_id_before_save', $this->inviter_id, $this->id );
+		$this->is_admin = apply_filters( 'groups_member_is_admin_before_save', $this->is_admin, $this->id );
+		$this->is_mod = apply_filters( 'groups_member_is_mod_before_save', $this->is_mod, $this->id );
+		$this->is_banned = apply_filters( 'groups_member_is_banned_before_save', $this->is_banned, $this->id );
+		$this->user_title = apply_filters( 'groups_member_user_title_before_save', $this->user_title, $this->id );
+		$this->date_modified = apply_filters( 'groups_member_date_modified_before_save', $this->date_modified, $this->id );
+		$this->is_confirmed = apply_filters( 'groups_member_is_confirmed_before_save', $this->is_confirmed, $this->id );
+		$this->comments = apply_filters( 'groups_member_comments_before_save', $this->comments, $this->id );
+		$this->invite_sent = apply_filters( 'groups_member_invite_sent_before_save', $this->invite_sent, $this->id );
+
+		do_action( 'groups_member_before_save', $this );
+
+		if ( $this->id ) {
+			$sql = $wpdb->prepare( "UPDATE {$bp->groups->table_name_members} SET inviter_id = %d, is_admin = %d, is_mod = %d, is_banned = %d, user_title = %s, date_modified = %s, is_confirmed = %d, comments = %s, invite_sent = %d WHERE id = %d", $this->inviter_id, $this->is_admin, $this->is_mod, $this->is_banned, $this->user_title, $this->date_modified, $this->is_confirmed, $this->comments, $this->invite_sent, $this->id );
+		} else {
+			$sql = $wpdb->prepare( "INSERT INTO {$bp->groups->table_name_members} ( user_id, group_id, inviter_id, is_admin, is_mod, is_banned, user_title, date_modified, is_confirmed, comments, invite_sent ) VALUES ( %d, %d, %d, %d, %d, %d, %s, %s, %d, %s, %d )", $this->user_id, $this->group_id, $this->inviter_id, $this->is_admin, $this->is_mod, $this->is_banned, $this->user_title, $this->date_modified, $this->is_confirmed, $this->comments, $this->invite_sent );
+		}
+
+		if ( !$wpdb->query($sql) )
+			return false;
+
+		$this->id = $wpdb->insert_id;
+
+		do_action( 'groups_member_after_save', $this );
+
+		return true;
+	}
+
+	function promote( $status = 'mod' ) {
+		if ( 'mod' == $status ) {
+			$this->is_admin = 0;
+			$this->is_mod = 1;
+			$this->user_title = __( 'Group Mod', 'buddypress' );
+		}
+
+		if ( 'admin' == $status ) {
+			$this->is_admin = 1;
+			$this->is_mod = 0;
+			$this->user_title = __( 'Group Admin', 'buddypress' );
+		}
+
+		return $this->save();
+	}
+
+	function demote() {
+		$this->is_mod = 0;
+		$this->is_admin = 0;
+		$this->user_title = false;
+
+		return $this->save();
+	}
+
+	function ban() {
+		if ( $this->is_admin )
+			return false;
+
+		$this->is_mod = 0;
+		$this->is_banned = 1;
+
+		groups_update_groupmeta( $this->group_id, 'total_member_count', ( (int) groups_get_groupmeta( $this->group_id, 'total_member_count' ) - 1 ) );
+
+		$group_count = get_user_meta( $this->user_id, 'total_group_count', true );
+		if ( !empty( $group_count ) )
+			update_user_meta( $this->user_id, 'total_group_count', (int)$group_count - 1 );
+
+		return $this->save();
+	}
+
+	function unban() {
+		if ( $this->is_admin )
+			return false;
+
+		$this->is_banned = 0;
+
+		groups_update_groupmeta( $this->group_id, 'total_member_count', ( (int) groups_get_groupmeta( $this->group_id, 'total_member_count' ) + 1 ) );
+		update_user_meta( $this->user_id, 'total_group_count', (int)get_user_meta( $this->user_id, 'total_group_count', true ) + 1 );
+
+		return $this->save();
+	}
+
+	function accept_invite() {
+		$this->inviter_id    = 0;
+		$this->is_confirmed  = 1;
+		$this->date_modified = bp_core_current_time();
+
+		update_user_meta( $this->user_id, 'total_group_count', (int)get_user_meta( $this->user_id, 'total_group_count', true ) + 1 );
+	}
+
+	function accept_request() {
+		$this->is_confirmed = 1;
+		$this->date_modified = bp_core_current_time();
+
+		update_user_meta( $this->user_id, 'total_group_count', (int)get_user_meta( $this->user_id, 'total_group_count', true ) + 1 );
+	}
+
+	function remove() {
+		global $wpdb, $bp;
+
+		$sql = $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $this->user_id, $this->group_id );
+
+		if ( !$result = $wpdb->query( $sql ) )
+			return false;
+
+		groups_update_groupmeta( $this->group_id, 'total_member_count', ( (int) groups_get_groupmeta( $this->group_id, 'total_member_count' ) - 1 ) );
+
+		$group_count = get_user_meta( $this->user_id, 'total_group_count', true );
+		if ( !empty( $group_count ) )
+			update_user_meta( $this->user_id, 'total_group_count', (int)$group_count - 1 );
+
+		return $result;
+	}
+
+	/* Static Functions */
+
+	function delete( $user_id, $group_id ) {
+		global $wpdb, $bp;
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $user_id, $group_id ) );
+	}
+
+	function get_group_ids( $user_id, $limit = false, $page = false ) {
+		global $wpdb, $bp;
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		// If the user is logged in and viewing their own groups, we can show hidden and private groups
+		if ( $user_id != $bp->loggedin_user->id ) {
+			$group_sql = $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE g.status != 'hidden' AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0{$pag_sql}", $user_id );
+			$total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE g.status != 'hidden' AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0", $user_id ) );
+		} else {
+			$group_sql = $wpdb->prepare( "SELECT DISTINCT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND is_confirmed = 1 AND is_banned = 0{$pag_sql}", $user_id );
+			$total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT group_id) FROM {$bp->groups->table_name_members} WHERE user_id = %d AND is_confirmed = 1 AND is_banned = 0", $user_id ) );
+		}
+
+		$groups = $wpdb->get_col( $group_sql );
+
+		return array( 'groups' => $groups, 'total' => (int) $total_groups );
+	}
+
+	function get_recently_joined( $user_id, $limit = false, $page = false, $filter = false ) {
+		global $wpdb, $bp;
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		if ( $filter ) {
+			$filter = like_escape( $wpdb->escape( $filter ) );
+			$filter_sql = " AND ( g.name LIKE '%%{$filter}%%' OR g.description LIKE '%%{$filter}%%' )";
+		}
+
+		if ( $user_id != $bp->loggedin_user->id )
+			$hidden_sql = " AND g.status != 'hidden'";
+
+		$paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE g.id = m.group_id AND g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count'{$hidden_sql}{$filter_sql} AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0 ORDER BY m.date_modified DESC {$pag_sql}", $user_id ) );
+		$total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id{$hidden_sql}{$filter_sql} AND m.user_id = %d AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY m.date_modified DESC", $user_id ) );
+
+		return array( 'groups' => $paged_groups, 'total' => $total_groups );
+	}
+
+	function get_is_admin_of( $user_id, $limit = false, $page = false, $filter = false ) {
+		global $wpdb, $bp;
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		if ( $filter ) {
+			$filter = like_escape( $wpdb->escape( $filter ) );
+			$filter_sql = " AND ( g.name LIKE '%%{$filter}%%' OR g.description LIKE '%%{$filter}%%' )";
+		}
+
+		if ( $user_id != $bp->loggedin_user->id )
+			$hidden_sql = " AND g.status != 'hidden'";
+
+		$paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE g.id = m.group_id AND g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count'{$hidden_sql}{$filter_sql} AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0 AND m.is_admin = 1 ORDER BY m.date_modified ASC {$pag_sql}", $user_id ) );
+		$total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id{$hidden_sql}{$filter_sql} AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0 AND m.is_admin = 1 ORDER BY date_modified ASC", $user_id ) );
+
+		return array( 'groups' => $paged_groups, 'total' => $total_groups );
+	}
+
+	function get_is_mod_of( $user_id, $limit = false, $page = false, $filter = false ) {
+		global $wpdb, $bp;
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		if ( $filter ) {
+			$filter = like_escape( $wpdb->escape( $filter ) );
+			$filter_sql = " AND ( g.name LIKE '%%{$filter}%%' OR g.description LIKE '%%{$filter}%%' )";
+		}
+
+		if ( $user_id != $bp->loggedin_user->id )
+			$hidden_sql = " AND g.status != 'hidden'";
+
+		$paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE g.id = m.group_id AND g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count'{$hidden_sql}{$filter_sql} AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0 AND m.is_mod = 1 ORDER BY m.date_modified ASC {$pag_sql}", $user_id ) );
+		$total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id{$hidden_sql}{$filter_sql} AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0 AND m.is_mod = 1 ORDER BY date_modified ASC", $user_id ) );
+
+		return array( 'groups' => $paged_groups, 'total' => $total_groups );
+	}
+
+	function total_group_count( $user_id = false ) {
+		global $bp, $wpdb;
+
+		if ( !$user_id )
+			$user_id = $bp->displayed_user->id;
+
+		if ( $user_id != $bp->loggedin_user->id && !is_super_admin() ) {
+			return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0", $user_id ) );
+		} else {
+			return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0", $user_id ) );
+		}
+	}
+
+	function get_invites( $user_id, $limit = false, $page = false ) {
+		global $wpdb, $bp;
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		$paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE g.id = m.group_id AND g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND m.is_confirmed = 0 AND m.inviter_id != 0 AND m.invite_sent = 1 AND m.user_id = %d ORDER BY m.date_modified ASC {$pag_sql}", $user_id ) );
+		$total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND m.is_confirmed = 0 AND m.inviter_id != 0 AND m.invite_sent = 1 AND m.user_id = %d ORDER BY date_modified ASC", $user_id ) );
+
+		return array( 'groups' => $paged_groups, 'total' => $total_groups );
+	}
+
+	function check_has_invite( $user_id, $group_id ) {
+		global $wpdb, $bp;
+
+		if ( !$user_id )
+			return false;
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id, $group_id ) );
+	}
+
+	function delete_invite( $user_id, $group_id ) {
+		global $wpdb, $bp;
+
+		if ( !$user_id )
+			return false;
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id, $group_id ) );
+	}
+
+	function delete_request( $user_id, $group_id ) {
+		global $wpdb, $bp;
+
+		if ( !$user_id )
+			return false;
+
+ 		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id = 0 AND invite_sent = 0", $user_id, $group_id ) );
+	}
+
+	function check_is_admin( $user_id, $group_id ) {
+		global $wpdb, $bp;
+
+		if ( !$user_id )
+			return false;
+
+		return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_admin = 1 AND is_banned = 0", $user_id, $group_id ) );
+	}
+
+	function check_is_mod( $user_id, $group_id ) {
+		global $wpdb, $bp;
+
+		if ( !$user_id )
+			return false;
+
+		return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_mod = 1 AND is_banned = 0", $user_id, $group_id ) );
+	}
+
+	function check_is_member( $user_id, $group_id ) {
+		global $wpdb, $bp;
+
+		if ( !$user_id )
+			return false;
+
+		return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 1 AND is_banned = 0", $user_id, $group_id ) );
+	}
+
+	function check_is_banned( $user_id, $group_id ) {
+		global $wpdb, $bp;
+
+		if ( !$user_id )
+			return false;
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT is_banned FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $user_id, $group_id ) );
+	}
+
+	/**
+	 * Is the specified user the creator of the group?
+	 *
+	 * @global object $bp BuddyPress global settings
+	 * @global wpdb $wpdb WordPress database object
+	 * @param int $user_id
+	 * @param int $group_id
+	 * @since 1.2.6
+	 */
+	function check_is_creator( $user_id, $group_id ) {
+		global $bp, $wpdb;
+
+		if ( !$user_id )
+			return false;
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name} WHERE creator_id = %d AND id = %d", $user_id, $group_id ) );
+	}
+
+	function check_for_membership_request( $user_id, $group_id ) {
+		global $wpdb, $bp;
+
+		if ( !$user_id )
+			return false;
+
+		return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND is_banned = 0 AND inviter_id = 0", $user_id, $group_id ) );
+	}
+
+	function get_random_groups( $user_id, $total_groups = 5 ) {
+		global $wpdb, $bp;
+
+		// If the user is logged in and viewing their random groups, we can show hidden and private groups
+		if ( bp_is_my_profile() ) {
+			return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND is_confirmed = 1 AND is_banned = 0 ORDER BY rand() LIMIT $total_groups", $user_id ) );
+		} else {
+			return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0 ORDER BY rand() LIMIT $total_groups", $user_id ) );
+		}
+	}
+
+	function get_group_member_ids( $group_id ) {
+		global $bp, $wpdb;
+
+		return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0", $group_id ) );
+	}
+
+	function get_group_administrator_ids( $group_id ) {
+		global $bp, $wpdb;
+
+		return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_admin = 1 AND is_banned = 0", $group_id ) );
+	}
+
+	function get_group_moderator_ids( $group_id ) {
+		global $bp, $wpdb;
+
+		return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_mod = 1 AND is_banned = 0", $group_id ) );
+	}
+
+	function get_all_membership_request_user_ids( $group_id ) {
+		global $bp, $wpdb;
+
+		return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0 AND inviter_id = 0", $group_id ) );
+	}
+
+	function get_all_for_group( $group_id, $limit = false, $page = false, $exclude_admins_mods = true, $exclude_banned = true ) {
+		global $bp, $wpdb;
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		if ( $exclude_admins_mods )
+			$exclude_sql = $wpdb->prepare( "AND is_admin = 0 AND is_mod = 0" );
+
+		if ( $exclude_banned )
+			$banned_sql = $wpdb->prepare( " AND is_banned = 0" );
+
+		if ( bp_is_active( 'xprofile' ) )
+			$members = $wpdb->get_results( $wpdb->prepare( "SELECT m.user_id, m.date_modified, m.is_banned, u.user_login, u.user_nicename, u.user_email, pd.value as display_name FROM {$bp->groups->table_name_members} m, {$wpdb->users} u, {$bp->profile->table_name_data} pd WHERE u.ID = m.user_id AND u.ID = pd.user_id AND pd.field_id = 1 AND group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql} ORDER BY m.date_modified DESC {$pag_sql}", $group_id ) );
+		else
+			$members = $wpdb->get_results( $wpdb->prepare( "SELECT m.user_id, m.date_modified, m.is_banned, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$bp->groups->table_name_members} m, {$wpdb->users} u WHERE u.ID = m.user_id AND group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql} ORDER BY m.date_modified DESC {$pag_sql}", $group_id ) );
+
+		if ( !$members )
+			return false;
+
+		if ( !isset($pag_sql) )
+			$total_member_count = count($members);
+		else
+			$total_member_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(user_id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql}", $group_id ) );
+
+		/* Fetch whether or not the user is a friend */
+		foreach ( (array)$members as $user ) $user_ids[] = $user->user_id;
+		$user_ids = $wpdb->escape( join( ',', (array)$user_ids ) );
+
+		if ( function_exists( 'friends_install' ) ) {
+			$friend_status = $wpdb->get_results( $wpdb->prepare( "SELECT initiator_user_id, friend_user_id, is_confirmed FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d AND friend_user_id IN ( {$user_ids} ) ) OR (initiator_user_id IN ( {$user_ids} ) AND friend_user_id = %d )", $bp->loggedin_user->id, $bp->loggedin_user->id ) );
+			for ( $i = 0; $i < count( $members ); $i++ ) {
+				foreach ( (array)$friend_status as $status ) {
+					if ( $status->initiator_user_id == $members[$i]->user_id || $status->friend_user_id == $members[$i]->user_id )
+						$members[$i]->is_friend = $status->is_confirmed;
+				}
+			}
+		}
+
+		return array( 'members' => $members, 'count' => $total_member_count );
+	}
+
+	function delete_all( $group_id ) {
+		global $wpdb, $bp;
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE group_id = %d", $group_id ) );
+	}
+
+	/**
+	 * Delete all group membership information for the specified user
+	 *
+	 * @global object $bp BuddyPress global settings
+	 * @global wpdb $wpdb WordPress database object
+	 * @param int $user_id
+	 * @since 1.0
+	 * @uses BP_Groups_Member
+	 */
+	function delete_all_for_user( $user_id ) {
+		global $bp, $wpdb;
+
+		// Get all the group ids for the current user's groups and update counts
+		$group_ids = BP_Groups_Member::get_group_ids( $user_id );
+		foreach ( $group_ids['groups'] as $group_id ) {
+			groups_update_groupmeta( $group_id, 'total_member_count', groups_get_total_member_count( $group_id ) - 1 );
+
+			// If current user is the creator of a group and is the sole admin, delete that group to avoid counts going out-of-sync
+			if ( groups_is_user_admin( $user_id, $group_id ) && count( groups_get_group_admins( $group_id ) ) < 2 && groups_is_user_creator( $user_id, $group_id ) )
+				groups_delete_group( $group_id );
+		}
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d", $user_id ) );
+	}
+}
+
+/**
+ * API for creating group extensions without having to hardcode the content into
+ * the theme.
+ *
+ * This class must be extended for each group extension and the following methods overridden:
+ *
+ * BP_Group_Extension::widget_display(), BP_Group_Extension::display(),
+ * BP_Group_Extension::edit_screen_save(), BP_Group_Extension::edit_screen(),
+ * BP_Group_Extension::create_screen_save(), BP_Group_Extension::create_screen()
+ *
+ * @package BuddyPress
+ * @subpackage Groups
+ * @since 1.1
+ */
+class BP_Group_Extension {
+	var $name = false;
+	var $slug = false;
+
+	/* Will this extension be visible to non-members of a group? Options: public/private */
+	var $visibility = 'public';
+
+	var $create_step_position = 81;
+	var $nav_item_position = 81;
+
+	var $enable_create_step = true;
+	var $enable_nav_item = true;
+	var $enable_edit_item = true;
+
+	var $nav_item_name = false;
+
+	var $display_hook = 'groups_custom_group_boxes';
+	var $template_file = 'groups/single/plugins';
+
+	// Methods you should override
+
+	function display() {
+		die( 'function BP_Group_Extension::display() must be over-ridden in a sub-class.' );
+	}
+
+	function widget_display() {
+		die( 'function BP_Group_Extension::widget_display() must be over-ridden in a sub-class.' );
+	}
+
+	function edit_screen() {
+		die( 'function BP_Group_Extension::edit_screen() must be over-ridden in a sub-class.' );
+	}
+
+	function edit_screen_save() {
+		die( 'function BP_Group_Extension::edit_screen_save() must be over-ridden in a sub-class.' );
+	}
+
+	function create_screen() {
+		die( 'function BP_Group_Extension::create_screen() must be over-ridden in a sub-class.' );
+	}
+
+	function create_screen_save() {
+		die( 'function BP_Group_Extension::create_screen_save() must be over-ridden in a sub-class.' );
+	}
+
+	// Private Methods
+
+	function _register() {
+		global $bp;
+
+		if ( $this->enable_create_step ) {
+			// Insert the group creation step for the new group extension
+			$bp->groups->group_creation_steps[$this->slug] = array( 'name' => $this->name, 'slug' => $this->slug, 'position' => $this->create_step_position );
+
+			// Attach the group creation step display content action
+			add_action( 'groups_custom_create_steps', array( &$this, 'create_screen' ) );
+
+			// Attach the group creation step save content action
+			add_action( 'groups_create_group_step_save_' . $this->slug, array( &$this, 'create_screen_save' ) );
+		}
+
+		// Construct the admin edit tab for the new group extension
+		if ( $this->enable_edit_item ) {
+			add_action( 'groups_admin_tabs', create_function( '$current, $group_slug', 'if ( "' . esc_attr( $this->slug ) . '" == $current ) $selected = " class=\"current\""; echo "<li{$selected}><a href=\"' . $bp->root_domain . '/' . $bp->groups->slug . '/{$group_slug}/admin/' . esc_attr( $this->slug ) . '\">' . esc_attr( $this->name ) . '</a></li>";' ), 10, 2 );
+
+			// Make sure user has access
+			if ( !$bp->is_item_admin )
+				return false;
+
+			// Catch the edit screen and forward it to the plugin template
+			if ( $bp->current_component == $bp->groups->slug && 'admin' == $bp->current_action && $this->slug == $bp->action_variables[0] ) {
+				add_action( 'wp', array( &$this, 'edit_screen_save' ) );
+				add_action( 'groups_custom_edit_steps', array( &$this, 'edit_screen' ) );
+
+				if ( '' != locate_template( array( 'groups/single/home.php' ), false ) ) {
+					bp_core_load_template( apply_filters( 'groups_template_group_home', 'groups/single/home' ) );
+				} else {
+					add_action( 'bp_template_content_header', create_function( '', 'echo "<ul class=\"content-header-nav\">"; bp_group_admin_tabs(); echo "</ul>";' ) );
+					add_action( 'bp_template_content', array( &$this, 'edit_screen' ) );
+					bp_core_load_template( apply_filters( 'bp_core_template_plugin', '/groups/single/plugins' ) );
+				}
+			}
+		}
+
+		// When we are viewing a single group, add the group extension nav item
+		if ( $this->visibility == 'public' || ( $this->visibility != 'public' && $bp->groups->current_group->user_has_access ) ) {
+			if ( $this->enable_nav_item ) {
+				if ( $bp->current_component == $bp->groups->slug && $bp->is_single_item )
+					bp_core_new_subnav_item( array( 'name' => ( !$this->nav_item_name ) ? $this->name : $this->nav_item_name, 'slug' => $this->slug, 'parent_slug' => BP_GROUPS_SLUG, 'parent_url' => bp_get_group_permalink( $bp->groups->current_group ), 'position' => $this->nav_item_position, 'item_css_id' => 'nav-' . $this->slug, 'screen_function' => array( &$this, '_display_hook' ), 'user_has_access' => $this->enable_nav_item ) );
+
+				// When we are viewing the extension display page, set the title and options title
+				if ( $bp->current_component == $bp->groups->slug && $bp->is_single_item && $bp->current_action == $this->slug ) {
+					add_action( 'bp_template_content_header', create_function( '', 'echo "' . esc_attr( $this->name ) . '";' ) );
+			 		add_action( 'bp_template_title', create_function( '', 'echo "' . esc_attr( $this->name ) . '";' ) );
+				}
+			}
+
+			// Hook the group home widget
+			if ( $bp->current_component == $bp->groups->slug && $bp->is_single_item && ( !$bp->current_action || 'home' == $bp->current_action ) )
+				add_action( $this->display_hook, array( &$this, 'widget_display' ) );
+		}
+	}
+
+	function _display_hook() {
+		add_action( 'bp_template_content', array( &$this, 'display' ) );
+		bp_core_load_template( apply_filters( 'bp_core_template_plugin', $this->template_file ) );
+	}
+}
+
+function bp_register_group_extension( $group_extension_class ) {
+	global $bp;
+
+	if ( !class_exists( $group_extension_class ) )
+		return false;
+
+	/* Register the group extension on the bp_init action so we have access to all plugins */
+	add_action( 'bp_init', create_function( '', '$extension = new ' . $group_extension_class . '; add_action( "wp", array( &$extension, "_register" ), 2 );' ), 11 );
+}
+
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-groups/bp-groups-filters.php b/wp-content/plugins/buddypress/bp-groups/bp-groups-filters.php
new file mode 100644
index 0000000000000000000000000000000000000000..9c60f3ce4ab140de2e46940dbe5ea084ba7ad050
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-groups/bp-groups-filters.php
@@ -0,0 +1,108 @@
+<?php
+
+/* Apply WordPress defined filters */
+add_filter( 'bp_get_group_description', 'wptexturize' );
+add_filter( 'bp_get_group_description_excerpt', 'wptexturize' );
+add_filter( 'bp_get_group_name', 'wptexturize' );
+
+add_filter( 'bp_get_group_description', 'convert_smilies' );
+add_filter( 'bp_get_group_description_excerpt', 'convert_smilies' );
+
+add_filter( 'bp_get_group_description', 'convert_chars' );
+add_filter( 'bp_get_group_description_excerpt', 'convert_chars' );
+add_filter( 'bp_get_group_name', 'convert_chars' );
+
+add_filter( 'bp_get_group_description', 'wpautop' );
+add_filter( 'bp_get_group_description_excerpt', 'wpautop' );
+
+add_filter( 'bp_get_group_description', 'make_clickable' );
+add_filter( 'bp_get_group_description_excerpt', 'make_clickable' );
+
+add_filter( 'bp_get_group_name', 'wp_filter_kses', 1 );
+add_filter( 'bp_get_group_permalink', 'wp_filter_kses', 1 );
+add_filter( 'bp_get_group_description', 'bp_groups_filter_kses', 1 );
+add_filter( 'bp_get_group_description_excerpt', 'wp_filter_kses', 1 );
+add_filter( 'groups_group_name_before_save', 'wp_filter_kses', 1 );
+add_filter( 'groups_group_description_before_save', 'wp_filter_kses', 1 );
+
+add_filter( 'bp_get_group_description', 'stripslashes' );
+add_filter( 'bp_get_group_description_excerpt', 'stripslashes' );
+add_filter( 'bp_get_group_name', 'stripslashes' );
+add_filter( 'bp_get_group_member_name', 'stripslashes' );
+add_filter( 'bp_get_group_member_link', 'stripslashes' );
+
+add_filter( 'groups_new_group_forum_desc', 'bp_create_excerpt' );
+
+add_filter( 'groups_group_name_before_save', 'force_balance_tags' );
+add_filter( 'groups_group_description_before_save', 'force_balance_tags' );
+
+add_filter( 'bp_get_total_group_count', 'bp_core_number_format' );
+add_filter( 'bp_get_group_total_for_member', 'bp_core_number_format' );
+add_filter( 'bp_get_group_total_members', 'bp_core_number_format' );
+
+function bp_groups_filter_kses( $content ) {
+	global $allowedtags;
+
+	$groups_allowedtags = $allowedtags;
+	$groups_allowedtags['a']['class'] = array();
+	$groups_allowedtags['img'] = array();
+	$groups_allowedtags['img']['src'] = array();
+	$groups_allowedtags['img']['alt'] = array();
+	$groups_allowedtags['img']['class'] = array();
+	$groups_allowedtags['img']['width'] = array();
+	$groups_allowedtags['img']['height'] = array();
+	$groups_allowedtags['img']['class'] = array();
+	$groups_allowedtags['img']['id'] = array();
+	$groups_allowedtags['code'] = array();
+
+	$groups_allowedtags = apply_filters( 'bp_groups_filter_kses', $groups_allowedtags );
+	return wp_kses( $content, $groups_allowedtags );
+}
+
+/**** Filters for group forums ****/
+
+function groups_add_forum_privacy_sql() {
+	global $bp;
+
+	/* Only filter the forum SQL on group pages or on the forums directory */
+	if ( ( $bp->groups->current_group && 'public' == $bp->groups->current_group->status ) || !$bp->groups->current_group ) {
+		add_filter( 'get_topics_fields', 'groups_add_forum_fields_sql' );
+		add_filter( 'get_topics_index_hint', 'groups_add_forum_tables_sql' );
+		add_filter( 'get_topics_where', 'groups_add_forum_where_sql' );
+	}
+}
+add_filter( 'bbpress_init', 'groups_add_forum_privacy_sql' );
+
+function groups_add_forum_fields_sql( $sql ) {
+	return $sql . ', g.id as object_id, g.name as object_name, g.slug as object_slug';
+}
+
+function groups_add_forum_tables_sql( $sql ) {
+	global $bp;
+	return ', ' . $bp->groups->table_name . ' AS g LEFT JOIN ' . $bp->groups->table_name_groupmeta . ' AS gm ON g.id = gm.group_id ';
+}
+
+function groups_add_forum_where_sql( $sql ) {
+	global $bp;
+
+	$bp->groups->filter_sql = ' AND ' . $sql;
+	return "(gm.meta_key = 'forum_id' AND gm.meta_value = t.forum_id) AND g.status = 'public' AND " . $sql;
+}
+
+function groups_filter_bbpress_caps( $value, $cap, $args ) {
+	global $bp;
+
+	if ( is_super_admin() )
+		return true;
+
+	if ( 'add_tag_to' == $cap )
+		if ( $bp->groups->current_group->user_has_access ) return true;
+
+	if ( 'manage_forums' == $cap && is_user_logged_in() )
+		return true;
+
+	return $value;
+}
+add_filter( 'bb_current_user_can', 'groups_filter_bbpress_caps', 10, 3 );
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-groups/bp-groups-notifications.php b/wp-content/plugins/buddypress/bp-groups/bp-groups-notifications.php
new file mode 100644
index 0000000000000000000000000000000000000000..cdebf5ab060a9e285528e8a6ad600ddc492f2b9e
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-groups/bp-groups-notifications.php
@@ -0,0 +1,303 @@
+<?php
+
+function groups_notification_group_updated( $group_id ) {
+	global $bp;
+
+	$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_user_meta( $user_id, 'notification_groups_group_updated', true ) ) continue;
+
+		$ud = bp_core_get_core_userdata( $user_id );
+
+		// Set up and send the message
+		$to = $ud->user_email;
+
+		$group_link = site_url( $bp->groups->slug . '/' . $group->slug );
+		$settings_link = bp_core_get_user_domain( $user_id ) .  BP_SETTINGS_SLUG . '/notifications/';
+
+		$message = sprintf( __(
+'Group details for the group "%s" were updated:
+
+To view the group: %s
+
+---------------------
+', 'buddypress' ), $group->name, $group_link );
+
+		$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
+
+		/* Send the message */
+		$to = apply_filters( 'groups_notification_group_updated_to', $to );
+		$subject = apply_filters( 'groups_notification_group_updated_subject', $subject, &$group );
+		$message = apply_filters( 'groups_notification_group_updated_message', $message, &$group, $group_link );
+
+		wp_mail( $to, $subject, $message );
+
+		unset( $message, $to );
+	}
+}
+
+function groups_notification_new_membership_request( $requesting_user_id, $admin_id, $group_id, $membership_id ) {
+	global $bp;
+
+	bp_core_add_notification( $requesting_user_id, $admin_id, 'groups', 'new_membership_request', $group_id );
+
+	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 );
+	$group = new BP_Groups_Group( $group_id );
+
+	$ud = bp_core_get_core_userdata($admin_id);
+	$requesting_ud = bp_core_get_core_userdata($requesting_user_id);
+
+	$group_requests = bp_get_group_permalink( $group ) . 'admin/membership-requests';
+	$profile_link = bp_core_get_user_domain( $requesting_user_id );
+	$settings_link = bp_core_get_user_domain( $requesting_user_id ) .  BP_SETTINGS_SLUG . '/notifications/';
+
+	// Set up and send the message
+	$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( __(
+'%s wants to join the group "%s".
+
+Because you are the administrator of this group, you must either accept or reject the membership request.
+
+To view all pending membership requests for this group, please visit:
+%s
+
+To view %s\'s profile: %s
+
+---------------------
+', 'buddypress' ), $requesting_user_name, $group->name, $group_requests, $requesting_user_name, $profile_link );
+
+	$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
+
+	/* Send the message */
+	$to = apply_filters( 'groups_notification_new_membership_request_to', $to );
+	$subject = apply_filters( 'groups_notification_new_membership_request_subject', $subject, &$group );
+	$message = apply_filters( 'groups_notification_new_membership_request_message', $message, &$group, $requesting_user_name, $profile_link, $group_requests );
+
+	wp_mail( $to, $subject, $message );
+}
+
+function groups_notification_membership_request_completed( $requesting_user_id, $group_id, $accepted = true ) {
+	global $bp;
+
+	// Post a screen notification first.
+	if ( $accepted )
+		bp_core_add_notification( $group_id, $requesting_user_id, 'groups', 'membership_request_accepted' );
+	else
+		bp_core_add_notification( $group_id, $requesting_user_id, 'groups', 'membership_request_rejected' );
+
+	if ( 'no' == get_user_meta( $requesting_user_id, 'notification_membership_request_completed', true ) )
+		return false;
+
+	$group = new BP_Groups_Group( $group_id );
+
+	$ud = bp_core_get_core_userdata($requesting_user_id);
+
+	$group_link = bp_get_group_permalink( $group );
+	$settings_link = bp_core_get_user_domain( $requesting_user_id ) .  BP_SETTINGS_SLUG . '/notifications/';
+
+	// Set up and send the message
+	$to       = $ud->user_email;
+	$sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
+
+	if ( $accepted ) {
+		$subject  = '[' . $sitename . '] ' . sprintf( __( 'Membership request for group "%s" accepted', 'buddypress' ), $group->name );
+		$message  = sprintf( __(
+'Your membership request for the group "%s" has been accepted.
+
+To view the group please login and visit: %s
+
+---------------------
+', 'buddypress' ), $group->name, $group_link );
+
+	} else {
+		$subject = '[' . $sitename . '] ' . sprintf( __( 'Membership request for group "%s" rejected', 'buddypress' ), $group->name );
+		$message = sprintf( __(
+'Your membership request for the group "%s" has been rejected.
+
+To submit another request please log in and visit: %s
+
+---------------------
+', 'buddypress' ), $group->name, $group_link );
+	}
+
+	$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
+
+	/* Send the message */
+	$to = apply_filters( 'groups_notification_membership_request_completed_to', $to );
+	$subject = apply_filters( 'groups_notification_membership_request_completed_subject', $subject, &$group );
+	$message = apply_filters( 'groups_notification_membership_request_completed_message', $message, &$group, $group_link  );
+
+	wp_mail( $to, $subject, $message );
+}
+
+function groups_notification_promoted_member( $user_id, $group_id ) {
+	global $bp;
+
+	if ( groups_is_user_admin( $user_id, $group_id ) ) {
+		$promoted_to = __( 'an administrator', 'buddypress' );
+		$type = 'member_promoted_to_admin';
+	} else {
+		$promoted_to = __( 'a moderator', 'buddypress' );
+		$type = 'member_promoted_to_mod';
+	}
+
+	// Post a screen notification first.
+	bp_core_add_notification( $group_id, $user_id, 'groups', $type );
+
+	if ( 'no' == get_user_meta( $user_id, 'notification_groups_admin_promotion', true ) )
+		return false;
+
+	$group = new BP_Groups_Group( $group_id );
+	$ud = bp_core_get_core_userdata($user_id);
+
+	$group_link = bp_get_group_permalink( $group );
+	$settings_link = bp_core_get_user_domain( $user_id ) .  BP_SETTINGS_SLUG . '/notifications/';
+
+	// Set up and send the message
+	$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 );
+
+	$message = sprintf( __(
+'You have been promoted to %s for the group: "%s".
+
+To view the group please visit: %s
+
+---------------------
+', 'buddypress' ), $promoted_to, $group->name, $group_link );
+
+	$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
+
+	/* Send the message */
+	$to = apply_filters( 'groups_notification_promoted_member_to', $to );
+	$subject = apply_filters( 'groups_notification_promoted_member_subject', $subject, &$group );
+	$message = apply_filters( 'groups_notification_promoted_member_message', $message, &$group, $promoted_to, $group_link );
+
+	wp_mail( $to, $subject, $message );
+}
+add_action( 'groups_promoted_member', 'groups_notification_promoted_member', 10, 2 );
+
+function groups_notification_group_invites( &$group, &$member, $inviter_user_id ) {
+	global $bp;
+
+	$inviter_ud = bp_core_get_core_userdata( $inviter_user_id );
+	$inviter_name = bp_core_get_userlink( $inviter_user_id, true, false, true );
+	$inviter_link = bp_core_get_user_domain( $inviter_user_id );
+
+	$group_link = bp_get_group_permalink( $group );
+
+	if ( !$member->invite_sent ) {
+		$invited_user_id = $member->user_id;
+
+		// Post a screen notification first.
+		bp_core_add_notification( $group->id, $invited_user_id, 'groups', 'group_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);
+
+		$settings_link = bp_core_get_user_domain( $invited_user_id ) .  BP_SETTINGS_SLUG . '/notifications/';
+		$invited_link = bp_core_get_user_domain( $invited_user_id );
+		$invites_link = $invited_link . $bp->groups->slug . '/invites';
+
+		// Set up and send the message
+		$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 );
+
+		$message = sprintf( __(
+'One of your friends %s has invited you to the group: "%s".
+
+To view your group invites visit: %s
+
+To view the group visit: %s
+
+To view %s\'s profile visit: %s
+
+---------------------
+', 'buddypress' ), $inviter_name, $group->name, $invites_link, $group_link, $inviter_name, $inviter_link );
+
+		$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
+
+		/* Send the message */
+		$to = apply_filters( 'groups_notification_group_invites_to', $to );
+		$subject = apply_filters( 'groups_notification_group_invites_subject', $subject, &$group );
+		$message = apply_filters( 'groups_notification_group_invites_message', $message, &$group, $inviter_name, $inviter_link, $invites_link, $group_link );
+
+		wp_mail( $to, $subject, $message );
+	}
+}
+
+function groups_at_message_notification( $content, $poster_user_id, $group_id, $activity_id ) {
+	global $bp;
+
+	/* Scan for @username strings in an activity update. Notify each user. */
+	$pattern = '/[@]+([A-Za-z0-9-_\.]+)/';
+	preg_match_all( $pattern, $content, $usernames );
+
+	/* Make sure there's only one instance of each username */
+	if ( !$usernames = array_unique( $usernames[1] ) )
+		return false;
+
+	$group = new BP_Groups_Group( $group_id );
+
+	foreach( (array)$usernames as $username ) {
+		if ( !$receiver_user_id = bp_core_get_userid($username) )
+			continue;
+
+		/* Check the user is a member of the group before sending the update. */
+		if ( !groups_is_user_member( $receiver_user_id, $group_id ) )
+			continue;
+
+		// Now email the user with the contents of the message (if they have enabled email notifications)
+		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 );
+			$settings_link = bp_core_get_user_domain( $receiver_user_id ) .  BP_SETTINGS_SLUG . '/notifications/';
+
+			$poster_name = stripslashes( $poster_name );
+			$content = bp_groups_filter_kses( stripslashes( $content ) );
+
+			// Set up and send the message
+			$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 the group "%s"', 'buddypress' ), $poster_name, $group->name );
+
+$message = sprintf( __(
+'%s mentioned you in the group "%s":
+
+"%s"
+
+To view and respond to the message, log in and visit: %s
+
+---------------------
+', 'buddypress' ), $poster_name, $group->name, $content, $message_link );
+
+			$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
+
+			/* Send the message */
+			$to = apply_filters( 'groups_at_message_notification_to', $to );
+			$subject = apply_filters( 'groups_at_message_notification_subject', $subject, &$group, $poster_name );
+			$message = apply_filters( 'groups_at_message_notification_message', $message, &$group, $poster_name, $content, $message_link );
+
+			wp_mail( $to, $subject, $message );
+		}
+	}
+}
+add_action( 'bp_groups_posted_update', 'groups_at_message_notification', 10, 4 );
+
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-groups/bp-groups-templatetags.php b/wp-content/plugins/buddypress/bp-groups/bp-groups-templatetags.php
new file mode 100644
index 0000000000000000000000000000000000000000..7d4d40677eb5403f8bab2b14fed321400e63c483
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-groups/bp-groups-templatetags.php
@@ -0,0 +1,2274 @@
+<?php
+
+/*****************************************************************************
+ * Groups Template Class/Tags
+ **/
+
+class BP_Groups_Template {
+	var $current_group = -1;
+	var $group_count;
+	var $groups;
+	var $group;
+
+	var $in_the_loop;
+
+	var $pag_page;
+	var $pag_num;
+	var $pag_links;
+	var $total_group_count;
+
+	var $single_group = false;
+
+	var $sort_by;
+	var $order;
+
+	function bp_groups_template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $populate_extras ) {
+		global $bp;
+
+		$this->pag_page = isset( $_REQUEST['grpage'] ) ? intval( $_REQUEST['grpage'] ) : $page;
+		$this->pag_num  = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
+
+		if ( 'invites' == $type ) {
+			$this->groups = groups_get_invites_for_user( $user_id, $this->pag_num, $this->pag_page );
+		} else if ( 'single-group' == $type ) {
+			$group = new stdClass;
+			$group->group_id = BP_Groups_Group::get_id_from_slug($slug);
+			$this->groups    = array( $group );
+		} else {
+			$this->groups = groups_get_groups( array( 'type' => $type, 'per_page' => $this->pag_num, 'page' =>$this->pag_page, 'user_id' => $user_id, 'search_terms' => $search_terms, 'populate_extras' => $populate_extras ) );
+		}
+
+		if ( 'invites' == $type ) {
+			$this->total_group_count = (int)$this->groups['total'];
+			$this->group_count       = (int)$this->groups['total'];
+			$this->groups            = $this->groups['groups'];
+		} else if ( 'single-group' == $type ) {
+			$this->single_group      = true;
+			$this->total_group_count = 1;
+			$this->group_count       = 1;
+		} else {
+			if ( !$max || $max >= (int)$this->groups['total'] ) {
+				$this->total_group_count = (int)$this->groups['total'];
+			} else {
+				$this->total_group_count = (int)$max;
+			}
+
+			$this->groups = $this->groups['groups'];
+
+			if ( $max ) {
+				if ( $max >= count($this->groups) ) {
+					$this->group_count = count( $this->groups );
+				} else {
+					$this->group_count = (int)$max;
+				}
+			} else {
+				$this->group_count = count( $this->groups );
+			}
+		}
+
+		// Build pagination links
+		if ( (int)$this->total_group_count && (int)$this->pag_num ) {
+			$this->pag_links = paginate_links( array(
+				'base'      => add_query_arg( array( 'grpage' => '%#%', 'num' => $this->pag_num, 's' => $search_terms, 'sortby' => $this->sort_by, 'order' => $this->order ) ),
+				'format'    => '',
+				'total'     => ceil( (int)$this->total_group_count / (int)$this->pag_num ),
+				'current'   => $this->pag_page,
+				'prev_text' => '&larr;',
+				'next_text' => '&rarr;',
+				'mid_size'  => 1
+			) );
+		}
+	}
+
+	function has_groups() {
+		if ( $this->group_count )
+			return true;
+
+		return false;
+	}
+
+	function next_group() {
+		$this->current_group++;
+		$this->group = $this->groups[$this->current_group];
+
+		return $this->group;
+	}
+
+	function rewind_groups() {
+		$this->current_group = -1;
+		if ( $this->group_count > 0 ) {
+			$this->group = $this->groups[0];
+		}
+	}
+
+	function groups() {
+		if ( $this->current_group + 1 < $this->group_count ) {
+			return true;
+		} elseif ( $this->current_group + 1 == $this->group_count ) {
+			do_action('loop_end');
+			// Do some cleaning up after the loop
+			$this->rewind_groups();
+		}
+
+		$this->in_the_loop = false;
+		return false;
+	}
+
+	function the_group() {
+		global $group;
+
+		$this->in_the_loop = true;
+		$this->group = $this->next_group();
+
+		if ( $this->single_group )
+			$this->group = new BP_Groups_Group( $this->group->group_id, true );
+		else {
+			if ( $this->group )
+				wp_cache_set( 'groups_group_nouserdata_' . $group->group_id, $this->group, 'bp' );
+		}
+
+		if ( 0 == $this->current_group ) // loop has just started
+			do_action('loop_start');
+	}
+}
+
+function bp_has_groups( $args = '' ) {
+	global $groups_template, $bp;
+
+	/***
+	 * Set the defaults based on the current page. Any of these will be overridden
+	 * if arguments are directly passed into the loop. Custom plugins should always
+	 * pass their parameters directly to the loop.
+	 */
+	$type = 'active';
+	$user_id = false;
+	$search_terms = false;
+	$slug = false;
+
+	/* User filtering */
+	if ( !empty( $bp->displayed_user->id ) )
+		$user_id = $bp->displayed_user->id;
+
+	/* Type */
+	if ( 'my-groups' == $bp->current_action ) {
+		if ( 'most-popular' == $order )
+			$type = 'popular';
+		else if ( 'alphabetically' == $order )
+			$type = 'alphabetical';
+	} else if ( 'invites' == $bp->current_action ) {
+		$type = 'invites';
+	} else if ( $bp->groups->current_group->slug ) {
+		$type = 'single-group';
+		$slug = $bp->groups->current_group->slug;
+	}
+
+	if ( isset( $_REQUEST['group-filter-box'] ) || isset( $_REQUEST['s'] ) )
+		$search_terms = ( isset( $_REQUEST['group-filter-box'] ) ) ? $_REQUEST['group-filter-box'] : $_REQUEST['s'];
+
+	$defaults = array(
+		'type' => $type,
+		'page' => 1,
+		'per_page' => 20,
+		'max' => false,
+
+		'user_id' => $user_id, // Pass a user ID to limit to groups this user has joined
+		'slug' => $slug, // Pass a group slug to only return that group
+		'search_terms' => $search_terms, // Pass search terms to return only matching groups
+
+		'populate_extras' => true // Get extra meta - is_member, is_banned
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r );
+
+	$groups_template = new BP_Groups_Template( (int)$user_id, $type, (int)$page, (int)$per_page, (int)$max, $slug, $search_terms, (bool)$populate_extras );
+	return apply_filters( 'bp_has_groups', $groups_template->has_groups(), &$groups_template );
+}
+
+function bp_groups() {
+	global $groups_template;
+	return $groups_template->groups();
+}
+
+function bp_the_group() {
+	global $groups_template;
+	return $groups_template->the_group();
+}
+
+function bp_group_is_visible( $group = false ) {
+	global $bp, $groups_template;
+
+	if ( $bp->loggedin_user->is_super_admin )
+		return true;
+
+	if ( !$group )
+		$group =& $groups_template->group;
+
+	if ( 'public' == $group->status ) {
+		return true;
+	} else {
+		if ( groups_is_user_member( $bp->loggedin_user->id, $group->id ) ) {
+			return true;
+		}
+	}
+
+	return false;
+}
+
+function bp_group_id() {
+	echo bp_get_group_id();
+}
+	function bp_get_group_id( $group = false ) {
+		global $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_id', $group->id );
+	}
+
+function bp_group_name() {
+	echo bp_get_group_name();
+}
+	function bp_get_group_name( $group = false ) {
+		global $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_name', $group->name );
+	}
+
+function bp_group_type() {
+	echo bp_get_group_type();
+}
+	function bp_get_group_type( $group = false ) {
+		global $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		if ( 'public' == $group->status ) {
+			$type = __( "Public Group", "buddypress" );
+		} else if ( 'hidden' == $group->status ) {
+			$type = __( "Hidden Group", "buddypress" );
+		} else if ( 'private' == $group->status ) {
+			$type = __( "Private Group", "buddypress" );
+		} else {
+			$type = ucwords( $group->status ) . ' ' . __( 'Group', 'buddypress' );
+		}
+
+		return apply_filters( 'bp_get_group_type', $type );
+	}
+
+function bp_group_status() {
+	echo bp_get_group_status();
+}
+	function bp_get_group_status( $group = false ) {
+		global $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_status', $group->status );
+	}
+
+function bp_group_avatar( $args = '' ) {
+	echo bp_get_group_avatar( $args );
+}
+	function bp_get_group_avatar( $args = '' ) {
+		global $bp, $groups_template;
+
+		$defaults = array(
+			'type' => 'full',
+			'width' => false,
+			'height' => false,
+			'class' => 'avatar',
+			'id' => false,
+			'alt' => __( 'Group avatar', 'buddypress' )
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		/* 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="' . esc_attr( $groups_template->group->avatar_thumb ) . '" class="avatar" alt="' . esc_attr( $groups_template->group->name ) . '" />';
+
+		return apply_filters( 'bp_get_group_avatar', $avatar );
+	}
+
+function bp_group_avatar_thumb() {
+	echo bp_get_group_avatar_thumb();
+}
+	function bp_get_group_avatar_thumb( $group = false ) {
+		return bp_get_group_avatar( 'type=thumb' );
+	}
+
+function bp_group_avatar_mini() {
+	echo bp_get_group_avatar_mini();
+}
+	function bp_get_group_avatar_mini( $group = false ) {
+		return bp_get_group_avatar( 'type=thumb&width=30&height=30' );
+	}
+
+function bp_group_last_active() {
+	echo bp_get_group_last_active();
+}
+	function bp_get_group_last_active( $group = false ) {
+		global $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		$last_active = $group->last_activity;
+
+		if ( !$last_active )
+			$last_active = groups_get_groupmeta( $group->id, 'last_activity' );
+
+		if ( empty( $last_active ) ) {
+			return __( 'not yet active', 'buddypress' );
+		} else {
+			return apply_filters( 'bp_get_group_last_active', bp_core_time_since( $last_active ) );
+		}
+	}
+
+function bp_group_permalink() {
+	echo bp_get_group_permalink();
+}
+	function bp_get_group_permalink( $group = false ) {
+		global $groups_template, $bp;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_permalink', $bp->root_domain . '/' . $bp->groups->slug . '/' . $group->slug . '/' );
+	}
+
+function bp_group_admin_permalink() {
+	echo bp_get_group_admin_permalink();
+}
+	function bp_get_group_admin_permalink( $group = false ) {
+		global $groups_template, $bp;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_admin_permalink', $bp->root_domain . '/' . $bp->groups->slug . '/' . $group->slug . '/admin' );
+	}
+
+function bp_group_slug() {
+	echo bp_get_group_slug();
+}
+	function bp_get_group_slug( $group = false ) {
+		global $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_slug', $group->slug );
+	}
+
+function bp_group_description() {
+	echo bp_get_group_description();
+}
+	function bp_get_group_description( $group = false ) {
+		global $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_description', stripslashes($group->description) );
+	}
+
+function bp_group_description_editable() {
+	echo bp_get_group_description_editable();
+}
+	function bp_get_group_description_editable( $group = false ) {
+		global $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_description_editable', $group->description );
+	}
+
+function bp_group_description_excerpt() {
+	echo bp_get_group_description_excerpt();
+}
+	function bp_get_group_description_excerpt( $group = false ) {
+		global $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_description_excerpt', bp_create_excerpt( $group->description, 20 ) );
+	}
+
+
+function bp_group_public_status() {
+	echo bp_get_group_public_status();
+}
+	function bp_get_group_public_status( $group = false ) {
+		global $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		if ( $group->is_public ) {
+			return __( 'Public', 'buddypress' );
+		} else {
+			return __( 'Private', 'buddypress' );
+		}
+	}
+
+function bp_group_is_public() {
+	echo bp_get_group_is_public();
+}
+	function bp_get_group_is_public( $group = false ) {
+		global $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_is_public', $group->is_public );
+	}
+
+function bp_group_date_created() {
+	echo bp_get_group_date_created();
+}
+	function bp_get_group_date_created( $group = false ) {
+		global $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_date_created', bp_core_time_since( strtotime( $group->date_created ) ) );
+	}
+
+function bp_group_is_admin() {
+	global $bp;
+
+	return $bp->is_item_admin;
+}
+
+function bp_group_is_mod() {
+	global $bp;
+
+	return $bp->is_item_mod;
+}
+
+function bp_group_list_admins( $group = false ) {
+	global $groups_template;
+
+	if ( !$group )
+		$group =& $groups_template->group;
+
+	if ( $group->admins ) { ?>
+		<ul id="group-admins">
+			<?php foreach( (array)$group->admins as $admin ) { ?>
+				<li>
+					<a href="<?php echo bp_core_get_user_domain( $admin->user_id, $admin->user_nicename, $admin->user_login ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'email' => $admin->user_email ) ) ?></a>
+				</li>
+			<?php } ?>
+		</ul>
+	<?php } else { ?>
+		<span class="activity"><?php _e( 'No Admins', 'buddypress' ) ?></span>
+	<?php } ?>
+<?php
+}
+
+function bp_group_list_mods( $group = false ) {
+	global $groups_template;
+
+	if ( !$group )
+		$group =& $groups_template->group;
+
+	if ( $group->mods ) { ?>
+		<ul id="group-mods">
+			<?php foreach( (array)$group->mods as $mod ) { ?>
+				<li>
+					<a href="<?php echo bp_core_get_user_domain( $mod->user_id, $mod->user_nicename, $mod->user_login ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'email' => $mod->user_email ) ) ?></a>
+				</li>
+			<?php } ?>
+		</ul>
+	<?php } else { ?>
+		<span class="activity"><?php _e( 'No Mods', 'buddypress' ) ?></span>
+	<?php } ?>
+<?php
+}
+
+function bp_group_all_members_permalink() {
+	echo bp_get_group_all_members_permalink();
+}
+	function bp_get_group_all_members_permalink( $group = false ) {
+		global $groups_template, $bp;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_all_members_permalink', bp_get_group_permalink( $group ) . 'members' );
+	}
+
+function bp_group_search_form() {
+	global $groups_template, $bp;
+
+	$action = $bp->displayed_user->domain . $bp->groups->slug . '/my-groups/search/';
+	$label = __('Filter Groups', 'buddypress');
+	$name = 'group-filter-box';
+
+?>
+	<form action="<?php echo $action ?>" id="group-search-form" method="post">
+		<label for="<?php echo $name ?>" id="<?php echo $name ?>-label"><?php echo $label ?></label>
+		<input type="search" name="<?php echo $name ?>" id="<?php echo $name ?>" value="<?php echo $value ?>"<?php echo $disabled ?> />
+
+		<?php wp_nonce_field( 'group-filter-box', '_wpnonce_group_filter' ) ?>
+	</form>
+<?php
+}
+
+function bp_group_show_no_groups_message() {
+	global $bp;
+
+	if ( !groups_total_groups_for_user( $bp->displayed_user->id ) )
+		return true;
+
+	return false;
+}
+
+function bp_group_is_activity_permalink() {
+	global $bp;
+
+	if ( !$bp->is_single_item || $bp->current_component != $bp->groups->slug || $bp->current_action != $bp->activity->slug )
+		return false;
+
+	return true;
+}
+
+function bp_groups_pagination_links() {
+	echo bp_get_groups_pagination_links();
+}
+	function bp_get_groups_pagination_links() {
+		global $groups_template;
+
+		return apply_filters( 'bp_get_groups_pagination_links', $groups_template->pag_links );
+	}
+
+function bp_groups_pagination_count() {
+	global $bp, $groups_template;
+
+	$start_num = intval( ( $groups_template->pag_page - 1 ) * $groups_template->pag_num ) + 1;
+	$from_num = bp_core_number_format( $start_num );
+	$to_num = bp_core_number_format( ( $start_num + ( $groups_template->pag_num - 1 ) > $groups_template->total_group_count ) ? $groups_template->total_group_count : $start_num + ( $groups_template->pag_num - 1 ) );
+	$total = bp_core_number_format( $groups_template->total_group_count );
+
+	echo sprintf( __( 'Viewing group %1$s to %2$s (of %3$s groups)', 'buddypress' ), $from_num, $to_num, $total ); ?> &nbsp;
+	<span class="ajax-loader"></span><?php
+}
+
+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();
+}
+	function bp_get_group_total_members( $group = false ) {
+		global $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_total_members', $group->total_member_count );
+	}
+
+function bp_group_member_count() {
+	echo bp_get_group_member_count();
+}
+	function bp_get_group_member_count() {
+		global $groups_template;
+
+		if ( 1 == (int) $groups_template->group->total_member_count )
+			return apply_filters( 'bp_get_group_member_count', sprintf( __( '%s member', 'buddypress' ), bp_core_number_format( $groups_template->group->total_member_count ) ) );
+		else
+			return apply_filters( 'bp_get_group_member_count', sprintf( __( '%s members', 'buddypress' ), bp_core_number_format( $groups_template->group->total_member_count ) ) );
+	}
+
+function bp_group_forum_permalink() {
+	echo bp_get_group_forum_permalink();
+}
+	function bp_get_group_forum_permalink( $group = false ) {
+		global $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_forum_permalink', bp_get_group_permalink( $group ) . 'forum' );
+	}
+
+function bp_group_forum_topic_count( $args = '' ) {
+	echo bp_get_group_forum_topic_count( $args );
+}
+	function bp_get_group_forum_topic_count( $args = '' ) {
+		global $groups_template;
+
+		$defaults = array(
+			'showtext' => false
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		if ( !$forum_id = groups_get_groupmeta( $groups_template->group->id, 'forum_id' ) )
+			return false;
+
+		if ( !function_exists( 'bp_forums_get_forum_topicpost_count' ) )
+			return false;
+
+		if ( !$groups_template->group->forum_counts )
+			$groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int)$forum_id );
+
+		if ( (bool) $showtext ) {
+			if ( 1 == (int) $groups_template->group->forum_counts[0]->topics )
+				$total_topics = sprintf( __( '%d topic', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->topics );
+			else
+				$total_topics = sprintf( __( '%d topics', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->topics );
+		} else {
+			$total_topics = (int) $groups_template->group->forum_counts[0]->topics;
+		}
+
+		return apply_filters( 'bp_get_group_forum_topic_count', $total_topics, (bool)$showtext );
+	}
+
+function bp_group_forum_post_count( $args = '' ) {
+	echo bp_get_group_forum_post_count( $args );
+}
+	function bp_get_group_forum_post_count( $args = '' ) {
+		global $groups_template;
+
+		$defaults = array(
+			'showtext' => false
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		if ( !$forum_id = groups_get_groupmeta( $groups_template->group->id, 'forum_id' ) )
+			return false;
+
+		if ( !function_exists( 'bp_forums_get_forum_topicpost_count' ) )
+			return false;
+
+		if ( !$groups_template->group->forum_counts )
+			$groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int)$forum_id );
+
+		if ( (bool) $showtext ) {
+			if ( 1 == (int) $groups_template->group->forum_counts[0]->posts )
+				$total_posts = sprintf( __( '%d post', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->posts );
+			else
+				$total_posts = sprintf( __( '%d posts', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->posts );
+		} else {
+			$total_posts = (int) $groups_template->group->forum_counts[0]->posts;
+		}
+
+		return apply_filters( 'bp_get_group_forum_post_count', $total_posts, (bool)$showtext );
+	}
+
+function bp_group_is_forum_enabled( $group = false ) {
+	global $groups_template;
+
+	if ( !$group )
+		$group =& $groups_template->group;
+
+	if ( function_exists( 'bp_forums_is_installed_correctly' ) ) {
+		if ( bp_forums_is_installed_correctly() ) {
+			if ( $group->enable_forum )
+				return true;
+
+			return false;
+		} else {
+			return false;
+		}
+	}
+
+	return false;
+}
+
+function bp_group_show_forum_setting( $group = false ) {
+	global $groups_template;
+
+	if ( !$group )
+		$group =& $groups_template->group;
+
+	if ( $group->enable_forum )
+		echo ' checked="checked"';
+}
+
+function bp_group_show_status_setting( $setting, $group = false ) {
+	global $groups_template;
+
+	if ( !$group )
+		$group =& $groups_template->group;
+
+	if ( $setting == $group->status )
+		echo ' checked="checked"';
+}
+
+function bp_group_admin_memberlist( $admin_list = false, $group = false ) {
+	global $groups_template;
+
+	if ( !$group )
+		$group =& $groups_template->group;
+
+	$admins = groups_get_group_admins( $group->id );
+?>
+	<?php if ( $admins ) { ?>
+		<ul id="admins-list" class="item-list<?php if ( $admin_list ) { ?> single-line<?php } ?>">
+		<?php foreach ( (array)$admins as $admin ) { ?>
+			<?php if ( $admin_list ) { ?>
+			<li>
+				<?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'type' => 'thumb', 'width' => 30, 'height' => 30 ) ) ?>
+				<h5><?php echo bp_core_get_userlink( $admin->user_id ) ?>  <span class="small"> &mdash; <a class="confirm" href="<?php bp_group_member_demote_link($admin->user_id) ?>"><?php _e( 'Demote to Member', 'buddypress' ) ?></a></span></h5>
+			</li>
+			<?php } else { ?>
+			<li>
+				<?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'type' => 'thumb' ) ) ?>
+				<h5><?php echo bp_core_get_userlink( $admin->user_id ) ?></h5>
+				<span class="activity"><?php echo bp_core_get_last_activity( strtotime( $admin->date_modified ), __( 'joined %s ago', 'buddypress') ); ?></span>
+
+				<?php if ( function_exists( 'friends_install' ) ) : ?>
+					<div class="action">
+						<?php bp_add_friend_button( $admin->user_id ) ?>
+					</div>
+				<?php endif; ?>
+			</li>
+			<?php } ?>
+		<?php } ?>
+		</ul>
+	<?php } else { ?>
+		<div id="message" class="info">
+			<p><?php _e( 'This group has no administrators', 'buddypress' ); ?></p>
+		</div>
+	<?php }
+}
+
+function bp_group_mod_memberlist( $admin_list = false, $group = false ) {
+	global $groups_template, $group_mods;
+
+	if ( !$group )
+		$group =& $groups_template->group;
+
+	$group_mods = groups_get_group_mods( $group->id );
+	?>
+		<?php if ( $group_mods ) { ?>
+			<ul id="mods-list" class="item-list<?php if ( $admin_list ) { ?> single-line<?php } ?>">
+			<?php foreach ( (array)$group_mods as $mod ) { ?>
+				<?php if ( $admin_list ) { ?>
+				<li>
+					<?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'type' => 'thumb', 'width' => 30, 'height' => 30 ) ) ?>
+					<h5><?php echo bp_core_get_userlink( $mod->user_id ) ?>  <span class="small"> &mdash; <a href="<?php bp_group_member_promote_admin_link( array( 'user_id' => $mod->user_id ) ) ?>" class="confirm" title="<?php _e( 'Promote to Admin', 'buddypress' ); ?>"><?php _e( 'Promote to Admin', 'buddypress' ); ?></a> | <a class="confirm" href="<?php bp_group_member_demote_link($mod->user_id) ?>"><?php _e( 'Demote to Member', 'buddypress' ) ?></a></span></h5>
+				</li>
+				<?php } else { ?>
+				<li>
+					<?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'type' => 'thumb' ) ) ?>
+					<h5><?php echo bp_core_get_userlink( $mod->user_id ) ?></h5>
+					<span class="activity"><?php echo bp_core_get_last_activity( strtotime( $mod->date_modified ), __( 'joined %s ago', 'buddypress') ); ?></span>
+
+					<?php if ( function_exists( 'friends_install' ) ) : ?>
+						<div class="action">
+							<?php bp_add_friend_button( $mod->user_id ) ?>
+						</div>
+					<?php endif; ?>
+				</li>
+				<?php } ?>
+			<?php } ?>
+			</ul>
+		<?php } else { ?>
+			<div id="message" class="info">
+				<p><?php _e( 'This group has no moderators', 'buddypress' ); ?></p>
+			</div>
+		<?php }
+}
+
+function bp_group_has_moderators( $group = false ) {
+	global $group_mods, $groups_template;
+
+	if ( !$group )
+		$group =& $groups_template->group;
+
+	return apply_filters( 'bp_group_has_moderators', groups_get_group_mods( $group->id ) );
+}
+
+function bp_group_member_promote_mod_link( $args = '' ) {
+	echo bp_get_group_member_promote_mod_link( $args );
+}
+	function bp_get_group_member_promote_mod_link( $args = '' ) {
+		global $members_template, $groups_template, $bp;
+
+		$defaults = array(
+			'user_id' => $members_template->member->user_id,
+			'group' => &$groups_template->group
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		return apply_filters( 'bp_get_group_member_promote_mod_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/promote/mod/' . $user_id, 'groups_promote_member' ) );
+	}
+
+function bp_group_member_promote_admin_link( $args = '' ) {
+	echo bp_get_group_member_promote_admin_link( $args );
+}
+	function bp_get_group_member_promote_admin_link( $args = '' ) {
+		global $members_template, $groups_template, $bp;
+
+		$defaults = array(
+			'user_id' => $members_template->member->user_id,
+			'group' => &$groups_template->group
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		return apply_filters( 'bp_get_group_member_promote_admin_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/promote/admin/' . $user_id, 'groups_promote_member' ) );
+	}
+
+function bp_group_member_demote_link( $user_id = false ) {
+	global $members_template;
+
+	if ( !$user_id )
+		$user_id = $members_template->member->user_id;
+
+	echo bp_get_group_member_demote_link( $user_id );
+}
+	function bp_get_group_member_demote_link( $user_id = false, $group = false ) {
+		global $members_template, $groups_template, $bp;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		if ( !$user_id )
+			$user_id = $members_template->member->user_id;
+
+		return apply_filters( 'bp_get_group_member_demote_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/demote/' . $user_id, 'groups_demote_member' ) );
+	}
+
+function bp_group_member_ban_link( $user_id = false ) {
+	global $members_template;
+
+	if ( !$user_id )
+		$user_id = $members_template->member->user_id;
+
+	echo bp_get_group_member_ban_link( $user_id );
+}
+	function bp_get_group_member_ban_link( $user_id = false, $group = false ) {
+		global $members_template, $groups_template, $bp;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_member_ban_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/ban/' . $user_id, 'groups_ban_member' ) );
+	}
+
+function bp_group_member_unban_link( $user_id = false ) {
+	global $members_template;
+
+	if ( !$user_id )
+		$user_id = $members_template->member->user_id;
+
+	echo bp_get_group_member_unban_link( $user_id );
+}
+	function bp_get_group_member_unban_link( $user_id = false, $group = false ) {
+		global $members_template, $groups_template;
+
+		if ( !$user_id )
+			$user_id = $members_template->member->user_id;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		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;
+
+	if ( !$group )
+		$group = ( $groups_template->group ) ? $groups_template->group : $bp->groups->current_group;
+
+	$current_tab = $bp->action_variables[0];
+?>
+	<?php if ( $bp->is_item_admin || $bp->is_item_mod ) { ?>
+		<li<?php if ( 'edit-details' == $current_tab || empty( $current_tab ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $group->slug ?>/admin/edit-details"><?php _e('Edit Details', 'buddypress') ?></a></li>
+	<?php } ?>
+
+	<?php
+		if ( !$bp->is_item_admin )
+			return false;
+	?>
+	<li<?php if ( 'group-settings' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $group->slug ?>/admin/group-settings"><?php _e('Group Settings', 'buddypress') ?></a></li>
+	<li<?php if ( 'group-avatar' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $group->slug ?>/admin/group-avatar"><?php _e('Group Avatar', 'buddypress') ?></a></li>
+	<li<?php if ( 'manage-members' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $group->slug ?>/admin/manage-members"><?php _e('Manage Members', 'buddypress') ?></a></li>
+
+	<?php if ( $groups_template->group->status == 'private' ) : ?>
+		<li<?php if ( 'membership-requests' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $group->slug ?>/admin/membership-requests"><?php _e('Membership Requests', 'buddypress') ?></a></li>
+	<?php endif; ?>
+
+	<?php do_action( 'groups_admin_tabs', $current_tab, $group->slug ) ?>
+
+	<li<?php if ( 'delete-group' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $group->slug ?>/admin/delete-group"><?php _e('Delete Group', 'buddypress') ?></a></li>
+<?php
+}
+
+function bp_group_total_for_member() {
+	echo bp_get_group_total_for_member();
+}
+	function bp_get_group_total_for_member() {
+		return apply_filters( 'bp_get_group_total_for_member', BP_Groups_Member::total_group_count() );
+	}
+
+function bp_group_form_action( $page ) {
+	echo bp_get_group_form_action( $page );
+}
+	function bp_get_group_form_action( $page, $group = false ) {
+		global $bp, $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_group_form_action', bp_get_group_permalink( $group ) . $page );
+	}
+
+function bp_group_admin_form_action( $page = false ) {
+	echo bp_get_group_admin_form_action( $page );
+}
+	function bp_get_group_admin_form_action( $page = false, $group = false ) {
+		global $bp, $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		if ( !$page )
+			$page = $bp->action_variables[0];
+
+		return apply_filters( 'bp_group_admin_form_action', bp_get_group_permalink( $group ) . 'admin/' . $page );
+	}
+
+function bp_group_has_requested_membership( $group = false ) {
+	global $bp, $groups_template;
+
+	if ( !$group )
+		$group =& $groups_template->group;
+
+	if ( groups_check_for_membership_request( $bp->loggedin_user->id, $group->id ) )
+		return true;
+
+	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;
+
+	// Site admins always have access
+	if ( is_super_admin() )
+		return true;
+
+	// Load group if none passed
+	if ( !$group )
+		$group =& $groups_template->group;
+
+	// Check membership
+	if ( null == $group->is_member )
+		$is_member = false;
+	else
+		$is_member = true;
+
+	// Return
+	return apply_filters( 'bp_group_is_member', $is_member );
+}
+
+function bp_group_accept_invite_link() {
+	echo bp_get_group_accept_invite_link();
+}
+	function bp_get_group_accept_invite_link( $group = false ) {
+		global $groups_template, $bp;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_accept_invite_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->groups->slug . '/invites/accept/' . $group->id, 'groups_accept_invite' ) );
+	}
+
+function bp_group_reject_invite_link() {
+	echo bp_get_group_reject_invite_link();
+}
+	function bp_get_group_reject_invite_link( $group = false ) {
+		global $groups_template, $bp;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_reject_invite_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->groups->slug . '/invites/reject/' . $group->id, 'groups_reject_invite' ) );
+	}
+
+function bp_group_leave_confirm_link() {
+	echo bp_get_group_leave_confirm_link();
+}
+	function bp_get_group_leave_confirm_link( $group = false ) {
+		global $groups_template, $bp;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_group_leave_confirm_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group/yes', 'groups_leave_group' ) );
+	}
+
+function bp_group_leave_reject_link() {
+	echo bp_get_group_leave_reject_link();
+}
+	function bp_get_group_leave_reject_link( $group = false ) {
+		global $groups_template, $bp;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_get_group_leave_reject_link', bp_get_group_permalink( $group ) );
+	}
+
+function bp_group_send_invite_form_action() {
+	echo bp_get_group_send_invite_form_action();
+}
+	function bp_get_group_send_invite_form_action( $group = false ) {
+		global $groups_template, $bp;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		return apply_filters( 'bp_group_send_invite_form_action', bp_get_group_permalink( $group ) . 'send-invites/send' );
+	}
+
+function bp_has_friends_to_invite( $group = false ) {
+	global $groups_template, $bp;
+
+	if ( !function_exists('friends_install') )
+		return false;
+
+	if ( !$group )
+		$group =& $groups_template->group;
+
+	if ( !friends_check_user_has_friends( $bp->loggedin_user->id ) || !friends_count_invitable_friends( $bp->loggedin_user->id, $group->id ) )
+		return false;
+
+	return true;
+}
+
+function bp_group_new_topic_button() {
+	if ( bp_is_group_forum() && is_user_logged_in() && !bp_is_group_forum_topic() ) {
+		bp_button( array (
+			'id'                => 'new_topic',
+			'component'         => 'groups',
+			'must_be_logged_in' => true,
+			'block_self'        => true,
+			'wrapper_class'     => 'group-button',
+			'link_href'         => '#post-new',
+			'link_class'        => '',
+			'link_text'         => __( 'New Topic', 'buddypress' ),
+			'link_title'        => __( 'New Topic', 'buddypress' ),
+		) );
+	}
+}
+
+function bp_group_join_button( $group = false ) {
+	echo bp_get_group_join_button();
+}
+	function bp_get_group_join_button( $group = false ) {
+		global $bp, $groups_template;
+
+		if ( !$group )
+			$group =& $groups_template->group;
+
+		// If they're not logged in or are banned from the group, no join button.
+		if ( !is_user_logged_in() || $group->is_banned )
+			return false;
+
+		// Group creation was not completed or status is unknown
+		if ( !$group->status )
+			return false;
+
+		// Already a member
+		if ( $group->is_member ) {
+
+			// Stop sole admins from abandoning their group
+			if ( $bp->is_item_admin && count( groups_get_group_admins( $group->id ) ) < 2 )
+				return false;
+
+			$button = array(
+				'id'                => 'leave_group',
+				'component'         => 'groups',
+				'must_be_logged_in' => true,
+				'block_self'        => false,
+				'wrapper_class'     => 'group-button ' . $group->status,
+				'wrapper_id'        => 'groupbutton-' . $group->id,
+				'link_class'        => 'leave-group',
+				'link_href'         => wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ),
+				'link_text'         => __( 'Leave Group', 'buddypress' ),
+				'link_title'        => __( 'Leave Group', 'buddypress' )
+			);
+
+		// Not a member
+		} else {
+
+			// Show different buttons based on group status
+			switch ( $group->status ) {
+				case 'hidden' :
+					return false;
+					break;
+
+				case 'public':
+					$button = array(
+						'id'                => 'join_group',
+						'component'         => 'groups',
+						'must_be_logged_in' => true,
+						'block_self'        => false,
+						'wrapper_class'     => 'group-button ' . $group->status,
+						'wrapper_id'        => 'groupbutton-' . $group->id,
+						'link_class'        => 'join-group',
+						'link_href'         => wp_nonce_url( bp_get_group_permalink( $group ) . 'join', 'groups_join_group' ),
+						'link_text'         => __( 'Join Group', 'buddypress' ),
+						'link_title'        => __( 'Join Group', 'buddypress' )
+					);
+					break;
+
+				case 'private' :
+
+					// Member has not requested membership yet
+					if ( !bp_group_has_requested_membership( $group ) ) {
+						$button = array(
+							'id'                => 'request_membership',
+							'component'         => 'groups',
+							'must_be_logged_in' => true,
+							'block_self'        => false,
+							'wrapper_class'     => 'group-button ' . $group->status,
+							'wrapper_id'        => 'groupbutton-' . $group->id,
+							'link_class'        => 'request-membership',
+							'link_href'         => wp_nonce_url( bp_get_group_permalink( $group ) . 'request-membership', 'groups_request_membership' ),
+							'link_text'         => __( 'Request Membership', 'buddypress' ),
+							'link_title'        => __( 'Request Membership', 'buddypress' ),
+						);
+
+					// Member has requested membership already
+					} else {
+						$button = array(
+							'id'                => 'membership_requested',
+							'component'         => 'groups',
+							'must_be_logged_in' => true,
+							'block_self'        => false,
+							'wrapper_class'     => 'group-button pending ' . $group->status,
+							'wrapper_id'        => 'groupbutton-' . $group->id,
+							'link_class'        => 'membership-requested',
+							'link_href'         => bp_get_group_permalink( $group ),
+							'link_text'         => __( 'Request Sent', 'buddypress' ),
+							'link_title'        => __( 'Request Sent', 'buddypress' ),
+						);
+					}
+
+					break;
+			}
+		}
+
+		// Filter and return the HTML button
+		return bp_get_button( apply_filters( 'bp_get_group_join_button', $button ) );
+	}
+
+function bp_group_status_message( $group = false ) {
+	global $groups_template;
+
+	if ( !$group )
+		$group =& $groups_template->group;
+
+	if ( 'private' == $group->status ) {
+		if ( !bp_group_has_requested_membership() )
+			if ( is_user_logged_in() )
+				_e( 'This is a private group and you must request group membership in order to join.', 'buddypress' );
+			else
+				_e( 'This is a private group. To join you must be a registered site member and request group membership.', 'buddypress' );
+		else
+			_e( 'This is a private group. Your membership request is awaiting approval from the group administrator.', 'buddypress' );
+	} else {
+		_e( 'This is a hidden group and only invited members can join.', 'buddypress' );
+	}
+}
+
+function bp_group_hidden_fields() {
+	if ( isset( $_REQUEST['s'] ) ) {
+		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="' . esc_attr( $_REQUEST['letter'] ) . '" name="selected_letter" />';
+	}
+
+	if ( isset( $_REQUEST['groups_search'] ) ) {
+		echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['groups_search'] ) . '" name="search_terms" />';
+	}
+}
+
+function bp_total_group_count() {
+	echo bp_get_total_group_count();
+}
+	function bp_get_total_group_count() {
+		return apply_filters( 'bp_get_total_group_count', groups_get_total_group_count() );
+	}
+
+function bp_total_group_count_for_user( $user_id = false ) {
+	echo bp_get_total_group_count_for_user( $user_id );
+}
+	function bp_get_total_group_count_for_user( $user_id = false ) {
+		return apply_filters( 'bp_get_total_group_count_for_user', groups_total_groups_for_user( $user_id ) );
+	}
+
+
+/***************************************************************************
+ * Group Members Template Tags
+ **/
+
+class BP_Groups_Group_Members_Template {
+	var $current_member = -1;
+	var $member_count;
+	var $members;
+	var $member;
+
+	var $in_the_loop;
+
+	var $pag_page;
+	var $pag_num;
+	var $pag_links;
+	var $total_group_count;
+
+	function bp_groups_group_members_template( $group_id, $per_page, $max, $exclude_admins_mods, $exclude_banned ) {
+		global $bp;
+
+		$this->pag_page = isset( $_REQUEST['mlpage'] ) ? intval( $_REQUEST['mlpage'] ) : 1;
+		$this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
+
+		$this->members = BP_Groups_Member::get_all_for_group( $group_id, $this->pag_num, $this->pag_page, $exclude_admins_mods, $exclude_banned );
+
+		if ( !$max || $max >= (int)$this->members['count'] )
+			$this->total_member_count = (int)$this->members['count'];
+		else
+			$this->total_member_count = (int)$max;
+
+		$this->members = $this->members['members'];
+
+		if ( $max ) {
+			if ( $max >= count($this->members) )
+				$this->member_count = count($this->members);
+			else
+				$this->member_count = (int)$max;
+		} else {
+			$this->member_count = count($this->members);
+		}
+
+		$this->pag_links = paginate_links( array(
+			'base' => add_query_arg( 'mlpage', '%#%' ),
+			'format' => '',
+			'total' => ceil( $this->total_member_count / $this->pag_num ),
+			'current' => $this->pag_page,
+			'prev_text' => '&larr;',
+			'next_text' => '&rarr;',
+			'mid_size' => 1
+		));
+	}
+
+	function has_members() {
+		if ( $this->member_count )
+			return true;
+
+		return false;
+	}
+
+	function next_member() {
+		$this->current_member++;
+		$this->member = $this->members[$this->current_member];
+
+		return $this->member;
+	}
+
+	function rewind_members() {
+		$this->current_member = -1;
+		if ( $this->member_count > 0 ) {
+			$this->member = $this->members[0];
+		}
+	}
+
+	function members() {
+		if ( $this->current_member + 1 < $this->member_count ) {
+			return true;
+		} elseif ( $this->current_member + 1 == $this->member_count ) {
+			do_action('loop_end');
+			// Do some cleaning up after the loop
+			$this->rewind_members();
+		}
+
+		$this->in_the_loop = false;
+		return false;
+	}
+
+	function the_member() {
+		global $member;
+
+		$this->in_the_loop = true;
+		$this->member = $this->next_member();
+
+		if ( 0 == $this->current_member ) // loop has just started
+			do_action('loop_start');
+	}
+}
+
+function bp_group_has_members( $args = '' ) {
+	global $bp, $members_template;
+
+	$defaults = array(
+		'group_id' => $bp->groups->current_group->id,
+		'per_page' => 20,
+		'max' => false,
+		'exclude_admins_mods' => 1,
+		'exclude_banned' => 1
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	$members_template = new BP_Groups_Group_Members_Template( $group_id, $per_page, $max, (int)$exclude_admins_mods, (int)$exclude_banned );
+	return apply_filters( 'bp_group_has_members', $members_template->has_members(), &$members_template );
+}
+
+function bp_group_members() {
+	global $members_template;
+
+	return $members_template->members();
+}
+
+function bp_group_the_member() {
+	global $members_template;
+
+	return $members_template->the_member();
+}
+
+function bp_group_member_avatar() {
+	echo bp_get_group_member_avatar();
+}
+	function bp_get_group_member_avatar() {
+		global $members_template;
+
+		return apply_filters( 'bp_get_group_member_avatar', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->user_id, 'type' => 'full', 'email' => $members_template->member->user_email ) ) );
+	}
+
+function bp_group_member_avatar_thumb() {
+	echo bp_get_group_member_avatar_thumb();
+}
+	function bp_get_group_member_avatar_thumb() {
+		global $members_template;
+
+		return apply_filters( 'bp_get_group_member_avatar_thumb', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->user_id, 'type' => 'thumb', 'email' => $members_template->member->user_email ) ) );
+	}
+
+function bp_group_member_avatar_mini( $width = 30, $height = 30 ) {
+	echo bp_get_group_member_avatar_mini( $width, $height );
+}
+	function bp_get_group_member_avatar_mini( $width = 30, $height = 30 ) {
+		global $members_template;
+
+		return apply_filters( 'bp_get_group_member_avatar_mini', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->user_id, 'type' => 'thumb', 'width' => $width, 'height' => $height, 'email' => $members_template->member->user_email ) ) );
+	}
+
+function bp_group_member_name() {
+	echo bp_get_group_member_name();
+}
+	function bp_get_group_member_name() {
+		global $members_template;
+
+		return apply_filters( 'bp_get_group_member_name', $members_template->member->display_name );
+	}
+
+function bp_group_member_url() {
+	echo bp_get_group_member_url();
+}
+	function bp_get_group_member_url() {
+		global $members_template;
+
+		return apply_filters( 'bp_get_group_member_url', bp_core_get_user_domain( $members_template->member->user_id, $members_template->member->user_nicename, $members_template->member->user_login ) );
+	}
+
+function bp_group_member_link() {
+	echo bp_get_group_member_link();
+}
+	function bp_get_group_member_link() {
+		global $members_template;
+
+		return apply_filters( 'bp_get_group_member_link', '<a href="' . bp_core_get_user_domain( $members_template->member->user_id, $members_template->member->user_nicename, $members_template->member->user_login ) . '">' . $members_template->member->display_name . '</a>' );
+	}
+
+function bp_group_member_domain() {
+	echo bp_get_group_member_domain();
+}
+	function bp_get_group_member_domain() {
+		global $members_template;
+
+		return apply_filters( 'bp_get_group_member_domain', bp_core_get_user_domain( $members_template->member->user_id, $members_template->member->user_nicename, $members_template->member->user_login ) );
+	}
+
+function bp_group_member_is_friend() {
+	echo bp_get_group_member_is_friend();
+}
+	function bp_get_group_member_is_friend() {
+		global $members_template;
+
+		if ( null === $members_template->member->is_friend )
+			$friend_status = 'not_friends';
+		else
+			$friend_status = ( 0 == $members_template->member->is_friend ) ? 'pending' : 'is_friend';
+
+		return apply_filters( 'bp_get_group_member_is_friend', $friend_status );
+	}
+
+function bp_group_member_is_banned() {
+	echo bp_get_group_member_is_banned();
+}
+	function bp_get_group_member_is_banned() {
+		global $members_template, $groups_template;
+
+		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();
+}
+	function bp_get_group_member_joined_since() {
+		global $members_template;
+
+		return apply_filters( 'bp_get_group_member_joined_since', bp_core_get_last_activity( $members_template->member->date_modified, __( 'joined %s ago', 'buddypress') ) );
+	}
+
+function bp_group_member_id() {
+	echo bp_get_group_member_id();
+}
+	function bp_get_group_member_id() {
+		global $members_template;
+
+		return apply_filters( 'bp_get_group_member_id', $members_template->member->user_id );
+	}
+
+function bp_group_member_needs_pagination() {
+	global $members_template;
+
+	if ( $members_template->total_member_count > $members_template->pag_num )
+		return true;
+
+	return false;
+}
+
+function bp_group_pag_id() {
+	echo bp_get_group_pag_id();
+}
+	function bp_get_group_pag_id() {
+		global $bp;
+
+		return apply_filters( 'bp_get_group_pag_id', 'pag' );
+	}
+
+function bp_group_member_pagination() {
+	echo bp_get_group_member_pagination();
+	wp_nonce_field( 'bp_groups_member_list', '_member_pag_nonce' );
+}
+	function bp_get_group_member_pagination() {
+		global $members_template;
+		return apply_filters( 'bp_get_group_member_pagination', $members_template->pag_links );
+	}
+
+function bp_group_member_pagination_count() {
+	echo bp_get_group_member_pagination_count();
+}
+	function bp_get_group_member_pagination_count() {
+		global $members_template;
+
+		$start_num = intval( ( $members_template->pag_page - 1 ) * $members_template->pag_num ) + 1;
+		$from_num = bp_core_number_format( $start_num );
+		$to_num = bp_core_number_format( ( $start_num + ( $members_template->pag_num - 1 ) > $members_template->total_member_count ) ? $members_template->total_member_count : $start_num + ( $members_template->pag_num - 1 ) );
+		$total = bp_core_number_format( $members_template->total_member_count );
+
+		return apply_filters( 'bp_get_group_member_pagination_count', sprintf( __( 'Viewing members %1$s to %2$s (of %3$s members)', 'buddypress' ), $from_num, $to_num, $total ) );
+	}
+
+function bp_group_member_admin_pagination() {
+	echo bp_get_group_member_admin_pagination();
+	wp_nonce_field( 'bp_groups_member_admin_list', '_member_admin_pag_nonce' );
+}
+	function bp_get_group_member_admin_pagination() {
+		global $members_template;
+
+		return $members_template->pag_links;
+	}
+
+
+/***************************************************************************
+ * Group Creation Process Template Tags
+ **/
+
+function bp_group_creation_tabs() {
+	global $bp;
+
+	if ( !is_array( $bp->groups->group_creation_steps ) )
+		return false;
+
+	if ( !$bp->groups->current_create_step )
+		$bp->groups->current_create_step = array_shift( array_keys( $bp->groups->group_creation_steps ) );
+
+	$counter = 1;
+
+	foreach ( (array)$bp->groups->group_creation_steps as $slug => $step ) {
+		$is_enabled = bp_are_previous_group_creation_steps_complete( $slug ); ?>
+
+		<li<?php if ( $bp->groups->current_create_step == $slug ) : ?> class="current"<?php endif; ?>><?php if ( $is_enabled ) : ?><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/create/step/<?php echo $slug ?>/"><?php else: ?><span><?php endif; ?><?php echo $counter ?>. <?php echo $step['name'] ?><?php if ( $is_enabled ) : ?></a><?php else: ?></span><?php endif ?></li><?php
+		$counter++;
+	}
+
+	unset( $is_enabled );
+
+	do_action( 'groups_creation_tabs' );
+}
+
+function bp_group_creation_stage_title() {
+	global $bp;
+
+	echo apply_filters( 'bp_group_creation_stage_title', '<span>&mdash; ' . $bp->groups->group_creation_steps[$bp->groups->current_create_step]['name'] . '</span>' );
+}
+
+function bp_group_creation_form_action() {
+	echo bp_get_group_creation_form_action();
+}
+	function bp_get_group_creation_form_action() {
+		global $bp;
+
+		if ( empty( $bp->action_variables[1] ) )
+			$bp->action_variables[1] = array_shift( array_keys( $bp->groups->group_creation_steps ) );
+
+		return apply_filters( 'bp_get_group_creation_form_action', $bp->root_domain . '/' . $bp->groups->slug . '/create/step/' . $bp->action_variables[1] );
+	}
+
+function bp_is_group_creation_step( $step_slug ) {
+	global $bp;
+
+	/* Make sure we are in the groups component */
+	if ( $bp->current_component != BP_GROUPS_SLUG || 'create' != $bp->current_action )
+		return false;
+
+	/* If this the first step, we can just accept and return true */
+	if ( !$bp->action_variables[1] && array_shift( array_keys( $bp->groups->group_creation_steps ) ) == $step_slug )
+		return true;
+
+	/* Before allowing a user to see a group creation step we must make sure previous steps are completed */
+	if ( !bp_is_first_group_creation_step() ) {
+		if ( !bp_are_previous_group_creation_steps_complete( $step_slug ) )
+			return false;
+	}
+
+	/* Check the current step against the step parameter */
+	if ( $bp->action_variables[1] == $step_slug )
+		return true;
+
+	return false;
+}
+
+function bp_is_group_creation_step_complete( $step_slugs ) {
+	global $bp;
+
+	if ( !$bp->groups->completed_create_steps )
+		return false;
+
+	if ( is_array( $step_slugs ) ) {
+		$found = true;
+
+		foreach ( (array)$step_slugs as $step_slug ) {
+			if ( !in_array( $step_slug, $bp->groups->completed_create_steps ) )
+				$found = false;
+		}
+
+		return $found;
+	} else {
+		return in_array( $step_slugs, $bp->groups->completed_create_steps );
+	}
+
+	return true;
+}
+
+function bp_are_previous_group_creation_steps_complete( $step_slug ) {
+	global $bp;
+
+	/* If this is the first group creation step, return true */
+	if ( array_shift( array_keys( $bp->groups->group_creation_steps ) ) == $step_slug )
+		return true;
+
+	reset( $bp->groups->group_creation_steps );
+	unset( $previous_steps );
+
+	/* Get previous steps */
+	foreach ( (array)$bp->groups->group_creation_steps as $slug => $name ) {
+		if ( $slug == $step_slug )
+			break;
+
+		$previous_steps[] = $slug;
+	}
+
+	return bp_is_group_creation_step_complete( $previous_steps );
+}
+
+function bp_new_group_id() {
+	echo bp_get_new_group_id();
+}
+	function bp_get_new_group_id() {
+		global $bp;
+		return apply_filters( 'bp_get_new_group_id', $bp->groups->new_group_id );
+	}
+
+function bp_new_group_name() {
+	echo bp_get_new_group_name();
+}
+	function bp_get_new_group_name() {
+		global $bp;
+		return apply_filters( 'bp_get_new_group_name', $bp->groups->current_group->name );
+	}
+
+function bp_new_group_description() {
+	echo bp_get_new_group_description();
+}
+	function bp_get_new_group_description() {
+		global $bp;
+		return apply_filters( 'bp_get_new_group_description', $bp->groups->current_group->description );
+	}
+
+function bp_new_group_enable_forum() {
+	echo bp_get_new_group_enable_forum();
+}
+	function bp_get_new_group_enable_forum() {
+		global $bp;
+		return (int) apply_filters( 'bp_get_new_group_enable_forum', $bp->groups->current_group->enable_forum );
+	}
+
+function bp_new_group_status() {
+	echo bp_get_new_group_status();
+}
+	function bp_get_new_group_status() {
+		global $bp;
+		return apply_filters( 'bp_get_new_group_status', $bp->groups->current_group->status );
+	}
+
+function bp_new_group_avatar( $args = '' ) {
+	echo bp_get_new_group_avatar( $args );
+}
+	function bp_get_new_group_avatar( $args = '' ) {
+		global $bp;
+
+		$defaults = array(
+			'type' => 'full',
+			'width' => false,
+			'height' => false,
+			'class' => 'avatar',
+			'id' => 'avatar-crop-preview',
+			'alt' => __( 'Group avatar', 'buddypress' ),
+			'no_grav' => false
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		return apply_filters( 'bp_get_new_group_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->groups->current_group->id, 'object' => 'group', 'type' => $type, 'avatar_dir' => 'group-avatars', 'alt' => $alt, 'width' => $width, 'height' => $height, 'class' => $class, 'no_grav' => $no_grav ) ) );
+	}
+
+function bp_group_creation_previous_link() {
+	echo bp_get_group_creation_previous_link();
+}
+	function bp_get_group_creation_previous_link() {
+		global $bp;
+
+		foreach ( (array)$bp->groups->group_creation_steps as $slug => $name ) {
+			if ( $slug == $bp->action_variables[1] )
+				break;
+
+			$previous_steps[] = $slug;
+		}
+
+		return apply_filters( 'bp_get_group_creation_previous_link', $bp->loggedin_user->domain . $bp->groups->slug . '/create/step/' . array_pop( $previous_steps ) );
+	}
+
+function bp_is_last_group_creation_step() {
+	global $bp;
+
+	$last_step = array_pop( array_keys( $bp->groups->group_creation_steps ) );
+
+	if ( $last_step == $bp->groups->current_create_step )
+		return true;
+
+	return false;
+}
+
+function bp_is_first_group_creation_step() {
+	global $bp;
+
+	$first_step = array_shift( array_keys( $bp->groups->group_creation_steps ) );
+
+	if ( $first_step == $bp->groups->current_create_step )
+		return true;
+
+	return false;
+}
+
+function bp_new_group_invite_friend_list() {
+	echo bp_get_new_group_invite_friend_list();
+}
+	function bp_get_new_group_invite_friend_list( $args = '' ) {
+		global $bp;
+
+		if ( !function_exists('friends_install') )
+			return false;
+
+		$defaults = array(
+			'group_id' => false,
+			'separator' => 'li'
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		if ( !$group_id )
+			$group_id = ( $bp->groups->new_group_id ) ? $bp->groups->new_group_id : $bp->groups->current_group->id;
+
+		$friends = friends_get_friends_invite_list( $bp->loggedin_user->id, $group_id );
+
+		if ( $friends ) {
+			$invites = groups_get_invites_for_group( $bp->loggedin_user->id, $group_id );
+
+			for ( $i = 0; $i < count( $friends ); $i++ ) {
+				if ( $invites ) {
+					if ( in_array( $friends[$i]['id'], $invites ) ) {
+						$checked = ' checked="checked"';
+					} else {
+						$checked = '';
+					}
+				}
+
+				$items[] = '<' . $separator . '><input' . $checked . ' type="checkbox" name="friends[]" id="f-' . $friends[$i]['id'] . '" value="' . esc_attr( $friends[$i]['id'] ) . '" /> ' . $friends[$i]['full_name'] . '</' . $separator . '>';
+			}
+		}
+
+		return implode( "\n", (array)$items );
+	}
+
+function bp_directory_groups_search_form() {
+	global $bp;
+
+	$search_value = __( 'Search anything...', 'buddypress' );
+	if ( !empty( $_REQUEST['s'] ) )
+	 	$search_value = $_REQUEST['s'];
+
+?>
+	<form action="" method="get" id="search-groups-form">
+		<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
+}
+
+function bp_groups_header_tabs() {
+	global $bp, $create_group_step, $completed_to_step;
+?>
+	<li<?php if ( !isset($bp->action_variables[0]) || 'recently-active' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li>
+	<li<?php if ( 'recently-joined' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/recently-joined"><?php _e( 'Recently Joined', 'buddypress' ) ?></a></li>
+	<li<?php if ( 'most-popular' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/most-popular""><?php _e( 'Most Popular', 'buddypress' ) ?></a></li>
+	<li<?php if ( 'admin-of' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/admin-of""><?php _e( 'Administrator Of', 'buddypress' ) ?></a></li>
+	<li<?php if ( 'mod-of' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/mod-of""><?php _e( 'Moderator Of', 'buddypress' ) ?></a></li>
+	<li<?php if ( 'alphabetically' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/alphabetically""><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li>
+<?php
+	do_action( 'groups_header_tabs' );
+}
+
+function bp_groups_filter_title() {
+	global $bp;
+
+	$current_filter = $bp->action_variables[0];
+
+	switch ( $current_filter ) {
+		case 'recently-active': default:
+			_e( 'Recently Active', 'buddypress' );
+			break;
+		case 'recently-joined':
+			_e( 'Recently Joined', 'buddypress' );
+			break;
+		case 'most-popular':
+			_e( 'Most Popular', 'buddypress' );
+			break;
+		case 'admin-of':
+			_e( 'Administrator Of', 'buddypress' );
+			break;
+		case 'mod-of':
+			_e( 'Moderator Of', 'buddypress' );
+			break;
+		case 'alphabetically':
+			_e( 'Alphabetically', 'buddypress' );
+		break;
+	}
+	do_action( 'bp_groups_filter_title' );
+}
+
+function bp_is_group_admin_screen( $slug ) {
+	global $bp;
+
+	if ( $bp->current_component != BP_GROUPS_SLUG || 'admin' != $bp->current_action )
+		return false;
+
+	if ( $bp->action_variables[0] == $slug )
+		return true;
+
+	return false;
+}
+
+/************************************************************************************
+ * Group Avatar Template Tags
+ **/
+
+function bp_group_current_avatar() {
+	global $bp;
+
+	if ( $bp->groups->current_group->avatar_full ) { ?>
+		<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 }
+}
+
+function bp_get_group_has_avatar() {
+	global $bp;
+
+	if ( !empty( $_FILES ) || !bp_core_fetch_avatar( array( 'item_id' => $bp->groups->current_group->id, 'object' => 'group', 'no_grav' => true ) ) )
+		return false;
+
+	return true;
+}
+
+function bp_group_avatar_delete_link() {
+	echo bp_get_group_avatar_delete_link();
+}
+	function bp_get_group_avatar_delete_link() {
+		global $bp;
+
+		return apply_filters( 'bp_get_group_avatar_delete_link', wp_nonce_url( bp_get_group_permalink( $bp->groups->current_group ) . '/admin/group-avatar/delete', 'bp_group_avatar_delete' ) );
+	}
+
+function bp_group_avatar_edit_form() {
+	groups_avatar_upload();
+}
+
+function bp_custom_group_boxes() {
+	do_action( 'groups_custom_group_boxes' );
+}
+
+function bp_custom_group_admin_tabs() {
+	do_action( 'groups_custom_group_admin_tabs' );
+}
+
+function bp_custom_group_fields_editable() {
+	do_action( 'groups_custom_group_fields_editable' );
+}
+
+function bp_custom_group_fields() {
+	do_action( 'groups_custom_group_fields' );
+}
+
+
+/************************************************************************************
+ * Membership Requests Template Tags
+ **/
+
+class BP_Groups_Membership_Requests_Template {
+	var $current_request = -1;
+	var $request_count;
+	var $requests;
+	var $request;
+
+	var $in_the_loop;
+
+	var $pag_page;
+	var $pag_num;
+	var $pag_links;
+	var $total_request_count;
+
+	function bp_groups_membership_requests_template( $group_id, $per_page, $max ) {
+		global $bp;
+
+		$this->pag_page = isset( $_REQUEST['mrpage'] ) ? intval( $_REQUEST['mrpage'] ) : 1;
+		$this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
+
+		$this->requests = BP_Groups_Group::get_membership_requests( $group_id, $this->pag_num, $this->pag_page );
+
+		if ( !$max || $max >= (int)$this->requests['total'] )
+			$this->total_request_count = (int)$this->requests['total'];
+		else
+			$this->total_request_count = (int)$max;
+
+		$this->requests = $this->requests['requests'];
+
+		if ( $max ) {
+			if ( $max >= count($this->requests) )
+				$this->request_count = count($this->requests);
+			else
+				$this->request_count = (int)$max;
+		} else {
+			$this->request_count = count($this->requests);
+		}
+
+		$this->pag_links = paginate_links( array(
+			'base' => add_query_arg( 'mrpage', '%#%' ),
+			'format' => '',
+			'total' => ceil( $this->total_request_count / $this->pag_num ),
+			'current' => $this->pag_page,
+			'prev_text' => '&larr;',
+			'next_text' => '&rarr;',
+			'mid_size' => 1
+		));
+	}
+
+	function has_requests() {
+		if ( $this->request_count )
+			return true;
+
+		return false;
+	}
+
+	function next_request() {
+		$this->current_request++;
+		$this->request = $this->requests[$this->current_request];
+
+		return $this->request;
+	}
+
+	function rewind_requests() {
+		$this->current_request = -1;
+		if ( $this->request_count > 0 ) {
+			$this->request = $this->requests[0];
+		}
+	}
+
+	function requests() {
+		if ( $this->current_request + 1 < $this->request_count ) {
+			return true;
+		} elseif ( $this->current_request + 1 == $this->request_count ) {
+			do_action('loop_end');
+			// Do some cleaning up after the loop
+			$this->rewind_requests();
+		}
+
+		$this->in_the_loop = false;
+		return false;
+	}
+
+	function the_request() {
+		global $request;
+
+		$this->in_the_loop = true;
+		$this->request = $this->next_request();
+
+		if ( 0 == $this->current_request ) // loop has just started
+			do_action('loop_start');
+	}
+}
+
+function bp_group_has_membership_requests( $args = '' ) {
+	global $requests_template, $groups_template;
+
+	$defaults = array(
+		'group_id' => $groups_template->group->id,
+		'per_page' => 10,
+		'max' => false
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	$requests_template = new BP_Groups_Membership_Requests_Template( $group_id, $per_page, $max );
+	return apply_filters( 'bp_group_has_membership_requests', $requests_template->has_requests(), &$requests_template );
+}
+
+function bp_group_membership_requests() {
+	global $requests_template;
+
+	return $requests_template->requests();
+}
+
+function bp_group_the_membership_request() {
+	global $requests_template;
+
+	return $requests_template->the_request();
+}
+
+function bp_group_request_user_avatar_thumb() {
+	global $requests_template;
+
+	echo apply_filters( 'bp_group_request_user_avatar_thumb', bp_core_fetch_avatar( array( 'item_id' => $requests_template->request->user_id, 'type' => 'thumb' ) ) );
+}
+
+function bp_group_request_reject_link() {
+	echo bp_get_group_request_reject_link();
+}
+	function bp_get_group_request_reject_link() {
+		global $requests_template, $groups_template;
+
+		return apply_filters( 'bp_get_group_request_reject_link', wp_nonce_url( bp_get_group_permalink( $groups_template->group ) . '/admin/membership-requests/reject/' . $requests_template->request->id, 'groups_reject_membership_request' ) );
+	}
+
+function bp_group_request_accept_link() {
+	echo bp_get_group_request_accept_link();
+}
+	function bp_get_group_request_accept_link() {
+		global $requests_template, $groups_template;
+
+		return apply_filters( 'bp_get_group_request_accept_link', wp_nonce_url( bp_get_group_permalink( $groups_template->group ) . '/admin/membership-requests/accept/' . $requests_template->request->id, 'groups_accept_membership_request' ) );
+	}
+
+function bp_group_request_user_link() {
+	echo bp_get_group_request_user_link();
+}
+	function bp_get_group_request_user_link() {
+		global $requests_template;
+
+		return apply_filters( 'bp_get_group_request_user_link', bp_core_get_userlink( $requests_template->request->user_id ) );
+	}
+
+function bp_group_request_time_since_requested() {
+	global $requests_template;
+
+	echo apply_filters( 'bp_group_request_time_since_requested', sprintf( __( 'requested %s ago', 'buddypress' ), bp_core_time_since( strtotime( $requests_template->request->date_modified ) ) ) );
+}
+
+function bp_group_request_comment() {
+	global $requests_template;
+
+	echo apply_filters( 'bp_group_request_comment', strip_tags( stripslashes( $requests_template->request->comments ) ) );
+}
+
+/************************************************************************************
+ * Invite Friends Template Tags
+ **/
+
+class BP_Groups_Invite_Template {
+	var $current_invite = -1;
+	var $invite_count;
+	var $invites;
+	var $invite;
+
+	var $in_the_loop;
+
+	var $pag_page;
+	var $pag_num;
+	var $pag_links;
+	var $total_invite_count;
+
+	function bp_groups_invite_template( $user_id, $group_id ) {
+		global $bp;
+
+		$this->invites = groups_get_invites_for_group( $user_id, $group_id );
+		$this->invite_count = count( $this->invites );
+	}
+
+	function has_invites() {
+		if ( $this->invite_count )
+			return true;
+
+		return false;
+	}
+
+	function next_invite() {
+		$this->current_invite++;
+		$this->invite = $this->invites[$this->current_invite];
+
+		return $this->invite;
+	}
+
+	function rewind_invites() {
+		$this->current_invite = -1;
+		if ( $this->invite_count > 0 ) {
+			$this->invite = $this->invites[0];
+		}
+	}
+
+	function invites() {
+		if ( $this->current_invite + 1 < $this->invite_count ) {
+			return true;
+		} elseif ( $this->current_invite + 1 == $this->invite_count ) {
+			do_action('loop_end');
+			// Do some cleaning up after the loop
+			$this->rewind_invites();
+		}
+
+		$this->in_the_loop = false;
+		return false;
+	}
+
+	function the_invite() {
+		global $invite;
+
+		$this->in_the_loop = true;
+		$user_id = $this->next_invite();
+
+		$this->invite = new stdClass;
+		$this->invite->user = new BP_Core_User( $user_id );
+		$this->invite->group_id = $group_id; // Globaled in bp_group_has_invites()
+
+		if ( 0 == $this->current_invite ) // loop has just started
+			do_action('loop_start');
+	}
+}
+
+function bp_group_has_invites( $args = '' ) {
+	global $bp, $invites_template, $group_id;
+
+	$defaults = array(
+		'group_id' => false,
+		'user_id' => $bp->loggedin_user->id
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	if ( !$group_id ) {
+		/* Backwards compatibility */
+		if ( $bp->groups->current_group ) $group_id = $bp->groups->current_group->id;
+		if ( $bp->groups->new_group_id ) $group_id = $bp->groups->new_group_id;
+	}
+
+	if ( !$group_id )
+		return false;
+
+	$invites_template = new BP_Groups_Invite_Template( $user_id, $group_id );
+	return apply_filters( 'bp_group_has_invites', $invites_template->has_invites(), &$invites_template );
+}
+
+function bp_group_invites() {
+	global $invites_template;
+
+	return $invites_template->invites();
+}
+
+function bp_group_the_invite() {
+	global $invites_template;
+
+	return $invites_template->the_invite();
+}
+
+function bp_group_invite_item_id() {
+	echo bp_get_group_invite_item_id();
+}
+	function bp_get_group_invite_item_id() {
+		global $invites_template;
+
+		return apply_filters( 'bp_get_group_invite_item_id', 'uid-' . $invites_template->invite->user->id );
+	}
+
+function bp_group_invite_user_avatar() {
+	echo bp_get_group_invite_user_avatar();
+}
+	function bp_get_group_invite_user_avatar() {
+		global $invites_template;
+
+		return apply_filters( 'bp_get_group_invite_user_avatar', $invites_template->invite->user->avatar_thumb );
+	}
+
+function bp_group_invite_user_link() {
+	echo bp_get_group_invite_user_link();
+}
+	function bp_get_group_invite_user_link() {
+		global $invites_template;
+
+		return apply_filters( 'bp_get_group_invite_user_link', bp_core_get_userlink( $invites_template->invite->user->id ) );
+	}
+
+function bp_group_invite_user_last_active() {
+	echo bp_get_group_invite_user_last_active();
+}
+	function bp_get_group_invite_user_last_active() {
+		global $invites_template;
+
+		return apply_filters( 'bp_get_group_invite_user_last_active', $invites_template->invite->user->last_active );
+	}
+
+function bp_group_invite_user_remove_invite_url() {
+	echo bp_get_group_invite_user_remove_invite_url();
+}
+	function bp_get_group_invite_user_remove_invite_url() {
+		global $invites_template;
+
+		return wp_nonce_url( site_url( BP_GROUPS_SLUG . '/' . $invites_template->invite->group_id . '/invites/remove/' . $invites_template->invite->user->id ), 'groups_invite_uninvite_user' );
+	}
+
+/***
+ * Groups RSS Feed Template Tags
+ */
+
+function bp_group_activity_feed_link() {
+	echo bp_get_group_activity_feed_link();
+}
+	function bp_get_group_activity_feed_link() {
+		global $bp;
+
+		return apply_filters( 'bp_get_group_activity_feed_link', bp_get_group_permalink( $bp->groups->current_group ) . 'feed/' );
+	}
+
+function bp_current_group_name() {
+	echo bp_get_current_group_name();
+}
+	function bp_get_current_group_name() {
+		global $bp;
+
+		$name = apply_filters( 'bp_get_group_name', $bp->groups->current_group->name );
+		return apply_filters( 'bp_get_current_group_name', $name );
+	}
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-groups/bp-groups-widgets.php b/wp-content/plugins/buddypress/bp-groups/bp-groups-widgets.php
new file mode 100644
index 0000000000000000000000000000000000000000..c8784feeeced2ab6ac9a157d1e23c9952cbea958
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-groups/bp-groups-widgets.php
@@ -0,0 +1,142 @@
+<?php
+
+/* Register widgets for groups component */
+function groups_register_widgets() {
+	add_action('widgets_init', create_function('', 'return register_widget("BP_Groups_Widget");') );
+}
+add_action( 'bp_register_widgets', 'groups_register_widgets' );
+
+/*** GROUPS WIDGET *****************/
+
+class BP_Groups_Widget extends WP_Widget {
+	function bp_groups_widget() {
+		parent::WP_Widget( false, $name = __( 'Groups', 'buddypress' ) );
+
+		if ( is_active_widget( false, false, $this->id_base ) )
+			wp_enqueue_script( 'groups_widget_groups_list-js', BP_PLUGIN_URL . '/bp-groups/js/widget-groups.js', array('jquery') );
+	}
+
+	function widget($args, $instance) {
+		global $bp;
+
+	    extract( $args );
+
+		echo $before_widget;
+		echo $before_title
+		   . $widget_name
+		   . $after_title; ?>
+
+		<?php if ( bp_has_groups( 'type=popular&per_page=' . $instance['max_groups'] . '&max=' . $instance['max_groups'] ) ) : ?>
+			<div class="item-options" id="groups-list-options">
+				<span class="ajax-loader" id="ajax-loader-groups"></span>
+				<a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="newest-groups"><?php _e("Newest", 'buddypress') ?></a> |
+				<a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="recently-active-groups"><?php _e("Active", 'buddypress') ?></a> |
+				<a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="popular-groups" class="selected"><?php _e("Popular", 'buddypress') ?></a>
+			</div>
+
+			<ul id="groups-list" class="item-list">
+				<?php while ( bp_groups() ) : bp_the_group(); ?>
+					<li>
+						<div class="item-avatar">
+							<a href="<?php bp_group_permalink() ?>"><?php bp_group_avatar_thumb() ?></a>
+						</div>
+
+						<div class="item">
+							<div class="item-title"><a href="<?php bp_group_permalink() ?>" title="<?php bp_group_name() ?>"><?php bp_group_name() ?></a></div>
+							<div class="item-meta"><span class="activity"><?php bp_group_member_count() ?></span></div>
+						</div>
+					</li>
+
+				<?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 esc_attr( $instance['max_groups'] ); ?>" />
+
+		<?php else: ?>
+
+			<div class="widget-error">
+				<?php _e('There are no groups to display.', 'buddypress') ?>
+			</div>
+
+		<?php endif; ?>
+
+		<?php echo $after_widget; ?>
+	<?php
+	}
+
+	function update( $new_instance, $old_instance ) {
+		$instance = $old_instance;
+		$instance['max_groups'] = strip_tags( $new_instance['max_groups'] );
+
+		return $instance;
+	}
+
+	function form( $instance ) {
+		$instance = wp_parse_args( (array) $instance, array( 'max_groups' => 5 ) );
+		$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 esc_attr( $max_groups ); ?>" style="width: 30%" /></label></p>
+	<?php
+	}
+}
+
+function groups_ajax_widget_groups_list() {
+	global $bp;
+
+	check_ajax_referer('groups_widget_groups_list');
+
+	switch ( $_POST['filter'] ) {
+		case 'newest-groups':
+			$type = 'newest';
+		break;
+		case 'recently-active-groups':
+			$type = 'active';
+		break;
+		case 'popular-groups':
+			$type = 'popular';
+		break;
+	}
+
+	if ( bp_has_groups( 'type=' . $type . '&per_page=' . $_POST['max_groups'] . '&max=' . $_POST['max_groups'] ) ) : ?>
+		<?php echo "0[[SPLIT]]"; ?>
+
+		<ul id="groups-list" class="item-list">
+			<?php while ( bp_groups() ) : bp_the_group(); ?>
+				<li>
+					<div class="item-avatar">
+						<a href="<?php bp_group_permalink() ?>"><?php bp_group_avatar_thumb() ?></a>
+					</div>
+
+					<div class="item">
+						<div class="item-title"><a href="<?php bp_group_permalink() ?>" title="<?php bp_group_name() ?>"><?php bp_group_name() ?></a></div>
+						<div class="item-meta">
+							<span class="activity">
+								<?php
+								if ( 'newest-groups' == $_POST['filter'] ) {
+									printf( __( 'created %s ago', 'buddypress' ), bp_get_group_date_created() );
+								} else if ( 'recently-active-groups' == $_POST['filter'] ) {
+									printf( __( 'active %s ago', 'buddypress' ), bp_get_group_last_active() );
+								} else if ( 'popular-groups' == $_POST['filter'] ) {
+									bp_group_member_count();
+								}
+								?>
+							</span>
+						</div>
+					</div>
+				</li>
+
+			<?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 esc_attr( $_POST['max_groups'] ); ?>" />
+
+	<?php else: ?>
+
+		<?php echo "-1[[SPLIT]]<li>" . __("No groups matched the current filter.", 'buddypress'); ?>
+
+	<?php endif;
+
+}
+add_action( 'wp_ajax_widget_groups_list', 'groups_ajax_widget_groups_list' );
+?>
diff --git a/wp-content/plugins/buddypress/bp-groups/js/widget-groups.js b/wp-content/plugins/buddypress/bp-groups/js/widget-groups.js
new file mode 100644
index 0000000000000000000000000000000000000000..5748ef65a8a1dc92d008521b42ab1c1d67891463
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-groups/js/widget-groups.js
@@ -0,0 +1,48 @@
+jQuery(document).ready( function() {
+	jQuery(".widget div#groups-list-options a").live('click',
+		function() {
+			jQuery('#ajax-loader-groups').toggle();
+
+			jQuery(".widget div#groups-list-options a").removeClass("selected");
+			jQuery(this).addClass('selected');
+
+			jQuery.post( ajaxurl, {
+				action: 'widget_groups_list',
+				'cookie': encodeURIComponent(document.cookie),
+				'_wpnonce': jQuery("input#_wpnonce-groups").val(),
+				'max_groups': jQuery("input#groups_widget_max").val(),
+				'filter': jQuery(this).attr('id')
+			},
+			function(response)
+			{
+				jQuery('#ajax-loader-groups').toggle();
+				groups_wiget_response(response);
+			});
+
+			return false;
+		}
+	);
+});
+
+function groups_wiget_response(response) {
+	response = response.substr(0, response.length-1);
+	response = response.split('[[SPLIT]]');
+
+	if ( response[0] != "-1" ) {
+		jQuery(".widget ul#groups-list").fadeOut(200,
+			function() {
+				jQuery(".widget ul#groups-list").html(response[1]);
+				jQuery(".widget ul#groups-list").fadeIn(200);
+			}
+		);
+
+	} else {
+		jQuery(".widget ul#groups-list").fadeOut(200,
+			function() {
+				var message = '<p>' + response[1] + '</p>';
+				jQuery(".widget ul#groups-list").html(message);
+				jQuery(".widget ul#groups-list").fadeIn(200);
+			}
+		);
+	}
+}
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-languages/buddypress.pot b/wp-content/plugins/buddypress/bp-languages/buddypress.pot
new file mode 100644
index 0000000000000000000000000000000000000000..bb5084fbc72f6a024dd08aa4f336c33bfab19540
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-languages/buddypress.pot
@@ -0,0 +1,4378 @@
+# Translation of BuddyPress.
+# Copyright (C) 2010 BuddyPress
+# This file is distributed under the same license as the BuddyPress package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: BuddyPress \n"
+"Report-Msgid-Bugs-To: wp-polyglots@lists.automattic.com\n"
+"POT-Creation-Date: 2010-10-13 13:13+0000\n"
+"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: bp-activity.php:113 bp-activity.php:270
+#: bp-activity/feeds/bp-activity-personal-feed.php:21
+#: bp-themes/bp-default/header.php:53
+msgid "Activity"
+msgstr ""
+
+#: bp-activity.php:120
+msgid "Personal"
+msgstr ""
+
+#: bp-activity.php:123 bp-core/bp-core-admin.php:201 bp-friends.php:150
+msgid "Friends"
+msgstr ""
+
+#: bp-activity.php:126 bp-core/bp-core-admin.php:210
+#: bp-core/bp-core-templatetags.php:1029 bp-groups.php:986 bp-groups.php:1410
+#: bp-groups.php:1423 bp-groups.php:1436 bp-groups.php:1449
+#: bp-groups/bp-groups-widgets.php:13 bp-themes/bp-default/header.php:63
+msgid "Groups"
+msgstr ""
+
+#: bp-activity.php:128
+msgid "Favorites"
+msgstr ""
+
+#: bp-activity.php:129 bp-themes/bp-default/activity/index.php:50
+#, php-format
+msgid "@%s Mentions"
+msgstr ""
+
+#: bp-activity.php:133
+msgid "My Activity"
+msgstr ""
+
+#: bp-activity.php:251
+msgid "You do not have access to this activity."
+msgstr ""
+
+#: bp-activity.php:271 bp-blogs/bp-blogs-templatetags.php:409
+#: bp-core/bp-core-admin.php:60 bp-core/bp-core-admin.php:68
+#: bp-core/bp-core-admin.php:75 bp-core/bp-core-admin.php:82
+#: bp-core/bp-core-admin.php:90 bp-core/bp-core-admin.php:99
+#: bp-friends.php:151 bp-groups.php:987 bp-messages.php:245
+#: bp-themes/bp-default/groups/single/admin.php:26
+#: bp-themes/bp-default/registration/register.php:196
+#: bp-xprofile/bp-xprofile-admin.php:93
+msgid "Yes"
+msgstr ""
+
+#: bp-activity.php:272 bp-blogs/bp-blogs-templatetags.php:413
+#: bp-core/bp-core-admin.php:61 bp-core/bp-core-admin.php:69
+#: bp-core/bp-core-admin.php:76 bp-core/bp-core-admin.php:83
+#: bp-core/bp-core-admin.php:91 bp-core/bp-core-admin.php:100
+#: bp-friends.php:152 bp-groups.php:988 bp-messages.php:246
+#: bp-themes/bp-default/groups/single/admin.php:27
+#: bp-themes/bp-default/registration/register.php:197
+msgid "No"
+msgstr ""
+
+#: bp-activity.php:279
+#, php-format
+msgid "A member mentions you in an update using \"@%s\""
+msgstr ""
+
+#: bp-activity.php:285
+msgid "A member replies to an update or comment you've posted"
+msgstr ""
+
+#: bp-activity.php:366
+msgid "Activity deleted"
+msgstr ""
+
+#: bp-activity.php:368
+msgid "There was an error when deleting that activity"
+msgstr ""
+
+#: bp-activity.php:388 bp-themes/bp-default/_inc/ajax.php:124
+msgid "Please enter some content to post."
+msgstr ""
+
+#: bp-activity.php:403
+msgid "Update Posted!"
+msgstr ""
+
+#: bp-activity.php:405
+msgid "There was an error when posting your update, please try again."
+msgstr ""
+
+#: bp-activity.php:424 bp-themes/bp-default/_inc/ajax.php:162
+msgid "Please do not leave the comment area blank."
+msgstr ""
+
+#: bp-activity.php:435
+msgid "Reply Posted!"
+msgstr ""
+
+#: bp-activity.php:437 bp-themes/bp-default/_inc/ajax.php:167
+#: bp-themes/bp-default/_inc/ajax.php:178
+msgid "There was an error posting that reply, please try again."
+msgstr ""
+
+#: bp-activity.php:453
+msgid "Activity marked as favorite."
+msgstr ""
+
+#: bp-activity.php:455
+msgid ""
+"There was an error marking that activity as a favorite, please try again."
+msgstr ""
+
+#: bp-activity.php:471
+msgid "Activity removed as favorite."
+msgstr ""
+
+#: bp-activity.php:473
+msgid ""
+"There was an error removing that activity as a favorite, please try again."
+msgstr ""
+
+#: bp-activity.php:699
+#, php-format
+msgid "%s posted an update:"
+msgstr ""
+
+#: bp-activity.php:752
+#, php-format
+msgid "%s posted a new activity comment:"
+msgstr ""
+
+#: bp-activity.php:967
+msgid "Thumbnail"
+msgstr ""
+
+#: bp-activity.php:1195
+msgid "Posted an update"
+msgstr ""
+
+#: bp-activity/bp-activity-notifications.php:32
+#, php-format
+msgid "%s mentioned you in an update"
+msgstr ""
+
+#: bp-activity/bp-activity-notifications.php:35
+#, php-format
+msgid ""
+"%s mentioned you in an update:\n"
+"\n"
+"\"%s\"\n"
+"\n"
+"To view and respond to the message, log in and visit: %s\n"
+"\n"
+"---------------------\n"
+msgstr ""
+
+#: 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:76
+#, php-format
+msgid "%s replied to one of your updates"
+msgstr ""
+
+#: bp-activity/bp-activity-notifications.php:79
+#, php-format
+msgid ""
+"%s replied to one of your updates:\n"
+"\n"
+"\"%s\"\n"
+"\n"
+"To view your original update and all comments, log in and visit: %s\n"
+"\n"
+"---------------------\n"
+msgstr ""
+
+#: bp-activity/bp-activity-notifications.php:116
+#, php-format
+msgid "%s replied to one of your comments"
+msgstr ""
+
+#: bp-activity/bp-activity-notifications.php:122
+#, php-format
+msgid ""
+"%s replied to one of your comments:\n"
+"\n"
+"\"%s\"\n"
+"\n"
+"To view the original activity, your comment and all replies, log in and "
+"visit: %s\n"
+"\n"
+"---------------------\n"
+msgstr ""
+
+#: bp-activity/bp-activity-templatetags.php:278
+#, php-format
+msgid "Viewing item %1$s to %2$s (of %3$s items)"
+msgstr ""
+
+#: bp-activity/bp-activity-templatetags.php:430
+#: bp-activity/bp-activity-templatetags.php:476 bp-groups.php:93
+msgid "Avatar"
+msgstr ""
+
+#: bp-activity/bp-activity-templatetags.php:577
+#, php-format
+msgid "&nbsp; %s ago"
+msgstr ""
+
+#: bp-activity/bp-activity-templatetags.php:580
+#: bp-themes/bp-default/activity/entry.php:46
+msgid "View Thread / Permalink"
+msgstr ""
+
+#: bp-activity/bp-activity-templatetags.php:580
+#: bp-activity/bp-activity-templatetags.php:817
+#: bp-core/bp-core-templatetags.php:379
+#: bp-themes/bp-default/activity/entry.php:46
+msgid "View"
+msgstr ""
+
+#: bp-activity/bp-activity-templatetags.php:660
+#: bp-themes/bp-default/_inc/ajax.php:190
+#, php-format
+msgid "%s ago"
+msgstr ""
+
+#: bp-activity/bp-activity-templatetags.php:664
+#: bp-themes/bp-default/_inc/ajax.php:191
+#: bp-themes/bp-default/activity/entry.php:28
+msgid "Reply"
+msgstr ""
+
+#: bp-activity/bp-activity-templatetags.php:668
+#: bp-activity/bp-activity-templatetags.php:801
+#: bp-forums/bp-forums-templatetags.php:976
+#: bp-themes/bp-default/_inc/ajax.php:192 bp-xprofile/bp-xprofile-admin.php:68
+#: bp-xprofile/bp-xprofile-admin.php:95
+msgid "Delete"
+msgstr ""
+
+#: bp-activity/bp-activity-templatetags.php:877
+msgid "profile"
+msgstr ""
+
+#: bp-activity/bp-activity-templatetags.php:877
+msgid "friends"
+msgstr ""
+
+#: bp-activity/bp-activity-templatetags.php:877 bp-core/bp-core-classes.php:98
+msgid "groups"
+msgstr ""
+
+#: bp-activity/bp-activity-templatetags.php:877
+msgid "status"
+msgstr ""
+
+#: bp-activity/bp-activity-templatetags.php:877
+msgid "blogs"
+msgstr ""
+
+#: bp-activity/bp-activity-templatetags.php:885
+msgid "Clear Filter"
+msgstr ""
+
+#: bp-activity/bp-activity-templatetags.php:956
+msgid ""
+"Mention this user in a new public message, this will send the user a "
+"notification to get their attention."
+msgstr ""
+
+#: bp-activity/bp-activity-templatetags.php:957
+msgid "Mention this User"
+msgstr ""
+
+#: bp-activity/feeds/bp-activity-favorites-feed.php:21
+#: bp-activity/feeds/bp-activity-favorites-feed.php:24
+msgid "Favorite Activity"
+msgstr ""
+
+#: bp-activity/feeds/bp-activity-favorites-feed.php:48
+#: bp-activity/feeds/bp-activity-friends-feed.php:44
+#: bp-activity/feeds/bp-activity-group-feed.php:43
+#: bp-activity/feeds/bp-activity-mentions-feed.php:43
+#: bp-activity/feeds/bp-activity-mygroups-feed.php:48
+#: bp-activity/feeds/bp-activity-personal-feed.php:43
+#: bp-activity/feeds/bp-activity-sitewide-feed.php:44
+#, php-format
+msgid "Comments: %s"
+msgstr ""
+
+#: bp-activity/feeds/bp-activity-favorites-feed.php:52
+#: bp-activity/feeds/bp-activity-friends-feed.php:48
+#: bp-activity/feeds/bp-activity-mentions-feed.php:47
+#: bp-activity/feeds/bp-activity-personal-feed.php:47
+#: bp-themes/bp-default/activity/entry.php:45
+msgid "In reply to"
+msgstr ""
+
+#: bp-activity/feeds/bp-activity-friends-feed.php:21
+msgid "Friends Activity"
+msgstr ""
+
+#: bp-activity/feeds/bp-activity-friends-feed.php:24
+#, php-format
+msgid "%s - Friends Activity Feed"
+msgstr ""
+
+#: bp-activity/feeds/bp-activity-group-feed.php:21
+msgid "Group Activity"
+msgstr ""
+
+#: bp-activity/feeds/bp-activity-group-feed.php:24
+#, php-format
+msgid "%s - Group Activity Feed"
+msgstr ""
+
+#: bp-activity/feeds/bp-activity-mentions-feed.php:21
+#: bp-activity/feeds/bp-activity-mentions-feed.php:24
+msgid "Mentions"
+msgstr ""
+
+#: bp-activity/feeds/bp-activity-mygroups-feed.php:21
+#: bp-activity/feeds/bp-activity-mygroups-feed.php:24
+msgid "My Groups - Public Activity"
+msgstr ""
+
+#: bp-activity/feeds/bp-activity-personal-feed.php:24
+#, php-format
+msgid "%s - Activity Feed"
+msgstr ""
+
+#: bp-activity/feeds/bp-activity-sitewide-feed.php:22
+msgid "Site Wide Activity"
+msgstr ""
+
+#: bp-activity/feeds/bp-activity-sitewide-feed.php:25
+msgid "Site Wide Activity Feed"
+msgstr ""
+
+#: bp-blogs.php:109
+#, php-format
+msgid "Blogs <span>(%d)</span>"
+msgstr ""
+
+#: bp-blogs.php:117 bp-core/bp-core-adminbar.php:113
+msgid "My Blogs"
+msgstr ""
+
+#: bp-blogs.php:190
+msgid "New blog created"
+msgstr ""
+
+#: bp-blogs.php:191
+msgid "New blog post published"
+msgstr ""
+
+#: bp-blogs.php:192
+msgid "New blog post comment posted"
+msgstr ""
+
+#: bp-blogs.php:360
+#, php-format
+msgid "%s created the blog %s"
+msgstr ""
+
+#: bp-blogs.php:423
+#, php-format
+msgid "%s wrote a new blog post: %s"
+msgstr ""
+
+#: bp-blogs.php:497
+#, php-format
+msgid "%s commented on the blog post %s"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:173
+#, php-format
+msgid "Viewing blog %1$s to %2$s (of %3$s blogs)"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:198
+msgid "Blog avatar"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:256 bp-core/bp-core-classes.php:82
+#: bp-core/bp-core-templatetags.php:355 bp-core/bp-core-templatetags.php:1327
+#: bp-groups/bp-groups-widgets.php:119
+#: bp-themes/bp-default/groups/groups-loop.php:31
+#: bp-themes/bp-default/groups/single/group-header.php:31
+#, php-format
+msgid "active %s ago"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:268
+#, php-format
+msgid "Latest Post: %s"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:340
+msgid "There was a problem, please correct the form below and try again."
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:343
+msgid ""
+"By filling out the form below, you can <strong>add a blog to your account</"
+"strong>. There is no limit to the number of blogs you can have, so create to "
+"your heart's content, but blog responsibly."
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:345
+msgid ""
+"If you&#8217;re not going to use a great blog domain, leave it for a new "
+"user. Now have at it!"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:354
+msgid "Create Blog &rarr;"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:368
+msgid "Blog Name:"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:370
+msgid "Blog Domain:"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:382
+msgid "Your address will be "
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:385
+msgid "blogname"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:387
+msgid "domain."
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:390
+msgid ""
+"Must be at least 4 characters, letters and numbers only. It cannot be "
+"changed so choose carefully!)"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:395
+msgid "Blog Title:"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:403
+msgid "Privacy:"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:404
+msgid ""
+"I would like my blog to appear in search engines like Google and Technorati, "
+"and in public listings around this site."
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:464
+msgid "Congratulations! You have successfully registered a new blog."
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:466
+#, php-format
+msgid ""
+"<a href=\"http://%1$s\">http://%2$s</a> is your new blog.  <a href=\"%3$s"
+"\">Login</a> as \"%4$s\" using your existing password."
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:476 bp-core/bp-core-templatetags.php:928
+#: bp-themes/bp-default/blogs/create.php:10
+#: bp-themes/bp-default/blogs/index.php:8
+msgid "Create a Blog"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:490
+#, php-format
+msgid "%s's Blogs"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:491
+#, php-format
+msgid "%s's Recent Posts"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:492
+#, php-format
+msgid "%s's Recent Comments"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:501 bp-core/bp-core-templatetags.php:447
+#: bp-core/bp-core-templatetags.php:453
+#: bp-forums/bp-forums-templatetags.php:1026
+#: bp-forums/bp-forums-templatetags.php:1032
+#: bp-groups/bp-groups-templatetags.php:1810
+#: bp-groups/bp-groups-templatetags.php:1816
+#: bp-themes/bp-default/_inc/ajax.php:56
+msgid "Search anything..."
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:502 bp-core/bp-core-templatetags.php:454
+#: bp-core/bp-core-templatetags.php:1048
+#: bp-forums/bp-forums-templatetags.php:1033
+#: bp-groups/bp-groups-templatetags.php:1817
+#: bp-themes/bp-default/header.php:93 bp-themes/bp-default/searchform.php:5
+msgid "Search"
+msgstr ""
+
+#: bp-blogs/bp-blogs-templatetags.php:534
+#: bp-blogs/bp-blogs-templatetags.php:535
+msgid "Visit Blog"
+msgstr ""
+
+#: bp-blogs/bp-blogs-widgets.php:18
+msgid "Recent Site Wide Posts"
+msgstr ""
+
+#: bp-blogs/bp-blogs-widgets.php:60
+msgid "Sorry, there were no blog posts found. Why not write one?"
+msgstr ""
+
+#: bp-blogs/bp-blogs-widgets.php:80
+msgid "Max posts to show:"
+msgstr ""
+
+#: bp-core.php:306 bp-core.php:307
+msgid "BuddyPress"
+msgstr ""
+
+#: bp-core.php:313 bp-core/bp-core-settings.php:69
+msgid "General Settings"
+msgstr ""
+
+#: bp-core.php:314
+msgid "Component Setup"
+msgstr ""
+
+#: bp-core.php:359 bp-xprofile.php:172
+msgid "Profile"
+msgstr ""
+
+#: bp-core.php:370 bp-groups/bp-groups-templatetags.php:419
+#: bp-xprofile.php:177
+msgid "Public"
+msgstr ""
+
+#: bp-core.php:380 bp-core/bp-core-templatetags.php:736
+#: bp-themes/bp-default/activity/post-form.php:41 bp-xprofile.php:183
+msgid "My Profile"
+msgstr ""
+
+#: bp-core.php:476
+msgid "User marked as spammer. Spam users are visible only to site admins."
+msgstr ""
+
+#: bp-core.php:478
+msgid "User removed as spammer."
+msgstr ""
+
+#: bp-core.php:512
+#, php-format
+msgid "%s has been deleted from the system."
+msgstr ""
+
+#: bp-core.php:514
+#, php-format
+msgid "There was an error deleting %s from the system. Please try again."
+msgstr ""
+
+#: bp-core.php:1417
+msgid "year"
+msgstr ""
+
+#: bp-core.php:1417
+msgid "years"
+msgstr ""
+
+#: bp-core.php:1418
+msgid "month"
+msgstr ""
+
+#: bp-core.php:1418
+msgid "months"
+msgstr ""
+
+#: bp-core.php:1419
+msgid "week"
+msgstr ""
+
+#: bp-core.php:1419
+msgid "weeks"
+msgstr ""
+
+#: bp-core.php:1420
+msgid "day"
+msgstr ""
+
+#: bp-core.php:1420
+msgid "days"
+msgstr ""
+
+#: bp-core.php:1421
+msgid "hour"
+msgstr ""
+
+#: bp-core.php:1421
+msgid "hours"
+msgstr ""
+
+#: bp-core.php:1422
+msgid "minute"
+msgstr ""
+
+#: bp-core.php:1422
+msgid "minutes"
+msgstr ""
+
+#: bp-core.php:1423
+msgid "second"
+msgstr ""
+
+#: bp-core.php:1423 bp-core.php:1475
+msgid "seconds"
+msgstr ""
+
+#: bp-core.php:1442
+msgid "sometime"
+msgstr ""
+
+#: bp-core.php:1470
+msgctxt "Separator in time since"
+msgid ","
+msgstr ""
+
+#: bp-core.php:1525
+msgid "not recently active"
+msgstr ""
+
+#: bp-core.php:1989
+msgid ""
+"IMPORTANT: <a href=\"http://codex.buddypress.org/getting-started/upgrading-"
+"from-10x/\">Read this before attempting to update BuddyPress</a>"
+msgstr ""
+
+#: bp-core.php:2018
+#, php-format
+msgid ""
+"<strong>BuddyPress is almost ready</strong>. You must <a href=\"%s\">update "
+"your permalink structure</a> to something other than the default for it to "
+"work."
+msgstr ""
+
+#: bp-core.php:2027
+#, php-format
+msgid ""
+"<strong>BuddyPress is ready</strong>. You'll need to <a href='%s'>activate a "
+"BuddyPress compatible theme</a> to take advantage of all of the features. "
+"We've bundled a default theme, but you can always <a href='%s'>install some "
+"other compatible themes</a> or <a href='%s'>upgrade your existing WordPress "
+"theme</a>."
+msgstr ""
+
+#: bp-core/bp-core-admin.php:32
+msgid "BuddyPress Settings"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:36 bp-core/bp-core-admin.php:160
+msgid "Settings Saved"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:46
+msgid "Base profile group name"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:52
+msgid "Full Name field name"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:58
+msgid "Disable BuddyPress to WordPress profile syncing?"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:66
+msgid "Hide admin bar for logged out users?"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:73
+msgid "Disable avatar uploads? (Gravatars will still work)"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:80
+msgid "Disable user account deletion?"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:88
+msgid "Disable global forum directory?"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:97
+msgid "Disable activity stream commenting on blog and forum posts?"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:106
+msgid "Default User Avatar"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:108
+msgid ""
+"For users without a custom avatar of their own, you can either display a "
+"generic logo or a generated one based on their email address"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:110
+msgid "Mystery Man"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:111
+msgid "Identicon (Generated)"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:112
+msgid "Wavatar (Generated)"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:113
+msgid "MonsterID (Generated)"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:124 bp-core/bp-core-admin.php:239
+msgid "Save Settings"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:156
+msgid "BuddyPress Component Setup"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:166
+msgid ""
+"By default, all BuddyPress components are enabled. You can selectively "
+"disable any of the components by using the form below. Your BuddyPress "
+"installation will continue to function, however the features of the disabled "
+"components will no longer be accessible to anyone using the site."
+msgstr ""
+
+#: bp-core/bp-core-admin.php:174
+msgid "Activity Streams"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:174
+msgid ""
+"Allow users to post activity updates and track all activity across the "
+"entire site."
+msgstr ""
+
+#: bp-core/bp-core-admin.php:176 bp-core/bp-core-admin.php:185
+#: bp-core/bp-core-admin.php:194 bp-core/bp-core-admin.php:203
+#: bp-core/bp-core-admin.php:212 bp-core/bp-core-admin.php:221
+#: bp-core/bp-core-admin.php:230
+msgid "Enabled"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:177 bp-core/bp-core-admin.php:186
+#: bp-core/bp-core-admin.php:195 bp-core/bp-core-admin.php:204
+#: bp-core/bp-core-admin.php:213 bp-core/bp-core-admin.php:222
+#: bp-core/bp-core-admin.php:231
+msgid "Disabled"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:183
+msgid "Blog Tracking"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:183
+msgid ""
+"Tracks blogs, blog posts and blogs comments for a user across a WPMU "
+"installation."
+msgstr ""
+
+#: bp-core/bp-core-admin.php:192
+msgid "bbPress Forums"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:192
+msgid ""
+"Activates bbPress forum support within BuddyPress groups or any other custom "
+"component."
+msgstr ""
+
+#: bp-core/bp-core-admin.php:201
+msgid "Allows the creation of friend connections between users."
+msgstr ""
+
+#: bp-core/bp-core-admin.php:210
+msgid "Let users create, join and participate in groups."
+msgstr ""
+
+#: bp-core/bp-core-admin.php:219
+msgid "Private Messaging"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:219
+msgid ""
+"Let users send private messages to one another. Site admins can also send "
+"site-wide notices."
+msgstr ""
+
+#: bp-core/bp-core-admin.php:228
+msgid "Extended Profiles"
+msgstr ""
+
+#: bp-core/bp-core-admin.php:228
+msgid "Activates customizable profiles and avatars for site users."
+msgstr ""
+
+#: bp-core/bp-core-adminbar.php:44 bp-themes/bp-default/sidebar.php:50
+msgid "Log In"
+msgstr ""
+
+#: bp-core/bp-core-adminbar.php:48
+msgid "Sign Up"
+msgstr ""
+
+#: bp-core/bp-core-adminbar.php:62
+msgid "My Account"
+msgstr ""
+
+#: bp-core/bp-core-adminbar.php:94 bp-core/bp-core-templatetags.php:516
+#: bp-core/bp-core-templatetags.php:518 bp-core/bp-core-templatetags.php:1059
+#: bp-core/bp-core-templatetags.php:1061 bp-themes/bp-default/sidebar.php:18
+msgid "Log Out"
+msgstr ""
+
+#: bp-core/bp-core-adminbar.php:128
+msgid "Dashboard"
+msgstr ""
+
+#: bp-core/bp-core-adminbar.php:129
+msgid "New Post"
+msgstr ""
+
+#: bp-core/bp-core-adminbar.php:130
+msgid "Manage Posts"
+msgstr ""
+
+#: bp-core/bp-core-adminbar.php:131
+msgid "Manage Comments"
+msgstr ""
+
+#: bp-core/bp-core-adminbar.php:143
+msgid "Create a Blog!"
+msgstr ""
+
+#: bp-core/bp-core-adminbar.php:159 bp-core/bp-core-settings.php:22
+msgid "Notifications"
+msgstr ""
+
+#: bp-core/bp-core-adminbar.php:177
+msgid "No new notifications."
+msgstr ""
+
+#: bp-core/bp-core-adminbar.php:198
+msgid "Blog Authors"
+msgstr ""
+
+#: bp-core/bp-core-adminbar.php:222
+msgid "Visit"
+msgstr ""
+
+#: bp-core/bp-core-adminbar.php:224
+msgid "Random Member"
+msgstr ""
+
+#: bp-core/bp-core-adminbar.php:227
+msgid "Random Group"
+msgstr ""
+
+#: bp-core/bp-core-adminbar.php:231
+msgid "Random Blog"
+msgstr ""
+
+#: bp-core/bp-core-avatars.php:67
+msgid "Avatar Image"
+msgstr ""
+
+#: bp-core/bp-core-avatars.php:332
+msgid "There is no error, the file uploaded with success"
+msgstr ""
+
+#: bp-core/bp-core-avatars.php:333 bp-core/bp-core-avatars.php:334
+msgid "Your image was bigger than the maximum allowed file size of: "
+msgstr ""
+
+#: bp-core/bp-core-avatars.php:335
+msgid "The uploaded file was only partially uploaded"
+msgstr ""
+
+#: bp-core/bp-core-avatars.php:336
+msgid "No file was uploaded"
+msgstr ""
+
+#: bp-core/bp-core-avatars.php:337
+msgid "Missing a temporary folder"
+msgstr ""
+
+#: bp-core/bp-core-avatars.php:341
+#, php-format
+msgid "Your upload failed, please try again. Error was: %s"
+msgstr ""
+
+#: bp-core/bp-core-avatars.php:346
+#, php-format
+msgid "The file you uploaded is too big. Please upload a file under %s"
+msgstr ""
+
+#: bp-core/bp-core-avatars.php:351
+msgid "Please upload only JPG, GIF or PNG photos."
+msgstr ""
+
+#: bp-core/bp-core-avatars.php:362 bp-core/bp-core-avatars.php:375
+#, php-format
+msgid "Upload Failed! Error was: %s"
+msgstr ""
+
+#: bp-core/bp-core-catchuri.php:262
+msgid ""
+"This user has been marked as a spammer. Only site admins can view this "
+"profile."
+msgstr ""
+
+#: bp-core/bp-core-classes.php:96
+msgid "group"
+msgstr ""
+
+#: bp-core/bp-core-cssjs.php:56
+msgid "Are you sure?"
+msgstr ""
+
+#: bp-core/bp-core-filters.php:29
+msgid "noreply"
+msgstr ""
+
+#: bp-core/bp-core-filters.php:133 bp-core/bp-core-filters.php:157
+msgid "[User Set]"
+msgstr ""
+
+#: bp-core/bp-core-filters.php:177
+#, php-format
+msgid ""
+"Thanks for registering! To complete the activation of your account and blog, "
+"please click the following link:\n"
+"\n"
+"%s\n"
+"\n"
+"\n"
+"\n"
+"After you activate, you can visit your blog here:\n"
+"\n"
+"%s"
+msgstr ""
+
+#: bp-core/bp-core-filters.php:178
+#, php-format
+msgid "Activate %s"
+msgstr ""
+
+#: bp-core/bp-core-filters.php:209 bp-core/bp-core-signup.php:585
+#, php-format
+msgid ""
+"Thanks for registering! To complete the activation of your account please "
+"click the following link:\n"
+"\n"
+"%s\n"
+"\n"
+msgstr ""
+
+#: bp-core/bp-core-filters.php:210 bp-core/bp-core-signup.php:586
+msgid "Activate Your Account"
+msgstr ""
+
+#: bp-core/bp-core-settings.php:17 bp-groups.php:92
+msgid "Settings"
+msgstr ""
+
+#: bp-core/bp-core-settings.php:21
+msgid "General"
+msgstr ""
+
+#: bp-core/bp-core-settings.php:25 bp-core/bp-core-settings.php:176
+msgid "Delete Account"
+msgstr ""
+
+#: bp-core/bp-core-settings.php:77 bp-core/bp-core-settings.php:138
+msgid "Changes Saved."
+msgstr ""
+
+#: bp-core/bp-core-settings.php:83
+msgid "Your passwords did not match"
+msgstr ""
+
+#: bp-core/bp-core-settings.php:88
+msgid "Account Email"
+msgstr ""
+
+#: bp-core/bp-core-settings.php:91
+msgid "Change Password <span>(leave blank for no change)</span>"
+msgstr ""
+
+#: bp-core/bp-core-settings.php:92
+msgid "New Password"
+msgstr ""
+
+#: bp-core/bp-core-settings.php:93
+msgid "Repeat New Password"
+msgstr ""
+
+#: bp-core/bp-core-settings.php:96 bp-core/bp-core-settings.php:149
+#: bp-themes/bp-default/groups/single/admin.php:32
+#: bp-themes/bp-default/groups/single/admin.php:100
+#: bp-themes/bp-default/groups/single/forum/edit.php:34
+#: bp-themes/bp-default/groups/single/forum/edit.php:52
+#: bp-themes/bp-default/members/single/profile/edit.php:111
+msgid "Save Changes"
+msgstr ""
+
+#: bp-core/bp-core-settings.php:130
+msgid "Notification Settings"
+msgstr ""
+
+#: bp-core/bp-core-settings.php:143
+msgid "Email Notifications"
+msgstr ""
+
+#: bp-core/bp-core-settings.php:144
+msgid "Send a notification by email when:"
+msgstr ""
+
+#: 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:188
+msgid "I understand the consequences of deleting my account."
+msgstr ""
+
+#: bp-core/bp-core-settings.php:191
+msgid "Delete My Account"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:47
+msgid "Please make sure you enter your password twice"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:51
+msgid "The passwords you entered do not match."
+msgstr ""
+
+#: bp-core/bp-core-signup.php:74
+msgid "This is a required field"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:168
+msgid ""
+"There was a problem uploading your avatar, please try uploading it again"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:198 bp-xprofile.php:386
+msgid "There was a problem cropping your avatar, please try uploading it again"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:200
+msgid "Your new avatar was uploaded successfully"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:222 bp-core/bp-core-signup.php:455
+msgid "There was an error activating your account, please try again."
+msgstr ""
+
+#: bp-core/bp-core-signup.php:236
+msgid "Your account is now active!"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:318
+msgid "Please enter a username"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:327
+msgid "Only lowercase letters and numbers allowed"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:330
+msgid "Username must be at least 4 characters"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:333
+msgid "Sorry, usernames may not contain the character \"_\"!"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:340
+msgid "Sorry, usernames must have letters too!"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:343
+msgid "Please check your email address."
+msgstr ""
+
+#: bp-core/bp-core-signup.php:351
+msgid "Sorry, that email address is not allowed!"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:356
+msgid "Sorry, that username already exists!"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:360
+msgid "Sorry, that email address is already used!"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:395
+#, php-format
+msgid ""
+"<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a "
+"href=\"mailto:%s\">webmaster</a> !"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:480 bp-core/bp-core-signup.php:484
+msgid "Invalid activation key"
+msgstr ""
+
+#: bp-core/bp-core-signup.php:527
+#, php-format
+msgid "%s became a registered member"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:184
+#, php-format
+msgid "Viewing member %1$s to %2$s (of %3$s active members)"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:186
+#, php-format
+msgid "Viewing member %1$s to %2$s (of %3$s members with friends)"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:188
+#, php-format
+msgid "Viewing member %1$s to %2$s (of %3$s members online)"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:190
+#, php-format
+msgid "Viewing member %1$s to %2$s (of %3$s members)"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:314
+msgid "Member avatar"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:415
+#, php-format
+msgid "registered %s ago"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:599
+msgid "Options"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:742 bp-themes/bp-default/comments.php:120
+msgid "Name"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:752
+msgid "About Me"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:762 bp-themes/bp-default/comments.php:130
+msgid "Website"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:772
+msgid "Jabber"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:782
+msgid "AOL Messenger"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:792
+msgid "Yahoo Messenger"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:834
+#, php-format
+msgid "%1$s at %2$s"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:892 bp-groups.php:201
+#: bp-themes/bp-default/header.php:44 bp-themes/bp-default/header.php:48
+msgid "Home"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:896
+msgid "Blog &#124; "
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:898
+msgid "Blog &#124; Categories &#124; "
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:900
+msgid "Blog &#124; Tags &#124; "
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:904 bp-themes/bp-default/attachment.php:9
+#: bp-themes/bp-default/search.php:10
+msgid "Blog"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:914 bp-core/bp-core-templatetags.php:916
+#, php-format
+msgid "%s Directory"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:919
+#: bp-themes/bp-default/registration/register.php:14
+msgid "Create an Account"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:922
+#: bp-themes/bp-default/registration/activate.php:28
+msgid "Activate your Account"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:925
+#: bp-themes/bp-default/groups/create.php:7
+#: bp-themes/bp-default/groups/index.php:7
+msgid "Create a Group"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:1026 bp-core/bp-core-widgets.php:15
+#: bp-themes/bp-default/groups/single/admin.php:174
+#: bp-themes/bp-default/header.php:58
+msgid "Members"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:1032 bp-forums/bp-forums-admin.php:159
+#: bp-themes/bp-default/header.php:68
+msgid "Forums"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:1035 bp-themes/bp-default/header.php:75
+msgid "Blogs"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:1213
+msgid "Your Avatar"
+msgstr ""
+
+#: bp-core/bp-core-templatetags.php:1286
+msgid "a user"
+msgstr ""
+
+#: bp-core/bp-core-widgets.php:34 bp-friends/bp-friends-templatetags.php:7
+#: bp-friends/bp-friends-templatetags.php:23
+#: bp-groups/bp-groups-widgets.php:32 bp-themes/bp-default/blogs/index.php:31
+#: bp-themes/bp-default/members/single/blogs.php:9
+msgid "Newest"
+msgstr ""
+
+#: bp-core/bp-core-widgets.php:35 bp-groups/bp-groups-widgets.php:33
+msgid "Active"
+msgstr ""
+
+#: bp-core/bp-core-widgets.php:39 bp-groups/bp-groups-widgets.php:34
+msgid "Popular"
+msgstr ""
+
+#: bp-core/bp-core-widgets.php:66
+msgid "No one has signed up yet!"
+msgstr ""
+
+#: bp-core/bp-core-widgets.php:87 bp-core/bp-core-widgets.php:141
+#: bp-core/bp-core-widgets.php:195
+msgid "Max Members to show:"
+msgstr ""
+
+#: bp-core/bp-core-widgets.php:96
+msgid "Who's Online Avatars"
+msgstr ""
+
+#: bp-core/bp-core-widgets.php:120
+msgid "There are no users currently online"
+msgstr ""
+
+#: bp-core/bp-core-widgets.php:150
+msgid "Recently Active Member Avatars"
+msgstr ""
+
+#: bp-core/bp-core-widgets.php:174
+msgid "There are no recently active members"
+msgstr ""
+
+#: bp-core/bp-core-widgets.php:249
+msgid "There were no members found, please try another filter."
+msgstr ""
+
+#: bp-forums.php:56
+msgid "The forums component has not been set up yet."
+msgstr ""
+
+#: bp-forums.php:76 bp-groups.php:554
+msgid "There was an error when creating the topic"
+msgstr ""
+
+#: bp-forums.php:78 bp-groups.php:556
+msgid "The topic was created successfully"
+msgstr ""
+
+#: bp-forums.php:82
+msgid "Please pick the group forum where you would like to post this topic."
+msgstr ""
+
+#: bp-forums.php:103 bp-forums/bp-forums-admin.php:8
+msgid "Forums Setup"
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:12
+msgid "Settings Saved."
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:22
+#, php-format
+msgid ""
+"bbPress forum integration in BuddyPress has been set up correctly. If you "
+"are having problems you can <a href=\"%s\" title=\"Reinstall bbPress\">re-"
+"install</a>"
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:23
+msgid ""
+"NOTE: The forums directory will only work if your bbPress tables are in the "
+"same database as your WordPress tables. If you are not using an existing "
+"bbPress install you can ignore this message."
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:38
+msgid ""
+"The bb-config.php file was not found at that location, please try again."
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:41
+msgid "Forums were set up correctly using your existing bbPress install!"
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:42
+msgid ""
+"BuddyPress will now use its internal copy of bbPress to run the forums on "
+"your site. If you wish, you can remove your old bbPress installation files, "
+"as long as you keep the bb-config.php file in the same location."
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:47
+msgid "Existing bbPress Installation"
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:48
+msgid ""
+"BuddyPress can make use of your existing bbPress install. Just provide the "
+"location of your <code>bb-config.php</code> file, and BuddyPress will do the "
+"rest."
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:50 bp-forums/bp-forums-admin.php:78
+msgid "Complete Installation"
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:65
+msgid ""
+"All done! Configuration settings have been saved to the file <code>bb-config."
+"php</code> in the root of your WordPress install."
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:69
+msgid ""
+"A configuration file could not be created. No problem, but you will need to "
+"save the text shown below into a file named <code>bb-config.php</code> in "
+"the root directory of your WordPress installation before you can start using "
+"the forum functionality."
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:75
+msgid "New bbPress Installation"
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:76
+msgid ""
+"You've decided to set up a new installation of bbPress for forum management "
+"in BuddyPress. This is very simple and is usually just a one click\n"
+"\t\t\t\tprocess. When you're ready, hit the link below."
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:86
+#, php-format
+msgid ""
+"bbPress files were not found. To install the forums component you must "
+"download a copy of bbPress and make sure it is in the folder: \"%s\""
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:90
+msgid ""
+"Forums in BuddyPress make use of a bbPress installation to function. You can "
+"choose to either let BuddyPress set up a new bbPress install, or use an "
+"already existing bbPress install. Please choose one of the options below."
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:92
+msgid "Set up a new bbPress installation"
+msgstr ""
+
+#: bp-forums/bp-forums-admin.php:93
+msgid "Use an existing bbPress installation"
+msgstr ""
+
+#: bp-forums/bp-forums-templatetags.php:304
+#: bp-forums/bp-forums-templatetags.php:353
+#: bp-forums/bp-forums-templatetags.php:923
+msgid "Deleted User"
+msgstr ""
+
+#: bp-forums/bp-forums-templatetags.php:464
+#: bp-groups/bp-groups-templatetags.php:669
+#, php-format
+msgid "%d post"
+msgstr ""
+
+#: bp-forums/bp-forums-templatetags.php:466
+#: bp-groups/bp-groups-templatetags.php:671
+#, php-format
+msgid "%d posts"
+msgstr ""
+
+#: bp-forums/bp-forums-templatetags.php:563
+msgid "Edit Topic"
+msgstr ""
+
+#: bp-forums/bp-forums-templatetags.php:567
+msgid "Sticky Topic"
+msgstr ""
+
+#: bp-forums/bp-forums-templatetags.php:569
+msgid "Un-stick Topic"
+msgstr ""
+
+#: bp-forums/bp-forums-templatetags.php:572
+msgid "Open Topic"
+msgstr ""
+
+#: bp-forums/bp-forums-templatetags.php:574
+msgid "Close Topic"
+msgstr ""
+
+#: bp-forums/bp-forums-templatetags.php:576
+msgid "Delete Topic"
+msgstr ""
+
+#: bp-forums/bp-forums-templatetags.php:682
+#, php-format
+msgid " matching tag \"%s\""
+msgstr ""
+
+#: bp-forums/bp-forums-templatetags.php:684
+#, php-format
+msgid "Viewing topic %1$s to %2$s (%3$s total topics%4$s)"
+msgstr ""
+
+#: bp-forums/bp-forums-templatetags.php:975
+#: bp-themes/bp-default/functions.php:91 bp-xprofile/bp-xprofile-admin.php:67
+#: bp-xprofile/bp-xprofile-admin.php:94
+msgid "Edit"
+msgstr ""
+
+#: bp-forums/bp-forums-templatetags.php:1008
+#, php-format
+msgid "Viewing post %1$s to %2$s (%3$s total posts)"
+msgstr ""
+
+#: bp-friends.php:70
+#, php-format
+msgid "Friends <span>(%d)</span>"
+msgstr ""
+
+#: bp-friends.php:75 bp-friends.php:80 bp-friends.php:320
+#: bp-friends/bp-friends-templatetags.php:40
+msgid "My Friends"
+msgstr ""
+
+#: bp-friends.php:76
+msgid "Requests"
+msgstr ""
+
+#: bp-friends.php:118
+msgid "Friendship accepted"
+msgstr ""
+
+#: bp-friends.php:120
+msgid "Friendship could not be accepted"
+msgstr ""
+
+#: bp-friends.php:129
+msgid "Friendship rejected"
+msgstr ""
+
+#: bp-friends.php:131
+msgid "Friendship could not be rejected"
+msgstr ""
+
+#: bp-friends.php:159
+msgid "A member sends you a friendship request"
+msgstr ""
+
+#: bp-friends.php:165
+msgid "A member accepts your friendship request"
+msgstr ""
+
+#: bp-friends.php:208 bp-themes/bp-default/_inc/ajax.php:351
+msgid "Friendship could not be requested."
+msgstr ""
+
+#: bp-friends.php:210
+msgid "Friendship requested"
+msgstr ""
+
+#: bp-friends.php:213
+msgid "You are already friends with this user"
+msgstr ""
+
+#: bp-friends.php:215
+msgid "You already have a pending friendship request with this user"
+msgstr ""
+
+#: bp-friends.php:246 bp-themes/bp-default/_inc/ajax.php:341
+msgid "Friendship could not be canceled."
+msgstr ""
+
+#: bp-friends.php:248
+msgid "Friendship canceled"
+msgstr ""
+
+#: bp-friends.php:251
+msgid "You are not yet friends with this user"
+msgstr ""
+
+#: bp-friends.php:253
+msgid "You have a pending friendship request with this user"
+msgstr ""
+
+#: bp-friends.php:308
+msgid "New friendship created"
+msgstr ""
+
+#: bp-friends.php:320
+#, php-format
+msgid "%d friends accepted your friendship requests"
+msgstr ""
+
+#: bp-friends.php:324 bp-friends/bp-friends-notifications.php:62
+#, php-format
+msgid "%s accepted your friendship request"
+msgstr ""
+
+#: bp-friends.php:330 bp-friends.php:334
+msgid "Friendship requests"
+msgstr ""
+
+#: bp-friends.php:330
+#, php-format
+msgid "You have %d pending friendship requests"
+msgstr ""
+
+#: bp-friends.php:334
+#, php-format
+msgid "You have a friendship request from %s"
+msgstr ""
+
+#: bp-friends.php:433 bp-friends.php:442
+#, php-format
+msgid "%s and %s are now friends"
+msgstr ""
+
+#: bp-friends/bp-friends-notifications.php:22
+#, php-format
+msgid "New friendship request from %s"
+msgstr ""
+
+#: bp-friends/bp-friends-notifications.php:25
+#, php-format
+msgid ""
+"%s wants to add you as a friend.\n"
+"\n"
+"To view all of your pending friendship requests: %s\n"
+"\n"
+"To view %s's profile: %s\n"
+"\n"
+"---------------------\n"
+msgstr ""
+
+#: bp-friends/bp-friends-notifications.php:65
+#, php-format
+msgid ""
+"%s accepted your friend request.\n"
+"\n"
+"To view %s's profile: %s\n"
+"\n"
+"---------------------\n"
+msgstr ""
+
+#: bp-friends/bp-friends-templatetags.php:6
+#: bp-friends/bp-friends-templatetags.php:20
+#: bp-groups/bp-groups-templatetags.php:1825
+#: bp-groups/bp-groups-templatetags.php:1842
+msgid "Recently Active"
+msgstr ""
+
+#: bp-friends/bp-friends-templatetags.php:8
+#: bp-friends/bp-friends-templatetags.php:26
+#: bp-groups/bp-groups-templatetags.php:1830
+#: bp-groups/bp-groups-templatetags.php:1857
+msgid "Alphabetically"
+msgstr ""
+
+#: bp-friends/bp-friends-templatetags.php:40
+#, php-format
+msgid "%s's Friends"
+msgstr ""
+
+#: bp-friends/bp-friends-templatetags.php:40
+msgid "See All"
+msgstr ""
+
+#: bp-friends/bp-friends-templatetags.php:53
+msgid "You haven't added any friend connections yet."
+msgstr ""
+
+#: bp-friends/bp-friends-templatetags.php:53
+#, php-format
+msgid "%s hasn't created any friend connections yet."
+msgstr ""
+
+#: bp-friends/bp-friends-templatetags.php:93
+msgid "There aren't enough site members to show a random sample just yet."
+msgstr ""
+
+#: bp-friends/bp-friends-templatetags.php:103
+msgid "Filter Friends"
+msgstr ""
+
+#: bp-friends/bp-friends-templatetags.php:138
+#, php-format
+msgid "%d friend"
+msgstr ""
+
+#: bp-friends/bp-friends-templatetags.php:140
+#, php-format
+msgid "%d friends"
+msgstr ""
+
+#: bp-friends/bp-friends-templatetags.php:224
+#: bp-friends/bp-friends-templatetags.php:225
+#: bp-themes/bp-default/_inc/ajax.php:353
+msgid "Friendship Requested"
+msgstr ""
+
+#: bp-friends/bp-friends-templatetags.php:239
+#: bp-friends/bp-friends-templatetags.php:240
+msgid "Cancel Friendship"
+msgstr ""
+
+#: bp-friends/bp-friends-templatetags.php:257
+#: bp-friends/bp-friends-templatetags.php:258
+#: bp-themes/bp-default/_inc/ajax.php:343
+msgid "Add Friend"
+msgstr ""
+
+#: bp-groups.php:91
+msgid "Details"
+msgstr ""
+
+#: bp-groups.php:97 bp-groups.php:154
+msgid "Invites"
+msgstr ""
+
+#: bp-groups.php:148
+#, php-format
+msgid "Groups <span>(%d)</span>"
+msgstr ""
+
+#: bp-groups.php:153 bp-groups.php:160
+msgid "My Groups"
+msgstr ""
+
+#: bp-groups.php:179 bp-groups/bp-groups-templatetags.php:930
+#: bp-groups/bp-groups-templatetags.php:1883
+msgid "Group Avatar"
+msgstr ""
+
+#: bp-groups.php:205
+msgid "Admin"
+msgstr ""
+
+#: bp-groups.php:209 bp-groups/bp-groups-templatetags.php:1188
+#: bp-groups/bp-groups-templatetags.php:1189
+#: bp-themes/bp-default/_inc/ajax.php:431
+msgid "Request Membership"
+msgstr ""
+
+#: bp-groups.php:212
+msgid "Forum"
+msgstr ""
+
+#: bp-groups.php:214
+#, php-format
+msgid "Members (%s)"
+msgstr ""
+
+#: bp-groups.php:218 bp-themes/bp-default/groups/single/send-invites.php:60
+msgid "Send Invites"
+msgstr ""
+
+#: bp-groups.php:250 bp-xprofile.php:213
+msgid "Admin Options"
+msgstr ""
+
+#: bp-groups.php:253 bp-groups/bp-groups-templatetags.php:939
+#: bp-themes/bp-default/groups/single/admin.php:303
+msgid "Delete Group"
+msgstr ""
+
+#: bp-groups.php:298
+msgid "Group invite could not be accepted"
+msgstr ""
+
+#: bp-groups.php:300
+msgid "Group invite accepted"
+msgstr ""
+
+#: bp-groups.php:306 bp-groups.php:1774 bp-groups.php:2479
+#, php-format
+msgid "%s joined the group %s"
+msgstr ""
+
+#: bp-groups.php:320
+msgid "Group invite could not be rejected"
+msgstr ""
+
+#: bp-groups.php:322
+msgid "Group invite rejected"
+msgstr ""
+
+#: bp-groups.php:376
+msgid "There was an error when replying to that topic"
+msgstr ""
+
+#: bp-groups.php:378
+msgid "Your reply was posted successfully"
+msgstr ""
+
+#: bp-groups.php:392
+msgid "There was an error when making that topic a sticky"
+msgstr ""
+
+#: bp-groups.php:394
+msgid "The topic was made sticky successfully"
+msgstr ""
+
+#: bp-groups.php:406
+msgid "There was an error when unsticking that topic"
+msgstr ""
+
+#: bp-groups.php:408
+msgid "The topic was unstuck successfully"
+msgstr ""
+
+#: bp-groups.php:420
+msgid "There was an error when closing that topic"
+msgstr ""
+
+#: bp-groups.php:422
+msgid "The topic was closed successfully"
+msgstr ""
+
+#: bp-groups.php:434
+msgid "There was an error when opening that topic"
+msgstr ""
+
+#: bp-groups.php:436
+msgid "The topic was opened successfully"
+msgstr ""
+
+#: bp-groups.php:455
+msgid "There was an error deleting the topic"
+msgstr ""
+
+#: bp-groups.php:457
+msgid "The topic was deleted successfully"
+msgstr ""
+
+#: bp-groups.php:477
+msgid "There was an error when editing that topic"
+msgstr ""
+
+#: bp-groups.php:479
+msgid "The topic was edited successfully"
+msgstr ""
+
+#: bp-groups.php:501
+msgid "There was an error deleting that post"
+msgstr ""
+
+#: bp-groups.php:503
+msgid "The post was deleted successfully"
+msgstr ""
+
+#: bp-groups.php:523
+msgid "There was an error when editing that post"
+msgstr ""
+
+#: bp-groups.php:525
+msgid "The post was edited successfully"
+msgstr ""
+
+#: bp-groups.php:592
+msgid "Group invites sent."
+msgstr ""
+
+#: bp-groups.php:618
+msgid ""
+"There was an error sending your group membership request, please try again."
+msgstr ""
+
+#: bp-groups.php:620
+msgid ""
+"Your membership request was sent to the group administrator successfully. "
+"You will be notified when the group administrator responds to your request."
+msgstr ""
+
+#: bp-groups.php:669
+msgid "There was an error updating group details, please try again."
+msgstr ""
+
+#: bp-groups.php:671
+msgid "Group details were successfully updated."
+msgstr ""
+
+#: bp-groups.php:707
+msgid "There was an error updating group settings, please try again."
+msgstr ""
+
+#: bp-groups.php:709
+msgid "Group settings were successfully updated."
+msgstr ""
+
+#: bp-groups.php:739 bp-xprofile.php:433
+msgid "Your avatar was deleted successfully!"
+msgstr ""
+
+#: bp-groups.php:741 bp-xprofile.php:435
+msgid "There was a problem deleting that avatar, please try again."
+msgstr ""
+
+#: bp-groups.php:769
+msgid "There was a problem cropping the avatar, please try uploading it again"
+msgstr ""
+
+#: bp-groups.php:771
+msgid "The new group avatar was uploaded successfully!"
+msgstr ""
+
+#: bp-groups.php:800
+msgid "There was an error when promoting that user, please try again"
+msgstr ""
+
+#: bp-groups.php:802
+msgid "User promoted successfully"
+msgstr ""
+
+#: bp-groups.php:818
+msgid "There was an error when demoting that user, please try again"
+msgstr ""
+
+#: bp-groups.php:820
+msgid "User demoted successfully"
+msgstr ""
+
+#: bp-groups.php:836
+msgid "There was an error when banning that user, please try again"
+msgstr ""
+
+#: bp-groups.php:838
+msgid "User banned successfully"
+msgstr ""
+
+#: bp-groups.php:854
+msgid "There was an error when unbanning that user, please try again"
+msgstr ""
+
+#: bp-groups.php:856
+msgid "User ban removed successfully"
+msgstr ""
+
+#: bp-groups.php:872
+msgid "There was an error removing that user from the group, please try again"
+msgstr ""
+
+#: bp-groups.php:874
+msgid "User removed successfully"
+msgstr ""
+
+#: bp-groups.php:915
+msgid "There was an error accepting the membership request, please try again."
+msgstr ""
+
+#: bp-groups.php:917
+msgid "Group membership request accepted"
+msgstr ""
+
+#: bp-groups.php:927
+msgid "There was an error rejecting the membership request, please try again."
+msgstr ""
+
+#: bp-groups.php:929
+msgid "Group membership request rejected"
+msgstr ""
+
+#: bp-groups.php:961
+msgid "There was an error deleting the group, please try again."
+msgstr ""
+
+#: bp-groups.php:963
+msgid "The group was deleted successfully"
+msgstr ""
+
+#: bp-groups.php:995
+msgid "A member invites you to join a group"
+msgstr ""
+
+#: bp-groups.php:1001
+msgid "Group information is updated"
+msgstr ""
+
+#: bp-groups.php:1007
+msgid "You are promoted to a group administrator or moderator"
+msgstr ""
+
+#: bp-groups.php:1013
+msgid "A member requests to join a private group for which you are an admin"
+msgstr ""
+
+#: bp-groups.php:1062
+msgid "There was an error saving group details. Please try again."
+msgstr ""
+
+#: bp-groups.php:1084
+msgid "Please fill in all of the required fields"
+msgstr ""
+
+#: bp-groups.php:1089 bp-groups.php:1116
+msgid "There was an error saving group details, please try again."
+msgstr ""
+
+#: bp-groups.php:1147
+#, php-format
+msgid "%s created the group %s"
+msgstr ""
+
+#: bp-groups.php:1195
+msgid "There was an error saving the group avatar, please try uploading again."
+msgstr ""
+
+#: bp-groups.php:1197
+msgid "The group avatar was uploaded successfully!"
+msgstr ""
+
+#: bp-groups.php:1221 bp-groups.php:1228
+msgid "There was an error joining the group."
+msgstr ""
+
+#: bp-groups.php:1230
+msgid "You joined the group!"
+msgstr ""
+
+#: bp-groups.php:1253
+msgid "There was an error leaving the group."
+msgstr ""
+
+#: bp-groups.php:1255 bp-groups.php:1732
+msgid "You successfully left the group."
+msgstr ""
+
+#: bp-groups.php:1333
+msgid "Created a group"
+msgstr ""
+
+#: bp-groups.php:1334
+msgid "Joined a group"
+msgstr ""
+
+#: bp-groups.php:1335
+msgid "New group forum topic"
+msgstr ""
+
+#: bp-groups.php:1336
+msgid "New group forum post"
+msgstr ""
+
+#: bp-groups.php:1396
+msgid "Group Membership Requests"
+msgstr ""
+
+#: bp-groups.php:1396
+#, php-format
+msgid "%d new membership requests for the group \"%s\""
+msgstr ""
+
+#: bp-groups.php:1399
+#, php-format
+msgid "%s requests membership for the group \"%s\""
+msgstr ""
+
+#: bp-groups.php:1410
+#, php-format
+msgid "%d accepted group membership requests"
+msgstr ""
+
+#: bp-groups.php:1412
+#, php-format
+msgid "Membership for group \"%s\" accepted"
+msgstr ""
+
+#: bp-groups.php:1423
+#, php-format
+msgid "%d rejected group membership requests"
+msgstr ""
+
+#: bp-groups.php:1425
+#, php-format
+msgid "Membership for group \"%s\" rejected"
+msgstr ""
+
+#: bp-groups.php:1436
+#, php-format
+msgid "You were promoted to an admin in %d groups"
+msgstr ""
+
+#: bp-groups.php:1438
+#, php-format
+msgid "You were promoted to an admin in the group %s"
+msgstr ""
+
+#: bp-groups.php:1449
+#, php-format
+msgid "You were promoted to a mod in %d groups"
+msgstr ""
+
+#: bp-groups.php:1451
+#, php-format
+msgid "You were promoted to a mod in the group %s"
+msgstr ""
+
+#: bp-groups.php:1462 bp-groups.php:1464
+msgid "Group Invites"
+msgstr ""
+
+#: bp-groups.php:1462
+#, php-format
+msgid "You have %d new group invitations"
+msgstr ""
+
+#: bp-groups.php:1464
+#, php-format
+msgid "You have an invitation to the group: %s"
+msgstr ""
+
+#: bp-groups.php:1556 bp-groups/bp-groups-classes.php:736
+msgid "Group Admin"
+msgstr ""
+
+#: bp-groups.php:1709
+msgid "As the only Admin, you cannot leave the group."
+msgstr ""
+
+#: bp-groups.php:1962
+#, php-format
+msgid "%s posted an update in the group %s:"
+msgstr ""
+
+#: bp-groups.php:2033 bp-groups.php:2138
+#, php-format
+msgid "%s posted on the forum topic %s in the group %s:"
+msgstr ""
+
+#: bp-groups.php:2072 bp-groups.php:2104
+#, php-format
+msgid "%s started the forum topic %s in the group %s:"
+msgstr ""
+
+#: bp-groups/bp-groups-classes.php:730
+msgid "Group Mod"
+msgstr ""
+
+#: bp-groups/bp-groups-notifications.php:8
+msgid "Group Details Updated"
+msgstr ""
+
+#: bp-groups/bp-groups-notifications.php:23
+#, php-format
+msgid ""
+"Group details for the group \"%s\" were updated:\n"
+"\n"
+"To view the group: %s\n"
+"\n"
+"---------------------\n"
+msgstr ""
+
+#: bp-groups/bp-groups-notifications.php:64
+#, php-format
+msgid "Membership request for group: %s"
+msgstr ""
+
+#: bp-groups/bp-groups-notifications.php:67
+#, php-format
+msgid ""
+"%s wants to join the group \"%s\".\n"
+"\n"
+"Because you are the administrator of this group, you must either accept or "
+"reject the membership request.\n"
+"\n"
+"To view all pending membership requests for this group, please visit:\n"
+"%s\n"
+"\n"
+"To view %s's profile: %s\n"
+"\n"
+"---------------------\n"
+msgstr ""
+
+#: bp-groups/bp-groups-notifications.php:113
+#, php-format
+msgid "Membership request for group \"%s\" accepted"
+msgstr ""
+
+#: bp-groups/bp-groups-notifications.php:115
+#, php-format
+msgid ""
+"Your membership request for the group \"%s\" has been accepted.\n"
+"\n"
+"To view the group please login and visit: %s\n"
+"\n"
+"---------------------\n"
+msgstr ""
+
+#: bp-groups/bp-groups-notifications.php:123
+#, php-format
+msgid "Membership request for group \"%s\" rejected"
+msgstr ""
+
+#: bp-groups/bp-groups-notifications.php:125
+#, php-format
+msgid ""
+"Your membership request for the group \"%s\" has been rejected.\n"
+"\n"
+"To submit another request please log in and visit: %s\n"
+"\n"
+"---------------------\n"
+msgstr ""
+
+#: bp-groups/bp-groups-notifications.php:147
+msgid "an administrator"
+msgstr ""
+
+#: bp-groups/bp-groups-notifications.php:150
+msgid "a moderator"
+msgstr ""
+
+#: 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:172
+#, php-format
+msgid ""
+"You have been promoted to %s for the group: \"%s\".\n"
+"\n"
+"To view the group please visit: %s\n"
+"\n"
+"---------------------\n"
+msgstr ""
+
+#: 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:220
+#, php-format
+msgid ""
+"One of your friends %s has invited you to the group: \"%s\".\n"
+"\n"
+"To view your group invites visit: %s\n"
+"\n"
+"To view the group visit: %s\n"
+"\n"
+"To view %s's profile visit: %s\n"
+"\n"
+"---------------------\n"
+msgstr ""
+
+#: bp-groups/bp-groups-notifications.php:277
+#, php-format
+msgid "%s mentioned you in the group \"%s\""
+msgstr ""
+
+#: bp-groups/bp-groups-notifications.php:280
+#, php-format
+msgid ""
+"%s mentioned you in the group \"%s\":\n"
+"\n"
+"\"%s\"\n"
+"\n"
+"To view and respond to the message, log in and visit: %s\n"
+"\n"
+"---------------------\n"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:252
+msgid "Public Group"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:254
+msgid "Hidden Group"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:256
+msgid "Private Group"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:258
+msgid "Group"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:288
+#: bp-groups/bp-groups-templatetags.php:1718
+msgid "Group avatar"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:330
+msgid "not yet active"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:421
+msgid "Private"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:476
+msgid "No Admins"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:496
+msgid "No Mods"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:517
+msgid "Filter Groups"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:565
+#, php-format
+msgid "Viewing group %1$s to %2$s (of %3$s groups)"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:594
+#, php-format
+msgid "%s member"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:596
+#: bp-themes/bp-default/members/single/groups/invites.php:11
+#, php-format
+msgid "%s members"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:635
+#, php-format
+msgid "%d topic"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:637
+#, php-format
+msgid "%d topics"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:733
+#: bp-groups/bp-groups-templatetags.php:771
+msgid "Demote to Member"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:739
+#: bp-groups/bp-groups-templatetags.php:777
+#: bp-groups/bp-groups-templatetags.php:1490
+#, php-format
+msgid "joined %s ago"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:752
+msgid "This group has no administrators"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:771
+#: bp-themes/bp-default/groups/single/admin.php:215
+msgid "Promote to Admin"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:790
+msgid "This group has no moderators"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:922
+msgid "Edit Details"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:929
+msgid "Group Settings"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:931
+msgid "Manage Members"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:934
+msgid "Membership Requests"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:1108
+#: bp-groups/bp-groups-templatetags.php:1109
+#: bp-themes/bp-default/forums/index.php:8
+msgid "New Topic"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:1147
+#: bp-groups/bp-groups-templatetags.php:1148
+#: bp-themes/bp-default/_inc/ajax.php:407
+msgid "Leave Group"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:1170
+#: bp-groups/bp-groups-templatetags.php:1171
+#: bp-themes/bp-default/_inc/ajax.php:429
+msgid "Join Group"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:1203
+#: bp-groups/bp-groups-templatetags.php:1204
+msgid "Request Sent"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:1225
+msgid ""
+"This is a private group and you must request group membership in order to "
+"join."
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:1227
+msgid ""
+"This is a private group. To join you must be a registered site member and "
+"request group membership."
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:1229
+msgid ""
+"This is a private group. Your membership request is awaiting approval from "
+"the group administrator."
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:1231
+msgid "This is a hidden group and only invited members can join."
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:1540
+#, php-format
+msgid "Viewing members %1$s to %2$s (of %3$s members)"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:1826
+#: bp-groups/bp-groups-templatetags.php:1845
+msgid "Recently Joined"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:1827
+#: bp-groups/bp-groups-templatetags.php:1848
+msgid "Most Popular"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:1828
+#: bp-groups/bp-groups-templatetags.php:1851
+msgid "Administrator Of"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:1829
+#: bp-groups/bp-groups-templatetags.php:1854
+msgid "Moderator Of"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:1885
+msgid "No Group Avatar"
+msgstr ""
+
+#: bp-groups/bp-groups-templatetags.php:2089
+#, php-format
+msgid "requested %s ago"
+msgstr ""
+
+#: bp-groups/bp-groups-widgets.php:58
+msgid "There are no groups to display."
+msgstr ""
+
+#: bp-groups/bp-groups-widgets.php:79
+msgid "Max groups to show:"
+msgstr ""
+
+#: bp-groups/bp-groups-widgets.php:117
+#, php-format
+msgid "created %s ago"
+msgstr ""
+
+#: bp-groups/bp-groups-widgets.php:136
+msgid "No groups matched the current filter."
+msgstr ""
+
+#: bp-messages.php:105
+#, php-format
+msgid "Messages <strong>(%s)</strong>"
+msgstr ""
+
+#: bp-messages.php:107
+msgid "Messages <strong></strong>"
+msgstr ""
+
+#: bp-messages.php:115
+msgid "Inbox"
+msgstr ""
+
+#: bp-messages.php:116
+msgid "Sent Messages"
+msgstr ""
+
+#: bp-messages.php:117
+msgid "Compose"
+msgstr ""
+
+#: bp-messages.php:120
+msgid "Notices"
+msgstr ""
+
+#: bp-messages.php:124
+msgid "My Messages"
+msgstr ""
+
+#: bp-messages.php:167 bp-messages.php:189
+msgid "There was an error sending that message, please try again"
+msgstr ""
+
+#: bp-messages.php:172
+msgid "Notice sent successfully!"
+msgstr ""
+
+#: bp-messages.php:175
+msgid "There was an error sending that notice, please try again"
+msgstr ""
+
+#: bp-messages.php:186
+msgid "Message sent successfully!"
+msgstr ""
+
+#: bp-messages.php:213
+msgid "There was a problem deactivating that notice."
+msgstr ""
+
+#: bp-messages.php:215
+msgid "Notice deactivated."
+msgstr ""
+
+#: bp-messages.php:219
+msgid "There was a problem activating that notice."
+msgstr ""
+
+#: bp-messages.php:221
+msgid "Notice activated."
+msgstr ""
+
+#: bp-messages.php:225
+msgid "There was a problem deleting that notice."
+msgstr ""
+
+#: bp-messages.php:227
+msgid "Notice deleted."
+msgstr ""
+
+#: bp-messages.php:244
+msgid "Messages"
+msgstr ""
+
+#: bp-messages.php:253
+msgid "A member sends you a new message"
+msgstr ""
+
+#: bp-messages.php:259
+msgid "A new site notice is posted"
+msgstr ""
+
+#: bp-messages.php:299
+msgid "Your reply was sent successfully"
+msgstr ""
+
+#: bp-messages.php:301
+msgid "There was a problem sending your reply, please try again"
+msgstr ""
+
+#: bp-messages.php:311
+#, php-format
+msgid "From: %s"
+msgstr ""
+
+#: bp-messages.php:332
+msgid "There was an error deleting that message."
+msgstr ""
+
+#: bp-messages.php:334
+msgid "Message deleted."
+msgstr ""
+
+#: bp-messages.php:356
+msgid "There was an error deleting messages."
+msgstr ""
+
+#: bp-messages.php:358 bp-themes/bp-default/_inc/ajax.php:534
+msgid "Messages deleted."
+msgstr ""
+
+#: bp-messages.php:378
+#, php-format
+msgid "You have %d new messages"
+msgstr ""
+
+#: bp-messages.php:380
+#, php-format
+msgid "You have %d new message"
+msgstr ""
+
+#: bp-messages.php:434
+#, php-format
+msgid "Re: %s"
+msgstr ""
+
+#: bp-messages.php:442
+msgid "No Subject"
+msgstr ""
+
+#: bp-messages/bp-messages-classes.php:193
+msgid " Recipients"
+msgstr ""
+
+#: bp-messages/bp-messages-notifications.php:23
+#, php-format
+msgid "New message from %s"
+msgstr ""
+
+#: bp-messages/bp-messages-notifications.php:26
+#, php-format
+msgid ""
+"%s sent you a new message:\n"
+"\n"
+"Subject: %s\n"
+"\n"
+"\"%s\"\n"
+"\n"
+"To view and read your messages please log in and visit: %s\n"
+"\n"
+"---------------------\n"
+msgstr ""
+
+#: bp-messages/bp-messages-templatetags.php:335
+#, php-format
+msgid "Viewing message %1$s to %2$s (of %3$s messages)"
+msgstr ""
+
+#: bp-messages/bp-messages-templatetags.php:376
+msgid "Select:"
+msgstr ""
+
+#: bp-messages/bp-messages-templatetags.php:379
+msgid "Read"
+msgstr ""
+
+#: bp-messages/bp-messages-templatetags.php:380
+msgid "Unread"
+msgstr ""
+
+#: bp-messages/bp-messages-templatetags.php:381
+msgid "All"
+msgstr ""
+
+#: bp-messages/bp-messages-templatetags.php:384
+msgid "Mark as Read"
+msgstr ""
+
+#: bp-messages/bp-messages-templatetags.php:385
+msgid "Mark as Unread"
+msgstr ""
+
+#: bp-messages/bp-messages-templatetags.php:387
+msgid "Delete Selected"
+msgstr ""
+
+#: bp-messages/bp-messages-templatetags.php:396
+msgid "Currently Active"
+msgstr ""
+
+#: bp-messages/bp-messages-templatetags.php:463
+msgid "Deactivate"
+msgstr ""
+
+#: bp-messages/bp-messages-templatetags.php:465
+#: bp-themes/bp-default/registration/activate.php:40
+msgid "Activate"
+msgstr ""
+
+#: bp-messages/bp-messages-templatetags.php:490
+#: bp-themes/bp-default/functions.php:32
+msgid "Close"
+msgstr ""
+
+#: bp-messages/bp-messages-templatetags.php:535
+msgid "Send a private message to this user."
+msgstr ""
+
+#: bp-messages/bp-messages-templatetags.php:536
+msgid "Send Private Message"
+msgstr ""
+
+#: bp-messages/bp-messages-templatetags.php:708
+#, php-format
+msgid "%d Recipients"
+msgstr ""
+
+#: bp-messages/bp-messages-templatetags.php:774
+#: bp-themes/bp-default/_inc/ajax.php:468
+#, php-format
+msgid "Sent %s ago"
+msgstr ""
+
+#: bp-themes/bp-default/404.php:10
+msgid "Page Not Found"
+msgstr ""
+
+#: bp-themes/bp-default/404.php:14
+msgid "The page you were looking for was not found."
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:137
+msgid "There was a problem posting your update, please try again."
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:229
+#: bp-themes/bp-default/_inc/ajax.php:262
+msgid "There was a problem when deleting. Please try again."
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:275
+#: bp-themes/bp-default/activity/entry.php:35
+msgid "Remove Favorite"
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:284
+#: bp-themes/bp-default/activity/entry.php:33
+msgid "Favorite"
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:315
+#: bp-themes/bp-default/groups/create.php:191
+#: bp-themes/bp-default/groups/single/send-invites.php:42
+msgid "Remove Invite"
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:356
+msgid "Request Pending"
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:368
+msgid "There was a problem accepting that request. Please try again."
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:379
+msgid "There was a problem rejecting that request. Please try again."
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:405
+msgid "Error joining group"
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:415
+msgid "Error requesting membership"
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:417
+msgid "Membership Requested"
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:426
+msgid "Error leaving group"
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:443
+msgid "There was a problem closing the notice."
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:485
+msgid "There was a problem sending that reply. Please try again."
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:495
+msgid "There was a problem marking messages as unread."
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:511
+msgid "There was a problem marking messages as read."
+msgstr ""
+
+#: bp-themes/bp-default/_inc/ajax.php:527
+msgid "There was a problem deleting messages."
+msgstr ""
+
+#: bp-themes/bp-default/_inc/options.php:9
+#: bp-themes/bp-default/_inc/options.php:27
+msgid "Theme Options"
+msgstr ""
+
+#: bp-themes/bp-default/_inc/options.php:22
+msgid "Settings saved."
+msgstr ""
+
+#: bp-themes/bp-default/_inc/options.php:34
+msgid "On front page show:"
+msgstr ""
+
+#: bp-themes/bp-default/_inc/options.php:36
+msgid "Blog Posts"
+msgstr ""
+
+#: bp-themes/bp-default/_inc/options.php:38
+#: bp-themes/bp-default/functions.php:120
+msgid "Activity Stream"
+msgstr ""
+
+#: bp-themes/bp-default/_inc/options.php:46
+msgid "Update Settings"
+msgstr ""
+
+#: bp-themes/bp-default/activity/activity-loop.php:27
+msgid "Load More"
+msgstr ""
+
+#: bp-themes/bp-default/activity/activity-loop.php:37
+msgid "Sorry, there was no activity found. Please try a different filter."
+msgstr ""
+
+#: bp-themes/bp-default/activity/entry.php:33
+msgid "Mark as Favorite"
+msgstr ""
+
+#: bp-themes/bp-default/activity/entry.php:63
+msgid "Post"
+msgstr ""
+
+#: bp-themes/bp-default/activity/entry.php:63
+msgid "or press esc to cancel."
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:7
+msgid "Site Activity"
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:22
+msgid "The public activity for everyone on this site."
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:22
+#: bp-themes/bp-default/members/index.php:18
+#, php-format
+msgid "All Members (%s)"
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:30
+msgid "The activity of my friends only."
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:30
+#: bp-themes/bp-default/members/index.php:21
+#, php-format
+msgid "My Friends (%s)"
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:38
+msgid "The activity of groups I am a member of."
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:38
+#: bp-themes/bp-default/groups/index.php:20
+#, php-format
+msgid "My Groups (%s)"
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:45
+msgid "The activity I've marked as a favorite."
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:45
+#, php-format
+msgid "My Favorites (<span>%s</span>)"
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:50
+msgid "Activity that I have been mentioned in."
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:50
+#, php-format
+msgid "(%s new)"
+msgstr ""
+
+#: 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 ""
+
+#: bp-themes/bp-default/activity/index.php:66
+#: bp-themes/bp-default/groups/single/activity.php:9
+#: bp-themes/bp-default/members/single/activity.php:7
+msgid "No Filter"
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:67
+#: bp-themes/bp-default/groups/single/activity.php:10
+#: bp-themes/bp-default/members/single/activity.php:8
+msgid "Show Updates"
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:70
+#: bp-themes/bp-default/members/single/activity.php:12
+msgid "Show Blog Posts"
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:71
+#: bp-themes/bp-default/members/single/activity.php:13
+msgid "Show Blog Comments"
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:75
+#: bp-themes/bp-default/groups/single/activity.php:13
+#: bp-themes/bp-default/members/single/activity.php:22
+msgid "Show New Forum Topics"
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:76
+#: bp-themes/bp-default/groups/single/activity.php:14
+#: bp-themes/bp-default/members/single/activity.php:23
+msgid "Show Forum Replies"
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:80
+#: bp-themes/bp-default/members/single/activity.php:27
+msgid "Show New Groups"
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:81
+#: bp-themes/bp-default/groups/single/activity.php:17
+#: bp-themes/bp-default/members/single/activity.php:28
+msgid "Show New Group Memberships"
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:85
+#: bp-themes/bp-default/members/single/activity.php:17
+msgid "Show Friendship Connections"
+msgstr ""
+
+#: bp-themes/bp-default/activity/index.php:88
+msgid "Show New Members"
+msgstr ""
+
+#: bp-themes/bp-default/activity/post-form.php:7
+#, php-format
+msgid ""
+"You are mentioning %s in a new update, this user will be sent a notification "
+"of your message."
+msgstr ""
+
+#: bp-themes/bp-default/activity/post-form.php:19
+#, php-format
+msgid "What's new in %s, %s?"
+msgstr ""
+
+#: bp-themes/bp-default/activity/post-form.php:21
+#, php-format
+msgid "What's new %s?"
+msgstr ""
+
+#: bp-themes/bp-default/activity/post-form.php:33
+msgid "Post Update"
+msgstr ""
+
+#: bp-themes/bp-default/activity/post-form.php:38
+msgid "Post in"
+msgstr ""
+
+#: bp-themes/bp-default/archive.php:10
+#, php-format
+msgid "You are browsing the archive for %1$s."
+msgstr ""
+
+#: bp-themes/bp-default/archive.php:16 bp-themes/bp-default/archive.php:52
+#: bp-themes/bp-default/index.php:43 bp-themes/bp-default/search.php:17
+#: bp-themes/bp-default/search.php:51 bp-themes/bp-default/single.php:14
+msgid "&larr; Previous Entries"
+msgstr ""
+
+#: bp-themes/bp-default/archive.php:17 bp-themes/bp-default/archive.php:53
+#: bp-themes/bp-default/index.php:44 bp-themes/bp-default/search.php:18
+#: bp-themes/bp-default/search.php:52 bp-themes/bp-default/single.php:15
+msgid "Next Entries &rarr;"
+msgstr ""
+
+#: bp-themes/bp-default/archive.php:29 bp-themes/bp-default/archive.php:35
+#: bp-themes/bp-default/index.php:20 bp-themes/bp-default/index.php:26
+#: bp-themes/bp-default/search.php:29 bp-themes/bp-default/search.php:35
+#: bp-themes/bp-default/single.php:23 bp-themes/bp-default/single.php:29
+#, php-format
+msgid "by %s"
+msgstr ""
+
+#: bp-themes/bp-default/archive.php:33 bp-themes/bp-default/index.php:24
+#: bp-themes/bp-default/search.php:33 bp-themes/bp-default/single.php:27
+msgid "Permanent Link to"
+msgstr ""
+
+#: bp-themes/bp-default/archive.php:35 bp-themes/bp-default/index.php:26
+#: bp-themes/bp-default/search.php:35 bp-themes/bp-default/single.php:29
+msgid "in"
+msgstr ""
+
+#: bp-themes/bp-default/archive.php:38 bp-themes/bp-default/index.php:29
+#: bp-themes/bp-default/search.php:38 bp-themes/bp-default/single.php:32
+msgid "Read the rest of this entry &rarr;"
+msgstr ""
+
+#: bp-themes/bp-default/archive.php:41 bp-themes/bp-default/index.php:32
+#: bp-themes/bp-default/search.php:41 bp-themes/bp-default/single.php:37
+msgid "Tags: "
+msgstr ""
+
+#: bp-themes/bp-default/archive.php:41 bp-themes/bp-default/index.php:32
+#: bp-themes/bp-default/search.php:41 bp-themes/bp-default/single.php:37
+msgid "No Comments &#187;"
+msgstr ""
+
+#: bp-themes/bp-default/archive.php:41 bp-themes/bp-default/index.php:32
+#: bp-themes/bp-default/search.php:41 bp-themes/bp-default/single.php:37
+msgid "1 Comment &#187;"
+msgstr ""
+
+#: bp-themes/bp-default/archive.php:41 bp-themes/bp-default/index.php:32
+#: bp-themes/bp-default/search.php:41 bp-themes/bp-default/single.php:37
+msgid "% Comments &#187;"
+msgstr ""
+
+#: bp-themes/bp-default/archive.php:59 bp-themes/bp-default/index.php:50
+msgid "Not Found"
+msgstr ""
+
+#: bp-themes/bp-default/attachment.php:25
+msgid "<p class=\"serif\">Read the rest of this entry &rarr;</p>"
+msgstr ""
+
+#: bp-themes/bp-default/attachment.php:27 bp-themes/bp-default/page.php:20
+#: bp-themes/bp-default/single.php:34
+msgid "<p><strong>Pages:</strong> "
+msgstr ""
+
+#: bp-themes/bp-default/attachment.php:38
+msgid "Sorry, no attachments matched your criteria."
+msgstr ""
+
+#: bp-themes/bp-default/blogs/blogs-loop.php:71
+msgid "Sorry, there were no blogs found."
+msgstr ""
+
+#: bp-themes/bp-default/blogs/create.php:10
+#: bp-themes/bp-default/blogs/index.php:8
+msgid "Blogs Directory"
+msgstr ""
+
+#: bp-themes/bp-default/blogs/create.php:21
+msgid "Blog registration is currently disabled"
+msgstr ""
+
+#: bp-themes/bp-default/blogs/index.php:18
+#, php-format
+msgid "All Blogs (%s)"
+msgstr ""
+
+#: bp-themes/bp-default/blogs/index.php:21
+#, php-format
+msgid "My Blogs (%s)"
+msgstr ""
+
+#: bp-themes/bp-default/blogs/index.php:28
+#: bp-themes/bp-default/forums/index.php:91
+#: bp-themes/bp-default/groups/index.php:27
+#: bp-themes/bp-default/members/index.php:28
+#: bp-themes/bp-default/members/single/blogs.php:6
+#: bp-themes/bp-default/members/single/friends.php:9
+#: bp-themes/bp-default/members/single/groups.php:10
+#: bp-xprofile/bp-xprofile-classes.php:495
+msgid "Order By:"
+msgstr ""
+
+#: bp-themes/bp-default/blogs/index.php:30
+#: bp-themes/bp-default/forums/index.php:93
+#: bp-themes/bp-default/groups/index.php:29
+#: bp-themes/bp-default/members/index.php:30
+#: bp-themes/bp-default/members/single/blogs.php:8
+#: bp-themes/bp-default/members/single/friends.php:11
+#: bp-themes/bp-default/members/single/groups.php:12
+msgid "Last Active"
+msgstr ""
+
+#: bp-themes/bp-default/blogs/index.php:32
+#: bp-themes/bp-default/groups/index.php:32
+#: bp-themes/bp-default/members/index.php:34
+#: bp-themes/bp-default/members/single/blogs.php:10
+#: bp-themes/bp-default/members/single/friends.php:13
+#: bp-themes/bp-default/members/single/groups.php:15
+msgid "Alphabetical"
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:3
+msgid "Password Protected"
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:4
+msgid "Enter the password to view comments."
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:28
+#, php-format
+msgid "One Response to %2$s"
+msgid_plural "%1$s Responses to %2$s"
+msgstr[0] ""
+msgstr[1] ""
+
+#: bp-themes/bp-default/comments.php:58
+#, php-format
+msgid ""
+"Comments are closed, but <a href=\"%1$s\" title=\"Trackback URL for this post"
+"\">trackbacks</a> and pingbacks are open."
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:64
+msgid "Comments are closed."
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:90
+msgid "Leave a Reply"
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:90
+#, php-format
+msgid "Leave a Reply to %s"
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:94
+msgid "Click here to cancel reply."
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:100
+#, php-format
+msgid ""
+"You must be <a href=\"%1$s\" title=\"Log in\">logged in</a> to post a "
+"comment."
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:112
+#, php-format
+msgid "Logged in as <a href=\"%1$s\" title=\"%2$s\">%2$s</a>."
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:112
+msgid "Log out of this account"
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:112
+msgid "Log out &rarr;"
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:120 bp-themes/bp-default/comments.php:125
+msgid "*"
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:125
+msgid "Email"
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:137
+msgid "Comment"
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:144
+msgid "Submit"
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:169
+#, php-format
+msgid "%d Trackback"
+msgstr ""
+
+#: bp-themes/bp-default/comments.php:171
+#, php-format
+msgid "%d Trackbacks"
+msgstr ""
+
+#: bp-themes/bp-default/footer.php:7
+#, php-format
+msgid ""
+"%s is proudly powered by <a href=\"http://wordpress.org\">WordPress</a> and "
+"<a href=\"http://buddypress.org\">BuddyPress</a>"
+msgstr ""
+
+#: bp-themes/bp-default/forums/forums-loop.php:24
+msgid "Topic Title"
+msgstr ""
+
+#: bp-themes/bp-default/forums/forums-loop.php:25
+msgid "Latest Poster"
+msgstr ""
+
+#: bp-themes/bp-default/forums/forums-loop.php:28
+msgid "Posted In Group"
+msgstr ""
+
+#: bp-themes/bp-default/forums/forums-loop.php:31
+msgid "Posts"
+msgstr ""
+
+#: bp-themes/bp-default/forums/forums-loop.php:32
+msgid "Freshness"
+msgstr ""
+
+#: bp-themes/bp-default/forums/forums-loop.php:45
+msgid "Permalink"
+msgstr ""
+
+#: bp-themes/bp-default/forums/forums-loop.php:95
+msgid "Sorry, there were no forum topics found."
+msgstr ""
+
+#: bp-themes/bp-default/forums/index.php:8
+msgid "Group Forums Directory"
+msgstr ""
+
+#: bp-themes/bp-default/forums/index.php:27
+#: bp-themes/bp-default/groups/single/forum.php:33
+msgid "Post a New Topic:"
+msgstr ""
+
+#: bp-themes/bp-default/forums/index.php:29
+#: bp-themes/bp-default/groups/single/forum.php:35
+#: bp-themes/bp-default/groups/single/forum/edit.php:26
+msgid "Title:"
+msgstr ""
+
+#: bp-themes/bp-default/forums/index.php:32
+#: bp-themes/bp-default/groups/single/forum.php:38
+#: bp-themes/bp-default/groups/single/forum/edit.php:29
+msgid "Content:"
+msgstr ""
+
+#: bp-themes/bp-default/forums/index.php:35
+#: bp-themes/bp-default/groups/single/forum.php:41
+msgid "Tags (comma separated):"
+msgstr ""
+
+#: bp-themes/bp-default/forums/index.php:38
+msgid "Post In Group Forum:"
+msgstr ""
+
+#: bp-themes/bp-default/forums/index.php:58
+#: bp-themes/bp-default/groups/single/forum.php:47
+msgid "Post Topic"
+msgstr ""
+
+#: bp-themes/bp-default/forums/index.php:59
+#: bp-xprofile/bp-xprofile-classes.php:633
+msgid "Cancel"
+msgstr ""
+
+#: bp-themes/bp-default/forums/index.php:69
+#, php-format
+msgid ""
+"You are not a member of any groups so you don't have any group forums you "
+"can post in. To start posting, first find a group that matches the topic "
+"subject you'd like to start. If this group does not exist, why not <a href='%"
+"s'>create a new group</a>? Once you have joined or created the group you can "
+"post your topic in that group's forum."
+msgstr ""
+
+#: bp-themes/bp-default/forums/index.php:81
+#, php-format
+msgid "All Topics (%s)"
+msgstr ""
+
+#: bp-themes/bp-default/forums/index.php:84
+#, php-format
+msgid "My Topics (%s)"
+msgstr ""
+
+#: bp-themes/bp-default/forums/index.php:94
+msgid "Most Posts"
+msgstr ""
+
+#: bp-themes/bp-default/forums/index.php:95
+msgid "Unreplied"
+msgstr ""
+
+#: bp-themes/bp-default/functions.php:26
+msgid "My Favorites"
+msgstr ""
+
+#: bp-themes/bp-default/functions.php:27
+msgid "Accepted"
+msgstr ""
+
+#: bp-themes/bp-default/functions.php:28
+msgid "Rejected"
+msgstr ""
+
+#: bp-themes/bp-default/functions.php:29
+msgid "Show all comments for this thread"
+msgstr ""
+
+#: bp-themes/bp-default/functions.php:30
+msgid "Show all"
+msgstr ""
+
+#: bp-themes/bp-default/functions.php:31
+msgid "comments"
+msgstr ""
+
+#: bp-themes/bp-default/functions.php:33
+#, php-format
+msgid ""
+"%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."
+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"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:26
+msgid "* Group Name"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:26
+#: bp-themes/bp-default/groups/create.php:29
+#: bp-themes/bp-default/members/single/profile/edit.php:23
+#: bp-themes/bp-default/members/single/profile/edit.php:30
+#: bp-themes/bp-default/members/single/profile/edit.php:37
+#: bp-themes/bp-default/members/single/profile/edit.php:46
+#: bp-themes/bp-default/members/single/profile/edit.php:60
+#: bp-themes/bp-default/members/single/profile/edit.php:74
+#: bp-themes/bp-default/members/single/profile/edit.php:84
+#: bp-themes/bp-default/registration/register.php:28
+#: bp-themes/bp-default/registration/register.php:32
+#: bp-themes/bp-default/registration/register.php:36
+#: bp-themes/bp-default/registration/register.php:40
+#: bp-themes/bp-default/registration/register.php:67
+#: bp-themes/bp-default/registration/register.php:75
+#: bp-themes/bp-default/registration/register.php:83
+#: bp-themes/bp-default/registration/register.php:93
+#: bp-themes/bp-default/registration/register.php:104
+#: bp-themes/bp-default/registration/register.php:119
+#: bp-themes/bp-default/registration/register.php:130
+#: bp-themes/bp-default/registration/register.php:180
+#: bp-themes/bp-default/registration/register.php:189
+msgid "(required)"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:29
+msgid "* Group Description"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:45
+#: bp-themes/bp-default/groups/single/admin.php:45
+msgid "Enable comment wire"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:52
+#: bp-themes/bp-default/groups/single/admin.php:55
+msgid "Enable discussion forum"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:57
+#, php-format
+msgid ""
+"<strong>Attention Site Admin:</strong> Group forums require the <a href=\"%s"
+"\">correct setup and configuration</a> of a bbPress installation."
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:65
+#: bp-themes/bp-default/groups/single/admin.php:64
+msgid "Privacy Options"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:69
+#: bp-themes/bp-default/groups/single/admin.php:69
+msgid "This is a public group"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:71
+#: bp-themes/bp-default/groups/single/admin.php:71
+msgid "Any site member can join this group."
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:72
+#: bp-themes/bp-default/groups/create.php:81
+#: bp-themes/bp-default/groups/single/admin.php:72
+#: bp-themes/bp-default/groups/single/admin.php:82
+msgid ""
+"This group will be listed in the groups directory and in search results."
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:73
+#: bp-themes/bp-default/groups/single/admin.php:73
+msgid "Group content and activity will be visible to any site member."
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:78
+#: bp-themes/bp-default/groups/single/admin.php:79
+msgid "This is a private group"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:80
+#: bp-themes/bp-default/groups/single/admin.php:81
+msgid "Only users who request membership and are accepted can join the group."
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:82
+#: bp-themes/bp-default/groups/create.php:91
+#: bp-themes/bp-default/groups/single/admin.php:83
+#: bp-themes/bp-default/groups/single/admin.php:93
+msgid ""
+"Group content and activity will only be visible to members of the group."
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:87
+#: bp-themes/bp-default/groups/single/admin.php:89
+msgid "This is a hidden group"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:89
+#: bp-themes/bp-default/groups/single/admin.php:91
+msgid "Only users who are invited can join the group."
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:90
+#: bp-themes/bp-default/groups/single/admin.php:92
+msgid ""
+"This group will not be listed in the groups directory or search results."
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:114
+#: bp-themes/bp-default/groups/single/admin.php:110
+msgid ""
+"Upload an image to use as an avatar for this group. The image will be shown "
+"on the main group page, and in search results."
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:118
+#: bp-themes/bp-default/groups/single/admin.php:114
+#: bp-themes/bp-default/members/single/profile/change-avatar.php:17
+#: bp-themes/bp-default/registration/register.php:244
+msgid "Upload Image"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:122
+msgid "To skip the avatar upload process, hit the \"Next Step\" button."
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:129
+msgid "Crop Group Avatar"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:131
+#: bp-themes/bp-default/groups/single/admin.php:134
+#: bp-themes/bp-default/members/single/profile/change-avatar.php:34
+#: bp-themes/bp-default/registration/register.php:258
+msgid "Avatar to crop"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:134
+#: bp-themes/bp-default/groups/single/admin.php:137
+#: bp-themes/bp-default/members/single/profile/change-avatar.php:37
+#: bp-themes/bp-default/registration/register.php:261
+msgid "Avatar preview"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:137
+#: bp-themes/bp-default/groups/single/admin.php:140
+#: bp-themes/bp-default/members/single/profile/change-avatar.php:40
+#: bp-themes/bp-default/registration/register.php:264
+msgid "Crop Image"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:175
+#: bp-themes/bp-default/groups/single/send-invites.php:22
+msgid "Select people to invite from your friends list."
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:206
+#: bp-themes/bp-default/groups/single/send-invites.php:73
+msgid ""
+"Once you have built up friend connections you will be able to invite others "
+"to your group. You can send invites any time in the future by selecting the "
+"\"Send Invites\" option when viewing your new group."
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:224
+msgid "Previous Step"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:229
+msgid "Next Step"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:234
+msgid "Create Group and Continue"
+msgstr ""
+
+#: bp-themes/bp-default/groups/create.php:239
+msgid "Finish"
+msgstr ""
+
+#: bp-themes/bp-default/groups/groups-loop.php:74
+msgid "There were no groups found."
+msgstr ""
+
+#: bp-themes/bp-default/groups/index.php:17
+#, php-format
+msgid "All Groups (%s)"
+msgstr ""
+
+#: bp-themes/bp-default/groups/index.php:30
+#: bp-themes/bp-default/members/single/groups.php:13
+msgid "Most Members"
+msgstr ""
+
+#: bp-themes/bp-default/groups/index.php:31
+#: bp-themes/bp-default/members/single/groups.php:14
+msgid "Newly Created"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:16
+msgid "Group Name"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:19
+msgid "Group Description"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:25
+msgid "Notify group members of changes via email"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:120
+msgid ""
+"If you'd like to remove the existing avatar but not upload a new one, please "
+"use the delete avatar button."
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:122
+#: bp-themes/bp-default/members/single/profile/change-avatar.php:23
+msgid "Delete Avatar"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:132
+msgid "Crop Avatar"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:160
+msgid "Administrators"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:167
+msgid "Moderators"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:203
+msgid "(banned)"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:209
+msgid "Unban this member"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:209
+msgid "Remove Ban"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:213
+msgid "Kick and ban this member"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:213
+msgid "Kick &amp; Ban"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:214
+msgid "Promote to Mod"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:219
+msgid "Remove this member"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:219
+msgid "Remove from group"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:233
+#: bp-themes/bp-default/groups/single/members.php:51
+msgid "This group has no members."
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:263
+#: bp-themes/bp-default/members/single/friends/requests.php:21
+#: bp-themes/bp-default/members/single/groups/invites.php:20
+msgid "Accept"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:265
+#: bp-themes/bp-default/members/single/friends/requests.php:22
+#: bp-themes/bp-default/members/single/groups/invites.php:21
+msgid "Reject"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:278
+msgid "There are no pending membership requests."
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:295
+msgid ""
+"WARNING: Deleting this group will completely remove ALL content associated "
+"with it. There is no way back, please be careful with this option."
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/admin.php:298
+msgid "I understand the consequences of deleting this group."
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/forum.php:29
+msgid "You will auto join this group when you start a new topic."
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/forum/edit.php:9
+#: bp-themes/bp-default/groups/single/forum/topic.php:21
+msgid "Group Forum"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/forum/edit.php:9
+#: bp-themes/bp-default/groups/single/forum/topic.php:21
+msgid "Group Forum Directory"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/forum/edit.php:24
+msgid "Edit Topic:"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/forum/edit.php:46
+msgid "Edit Post:"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/forum/edit.php:67
+msgid "This topic does not exist."
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/forum/topic.php:42
+#, php-format
+msgid "%s said %s ago:"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/forum/topic.php:56
+msgid "Permanent link to this post"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/forum/topic.php:87
+msgid "You will auto join this group when you reply to this topic."
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/forum/topic.php:92
+msgid "Add a reply:"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/forum/topic.php:97
+msgid "Post Reply"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/forum/topic.php:108
+msgid "This topic is closed, replies are no longer accepted."
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/forum/topic.php:121
+msgid "There are no posts for this topic."
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/group-header.php:6
+msgid "Group Admins"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/group-header.php:14
+msgid "Group Mods"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/request-membership.php:4
+#, php-format
+msgid "You are requesting to become a member of the group '%s'."
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/request-membership.php:7
+msgid "Comments (optional)"
+msgstr ""
+
+#: bp-themes/bp-default/groups/single/request-membership.php:12
+msgid "Send Request"
+msgstr ""
+
+#: bp-themes/bp-default/header.php:18
+msgid "Site Wide Activity RSS Feed"
+msgstr ""
+
+#: bp-themes/bp-default/header.php:22
+msgid "Activity RSS Feed"
+msgstr ""
+
+#: bp-themes/bp-default/header.php:26
+msgid "Group Activity RSS Feed"
+msgstr ""
+
+#: bp-themes/bp-default/header.php:29
+msgid "Blog Posts RSS Feed"
+msgstr ""
+
+#: bp-themes/bp-default/header.php:30
+msgid "Blog Posts Atom Feed"
+msgstr ""
+
+#: bp-themes/bp-default/index.php:51
+msgid "Sorry, but you are looking for something that isn't here."
+msgstr ""
+
+#: bp-themes/bp-default/links.php:16
+msgid "Links"
+msgstr ""
+
+#: bp-themes/bp-default/members/index.php:8
+msgid "Members Directory"
+msgstr ""
+
+#: bp-themes/bp-default/members/index.php:31
+#: bp-themes/bp-default/members/single/friends.php:12
+msgid "Newest Registered"
+msgstr ""
+
+#: bp-themes/bp-default/members/members-loop.php:87
+msgid "Sorry, no members were found."
+msgstr ""
+
+#: bp-themes/bp-default/members/single/friends/requests.php:36
+msgid "You have no pending friendship requests."
+msgstr ""
+
+#: bp-themes/bp-default/members/single/groups/invites.php:34
+msgid "You have no outstanding group invites."
+msgstr ""
+
+#: bp-themes/bp-default/members/single/messages/compose.php:5
+msgid "Send To (Username or Friend's Name)"
+msgstr ""
+
+#: bp-themes/bp-default/members/single/messages/compose.php:14
+msgid "This is a notice to all users."
+msgstr ""
+
+#: bp-themes/bp-default/members/single/messages/compose.php:17
+msgid "Subject"
+msgstr ""
+
+#: bp-themes/bp-default/members/single/messages/compose.php:20
+msgid "Message"
+msgstr ""
+
+#: bp-themes/bp-default/members/single/messages/compose.php:28
+msgid "Send Message"
+msgstr ""
+
+#: bp-themes/bp-default/members/single/messages/messages-loop.php:31
+msgid "From:"
+msgstr ""
+
+#: bp-themes/bp-default/members/single/messages/messages-loop.php:36
+msgid "To:"
+msgstr ""
+
+#: bp-themes/bp-default/members/single/messages/messages-loop.php:42
+msgid "View Message"
+msgstr ""
+
+#: bp-themes/bp-default/members/single/messages/messages-loop.php:50
+#: bp-themes/bp-default/members/single/messages/notices-loop.php:38
+msgid "Delete Message"
+msgstr ""
+
+#: bp-themes/bp-default/members/single/messages/messages-loop.php:68
+msgid "Sorry, no messages were found."
+msgstr ""
+
+#: bp-themes/bp-default/members/single/messages/notices-loop.php:31
+msgid "Sent:"
+msgstr ""
+
+#: bp-themes/bp-default/members/single/messages/notices-loop.php:49
+msgid "Sorry, no notices were found."
+msgstr ""
+
+#: bp-themes/bp-default/members/single/messages/single.php:11
+#, php-format
+msgid "Sent between %s and %s"
+msgstr ""
+
+#: bp-themes/bp-default/members/single/messages/single.php:63
+msgid "Send a Reply"
+msgstr ""
+
+#: bp-themes/bp-default/members/single/messages/single.php:79
+msgid "Send Reply"
+msgstr ""
+
+#: bp-themes/bp-default/members/single/profile/change-avatar.php:1
+#: bp-xprofile.php:179
+msgid "Change Avatar"
+msgstr ""
+
+#: bp-themes/bp-default/members/single/profile/change-avatar.php:7
+msgid ""
+"Your avatar will be used on your profile and throughout the site. If there "
+"is a <a href=\"http://gravatar.com\">Gravatar</a> associated with your "
+"account email we will use that, or you can upload an image from your "
+"computer."
+msgstr ""
+
+#: bp-themes/bp-default/members/single/profile/change-avatar.php:13
+msgid ""
+"Click below to select a JPG, GIF or PNG format photo from your computer and "
+"then click 'Upload Image' to proceed."
+msgstr ""
+
+#: bp-themes/bp-default/members/single/profile/change-avatar.php:22
+msgid ""
+"If you'd like to delete your current avatar but not upload a new one, please "
+"use the delete avatar button."
+msgstr ""
+
+#: bp-themes/bp-default/members/single/profile/change-avatar.php:23
+msgid "Delete My Avatar"
+msgstr ""
+
+#: bp-themes/bp-default/members/single/profile/change-avatar.php:32
+#: bp-themes/bp-default/registration/register.php:256
+msgid "Crop Your New Avatar"
+msgstr ""
+
+#: bp-themes/bp-default/members/single/profile/change-avatar.php:56
+msgid ""
+"Your avatar will be used on your profile and throughout the site. To change "
+"your avatar, please create an account with <a href=\"http://gravatar.com"
+"\">Gravatar</a> using the same email address as you used to register with "
+"this site."
+msgstr ""
+
+#: bp-themes/bp-default/members/single/profile/edit.php:9
+#, php-format
+msgid "Editing '%s' Profile Group"
+msgstr ""
+
+#: bp-themes/bp-default/members/single/profile/edit.php:52
+#: bp-themes/bp-default/members/single/profile/edit.php:65
+#: bp-themes/bp-default/registration/register.php:110
+msgid "Clear"
+msgstr ""
+
+#: bp-themes/bp-default/page.php:18
+msgid "<p class=\"serif\">Read the rest of this page &rarr;</p>"
+msgstr ""
+
+#: bp-themes/bp-default/page.php:21
+msgid "Edit this entry."
+msgstr ""
+
+#: bp-themes/bp-default/registration/activate.php:16
+msgid "Account Activated"
+msgstr ""
+
+#: bp-themes/bp-default/registration/activate.php:21
+msgid ""
+"Your account was activated successfully! Your account details have been sent "
+"to you in a separate email."
+msgstr ""
+
+#: bp-themes/bp-default/registration/activate.php:23
+msgid ""
+"Your account was activated successfully! You can now log in with the "
+"username and password you provided when you signed up."
+msgstr ""
+
+#: bp-themes/bp-default/registration/activate.php:32
+msgid "Please provide a valid activation key."
+msgstr ""
+
+#: bp-themes/bp-default/registration/activate.php:36
+msgid "Activation Key:"
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:18
+msgid ""
+"Registering for this site is easy, just fill in the fields below and we'll "
+"get a new account set up for you in no time."
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:26
+msgid "Account Details"
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:28
+#: bp-themes/bp-default/sidebar.php:41
+msgid "Username"
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:32
+msgid "Email Address"
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:36
+msgid "Choose a Password"
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:40
+msgid "Confirm Password"
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:56
+msgid "Profile Details"
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:174
+msgid "Blog Details"
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:176
+msgid "Yes, I'd like to create a new blog"
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:180
+msgid "Blog URL"
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:189
+msgid "Blog Title"
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:193
+msgid ""
+"I would like my blog to appear in search engines, and in public listings "
+"around this site"
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:210
+msgid "Complete Sign Up"
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:221
+msgid "Sign Up Complete!"
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:226
+msgid ""
+"You have successfully created your account! To begin using this site you "
+"will need to activate your account via the email we have just sent to your "
+"address."
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:228
+msgid ""
+"You have successfully created your account! Please log in using the username "
+"and password you have just created."
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:235
+msgid "Your Current Avatar"
+msgstr ""
+
+#: bp-themes/bp-default/registration/register.php:236
+msgid ""
+"We've fetched an avatar for your new account. If you'd like to change this, "
+"why not upload a new one?"
+msgstr ""
+
+#: bp-themes/bp-default/search.php:14
+msgid "Search Results"
+msgstr ""
+
+#: bp-themes/bp-default/search.php:57
+msgid "No posts found. Try a different search?"
+msgstr ""
+
+#: bp-themes/bp-default/sidebar.php:34
+msgid "To start connecting please log in first."
+msgstr ""
+
+#: bp-themes/bp-default/sidebar.php:36
+#, php-format
+msgid ""
+" You can also <a href=\"%s\" title=\"Create an account\">create an account</"
+"a>."
+msgstr ""
+
+#: bp-themes/bp-default/sidebar.php:44
+msgid "Password"
+msgstr ""
+
+#: bp-themes/bp-default/sidebar.php:47
+msgid "Remember Me"
+msgstr ""
+
+#: bp-themes/bp-default/sidebar.php:62
+msgid "Forum Topic Tags"
+msgstr ""
+
+#: bp-themes/bp-default/single.php:29
+msgid "Edit this entry"
+msgstr ""
+
+#: bp-themes/bp-default/single.php:46
+msgid "Sorry, no posts matched your criteria."
+msgstr ""
+
+#: bp-xprofile.php:148 bp-xprofile/bp-xprofile-admin.php:38
+msgid "Profile Field Setup"
+msgstr ""
+
+#: bp-xprofile.php:178 bp-xprofile/bp-xprofile-templatetags.php:695
+#: bp-xprofile/bp-xprofile-templatetags.php:696
+msgid "Edit Profile"
+msgstr ""
+
+#: bp-xprofile.php:216
+#, php-format
+msgid "Edit %s's Profile"
+msgstr ""
+
+#: bp-xprofile.php:217
+#, php-format
+msgid "Edit %s's Avatar"
+msgstr ""
+
+#: bp-xprofile.php:220
+msgid "Mark as Spammer"
+msgstr ""
+
+#: bp-xprofile.php:222
+msgid "Not a Spammer"
+msgstr ""
+
+#: bp-xprofile.php:225
+#, php-format
+msgid "Delete %s"
+msgstr ""
+
+#: bp-xprofile.php:318
+msgid ""
+"Please make sure you fill in all required fields in this profile field group "
+"before saving."
+msgstr ""
+
+#: bp-xprofile.php:335
+msgid ""
+"There was a problem updating some of your profile information, please try "
+"again."
+msgstr ""
+
+#: bp-xprofile.php:337
+msgid "Changes saved."
+msgstr ""
+
+#: bp-xprofile.php:388
+msgid "Your new avatar was uploaded successfully!"
+msgstr ""
+
+#: bp-xprofile.php:455
+msgid "New member registered"
+msgstr ""
+
+#: bp-xprofile.php:456
+msgid "Updated Profile"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:40
+msgid ""
+"Your users will distinguish themselves through their profile page. You must "
+"give them profile fields that allow them to describe themselves in a way "
+"that is relevant to the theme of your social network."
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:41
+msgid "NOTE: Any fields in the first group will appear on the signup page."
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:73
+msgid "Field Name"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:74
+#: bp-xprofile/bp-xprofile-classes.php:617
+msgid "Field Type"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:75
+msgid "Required?"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:76
+msgid "Action"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:90
+msgid "Drag"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:91
+msgid "(Core Field)"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:103
+msgid "There are no fields in this group."
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:113
+msgid "Add New Field"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:124
+#: bp-xprofile/bp-xprofile-classes.php:171
+msgid "Add New Field Group"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:128
+msgid "You have no groups."
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:129
+msgid "Add New Group"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:157
+msgid "There was an error saving the group. Please try again"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:160
+msgid "The group was saved successfully."
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:189
+msgid "There was an error deleting the group. Please try again"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:192
+msgid "The group was deleted successfully."
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:231
+msgid "There was an error saving the field. Please try again"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:237
+msgid "The field was saved successfully."
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:265
+msgid "field"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:267
+msgid "option"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:273
+#, php-format
+msgid "There was an error deleting the %s. Please try again"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-admin.php:276
+#, php-format
+msgid "The %s was deleted successfully!"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:158
+msgid "Please make sure you give the group a name."
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:174
+msgid "Edit Field Group"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:195
+msgid "Field Group Name"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:494
+msgid "Please enter options for this Field:"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:498
+msgid "Order Entered"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:499
+msgid "Name - Ascending"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:500
+msgid "Name - Descending"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:529
+#: bp-xprofile/bp-xprofile-classes.php:550
+msgid "Option"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:531
+#: bp-xprofile/bp-xprofile-classes.php:551
+msgid "Default Value"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:557
+msgid "Add Another Option"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:565
+msgid "Add Field"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:574
+msgid "Edit Field"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:595
+msgid "Field Title"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:602
+msgid "Field Description"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:609
+msgid "Is This Field Required?"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:611
+msgid "Not Required"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:612
+msgid "Required"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:619
+msgid "Text Box"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:620
+msgid "Multi-line Text Box"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:621
+msgid "Date Selector"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:622
+msgid "Radio Buttons"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:623
+msgid "Drop Down Select Box"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:624
+msgid "Multi Select Box"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:625
+msgid "Checkboxes"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:632
+msgid "Save"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:633
+msgid "or"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:655
+msgid "Please make sure you fill out all required fields."
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:658
+msgid ""
+"Radio button field types require at least one option. Please add options "
+"below."
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:661
+#: bp-xprofile/bp-xprofile-classes.php:664
+msgid ""
+"Select box field types require at least one option. Please add options below."
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-classes.php:667
+msgid ""
+"Checkbox field types require at least one option. Please add options below."
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-templatetags.php:490
+msgid "January"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-templatetags.php:490
+msgid "February"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-templatetags.php:490
+msgid "March"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-templatetags.php:491
+msgid "April"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-templatetags.php:491
+msgid "May"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-templatetags.php:491
+msgid "June"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-templatetags.php:492
+msgid "July"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-templatetags.php:492
+msgid "August"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-templatetags.php:492
+msgid "September"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-templatetags.php:493
+msgid "October"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-templatetags.php:493
+msgid "November"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-templatetags.php:493
+msgid "December"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-templatetags.php:632
+msgid ""
+"Avatar uploads are currently disabled. Why not use a <a href=\"http://"
+"gravatar.com\" target=\"_blank\">gravatar</a> instead?"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-templatetags.php:641
+msgid "Profile not recently updated"
+msgstr ""
+
+#: bp-xprofile/bp-xprofile-templatetags.php:652
+#, php-format
+msgid "Profile updated %s ago"
+msgstr ""
diff --git a/wp-content/plugins/buddypress/bp-loader.php b/wp-content/plugins/buddypress/bp-loader.php
new file mode 100644
index 0000000000000000000000000000000000000000..e47c524ef471634d6eaf2cb321e959785bca548b
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-loader.php
@@ -0,0 +1,101 @@
+<?php
+/*
+Plugin Name: BuddyPress
+Plugin URI: http://buddypress.org
+Description: Social networking in a box. Build a social network for your company, school, sports team or niche community all based on the power and flexibility of WordPress.
+Author: The BuddyPress Community
+Version: 1.2.6
+Author URI: http://buddypress.org/community/members/
+Site Wide Only: true
+Network: true
+*/
+
+define( 'BP_VERSION', '1.2.6' );
+
+/***
+ * This file will load in each BuddyPress component based on which
+ * of the components have been activated on the "BuddyPress" admin menu.
+ */
+
+require_once( WP_PLUGIN_DIR . '/buddypress/bp-core.php' );
+$bp_deactivated = apply_filters( 'bp_deactivated_components', get_site_option( 'bp-deactivated-components' ) );
+
+do_action( 'bp_core_loaded' );
+
+/* Activity Streams */
+if ( !isset( $bp_deactivated['bp-activity.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-activity.php') )
+	include( BP_PLUGIN_DIR . '/bp-activity.php' );
+
+/* Blog Tracking */
+if ( !isset( $bp_deactivated['bp-blogs.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-blogs.php') )
+	include( BP_PLUGIN_DIR . '/bp-blogs.php' );
+
+/* bbPress Forum Integration */
+if ( !isset( $bp_deactivated['bp-forums.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-forums.php') )
+	include( BP_PLUGIN_DIR . '/bp-forums.php' );
+
+/* Friend Connections */
+if ( !isset( $bp_deactivated['bp-friends.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-friends.php') )
+	include( BP_PLUGIN_DIR . '/bp-friends.php' );
+
+/* Groups Support */
+if ( !isset( $bp_deactivated['bp-groups.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-groups.php') )
+	include( BP_PLUGIN_DIR . '/bp-groups.php' );
+
+/* Private Messaging */
+if ( !isset( $bp_deactivated['bp-messages.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-messages.php') )
+	include( BP_PLUGIN_DIR . '/bp-messages.php' );
+
+/* Extended Profiles */
+if ( !isset( $bp_deactivated['bp-xprofile.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-xprofile.php') )
+	include( BP_PLUGIN_DIR . '/bp-xprofile.php' );
+
+/**
+ * bp_loaded()
+ * 
+ * Allow dependent plugins and core actions to attach themselves in a safe way.
+ *
+ * See bp-core.php for the following core actions:
+ *	- bp_init|bp_setup_globals|bp_setup_root_components|bp_setup_nav|bp_register_widgets
+ */
+function bp_loaded() {
+	do_action( 'bp_loaded' );
+}
+add_action( 'plugins_loaded', 'bp_loaded', 20 );
+
+/* Activation Function */
+function bp_loader_activate() {
+	/* Force refresh theme roots. */
+	delete_site_transient( 'theme_roots' );
+
+	/* Switch the user to the new bp-default if they are using the old bp-default on activation. */
+	if ( 'bp-sn-parent' == get_blog_option( BP_ROOT_BLOG, 'template' ) && 'bp-default' == get_blog_option( BP_ROOT_BLOG, 'stylesheet' ) )
+		switch_theme( 'bp-default', 'bp-default' );
+
+	/* Install site options on activation */
+	bp_core_activate_site_options( array( 'bp-disable-account-deletion' => 0, 'bp-disable-avatar-uploads' => 0, 'bp-disable-blogforum-comments' => 0,  'bp-disable-forum-directory' => 0,  'bp-disable-profile-sync' => 0 ) );
+
+	do_action( 'bp_loader_activate' );
+}
+register_activation_hook( 'buddypress/bp-loader.php', 'bp_loader_activate' );
+
+/* Deactivation Function */
+function bp_loader_deactivate() {
+	if ( !function_exists( 'delete_site_option') )
+		return false;
+
+	delete_site_option( 'bp-core-db-version' );
+	delete_site_option( 'bp-activity-db-version' );
+	delete_site_option( 'bp-blogs-db-version' );
+	delete_site_option( 'bp-friends-db-version' );
+	delete_site_option( 'bp-groups-db-version' );
+	delete_site_option( 'bp-messages-db-version' );
+	delete_site_option( 'bp-xprofile-db-version' );
+	delete_site_option( 'bp-deactivated-components' );
+	delete_site_option( 'bp-blogs-first-install' );
+
+	do_action( 'bp_loader_deactivate' );
+}
+register_deactivation_hook( 'buddypress/bp-loader.php', 'bp_loader_deactivate' );
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-messages.php b/wp-content/plugins/buddypress/bp-messages.php
new file mode 100644
index 0000000000000000000000000000000000000000..8d7e184556c6f693121b4811ec9bb30dddcfe00c
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-messages.php
@@ -0,0 +1,600 @@
+<?php
+
+define ( 'BP_MESSAGES_DB_VERSION', '2000' );
+
+/* Define the slug for the component */
+if ( !defined( 'BP_MESSAGES_SLUG' ) )
+	define ( 'BP_MESSAGES_SLUG', 'messages' );
+
+require ( BP_PLUGIN_DIR . '/bp-messages/bp-messages-classes.php' );
+require ( BP_PLUGIN_DIR . '/bp-messages/bp-messages-cssjs.php' );
+require ( BP_PLUGIN_DIR . '/bp-messages/bp-messages-templatetags.php' );
+require ( BP_PLUGIN_DIR . '/bp-messages/bp-messages-filters.php' );
+
+function messages_install() {
+	global $wpdb, $bp;
+
+	if ( !empty($wpdb->charset) )
+		$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
+
+	$sql[] = "CREATE TABLE {$bp->messages->table_name_recipients} (
+		  		id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+		  		user_id bigint(20) NOT NULL,
+		  		thread_id bigint(20) NOT NULL,
+		  		unread_count int(10) NOT NULL DEFAULT '0',
+				sender_only tinyint(1) NOT NULL DEFAULT '0',
+				is_deleted tinyint(1) NOT NULL DEFAULT '0',
+			    KEY user_id (user_id),
+			    KEY thread_id (thread_id),
+				KEY is_deleted (is_deleted),
+				KEY sender_only (sender_only),
+			    KEY unread_count (unread_count)
+		 	   ) {$charset_collate};";
+
+	$sql[] = "CREATE TABLE {$bp->messages->table_name_messages} (
+		  		id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+		  		thread_id bigint(20) NOT NULL,
+		  		sender_id bigint(20) NOT NULL,
+		  		subject varchar(200) NOT NULL,
+		  		message longtext NOT NULL,
+		  		date_sent datetime NOT NULL,
+			    KEY sender_id (sender_id),
+			    KEY thread_id (thread_id)
+		 	   ) {$charset_collate};";
+
+	$sql[] = "CREATE TABLE {$bp->messages->table_name_notices} (
+		  		id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+		  		subject varchar(200) NOT NULL,
+		  		message longtext NOT NULL,
+		  		date_sent datetime NOT NULL,
+				is_active tinyint(1) NOT NULL DEFAULT '0',
+			    KEY is_active (is_active)
+		 	   ) {$charset_collate};";
+
+	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
+	dbDelta($sql);
+
+	/* Upgrade and remove the message threads table if it exists */
+	if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$wpdb->base_prefix}bp_messages_threads%'" ) ) {
+		$upgrade = BP_Messages_Thread::upgrade_tables();
+
+		if ( $upgrade )
+			$wpdb->query( "DROP TABLE {$wpdb->base_prefix}bp_messages_threads" );
+	}
+
+	add_site_option( 'bp-messages-db-version', BP_MESSAGES_DB_VERSION );
+}
+
+function messages_setup_globals() {
+	global $bp;
+
+	/* For internal identification */
+	$bp->messages->id = 'messages';
+
+	$bp->messages->slug = BP_MESSAGES_SLUG;
+
+	$bp->messages->table_name_notices    = $bp->table_prefix . 'bp_messages_notices';
+	$bp->messages->table_name_messages   = $bp->table_prefix . 'bp_messages_messages';
+	$bp->messages->table_name_recipients = $bp->table_prefix . 'bp_messages_recipients';
+
+	$bp->messages->format_notification_function = 'messages_format_notifications';
+
+	/* Register this in the active components array */
+	$bp->active_components[$bp->messages->slug] = $bp->messages->id;
+
+	do_action( 'messages_setup_globals' );
+}
+add_action( 'bp_setup_globals', 'messages_setup_globals' );
+
+function messages_check_installed() {
+	global $bp;
+
+	if ( !is_super_admin() )
+		return false;
+
+	/* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
+	if ( get_site_option( 'bp-messages-db-version' ) < BP_MESSAGES_DB_VERSION )
+		messages_install();
+}
+add_action( 'admin_menu', 'messages_check_installed' );
+
+function messages_setup_nav() {
+	global $bp;
+
+	if ( $count = messages_get_unread_count() )
+		$name = sprintf( __('Messages <strong>(%s)</strong>', 'buddypress'), $count );
+	else
+		$name = __('Messages <strong></strong>', 'buddypress');
+
+	/* Add 'Messages' to the main navigation */
+	bp_core_new_nav_item( array( 'name' => $name, 'slug' => $bp->messages->slug, 'position' => 50, 'show_for_displayed_user' => false, 'screen_function' => 'messages_screen_inbox', 'default_subnav_slug' => 'inbox', 'item_css_id' => $bp->messages->id ) );
+
+	$messages_link = $bp->loggedin_user->domain . $bp->messages->slug . '/';
+
+	/* Add the subnav items to the profile */
+	bp_core_new_subnav_item( array( 'name' => __( 'Inbox', 'buddypress' ) . $count_indicator, 'slug' => 'inbox', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_inbox', 'position' => 10, 'user_has_access' => bp_is_my_profile() ) );
+	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_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() ) {
+			$bp->bp_options_title = __( 'My Messages', 'buddypress' );
+		} else {
+			$bp_options_avatar =  bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => 'thumb' ) );
+			$bp->bp_options_title = $bp->displayed_user->fullname;
+		}
+	}
+
+	do_action( 'messages_setup_nav' );
+}
+add_action( 'bp_setup_nav', 'messages_setup_nav' );
+
+/********************************************************************************
+ * Screen Functions
+ *
+ * Screen functions are the controllers of BuddyPress. They will execute when their
+ * specific URL is caught. They will first save or manipulate data using business
+ * functions, then pass on the user to a template file.
+ */
+
+function messages_screen_inbox() {
+	do_action( 'messages_screen_inbox' );
+	bp_core_load_template( apply_filters( 'messages_template_inbox', 'members/single/home' ) );
+}
+
+function messages_screen_sentbox() {
+	do_action( 'messages_screen_sentbox' );
+	bp_core_load_template( apply_filters( 'messages_template_sentbox', 'members/single/home' ) );
+}
+
+function messages_screen_compose() {
+	global $bp;
+
+	// Remove any saved message data from a previous session.
+	messages_remove_callback_values();
+
+	// Check if the message form has been submitted
+	if ( isset( $_POST['send'] ) ) {
+
+		// Check the nonce
+		check_admin_referer( 'messages_send_message' );
+
+		// 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 ( isset( $_POST['send-notice'] ) ) {
+				if ( messages_send_notice( $_POST['subject'], $_POST['content'] ) ) {
+					bp_core_add_message( __( 'Notice sent successfully!', 'buddypress' ) );
+					bp_core_redirect( $bp->loggedin_user->domain . $bp->messages->slug . '/inbox/' );
+				} else {
+					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' )
+				$autocomplete_recipients = explode( ',', $_POST['send-to-input'] );
+				$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
+				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 . '/' );
+				} else {
+					bp_core_add_message( __( 'There was an error sending that message, please try again', 'buddypress' ), 'error' );
+				}
+			}
+		}
+	}
+
+	do_action( 'messages_screen_compose' );
+
+	bp_core_load_template( apply_filters( 'messages_template_compose', 'members/single/home' ) );
+}
+
+function messages_screen_notices() {
+	global $bp, $notice_id;
+
+	if ( !is_super_admin() )
+		return false;
+
+	$notice_id = $bp->action_variables[1];
+
+	if ( $notice_id && is_numeric($notice_id) ) {
+		$notice = new BP_Messages_Notice($notice_id);
+
+		if ( 'deactivate' == $bp->action_variables[0] ) {
+			if ( !$notice->deactivate() ) {
+				bp_core_add_message( __('There was a problem deactivating that notice.', 'buddypress'), 'error' );
+			} else {
+				bp_core_add_message( __('Notice deactivated.', 'buddypress') );
+			}
+		} else if ( 'activate' == $bp->action_variables[0] ) {
+			if ( !$notice->activate() ) {
+				bp_core_add_message( __('There was a problem activating that notice.', 'buddypress'), 'error' );
+			} else {
+				bp_core_add_message( __('Notice activated.', 'buddypress') );
+			}
+		} else if ( 'delete' == $bp->action_variables[0] ) {
+			if ( !$notice->delete() ) {
+				bp_core_add_message( __('There was a problem deleting that notice.', 'buddypress'), 'buddypress' );
+			} else {
+				bp_core_add_message( __('Notice deleted.', 'buddypress') );
+			}
+		}
+		bp_core_redirect( $bp->loggedin_user->domain . $bp->messages->slug . '/notices' );
+	}
+
+	do_action( 'messages_screen_notices' );
+
+	bp_core_load_template( apply_filters( 'messages_template_notices', 'members/single/home' ) );
+}
+
+function messages_screen_notification_settings() {
+	global $current_user; ?>
+	<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>
+
+		<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
+}
+add_action( 'bp_notification_settings', 'messages_screen_notification_settings', 2 );
+
+
+/********************************************************************************
+ * Action Functions
+ *
+ * Action functions are exactly the same as screen functions, however they do not
+ * have a template screen associated with them. Usually they will send the user
+ * back to the default screen after execution.
+ */
+
+function messages_action_view_message() {
+	global $bp, $thread_id;
+
+	if ( $bp->current_component != $bp->messages->slug || $bp->current_action != 'view' )
+		return false;
+
+	$thread_id = $bp->action_variables[0];
+
+	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 */
+	if ( isset( $_POST['send'] ) ) {
+
+		/* Check the nonce */
+		check_admin_referer( 'messages_send_message', 'send_message_nonce' );
+
+		/* Send the reply */
+		if ( messages_new_message( array( 'thread_id' => $thread_id, 'subject' => $_POST['subject'], 'content' => $_POST['content'] ) ) )
+			bp_core_add_message( __( 'Your reply was sent successfully', 'buddypress' ) );
+		else
+			bp_core_add_message( __( 'There was a problem sending your reply, please try again', 'buddypress' ), 'error' );
+
+		bp_core_redirect( $bp->displayed_user->domain . $bp->current_component . '/view/' . $thread_id . '/' );
+	}
+
+	/* Mark message read */
+	messages_mark_thread_read( $thread_id );
+
+	do_action( 'messages_action_view_message' );
+
+	bp_core_new_subnav_item( array( 'name' => sprintf( __( 'From: %s', 'buddypress'), BP_Messages_Thread::get_last_sender($thread_id) ), 'slug' => 'view', 'parent_url' => $bp->loggedin_user->domain . $bp->messages->slug . '/', 'parent_slug' => $bp->messages->slug, 'screen_function' => true, 'position' => 40, 'user_has_access' => bp_is_my_profile() ) );
+	bp_core_load_template( apply_filters( 'messages_template_view_message', 'members/single/home' ) );
+}
+add_action( 'wp', 'messages_action_view_message', 3 );
+
+function messages_action_delete_message() {
+	global $bp, $thread_id;
+
+	if ( $bp->current_component != $bp->messages->slug || 'notices' == $bp->current_action || $bp->action_variables[0] != 'delete' )
+		return false;
+
+	$thread_id = $bp->action_variables[1];
+
+	if ( !$thread_id || !is_numeric($thread_id) || !messages_check_thread_access($thread_id) ) {
+		bp_core_redirect( $bp->displayed_user->domain . $bp->current_component . '/' . $bp->current_action );
+	} else {
+		if ( !check_admin_referer( 'messages_delete_thread' ) )
+			return false;
+
+		// delete message
+		if ( !messages_delete_thread($thread_id) ) {
+			bp_core_add_message( __('There was an error deleting that message.', 'buddypress'), 'error' );
+		} else {
+			bp_core_add_message( __('Message deleted.', 'buddypress') );
+		}
+		bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
+	}
+}
+add_action( 'wp', 'messages_action_delete_message', 3 );
+
+function messages_action_bulk_delete() {
+	global $bp, $thread_ids;
+
+	if ( $bp->current_component != $bp->messages->slug || $bp->action_variables[0] != 'bulk-delete' )
+		return false;
+
+	$thread_ids = $_POST['thread_ids'];
+
+	if ( !$thread_ids || !messages_check_thread_access($thread_ids) ) {
+		bp_core_redirect( $bp->displayed_user->domain . $bp->current_component . '/' . $bp->current_action );
+	} else {
+		if ( !check_admin_referer( 'messages_delete_thread' ) )
+			return false;
+
+		if ( !messages_delete_thread( $thread_ids ) ) {
+			bp_core_add_message( __('There was an error deleting messages.', 'buddypress'), 'error' );
+		} else {
+			bp_core_add_message( __('Messages deleted.', 'buddypress') );
+		}
+		bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
+	}
+}
+add_action( 'wp', 'messages_action_bulk_delete', 3 );
+
+
+/********************************************************************************
+ * Activity & Notification Functions
+ *
+ * These functions handle the recording, deleting and formatting of activity and
+ * notifications for the user and for this specific component.
+ */
+
+function messages_format_notifications( $action, $item_id, $secondary_item_id, $total_items ) {
+	global $bp;
+
+	if ( 'new_message' == $action ) {
+		if ( (int)$total_items > 1 )
+			return apply_filters( 'bp_messages_multiple_new_message_notification', '<a href="' . $bp->loggedin_user->domain . $bp->messages->slug . '/inbox" title="Inbox">' . sprintf( __('You have %d new messages', 'buddypress' ), (int)$total_items ) . '</a>', $total_items );
+		else
+			return apply_filters( 'bp_messages_single_new_message_notification', '<a href="' . $bp->loggedin_user->domain . $bp->messages->slug . '/inbox" title="Inbox">' . sprintf( __('You have %d new message', 'buddypress' ), (int)$total_items ) . '</a>', $total_items );
+	}
+
+	do_action( 'messages_format_notifications', $action, $item_id, $secondary_item_id, $total_items );
+
+	return false;
+}
+
+
+/********************************************************************************
+ * Business Functions
+ *
+ * Business functions are where all the magic happens in BuddyPress. They will
+ * handle the actual saving or manipulation of information. Usually they will
+ * hand off to a database class for data access, then return
+ * true or false on success or failure.
+ */
+
+function messages_new_message( $args = '' ) {
+	global $bp;
+
+	$defaults = array(
+		'thread_id' => false, // false for a new message, thread id for a reply to a thread.
+		'sender_id' => $bp->loggedin_user->id,
+		'recipients' => false, // Can be an array of usernames, user_ids or mixed.
+		'subject' => false,
+		'content' => false,
+		'date_sent' => bp_core_current_time()
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	if ( !$sender_id || !$content )
+		return false;
+
+	/* Create a new message object */
+	$message = new BP_Messages_Message;
+	$message->thread_id = $thread_id;
+	$message->sender_id = $sender_id;
+	$message->subject = $subject;
+	$message->message = $content;
+	$message->date_sent = $date_sent;
+
+	// 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;
+
+		if ( empty( $message->subject ) )
+			$message->subject = __( 'No Subject', 'buddypress' );
+
+		/* Loop the recipients and convert all usernames to user_ids where needed */
+		foreach( (array) $recipients as $recipient ) {
+			if ( is_numeric( trim( $recipient ) ) )
+				$recipient_ids[] = (int)trim( $recipient );
+
+			if ( $recipient_id = bp_core_get_userid( trim( $recipient ) ) )
+				$recipient_ids[] = (int)$recipient_id;
+		}
+
+		/* Strip the sender from the recipient list if they exist */
+		if ( $key = array_search( $sender_id, (array)$recipient_ids ) )
+			unset( $recipient_ids[$key] );
+
+		/* Remove duplicates */
+		$recipient_ids = array_unique( (array)$recipient_ids );
+
+		if ( empty( $recipient_ids ) )
+			return false;
+
+		/* Format this to match existing recipients */
+		foreach( (array)$recipient_ids as $i => $recipient_id ) {
+			$message->recipients[$i] = new stdClass;
+			$message->recipients[$i]->user_id = $recipient_id;
+		}
+	}
+
+	if ( $message->send() ) {
+		require_once( BP_PLUGIN_DIR . '/bp-messages/bp-messages-notifications.php' );
+
+		// Send screen notifications to the recipients
+		foreach ( (array)$message->recipients as $recipient )
+			bp_core_add_notification( $message->id, $recipient->user_id, 'messages', 'new_message' );
+
+		// Send email notifications to the recipients
+		messages_notification_new_message( array( 'message_id' => $message->id, 'sender_id' => $message->sender_id, 'subject' => $message->subject, 'content' => $message->message, 'recipients' => $message->recipients, 'thread_id' => $message->thread_id) );
+
+		do_action( 'messages_message_sent', &$message );
+
+		return $message->thread_id;
+	}
+
+	return false;
+}
+
+
+function messages_send_notice( $subject, $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 = bp_core_current_time();
+		$notice->is_active = 1;
+		$notice->save(); // send it.
+
+		do_action( 'messages_send_notice', $subject, $message );
+
+		return true;
+	}
+}
+
+function messages_delete_thread( $thread_ids ) {
+
+	if ( is_array($thread_ids) ) {
+		$error = 0;
+		for ( $i = 0; $i < count($thread_ids); $i++ ) {
+			if ( !$status = BP_Messages_Thread::delete($thread_ids[$i]) )
+				$error = 1;
+		}
+
+		if ( $error )
+			return false;
+
+		do_action( 'messages_delete_thread', $thread_ids );
+
+		return true;
+	} else {
+		if ( !BP_Messages_Thread::delete($thread_ids) )
+			return false;
+
+		do_action( 'messages_delete_thread', $thread_ids );
+
+		return true;
+	}
+}
+
+function messages_check_thread_access( $thread_id, $user_id = false ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = $bp->loggedin_user->id;
+
+	return BP_Messages_Thread::check_access( $thread_id, $user_id );
+}
+
+function messages_mark_thread_read( $thread_id ) {
+	return BP_Messages_Thread::mark_as_read( $thread_id );
+}
+
+function messages_mark_thread_unread( $thread_id ) {
+	return BP_Messages_Thread::mark_as_unread( $thread_id );
+}
+
+function messages_add_callback_values( $recipients, $subject, $content ) {
+	setcookie( 'bp_messages_send_to', $recipients, time()+60*60*24, COOKIEPATH );
+	setcookie( 'bp_messages_subject', $subject, time()+60*60*24, COOKIEPATH );
+	setcookie( 'bp_messages_content', $content, time()+60*60*24, COOKIEPATH );
+}
+
+function messages_remove_callback_values() {
+	setcookie( 'bp_messages_send_to', false, time()-1000, COOKIEPATH );
+	setcookie( 'bp_messages_subject', false, time()-1000, COOKIEPATH );
+	setcookie( 'bp_messages_content', false, time()-1000, COOKIEPATH );
+}
+
+function messages_get_unread_count( $user_id = false ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = $bp->loggedin_user->id;
+
+	return BP_Messages_Thread::get_inbox_count( $user_id );
+}
+
+function messages_is_user_sender( $user_id, $message_id ) {
+	return BP_Messages_Message::is_user_sender( $user_id, $message_id );
+}
+
+function messages_get_message_sender( $message_id ) {
+	return BP_Messages_Message::get_message_sender( $message_id );
+}
+
+function messages_is_valid_thread( $thread_id ) {
+	return BP_Messages_Thread::is_valid( $thread_id );
+}
+
+
+/********************************************************************************
+ * Caching
+ *
+ * Caching functions handle the clearing of cached objects and pages on specific
+ * actions throughout BuddyPress.
+ */
+
+// List actions to clear super cached pages on, if super cache is installed
+add_action( 'messages_delete_thread', 'bp_core_clear_cache' );
+add_action( 'messages_send_notice', 'bp_core_clear_cache' );
+add_action( 'messages_message_sent', 'bp_core_clear_cache' );
+
+// Don't cache message inbox/sentbox/compose as it's too problematic
+add_action( 'messages_screen_compose', 'bp_core_clear_cache' );
+add_action( 'messages_screen_sentbox', 'bp_core_clear_cache' );
+add_action( 'messages_screen_inbox', 'bp_core_clear_cache' );
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-messages/bp-messages-classes.php b/wp-content/plugins/buddypress/bp-messages/bp-messages-classes.php
new file mode 100644
index 0000000000000000000000000000000000000000..80caa004ac70370e59121f36f9287b4b4a544df1
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-messages/bp-messages-classes.php
@@ -0,0 +1,462 @@
+<?php
+
+Class BP_Messages_Thread {
+	var $thread_id;
+	var $messages;
+	var $recipients;
+	var $sender_ids;
+
+	var $unread_count;
+
+	function bp_messages_thread ( $thread_id = false ) {
+		if ( $thread_id )
+			$this->populate( $thread_id );
+	}
+
+	function populate( $thread_id ) {
+		global $wpdb, $bp;
+
+		$this->thread_id = $thread_id;
+
+		if ( !$this->messages = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_messages} WHERE thread_id = %d ORDER BY date_sent ASC", $this->thread_id ) ) )
+			return false;
+
+		foreach ( (array)$this->messages as $key => $message )
+			$this->sender_ids[$message->sender_id] = $message->sender_id;
+
+		/* Fetch the recipients */
+		$this->recipients = $this->get_recipients();
+
+		/* Get the unread count for the logged in user */
+		if ( isset( $this->recipients[$bp->loggedin_user->id] ) )
+			$this->unread_count = $this->recipients[$bp->loggedin_user->id]->unread_count;
+	}
+
+	function mark_read() {
+		BP_Messages_Thread::mark_as_read( $this->thread_id );
+	}
+
+	function mark_unread() {
+		BP_Messages_Thread::mark_as_unread( $this->thread_id );
+	}
+
+	function get_recipients() {
+		global $wpdb, $bp;
+
+		$results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $this->thread_id ) );
+
+		foreach ( (array)$results as $recipient )
+			$recipients[$recipient->user_id] = $recipient;
+
+		return $recipients;
+	}
+
+	/** Static Functions **/
+
+	function delete( $thread_id ) {
+		global $wpdb, $bp;
+
+		$delete_for_user = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET is_deleted = 1 WHERE thread_id = %d AND user_id = %d", $thread_id, $bp->loggedin_user->id ) );
+
+		// Check to see if any more recipients remain for this message
+		// if not, then delete the message from the database.
+		$recipients = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d AND is_deleted = 0", $thread_id ) );
+
+		if ( empty( $recipients ) ) {
+			/* Delete all the messages */
+			$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_messages} WHERE thread_id = %d", $thread_id ) );
+
+			/* Delete all the recipients */
+			$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $thread_id ) );
+		}
+
+		return true;
+	}
+
+	function get_current_threads_for_user( $user_id, $box = 'inbox', $type = 'all', $limit = null, $page = null ) {
+		global $wpdb, $bp;
+
+		if ( $limit && $page )
+			$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
+
+		if ( $type == 'unread' )
+			$type_sql = $wpdb->prepare( " AND r.unread_count != 0 " );
+		else if ( $type == 'read' )
+			$type_sql = $wpdb->prepare( " AND r.unread_count = 0 " );
+
+		if ( 'sentbox' == $box ) {
+			$thread_ids = $wpdb->get_results( $wpdb->prepare( "SELECT m.thread_id, MAX(m.date_sent) AS date_sent FROM {$bp->messages->table_name_recipients} r, {$bp->messages->table_name_messages} m WHERE m.thread_id = r.thread_id AND m.sender_id = r.user_id AND m.sender_id = %d AND r.is_deleted = 0 GROUP BY m.thread_id ORDER BY m.date_sent DESC {$pag_sql}", $bp->loggedin_user->id ) );
+			$total_threads = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( DISTINCT m.thread_id ) FROM {$bp->messages->table_name_recipients} r, {$bp->messages->table_name_messages} m WHERE m.thread_id = r.thread_id AND m.sender_id = r.user_id AND m.sender_id = %d AND r.is_deleted = 0 ", $bp->loggedin_user->id ) );
+		} else {
+			$thread_ids = $wpdb->get_results( $wpdb->prepare( "SELECT m.thread_id, MAX(m.date_sent) AS date_sent FROM {$bp->messages->table_name_recipients} r, {$bp->messages->table_name_messages} m WHERE m.thread_id = r.thread_id AND r.is_deleted = 0 AND r.user_id = %d AND r.sender_only = 0 {$type_sql} GROUP BY m.thread_id ORDER BY m.date_sent DESC {$pag_sql}", $bp->loggedin_user->id ) );
+			$total_threads = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( DISTINCT m.thread_id ) FROM {$bp->messages->table_name_recipients} r, {$bp->messages->table_name_messages} m WHERE m.thread_id = r.thread_id AND r.is_deleted = 0 AND r.user_id = %d AND r.sender_only = 0 {$type_sql}", $bp->loggedin_user->id ) );
+		}
+
+		if ( empty( $thread_ids ) )
+			return false;
+
+		/* Sort threads by date_sent */
+		foreach( (array)$thread_ids as $thread ) {
+			$sorted_threads[$thread->thread_id] = strtotime($thread->date_sent);
+		}
+		arsort($sorted_threads);
+
+		$threads = false;
+		foreach ( (array)$sorted_threads as $thread_id => $date_sent )
+			$threads[] = new BP_Messages_Thread( $thread_id );
+
+		return array( 'threads' => &$threads, 'total' => (int)$total_threads );
+	}
+
+	function mark_as_read( $thread_id ) {
+		global $wpdb, $bp;
+
+		$sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = 0 WHERE user_id = %d AND thread_id = %d", $bp->loggedin_user->id, $thread_id );
+		$wpdb->query($sql);
+	}
+
+	function mark_as_unread( $thread_id ) {
+		global $wpdb, $bp;
+
+		$sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = 1 WHERE user_id = %d AND thread_id = %d", $bp->loggedin_user->id, $thread_id );
+		$wpdb->query($sql);
+	}
+
+	function get_total_threads_for_user( $user_id, $box = 'inbox', $type = 'all' ) {
+		global $wpdb, $bp;
+
+		$exclude_sender = '';
+		if ( $box != 'sentbox' )
+			$exclude_sender = ' AND sender_only != 1';
+
+		if ( $type == 'unread' )
+			$type_sql = $wpdb->prepare( " AND unread_count != 0 " );
+		else if ( $type == 'read' )
+			$type_sql = $wpdb->prepare( " AND unread_count = 0 " );
+
+		return (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(thread_id) FROM {$bp->messages->table_name_recipients} WHERE user_id = %d AND is_deleted = 0$exclude_sender $type_sql", $user_id ) );
+	}
+
+	function user_is_sender( $thread_id ) {
+		global $wpdb, $bp;
+
+		$sender_ids = $wpdb->get_col( $wpdb->prepare( "SELECT sender_id FROM {$bp->messages->table_name_messages} WHERE thread_id = %d", $thread_id ) );
+
+		if ( !$sender_ids )
+			return false;
+
+		return in_array( $bp->loggedin_user->id, $sender_ids );
+	}
+
+	function get_last_sender( $thread_id ) {
+		global $wpdb, $bp;
+
+		if ( !$sender_id = $wpdb->get_var( $wpdb->prepare( "SELECT sender_id FROM {$bp->messages->table_name_messages} WHERE thread_id = %d GROUP BY sender_id ORDER BY date_sent LIMIT 1", $thread_id ) ) )
+			return false;
+
+		return bp_core_get_userlink( $sender_id, true );
+	}
+
+	function get_inbox_count() {
+		global $wpdb, $bp;
+
+		$sql = $wpdb->prepare( "SELECT unread_count FROM {$bp->messages->table_name_recipients} WHERE user_id = %d AND is_deleted = 0 AND sender_only = 0", $bp->loggedin_user->id );
+
+		if ( !$unread_counts = $wpdb->get_results($sql) )
+			return false;
+
+		$count = 0;
+		for ( $i = 0; $i < count($unread_counts); $i++ ) {
+			$count += $unread_counts[$i]->unread_count;
+		}
+
+		return $count;
+	}
+
+	function check_access( $thread_id, $user_id = false ) {
+		global $wpdb, $bp;
+
+		if ( !$user_id )
+			$user_id = $bp->loggedin_user->id;
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d AND user_id = %d", $thread_id, $user_id ) );
+	}
+
+	function is_valid( $thread_id ) {
+		global $wpdb, $bp;
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT thread_id FROM {$bp->messages->table_name_messages} WHERE thread_id = %d LIMIT 1", $thread_id ) );
+	}
+
+	function get_recipient_links($recipients) {
+		if ( count($recipients) >= 5 )
+			return count( $recipients ) . __(' Recipients', 'buddypress');
+
+		foreach ( (array)$recipients as $recipient ) {
+			$recipient_links[] = bp_core_get_userlink( $recipient->user_id );
+		}
+
+		return implode( ', ', (array) $recipient_links );
+	}
+
+	/* Upgrade Functions */
+
+	function upgrade_tables() {
+		global $wpdb, $bp;
+
+		$errors = false;
+		$threads = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->base_prefix}bp_messages_threads" ) );
+
+		/* Nothing to upgrade, just return true to remove the table */
+		if ( empty( $threads ) )
+			return true;
+
+		foreach( (array)$threads as $thread ) {
+			$message_ids = maybe_unserialize( $thread->message_ids );
+
+			if ( !empty( $message_ids ) ) {
+				$message_ids = implode( ',', $message_ids );
+
+				/* Add the thread_id to the messages table */
+				if ( !$wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_messages} SET thread_id = %d WHERE id IN ({$message_ids})", $thread->id ) ) )
+					$errors = true;
+			}
+		}
+
+		if ( $errors )
+			return false;
+
+		return true;
+	}
+}
+
+Class BP_Messages_Message {
+	var $id;
+	var $thread_id;
+	var $sender_id;
+	var $subject;
+	var $message;
+	var $date_sent;
+
+	var $recipients = false;
+
+	function bp_messages_message( $id = null ) {
+		global $bp;
+
+		$this->date_sent = bp_core_current_time();
+		$this->sender_id = $bp->loggedin_user->id;
+
+		if ( $id ) {
+			$this->populate($id);
+		}
+	}
+
+	function populate( $id ) {
+		global $wpdb, $bp;
+
+		if ( $message = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_messages} WHERE id = %d", $id ) ) ) {
+			$this->id = $message->id;
+			$this->thread_id = $message->thread_id;
+			$this->sender_id = $message->sender_id;
+			$this->subject = $message->subject;
+			$this->message = $message->message;
+			$this->date_sent = $message->date_sent;
+		}
+	}
+
+	function send() {
+		global $wpdb, $bp;
+
+		$this->sender_id = apply_filters( 'messages_message_sender_id_before_save', $this->sender_id, $this->id );
+		$this->thread_id = apply_filters( 'messages_message_thread_id_before_save', $this->thread_id, $this->id );
+		$this->subject = apply_filters( 'messages_message_subject_before_save', $this->subject, $this->id );
+		$this->message = apply_filters( 'messages_message_content_before_save', $this->message, $this->id );
+		$this->date_sent = apply_filters( 'messages_message_date_sent_before_save', $this->date_sent, $this->id );
+
+		do_action( 'messages_message_before_save', $this );
+
+		/* Make sure we have at least one recipient before sending. */
+		if ( empty( $this->recipients ) )
+			return false;
+
+		$new_thread = false;
+
+		/* If we have no thread_id then this is the first message of a new thread. */
+		if ( empty( $this->thread_id ) ) {
+			$this->thread_id = (int)$wpdb->get_var( $wpdb->prepare( "SELECT MAX(thread_id) FROM {$bp->messages->table_name_messages}" ) ) + 1;
+			$new_thread = true;
+		}
+
+		// 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, %s )", $this->thread_id, $this->sender_id, $this->subject, $this->message, $this->date_sent ) ) )
+			return false;
+
+		if ( $new_thread ) {
+			/* Add an recipient entry for all recipients */
+			foreach ( (array)$this->recipients as $recipient )
+				$wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_recipients} ( user_id, thread_id, unread_count ) VALUES ( %d, %d, 1 )", $recipient->user_id, $this->thread_id ) );
+
+			/* Add a sender recipient entry if the sender is not in the list of recipients */
+			if ( !in_array( $this->sender_id, $this->recipients ) )
+				$wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_recipients} ( user_id, thread_id, sender_only ) VALUES ( %d, %d, 1 )", $this->sender_id, $this->thread_id ) );
+		} else {
+			/* Update the unread count for all recipients */
+			$wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = unread_count + 1, sender_only = 0, is_deleted = 0 WHERE thread_id = %d AND user_id != %d", $this->thread_id, $this->sender_id ) );
+		}
+
+		$this->id = $wpdb->insert_id;
+		messages_remove_callback_values();
+
+		do_action( 'messages_message_after_save', $this );
+
+		return $this->id;
+	}
+
+	function get_recipients() {
+		global $bp, $wpdb;
+
+		return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $this->thread_id ) );
+	}
+
+	// Static Functions
+
+	function get_recipient_ids( $recipient_usernames ) {
+		if ( !$recipient_usernames )
+			return false;
+
+		if ( is_array( $recipient_usernames ) ) {
+			for ( $i = 0; $i < count($recipient_usernames); $i++ ) {
+				if ( $rid = bp_core_get_userid( trim($recipient_usernames[$i]) ) )
+					$recipient_ids[] = $rid;
+			}
+		}
+
+		return $recipient_ids;
+	}
+
+	function get_last_sent_for_user( $thread_id ) {
+		global $wpdb, $bp;
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE sender_id = %d AND thread_id = %d ORDER BY date_sent DESC LIMIT 1", $bp->loggedin_user->id, $thread_id ) );
+	}
+
+	function is_user_sender( $user_id, $message_id ) {
+		global $wpdb, $bp;
+		return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE sender_id = %d AND id = %d", $user_id, $message_id ) );
+	}
+
+	function get_message_sender( $message_id ) {
+		global $wpdb, $bp;
+		return $wpdb->get_var( $wpdb->prepare( "SELECT sender_id FROM {$bp->messages->table_name_messages} WHERE id = %d", $message_id ) );
+	}
+}
+
+Class BP_Messages_Notice {
+	var $id = null;
+	var $subject;
+	var $message;
+	var $date_sent;
+	var $is_active;
+
+	function bp_messages_notice($id = null) {
+		if ( $id ) {
+			$this->id = $id;
+			$this->populate($id);
+		}
+	}
+
+	function populate() {
+		global $wpdb, $bp;
+
+		$notice = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_notices} WHERE id = %d", $this->id ) );
+
+		if ( $notice ) {
+			$this->subject = $notice->subject;
+			$this->message = $notice->message;
+			$this->date_sent = $notice->date_sent;
+			$this->is_active = $notice->is_active;
+		}
+	}
+
+	function save() {
+		global $wpdb, $bp;
+
+		$this->subject = apply_filters( 'messages_notice_subject_before_save', $this->subject, $this->id );
+		$this->message = apply_filters( 'messages_notice_message_before_save', $this->message, $this->id );
+
+		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, %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 );
+		}
+
+		if ( !$wpdb->query($sql) )
+			return false;
+
+		if ( !$id = $this->id )
+			$id = $wpdb->insert_id;
+
+		// 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_user_meta( $bp->loggedin_user->id, 'last_activity', date( 'Y-m-d H:i:s' ) );
+
+		do_action( 'messages_notice_after_save', $this );
+
+		return true;
+	}
+
+	function activate() {
+		$this->is_active = 1;
+		if ( !$this->save() )
+			return false;
+
+		return true;
+	}
+
+	function deactivate() {
+		$this->is_active = 0;
+		if ( !$this->save() )
+			return false;
+
+		return true;
+	}
+
+	function delete() {
+		global $wpdb, $bp;
+
+		$sql = $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_notices} WHERE id = %d", $this->id );
+
+		if ( !$wpdb->query($sql) )
+			return false;
+
+		return true;
+	}
+
+	// Static Functions
+
+	function get_notices() {
+		global $wpdb, $bp;
+
+		$notices = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_notices} ORDER BY date_sent DESC" ) );
+		return $notices;
+	}
+
+	function get_total_notice_count() {
+		global $wpdb, $bp;
+
+		$notice_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM " . $bp->messages->table_name_notices ) );
+
+		return $notice_count;
+	}
+
+	function get_active() {
+		global $wpdb, $bp;
+
+		$notice_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_notices} WHERE is_active = 1") );
+		return new BP_Messages_Notice($notice_id);
+	}
+}
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-messages/bp-messages-cssjs.php b/wp-content/plugins/buddypress/bp-messages/bp-messages-cssjs.php
new file mode 100644
index 0000000000000000000000000000000000000000..1ff9734ddd9ab20468158da4d5f0cdc1369ae97f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-messages/bp-messages-cssjs.php
@@ -0,0 +1,44 @@
+<?php
+
+function messages_add_autocomplete_js() {
+	global $bp;
+
+	// Include the autocomplete JS for composing a message.
+	if ( $bp->current_component == $bp->messages->slug && 'compose' == $bp->current_action ) {
+		add_action( 'wp_head', 'messages_autocomplete_init_jsblock' );
+
+		wp_enqueue_script( 'bp-jquery-autocomplete', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.autocomplete.js', array( 'jquery' ) );
+		wp_enqueue_script( 'bp-jquery-autocomplete-fb', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.autocompletefb.js' );
+		wp_enqueue_script( 'bp-jquery-bgiframe', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.bgiframe.min.js' );
+		wp_enqueue_script( 'bp-jquery-dimensions', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.dimensions.js' );
+	}
+
+}
+add_action( 'wp', 'messages_add_autocomplete_js', 2 );
+
+function messages_add_autocomplete_css() {
+	global $bp;
+
+	if ( $bp->current_component == $bp->messages->slug && 'compose' == $bp->current_action ) {
+		wp_enqueue_style( 'bp-messages-autocomplete', BP_PLUGIN_URL . '/bp-messages/css/autocomplete/jquery.autocompletefb.css' );
+		wp_print_styles();
+	}
+}
+add_action( 'wp_head', 'messages_add_autocomplete_css' );
+
+function messages_autocomplete_init_jsblock() {
+	global $bp;
+?>
+	<script type="text/javascript">
+		jQuery(document).ready(function() {
+			var acfb =
+			jQuery("ul.first").autoCompletefb({urlLookup:'<?php echo $bp->root_domain . str_replace( 'index.php', 'wp-load.php', $_SERVER['SCRIPT_NAME'] ) ?>'});
+
+			jQuery('#send_message_form').submit( function() {
+				var users = document.getElementById('send-to-usernames').className;
+				document.getElementById('send-to-usernames').value = String(users);
+			});
+		});
+	</script>
+<?php
+}
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-messages/bp-messages-filters.php b/wp-content/plugins/buddypress/bp-messages/bp-messages-filters.php
new file mode 100644
index 0000000000000000000000000000000000000000..1752fe5c167551a126ab59d7ddd063f45e58fc92
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-messages/bp-messages-filters.php
@@ -0,0 +1,61 @@
+<?php
+
+/* Apply WordPress defined filters */
+add_filter( 'bp_get_message_notice_subject', 'wp_filter_kses', 1 );
+add_filter( 'bp_get_message_notice_text', 'wp_filter_kses', 1 );
+add_filter( 'bp_get_message_thread_subject', 'wp_filter_kses', 1 );
+add_filter( 'bp_get_message_thread_excerpt', 'wp_filter_kses', 1 );
+add_filter( 'bp_get_messages_subject_value', 'wp_filter_kses', 1 );
+add_filter( 'bp_get_messages_content_value', 'wp_filter_kses', 1 );
+add_filter( 'bp_get_the_thread_message_content', 'wp_filter_kses', 1 );
+
+add_filter( 'messages_message_content_before_save', 'wp_filter_kses', 1 );
+add_filter( 'messages_message_subject_before_save', 'wp_filter_kses', 1 );
+add_filter( 'messages_notice_message_before_save', 'wp_filter_kses', 1 );
+add_filter( 'messages_notice_subject_before_save', 'wp_filter_kses', 1 );
+
+add_filter( 'bp_get_the_thread_message_content', 'wp_filter_kses', 1 );
+add_filter( 'bp_get_the_thread_subject', 'wp_filter_kses', 1 );
+
+add_filter( 'messages_message_content_before_save', 'force_balance_tags' );
+add_filter( 'messages_message_subject_before_save', 'force_balance_tags' );
+add_filter( 'messages_notice_message_before_save', 'force_balance_tags' );
+add_filter( 'messages_notice_subject_before_save', 'force_balance_tags' );
+
+add_filter( 'bp_get_message_notice_subject', 'wptexturize' );
+add_filter( 'bp_get_message_notice_text', 'wptexturize' );
+add_filter( 'bp_get_message_thread_subject', 'wptexturize' );
+add_filter( 'bp_get_message_thread_excerpt', 'wptexturize' );
+add_filter( 'bp_get_the_thread_message_content', 'wptexturize' );
+
+add_filter( 'bp_get_message_notice_subject', 'convert_smilies', 2 );
+add_filter( 'bp_get_message_notice_text', 'convert_smilies', 2 );
+add_filter( 'bp_get_message_thread_subject', 'convert_smilies', 2 );
+add_filter( 'bp_get_message_thread_excerpt', 'convert_smilies', 2 );
+add_filter( 'bp_get_the_thread_message_content', 'convert_smilies', 2 );
+
+add_filter( 'bp_get_message_notice_subject', 'convert_chars' );
+add_filter( 'bp_get_message_notice_text', 'convert_chars' );
+add_filter( 'bp_get_message_thread_subject', 'convert_chars' );
+add_filter( 'bp_get_message_thread_excerpt', 'convert_chars' );
+add_filter( 'bp_get_the_thread_message_content', 'convert_chars' );
+
+add_filter( 'bp_get_message_notice_text', 'make_clickable' );
+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_text', 'wpautop' );
+add_filter( 'bp_get_the_thread_message_content', 'wpautop' );
+
+add_filter( 'bp_get_message_notice_subject', 'stripslashes_deep' );
+add_filter( 'bp_get_message_notice_text', 'stripslashes_deep' );
+add_filter( 'bp_get_message_thread_subject', 'stripslashes_deep' );
+add_filter( 'bp_get_message_thread_excerpt', 'stripslashes_deep' );
+add_filter( 'bp_get_messages_subject_value', 'stripslashes_deep' );
+add_filter( 'bp_get_messages_content_value', 'stripslashes_deep' );
+add_filter( 'bp_get_the_thread_message_content', 'stripslashes_deep' );
+
+add_filter( 'bp_get_the_thread_message_content', 'stripslashes_deep' );
+add_filter( 'bp_get_the_thread_subject', 'stripslashes_deep' );
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-messages/bp-messages-notifications.php b/wp-content/plugins/buddypress/bp-messages/bp-messages-notifications.php
new file mode 100644
index 0000000000000000000000000000000000000000..87c821314fca41fe69dfe11044ac336c3c351577
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-messages/bp-messages-notifications.php
@@ -0,0 +1,48 @@
+<?php
+
+function messages_notification_new_message( $args ) {
+	global $bp;
+	extract($args);
+
+	$sender_name = bp_core_get_user_displayname( $sender_id );
+
+	foreach( $recipients as $recipient ) {
+		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 .'/';
+		$settings_link = bp_core_get_user_domain( $recipient->user_id ) .  BP_SETTINGS_SLUG . '/notifications/';
+
+		$sender_name = stripslashes( $sender_name );
+		$subject = stripslashes( wp_filter_kses( $subject ) );
+		$content = stripslashes( wp_filter_kses( $content ) );
+
+		// Set up and send the message
+		$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( __(
+'%s sent you a new message:
+
+Subject: %s
+
+"%s"
+
+To view and read your messages please log in and visit: %s
+
+---------------------
+', 'buddypress' ), $sender_name, $subject, $content, $message_link );
+
+		$email_content .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
+
+		/* Send the message */
+		$email_to = apply_filters( 'messages_notification_new_message_to', $email_to );
+		$email_subject = apply_filters( 'messages_notification_new_message_subject', $email_subject, $sender_name );
+		$email_content = apply_filters( 'messages_notification_new_message_message', $email_content, $sender_name, $subject, $content, $message_link );
+
+		wp_mail( $email_to, $email_subject, $email_content );
+	}
+}
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-messages/bp-messages-templatetags.php b/wp-content/plugins/buddypress/bp-messages/bp-messages-templatetags.php
new file mode 100644
index 0000000000000000000000000000000000000000..2823b74e3881ac3e03b23129fdf2a929eb0ea84f
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-messages/bp-messages-templatetags.php
@@ -0,0 +1,786 @@
+<?php
+
+/*****************************************************************************
+ * Message Box Template Class
+ **/
+
+Class BP_Messages_Box_Template {
+	var $current_thread = -1;
+	var $current_thread_count;
+	var $total_thread_count;
+	var $threads;
+	var $thread;
+
+	var $in_the_loop;
+	var $user_id;
+	var $box;
+
+	var $pag_page;
+	var $pag_num;
+	var $pag_links;
+
+	function bp_messages_box_template( $user_id, $box, $per_page, $max, $type ) {
+		$this->pag_page = isset( $_GET['mpage'] ) ? intval( $_GET['mpage'] ) : 1;
+		$this->pag_num  = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : $per_page;
+
+		$this->user_id  = $user_id;
+		$this->box      = $box;
+		$this->type     = $type;
+
+		if ( 'notices' == $this->box ) {
+			$this->threads = BP_Messages_Notice::get_notices();
+		} else {
+			$threads = BP_Messages_Thread::get_current_threads_for_user( $this->user_id, $this->box, $this->type, $this->pag_num, $this->pag_page );
+
+			$this->threads            = $threads['threads'];
+			$this->total_thread_count = $threads['total'];
+		}
+
+		if ( !$this->threads ) {
+			$this->thread_count       = 0;
+			$this->total_thread_count = 0;
+		} else {
+			$total_notice_count = BP_Messages_Notice::get_total_notice_count();
+
+			if ( !$max || $max >= (int)$total_notice_count ) {
+				if ( 'notices' == $this->box ) {
+					$this->total_thread_count = (int)$total_notice_count;
+				}
+			} else {
+				$this->total_thread_count = (int)$max;
+			}
+
+			if ( $max ) {
+				if ( $max >= count($this->threads) ) {
+					$this->thread_count = count($this->threads);
+				} else {
+					$this->thread_count = (int)$max;
+				}
+			} else {
+				$this->thread_count = count($this->threads);
+			}
+		}
+
+		if ( (int)$this->total_thread_count && (int)$this->pag_num ) {
+			$this->pag_links = paginate_links( array(
+				'base'      => add_query_arg( 'mpage', '%#%' ),
+				'format'    => '',
+				'total'     => ceil( (int)$this->total_thread_count / (int)$this->pag_num ),
+				'current'   => $this->pag_page,
+				'prev_text' => '&larr;',
+				'next_text' => '&rarr;',
+				'mid_size'  => 1
+			) );
+		}
+	}
+
+	function has_threads() {
+		if ( $this->thread_count )
+			return true;
+
+		return false;
+	}
+
+	function next_thread() {
+		$this->current_thread++;
+		$this->thread = $this->threads[$this->current_thread];
+
+		return $this->thread;
+	}
+
+	function rewind_threads() {
+		$this->current_thread = -1;
+		if ( $this->thread_count > 0 ) {
+			$this->thread = $this->threads[0];
+		}
+	}
+
+	function message_threads() {
+		if ( $this->current_thread + 1 < $this->thread_count ) {
+			return true;
+		} elseif ( $this->current_thread + 1 == $this->thread_count ) {
+			do_action('loop_end');
+			// Do some cleaning up after the loop
+			$this->rewind_threads();
+		}
+
+		$this->in_the_loop = false;
+		return false;
+	}
+
+	function the_message_thread() {
+		global $bp;
+
+		$this->in_the_loop = true;
+		$this->thread = $this->next_thread();
+
+		$last_message_index = count($this->thread->messages) - 1;
+		$this->thread->messages = array_reverse( (array)$this->thread->messages );
+
+		/* Set up the last message data */
+		if ( count($this->thread->messages) > 1 ) {
+			if ( 'inbox' == $this->box ) {
+				foreach ( (array)$this->thread->messages as $key => $message ) {
+					if ( $bp->loggedin_user->id != $message->sender_id ) {
+						$last_message_index = $key;
+						break;
+					}
+				}
+			} else if ( 'sentbox' == $this->box ) {
+				foreach ( (array)$this->thread->messages as $key => $message ) {
+					if ( $bp->loggedin_user->id == $message->sender_id ) {
+						$last_message_index = $key;
+						break;
+					}
+				}
+			}
+		}
+
+		$this->thread->last_message_id = $this->thread->messages[$last_message_index]->id;
+		$this->thread->last_message_date = $this->thread->messages[$last_message_index]->date_sent;
+		$this->thread->last_sender_id = $this->thread->messages[$last_message_index]->sender_id;
+		$this->thread->last_message_subject = $this->thread->messages[$last_message_index]->subject;
+		$this->thread->last_message_content = $this->thread->messages[$last_message_index]->message;
+
+		if ( 0 == $this->current_thread ) // loop has just started
+			do_action('loop_start');
+	}
+}
+
+function bp_has_message_threads( $args = '' ) {
+	global $bp, $messages_template;
+
+	$defaults = array(
+		'user_id' => $bp->loggedin_user->id,
+		'box' => 'inbox',
+		'per_page' => 10,
+		'max' => false,
+		'type' => 'all'
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	if ( 'notices' == $bp->current_action && !is_super_admin() ) {
+		wp_redirect( $bp->displayed_user->id );
+	} else {
+		if ( 'inbox' == $bp->current_action )
+			bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->messages->id, 'new_message' );
+
+		if ( 'sentbox' == $bp->current_action )
+			$box = 'sentbox';
+
+		if ( 'notices' == $bp->current_action )
+			$box = 'notices';
+
+		$messages_template = new BP_Messages_Box_Template( $user_id, $box, $per_page, $max, $type );
+	}
+
+	return apply_filters( 'bp_has_message_threads', $messages_template->has_threads(), &$messages_template );
+}
+
+function bp_message_threads() {
+	global $messages_template;
+	return $messages_template->message_threads();
+}
+
+function bp_message_thread() {
+	global $messages_template;
+	return $messages_template->the_message_thread();
+}
+
+function bp_message_thread_id() {
+	echo bp_get_message_thread_id();
+}
+	function bp_get_message_thread_id() {
+		global $messages_template;
+
+		return apply_filters( 'bp_get_message_thread_id', $messages_template->thread->thread_id );
+	}
+
+function bp_message_thread_subject() {
+	echo bp_get_message_thread_subject();
+}
+	function bp_get_message_thread_subject() {
+		global $messages_template, $message_template_subject;
+
+		return apply_filters( 'bp_get_message_thread_subject', stripslashes_deep( $messages_template->thread->last_message_subject ) );
+	}
+
+function bp_message_thread_excerpt() {
+	echo bp_get_message_thread_excerpt();
+}
+	function bp_get_message_thread_excerpt() {
+		global $messages_template;
+
+		return apply_filters( 'bp_get_message_thread_excerpt', strip_tags( bp_create_excerpt( $messages_template->thread->last_message_content, 10 ) ) );
+	}
+
+function bp_message_thread_from() {
+	echo bp_get_message_thread_from();
+}
+	function bp_get_message_thread_from() {
+		global $messages_template, $bp;
+
+		return apply_filters( 'bp_get_message_thread_from', bp_core_get_userlink( $messages_template->thread->last_sender_id ) );
+	}
+
+function bp_message_thread_to() {
+	echo bp_get_message_thread_to();
+}
+	function bp_get_message_thread_to() {
+		global $messages_template;
+		return apply_filters( 'bp_message_thread_to', BP_Messages_Thread::get_recipient_links($messages_template->thread->recipients) );
+	}
+
+function bp_message_thread_view_link() {
+	echo bp_get_message_thread_view_link();
+}
+	function bp_get_message_thread_view_link() {
+		global $messages_template, $bp;
+		return apply_filters( 'bp_get_message_thread_view_link', $bp->loggedin_user->domain . $bp->messages->slug . '/view/' . $messages_template->thread->thread_id );
+	}
+
+function bp_message_thread_delete_link() {
+	echo bp_get_message_thread_delete_link();
+}
+	function bp_get_message_thread_delete_link() {
+		global $messages_template, $bp;
+		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;
+
+	if ( $messages_template->thread->unread_count )
+		return true;
+
+	return false;
+}
+
+function bp_message_thread_unread_count() {
+	echo bp_get_message_thread_unread_count();
+}
+	function bp_get_message_thread_unread_count() {
+		global $messages_template;
+
+		if ( (int)$messages_template->thread->unread_count )
+			return apply_filters( 'bp_get_message_thread_unread_count', $messages_template->thread->unread_count );
+
+		return false;
+	}
+
+function bp_message_thread_last_post_date() {
+	echo bp_get_message_thread_last_post_date();
+}
+	function bp_get_message_thread_last_post_date() {
+		global $messages_template;
+
+		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() {
+	echo bp_get_message_thread_avatar();
+}
+	function bp_get_message_thread_avatar() {
+		global $messages_template, $bp;
+
+		return apply_filters( 'bp_get_message_thread_avatar', bp_core_fetch_avatar( array( 'item_id' => $messages_template->thread->last_sender_id, 'type' => 'thumb' ) ) );
+	}
+
+function bp_message_thread_view() {
+	global $thread_id;
+
+	messages_view_thread($thread_id);
+}
+
+function bp_total_unread_messages_count() {
+	echo bp_get_total_unread_messages_count();
+}
+	function bp_get_total_unread_messages_count() {
+		return apply_filters( 'bp_get_total_unread_messages_count', BP_Messages_Thread::get_inbox_count() );
+	}
+
+function bp_messages_pagination() {
+	echo bp_get_messages_pagination();
+}
+	function bp_get_messages_pagination() {
+		global $messages_template;
+		return apply_filters( 'bp_get_messages_pagination', $messages_template->pag_links );
+	}
+
+function bp_messages_pagination_count() {
+	global $messages_template;
+
+	$start_num = intval( ( $messages_template->pag_page - 1 ) * $messages_template->pag_num ) + 1;
+	$from_num = bp_core_number_format( $start_num );
+	$to_num = bp_core_number_format( ( $start_num + ( $messages_template->pag_num - 1 ) > $messages_template->total_thread_count ) ? $messages_template->total_thread_count : $start_num + ( $messages_template->pag_num - 1 ) );
+	$total = bp_core_number_format( $messages_template->total_thread_count );
+
+	echo sprintf( __( 'Viewing message %1$s to %2$s (of %3$s messages)', 'buddypress' ), $from_num, $to_num, $total ); ?> &nbsp;
+	<span class="ajax-loader"></span><?php
+}
+
+function bp_messages_form_action() {
+	echo bp_get_messages_form_action();
+}
+	function bp_get_messages_form_action() {
+		global $bp;
+
+		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() {
+	echo bp_get_messages_username_value();
+}
+	function bp_get_messages_username_value() {
+		if ( isset( $_COOKIE['bp_messages_send_to'] ) ) {
+			return apply_filters( 'bp_get_messages_username_value', $_COOKIE['bp_messages_send_to'] );
+		} else if ( isset( $_GET['r'] ) && !isset( $_COOKIE['bp_messages_send_to'] ) ) {
+			return apply_filters( 'bp_get_messages_username_value', $_GET['r'] );
+		}
+	}
+
+function bp_messages_subject_value() {
+	echo bp_get_messages_subject_value();
+}
+	function bp_get_messages_subject_value() {
+		return apply_filters( 'bp_get_messages_subject_value', $_POST['subject'] );
+	}
+
+function bp_messages_content_value() {
+	echo bp_get_messages_content_value();
+}
+	function bp_get_messages_content_value() {
+		return apply_filters( 'bp_get_messages_content_value', $_POST['content'] );
+	}
+
+function bp_messages_options() {
+	global $bp;
+?>
+	<?php _e( 'Select:', 'buddypress' ) ?>
+	<select name="message-type-select" id="message-type-select">
+		<option value=""></option>
+		<option value="read"><?php _e('Read', 'buddypress') ?></option>
+		<option value="unread"><?php _e('Unread', 'buddypress') ?></option>
+		<option value="all"><?php _e('All', 'buddypress') ?></option>
+	</select> &nbsp;
+	<?php if ( $bp->current_action != 'sentbox' && $bp->current_action != 'notices' ) : ?>
+		<a href="#" id="mark_as_read"><?php _e('Mark as Read', 'buddypress') ?></a> &nbsp;
+		<a href="#" id="mark_as_unread"><?php _e('Mark as Unread', 'buddypress') ?></a> &nbsp;
+	<?php endif; ?>
+	<a href="#" id="delete_<?php echo $bp->current_action ?>_messages"><?php _e('Delete Selected', 'buddypress') ?></a> &nbsp;
+<?php
+}
+
+function bp_message_is_active_notice() {
+	global $messages_template;
+
+	if ( $messages_template->thread->is_active ) {
+		echo "<strong>";
+		_e( 'Currently Active', 'buddypress' );
+		echo "</strong>";
+	}
+}
+	function bp_get_message_is_active_notice() {
+		global $messages_template;
+
+		if ( $messages_template->thread->is_active )
+			return true;
+
+		return false;
+	}
+
+function bp_message_notice_post_date() {
+	echo bp_get_message_notice_post_date();
+}
+	function bp_get_message_notice_post_date() {
+		global $messages_template;
+		return apply_filters( 'bp_get_message_notice_post_date', bp_format_time( strtotime($messages_template->thread->date_sent) ) );
+	}
+
+function bp_message_notice_subject() {
+	echo bp_get_message_notice_subject();
+}
+	function bp_get_message_notice_subject() {
+		global $messages_template;
+		return apply_filters( 'bp_get_message_notice_subject', $messages_template->thread->subject );
+	}
+
+function bp_message_notice_text() {
+	echo bp_get_message_notice_text();
+}
+	function bp_get_message_notice_text() {
+		global $messages_template;
+		return apply_filters( 'bp_get_message_notice_text', $messages_template->thread->message );
+	}
+
+function bp_message_notice_delete_link() {
+	echo bp_get_message_notice_delete_link();
+}
+	function bp_get_message_notice_delete_link() {
+		global $messages_template, $bp;
+
+		return apply_filters( 'bp_get_message_notice_delete_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->messages->slug . '/notices/delete/' . $messages_template->thread->id, 'messages_delete_thread' ) );
+	}
+
+function bp_message_activate_deactivate_link() {
+	echo bp_get_message_activate_deactivate_link();
+}
+	function bp_get_message_activate_deactivate_link() {
+		global $messages_template, $bp;
+
+		if ( 1 == (int)$messages_template->thread->is_active ) {
+			$link = wp_nonce_url( $bp->loggedin_user->domain . $bp->messages->slug . '/notices/deactivate/' . $messages_template->thread->id, 'messages_deactivate_notice' );
+		} else {
+			$link = wp_nonce_url( $bp->loggedin_user->domain . $bp->messages->slug . '/notices/activate/' . $messages_template->thread->id, 'messages_activate_notice' );
+		}
+		return apply_filters( 'bp_get_message_activate_deactivate_link', $link );
+	}
+
+function bp_message_activate_deactivate_text() {
+	echo bp_get_message_activate_deactivate_text();
+}
+	function bp_get_message_activate_deactivate_text() {
+		global $messages_template;
+
+		if ( 1 == (int)$messages_template->thread->is_active  ) {
+			$text = __('Deactivate', 'buddypress');
+		} else {
+			$text = __('Activate', 'buddypress');
+		}
+		return apply_filters( 'bp_message_activate_deactivate_text', $text );
+	}
+
+function bp_message_get_notices() {
+	global $userdata;
+
+	$notice = BP_Messages_Notice::get_active();
+
+	if ( empty( $notice ) )
+		return false;
+
+	$closed_notices = get_user_meta( $userdata->ID, 'closed_notices', true );
+
+	if ( !$closed_notices )
+		$closed_notices = array();
+
+	if ( is_array($closed_notices) ) {
+		if ( !in_array( $notice->id, $closed_notices ) && $notice->id ) {
+			?>
+			<div id="message" class="info notice" rel="n-<?php echo $notice->id ?>">
+				<p>
+					<strong><?php echo stripslashes( wp_filter_kses( $notice->subject ) ) ?></strong><br />
+					<?php echo stripslashes( wp_filter_kses( $notice->message) ) ?>
+					<a href="#" id="close-notice"><?php _e( 'Close', 'buddypress' ) ?></a>
+				</p>
+			</div>
+			<?php
+		}
+	}
+}
+
+function bp_send_private_message_link() {
+	echo bp_get_send_private_message_link();
+}
+	function bp_get_send_private_message_link() {
+		global $bp;
+
+		if ( bp_is_my_profile() || !is_user_logged_in() )
+			return false;
+
+		return apply_filters( 'bp_get_send_private_message_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->messages->slug . '/compose/?r=' . bp_core_get_username( $bp->displayed_user->user_id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) ) );
+	}
+
+/**
+ * bp_send_private_message_button()
+ *
+ * Explicitly named function to avoid confusion with public messages.
+ *
+ * @uses bp_get_send_message_button()
+ * @since 1.2.6
+ */
+function bp_send_private_message_button() {
+	echo bp_get_send_message_button();
+}
+
+function bp_send_message_button() {
+	echo bp_get_send_message_button();
+}
+	function bp_get_send_message_button() {
+		return apply_filters( 'bp_get_send_message_button',
+			bp_get_button( array(
+				'id'                => 'private_message',
+				'component'         => 'messages',
+				'must_be_logged_in' => true,
+				'block_self'        => true,
+				'wrapper_id'        => 'send-private-message',
+				'link_href'         => bp_get_send_private_message_link(),
+				'link_class'        => 'send-message',
+				'link_title'        => __( 'Send a private message to this user.', 'buddypress' ),
+				'link_text'         => __( 'Send Private Message', 'buddypress' )
+			) )
+		);
+	}
+
+function bp_message_loading_image_src() {
+	echo bp_get_message_loading_image_src();
+}
+	function bp_get_message_loading_image_src() {
+		global $bp;
+		return apply_filters( 'bp_get_message_loading_image_src', $bp->messages->image_base . '/ajax-loader.gif' );
+	}
+
+function bp_message_get_recipient_tabs() {
+	global $bp;
+
+	if ( isset( $_GET['r'] ) ) {
+		$user_id = bp_core_get_userid( $_GET['r'] );
+
+		if ( $user_id ) {
+			?>
+			<li id="un-<?php echo $_GET['r'] ?>" class="friend-tab">
+				<span>
+					<?php echo bp_core_fetch_avatar( array( 'item_id' => $user_id, 'type' => 'thumb', 'width' => 15, 'height' => 15 ) ) ?>
+					<?php echo bp_core_get_userlink( $user_id ) ?>
+				</span>
+			</li>
+			<?php
+		}
+	}
+}
+
+function bp_message_get_recipient_usernames() {
+	echo bp_get_message_get_recipient_usernames();
+}
+	function bp_get_message_get_recipient_usernames() {
+		return apply_filters( 'bp_get_message_get_recipient_usernames', $_GET['r'] );
+	}
+
+
+/*****************************************************************************
+ * Message Thread Template Class
+ **/
+
+class BP_Messages_Thread_Template {
+	var $current_message = -1;
+	var $message_count;
+	var $message;
+
+	var $thread;
+
+	var $in_the_loop;
+
+	var $pag_page;
+	var $pag_num;
+	var $pag_links;
+	var $total_message_count;
+
+	function bp_messages_thread_template( $thread_id, $order ) {
+		global $bp;
+
+		$this->thread = new BP_Messages_Thread( $thread_id, true );
+		$this->message_count = count( $this->thread->messages );
+
+		$last_message_index = $this->message_count - 1;
+		$this->thread->last_message_id = $this->thread->messages[$last_message_index]->id;
+		$this->thread->last_message_date = $this->thread->messages[$last_message_index]->date_sent;
+		$this->thread->last_sender_id = $this->thread->messages[$last_message_index]->sender_id;
+		$this->thread->last_message_subject = $this->thread->messages[$last_message_index]->subject;
+		$this->thread->last_message_content = $this->thread->messages[$last_message_index]->message;
+	}
+
+	function has_messages() {
+		if ( $this->message_count )
+			return true;
+
+		return false;
+	}
+
+	function next_message() {
+		$this->current_message++;
+		$this->message = $this->thread->messages[$this->current_message];
+
+		return $this->message;
+	}
+
+	function rewind_messages() {
+		$this->current_message = -1;
+		if ( $this->message_count > 0 ) {
+			$this->message = $this->thread->messages[0];
+		}
+	}
+
+	function messages() {
+		if ( $this->current_message + 1 < $this->message_count ) {
+			return true;
+		} elseif ( $this->current_message + 1 == $this->message_count ) {
+			do_action('thread_loop_end');
+			// Do some cleaning up after the loop
+			$this->rewind_messages();
+		}
+
+		$this->in_the_loop = false;
+		return false;
+	}
+
+	function the_message() {
+		global $message;
+
+		$this->in_the_loop = true;
+		$this->message = $this->next_message();
+
+		if ( 0 == $this->current_message ) // loop has just started
+			do_action('thread_loop_start');
+	}
+}
+
+function bp_thread_has_messages( $args = '' ) {
+	global $bp, $thread_template, $group_id;
+
+	$defaults = array(
+		'thread_id' => false,
+		'order' => 'ASC'
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	if ( !$thread_id && $bp->current_component == BP_MESSAGES_SLUG && 'view' == $bp->current_action )
+		$thread_id = (int)$bp->action_variables[0];
+
+	$thread_template = new BP_Messages_Thread_Template( $thread_id, $order );
+	return $thread_template->has_messages();
+}
+
+function bp_thread_messages() {
+	global $thread_template;
+
+	return $thread_template->messages();
+}
+
+function bp_thread_the_message() {
+	global $thread_template;
+
+	return $thread_template->the_message();
+}
+
+function bp_the_thread_id() {
+	echo bp_get_the_thread_id();
+}
+	function bp_get_the_thread_id() {
+		global $thread_template;
+
+		return apply_filters( 'bp_get_the_thread_id', $thread_template->thread->thread_id );
+	}
+
+function bp_the_thread_subject() {
+	echo bp_get_the_thread_subject();
+}
+	function bp_get_the_thread_subject() {
+		global $thread_template;
+
+		return apply_filters( 'bp_get_the_thread_subject', $thread_template->thread->last_message_subject );
+	}
+
+function bp_the_thread_recipients() {
+	echo bp_get_the_thread_recipients();
+}
+	function bp_get_the_thread_recipients() {
+		global $thread_template, $bp;
+
+		if ( count($thread_template->thread->recipients) >= 5 )
+			return apply_filters( 'bp_get_the_thread_recipients', sprintf( __( '%d Recipients', 'buddypress' ), count($thread_template->thread->recipients) ) );
+
+		foreach( (array)$thread_template->thread->recipients as $recipient ) {
+			if ( $recipient->user_id !== $bp->loggedin_user->id )
+				$recipient_links[] = bp_core_get_userlink( $recipient->user_id );
+		}
+
+		return apply_filters( 'bp_get_the_thread_recipients', implode( ', ', (array)$recipient_links ) );
+	}
+
+function bp_the_thread_message_alt_class() {
+	echo bp_get_the_thread_message_alt_class();
+}
+	function bp_get_the_thread_message_alt_class() {
+		global $thread_template;
+
+		if ( $thread_template->current_message % 2 == 1 )
+			$class = ' alt';
+		else
+			$class = '';
+
+		return apply_filters( 'bp_get_the_thread_message_alt_class', $class );
+	}
+
+function bp_the_thread_message_sender_avatar( $args = '' ) {
+	echo bp_get_the_thread_message_sender_avatar_thumb( $args );
+}
+	function bp_get_the_thread_message_sender_avatar_thumb( $args = '' ) {
+		global $thread_template;
+
+		$defaults = array(
+			'type' => 'thumb',
+			'width' => false,
+			'height' => false,
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		return apply_filters( 'bp_get_the_thread_message_sender_avatar_thumb', bp_core_fetch_avatar( array( 'item_id' => $thread_template->message->sender_id, 'type' => $type, 'width' => $width, 'height' => $height ) ) );
+	}
+
+function bp_the_thread_message_sender_link() {
+	echo bp_get_the_thread_message_sender_link();
+}
+	function bp_get_the_thread_message_sender_link() {
+		global $thread_template;
+
+		return apply_filters( 'bp_get_the_thread_message_sender_link', bp_core_get_userlink( $thread_template->message->sender_id, false, true ) );
+	}
+
+function bp_the_thread_message_sender_name() {
+	echo bp_get_the_thread_message_sender_name();
+}
+	function bp_get_the_thread_message_sender_name() {
+		global $thread_template;
+
+		return apply_filters( 'bp_get_the_thread_message_sender_name', bp_core_get_user_displayname( $thread_template->message->sender_id ) );
+	}
+
+function bp_the_thread_message_time_since() {
+	echo bp_get_the_thread_message_time_since();
+}
+	function bp_get_the_thread_message_time_since() {
+		global $thread_template;
+
+		return apply_filters( 'bp_get_the_thread_message_time_since', sprintf( __( 'Sent %s ago', 'buddypress' ), bp_core_time_since( strtotime( $thread_template->message->date_sent ) ) ) );
+	}
+
+function bp_the_thread_message_content() {
+	echo bp_get_the_thread_message_content();
+}
+	function bp_get_the_thread_message_content() {
+		global $thread_template;
+
+		return apply_filters( 'bp_get_the_thread_message_content', $thread_template->message->message );
+	}
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-messages/css/autocomplete/jquery.autocompletefb.css b/wp-content/plugins/buddypress/bp-messages/css/autocomplete/jquery.autocompletefb.css
new file mode 100644
index 0000000000000000000000000000000000000000..467d362b504b026d741db7fc11b25eb39c9da0a6
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-messages/css/autocomplete/jquery.autocompletefb.css
@@ -0,0 +1,85 @@
+.ac_results {
+	padding: 0px;
+	overflow: hidden;
+	z-index: 99999;
+	background: #fff;
+	border: 1px solid #ccc;
+	-moz-border-radius-bottomleft: 3px;
+	-khtml-border-bottom-left-radius: 3px;
+	-webkit-border-bottom-left-radius: 3px;
+	border-bottom-left-radius: 3px;
+	-moz-border-radius-bottomright: 3px;
+	-khtml-border-bottom-right-radius: 3px;
+	-webkit-border-bottom-right-radius: 3px;
+	border-bottom-right-radius: 3px;
+}
+	.ac_results ul {
+		width: 100%;
+		list-style-position: outside;
+		list-style: none;
+		padding: 0;
+		margin: 0;
+	}
+
+	.ac_results li {
+		margin: 0px;
+		padding: 5px 10px;
+		cursor: pointer;
+		display: block;
+		font-size: 1em;
+		line-height: 16px;
+		overflow: hidden;
+	}
+		.ac_results li img {
+			margin-right: 5px;
+		}
+
+.ac_loading {
+	background : url('../../../bp-themes/bp-default/_inc/images/ajax-loader.gif') right center no-repeat;
+}
+
+.ac_odd {
+	background-color: #f0f0f0;
+}
+
+.ac_over {
+	background-color: #888;
+	color: #fff;
+}
+
+ul.acfb-holder {
+	margin  : 0;
+	height  : auto !important;
+	height  : 1%;
+	overflow: hidden;
+	padding: 0;
+	list-style: none;
+}
+	ul.acfb-holder li {
+		float   : left;
+		margin  : 0 5px 4px 0;
+		list-style-type: none;
+	}
+
+	ul.acfb-holder li.friend-tab {
+		border-radius         : 3px;
+		-moz-border-radius    : 3px;
+		-webkit-border-radius : 3px;
+		border     : 1px solid #ffe7c7;
+		padding    : 2px 7px 2px;
+		background : #FFF9DF;
+		font-size: 1em;
+	}
+		li.friend-tab img.avatar {
+			border-width: 2px !important;
+			vertical-align: middle;
+		}
+
+		li.friend-tab span.p {
+			padding-left: 5px;
+			font-size: 0.8em;
+			cursor: pointer;
+		}
+
+input#send-to-input { width: 275px !important; }
+
diff --git a/wp-content/plugins/buddypress/bp-messages/js/autocomplete/jquery.autocomplete.js b/wp-content/plugins/buddypress/bp-messages/js/autocomplete/jquery.autocomplete.js
new file mode 100644
index 0000000000000000000000000000000000000000..1d9aee445c920c4a3eccce3849531130d1352753
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-messages/js/autocomplete/jquery.autocomplete.js
@@ -0,0 +1,730 @@
+/*
+ * Autocomplete - jQuery plugin 1.0 Beta
+ *
+ * Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *   http://www.gnu.org/licenses/gpl.html
+ *
+ * Revision: $Id: jquery.autocomplete.js 4485 2008-01-20 13:52:47Z joern.zaefferer $
+ *
+ */
+
+;(function($) {
+
+$.fn.extend({
+	autocomplete: function(urlOrData, options) {
+		var isUrl = typeof urlOrData == "string";
+		options = $.extend({}, $.Autocompleter.defaults, {
+			url: isUrl ? urlOrData : null,
+			data: isUrl ? null : urlOrData,
+			delay: isUrl ? $.Autocompleter.defaults.delay : 10,
+			max: options && !options.scroll ? 10 : 150
+		}, options);
+
+		// if highlight is set to false, replace it with a do-nothing function
+		options.highlight = options.highlight || function(value) { return value; };
+
+		return this.each(function() {
+			new $.Autocompleter(this, options);
+		});
+	},
+	result: function(handler) {
+		return this.bind("result", handler);
+	},
+	search: function(handler) {
+		return this.trigger("search", [handler]);
+	},
+	flushCache: function() {
+		return this.trigger("flushCache");
+	},
+	setOptions: function(options){
+		return this.trigger("setOptions", [options]);
+	},
+	unautocomplete: function() {
+		return this.trigger("unautocomplete");
+	}
+});
+
+$.Autocompleter = function(input, options) {
+
+	var KEY = {
+		UP: 38,
+		DOWN: 40,
+		DEL: 46,
+		TAB: 9,
+		RETURN: 13,
+		ESC: 27,
+		COMMA: 188,
+		PAGEUP: 33,
+		PAGEDOWN: 34
+	};
+
+	// Create $ object for input element
+	var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);
+
+	var timeout;
+	var previousValue = "";
+	var cache = $.Autocompleter.Cache(options);
+	var hasFocus = 0;
+	var lastKeyPressCode;
+	var config = {
+		mouseDownOnSelect: false
+	};
+	var select = $.Autocompleter.Select(options, input, selectCurrent, config);
+
+	$input.keydown(function(event) {
+		// track last key pressed
+		lastKeyPressCode = event.keyCode;
+		switch(event.keyCode) {
+
+			case KEY.UP:
+				event.preventDefault();
+				if ( select.visible() ) {
+					select.prev();
+				} else {
+					onChange(0, true);
+				}
+				break;
+
+			case KEY.DOWN:
+				event.preventDefault();
+				if ( select.visible() ) {
+					select.next();
+				} else {
+					onChange(0, true);
+				}
+				break;
+
+			case KEY.PAGEUP:
+				event.preventDefault();
+				if ( select.visible() ) {
+					select.pageUp();
+				} else {
+					onChange(0, true);
+				}
+				break;
+
+			case KEY.PAGEDOWN:
+				event.preventDefault();
+				if ( select.visible() ) {
+					select.pageDown();
+				} else {
+					onChange(0, true);
+				}
+				break;
+
+			// matches also semicolon
+			case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
+			case KEY.TAB:
+			case KEY.RETURN:
+				if( selectCurrent() ){
+					// make sure to blur off the current field
+					if( !options.multiple )
+						$input.blur();
+					event.preventDefault();
+						$input.focus();
+				}
+				break;
+
+			case KEY.ESC:
+				select.hide();
+				break;
+
+			default:
+				clearTimeout(timeout);
+				timeout = setTimeout(onChange, options.delay);
+				break;
+		}
+	}).keypress(function() {
+		// having fun with opera - remove this binding and Opera submits the form when we select an entry via return
+	}).focus(function(){
+		// track whether the field has focus, we shouldn't process any
+		// results if the field no longer has focus
+		hasFocus++;
+	}).blur(function() {
+		hasFocus = 0;
+		if (!config.mouseDownOnSelect) {
+			hideResults();
+		}
+	}).click(function() {
+		// show select when clicking in a focused field
+		if ( hasFocus++ > 1 && !select.visible() ) {
+			onChange(0, true);
+		}
+	}).bind("search", function() {
+		// TODO why not just specifying both arguments?
+		var fn = (arguments.length > 1) ? arguments[1] : null;
+		function findValueCallback(q, data) {
+			var result;
+			if( data && data.length ) {
+				for (var i=0; i < data.length; i++) {
+					if( data[i].result.toLowerCase() == q.toLowerCase() ) {
+						result = data[i];
+						break;
+					}
+				}
+			}
+			if( typeof fn == "function" ) fn(result);
+			else $input.trigger("result", result && [result.data, result.value]);
+		}
+		$.each(trimWords($input.val()), function(i, value) {
+			request(value, findValueCallback, findValueCallback);
+		});
+	}).bind("flushCache", function() {
+		cache.flush();
+	}).bind("setOptions", function() {
+		$.extend(options, arguments[1]);
+		// if we've updated the data, repopulate
+		if ( "data" in arguments[1] )
+			cache.populate();
+	}).bind("unautocomplete", function() {
+		select.unbind();
+		$input.unbind();
+	});
+
+
+	function selectCurrent() {
+		var selected = select.selected();
+		if( !selected )
+			return false;
+
+		var v = selected.result;
+		previousValue = v;
+
+		if ( options.multiple ) {
+			var words = trimWords($input.val());
+			if ( words.length > 1 ) {
+				v = words.slice(0, words.length - 1).join( options.multipleSeparator ) + options.multipleSeparator + v;
+			}
+			v += options.multipleSeparator;
+		}
+
+		$input.val(v);
+		hideResultsNow();
+		$input.trigger("result", [selected.data, selected.value]);
+		return true;
+	}
+
+	function onChange(crap, skipPrevCheck) {
+		if( lastKeyPressCode == KEY.DEL ) {
+			select.hide();
+			return;
+		}
+
+		var currentValue = $input.val();
+
+		if ( !skipPrevCheck && currentValue == previousValue )
+			return;
+
+		previousValue = currentValue;
+
+		currentValue = lastWord(currentValue);
+		if ( currentValue.length >= options.minChars) {
+			$input.addClass(options.loadingClass);
+			jQuery('.ajax-loader').show();
+			if (!options.matchCase)
+				currentValue = currentValue.toLowerCase();
+			request(currentValue, receiveData, hideResultsNow);
+		} else {
+			stopLoading();
+			select.hide();
+		}
+	};
+
+	function trimWords(value) {
+		if ( !value ) {
+			return [""];
+		}
+		var words = value.split( $.trim( options.multipleSeparator ) );
+		var result = [];
+		$.each(words, function(i, value) {
+			if ( $.trim(value) )
+				result[i] = $.trim(value);
+		});
+		return result;
+	}
+
+	function lastWord(value) {
+		if ( !options.multiple )
+			return value;
+		var words = trimWords(value);
+		return words[words.length - 1];
+	}
+
+	// fills in the input box w/the first match (assumed to be the best match)
+	function autoFill(q, sValue){
+		// autofill in the complete box w/the first match as long as the user hasn't entered in more data
+		// if the last user key pressed was backspace, don't autofill
+		if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != 8 ) {
+			// fill in the value (keep the case the user has typed)
+			$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
+			// select the portion of the value not typed by the user (so the next character will erase)
+			$.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length);
+		}
+	};
+
+	function hideResults() {
+		clearTimeout(timeout);
+		timeout = setTimeout(hideResultsNow, 200);
+	};
+
+	function hideResultsNow() {
+		select.hide();
+		clearTimeout(timeout);
+		stopLoading();
+		if (options.mustMatch) {
+			// call search and run callback
+			$input.search(
+				function (result){
+					// if no value found, clear the input box
+					if( !result ) $input.val("");
+				}
+			);
+		}
+	};
+
+	function receiveData(q, data) {
+		if ( data && data.length && hasFocus ) {
+			stopLoading();
+			select.display(data, q);
+
+			var newData = data[0].value.split(';');
+			data.value = newData[0];
+
+			autoFill(q, data.value);
+			select.show();
+		} else {
+			hideResultsNow();
+		}
+	};
+
+	function request(term, success, failure) {
+		if (!options.matchCase)
+			term = term.toLowerCase();
+		var data = cache.load(term);
+		// recieve the cached data
+		if (data && data.length) {
+			success(term, data);
+		// if an AJAX url has been supplied, try loading the data now
+		} else if( (typeof options.url == "string") && (options.url.length > 0) ){
+
+			var extraParams = {};
+			$.each(options.extraParams, function(key, param) {
+				extraParams[key] = typeof param == "function" ? param() : param;
+			});
+
+			$.ajax({
+				// try to leverage ajaxQueue plugin to abort previous requests
+				mode: "abort",
+				// limit abortion to this input
+				port: "autocomplete" + input.name,
+				dataType: options.dataType,
+				url: options.url,
+				data: $.extend({
+					q: lastWord(term),
+					limit: options.max,
+					action: 'messages_autocomplete_results',
+					'cookie': encodeURIComponent(document.cookie)
+				}, extraParams),
+				success: function(data) {
+					var parsed = options.parse && options.parse(data) || parse(data);
+					cache.add(term, parsed);
+					success(term, parsed);
+				}
+			});
+		} else {
+			failure(term);
+		}
+	};
+
+	function parse(data) {
+		var parsed = [];
+		var rows = data.split("\n");
+		for (var i=0; i < rows.length; i++) {
+			var row = $.trim(rows[i]);
+			if (row) {
+				row = row.split("|");
+				parsed[parsed.length] = {
+					data: row,
+					value: row[0],
+					result: options.formatResult && options.formatResult(row, row[0]) || row[0]
+				};
+			}
+		}
+		return parsed;
+	};
+
+	function stopLoading() {
+		$input.removeClass(options.loadingClass);
+		jQuery('.ajax-loader').hide();
+	};
+
+};
+
+$.Autocompleter.defaults = {
+	inputClass: "ac_input",
+	resultsClass: "ac_results",
+	loadingClass: "ac_loading",
+	minChars: 1,
+	delay: 400,
+	matchCase: false,
+	matchSubset: true,
+	matchContains: false,
+	cacheLength: 10,
+	max: 100,
+	mustMatch: false,
+	extraParams: {},
+	selectFirst: true,
+	formatItem: function(row) { return row[0]; },
+	autoFill: false,
+	width: 0,
+	multiple: false,
+	multipleSeparator: ", ",
+	highlight: function(value, term) {
+		return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
+	},
+    scroll: true,
+    scrollHeight: 250,
+	attachTo: 'body'
+};
+
+$.Autocompleter.Cache = function(options) {
+
+	var data = {};
+	var length = 0;
+
+	function matchSubset(s, sub) {
+		if (!options.matchCase)
+			s = s.toLowerCase();
+		var i = s.indexOf(sub);
+		if (i == -1) return false;
+		return i == 0 || options.matchContains;
+	};
+
+	function add(q, value) {
+		if (length > options.cacheLength){
+			flush();
+		}
+		if (!data[q]){
+			length++;
+		}
+		data[q] = value;
+	}
+
+	function populate(){
+		if( !options.data ) return false;
+		// track the matches
+		var stMatchSets = {},
+			nullData = 0;
+
+		// no url was specified, we need to adjust the cache length to make sure it fits the local data store
+		if( !options.url ) options.cacheLength = 1;
+
+		// track all options for minChars = 0
+		stMatchSets[""] = [];
+
+		// loop through the array and create a lookup structure
+		for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
+			var rawValue = options.data[i];
+			// if rawValue is a string, make an array otherwise just reference the array
+			rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
+
+			var value = options.formatItem(rawValue, i+1, options.data.length);
+			if ( value === false )
+				continue;
+
+			var firstChar = value.charAt(0).toLowerCase();
+			// if no lookup array for this character exists, look it up now
+			if( !stMatchSets[firstChar] )
+				stMatchSets[firstChar] = [];
+
+			// if the match is a string
+			var row = {
+				value: value,
+				data: rawValue,
+				result: options.formatResult && options.formatResult(rawValue) || value
+			};
+
+			// push the current match into the set list
+			stMatchSets[firstChar].push(row);
+
+			// keep track of minChars zero items
+			if ( nullData++ < options.max ) {
+				stMatchSets[""].push(row);
+			}
+		};
+
+		// add the data items to the cache
+		$.each(stMatchSets, function(i, value) {
+			// increase the cache size
+			options.cacheLength++;
+			// add to the cache
+			add(i, value);
+		});
+	}
+
+	// populate any existing data
+	setTimeout(populate, 25);
+
+	function flush(){
+		data = {};
+		length = 0;
+	}
+
+	return {
+		flush: flush,
+		add: add,
+		populate: populate,
+		load: function(q) {
+			if (!options.cacheLength || !length)
+				return null;
+			/*
+			 * if dealing w/local data and matchContains than we must make sure
+			 * to loop through all the data collections looking for matches
+			 */
+			if( !options.url && options.matchContains ){
+				// track all matches
+				var csub = [];
+				// loop through all the data grids for matches
+				for( var k in data ){
+					// don't search through the stMatchSets[""] (minChars: 0) cache
+					// this prevents duplicates
+					if( k.length > 0 ){
+						var c = data[k];
+						$.each(c, function(i, x) {
+							// if we've got a match, add it to the array
+							if (matchSubset(x.value, q)) {
+								csub.push(x);
+							}
+						});
+					}
+				}
+				return csub;
+			} else
+			// if the exact item exists, use it
+			if (data[q]){
+				return data[q];
+			} else
+			if (options.matchSubset) {
+				for (var i = q.length - 1; i >= options.minChars; i--) {
+					var c = data[q.substr(0, i)];
+					if (c) {
+						var csub = [];
+						$.each(c, function(i, x) {
+							if (matchSubset(x.value, q)) {
+								csub[csub.length] = x;
+							}
+						});
+						return csub;
+					}
+				}
+			}
+			return null;
+		}
+	};
+};
+
+$.Autocompleter.Select = function (options, input, select, config) {
+	var CLASSES = {
+		ACTIVE: "ac_over"
+	};
+
+	var listItems,
+		active = -1,
+		data,
+		term = "",
+		needsInit = true,
+		element,
+		list;
+
+	// Create results
+	function init() {
+		if (!needsInit)
+			return;
+		element = $("<div/>")
+		.hide()
+		.addClass(options.resultsClass)
+		.css("position", "absolute")
+		.appendTo(options.attachTo);
+
+		list = $("<ul>").appendTo(element).mouseover( function(event) {
+			if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
+	            active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
+			    $(target(event)).addClass(CLASSES.ACTIVE);
+	        }
+		}).click(function(event) {
+			$(target(event)).addClass(CLASSES.ACTIVE);
+			select();
+			input.focus();
+			return false;
+		}).mousedown(function() {
+			config.mouseDownOnSelect = true;
+		}).mouseup(function() {
+			config.mouseDownOnSelect = false;
+		});
+
+		if( options.width > 0 )
+			element.css("width", options.width);
+
+		needsInit = false;
+	}
+
+	function target(event) {
+		var element = event.target;
+		while(element && element.tagName != "LI")
+			element = element.parentNode;
+		// more fun with IE, sometimes event.target is empty, just ignore it then
+		if(!element)
+			return [];
+		return element;
+	}
+
+	function moveSelect(step) {
+		listItems.slice(active, active + 1).removeClass();
+		movePosition(step);
+        var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
+        if(options.scroll) {
+            var offset = 0;
+            listItems.slice(0, active).each(function() {
+				offset += this.offsetHeight;
+			});
+            if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
+                list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
+            } else if(offset < list.scrollTop()) {
+                list.scrollTop(offset);
+            }
+        }
+	};
+
+	function movePosition(step) {
+		active += step;
+		if (active < 0) {
+			active = listItems.size() - 1;
+		} else if (active >= listItems.size()) {
+			active = 0;
+		}
+	}
+
+	function limitNumberOfItems(available) {
+		return options.max && options.max < available
+			? options.max
+			: available;
+	}
+
+	function fillList() {
+		list.empty();
+		var max = limitNumberOfItems(data.length);
+		for (var i=0; i < max; i++) {
+			if (!data[i])
+				continue;
+			var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term);
+			if ( formatted === false )
+				continue;
+			var li = $("<li>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_event" : "ac_odd").appendTo(list)[0];
+			$.data(li, "ac_data", data[i]);
+		}
+		listItems = list.find("li");
+		if ( options.selectFirst ) {
+			listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
+			active = 0;
+		}
+		list.bgiframe();
+	}
+
+	return {
+		display: function(d, q) {
+			init();
+			data = d;
+			term = q;
+			fillList();
+		},
+		next: function() {
+			moveSelect(1);
+		},
+		prev: function() {
+			moveSelect(-1);
+		},
+		pageUp: function() {
+			if (active != 0 && active - 8 < 0) {
+				moveSelect( -active );
+			} else {
+				moveSelect(-8);
+			}
+		},
+		pageDown: function() {
+			if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
+				moveSelect( listItems.size() - 1 - active );
+			} else {
+				moveSelect(8);
+			}
+		},
+		hide: function() {
+			element && element.hide();
+			active = -1;
+		},
+		visible : function() {
+			return element && element.is(":visible");
+		},
+		current: function() {
+			return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
+		},
+		show: function() {
+			var offset = $(input).offset();
+			element.css({
+				width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),
+				top: offset.top + input.offsetHeight,
+				left: offset.left
+			}).show();
+            if(options.scroll) {
+                list.scrollTop(0);
+                list.css({
+					maxHeight: options.scrollHeight,
+					overflow: 'auto'
+				});
+
+                if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
+					var listHeight = 0;
+					listItems.each(function() {
+						listHeight += this.offsetHeight;
+					});
+					var scrollbarsVisible = listHeight > options.scrollHeight;
+                    list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight );
+					if (!scrollbarsVisible) {
+						// IE doesn't recalculate width when scrollbar disappears
+						listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
+					}
+                }
+
+            }
+		},
+		selected: function() {
+			var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
+			return selected && selected.length && $.data(selected[0], "ac_data");
+		},
+		unbind: function() {
+			element && element.remove();
+		}
+	};
+};
+
+$.Autocompleter.Selection = function(field, start, end) {
+	if( field.createTextRange ){
+		var selRange = field.createTextRange();
+		selRange.collapse(true);
+		selRange.moveStart("character", start);
+		selRange.moveEnd("character", end);
+		selRange.select();
+	} else if( field.setSelectionRange ){
+		field.setSelectionRange(start, end);
+	} else {
+		if( field.selectionStart ){
+			field.selectionStart = start;
+			field.selectionEnd = end;
+		}
+	}
+	field.focus();
+};
+
+})(jQuery);
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-messages/js/autocomplete/jquery.autocompletefb.js b/wp-content/plugins/buddypress/bp-messages/js/autocomplete/jquery.autocompletefb.js
new file mode 100644
index 0000000000000000000000000000000000000000..d94e43c52b2696adda1e685acb9a270dc0ddfbb0
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-messages/js/autocomplete/jquery.autocompletefb.js
@@ -0,0 +1,68 @@
+/*
+ * jQuery plugin: autoCompletefb(AutoComplete Facebook)
+ * @requires jQuery v1.2.2 or later
+ * using plugin:jquery.autocomplete.js
+ *
+ * Credits:
+ * - Idea: Facebook
+ * - Guillermo Rauch: Original MooTools script
+ * - InteRiders <http://interiders.com/> 
+ *
+ * Copyright (c) 2008 Widi Harsojo <wharsojo@gmail.com>, http://wharsojo.wordpress.com/
+ * Dual licensed under the MIT and GPL licenses:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *   http://www.gnu.org/licenses/gpl.html
+ */
+ 
+jQuery.fn.autoCompletefb = function(options) 
+{
+	var tmp = this;
+	var settings = 
+	{
+		ul         : tmp,
+		urlLookup  : [""],
+		acOptions  : {},
+		foundClass : ".friend-tab",
+		inputClass : ".send-to-input"
+	}
+	
+	if(options) jQuery.extend(settings, options);
+	
+	var acfb = 
+	{
+		params  : settings,
+		removeFind : function(o){
+			acfb.removeUsername(o);
+			jQuery(o).unbind('click').parent().remove();
+			jQuery(settings.inputClass,tmp).focus();
+			return tmp.acfb;
+		},
+		removeUsername: function(o){
+			var newID = o.parentNode.id.split('-');
+			jQuery('#send-to-usernames').removeClass(newID[1]);
+		}
+	}
+	
+	jQuery(settings.foundClass+" img.p").click(function(){
+		acfb.removeFind(this);
+	});
+	
+	jQuery(settings.inputClass,tmp).autocomplete(settings.urlLookup,settings.acOptions);
+	jQuery(settings.inputClass,tmp).result(function(e,d,f){
+		var f = settings.foundClass.replace(/\./,'');
+		var d = String(d).split(' (');
+		var un = d[1].substr(0, d[1].length-1);
+		var v = '<li class="'+f+'" id="un-'+un+'"><span>'+d[0]+'</span> <span class="p">X</span></li>';
+		var x = jQuery(settings.inputClass,tmp).before(v);
+		
+		jQuery('#send-to-usernames').addClass(un);
+		
+		jQuery('.p',x[0].previousSibling).click(function(){
+			acfb.removeFind(this);
+		});
+		jQuery(settings.inputClass,tmp).val('');
+	});
+	
+	jQuery(settings.inputClass,tmp).focus();
+	return acfb;
+}
diff --git a/wp-content/plugins/buddypress/bp-messages/js/autocomplete/jquery.bgiframe.min.js b/wp-content/plugins/buddypress/bp-messages/js/autocomplete/jquery.bgiframe.min.js
new file mode 100644
index 0000000000000000000000000000000000000000..7faef4b33506062dd1d931743a880880fa3093d3
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-messages/js/autocomplete/jquery.bgiframe.min.js
@@ -0,0 +1,10 @@
+/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
+ *
+ * $LastChangedDate: 2007-07-22 01:45:56 +0200 (Son, 22 Jul 2007) $
+ * $Rev: 2447 $
+ *
+ * Version 2.1.1
+ */
+(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery);
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-messages/js/autocomplete/jquery.dimensions.js b/wp-content/plugins/buddypress/bp-messages/js/autocomplete/jquery.dimensions.js
new file mode 100644
index 0000000000000000000000000000000000000000..4c80c2f2b86a3f92d0b9e4e33645f01121183a4e
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-messages/js/autocomplete/jquery.dimensions.js
@@ -0,0 +1,116 @@
+/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
+ *
+ * $LastChangedDate: 2007-09-11 05:38:31 +0300 (Вт, 11 сен 2007) $
+ * $Rev: 3238 $
+ *
+ * Version: @VERSION
+ *
+ * Requires: jQuery 1.2+
+ */
+
+(function($){
+	
+$.dimensions = {
+	version: '@VERSION'
+};
+
+// Create innerHeight, innerWidth, outerHeight and outerWidth methods
+$.each( [ 'Height', 'Width' ], function(i, name){
+	
+	// innerHeight and innerWidth
+	$.fn[ 'inner' + name ] = function() {
+		if (!this[0]) return;
+		
+		var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
+		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
+		
+		return this[ name.toLowerCase() ]() + num(this, 'padding' + torl) + num(this, 'padding' + borr);
+	};
+	
+	// outerHeight and outerWidth
+	$.fn[ 'outer' + name ] = function(options) {
+		if (!this[0]) return;
+		
+		var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
+		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
+		
+		options = $.extend({ margin: false }, options || {});
+		
+		return this[ name.toLowerCase() ]()
+				+ num(this, 'border' + torl + 'Width') + num(this, 'border' + borr + 'Width')
+				+ num(this, 'padding' + torl) + num(this, 'padding' + borr)
+				+ (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0);
+	};
+});
+
+// Create scrollLeft and scrollTop methods
+$.each( ['Left', 'Top'], function(i, name) {
+	$.fn[ 'scroll' + name ] = function(val) {
+		if (!this[0]) return;
+		
+		return val != undefined ?
+		
+			// Set the scroll offset
+			this.each(function() {
+				this == window || this == document ?
+					window.scrollTo( 
+						name == 'Left' ? val : $(window)[ 'scrollLeft' ](),
+						name == 'Top'  ? val : $(window)[ 'scrollTop'  ]()
+					) :
+					this[ 'scroll' + name ] = val;
+			}) :
+			
+			// Return the scroll offset
+			this[0] == window || this[0] == document ?
+				self[ (name == 'Left' ? 'pageXOffset' : 'pageYOffset') ] ||
+					$.boxModel && document.documentElement[ 'scroll' + name ] ||
+					document.body[ 'scroll' + name ] :
+				this[0][ 'scroll' + name ];
+	};
+});
+
+$.fn.extend({
+	position: function() {
+		var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results;
+		
+		if (elem) {
+			// Get *real* offsetParent
+			offsetParent = this.offsetParent();
+			
+			// Get correct offsets
+			offset       = this.offset();
+			parentOffset = offsetParent.offset();
+			
+			// Subtract element margins
+			offset.top  -= num(elem, 'marginTop');
+			offset.left -= num(elem, 'marginLeft');
+			
+			// Add offsetParent borders
+			parentOffset.top  += num(offsetParent, 'borderTopWidth');
+			parentOffset.left += num(offsetParent, 'borderLeftWidth');
+			
+			// Subtract the two offsets
+			results = {
+				top:  offset.top  - parentOffset.top,
+				left: offset.left - parentOffset.left
+			};
+		}
+		
+		return results;
+	},
+	
+	offsetParent: function() {
+		var offsetParent = this[0].offsetParent;
+		while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, 'position') == 'static') )
+			offsetParent = offsetParent.offsetParent;
+		return $(offsetParent);
+	}
+});
+
+var num = function(el, prop) {
+	return parseInt($.css(el.jquery?el[0]:el,prop))||0;
+};
+
+})(jQuery);
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/404.php b/wp-content/plugins/buddypress/bp-themes/bp-default/404.php
new file mode 100644
index 0000000000000000000000000000000000000000..387bc746f7375f1783909d7d768b766e8fd44a12
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/404.php
@@ -0,0 +1,29 @@
+<?php get_header(); ?>
+
+	<div id="content">
+		<div class="padder">
+
+		<?php do_action( 'bp_before_404' ) ?>
+
+		<div class="page 404">
+
+			<h2 class="pagetitle"><?php _e( 'Page Not Found', 'buddypress' ) ?></h2>
+
+			<div id="message" class="info">
+
+				<p><?php _e( 'The page you were looking for was not found.', 'buddypress' ) ?>
+
+			</div>
+
+			<?php do_action( 'bp_404' ) ?>
+
+		</div>
+
+		<?php do_action( 'bp_after_404' ) ?>
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer(); ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/ajax.php b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/ajax.php
new file mode 100644
index 0000000000000000000000000000000000000000..8e633fd044fc4b74fef50cf7bea1d012c342881b
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/ajax.php
@@ -0,0 +1,562 @@
+<?php
+/***
+ * AJAX Functions
+ *
+ * All of these functions enhance the responsiveness of the user interface in the default
+ * theme by adding AJAX functionality.
+ *
+ * By default your child theme will inherit this AJAX functionality. You can however create
+ * your own _inc/ajax.php file and add/remove AJAX functionality as you see fit.
+ */
+
+/***
+ * This function looks scarier than it actually is. :)
+ * Each object loop (activity/members/groups/blogs/forums) contains default parameters to
+ * show specific information based on the page we are currently looking at.
+ * The following function will take into account any cookies set in the JS and allow us
+ * to override the parameters sent. That way we can change the results returned without reloading the page.
+ * By using cookies we can also make sure that user settings are retained across page loads.
+ */
+function bp_dtheme_ajax_querystring( $query_string, $object ) {
+	global $bp;
+
+	if ( empty( $object ) )
+		return false;
+
+	/* Set up the cookies passed on this AJAX request. Store a local var to avoid conflicts */
+	if ( !empty( $_POST['cookie'] ) )
+		$_BP_COOKIE = wp_parse_args( str_replace( '; ', '&', urldecode( $_POST['cookie'] ) ) );
+	else
+		$_BP_COOKIE = &$_COOKIE;
+
+	$qs = false;
+
+	/***
+	 * Check if any cookie values are set. If there are then override the default params passed to the
+	 * template loop
+	 */
+	if ( !empty( $_BP_COOKIE['bp-' . $object . '-filter'] ) && '-1' != $_BP_COOKIE['bp-' . $object . '-filter'] ) {
+		$qs[] = 'type=' . $_BP_COOKIE['bp-' . $object . '-filter'];
+		$qs[] = 'action=' . $_BP_COOKIE['bp-' . $object . '-filter']; // Activity stream filtering on action
+	}
+
+	if ( !empty( $_BP_COOKIE['bp-' . $object . '-scope'] ) ) {
+		if ( 'personal' == $_BP_COOKIE['bp-' . $object . '-scope'] ) {
+			$user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
+			$qs[] = 'user_id=' . $user_id;
+		}
+		if ( 'all' != $_BP_COOKIE['bp-' . $object . '-scope'] && empty( $bp->displayed_user->id ) && !$bp->is_single_item )
+			$qs[] = 'scope=' . $_BP_COOKIE['bp-' . $object . '-scope']; // Activity stream scope only on activity directory.
+	}
+
+	/* If page and search_terms have been passed via the AJAX post request, use those */
+	if ( !empty( $_POST['page'] ) && '-1' != $_POST['page'] )
+		$qs[] = 'page=' . $_POST['page'];
+
+	if ( !empty( $_POST['search_terms'] ) && __( 'Search anything...', 'buddypress' ) != $_POST['search_terms'] && 'false' != $_POST['search_terms'] && 'undefined' != $_POST['search_terms'] )
+		$qs[] = 'search_terms=' . $_POST['search_terms'];
+
+	/* Now pass the querystring to override default values. */
+	$query_string = empty( $qs ) ? '' : join( '&', (array)$qs );
+
+	return apply_filters( 'bp_dtheme_ajax_querystring', $query_string, $object, $_BP_COOKIE['bp-' . $object . '-filter'], $_BP_COOKIE['bp-' . $object . '-scope'], $_BP_COOKIE['bp-' . $object . '-page'], $_BP_COOKIE['bp-' . $object . '-search-terms'], $_BP_COOKIE['bp-' . $object . '-extras'] );
+}
+add_filter( 'bp_ajax_querystring', 'bp_dtheme_ajax_querystring', 10, 2 );
+
+/* This function will simply load the template loop for the current object. On an AJAX request */
+function bp_dtheme_object_template_loader() {
+	$object = esc_attr( $_POST['object'] );
+	locate_template( array( "$object/$object-loop.php" ), true );
+}
+add_action( 'wp_ajax_members_filter', 'bp_dtheme_object_template_loader' );
+add_action( 'wp_ajax_groups_filter', 'bp_dtheme_object_template_loader' );
+add_action( 'wp_ajax_blogs_filter', 'bp_dtheme_object_template_loader' );
+add_action( 'wp_ajax_forums_filter', 'bp_dtheme_object_template_loader' );
+
+/* This function will load the activity loop template when activity is requested via AJAX */
+function bp_dtheme_activity_template_loader() {
+	global $bp;
+
+	/* We need to calculate and return the feed URL for each scope */
+	$feed_url = site_url( BP_ACTIVITY_SLUG . '/feed/' );
+
+	switch ( $_POST['scope'] ) {
+		case 'friends':
+			$feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/friends/feed/';
+			break;
+		case 'groups':
+			$feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/groups/feed/';
+			break;
+		case 'favorites':
+			$feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/favorites/feed/';
+			break;
+		case 'mentions':
+			$feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/mentions/feed/';
+			delete_usermeta( $bp->loggedin_user->id, 'bp_new_mention_count' );
+			break;
+	}
+
+	/* Buffer the loop in the template to a var for JS to spit out. */
+	ob_start();
+	locate_template( array( 'activity/activity-loop.php' ), true );
+	$result['contents'] = ob_get_contents();
+	$result['feed_url'] = apply_filters( 'bp_dtheme_activity_feed_url', $feed_url, $_POST['scope'] );
+	ob_end_clean();
+
+	echo json_encode( $result );
+}
+add_action( 'wp_ajax_activity_widget_filter', 'bp_dtheme_activity_template_loader' );
+add_action( 'wp_ajax_activity_get_older_updates', 'bp_dtheme_activity_template_loader' );
+
+/* AJAX update posting */
+function bp_dtheme_post_update() {
+	global $bp;
+
+	/* Check the nonce */
+	check_admin_referer( 'post_update', '_wpnonce_post_update' );
+
+	if ( !is_user_logged_in() ) {
+		echo '-1';
+		return false;
+	}
+
+	if ( empty( $_POST['content'] ) ) {
+		echo '-1<div id="message" class="error"><p>' . __( 'Please enter some content to post.', 'buddypress' ) . '</p></div>';
+		return false;
+	}
+
+	if ( empty( $_POST['object'] ) && function_exists( 'bp_activity_post_update' ) ) {
+		$activity_id = bp_activity_post_update( array( 'content' => $_POST['content'] ) );
+	} elseif ( $_POST['object'] == 'groups' ) {
+		if ( !empty( $_POST['item_id'] ) && function_exists( 'groups_post_update' ) )
+			$activity_id = groups_post_update( array( 'content' => $_POST['content'], 'group_id' => $_POST['item_id'] ) );
+	} else
+		$activity_id = apply_filters( 'bp_activity_custom_update', $_POST['object'], $_POST['item_id'], $_POST['content'] );
+
+	if ( !$activity_id ) {
+		echo '-1<div id="message" class="error"><p>' . __( 'There was a problem posting your update, please try again.', 'buddypress' ) . '</p></div>';
+		return false;
+	}
+
+	if ( bp_has_activities ( 'include=' . $activity_id ) ) : ?>
+		<?php while ( bp_activities() ) : bp_the_activity(); ?>
+			<?php locate_template( array( 'activity/entry.php' ), true ) ?>
+		<?php endwhile; ?>
+	 <?php endif;
+}
+add_action( 'wp_ajax_post_update', 'bp_dtheme_post_update' );
+
+/* AJAX activity comment posting */
+function bp_dtheme_new_activity_comment() {
+	global $bp;
+
+	/* Check the nonce */
+	check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' );
+
+	if ( !is_user_logged_in() ) {
+		echo '-1';
+		return false;
+	}
+
+	if ( empty( $_POST['content'] ) ) {
+		echo '-1<div id="message" class="error"><p>' . __( 'Please do not leave the comment area blank.', 'buddypress' ) . '</p></div>';
+		return false;
+	}
+
+	if ( empty( $_POST['form_id'] ) || empty( $_POST['comment_id'] ) || !is_numeric( $_POST['form_id'] ) || !is_numeric( $_POST['comment_id'] ) ) {
+		echo '-1<div id="message" class="error"><p>' . __( 'There was an error posting that reply, please try again.', 'buddypress' ) . '</p></div>';
+		return false;
+	}
+
+	$comment_id = bp_activity_new_comment( array(
+		'content' => $_POST['content'],
+		'activity_id' => $_POST['form_id'],
+		'parent_id' => $_POST['comment_id']
+	));
+
+	if ( !$comment_id ) {
+		echo '-1<div id="message" class="error"><p>' . __( 'There was an error posting that reply, please try again.', 'buddypress' ) . '</p></div>';
+		return false;
+	}
+
+	if ( bp_has_activities ( 'include=' . $comment_id ) ) : ?>
+		<?php while ( bp_activities() ) : bp_the_activity(); ?>
+			<li id="acomment-<?php bp_activity_id() ?>">
+				<div class="acomment-avatar">
+					<?php bp_activity_avatar() ?>
+				</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( 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>
+
+				<div class="acomment-content">
+					<?php bp_activity_content_body() ?>
+				</div>
+			</li>
+		<?php endwhile; ?>
+	 <?php endif;
+}
+add_action( 'wp_ajax_new_activity_comment', 'bp_dtheme_new_activity_comment' );
+
+/* AJAX delete an activity */
+function bp_dtheme_delete_activity() {
+	global $bp;
+
+	/* Check the nonce */
+	check_admin_referer( 'bp_activity_delete_link' );
+
+	if ( !is_user_logged_in() ) {
+		echo '-1';
+		return false;
+	}
+
+	$activity = new BP_Activity_Activity( $_POST['id'] );
+
+	/* Check access */
+	if ( !is_super_admin() && $activity->user_id != $bp->loggedin_user->id )
+		return false;
+
+	if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) )
+		return false;
+
+	/* Call the action before the delete so plugins can still fetch information about it */
+	do_action( 'bp_activity_action_delete_activity', $_POST['id'], $activity->user_id );
+
+	if ( !bp_activity_delete( array( 'id' => $_POST['id'], 'user_id' => $activity->user_id ) ) ) {
+		echo '-1<div id="message" class="error"><p>' . __( 'There was a problem when deleting. Please try again.', 'buddypress' ) . '</p></div>';
+		return false;
+	}
+
+	return true;
+}
+add_action( 'wp_ajax_delete_activity', 'bp_dtheme_delete_activity' );
+
+/* AJAX delete an activity comment */
+function bp_dtheme_delete_activity_comment() {
+	global $bp;
+
+	/* Check the nonce */
+	check_admin_referer( 'bp_activity_delete_link' );
+
+	if ( !is_user_logged_in() ) {
+		echo '-1';
+		return false;
+	}
+
+	$comment = new BP_Activity_Activity( $_POST['id'] );
+
+	/* Check access */
+	if ( !is_super_admin() && $comment->user_id != $bp->loggedin_user->id )
+		return false;
+
+	if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) )
+		return false;
+
+	/* Call the action before the delete so plugins can still fetch information about it */
+	do_action( 'bp_activity_action_delete_activity', $_POST['id'], $comment->user_id );
+
+	if ( !bp_activity_delete_comment( $comment->item_id, $comment->id ) ) {
+		echo '-1<div id="message" class="error"><p>' . __( 'There was a problem when deleting. Please try again.', 'buddypress' ) . '</p></div>';
+		return false;
+	}
+
+	return true;
+}
+add_action( 'wp_ajax_delete_activity_comment', 'bp_dtheme_delete_activity_comment' );
+
+/* AJAX mark an activity as a favorite */
+function bp_dtheme_mark_activity_favorite() {
+	global $bp;
+
+	bp_activity_add_user_favorite( $_POST['id'] );
+	_e( 'Remove Favorite', 'buddypress' );
+}
+add_action( 'wp_ajax_activity_mark_fav', 'bp_dtheme_mark_activity_favorite' );
+
+/* AJAX mark an activity as not a favorite */
+function bp_dtheme_unmark_activity_favorite() {
+	global $bp;
+
+	bp_activity_remove_user_favorite( $_POST['id'] );
+	_e( 'Favorite', 'buddypress' );
+}
+add_action( 'wp_ajax_activity_mark_unfav', 'bp_dtheme_unmark_activity_favorite' );
+
+/* AJAX invite a friend to a group functionality */
+function bp_dtheme_ajax_invite_user() {
+	global $bp;
+
+	check_ajax_referer( 'groups_invite_uninvite_user' );
+
+	if ( !$_POST['friend_id'] || !$_POST['friend_action'] || !$_POST['group_id'] )
+		return false;
+
+	if ( !groups_is_user_admin( $bp->loggedin_user->id, $_POST['group_id'] ) )
+		return false;
+
+	if ( !friends_check_friendship( $bp->loggedin_user->id, $_POST['friend_id'] ) )
+		return false;
+
+	if ( 'invite' == $_POST['friend_action'] ) {
+
+		if ( !groups_invite_user( array( 'user_id' => $_POST['friend_id'], 'group_id' => $_POST['group_id'] ) ) )
+			return false;
+
+		$user = new BP_Core_User( $_POST['friend_id'] );
+
+		echo '<li id="uid-' . $user->id . '">';
+		echo $user->avatar_thumb;
+		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-' . esc_attr( $user->id ) . '">' . __( 'Remove Invite', 'buddypress' ) . '</a>
+			  </div>';
+		echo '</li>';
+
+	} else if ( 'uninvite' == $_POST['friend_action'] ) {
+
+		if ( !groups_uninvite_user( $_POST['friend_id'], $_POST['group_id'] ) )
+			return false;
+
+		return true;
+
+	} else {
+		return false;
+	}
+}
+add_action( 'wp_ajax_groups_invite_user', 'bp_dtheme_ajax_invite_user' );
+
+/* AJAX add/remove a user as a friend when clicking the button */
+function bp_dtheme_ajax_addremove_friend() {
+	global $bp;
+
+	if ( 'is_friend' == BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) {
+
+		check_ajax_referer('friends_remove_friend');
+
+		if ( !friends_remove_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) {
+			echo __("Friendship could not be canceled.", 'buddypress');
+		} else {
+			echo '<a id="friend-' . $_POST['fid'] . '" class="add" rel="add" title="' . __( 'Add Friend', 'buddypress' ) . '" href="' . wp_nonce_url( $bp->loggedin_user->domain . $bp->friends->slug . '/add-friend/' . $_POST['fid'], 'friends_add_friend' ) . '">' . __( 'Add Friend', 'buddypress' ) . '</a>';
+		}
+
+	} else if ( 'not_friends' == BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) {
+
+		check_ajax_referer('friends_add_friend');
+
+		if ( !friends_add_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) {
+			echo __("Friendship could not be requested.", 'buddypress');
+		} else {
+			echo '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '" class="requested">' . __( 'Friendship Requested', 'buddypress' ) . '</a>';
+		}
+	} else {
+		echo __( 'Request Pending', 'buddypress' );
+	}
+
+	return false;
+}
+add_action( 'wp_ajax_addremove_friend', 'bp_dtheme_ajax_addremove_friend' );
+
+/* AJAX accept a user as a friend when clicking the "accept" button */
+function bp_dtheme_ajax_accept_friendship() {
+	check_admin_referer( 'friends_accept_friendship' );
+
+	if ( !friends_accept_friendship( $_POST['id'] ) )
+		echo "-1<div id='message' class='error'><p>" . __( 'There was a problem accepting that request. Please try again.', 'buddypress' ) . '</p></div>';
+
+	return true;
+}
+add_action( 'wp_ajax_accept_friendship', 'bp_dtheme_ajax_accept_friendship' );
+
+/* AJAX reject a user as a friend when clicking the "reject" button */
+function bp_dtheme_ajax_reject_friendship() {
+	check_admin_referer( 'friends_reject_friendship' );
+
+	if ( !friends_reject_friendship( $_POST['id'] ) )
+		echo "-1<div id='message' class='error'><p>" . __( 'There was a problem rejecting that request. Please try again.', 'buddypress' ) . '</p></div>';
+
+	return true;
+}
+add_action( 'wp_ajax_reject_friendship', 'bp_dtheme_ajax_reject_friendship' );
+
+/* AJAX join or leave a group when clicking the "join/leave" button */
+function bp_dtheme_ajax_joinleave_group() {
+	global $bp;
+
+	if ( groups_is_user_banned( $bp->loggedin_user->id, $_POST['gid'] ) )
+		return false;
+
+	if ( !$group = new BP_Groups_Group( $_POST['gid'], false, false ) )
+		return false;
+
+	if ( 'hidden' == $group->status )
+		return false;
+
+	if ( !groups_is_user_member( $bp->loggedin_user->id, $group->id ) ) {
+
+		if ( 'public' == $group->status ) {
+
+			check_ajax_referer( 'groups_join_group' );
+
+			if ( !groups_join_group( $group->id ) ) {
+				_e( 'Error joining group', 'buddypress' );
+			} else {
+				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 ) {
+
+			check_ajax_referer( 'groups_request_membership' );
+
+			if ( !groups_send_membership_request( $bp->loggedin_user->id, $group->id ) ) {
+				_e( 'Error requesting membership', 'buddypress' );
+			} else {
+				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>';
+			}
+		}
+
+	} else {
+
+		check_ajax_referer( 'groups_leave_group' );
+
+		if ( !groups_leave_group( $group->id ) ) {
+			_e( 'Error leaving group', 'buddypress' );
+		} else {
+			if ( 'public' == $group->status ) {
+				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-' . 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>';
+			}
+		}
+	}
+}
+add_action( 'wp_ajax_joinleave_group', 'bp_dtheme_ajax_joinleave_group' );
+
+/* AJAX close and keep closed site wide notices from an admin in the sidebar */
+function bp_dtheme_ajax_close_notice() {
+	global $userdata;
+
+	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_user_meta( $userdata->ID, 'closed_notices', true );
+
+		$notice_ids[] = (int) $_POST['notice_id'];
+
+		update_user_meta( $userdata->ID, 'closed_notices', $notice_ids );
+	}
+}
+add_action( 'wp_ajax_messages_close_notice', 'bp_dtheme_ajax_close_notice' );
+
+/* AJAX send a private message reply to a thread */
+function bp_dtheme_ajax_messages_send_reply() {
+	global $bp;
+
+	check_ajax_referer( 'messages_send_message' );
+
+	$result = messages_new_message( array( 'thread_id' => $_REQUEST['thread_id'], 'content' => $_REQUEST['content'] ) );
+
+	if ( $result ) { ?>
+		<div class="message-box new-message">
+			<div class="message-metadata">
+				<?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( bp_core_current_time() ) ) ?></span></strong>
+
+				<?php do_action( 'bp_after_message_meta' ) ?>
+			</div>
+
+			<?php do_action( 'bp_before_message_content' ) ?>
+
+			<div class="message-content">
+				<?php echo stripslashes( apply_filters( 'bp_get_the_thread_message_content', $_REQUEST['content'] ) ) ?>
+			</div>
+
+			<?php do_action( 'bp_after_message_content' ) ?>
+
+			<div class="clear"></div>
+		</div>
+	<?php
+	} else {
+		echo "-1<div id='message' class='error'><p>" . __( 'There was a problem sending that reply. Please try again.', 'buddypress' ) . '</p></div>';
+	}
+}
+add_action( 'wp_ajax_messages_send_reply', 'bp_dtheme_ajax_messages_send_reply' );
+
+/* AJAX mark a private message as unread in your inbox */
+function bp_dtheme_ajax_message_markunread() {
+	global $bp;
+
+	if ( !isset($_POST['thread_ids']) ) {
+		echo "-1<div id='message' class='error'><p>" . __('There was a problem marking messages as unread.', 'buddypress' ) . '</p></div>';
+	} else {
+		$thread_ids = explode( ',', $_POST['thread_ids'] );
+
+		for ( $i = 0; $i < count($thread_ids); $i++ ) {
+			BP_Messages_Thread::mark_as_unread($thread_ids[$i]);
+		}
+	}
+}
+add_action( 'wp_ajax_messages_markunread', 'bp_dtheme_ajax_message_markunread' );
+
+/* AJAX mark a private message as read in your inbox */
+function bp_dtheme_ajax_message_markread() {
+	global $bp;
+
+	if ( !isset($_POST['thread_ids']) ) {
+		echo "-1<div id='message' class='error'><p>" . __('There was a problem marking messages as read.', 'buddypress' ) . '</p></div>';
+	} else {
+		$thread_ids = explode( ',', $_POST['thread_ids'] );
+
+		for ( $i = 0; $i < count($thread_ids); $i++ ) {
+			BP_Messages_Thread::mark_as_read($thread_ids[$i]);
+		}
+	}
+}
+add_action( 'wp_ajax_messages_markread', 'bp_dtheme_ajax_message_markread' );
+
+/* AJAX delete a private message or array of messages in your inbox */
+function bp_dtheme_ajax_messages_delete() {
+	global $bp;
+
+	if ( !isset($_POST['thread_ids']) ) {
+		echo "-1<div id='message' class='error'><p>" . __( 'There was a problem deleting messages.', 'buddypress' ) . '</p></div>';
+	} else {
+		$thread_ids = explode( ',', $_POST['thread_ids'] );
+
+		for ( $i = 0; $i < count($thread_ids); $i++ )
+			BP_Messages_Thread::delete($thread_ids[$i]);
+
+		_e('Messages deleted.', 'buddypress');
+	}
+}
+add_action( 'wp_ajax_messages_delete', 'bp_dtheme_ajax_messages_delete' );
+
+/* AJAX autocomplete your friends names on the compose screen */
+function bp_dtheme_ajax_messages_autocomplete_results() {
+	global $bp;
+
+	$friends = false;
+
+	// Get the friend ids based on the search terms
+	if ( function_exists( 'friends_search_friends' ) )
+		$friends = friends_search_friends( $_GET['q'], $bp->loggedin_user->id, $_GET['limit'], 1 );
+
+	$friends = apply_filters( 'bp_friends_autocomplete_list', $friends, $_GET['q'], $_GET['limit'] );
+
+	if ( $friends['friends'] ) {
+		foreach ( (array)$friends['friends'] as $user_id ) {
+			$ud = get_userdata($user_id);
+			$username = $ud->user_login;
+			echo bp_core_fetch_avatar( array( 'item_id' => $user_id, 'type' => 'thumb', 'width' => 15, 'height' => 15 ) ) . ' &nbsp;' . bp_core_get_user_displayname( $user_id ) . ' (' . $username . ')
+			';
+		}
+	}
+}
+add_action( 'wp_ajax_messages_autocomplete_results', 'bp_dtheme_ajax_messages_autocomplete_results' );
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/css/adminbar.css b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/css/adminbar.css
new file mode 100644
index 0000000000000000000000000000000000000000..dea0ddf81ad3154a05d0ce598b198ad013d14d7e
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/css/adminbar.css
@@ -0,0 +1,216 @@
+body {
+	padding-top: 25px;
+}
+
+#wp-admin-bar {
+	position: fixed;
+	top: 0;
+	left: 0;
+	z-index: 99;
+	height: 25px;
+	font-size: 11px;
+	width: 100%;
+	z-index: 1000;
+}
+	#wp-admin-bar .padder {
+		position: relative;
+		padding: 0;
+		width: 100%;
+		margin: 0 auto;
+		background: url( ../images/60pc_black.png );
+		height: 25px;
+	}
+		body#bp-default #wp-admin-bar .padder {
+			min-width: 960px;
+			max-width: 1250px;
+		}
+
+		body#bp-default.activity-permalink #wp-admin-bar .padder {
+			min-width: 960px;
+			max-width: 960px;
+		}
+
+#wp-admin-bar * { z-index: 999; }
+
+#wp-admin-bar div#admin-bar-logo {
+	position: absolute;
+	top: 5px;
+	left: 10px;
+}
+
+#wp-admin-bar a img {
+	border: none;
+}
+
+#wp-admin-bar li {
+	list-style: none;
+	margin: 0;
+	padding: 0;
+	line-height: 100%;
+	text-align: left;
+}
+
+#wp-admin-bar li a {
+	padding: 7px 15px 7px 15px;
+	color: #eee;
+	text-decoration: none;
+	font-size: 11px;
+}
+	#wp-admin-bar li.alt { border: none; }
+
+	#wp-admin-bar li.no-arrow a {
+		padding-right: 15px;
+	}
+
+	#wp-admin-bar ul li ul li a span {
+		display: none;
+	}
+
+#wp-admin-bar li:hover, #wp-admin-bar li.hover {
+	position: static;
+}
+
+#admin-bar-logo {
+	float: left;
+	font-weight: bold;
+	font-size: 11px;
+	padding: 5px 8px;
+	margin: 0;
+	text-decoration: none;
+	color: #fff;
+}
+	body#bp-default #admin-bar-logo { padding: 2px 8px; }
+
+/*******************/
+
+#wp-admin-bar ul { /* all lists */
+	margin: 0;
+	list-style: none;
+	line-height: 1;
+	cursor: pointer;
+	height: auto;
+	padding: 0;
+}
+
+#wp-admin-bar ul li { /* all list items */
+	padding: 0;
+	float: left;
+	position: relative;
+	background: url( ../images/admin-menu-arrow.gif ) 88% 53% no-repeat;
+	padding-right: 11px;
+}
+	#wp-admin-bar ul li.no-arrow {
+		background: none;
+		padding-right: 0;
+	}
+
+	#wp-admin-bar ul li ul li {
+		background-image: none;
+	}
+
+#wp-admin-bar ul li.align-right {
+	position: absolute;
+	right: 0;
+}
+
+#wp-admin-bar ul li a {
+	display: block;
+}
+
+#wp-admin-bar ul.main-nav li:hover, #wp-admin-bar ul.main-nav li.sfhover, #wp-admin-bar ul.main-nav li ul li.sfhover {
+	background-color: #333;
+}
+
+/* second-level lists */
+
+#wp-admin-bar ul li ul {
+	position: absolute;
+	width: 185px;
+	left: -999em;
+	margin-left: 0;
+	background: #333;
+	border: 1px solid #222;
+	-moz-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
+	-webkit-box-shadow:0 4px 8px rgba(0, 0, 0, 0.1);
+	-moz-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	-moz-border-radius-topleft: 0;
+	-webkit-border-top-left-radius: 0;
+	-moz-border-radius-topright: 0;
+	-webkit-border-top-right-radius: 0;
+}
+	#wp-admin-bar ul li > ul {
+		border-top: none;
+	}
+
+	#wp-admin-bar ul li ul a {
+		color: #eee;
+	}
+
+#wp-admin-bar ul li ul li {
+	float: left;
+	width: 174px;
+	margin: 0;
+}
+	#wp-admin-bar ul li ul li:hover a {
+		color: #fff;
+	}
+
+#wp-admin-bar ul li div.admin-bar-clear {
+	clear: both;
+}
+
+#wp-admin-bar ul.main-nav li ul li:hover, #wp-admin-bar ul.main-nav li ul li.sfhover, #wp-admin-bar ul.main-nav li ul li.sfhover {
+	background-color: #222;
+}
+
+/* third-and-above-level lists */
+
+#wp-admin-bar ul li ul ul {
+	margin: -25px 0 0 184px;
+	-moz-border-radius: 3px;
+	-webkit-border-radius: 3px;
+}
+	#wp-admin-bar ul li ul li:hover ul li a {
+		color: #eee;
+	}
+		#wp-admin-bar ul li ul li ul li:hover a {
+			color: #fff;
+		}
+
+#wp-admin-bar ul li:hover ul, #wp-admin-bar ul li ul li:hover ul, #wp-admin-bar ul li.sfhover ul, #wp-admin-bar ul li ul li.sfhover ul  {
+	left: auto;
+}
+
+#wp-admin-bar ul li.align-right:hover ul {
+	right: 0;
+}
+
+#wp-admin-bar ul li:hover ul ul, #wp-admin-bar li.sfhover ul li ul {
+	left: -999em;
+}
+
+/* Menu item css */
+
+#wp-admin-bar img.avatar {
+	float: left;
+	margin-right: 8px;
+}
+
+#wp-admin-bar span.activity {
+	display: block;
+	margin-left: 34px;
+	padding: 0;
+}
+
+#wp-admin-bar ul.author-list li a { height: 17px; }
+
+#wp-admin-bar ul li#bp-adminbar-notifications-menu a span {
+	padding: 0 6px;
+	margin-left: 2px;
+	background: #fff;
+	color: #000;
+	-moz-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+}
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/css/default.css b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/css/default.css
new file mode 100644
index 0000000000000000000000000000000000000000..746b5b97a2bb5c870254d0402968d9bf65842e27
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/css/default.css
@@ -0,0 +1,1763 @@
+@import url( reset.css ); /* Reset browser defaults */
+
+/* > Global Elements
+-------------------------------------------------------------- */
+
+body {
+	background: #eaeaea url( ../images/background.gif ) top left repeat-x;
+	font-size: 12px;
+	font-family: Arial, Tahoma, Verdana, sans-serif;
+	line-height: 170%;
+	color: #555;
+	width: 90%;
+	min-width: 960px;
+	max-width: 1250px;
+	margin: 0 auto;
+	padding-top: 0 !important; /* Remove the top padding space for the admin bar in this theme */
+}
+	body.activity-permalink {
+		min-width: 960px;
+		max-width: 960px;
+	}
+
+h1, h2, h3, h4, h5, h6 {
+	margin: 5px 0 15px 0;
+}
+
+h1 { font-size: 28px; margin-bottom: 25px; }
+h2 { font-size: 24px; margin-bottom: 20px; }
+h3 { font-size: 20px; }
+h4 { font-size: 16px; margin-bottom: 15px; }
+h5 { font-size: 14px; margin-bottom: 0; }
+h6 { font-size: 12px; margin-bottom: 0; }
+
+a { color: #1fb3dd; }
+a:hover, a:active { color: #888; }
+a:focus { outline: 1px dotted #ccc; }
+
+.padder { padding: 19px; }
+.clear { clear: left; }
+
+p {	margin-bottom: 15px; }
+p:last-child { margin-bottom: 0; }
+
+hr {
+	background-color:#E7E7E7;
+	border:0 none;
+	clear:both;
+	height:1px;
+	margin: 20px 0;
+}
+
+img.avatar {
+	float: left;
+	border: 2px solid #eee;
+}
+
+/* > Admin Bar
+-------------------------------------------------------------- */
+
+#wp-admin-bar .padder {
+	width: 90% !important; /* Line up the admin bar with the content body in this theme */
+}
+
+/* > Header
+-------------------------------------------------------------- */
+
+#header {
+	position: relative;
+	color: #fff;
+	background: url( ../images/default_header.jpg);
+	-moz-border-radius-bottomleft: 6px;
+	-webkit-border-bottom-left-radius: 6px;
+	-moz-border-radius-bottomright: 6px;
+	-webkit-border-bottom-right-radius: 6px;
+	margin-bottom: 20px;
+	height: 100px;
+	padding-top: 25px;
+}
+	#header #search-bar {
+		position: absolute;
+		top: 25px;
+		right: 0;
+		width: 100%;
+		text-align: right;
+	}
+
+		#header h1 {
+			line-height: 230%;
+		}
+
+		#header #search-bar .padder {
+			padding: 10px 20px;
+		}
+
+		#header #search-bar input[type=text] {
+			-moz-border-radius: 3px;
+			-webkit-border-radius: 3px;
+			border-radius: 3px;
+			border: 1px inset #888;
+			padding: 2px;
+			margin-right: 4px;
+		}
+
+		#header #search-bar input[type=submit] {
+			font-size: 11px;
+			padding: 1px 4px;
+			margin-left: 4px;
+		}
+
+	#header h1 {
+		position: absolute;
+		bottom: 0;
+		left: 20px;
+		width: 44%;
+		margin: 0 0 -5px 0;
+	}
+		#header h1 a {
+			color: #fff;
+			font-size: 26px;
+			text-decoration: none;
+		}
+
+/* > Navigation
+-------------------------------------------------------------- */
+
+ul#nav {
+	margin: 0;
+	padding: 0;
+	position: absolute;
+	right: 15px;
+	list-style: none;
+	bottom: 0;
+	max-width: 65%;
+}
+	ul#nav li {
+		float: left;
+		margin: 0 5px 0 0;
+	}
+		ul#nav li a {
+			display: block;
+			color: #fff;
+			text-decoration: none;
+			padding: 5px 15px;
+			background: url( ../images/60pc_black.png );
+			-moz-border-radius-topleft: 3px;
+			-webkit-border-top-left-radius: 3px;
+			-moz-border-radius-topright: 3px;
+			-webkit-border-top-right-radius: 3px;
+		}
+			ul#nav li.selected a, ul#nav li.current_page_item a {
+				background: #f5f5f5;
+				color: #555;
+			}
+			ul#nav a:focus { outline: none; }
+
+/* > Container
+-------------------------------------------------------------- */
+
+div#container {
+	position: relative;
+	width: 100%;
+	-moz-border-radius: 6px;
+	-webkit-border-radius: 6px;
+	border-right: 1px solid #e0e0e0;
+	border-bottom: 1px solid #e0e0e0;
+	background: #fff;
+	overflow: hidden;
+}
+	body.activity-permalink div#container {
+		background: none;
+		border: none;
+	}
+
+/* > Sidebar
+-------------------------------------------------------------- */
+
+div#sidebar {
+	float: left;
+	width: 224px;
+	margin-left: -226px;
+	margin-top: 1px;
+	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;
+}
+	div#sidebar div#sidebar-me img.avatar {
+		float: left;
+		margin: 0 10px 15px 0;
+	}
+
+	div#sidebar div#sidebar-me h4 {
+		font-size: 16px;
+		margin: 0 0 8px 0;
+		font-weight: normal;
+	}
+
+
+	div#sidebar ul#bp-nav {
+		clear: left;
+		margin: 15px -16px;
+	}
+		div#sidebar ul#bp-nav li {
+			padding: 10px 15px;
+		}
+
+	div#sidebar h3.widgettitle {
+		margin: 25px -20px 10px -19px;
+		background: #eaeaea;
+		padding: 5px 15px;
+		font-size: 12px;
+		clear: left;
+	}
+
+	div#sidebar .widget_search {
+		margin-top: 20px;
+	}
+		div#sidebar .widget_search input[type=text] {
+			width: 110px;
+			padding: 2px;
+		}
+
+	div#sidebar ul#recentcomments li, div#sidebar .widget_recent_entries ul li {
+		margin-bottom: 15px;
+	}
+
+	div#sidebar ul.item-list img.avatar {
+		width: 20px;
+		height: 20px;
+		margin-right: 10px;
+	}
+		div#sidebar div.item-avatar img {
+			width: 40px;
+			height: 40px;
+			margin: 1px;
+		}
+
+		div#sidebar .avatar-block { overflow: hidden; }
+
+	div#sidebar ul.item-list div.item-title {
+		font-size: 12px;
+	}
+
+	div#sidebar div.item-options {
+		margin: -10px -20px 0 -19px;
+		background: #f8f8f8;
+		padding: 5px 15px;
+		font-size: 11px;
+	}
+
+	div#sidebar div.item-meta, div#sidebar div.item-content {
+		margin-left: 38px;
+		font-size: 11px;
+	}
+
+	div#sidebar div.tags div#tag-text {
+		font-size: 1.4em;
+		line-height: 140%;
+		padding-top: 10px;
+	}
+
+/* > Content
+-------------------------------------------------------------- */
+
+div#content {
+	float: left;
+	width: 100%;
+	-moz-border-radius-topleft: 6px;
+	-webkit-border-top-left-radius: 6px;
+	-moz-border-radius-bottomleft: 6px;
+	-webkit-border-bottom-left-radius: 6px;
+}
+
+div#content .padder {
+	margin-right: 225px;
+	border-right: 1px solid #ddd;
+	-moz-border-radius-topleft: 6px;
+	-webkit-border-top-left-radius: 6px;
+	-moz-border-radius-bottomleft: 6px;
+	-webkit-border-bottom-left-radius: 6px;
+}
+	div#content .left-menu {
+		float: left;
+		width: 170px;
+	}
+
+	div#content .main-column {
+		margin-left: 190px;
+	}
+
+/* > Item Headers (Profiles, Groups)
+-------------------------------------------------------------- */
+
+div#item-header {
+	overflow: hidden;
+}
+	div#item-header div#item-header-content { margin-left: 170px; }
+
+	div#item-header h2 {
+		font-size: 28px;
+		margin: 0 0 15px 0;
+		line-height: 120%;
+	}
+		div#item-header h2 a {
+			text-decoration: none;
+			color: #777;
+		}
+
+	div#item-header img.avatar {
+		float: left;
+		margin: 0 15px 25px 0;
+	}
+
+	div#item-header h2 { margin-bottom: 5px; }
+
+	div#item-header span.activity, div#item-header h2 span.highlight {
+		vertical-align: middle;
+		font-size: 11px;
+		font-weight: normal;
+		line-height: 170%;
+		margin-bottom: 7px;
+	}
+
+	div#item-header h2 span.highlight { font-size: 16px; }
+	div#item-header h2 span.highlight span {
+		position: relative;
+		top: -2px;
+		right: -2px;
+		font-weight: bold;
+		font-size: 11px;
+		background: #a1dcfa;
+		color: #fff;
+		padding: 1px 4px;
+		margin-bottom: 2px;
+		-moz-border-radius: 3px;
+		-webkit-border-radius: 3px;
+		vertical-align: middle;
+		cursor: pointer;
+		display: none;
+	}
+
+	div#item-header div#item-meta {
+		font-size: 14px;
+		color: #aaa;
+		padding-bottom: 10px;
+		overflow: hidden;
+		margin: 15px 0 5px 0;
+	}
+
+	div#item-header div#item-actions {
+		float: right;
+		width: 20%;
+		margin: 0 0 15px 15px;
+		text-align: right;
+	}
+		div#item-header div#item-actions h3 {
+			font-size: 12px;
+			margin: 0 0 5px 0;
+		}
+
+		div#item-header ul {
+			overflow: hidden;
+			margin-bottom: 15px;
+		}
+
+		div#item-header ul h5, div#item-header ul span, div#item-header ul hr {
+			display: none;
+		}
+
+		div#item-header ul li {
+			float: right;
+		}
+
+		div#item-header ul img.avatar, div#item-header ul.avatars img.avatar {
+			width: 30px;
+			height: 30px;
+			margin: 2px;
+		}
+
+	div#item-header div.generic-button, div#item-header a.button {
+		float: left;
+		margin: 10px 10px 0 0;
+	}
+
+	div#item-header div#message.info {
+		line-height: 80%;
+	}
+
+
+/* > Item Lists (Activity, Friend, Group lists)
+-------------------------------------------------------------- */
+
+ul.item-list {
+	width: 100%;
+}
+	ul.item-list li {
+		position: relative;
+		padding: 15px 0;
+		border-bottom: 1px solid #eaeaea;
+	}
+		ul.single-line li { border: none; }
+
+		ul.item-list li img.avatar {
+			float: left;
+			margin: 0 10px 10px 0;
+		}
+
+		ul.item-list li div.item-title, ul.item-list li h4 {
+			font-weight: normal;
+			font-size: 14px;
+			width: 75%;
+			margin: 0;
+		}
+			ul.item-list li div.item-title span {
+				font-size: 12px;
+				color: #999;
+			}
+
+		ul.item-list li div.item-desc {
+			margin: 10px 0 0 64px;
+			font-size: 11px;
+			color: #888;
+			width: 50%;
+		}
+
+		ul.item-list li div.action {
+			position: absolute;
+			top: 15px;
+			right: 0;
+			text-align: right;
+		}
+
+		ul.item-list li div.meta {
+			margin-top: 10px;
+			color: #888;
+			font-size: 11px;
+		}
+
+		ul.item-list li h5 span.small {
+			font-weight: normal;
+			font-size: 11px;
+		}
+
+/* > Item Tabs
+-------------------------------------------------------------- */
+
+div.item-list-tabs {
+	clear: left;
+	overflow: hidden;
+	margin: 25px -19px 20px -19px;
+	background: #eaeaea;
+}
+	div.item-list-tabs ul li a {
+		text-decoration: none;
+	}
+
+	div.item-list-tabs ul {
+		width: 100%;
+	}
+		div.item-list-tabs ul li {
+			float: left;
+			margin: 5px 0 0 5px;
+		}
+			div.item-list-tabs#subnav ul li {
+				margin-top: 0;
+			}
+
+			div.item-list-tabs ul li:first-child {
+				margin-left: 20px;
+			}
+
+			div.item-list-tabs ul li.last {
+				float: right;
+				margin: 7px 20px 0 0;
+			}
+				div.item-list-tabs#subnav ul li.last {
+					margin-top: 4px;
+				}
+
+				div.item-list-tabs ul li.last select {
+					max-width: 175px;
+				}
+
+		div.item-list-tabs ul li a,
+		div.item-list-tabs ul li span {
+			display: block;
+			padding: 5px 10px;
+			text-decoration: none;
+		}
+			div.item-list-tabs ul li span {
+				color: #aaa;
+			}
+
+			div.item-list-tabs ul li a span {
+				display: inline;
+				padding: 0;
+				color: inherit;
+			}
+
+		div.item-list-tabs ul li.selected a,
+		div.item-list-tabs ul li.current a {
+			background-color: #fff;
+			color: #555;
+			font-weight: bold;
+			-moz-border-radius-topleft: 3px;
+			-webkit-border-top-left-radius: 3px;
+			-moz-border-radius-topright: 3px;
+			-webkit-border-top-right-radius: 3px;
+		}
+			ul li.loading a {
+				background-image: url( ../images/ajax-loader.gif );
+				background-position: 92% 50%;
+				background-repeat: no-repeat;
+				padding-right: 30px !important;
+			}
+				div#item-nav ul li.loading a {
+					background-position: 88% 50%;
+				}
+
+	div.item-list-tabs#object-nav {
+		margin-top: 0;
+	}
+
+	div.item-list-tabs#subnav {
+		background: #fff;
+		margin: -15px -19px 15px -19px;
+		border-bottom: 1px solid #eaeaea;
+		min-height: 35px;
+		overflow: hidden;
+	}
+
+	div.item-list-tabs ul li.feed a {
+		background: url( ../images/rss.png ) center left no-repeat;
+		padding-left: 20px;
+	}
+
+/* > Item Body
+-------------------------------------------------------------- */
+
+.item-body {
+	margin: 20px 0;
+}
+
+span.activity, div#message p {
+	display: inline-block;
+	font-size: 11px;
+	font-weight: normal;
+	background: #FFF9DB;
+	border-bottom: 1px solid #FFE8C4;
+	border-right: 1px solid #FFE8C4;
+	color: #ffa200;
+	padding: 1px 8px;
+	margin-top: 6px;
+	text-decoration: none;
+	-moz-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+}
+
+/* > Directories (Members, Groups, Blogs, Forums)
+-------------------------------------------------------------- */
+
+div.dir-search {
+	float: right;
+	margin: -37px 0 0 0;
+}
+	div.dir-search input[type=text] {
+		padding: 4px;
+		font-size: 12px;
+	}
+
+/* > Pagination
+-------------------------------------------------------------- */
+
+div.pagination {
+	margin: -20px -20px 9px -20px;
+	border-bottom: 1px solid #eaeaea;
+	padding: 10px 20px 10px 20px;
+	color: #888;
+	font-size: 11px;
+	height: 16px;
+}
+	div.pagination#user-pag, .friends div.pagination,
+	.mygroups div.pagination, .myblogs div.pagination, noscript div.pagination {
+		background: #f8f8f8;
+		border: none;
+		padding: 8px 15px;
+	}
+
+	div.pagination .pag-count {
+		float: left;
+	}
+
+	div.pagination .pagination-links {
+		float: right;
+	}
+		div.pagination .pagination-links span,
+		div.pagination .pagination-links a {
+			font-size: 12px;
+			padding: 0 5px;
+		}
+			div.pagination .pagination-links a:hover {
+				font-weight: bold;
+			}
+
+div#pag-bottom {
+	margin-top: 0;
+}
+
+/* > Error / Success Messages
+-------------------------------------------------------------- */
+
+div#message {
+	margin: 15px 0;
+}
+	div#message.updated { clear: both; }
+
+div#message p {
+	padding: 10px 15px;
+	font-size: 12px;
+	display:block;
+}
+	div#message.error p {
+		background: #e41717;
+		color: #fff;
+		border-color: #a71a1a;
+		clear: left;
+	}
+
+	div#message.updated p {
+		background: #dffcd9;
+		color: #1a9b00;
+		border-color: #c4e9bd;
+	}
+
+form.standard-form#signup_form div div.error {
+	color: #fff;
+	background: #e41717;
+	-moz-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	padding: 6px;
+	width: 90%;
+	margin: 0 0 10px 0;
+}
+
+/* > Buttons
+-------------------------------------------------------------- */
+
+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;
+	padding: 3px 10px;
+	-moz-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	text-decoration: none;
+	color: #888;
+	font-size: 12px;
+	font-weight: normal;
+	vertical-align: bottom;
+	cursor: pointer;
+}
+	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;
+		color: #555;
+		outline: none;
+	}
+
+	/* Buttons that are disabled */
+	div.pending a, a.disabled {
+		border-color: #eee;
+		color: #bbb;
+		cursor: default;
+	}
+	div.pending a:hover, a.disabled:hover { border-color: #eee; color: #bbb; }
+
+	div.accept, div.reject {
+		float: left;
+		margin-left: 10px;
+	}
+
+ul.button-nav li {
+	float: left;
+	margin: 0 10px 10px 0;
+}
+	ul.button-nav li.current a {
+		font-weight: bold;
+	}
+
+/* > AJAX Loaders
+-------------------------------------------------------------- */
+
+.ajax-loader {
+	background: url( ../images/ajax-loader.gif ) center left no-repeat !important;
+	padding: 8px;
+	display: none;
+}
+
+a.loading {
+	background-image: url( ../images/ajax-loader.gif ) !important;
+	background-position: 95% 50% !important;
+	background-repeat: no-repeat !important;
+	padding-right: 25px !important;
+}
+
+/* > Input Forms
+-------------------------------------------------------------- */
+
+form.standard-form {
+
+}
+	form.standard-form textarea, form.standard-form input[type=text],
+	form.standard-form select, form.standard-form input[type=password],
+	.dir-search input[type=text] {
+		border: 1px inset #ccc;
+		-moz-border-radius: 3px;
+		-webkit-border-radius: 3px;
+		border-radius: 3px;
+		padding: 6px;
+		font: inherit;
+		font-size: 14px;
+		color: #888;
+	}
+		form.standard-form select {
+			padding: 3px;
+		}
+
+		form.standard-form input[type=password] {
+			margin-bottom: 5px;
+		}
+
+	form.standard-form label, form.standard-form span.label {
+		display: block;
+		font-weight: bold;
+		margin: 15px 0 5px 0;
+	}
+		form.standard-form div.checkbox label,
+		form.standard-form div.radio label {
+			font-weight: normal;
+			margin: 5px 0 0 0;
+			font-size: 14px;
+			color: #888;
+		}
+
+		form.standard-form#sidebar-login-form label {
+			margin-top: 5px;
+		}
+
+	form.standard-form input[type=text] {
+		width: 75%;
+	}
+		form.standard-form#sidebar-login-form input[type=text],
+		form.standard-form#sidebar-login-form input[type=password] {
+			padding: 4px;
+			width: 95%;
+		}
+
+		form.standard-form #basic-details-section input[type=password],
+		form.standard-form #blog-details-section input#signup_blog_url {
+			width: 35%;
+		}
+
+		form.standard-form#signup_form input[type=text],
+		form.standard-form#signup_form textarea {
+			width: 90%;
+		}
+			form.standard-form#signup_form div.submit { float: right; }
+			div#signup-avatar img { margin: 0 15px 10px 0; }
+
+	form.standard-form textarea {
+		width: 75%;
+		height: 120px;
+	}
+		form.standard-form textarea#message_content {
+			height: 200px;
+		}
+
+		form.standard-form#send-reply textarea {
+			width: 97.5%;
+		}
+
+	form.standard-form p.description {
+		font-size: 11px;
+		color: #888;
+		margin: 5px 0;
+	}
+
+	form.standard-form div.submit {
+		padding: 15px 0;
+		clear: both;
+	}
+		form.standard-form div.submit input {
+			margin-right: 15px;
+		}
+
+	form.standard-form div.radio ul {
+		margin: 10px 0 15px 38px;
+		list-style: disc;
+	}
+		form.standard-form div.radio ul li {
+			margin-bottom: 5px;
+		}
+
+	form.standard-form a.clear-value {
+		display: block;
+		margin-top: 5px;
+		outline: none;
+	}
+
+form.standard-form #basic-details-section, form.standard-form #blog-details-section,
+form.standard-form #profile-details-section {
+	float: left;
+	width: 48%;
+}
+	form.standard-form #profile-details-section { float: right; }
+	form.standard-form #blog-details-section {
+		clear: left;
+	}
+
+form.standard-form input:focus, form.standard-form textarea:focus, form.standard-form select:focus {
+	background: #fafafa;
+	color: #555;
+}
+
+form#send-invite-form {
+	margin-top: 20px;
+}
+	div#invite-list {
+		height: 400px;
+		overflow: scroll;
+		-moz-border-radius: 3px;
+		-webkit-border-radius: 3px;
+		border-radius: 3px;
+		padding: 5px;
+		background: #f5f5f5;
+		width: 160px;
+		border: 1px solid #e4e4e4;
+		margin: 10px 0;
+	}
+
+
+/* > Data Tables
+-------------------------------------------------------------- */
+
+table {
+	width: 100%;
+}
+	table thead tr {
+		background: #eaeaea;
+	}
+
+	table#message-threads {
+		margin: 0 -20px;
+		width: auto;
+	}
+
+	table.profile-fields { margin-bottom: 20px; }
+
+	div#sidebar table {
+		margin: 0 -16px;
+		width: 117%;
+	}
+
+	table tr td, table tr th {
+		padding: 8px;
+		vertical-align: middle;
+	}
+		table tr td.label {
+			border-right: 1px solid #eaeaea;
+			font-weight: bold;
+			width: 25%;
+		}
+
+		table tr td.thread-info p { margin: 0; }
+
+			table tr td.thread-info p.thread-excerpt {
+				color: #888;
+				font-size: 11px;
+				margin-top: 3px;
+			}
+
+		div#sidebar table td, table.forum td { text-align: center; }
+
+	table tr.alt {
+		background: #f4f4f4;
+	}
+
+table.notification-settings {
+	margin-bottom: 20px;
+	text-align: left;
+}
+	table.notification-settings th.icon, table.notification-settings td:first-child { display: none; }
+	table.notification-settings th.title { width: 80%; }
+	table.notification-settings .yes, table.notification-settings .no { width: 40px; text-align: center; }
+
+table.forum {
+	margin: -9px -20px 20px -20px;
+	width: auto;
+}
+	table.forum tr.sticky td {
+		background: #FFF9DB;
+		border-top: 1px solid #FFE8C4;
+		border-bottom: 1px solid #FFE8C4;
+	}
+
+	table.forum tr.closed td.td-title {
+		padding-left: 35px;
+		background-image: url( ../images/closed.png );
+		background-position: 15px 50%;
+		background-repeat: no-repeat;
+	}
+
+	table.forum td p.topic-text {
+		color: #888;
+		font-size: 11px;
+	}
+
+	table.forum tr > td:first-child, table.forum tr > th:first-child {
+		padding-left: 15px;
+	}
+
+	table.forum tr > td:last-child, table.forum tr > th:last-child {
+		padding-right: 15px;
+	}
+
+	table.forum tr th#th-title, table.forum tr th#th-poster,
+	table.forum tr th#th-group, table.forum td.td-poster,
+	table.forum td.td-group, table.forum td.td-title { text-align: left; }
+
+	table.forum td.td-freshness {
+		font-size: 11px;
+		color: #888;
+	}
+
+	table.forum td img.avatar {
+		margin-right: 5px;
+	}
+
+	table.forum td.td-poster, table.forum td.td-group  {
+		min-width: 130px;
+	}
+
+	table.forum th#th-title {
+		width: 40%;
+	}
+
+	table.forum th#th-postcount {
+		width: 1%;
+	}
+
+/* > Activity Stream Posting
+-------------------------------------------------------------- */
+
+form#whats-new-form {
+	margin-bottom: 5px;
+	border-bottom: 1px solid #f0f0f0;
+	overflow: hidden;
+	padding-bottom: 20px;
+}
+	#item-body form#whats-new-form {
+		margin-top: 20px;
+		border: none;
+	}
+
+	.home-page form#whats-new-form {
+		border-bottom: none;
+		padding-bottom: 0;
+	}
+
+	form#whats-new-form h5 {
+		margin: 0;
+		font-weight: normal;
+		font-size: 12px;
+		color: #888;
+		margin-left: 76px;
+		padding: 0 0 3px 0;
+	}
+
+	form#whats-new-form #whats-new-avatar {
+		float: left;
+	}
+
+	form#whats-new-form #whats-new-content {
+		margin-left: 54px;
+		padding-left: 22px;
+	}
+
+	form#whats-new-form #whats-new-textarea {
+		padding: 8px;
+		border: 1px inset #ccc;
+		background: #fff;
+		margin-bottom: 10px;
+		-moz-border-radius: 3px;
+		-webkit-border-radius: 3px;
+		border-radius: 3px;
+	}
+	form#whats-new-form textarea {
+		width: 100%;
+		height: 50px;
+		font-size: 14px;
+		font-family: inherit;
+		color: #555;
+		border: none;
+		margin: 0;
+		padding: 0;
+	}
+
+	form#whats-new-form #whats-new-options select {
+		max-width: 200px;
+	}
+
+	form#whats-new-form #whats-new-submit {
+		float: right;
+		margin: 0;
+	}
+
+/* > Activity Stream Listing
+-------------------------------------------------------------- */
+
+ul.activity-list li {
+	padding: 20px 0 0 0;
+	overflow: hidden;
+}
+	ul.activity-list > li:first-child {
+		padding-top: 5px;
+	}
+
+	ul.activity-list li.has-comments {
+		padding-bottom: 20px;
+	}
+
+.activity-list li.mini {
+	position: relative;
+	font-size: 11px;
+	min-height: 35px;
+	padding: 12px 0 0 0;
+}
+	.activity-list li.mini div.activity-meta {
+		margin: 0;
+	}
+
+	.activity-list li.mini div.activity-meta a {
+		padding: 3px 8px;
+	}
+
+	.activity-list li.mini .activity-avatar img.avatar,
+	.activity-list li.mini .activity-avatar img.FB_profile_pic {
+		width: 20px;
+		height: 20px;
+		margin-left: 36px;
+	}
+		.activity-list li.activity_comment .activity-avatar img.avatar,
+		.activity-list li.activity_comment .activity-avatar img.FB_profile_pic {
+			width: 40px;
+			height: 40px;
+			margin-left: 20px;
+		}
+
+		body.activity-permalink .activity-list li .activity-avatar img.avatar,
+		body.activity-permalink .activity-list li .activity-avatar img.FB_profile_pic {
+			width: 100px;
+			height: 100px;
+			margin-left: 0;
+		}
+
+	.activity-list li.mini .activity-content {
+		margin-right: 175px;
+	}
+
+	.activity-list li.mini .activity-content p {
+		margin: 0;
+		float: left;
+	}
+
+	.activity-list li.mini .activity-meta {
+		position: absolute;
+		right: 0;
+	}
+		body.activity-permalink .activity-list li.mini .activity-meta {
+			position: absolute;
+			right: 15px;
+		}
+
+	.activity-list li.mini .activity-comments {
+		clear: left;
+		font-size: 12px;
+		margin-top: 30px;
+	}
+
+.activity-list li .activity-inreplyto {
+	font-size: 11px;
+	color: #888;
+	margin-left: 70px;
+	margin-bottom: 15px;
+	padding-left: 25px;
+	background: url( ../images/replyto_arrow.gif ) 7px 0 no-repeat;
+}
+	.activity-list li .activity-inreplyto > p {
+		margin: 0;
+		display: inline;
+	}
+
+	.activity-list li .activity-inreplyto blockquote,
+	.activity-list li .activity-inreplyto div.activity-inner {
+		background: none;
+		border: none;
+		display: inline;
+		padding: 0;
+		margin: 0;
+		overflow: hidden;
+	}
+
+.activity-list .activity-avatar img {
+	width: 50px;
+	height: 50px;
+}
+		body.activity-permalink .activity-list .activity-avatar img {
+			width: 100px;
+			height: 100px;
+		}
+
+.activity-list .activity-content {
+	margin-left: 70px;
+}
+	body.activity-permalink .activity-list li .activity-content {
+		-moz-border-radius: 4px;
+		-webkit-border-radius: 4px;
+		border-radius: 4px;
+		background: #fff;
+		padding: 15px;
+		border-bottom: 1px solid #ddd;
+		border-right: 1px solid #ddd;
+		margin-left: 135px;
+		font-size: 16px;
+		line-height: 150%;
+		min-height: 35px;
+		margin-right: 0;
+	}
+		body.activity-permalink .activity-list li .activity-header > p {
+			background: url( ../images/activity_arrow.gif ) top left no-repeat;
+			margin-left: -35px;
+			padding: 5px 0 0 38px;
+			height: 35px;
+			margin-bottom: 0;
+		}
+
+	.activity-list .activity-content .activity-header,
+	.activity-list .activity-content .comment-header {
+		font-size: 11px;
+		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;
+		border-bottom: 1px solid #a1dcfa;
+		border-right: 1px solid #a1dcfa;
+		color: #059AE7;
+		padding: 3px 8px;
+		text-decoration: none;
+		-moz-border-radius: 4px;
+		-webkit-border-radius: 4px;
+		border-radius: 4px;
+		margin-right: 3px;
+	}
+		.activity-list .activity-header a:first-child:hover {
+			background: #059AE7 !important;
+			color: #fff !important;
+		}
+		.activity-list .activity-content a:first-child:focus { outline: none; }
+
+		.activity-list .activity-content span.time-since {
+			color: #bbb;
+		}
+
+	.activity-list .activity-content span.activity-header-meta a {
+		background: none;
+		padding: 0;
+		font-size: 11px;
+		margin: 0;
+		border: none;
+		color: #aaa;
+		text-decoration: underline;
+	}
+		.activity-list .activity-content span.activity-header-meta a:hover {
+			color: inherit;
+			text-decoration: none;
+		}
+
+	.activity-list .activity-content .activity-inner,
+	.activity-list .activity-content blockquote {
+		margin: 15px 0 15px 5px;
+		overflow: hidden;
+	}
+		body.activity-permalink .activity-content .activity-inner,
+		body.activity-permalink .activity-content blockquote {
+			margin-top: 5px;
+		}
+
+		/* Backwards compatibility. */
+		.activity-inner > .activity-inner { margin: 0 !important; }
+		.activity-inner > blockquote { margin: 0 !important; }
+
+	.activity-list .activity-content img.thumbnail {
+		float: left;
+		margin: 0 10px 5px 0;
+		border: 2px solid #eee;
+	}
+
+.activity-list li.load-more {
+	margin: 15px  0 !important;
+	padding: 10px 15px !important;
+	background: #f0f0f0 !important;
+	text-align: center;
+	font-size: 1.2em;
+	border-right: 1px solid #ddd;
+	border-bottom: 1px solid #ddd;
+	-moz-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+}
+	.activity-list li.load-more a {
+		color: #555;
+	}
+
+/* > Activity Stream Comments
+-------------------------------------------------------------- */
+
+div.activity-meta {
+	margin: 0 0 20px 3px;
+	clear: left;
+}
+
+.activity-list div.activity-meta a {
+	font-size: 11px;
+	background: #f4f4f4;
+	border-bottom: 1px solid #ddd;
+	border-right: 1px solid #ddd;
+	color: #999;
+	padding: 4px 8px;
+	text-decoration: none;
+	-moz-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	border-radius: 4px;
+	margin-right: 3px;
+}
+	.activity-list div.activity-meta a.acomment-reply {
+		background: #FFF9DB;
+		border-bottom: 1px solid #FFE8C4;
+		border-right: 1px solid #FFE8C4;
+		color: #ffa200;
+	}
+
+	div.activity-meta a:focus { outline: none; }
+	div.activity-meta a:hover {
+		background: #aaa;
+		color: #fff;
+		border-color: #aaa;
+	}
+		div.activity-meta a.acomment-reply:hover {
+			background: #f7740a;
+			color: #fff;
+			border-color: #f7740a;
+		}
+
+div.activity-comments {
+	position: relative;
+	margin: 0 0 0 75px;
+	width: auto;
+	overflow: hidden; /* IE fix */
+}
+
+	body.activity-permalink div.activity-comments {
+		width: auto;
+		margin-left: 135px;
+		background: none;
+	}
+
+div.activity-comments > ul {
+	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;
+	list-style: none;
+}
+
+	div.activity-comments ul {
+		clear: left;
+	}
+
+	div.activity-comments ul li {
+		border-top: 2px solid #fff;
+		padding: 10px 0 0;
+	}
+		body.activity-permalink div.activity-comments ul li {
+			border-width: 1px;
+			padding: 10px 0 0;
+		}
+
+		div.activity-comments ul li p:last-child {
+			margin-bottom: 10px;
+		}
+
+		div.activity-comments > ul > li:first-child {
+			border-top: none;
+		}
+
+		div.activity-comments ul li:last-child {
+			margin-bottom: 0;
+		}
+
+	div.activity-comments ul li > ul {
+		margin-top: 0;
+		margin-left: 20px;
+	}
+		body.activity-permalink div.activity-comments ul li > ul {
+			margin-top: 15px;
+		}
+
+	div.activity-comments div.acomment-avatar img {
+		border-width: 2px !important;
+		float: left;
+		margin-right: 10px;
+	}
+
+	div.activity-comments div.acomment-content {
+		font-size: 11px;
+		margin-left: 39px;
+		margin-top: 5px;
+	}
+		div.acomment-content .time-since { display: none; }
+		div.acomment-content .activity-delete-link { display: none; }
+		div.acomment-content .comment-header { display: none; }
+
+		body.activity-permalink div.activity-comments div.acomment-content {
+			font-size: 14px;
+		}
+
+	div.activity-comments div.acomment-meta {
+		font-size: 11px;
+		color: #888;
+	}
+
+	div.activity-comments form.ac-form {
+		display: none;
+		margin: 10px 0 10px 33px;
+		background: #fafafa;
+		border: 1px solid #ddd;
+		-moz-border-radius: 4px;
+		-webkit-border-radius: 4px;
+		border-radius: 4px;
+		padding: 8px;
+	}
+		div.activity-comments li form.ac-form {
+			margin-right: 15px;
+		}
+
+		div.activity-comments form.root {
+			margin-left: 0;
+		}
+
+		div.activity-comments div#message {
+			margin-top: 15px;
+			margin-bottom: 0;
+		}
+
+		div.activity-comments form.loading {
+			background-image: url( ../images/ajax-loader.gif );
+			background-position: 2% 95%;
+			background-repeat: no-repeat;
+		}
+
+		div.activity-comments form .ac-textarea {
+			padding: 8px;
+			border: 1px inset #ccc;
+			background: #fff;
+			margin-bottom: 10px;
+			-moz-border-radius: 3px;
+			-webkit-border-radius: 3px;
+			border-radius: 3px;
+		}
+			div.activity-comments form textarea {
+				width: 100%;
+				font-family: inherit;
+				font-size: 11px;
+				color: #555;
+				height: 60px;
+				border: none;
+				padding: 0;
+			}
+				div.activity-comments form input {
+					margin-top: 5px;
+				}
+
+		div.activity-comments form div.ac-reply-avatar {
+			float: left;
+		}
+			div.ac-reply-avatar img {
+				border: 2px solid #fff !important;
+			}
+
+		div.activity-comments form div.ac-reply-content {
+			margin-left: 50px;
+			padding-left: 15px;
+			color: #888;
+			font-size: 11px;
+		}
+
+/* > Private Message Threads
+-------------------------------------------------------------- */
+
+table#message-threads tr.unread td {
+	background: #FFF9DB;
+	border-top: 1px solid #FFE8C4;
+	border-bottom: 1px solid #FFE8C4;
+	font-weight: bold;
+}
+	table#message-threads tr.unread td span.activity {
+		background: #fff;
+	}
+
+	li span.unread-count, tr.unread span.unread-count {
+		background: #dd0000;
+		padding: 2px 8px;
+		color: #fff;
+		font-weight: bold;
+		-moz-border-radius: 3px;
+		-webkit-border-radius: 3px;
+		border-radius: 3px;
+	}
+		div.item-list-tabs ul li a span.unread-count {
+			padding: 1px 6px;
+			color: #fff;
+		}
+
+	div.messages-options-nav {
+		font-size: 11px;
+		background: #eee;
+		text-align: right;
+		margin: 0 -20px;
+		padding: 5px 15px;
+	}
+
+div#message-thread div.message-box {
+	margin: 0 -20px;
+	padding: 15px;
+}
+	div#message-thread div.alt {
+		background: #f4f4f4;
+	}
+
+	div#message-thread p#message-recipients {
+		margin: 10px 0 20px 0;
+	}
+
+	div#message-thread img.avatar {
+		float: left;
+		margin: 0 10px 0 0;
+		vertical-align: middle;
+	}
+
+	div#message-thread strong {
+		margin: 0;
+		font-size: 16px;
+	}
+		div#message-thread strong a {
+			text-decoration: none;
+		}
+
+		div#message-thread strong span.activity {
+			margin: 4px 0 0 10px;
+		}
+
+	div#message-thread div.message-metadata {
+		overflow: hidden;
+	}
+
+	div#message-thread div.message-content {
+		margin-left: 45px;
+	}
+
+	div#message-thread div.message-options {
+		text-align: right;
+	}
+
+/* > Group Forum Topics
+-------------------------------------------------------------- */
+
+ul#topic-post-list {
+	margin: 15px -20px;
+	width: auto;
+}
+	ul#topic-post-list li {
+		padding: 15px;
+		position: relative;
+	}
+
+	ul#topic-post-list li.alt {
+		background: #f4f4f4;
+	}
+
+	ul#topic-post-list li div.poster-meta {
+		margin-bottom: 10px;
+		color: #888;
+	}
+
+	ul#topic-post-list li div.post-content {
+		margin-left: 54px;
+	}
+
+div.admin-links {
+	position: absolute;
+	top: 15px;
+	right: 25px;
+	color: #888;
+	font-size: 11px;
+}
+	div#topic-meta div.admin-links {
+		bottom: 0;
+		right: 0;
+		top: auto;
+	}
+
+div#topic-meta {
+	position: relative;
+	padding: 5px 0;
+}
+	div#topic-meta h3 {
+		font-size: 20px;
+	}
+
+div#new-topic-post {
+	margin: 0;
+	padding: 1px 0 0 0;
+}
+
+/* > WordPress Blog Styles
+-------------------------------------------------------------- */
+
+div.post {
+	margin: 0 0 40px 0;
+	overflow: hidden;
+}
+	div.post h2.pagetitle, div.post h2.posttitle {
+		margin: 0;
+		line-height: 120%;
+	}
+		div.post h2.pagetitle a, div.post h2.posttitle a {
+			color: #666;
+			text-decoration: none;
+		}
+
+	.navigation, .paged-navigation, .comment-navigation {
+		overflow: hidden;
+		font-family: georgia, times, serif;
+		font-style: italic;
+		font-size: 14px;
+		padding: 5px 0;
+		margin: 5px 0 25px 0;
+	}
+		.alignright {
+			float: right;
+			margin-left: 15px;
+		}
+
+		.alignleft {
+			float: left;
+			margin-right: 15px;
+		}
+
+	div.post p { margin: 0 0 20px 0; }
+	div.post ul, div.post ol, div.post dl { margin: 0 0 18px 1.5em; }
+	div.post ul { list-style: square; }
+	div.post ol { list-style: decimal; }
+	div.post ol ol { list-style: upper-alpha; }
+	div.post dl { margin-left: 0; }
+	div.post dt { font-size: 14px; font-weight: bold; }
+	div.post dd { margin: 0 0 15px 0;}
+
+	div.post pre, div.post code p {
+		padding: 15px;
+		background: #f4f4f4;
+		-moz-border-radius: 3px;
+		-webkit-border-radius: 3px;
+		border-radius: 3px;
+	}
+
+	div.post code { font-family: "Monaco", courier, sans-serif; }
+	div.post blockquote {
+		quotes: none;
+		font-style:italic;
+		padding:0 3em;
+		font-family: georgia, times, serif;
+		font-size: 16px;
+		line-height: 150%;
+	}
+
+	div.post table {
+		border-collapse:collapse;
+		border-spacing:0;
+		border: 1px solid #eee;
+	}
+		div.post table th { border-top: 1px solid #eee; text-align: left; }
+		div.post table td { border-top: 1px solid #eee; }
+
+	div.post div.author-box, div.comment-avatar-box {
+		background: #f0f0f0;
+		padding: 10px;
+		float: left;
+		margin: 0 15px 15px 0;
+		font-family: georgia, times, serif;
+		font-style: italic;
+		text-align: center;
+		width: 70px;
+		-moz-border-radius: 3px;
+		-webkit-border-radius: 3px;
+		border-radius: 3px;
+	}
+		div.author-box p, div.comment-avatar-box p { margin: 5px 0 0; }
+		div.author-box a, div.comment-avatar-box a { text-decoration: none; }
+
+		div.post div.author-box img, div.comment-avatar-box img {
+			float: none;
+			border: 4px solid #fff;
+			margin: 0;
+		}
+
+	div.post div.post-content, div.comment-content {
+		margin-left: 105px;
+	}
+
+	div.post p.date, div.post p.postmetadata, div.comment-meta, div.comment-options {
+		color: #888;
+		font-size: 12px;
+		font-family: Georgia, times, serif;
+		padding: 3px 0;
+		margin: 10px 0;
+		border-bottom: 1px solid #e4e4e4;
+		border-top: 1px solid #e4e4e4;
+	}
+
+	div.post p.postmetadata {
+		margin-top: 15px;
+		clear: left;
+		overflow: hidden;
+	}
+
+	div.post .tags { float: left; }
+	div.post .comments { float: right; }
+
+	div.post img { margin-bottom: 15px; }
+	div.post img.wp-smiley { padding: 0 !important; margin: 0 !important; border: none !important; float: none !important; clear: none !important; }
+
+	div.post img.centered, img.aligncenter {
+		display: block;
+		margin-left: auto;
+		margin-right: auto;
+	}
+
+	div.post img.alignright {
+		padding: 4px;
+		margin: 0 0 2px 7px;
+		display: inline;
+	}
+
+	div.post img.alignleft {
+		padding: 4px;
+		margin: 0 7px 2px 0;
+		display: inline;
+	}
+
+	div.post .aligncenter, div.post div.aligncenter {
+		display: block;
+		margin-left: auto;
+		margin-right: auto;
+	}
+
+	div.post .wp-caption {
+		border: 1px solid #ddd;
+		text-align: center;
+		background-color: #f3f3f3;
+		padding-top: 4px;
+		-moz-border-radius: 3px;
+		-webkit-border-radius: 3px;
+		border-radius: 3px;
+	}
+
+	div.post .wp-caption img {
+		margin: 0;
+		padding: 0;
+		border: 0 none;
+	}
+
+	div.post dd.wp-caption p.wp-caption-text, div.post .wp-caption p.wp-caption-text {
+		font-size: 0.9em;
+		line-height: 17px;
+		padding: 0 4px 5px 0;
+		margin: 0;
+	}
+
+/* > WordPress Blog Comment Styles
+-------------------------------------------------------------- */
+
+#trackbacks {
+	margin-top: 30px;
+}
+
+#comments h3, #trackbacks h3, #respond h3 {
+	font-size: 20px;
+	margin: 5px 0 25px 0;
+	font-weight: normal;
+	color: #555;
+}
+
+#comments span.title, #trackbacks span.title {
+	color: #aaa;
+}
+
+ol.commentlist li {
+	margin: 0 0 30px 0;
+}
+
+	div.comment-meta {
+		border-top: none;
+		padding-top: 0;
+	}
+
+	div.comment-meta h5 {
+		font-weight: normal;
+	}
+
+	div.comment-meta em {
+		float: right;
+	}
+
+	div.comment-options {
+		border-bottom: none;
+	}
+
+/* > Footer
+-------------------------------------------------------------- */
+
+#footer {
+	padding: 25px;
+	text-align: center;
+	color: #bbb;
+	text-shadow: #fafafa 1px 1px 0;
+}
+	#footer a {
+		color: #bbb;
+	}
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/css/reset.css b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/css/reset.css
new file mode 100644
index 0000000000000000000000000000000000000000..2a0a2e25845fe20214d16fe74210875344ee87a8
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/css/reset.css
@@ -0,0 +1,64 @@
+/* --------------------------------------------------------------
+
+   Reset default browser CSS.
+
+   Based on work by Eric Meyer:
+   http://meyerweb.com/eric/tools/css/reset/index.html
+
+-------------------------------------------------------------- */
+
+/* v1.0 | 20080212 */
+
+html, body, div, span, applet, object, iframe,
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+a, abbr, acronym, address, big, cite, code,
+del, dfn, em, font, img, ins, kbd, q, s, samp,
+small, strike, strong, sub, sup, tt, var,
+b, u, i, center,
+dl, dt, dd, ol, ul, li,
+fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td {
+	margin: 0;
+	padding: 0;
+	border: 0;
+	outline: 0;
+	font-size: 100%;
+	vertical-align: baseline;
+	background: transparent;
+}
+body {
+    background:#fff;
+	line-height: 1;
+}
+ol, ul {
+	list-style: none;
+}
+blockquote, q {
+	quotes: none;
+}
+blockquote:before, blockquote:after,
+q:before, q:after {
+	content: '';
+	content: none;
+}
+
+/* remember to define focus styles! */
+:focus {
+	outline: 0;
+}
+
+/* remember to highlight inserts somehow! */
+ins {
+	text-decoration: none;
+}
+del {
+	text-decoration: line-through;
+}
+
+/* tables still need 'cellspacing="0"' in the markup */
+table {
+	border-collapse: collapse;
+	border-spacing: 0;
+}
+
+a img { border: none; }
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/global.js b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/global.js
new file mode 100644
index 0000000000000000000000000000000000000000..c52df49568677535d39828e9ffdc43754ddedeff
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/global.js
@@ -0,0 +1,1259 @@
+// AJAX Functions
+var jq = jQuery;
+
+// Global variable to prevent multiple AJAX requests
+var bp_ajax_request = null;
+
+jq(document).ready( function() {
+	/**** Page Load Actions *******************************************************/
+
+	/* Hide Forums Post Form */
+	if ( jq('div.forums').length )
+		jq('div#new-topic-post').hide();
+
+	/* Activity filter and scope set */
+	bp_init_activity();
+
+	/* Object filter and scope set. */
+	var objects = [ 'members', 'groups', 'blogs', 'forums' ];
+	bp_init_objects( objects );
+
+	/* @mention Compose Scrolling */
+	if ( jq.query.get('r') ) {
+		if ( jq('textarea#whats-new').length ) {
+			jq.scrollTo( jq('textarea#whats-new'), 500, { offset:-125, easing:'easeout' } );
+			jq('textarea#whats-new').focus();
+		}
+	}
+
+	/* @mention username help button display */
+	if ( jq( 'span.highlight span' ).length )
+		jq( 'span.highlight span' ).toggle();
+
+	/**** Activity Posting ********************************************************/
+
+	/* New posts */
+	jq("input#aw-whats-new-submit").click( function() {
+		var button = jq(this);
+		var form = button.parent().parent().parent().parent();
+
+		form.children().each( function() {
+			if ( jq.nodeName(this, "textarea") || jq.nodeName(this, "input") )
+				jq(this).attr( 'disabled', 'disabled' );
+		});
+
+		jq( 'form#' + form.attr('id') + ' span.ajax-loader' ).show();
+
+		/* Remove any errors */
+		jq('div.error').remove();
+		button.attr('disabled','disabled');
+
+		/* Default POST values */
+		var object = '';
+		var item_id = jq("#whats-new-post-in").val();
+		var content = jq("textarea#whats-new").val();
+
+		/* Set object for non-profile posts */
+		if ( item_id > 0 ) {
+			object = jq("#whats-new-post-object").val();
+		}
+
+		jq.post( ajaxurl, {
+			action: 'post_update',
+			'cookie': encodeURIComponent(document.cookie),
+			'_wpnonce_post_update': jq("input#_wpnonce_post_update").val(),
+			'content': content,
+			'object': object,
+			'item_id': item_id
+		},
+		function(response)
+		{
+			jq( 'form#' + form.attr('id') + ' span.ajax-loader' ).hide();
+
+			form.children().each( function() {
+				if ( jq.nodeName(this, "textarea") || jq.nodeName(this, "input") )
+					jq(this).attr( 'disabled', '' );
+			});
+
+			/* Check for errors and append if found. */
+			if ( response[0] + response[1] == '-1' ) {
+				form.prepend( response.substr( 2, response.length ) );
+				jq( 'form#' + form.attr('id') + ' div.error').hide().fadeIn( 200 );
+				button.attr("disabled", '');
+			} else {
+				if ( 0 == jq("ul.activity-list").length ) {
+					jq("div.error").slideUp(100).remove();
+					jq("div#message").slideUp(100).remove();
+					jq("div.activity").append( '<ul id="activity-stream" class="activity-list item-list">' );
+				}
+
+				jq("ul.activity-list").prepend(response);
+				jq("ul.activity-list li:first").addClass('new-update');
+				jq("li.new-update").hide().slideDown( 300 );
+				jq("li.new-update").removeClass( 'new-update' );
+				jq("textarea#whats-new").val('');
+
+				/* Re-enable the submit button after 8 seconds. */
+				setTimeout( function() { button.attr("disabled", ''); }, 8000 );
+			}
+		});
+
+		return false;
+	});
+
+	/* List tabs event delegation */
+	jq('div.activity-type-tabs').click( function(event) {
+		var target = jq(event.target).parent();
+
+		if ( event.target.nodeName == 'STRONG' || event.target.nodeName == 'SPAN' )
+			target = target.parent();
+		else if ( event.target.nodeName != 'A' )
+			return false;
+
+		/* Reset the page */
+		jq.cookie( 'bp-activity-oldestpage', 1, {path: '/'} );
+
+		/* Activity Stream Tabs */
+		var scope = target.attr('id').substr( 9, target.attr('id').length );
+		var filter = jq("#activity-filter-select select").val();
+
+		if ( scope == 'mentions' )
+			jq( 'li#' + target.attr('id') + ' a strong' ).remove();
+
+		bp_activity_request(scope, filter, target);
+
+		return false;
+	});
+
+	/* Activity filter select */
+	jq('#activity-filter-select select').change( function() {
+		var selected_tab = jq( 'div.activity-type-tabs li.selected' );
+
+		if ( !selected_tab.length )
+			var scope = null;
+		else
+			var scope = selected_tab.attr('id').substr( 9, selected_tab.attr('id').length );
+
+		var filter = jq(this).val();
+
+		bp_activity_request(scope, filter);
+
+		return false;
+	});
+
+	/* Stream event delegation */
+	jq('div.activity').click( function(event) {
+		var target = jq(event.target);
+
+		/* Favoriting activity stream items */
+		if ( target.attr('class') == 'fav' || target.attr('class') == 'unfav' ) {
+			var type = target.attr('class')
+			var parent = target.parent().parent().parent();
+			var parent_id = parent.attr('id').substr( 9, parent.attr('id').length );
+
+			target.addClass('loading');
+
+			jq.post( ajaxurl, {
+				action: 'activity_mark_' + type,
+				'cookie': encodeURIComponent(document.cookie),
+				'id': parent_id
+			},
+			function(response) {
+				target.removeClass('loading');
+
+				target.fadeOut( 100, function() {
+					jq(this).html(response);
+					jq(this).fadeIn(100);
+				});
+
+				if ( 'fav' == type ) {
+					if ( !jq('div.item-list-tabs li#activity-favorites').length )
+						jq('div.item-list-tabs ul li#activity-mentions').before( '<li id="activity-favorites"><a href="#">' + BP_DTheme.my_favs + ' (<span>0</span>)</a></li>');
+
+					target.removeClass('fav');
+					target.addClass('unfav');
+
+					jq('div.item-list-tabs ul li#activity-favorites span').html( Number( jq('div.item-list-tabs ul li#activity-favorites span').html() ) + 1 );
+				} else {
+					target.removeClass('unfav');
+					target.addClass('fav');
+
+					jq('div.item-list-tabs ul li#activity-favorites span').html( Number( jq('div.item-list-tabs ul li#activity-favorites span').html() ) - 1 );
+
+					if ( !Number( jq('div.item-list-tabs ul li#activity-favorites span').html() ) ) {
+						if ( jq('div.item-list-tabs ul li#activity-favorites').hasClass('selected') )
+							bp_activity_request( null, null );
+
+						jq('div.item-list-tabs ul li#activity-favorites').remove();
+					}
+				}
+
+				if ( 'activity-favorites' == jq( 'div.item-list-tabs li.selected').attr('id') )
+					target.parent().parent().parent().slideUp(100);
+			});
+
+			return false;
+		}
+
+		/* Delete activity stream items */
+		if ( target.hasClass('delete-activity') ) {
+			var li = target.parents('div.activity ul li');
+			var id = li.attr('id').substr( 9, li.attr('id').length );
+			var link_href = target.attr('href');
+
+			var nonce = link_href.split('_wpnonce=');
+				nonce = nonce[1];
+
+			target.addClass('loading');
+
+			jq.post( ajaxurl, {
+				action: 'delete_activity',
+				'cookie': encodeURIComponent(document.cookie),
+				'id': id,
+				'_wpnonce': nonce
+			},
+			function(response) {
+				target.removeClass('loading');
+
+				if ( response[0] + response[1] == '-1' ) {
+					li.prepend( response.substr( 2, response.length ) );
+					li.children('div#message').hide().fadeIn(200);
+				} else {
+					li.slideUp(200);
+				}
+			});
+
+			return false;
+		}
+
+		/* Load more updates at the end of the page */
+		if ( target.parent().attr('class') == 'load-more' ) {
+			jq("#content li.load-more").addClass('loading');
+
+			if ( null == jq.cookie('bp-activity-oldestpage') )
+				jq.cookie('bp-activity-oldestpage', 1, {path: '/'} );
+
+			var oldest_page = ( jq.cookie('bp-activity-oldestpage') * 1 ) + 1;
+
+			jq.post( ajaxurl, {
+				action: 'activity_get_older_updates',
+				'cookie': encodeURIComponent(document.cookie),
+				'page': oldest_page
+			},
+			function(response)
+			{
+				jq("#content li.load-more").removeClass('loading');
+				jq.cookie( 'bp-activity-oldestpage', oldest_page, {path: '/'} );
+				jq("#content ul.activity-list").append(response.contents);
+
+				target.parent().hide();
+			}, 'json' );
+
+			return false;
+		}
+	});
+
+	/**** Activity Comments *******************************************************/
+
+	/* Hide all activity comment forms */
+	jq('form.ac-form').hide();
+
+	/* Hide excess comments */
+	if ( jq('div.activity-comments').length )
+		bp_dtheme_hide_comments();
+
+	/* Activity list event delegation */
+	jq('div.activity').click( function(event) {
+		var target = jq(event.target);
+
+		/* Comment / comment reply links */
+		if ( target.attr('class') == 'acomment-reply' || target.parent().attr('class') == 'acomment-reply' ) {
+			if ( target.parent().attr('class') == 'acomment-reply' )
+				target = target.parent();
+
+			var id = target.attr('id');
+			ids = id.split('-');
+
+			var a_id = ids[2]
+			var c_id = target.attr('href').substr( 10, target.attr('href').length );
+			var form = jq( '#ac-form-' + a_id );
+
+			var form = jq( '#ac-form-' + ids[2] );
+
+			form.css( 'display', 'none' );
+			form.removeClass('root');
+			jq('.ac-form').hide();
+
+			/* Hide any error messages */
+			form.children('div').each( function() {
+				if ( jq(this).hasClass( 'error' ) )
+					jq(this).hide();
+			});
+
+			if ( ids[1] != 'comment' ) {
+				jq('div.activity-comments li#acomment-' + c_id).append( form );
+			} else {
+				jq('li#activity-' + a_id + ' div.activity-comments').append( form );
+			}
+
+	 		if ( form.parent().attr( 'class' ) == 'activity-comments' )
+				form.addClass('root');
+
+			form.slideDown( 200 );
+			jq.scrollTo( form, 500, { offset:-100, easing:'easeout' } );
+			jq('#ac-form-' + ids[2] + ' textarea').focus();
+
+			return false;
+		}
+
+		/* Activity comment posting */
+		if ( target.attr('name') == 'ac_form_submit' ) {
+			var form = target.parent().parent();
+			var form_parent = form.parent();
+			var form_id = form.attr('id').split('-');
+
+			if ( 'activity-comments' !== form_parent.attr('class') ) {
+				var tmp_id = form_parent.attr('id').split('-');
+				var comment_id = tmp_id[1];
+			} else {
+				var comment_id = form_id[2];
+			}
+
+			/* Hide any error messages */
+			jq( 'form#' + form + ' div.error').hide();
+			form.addClass('loading');
+			target.css('disabled', 'disabled');
+
+			jq.post( ajaxurl, {
+				action: 'new_activity_comment',
+				'cookie': encodeURIComponent(document.cookie),
+				'_wpnonce_new_activity_comment': jq("input#_wpnonce_new_activity_comment").val(),
+				'comment_id': comment_id,
+				'form_id': form_id[2],
+				'content': jq('form#' + form.attr('id') + ' textarea').val()
+			},
+			function(response)
+			{
+				form.removeClass('loading');
+
+				/* Check for errors and append if found. */
+				if ( response[0] + response[1] == '-1' ) {
+					form.append( response.substr( 2, response.length ) ).hide().fadeIn( 200 );
+					target.attr("disabled", '');
+				} else {
+					form.fadeOut( 200,
+						function() {
+							if ( 0 == form.parent().children('ul').length ) {
+								if ( form.parent().attr('class') == 'activity-comments' )
+									form.parent().prepend('<ul></ul>');
+								else
+									form.parent().append('<ul></ul>');
+							}
+
+							form.parent().children('ul').append(response).hide().fadeIn( 200 );
+							form.children('textarea').val('');
+							form.parent().parent().addClass('has-comments');
+						}
+					);
+					jq( 'form#' + form + ' textarea').val('');
+
+					/* Increase the "Reply (X)" button count */
+					jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 );
+
+					/* Re-enable the submit button after 5 seconds. */
+					setTimeout( function() { target.attr("disabled", ''); }, 5000 );
+				}
+			});
+
+			return false;
+		}
+
+		/* Deleting an activity comment */
+		if ( target.hasClass('acomment-delete') ) {
+			var link_href = target.attr('href');
+			var comment_li = target.parent().parent();
+			var form = comment_li.parents('div.activity-comments').children('form');
+
+			var nonce = link_href.split('_wpnonce=');
+				nonce = nonce[1];
+
+			var comment_id = link_href.split('cid=');
+				comment_id = comment_id[1].split('&');
+				comment_id = comment_id[0];
+
+			target.addClass('loading');
+
+			/* Remove any error messages */
+			jq('div.activity-comments ul div.error').remove();
+
+			/* Reset the form position */
+			comment_li.parents('div.activity-comments').append(form);
+
+			jq.post( ajaxurl, {
+				action: 'delete_activity_comment',
+				'cookie': encodeURIComponent(document.cookie),
+				'_wpnonce': nonce,
+				'id': comment_id
+			},
+			function(response)
+			{
+				/* Check for errors and append if found. */
+				if ( response[0] + response[1] == '-1' ) {
+					comment_li.prepend( response.substr( 2, response.length ) ).hide().fadeIn( 200 );
+				} else {
+					var children = jq( 'li#' + comment_li.attr('id') + ' ul' ).children('li');
+					var child_count = 0;
+					jq(children).each( function() {
+						if ( !jq(this).is(':hidden') )
+							child_count++;
+					});
+					comment_li.fadeOut(200);
+
+					/* Decrease the "Reply (X)" button count */
+					var parent_li = comment_li.parents('ul#activity-stream > li');
+					jq('li#' + parent_li.attr('id') + ' a.acomment-reply span').html( jq('li#' + parent_li.attr('id') + ' a.acomment-reply span').html() - ( 1 + child_count ) );
+				}
+			});
+
+			return false;
+		}
+
+		/* Showing hidden comments - pause for half a second */
+		if ( target.parent().hasClass('show-all') ) {
+			target.parent().addClass('loading');
+
+			setTimeout( function() {
+				target.parent().parent().children('li').fadeIn(200, function() {
+					target.parent().remove();
+				});
+			}, 600 );
+
+			return false;
+		}
+	});
+
+	/* Escape Key Press for cancelling comment forms */
+	jq(document).keydown( function(e) {
+		e = e || window.event;
+		if (e.target)
+			element = e.target;
+		else if (e.srcElement)
+			element = e.srcElement;
+
+		if( element.nodeType == 3)
+			element = element.parentNode;
+
+		if( e.ctrlKey == true || e.altKey == true || e.metaKey == true )
+			return;
+
+		var keyCode = (e.keyCode) ? e.keyCode : e.which;
+
+		if ( keyCode == 27 ) {
+			if (element.tagName == 'TEXTAREA') {
+				if ( jq(element).attr('class') == 'ac-input' )
+					jq(element).parent().parent().parent().slideUp( 200 );
+			}
+		}
+	});
+
+	/**** @mention username help tooltip **************************************/
+
+	jq('span.highlight span').click( function() {
+		if ( !jq('div.help').length ) {
+			jq(this).parent().after( '<div id="message" class="info help"><p>' + BP_DTheme.mention_explain + '</p></div>' );
+			jq('div.help').hide().slideDown(200);
+		} else {
+			jq('div.help').hide().remove();
+		}
+	})
+
+	/**** Directory Search ****************************************************/
+
+	/* The search form on all directory pages */
+	jq('div.dir-search').click( function(event) {
+		if ( jq(this).hasClass('no-ajax') )
+			return;
+
+		var target = jq(event.target);
+
+		if ( target.attr('type') == 'submit' ) {
+			var css_id = jq('div.item-list-tabs li.selected').attr('id').split( '-' );
+			var object = css_id[0];
+
+			bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope') , 'div.' + object, target.parent().children('label').children('input').val(), 1, jq.cookie('bp-' + object + '-extras') );
+
+			return false;
+		}
+	});
+
+	/**** Tabs and Filters ****************************************************/
+
+	/* When a navigation tab is clicked - e.g. | All Groups | My Groups | */
+	jq('div.item-list-tabs').click( function(event) {
+		if ( jq(this).hasClass('no-ajax') )
+			return;
+
+		var target = jq(event.target).parent();
+
+		if ( 'LI' == event.target.parentNode.nodeName && !target.hasClass('last') ) {
+			var css_id = target.attr('id').split( '-' );
+			var object = css_id[0];
+
+			if ( 'activity' == object )
+				return false;
+
+			var scope = css_id[1];
+			var filter = jq("#" + object + "-order-select select").val();
+			var search_terms = jq("#" + object + "_search").val();
+
+			bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, jq.cookie('bp-' + object + '-extras') );
+
+			return false;
+		}
+	});
+
+	/* When the filter select box is changed re-query */
+	jq('li.filter select').change( function() {
+		if ( jq('div.item-list-tabs li.selected').length )
+			var el = jq('div.item-list-tabs li.selected');
+		else
+			var el = jq(this);
+
+		var css_id = el.attr('id').split('-');
+		var object = css_id[0];
+		var scope = css_id[1];
+		var filter = jq(this).val();
+		var search_terms = false;
+
+		if ( jq('div.dir-search input').length )
+			search_terms = jq('div.dir-search input').val();
+
+		if ( 'friends' == object )
+			object = 'members';
+
+		bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, jq.cookie('bp-' + object + '-extras') );
+
+		return false;
+	});
+
+	/* All pagination links run through this function */
+	jq('div#content').click( function(event) {
+		var target = jq(event.target);
+
+		if ( target.hasClass('button') )
+			return true;
+
+		if ( target.parent().parent().hasClass('pagination') && !target.parent().parent().hasClass('no-ajax') ) {
+			if ( target.hasClass('dots') || target.hasClass('current') )
+				return false;
+
+			if ( jq('div.item-list-tabs li.selected').length )
+				var el = jq('div.item-list-tabs li.selected');
+			else
+				var el = jq('li.filter select');
+
+			var page_number = 1;
+			var css_id = el.attr('id').split( '-' );
+			var object = css_id[0];
+			var search_terms = false;
+
+			if ( jq('div.dir-search input').length )
+				search_terms = jq('div.dir-search input').val();
+
+			if ( jq(target).hasClass('next') )
+				var page_number = Number( jq('div.pagination span.current').html() ) + 1;
+			else if ( jq(target).hasClass('prev') )
+				var page_number = Number( jq('div.pagination span.current').html() ) - 1;
+			else
+				var page_number = Number( jq(target).html() );
+
+			bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope'), 'div.' + object, search_terms, page_number, jq.cookie('bp-' + object + '-extras') );
+
+			return false;
+		}
+
+	});
+
+	/**** New Forum Directory Post **************************************/
+
+	/* Hit the "New Topic" button on the forums directory page */
+	jq('a#new-topic-button').click( function() {
+		if ( !jq('div#new-topic-post').length )
+			return false;
+
+		if ( jq('div#new-topic-post').is(":visible") )
+			jq('div#new-topic-post').slideUp(200);
+		else
+			jq('div#new-topic-post').slideDown(200);
+
+		return false;
+	});
+
+	/* Cancel the posting of a new forum topic */
+	jq('input#submit_topic_cancel').click( function() {
+		if ( !jq('div#new-topic-post').length )
+			return false;
+
+		jq('div#new-topic-post').slideUp(200);
+		return false;
+	});
+
+	/* Clicking a forum tag */
+	jq('div#forum-directory-tags a').click( function() {
+		bp_filter_request( 'forums', 'tags', jq.cookie('bp-forums-scope'), 'div.forums', jq(this).html().replace( /&nbsp;/g, '-' ), 1, jq.cookie('bp-forums-extras') );
+		return false;
+	});
+
+	/** Invite Friends Interface ****************************************/
+
+	/* Select a user from the list of friends and add them to the invite list */
+	jq("div#invite-list input").click( function() {
+		jq('.ajax-loader').toggle();
+
+		var friend_id = jq(this).val();
+
+		if ( jq(this).attr('checked') == true )
+			var friend_action = 'invite';
+		else
+			var friend_action = 'uninvite';
+
+		jq('div.item-list-tabs li.selected').addClass('loading');
+
+		jq.post( ajaxurl, {
+			action: 'groups_invite_user',
+			'friend_action': friend_action,
+			'cookie': encodeURIComponent(document.cookie),
+			'_wpnonce': jq("input#_wpnonce_invite_uninvite_user").val(),
+			'friend_id': friend_id,
+			'group_id': jq("input#group_id").val()
+		},
+		function(response)
+		{
+			if ( jq("#message") )
+				jq("#message").hide();
+
+			jq('.ajax-loader').toggle();
+
+			if ( friend_action == 'invite' ) {
+				jq('#friend-list').append(response);
+			} else if ( friend_action == 'uninvite' ) {
+				jq('#friend-list li#uid-' + friend_id).remove();
+			}
+
+			jq('div.item-list-tabs li.selected').removeClass('loading');
+		});
+	});
+
+	/* Remove a user from the list of users to invite to a group */
+	jq("#friend-list li a.remove").live('click', function() {
+		jq('.ajax-loader').toggle();
+
+		var friend_id = jq(this).attr('id');
+		friend_id = friend_id.split('-');
+		friend_id = friend_id[1];
+
+		jq.post( ajaxurl, {
+			action: 'groups_invite_user',
+			'friend_action': 'uninvite',
+			'cookie': encodeURIComponent(document.cookie),
+			'_wpnonce': jq("input#_wpnonce_invite_uninvite_user").val(),
+			'friend_id': friend_id,
+			'group_id': jq("input#group_id").val()
+		},
+		function(response)
+		{
+			jq('.ajax-loader').toggle();
+			jq('#friend-list li#uid-' + friend_id).remove();
+			jq('#invite-list input#f-' + friend_id).attr('checked', false);
+		});
+
+		return false;
+	});
+
+	/** Friendship Requests **************************************/
+
+	/* Accept and Reject friendship request buttons */
+	jq("ul#friend-list a.accept, ul#friend-list a.reject").click( function() {
+		var button = jq(this);
+		var li = jq(this).parents('ul#friend-list li');
+		var action_div = jq(this).parents('li div.action');
+
+		var id = li.attr('id').substr( 11, li.attr('id').length );
+		var link_href = button.attr('href');
+
+		var nonce = link_href.split('_wpnonce=');
+			nonce = nonce[1];
+
+		if ( jq(this).hasClass('accepted') || jq(this).hasClass('rejected') )
+			return false;
+
+		if ( jq(this).hasClass('accept') ) {
+			var action = 'accept_friendship';
+			action_div.children('a.reject').css( 'visibility', 'hidden' );
+		} else {
+			var action = 'reject_friendship';
+			action_div.children('a.accept').css( 'visibility', 'hidden' );
+		}
+
+		button.addClass('loading');
+
+		jq.post( ajaxurl, {
+			action: action,
+			'cookie': encodeURIComponent(document.cookie),
+			'id': id,
+			'_wpnonce': nonce
+		},
+		function(response) {
+			button.removeClass('loading');
+
+			if ( response[0] + response[1] == '-1' ) {
+				li.prepend( response.substr( 2, response.length ) );
+				li.children('div#message').hide().fadeIn(200);
+			} else {
+				button.fadeOut( 100, function() {
+					if ( jq(this).hasClass('accept') ) {
+						jq(this).html( BP_DTheme.accepted ).fadeIn(50);
+						jq(this).addClass('accepted');
+					} else {
+						jq(this).html( BP_DTheme.rejected ).fadeIn(50);
+						jq(this).addClass('rejected');
+					}
+				});
+			}
+		});
+
+		return false;
+	});
+
+	/* Add / Remove friendship buttons */
+	jq("div.friendship-button a").live('click', function() {
+		jq(this).parent().addClass('loading');
+		var fid = jq(this).attr('id');
+		fid = fid.split('-');
+		fid = fid[1];
+
+		var nonce = jq(this).attr('href');
+		nonce = nonce.split('?_wpnonce=');
+		nonce = nonce[1].split('&');
+		nonce = nonce[0];
+
+		var thelink = jq(this);
+
+		jq.post( ajaxurl, {
+			action: 'addremove_friend',
+			'cookie': encodeURIComponent(document.cookie),
+			'fid': fid,
+			'_wpnonce': nonce
+		},
+		function(response)
+		{
+			var action = thelink.attr('rel');
+			var parentdiv = thelink.parent();
+
+			if ( action == 'add' ) {
+				jq(parentdiv).fadeOut(200,
+					function() {
+						parentdiv.removeClass('add_friend');
+						parentdiv.removeClass('loading');
+						parentdiv.addClass('pending');
+						parentdiv.fadeIn(200).html(response);
+					}
+				);
+
+			} else if ( action == 'remove' ) {
+				jq(parentdiv).fadeOut(200,
+					function() {
+						parentdiv.removeClass('remove_friend');
+						parentdiv.removeClass('loading');
+						parentdiv.addClass('add');
+						parentdiv.fadeIn(200).html(response);
+					}
+				);
+			}
+		});
+		return false;
+	} );
+
+	/** Group Join / Leave Buttons **************************************/
+
+	jq("div.group-button a").live('click', function() {
+		var gid = jq(this).parent().attr('id');
+		gid = gid.split('-');
+		gid = gid[1];
+
+		var nonce = jq(this).attr('href');
+		nonce = nonce.split('?_wpnonce=');
+		nonce = nonce[1].split('&');
+		nonce = nonce[0];
+
+		var thelink = jq(this);
+
+		jq.post( ajaxurl, {
+			action: 'joinleave_group',
+			'cookie': encodeURIComponent(document.cookie),
+			'gid': gid,
+			'_wpnonce': nonce
+		},
+		function(response)
+		{
+			var parentdiv = thelink.parent();
+
+			if ( !jq('body.directory').length )
+				location.href = location.href;
+			else {
+				jq(parentdiv).fadeOut(200,
+					function() {
+						parentdiv.fadeIn(200).html(response);
+					}
+				);
+			}
+		});
+		return false;
+	} );
+
+	/** Button disabling ************************************************/
+
+	jq('div.pending').click(function() {
+		return false;
+	});
+
+	/** Alternate Highlighting ******************************************/
+
+	jq('body#bp-default table.zebra tbody tr').mouseover( function() {
+		jq(this).addClass('over');
+	}).mouseout( function() {
+		jq(this).removeClass('over');
+	});
+		
+	jq('body#bp-default table.zebra tbody tr:odd').addClass('alt');
+
+	jq('div.message-box').each( function(i) {
+		if ( i % 2 == 1 )
+			jq(this).addClass('alt');
+	});
+
+	/** Private Messaging ******************************************/
+
+	/* AJAX send reply functionality */
+	jq("input#send_reply_button").click(
+		function() {
+			jq('form#send-reply span.ajax-loader').toggle();
+
+			jq.post( ajaxurl, {
+				action: 'messages_send_reply',
+				'cookie': encodeURIComponent(document.cookie),
+				'_wpnonce': jq("input#send_message_nonce").val(),
+
+				'content': jq("#message_content").val(),
+				'send_to': jq("input#send_to").val(),
+				'subject': jq("input#subject").val(),
+				'thread_id': jq("input#thread_id").val()
+			},
+			function(response)
+			{
+				if ( response[0] + response[1] == "-1" ) {
+					jq('form#send-reply').prepend( response.substr( 2, response.length ) );
+				} else {
+					jq('form#send-reply div#message').remove();
+					jq("#message_content").val('');
+					jq('form#send-reply').before( response );
+
+					jq("div.new-message").hide().slideDown( 200, function() {
+						jq('div.new-message').removeClass('new-message');
+					});
+
+					jq('div.message-box').each( function(i) {
+						jq(this).removeClass('alt');
+						if ( i % 2 != 1 )
+							jq(this).addClass('alt');
+					});
+				}
+				jq('form#send-reply span.ajax-loader').toggle();
+			});
+
+			return false;
+		}
+	);
+
+	/* Marking private messages as read and unread */
+	jq("a#mark_as_read, a#mark_as_unread").click(function() {
+		var checkboxes_tosend = '';
+		var checkboxes = jq("#message-threads tr td input[type='checkbox']");
+
+		if ( 'mark_as_unread' == jq(this).attr('id') ) {
+			var currentClass = 'read'
+			var newClass = 'unread'
+			var unreadCount = 1;
+			var inboxCount = 0;
+			var unreadCountDisplay = 'inline';
+			var action = 'messages_markunread';
+		} else {
+			var currentClass = 'unread'
+			var newClass = 'read'
+			var unreadCount = 0;
+			var inboxCount = 1;
+			var unreadCountDisplay = 'none';
+			var action = 'messages_markread';
+		}
+
+		checkboxes.each( function(i) {
+			if(jq(this).is(':checked')) {
+				if ( jq('tr#m-' + jq(this).attr('value')).hasClass(currentClass) ) {
+					checkboxes_tosend += jq(this).attr('value');
+					jq('tr#m-' + jq(this).attr('value')).removeClass(currentClass);
+					jq('tr#m-' + jq(this).attr('value')).addClass(newClass);
+					var thread_count = jq('tr#m-' + jq(this).attr('value') + ' td span.unread-count').html();
+
+					jq('tr#m-' + jq(this).attr('value') + ' td span.unread-count').html(unreadCount);
+					jq('tr#m-' + jq(this).attr('value') + ' td span.unread-count').css('display', unreadCountDisplay);
+					var inboxcount = jq('a#user-messages strong').html().substr( 1, jq('a#user-messages strong').html().length );
+					var inboxcount = inboxcount.substr( 0, inboxcount.length - 1 );
+
+					if ( !inboxcount.length )
+						inboxcount = 0;
+					if ( parseInt(inboxcount) == inboxCount ) {
+						jq('a#user-messages strong').css('display', unreadCountDisplay);
+						jq('a#user-messages strong').html( '(' + unreadCount + ')' );
+					} else {
+						if ( 'read' == currentClass )
+							jq('a#user-messages strong').html('(' + ( parseInt(inboxcount) + 1 ) + ')');
+						else
+							jq('a#user-messages strong').html('(' + ( parseInt(inboxcount) - thread_count ) + ')');
+					}
+
+					if ( i != checkboxes.length - 1 ) {
+						checkboxes_tosend += ','
+					}
+				}
+			}
+		});
+		jq.post( ajaxurl, {
+			action: action,
+			'thread_ids': checkboxes_tosend
+		});
+		return false;
+	});
+
+	/* Selecting unread and read messages in inbox */
+	jq("select#message-type-select").change(
+		function() {
+			var selection = jq("select#message-type-select").val();
+			var checkboxes = jq("td input[type='checkbox']");
+			checkboxes.each( function(i) {
+				checkboxes[i].checked = "";
+			});
+
+			switch(selection) {
+				case 'unread':
+					var checkboxes = jq("tr.unread td input[type='checkbox']");
+				break;
+				case 'read':
+					var checkboxes = jq("tr.read td input[type='checkbox']");
+				break;
+			}
+			if ( selection != '' ) {
+				checkboxes.each( function(i) {
+					checkboxes[i].checked = "checked";
+				});
+			} else {
+				checkboxes.each( function(i) {
+					checkboxes[i].checked = "";
+				});
+			}
+		}
+	);
+
+	/* Bulk delete messages */
+	jq("a#delete_inbox_messages, a#delete_sentbox_messages").click( function() {
+		checkboxes_tosend = '';
+		checkboxes = jq("#message-threads tr td input[type='checkbox']");
+
+		jq('div#message').remove();
+		jq(this).addClass('loading');
+
+		jq(checkboxes).each( function(i) {
+			if( jq(this).is(':checked') )
+				checkboxes_tosend += jq(this).attr('value') + ',';
+		});
+
+		if ( '' == checkboxes_tosend ) {
+			jq(this).removeClass('loading');
+			return false;
+		}
+
+		jq.post( ajaxurl, {
+			action: 'messages_delete',
+			'thread_ids': checkboxes_tosend
+		}, function(response) {
+			if ( response[0] + response[1] == "-1" ) {
+				jq('#message-threads').prepend( response.substr( 2, response.length ) );
+			} else {
+				jq('#message-threads').before( '<div id="message" class="updated"><p>' + response + '</p></div>' );
+
+				jq(checkboxes).each( function(i) {
+					if( jq(this).is(':checked') )
+						jq(this).parent().parent().fadeOut(150);
+				});
+			}
+
+			jq('div#message').hide().slideDown(150);
+			jq("a#delete_inbox_messages, a#delete_sentbox_messages").removeClass('loading');
+		});
+		return false;
+	});
+
+	/* Close site wide notices in the sidebar */
+	jq("a#close-notice").click( function() {
+		jq(this).addClass('loading');
+		jq('div#sidebar div.error').remove();
+
+		jq.post( ajaxurl, {
+			action: 'messages_close_notice',
+			'notice_id': jq('.notice').attr('rel').substr( 2, jq('.notice').attr('rel').length )
+		},
+		function(response) {
+			jq("a#close-notice").removeClass('loading');
+
+			if ( response[0] + response[1] == '-1' ) {
+				jq('.notice').prepend( response.substr( 2, response.length ) );
+				jq( 'div#sidebar div.error').hide().fadeIn( 200 );
+			} else {
+				jq('.notice').slideUp( 100 );
+			}
+		});
+		return false;
+	});
+
+	/* Admin Bar Javascript */
+	jq("#wp-admin-bar ul.main-nav li").mouseover( function() {
+		jq(this).addClass('sfhover');
+	});
+
+	jq("#wp-admin-bar ul.main-nav li").mouseout( function() {
+		jq(this).removeClass('sfhover');
+	});
+
+	/* Clear BP cookies on logout */
+	jq('a.logout').click( function() {
+		jq.cookie('bp-activity-scope', null, {path: '/'});
+		jq.cookie('bp-activity-filter', null, {path: '/'});
+		jq.cookie('bp-activity-oldestpage', null, {path: '/'});
+
+		var objects = [ 'members', 'groups', 'blogs', 'forums' ];
+		jq(objects).each( function(i) {
+			jq.cookie('bp-' + objects[i] + '-scope', null, {path: '/'} );
+			jq.cookie('bp-' + objects[i] + '-filter', null, {path: '/'} );
+			jq.cookie('bp-' + objects[i] + '-extras', null, {path: '/'} );
+		});
+	});
+});
+
+/* Setup activity scope and filter based on the current cookie settings. */
+function bp_init_activity() {
+	/* Reset the page */
+	jq.cookie( 'bp-activity-oldestpage', 1, {path: '/'} );
+
+	if ( null != jq.cookie('bp-activity-filter') && jq('#activity-filter-select').length )
+		jq('#activity-filter-select select option[value=' + jq.cookie('bp-activity-filter') + ']').attr( 'selected', 'selected' );
+
+	/* Activity Tab Set */
+	if ( null != jq.cookie('bp-activity-scope') && jq('div.activity-type-tabs').length ) {
+		jq('div.activity-type-tabs li').each( function() {
+			jq(this).removeClass('selected');
+		});
+		jq('li#activity-' + jq.cookie('bp-activity-scope') + ', div.item-list-tabs li.current').addClass('selected');
+	}
+}
+
+/* Setup object scope and filter based on the current cookie settings for the object. */
+function bp_init_objects(objects) {
+	jq(objects).each( function(i) {
+		if ( null != jq.cookie('bp-' + objects[i] + '-filter') && jq('li#' + objects[i] + '-order-select select').length )
+			jq('li#' + objects[i] + '-order-select select option[value=' + jq.cookie('bp-' + objects[i] + '-filter') + ']').attr( 'selected', 'selected' );
+
+		if ( null != jq.cookie('bp-' + objects[i] + '-scope') && jq('div.' + objects[i]).length ) {
+			jq('div.item-list-tabs li').each( function() {
+				jq(this).removeClass('selected');
+			});
+			jq('div.item-list-tabs li#' + objects[i] + '-' + jq.cookie('bp-' + objects[i] + '-scope') + ', div.item-list-tabs#object-nav li.current').addClass('selected');
+		}
+	});
+}
+
+/* Filter the current content list (groups/members/blogs/topics) */
+function bp_filter_request( object, filter, scope, target, search_terms, page, extras ) {
+	if ( 'activity' == object )
+		return false;
+
+	if ( jq.query.get('s') && !search_terms )
+		search_terms = jq.query.get('s');
+
+	if ( null == scope )
+		scope = 'all';
+
+	/* Save the settings we want to remain persistent to a cookie */
+	jq.cookie( 'bp-' + object + '-scope', scope, {path: '/'} );
+	jq.cookie( 'bp-' + object + '-filter', filter, {path: '/'} );
+	jq.cookie( 'bp-' + object + '-extras', extras, {path: '/'} );
+
+	/* Set the correct selected nav and filter */
+	jq('div.item-list-tabs li').each( function() {
+		jq(this).removeClass('selected');
+	});
+	jq('div.item-list-tabs li#' + object + '-' + scope + ', div.item-list-tabs#object-nav li.current').addClass('selected');
+	jq('div.item-list-tabs li.selected').addClass('loading');
+	jq('div.item-list-tabs select option[value=' + filter + ']').attr( 'selected', 'selected' );
+
+	if ( 'friends' == object )
+		object = 'members';
+
+	if ( bp_ajax_request )
+		bp_ajax_request.abort();
+
+	bp_ajax_request = jq.post( ajaxurl, {
+		action: object + '_filter',
+		'cookie': encodeURIComponent(document.cookie),
+		'object': object,
+		'filter': filter,
+		'search_terms': search_terms,
+		'scope': scope,
+		'page': page,
+		'extras': extras
+	},
+	function(response)
+	{
+		jq(target).fadeOut( 100, function() {
+			jq(this).html(response);
+			jq(this).fadeIn(100);
+	 	});
+		jq('div.item-list-tabs li.selected').removeClass('loading');
+	});
+}
+
+/* Activity Loop Requesting */
+function bp_activity_request(scope, filter) {
+	/* Save the type and filter to a session cookie */
+	jq.cookie( 'bp-activity-scope', scope, {path: '/'} );
+	jq.cookie( 'bp-activity-filter', filter, {path: '/'} );
+	jq.cookie( 'bp-activity-oldestpage', 1 );
+
+	/* Remove selected and loading classes from tabs */
+	jq('div.item-list-tabs li').each( function() {
+		jq(this).removeClass('selected loading');
+	});
+	/* Set the correct selected nav and filter */
+	jq('li#activity-' + scope + ', div.item-list-tabs li.current').addClass('selected');
+	jq('div#object-nav.item-list-tabs li.selected, div.activity-type-tabs li.selected').addClass('loading');
+	jq('#activity-filter-select select option[value=' + filter + ']').attr( 'selected', 'selected' );
+
+	/* Reload the activity stream based on the selection */
+	jq('.widget_bp_activity_widget h2 span.ajax-loader').show();
+
+	if ( bp_ajax_request )
+		bp_ajax_request.abort();
+
+	bp_ajax_request = jq.post( ajaxurl, {
+		action: 'activity_widget_filter',
+		'cookie': encodeURIComponent(document.cookie),
+		'_wpnonce_activity_filter': jq("input#_wpnonce_activity_filter").val(),
+		'scope': scope,
+		'filter': filter
+	},
+	function(response)
+	{
+		jq('.widget_bp_activity_widget h2 span.ajax-loader').hide();
+
+		jq('div.activity').fadeOut( 100, function() {
+			jq(this).html(response.contents);
+			jq(this).fadeIn(100);
+
+			/* Selectively hide comments */
+			bp_dtheme_hide_comments();
+		});
+
+		/* Update the feed link */
+		if ( null != response.feed_url )
+			jq('.directory div#subnav li.feed a, .home-page div#subnav li.feed a').attr('href', response.feed_url);
+
+		jq('div.item-list-tabs li.selected').removeClass('loading');
+
+	}, 'json' );
+}
+
+/* Hide long lists of activity comments, only show the latest five root comments. */
+function bp_dtheme_hide_comments() {
+	var comments_divs = jq('div.activity-comments');
+
+	if ( !comments_divs.length )
+		return false;
+
+	comments_divs.each( function() {
+		if ( jq(this).children('ul').children('li').length < 5 ) return;
+
+		var comments_div = jq(this);
+		var parent_li = comments_div.parents('ul#activity-stream > li');
+		var comment_lis = jq(this).children('ul').children('li');
+		var comment_count = ' ';
+
+		if ( jq('li#' + parent_li.attr('id') + ' a.acomment-reply span').length )
+			var comment_count = jq('li#' + parent_li.attr('id') + ' a.acomment-reply span').html();
+
+		comment_lis.each( function(i) {
+			/* Show the latest 5 root comments */
+			if ( i < comment_lis.length - 5 ) {
+				jq(this).addClass('hidden');
+				jq(this).toggle();
+
+				if ( !i )
+					jq(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + BP_DTheme.show_all_comments + '">' + BP_DTheme.show_all + ' ' + comment_count + ' ' + BP_DTheme.comments + '</a></li>' );
+			}
+		});
+
+	});
+}
+
+/* Helper Functions */
+
+function checkAll() {
+	var checkboxes = document.getElementsByTagName("input");
+	for(var i=0; i<checkboxes.length; i++) {
+		if(checkboxes[i].type == "checkbox") {
+			if($("check_all").checked == "") {
+				checkboxes[i].checked = "";
+			}
+			else {
+				checkboxes[i].checked = "checked";
+			}
+		}
+	}
+}
+
+function clear(container) {
+	if( !document.getElementById(container) ) return;
+
+	var container = document.getElementById(container);
+
+	if ( radioButtons = container.getElementsByTagName('INPUT') ) {
+		for(var i=0; i<radioButtons.length; i++) {
+			radioButtons[i].checked = '';
+		}
+	}
+
+	if ( options = container.getElementsByTagName('OPTION') ) {
+		for(var i=0; i<options.length; i++) {
+			options[i].selected = false;
+		}
+	}
+
+	return;
+}
+
+/* ScrollTo plugin - just inline and minified */
+;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
+jQuery.extend({easing:{easein:function(x,t,b,c,d){return c*(t/=d)*t+b},easeinout:function(x,t,b,c,d){if(t<d/2)return 2*c*t*t/(d*d)+b;var ts=t-d/2;return-2*c*ts*ts/(d*d)+2*c*ts/d+c/2+b},easeout:function(x,t,b,c,d){return-c*t*t/(d*d)+2*c*t/d+b},expoin:function(x,t,b,c,d){var flip=1;if(c<0){flip*=-1;c*=-1}return flip*(Math.exp(Math.log(c)/d*t))+b},expoout:function(x,t,b,c,d){var flip=1;if(c<0){flip*=-1;c*=-1}return flip*(-Math.exp(-Math.log(c)/d*(t-d))+c+1)+b},expoinout:function(x,t,b,c,d){var flip=1;if(c<0){flip*=-1;c*=-1}if(t<d/2)return flip*(Math.exp(Math.log(c/2)/(d/2)*t))+b;return flip*(-Math.exp(-2*Math.log(c/2)/d*(t-d))+c+1)+b},bouncein:function(x,t,b,c,d){return c-jQuery.easing['bounceout'](x,d-t,0,c,d)+b},bounceout:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b}},bounceinout:function(x,t,b,c,d){if(t<d/2)return jQuery.easing['bouncein'](x,t*2,0,c,d)*.5+b;return jQuery.easing['bounceout'](x,t*2-d,0,c,d)*.5+c*.5+b},elasin:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},elasout:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},elasinout:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b},backin:function(x,t,b,c,d){var s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b},backout:function(x,t,b,c,d){var s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},backinout:function(x,t,b,c,d){var s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},linear:function(x,t,b,c,d){return c*t/d+b}}});
+
+/* jQuery Cookie plugin */
+jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires='; expires='+date.toUTCString();}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}};
+
+/* jQuery querystring plugin */
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('M 6(A){4 $11=A.11||\'&\';4 $V=A.V===r?r:j;4 $1p=A.1p===r?\'\':\'[]\';4 $13=A.13===r?r:j;4 $D=$13?A.D===j?"#":"?":"";4 $15=A.15===r?r:j;v.1o=M 6(){4 f=6(o,t){8 o!=1v&&o!==x&&(!!t?o.1t==t:j)};4 14=6(1m){4 m,1l=/\\[([^[]*)\\]/g,T=/^([^[]+)(\\[.*\\])?$/.1r(1m),k=T[1],e=[];19(m=1l.1r(T[2]))e.u(m[1]);8[k,e]};4 w=6(3,e,7){4 o,y=e.1b();b(I 3!=\'X\')3=x;b(y===""){b(!3)3=[];b(f(3,L)){3.u(e.h==0?7:w(x,e.z(0),7))}n b(f(3,1a)){4 i=0;19(3[i++]!=x);3[--i]=e.h==0?7:w(3[i],e.z(0),7)}n{3=[];3.u(e.h==0?7:w(x,e.z(0),7))}}n b(y&&y.T(/^\\s*[0-9]+\\s*$/)){4 H=1c(y,10);b(!3)3=[];3[H]=e.h==0?7:w(3[H],e.z(0),7)}n b(y){4 H=y.B(/^\\s*|\\s*$/g,"");b(!3)3={};b(f(3,L)){4 18={};1w(4 i=0;i<3.h;++i){18[i]=3[i]}3=18}3[H]=e.h==0?7:w(3[H],e.z(0),7)}n{8 7}8 3};4 C=6(a){4 p=d;p.l={};b(a.C){v.J(a.Z(),6(5,c){p.O(5,c)})}n{v.J(1u,6(){4 q=""+d;q=q.B(/^[?#]/,\'\');q=q.B(/[;&]$/,\'\');b($V)q=q.B(/[+]/g,\' \');v.J(q.Y(/[&;]/),6(){4 5=1e(d.Y(\'=\')[0]||"");4 c=1e(d.Y(\'=\')[1]||"");b(!5)8;b($15){b(/^[+-]?[0-9]+\\.[0-9]*$/.1d(c))c=1A(c);n b(/^[+-]?[0-9]+$/.1d(c))c=1c(c,10)}c=(!c&&c!==0)?j:c;b(c!==r&&c!==j&&I c!=\'1g\')c=c;p.O(5,c)})})}8 p};C.1H={C:j,1G:6(5,1f){4 7=d.Z(5);8 f(7,1f)},1h:6(5){b(!f(5))8 d.l;4 K=14(5),k=K[0],e=K[1];4 3=d.l[k];19(3!=x&&e.h!=0){3=3[e.1b()]}8 I 3==\'1g\'?3:3||""},Z:6(5){4 3=d.1h(5);b(f(3,1a))8 v.1E(j,{},3);n b(f(3,L))8 3.z(0);8 3},O:6(5,c){4 7=!f(c)?x:c;4 K=14(5),k=K[0],e=K[1];4 3=d.l[k];d.l[k]=w(3,e.z(0),7);8 d},w:6(5,c){8 d.N().O(5,c)},1s:6(5){8 d.O(5,x).17()},1z:6(5){8 d.N().1s(5)},1j:6(){4 p=d;v.J(p.l,6(5,7){1y p.l[5]});8 p},1F:6(Q){4 D=Q.B(/^.*?[#](.+?)(?:\\?.+)?$/,"$1");4 S=Q.B(/^.*?[?](.+?)(?:#.+)?$/,"$1");8 M C(Q.h==S.h?\'\':S,Q.h==D.h?\'\':D)},1x:6(){8 d.N().1j()},N:6(){8 M C(d)},17:6(){6 F(G){4 R=I G=="X"?f(G,L)?[]:{}:G;b(I G==\'X\'){6 1k(o,5,7){b(f(o,L))o.u(7);n o[5]=7}v.J(G,6(5,7){b(!f(7))8 j;1k(R,5,F(7))})}8 R}d.l=F(d.l);8 d},1B:6(){8 d.N().17()},1D:6(){4 i=0,U=[],W=[],p=d;4 16=6(E){E=E+"";b($V)E=E.B(/ /g,"+");8 1C(E)};4 1n=6(1i,5,7){b(!f(7)||7===r)8;4 o=[16(5)];b(7!==j){o.u("=");o.u(16(7))}1i.u(o.P(""))};4 F=6(R,k){4 12=6(5){8!k||k==""?[5].P(""):[k,"[",5,"]"].P("")};v.J(R,6(5,7){b(I 7==\'X\')F(7,12(5));n 1n(W,12(5),7)})};F(d.l);b(W.h>0)U.u($D);U.u(W.P($11));8 U.P("")}};8 M C(1q.S,1q.D)}}(v.1o||{});',62,106,'|||target|var|key|function|value|return|||if|val|this|tokens|is||length||true|base|keys||else||self||false|||push|jQuery|set|null|token|slice|settings|replace|queryObject|hash|str|build|orig|index|typeof|each|parsed|Array|new|copy|SET|join|url|obj|search|match|queryString|spaces|chunks|object|split|get||separator|newKey|prefix|parse|numbers|encode|COMPACT|temp|while|Object|shift|parseInt|test|decodeURIComponent|type|number|GET|arr|EMPTY|add|rx|path|addFields|query|suffix|location|exec|REMOVE|constructor|arguments|undefined|for|empty|delete|remove|parseFloat|compact|encodeURIComponent|toString|extend|load|has|prototype'.split('|'),0,{}))
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/45pc_black.png b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/45pc_black.png
new file mode 100644
index 0000000000000000000000000000000000000000..38b032aa2ae4561ede965f119714099359fd8a94
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/45pc_black.png differ
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/60pc_black.png b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/60pc_black.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce7c1c7330326b32e8767f4110d6527886a1deea
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/60pc_black.png differ
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/activity_arrow.gif b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/activity_arrow.gif
new file mode 100644
index 0000000000000000000000000000000000000000..6c52bfd534e1091ecf2781f67ab3965c328159f8
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/activity_arrow.gif differ
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/admin-menu-arrow.gif b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/admin-menu-arrow.gif
new file mode 100644
index 0000000000000000000000000000000000000000..ba8eab77cfc9761426220d1caf4510cfea3affca
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/admin-menu-arrow.gif differ
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/ajax-loader.gif b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/ajax-loader.gif
new file mode 100644
index 0000000000000000000000000000000000000000..6e5bace6e654c094f212632e8692e78c55ba3119
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/ajax-loader.gif differ
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/background.gif b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/background.gif
new file mode 100644
index 0000000000000000000000000000000000000000..1af6782476a71177e5713394379b20874261ab09
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/background.gif differ
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/closed.png b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/closed.png
new file mode 100644
index 0000000000000000000000000000000000000000..81f9329e42fc90dc85e1b8226662329d12c4ed2e
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/closed.png differ
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/default_header.jpg b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/default_header.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..64289f5e05663bc55d1de2ed15a59f5f409d7133
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/default_header.jpg differ
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/item_back.gif b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/item_back.gif
new file mode 100644
index 0000000000000000000000000000000000000000..afc88fcb121cdc89b3ea1f88bdbf3a12087709e5
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/item_back.gif differ
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/replyto_arrow.gif b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/replyto_arrow.gif
new file mode 100644
index 0000000000000000000000000000000000000000..168c53af649d83b7bd57ea69c48a7629e96aaaf0
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/replyto_arrow.gif differ
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/rss.png b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/rss.png
new file mode 100755
index 0000000000000000000000000000000000000000..b3c949d2244f2c0c81d65e74719af2a1b56d06a3
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/rss.png differ
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/sidebar_back.gif b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/sidebar_back.gif
new file mode 100644
index 0000000000000000000000000000000000000000..0a0142d101f829fcc906702badbe7a519d806704
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/sidebar_back.gif differ
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/white-grad.png b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/white-grad.png
new file mode 100644
index 0000000000000000000000000000000000000000..3ffe025da8709d0e939adec4b6fe4e9a66e40d0b
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/white-grad.png differ
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/options.php b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/options.php
new file mode 100644
index 0000000000000000000000000000000000000000..819a3cc25b04f74467b05855f9fc53737720c2f8
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/options.php
@@ -0,0 +1,55 @@
+<?php
+
+class BP_Dtheme_Options_Page {
+	function init() {
+		add_action( 'admin_menu', array( 'Bp_Dtheme_Options_Page', 'add_options_page' ) );
+	}
+
+	function add_options_page() {
+  		add_theme_page( __( 'Theme Options', 'buddypress' ), __( 'Theme Options', 'buddypress' ), 8, 'theme-options-page', array( 'BP_Dtheme_Options_Page', 'page' ) );
+	}
+
+	function page() {
+		$bp_dtheme_options = get_option( 'bp_dtheme_options' );
+
+		if ( isset( $_POST[ 'submit' ] ) ) {
+			check_admin_referer( 'bpdtheme_options' );
+
+			$bp_dtheme_options['show_on_frontpage'] = $_POST[ 'show_on_frontpage' ];
+
+			update_option( 'bp_dtheme_options', $bp_dtheme_options );
+		?>
+			<div class="updated"><p><strong><?php _e( 'Settings saved.', 'buddypress' ); ?></strong></p></div>
+		<?php
+    	} ?>
+
+		<div class="wrap">
+		    <?php echo "<h2>" . __( 'Theme Options', 'buddypress' ) . "</h2>"; ?>
+
+			<form name="options" method="post" action="">
+
+				<table class="form-table">
+					<tbody>
+						<tr valign="top">
+							<th scope="row"><?php _e( 'On front page show:', 'buddypress' ) ?></th>
+							<td>
+								<label><input id="bpdtheme_frontpage_blog" type="radio" name="show_on_frontpage" <?php if ( $bp_dtheme_options['show_on_frontpage'] == 'blog' || empty($bp_dtheme_options['show_on_frontpage']) ) echo 'checked="checked"'; ?> value="blog" /> <?php _e( 'Blog Posts', 'buddypress' ) ?></label><br />
+								<?php if ( bp_is_active( 'activity') ) : ?>
+									<label><input id="bpdtheme_frontpage_activity" type="radio" name="show_on_frontpage" <?php if ( $bp_dtheme_options['show_on_frontpage'] == 'activity' ) echo 'checked="checked"'; ?> value="activity" /> <?php _e( 'Activity Stream', 'buddypress' ) ?></label>
+								<?php endif; ?>
+							</td>
+						</tr>
+					</tbody>
+				</table>
+
+				<p class="submit">
+					<input type="submit" name="submit" value="<?php esc_attr_e( 'Update Settings', 'buddypress' ) ?>" />
+				</p>
+
+				<?php wp_nonce_field( 'bpdtheme_options' ) ?>
+
+			</form>
+		</div><?php
+	}
+}
+add_action( 'init', array( 'BP_Dtheme_Options_Page', 'init' ) );
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/activity/activity-loop.php b/wp-content/plugins/buddypress/bp-themes/bp-default/activity/activity-loop.php
new file mode 100644
index 0000000000000000000000000000000000000000..0f85e86f02c30fb47554df08324b2476f8f207c7
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/activity/activity-loop.php
@@ -0,0 +1,45 @@
+<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_activity_loop() */ ?>
+
+<?php do_action( 'bp_before_activity_loop' ) ?>
+
+<?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) ) ) : ?>
+
+	<?php /* Show pagination if JS is not enabled, since the "Load More" link will do nothing */ ?>
+	<noscript>
+		<div class="pagination">
+			<div class="pag-count"><?php bp_activity_pagination_count() ?></div>
+			<div class="pagination-links"><?php bp_activity_pagination_links() ?></div>
+		</div>
+	</noscript>
+
+	<?php if ( empty( $_POST['page'] ) ) : ?>
+		<ul id="activity-stream" class="activity-list item-list">
+	<?php endif; ?>
+
+	<?php while ( bp_activities() ) : bp_the_activity(); ?>
+
+		<?php include( locate_template( array( 'activity/entry.php' ), false ) ) ?>
+
+	<?php endwhile; ?>
+
+	<?php if ( bp_get_activity_count() == bp_get_activity_per_page() ) : ?>
+		<li class="load-more">
+			<a href="#more"><?php _e( 'Load More', 'buddypress' ) ?></a> &nbsp; <span class="ajax-loader"></span>
+		</li>
+	<?php endif; ?>
+
+	<?php if ( empty( $_POST['page'] ) ) : ?>
+		</ul>
+	<?php endif; ?>
+
+<?php else : ?>
+	<div id="message" class="info">
+		<p><?php _e( 'Sorry, there was no activity found. Please try a different filter.', 'buddypress' ) ?></p>
+	</div>
+<?php endif; ?>
+
+<?php do_action( 'bp_after_activity_loop' ) ?>
+
+<form action="" name="activity-loop-form" id="activity-loop-form" method="post">
+	<?php wp_nonce_field( 'activity_filter', '_wpnonce_activity_filter' ) ?>
+</form>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/activity/entry.php b/wp-content/plugins/buddypress/bp-themes/bp-default/activity/entry.php
new file mode 100644
index 0000000000000000000000000000000000000000..80073943c80c26e7040539cd11b9bcabcfcb6dc9
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/activity/entry.php
@@ -0,0 +1,76 @@
+<?php /* This template is used by activity-loop.php and AJAX functions to show each activity */ ?>
+
+<?php do_action( 'bp_before_activity_entry' ) ?>
+
+<li class="<?php bp_activity_css_class() ?>" id="activity-<?php bp_activity_id() ?>">
+	<div class="activity-avatar">
+		<a href="<?php bp_activity_user_link() ?>">
+			<?php bp_activity_avatar( 'type=full&width=100&height=100' ) ?>
+		</a>
+	</div>
+
+	<div class="activity-content">
+
+		<div class="activity-header">
+			<?php bp_activity_action() ?>
+		</div>
+
+		<?php if ( bp_activity_has_content() ) : ?>
+			<div class="activity-inner">
+				<?php bp_activity_content_body() ?>
+			</div>
+		<?php endif; ?>
+
+		<?php do_action( 'bp_activity_entry_content' ) ?>
+
+		<div class="activity-meta">
+			<?php if ( is_user_logged_in() && bp_activity_can_comment() ) : ?>
+				<a href="<?php bp_activity_comment_link() ?>" class="acomment-reply" id="acomment-comment-<?php bp_activity_id() ?>"><?php _e( 'Reply', 'buddypress' ) ?> (<span><?php bp_activity_comment_count() ?></span>)</a>
+			<?php endif; ?>
+
+			<?php if ( is_user_logged_in() ) : ?>
+				<?php if ( !bp_get_activity_is_favorite() ) : ?>
+					<a href="<?php bp_activity_favorite_link() ?>" class="fav" title="<?php _e( 'Mark as Favorite', 'buddypress' ) ?>"><?php _e( 'Favorite', 'buddypress' ) ?></a>
+				<?php else : ?>
+					<a href="<?php bp_activity_unfavorite_link() ?>" class="unfav" title="<?php _e( 'Remove Favorite', 'buddypress' ) ?>"><?php _e( 'Remove Favorite', 'buddypress' ) ?></a>
+				<?php endif; ?>
+			<?php endif;?>
+
+			<?php do_action( 'bp_activity_entry_meta' ) ?>
+		</div>
+	</div>
+
+	<?php if ( 'activity_comment' == bp_get_activity_type() ) : ?>
+		<div class="activity-inreplyto">
+			<strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> - <?php bp_activity_parent_content() ?> &middot;
+			<a href="<?php bp_activity_thread_permalink() ?>" class="view" title="<?php _e( 'View Thread / Permalink', 'buddypress' ) ?>"><?php _e( 'View', 'buddypress' ) ?></a>
+		</div>
+	<?php endif; ?>
+
+	<?php do_action( 'bp_before_activity_entry_comments' ) ?>
+
+	<?php if ( bp_activity_can_comment() ) : ?>
+		<div class="activity-comments">
+			<?php bp_activity_comments() ?>
+
+			<?php if ( is_user_logged_in() ) : ?>
+			<form action="<?php bp_activity_comment_form_action() ?>" method="post" id="ac-form-<?php bp_activity_id() ?>" class="ac-form"<?php bp_activity_comment_form_nojs_display() ?>>
+				<div class="ac-reply-avatar"><?php bp_loggedin_user_avatar( 'width=' . BP_AVATAR_THUMB_WIDTH . '&height=' . BP_AVATAR_THUMB_HEIGHT ) ?></div>
+				<div class="ac-reply-content">
+					<div class="ac-textarea">
+						<textarea id="ac-input-<?php bp_activity_id() ?>" class="ac-input" name="ac_input_<?php bp_activity_id() ?>"></textarea>
+					</div>
+					<input type="submit" name="ac_form_submit" value="<?php _e( 'Post', 'buddypress' ) ?> &rarr;" /> &nbsp; <?php _e( 'or press esc to cancel.', 'buddypress' ) ?>
+					<input type="hidden" name="comment_form_id" value="<?php bp_activity_id() ?>" />
+				</div>
+				<?php wp_nonce_field( 'new_activity_comment', '_wpnonce_new_activity_comment' ) ?>
+			</form>
+			<?php endif; ?>
+		</div>
+	<?php endif; ?>
+
+	<?php do_action( 'bp_after_activity_entry_comments' ) ?>
+</li>
+
+<?php do_action( 'bp_after_activity_entry' ) ?>
+
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/activity/index.php b/wp-content/plugins/buddypress/bp-themes/bp-default/activity/index.php
new file mode 100644
index 0000000000000000000000000000000000000000..2757ae62822897bf1a1f37e76e0440f62c9cb565
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/activity/index.php
@@ -0,0 +1,107 @@
+<?php get_header() ?>
+
+	<div id="content">
+		<div class="padder">
+
+			<?php if ( !is_user_logged_in() ) : ?>
+				<h3><?php _e( 'Site Activity', 'buddypress' ) ?></h3>
+			<?php endif; ?>
+
+			<?php do_action( 'bp_before_directory_activity_content' ) ?>
+
+			<?php if ( is_user_logged_in() ) : ?>
+				<?php locate_template( array( 'activity/post-form.php'), true ) ?>
+			<?php endif; ?>
+
+			<?php do_action( 'template_notices' ) ?>
+
+			<div class="item-list-tabs activity-type-tabs">
+				<ul>
+					<?php do_action( 'bp_before_activity_type_tab_all' ) ?>
+
+					<li class="selected" id="activity-all"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/' ?>" title="<?php _e( 'The public activity for everyone on this site.', 'buddypress' ) ?>"><?php printf( __( 'All Members (%s)', 'buddypress' ), bp_get_total_site_member_count() ) ?></a></li>
+
+					<?php if ( is_user_logged_in() ) : ?>
+
+						<?php do_action( 'bp_before_activity_type_tab_friends' ) ?>
+
+						<?php if ( function_exists( 'bp_get_total_friend_count' ) ) : ?>
+							<?php if ( bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?>
+								<li id="activity-friends"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/' . BP_FRIENDS_SLUG . '/' ?>" title="<?php _e( 'The activity of my friends only.', 'buddypress' ) ?>"><?php printf( __( 'My Friends (%s)', 'buddypress' ), bp_get_total_friend_count( bp_loggedin_user_id() ) ) ?></a></li>
+							<?php endif; ?>
+						<?php endif; ?>
+
+						<?php do_action( 'bp_before_activity_type_tab_groups' ) ?>
+
+						<?php if ( function_exists( 'bp_get_total_group_count_for_user' ) ) : ?>
+							<?php if ( bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) : ?>
+								<li id="activity-groups"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/' . BP_GROUPS_SLUG . '/' ?>" title="<?php _e( 'The activity of groups I am a member of.', 'buddypress' ) ?>"><?php printf( __( 'My Groups (%s)', 'buddypress' ), bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) ?></a></li>
+							<?php endif; ?>
+						<?php endif; ?>
+
+						<?php do_action( 'bp_before_activity_type_tab_favorites' ) ?>
+
+						<?php if ( bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) : ?>
+							<li id="activity-favorites"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/favorites/' ?>" title="<?php _e( "The activity I've marked as a favorite.", 'buddypress' ) ?>"><?php printf( __( 'My Favorites (<span>%s</span>)', 'buddypress' ), bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) ?></a></li>
+						<?php endif; ?>
+
+						<?php do_action( 'bp_before_activity_type_tab_mentions' ) ?>
+
+						<li id="activity-mentions"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/mentions/' ?>" title="<?php _e( 'Activity that I have been mentioned in.', 'buddypress' ) ?>"><?php printf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() ) ?><?php if ( bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) : ?> <strong><?php printf( __( '(%s new)', 'buddypress' ), bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) ?></strong><?php endif; ?></a></li>
+
+					<?php endif; ?>
+
+					<?php do_action( 'bp_activity_type_tabs' ) ?>
+				</ul>
+			</div><!-- .item-list-tabs -->
+
+			<div class="item-list-tabs no-ajax" id="subnav">
+				<ul>
+					<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' ) ?>
+
+					<li id="activity-filter-select" class="last">
+						<select>
+							<option value="-1"><?php _e( 'No Filter', 'buddypress' ) ?></option>
+							<option value="activity_update"><?php _e( 'Show Updates', 'buddypress' ) ?></option>
+
+							<?php if ( bp_is_active( 'blogs' ) ) : ?>
+								<option value="new_blog_post"><?php _e( 'Show Blog Posts', 'buddypress' ) ?></option>
+								<option value="new_blog_comment"><?php _e( 'Show Blog Comments', 'buddypress' ) ?></option>
+							<?php endif; ?>
+
+							<?php if ( bp_is_active( 'forums' ) ) : ?>
+								<option value="new_forum_topic"><?php _e( 'Show New Forum Topics', 'buddypress' ) ?></option>
+								<option value="new_forum_post"><?php _e( 'Show Forum Replies', 'buddypress' ) ?></option>
+							<?php endif; ?>
+
+							<?php if ( bp_is_active( 'groups' ) ) : ?>
+								<option value="created_group"><?php _e( 'Show New Groups', 'buddypress' ) ?></option>
+								<option value="joined_group"><?php _e( 'Show New Group Memberships', 'buddypress' ) ?></option>
+							<?php endif; ?>
+
+							<?php if ( bp_is_active( 'friends' ) ) : ?>
+								<option value="friendship_accepted,friendship_created"><?php _e( 'Show Friendship Connections', 'buddypress' ) ?></option>
+							<?php endif; ?>
+
+							<option value="new_member"><?php _e( 'Show New Members', 'buddypress' ) ?></option>
+
+							<?php do_action( 'bp_activity_filter_options' ) ?>
+						</select>
+					</li>
+				</ul>
+			</div><!-- .item-list-tabs -->
+
+			<div class="activity">
+				<?php locate_template( array( 'activity/activity-loop.php' ), true ) ?>
+			</div><!-- .activity -->
+
+			<?php do_action( 'bp_after_directory_activity_content' ) ?>
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer() ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/activity/post-form.php b/wp-content/plugins/buddypress/bp-themes/bp-default/activity/post-form.php
new file mode 100644
index 0000000000000000000000000000000000000000..823f775546ec1452b57f31b2a9fed25db5a96113
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/activity/post-form.php
@@ -0,0 +1,62 @@
+<form action="<?php bp_activity_post_form_action() ?>" method="post" id="whats-new-form" name="whats-new-form">
+
+	<?php do_action( 'bp_before_activity_post_form' ) ?>
+
+	<?php if ( isset( $_GET['r'] ) ) : ?>
+		<div id="message" class="info">
+			<p><?php printf( __( 'You are mentioning %s in a new update, this user will be sent a notification of your message.', 'buddypress' ), bp_get_mentioned_user_display_name( $_GET['r'] ) ) ?></p>
+		</div>
+	<?php endif; ?>
+
+	<div id="whats-new-avatar">
+		<a href="<?php echo bp_loggedin_user_domain() ?>">
+			<?php bp_loggedin_user_avatar( 'width=' . BP_AVATAR_THUMB_WIDTH . '&height=' . BP_AVATAR_THUMB_HEIGHT ) ?>
+		</a>
+	</div>
+
+	<h5>
+		<?php if ( bp_is_group() ) : ?>
+			<?php printf( __( "What's new in %s, %s?", 'buddypress' ), bp_get_group_name(), bp_get_user_firstname() ) ?>
+		<?php else : ?>
+			<?php printf( __( "What's new %s?", 'buddypress' ), bp_get_user_firstname() ) ?>
+		<?php endif; ?>
+	</h5>
+
+	<div id="whats-new-content">
+		<div id="whats-new-textarea">
+			<textarea name="whats-new" id="whats-new" cols="50" rows="10"><?php if ( isset( $_GET['r'] ) ) : ?>@<?php echo esc_attr( $_GET['r'] ) ?> <?php endif; ?></textarea>
+		</div>
+
+		<div id="whats-new-options">
+			<div id="whats-new-submit">
+				<span class="ajax-loader"></span> &nbsp;
+				<input type="submit" name="aw-whats-new-submit" id="aw-whats-new-submit" value="<?php _e( 'Post Update', 'buddypress' ) ?>" />
+			</div>
+
+			<?php if ( function_exists('bp_has_groups') && !bp_is_my_profile() && !bp_is_group() ) : ?>
+				<div id="whats-new-post-in-box">
+					<?php _e( 'Post in', 'buddypress' ) ?>:
+
+					<select id="whats-new-post-in" name="whats-new-post-in">
+						<option selected="selected" value="0"><?php _e( 'My Profile', 'buddypress' ) ?></option>
+
+						<?php if ( bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100&populate_extras=0' ) ) : while ( bp_groups() ) : bp_the_group(); ?>
+							<option value="<?php bp_group_id() ?>"><?php bp_group_name() ?></option>
+						<?php endwhile; endif; ?>
+					</select>
+				</div>
+				<input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" />
+			<?php elseif ( bp_is_group_home() ) : ?>
+				<input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" />
+				<input type="hidden" id="whats-new-post-in" name="whats-new-post-in" value="<?php bp_group_id() ?>" />
+			<?php endif; ?>
+
+			<?php do_action( 'bp_activity_post_form_options' ) ?>
+
+		</div><!-- #whats-new-options -->
+	</div><!-- #whats-new-content -->
+
+	<?php wp_nonce_field( 'post_update', '_wpnonce_post_update' ); ?>
+	<?php do_action( 'bp_after_activity_post_form' ) ?>
+
+</form><!-- #whats-new-form -->
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/archive.php b/wp-content/plugins/buddypress/bp-themes/bp-default/archive.php
new file mode 100644
index 0000000000000000000000000000000000000000..016e7043dc5a0ac3cae89395a892094ea903b15b
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/archive.php
@@ -0,0 +1,73 @@
+<?php get_header(); ?>
+
+	<div id="content">
+		<div class="padder">
+
+		<?php do_action( 'bp_before_archive' ) ?>
+
+		<div class="page" id="blog-archives">
+
+			<h3 class="pagetitle"><?php printf( __( 'You are browsing the archive for %1$s.', 'buddypress' ), wp_title( false, false ) ); ?></h3>
+
+			<?php if ( have_posts() ) : ?>
+
+				<div class="navigation">
+
+					<div class="alignleft"><?php next_posts_link( __( '&larr; Previous Entries', 'buddypress' ) ) ?></div>
+					<div class="alignright"><?php previous_posts_link( __( 'Next Entries &rarr;', 'buddypress' ) ) ?></div>
+
+				</div>
+
+				<?php while (have_posts()) : the_post(); ?>
+
+					<?php do_action( 'bp_before_blog_post' ) ?>
+
+					<div class="post" id="post-<?php the_ID(); ?>">
+
+						<div class="author-box">
+							<?php echo get_avatar( get_the_author_meta( 'user_email' ), '50' ); ?>
+							<p><?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></p>
+						</div>
+
+						<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() ?> <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' ) ); ?>
+							</div>
+
+							<p class="postmetadata"><span class="tags"><?php the_tags( __( 'Tags: ', 'buddypress' ), ', ', '<br />'); ?></span> <span class="comments"><?php comments_popup_link( __( 'No Comments &#187;', 'buddypress' ), __( '1 Comment &#187;', 'buddypress' ), __( '% Comments &#187;', 'buddypress' ) ); ?></span></p>
+						</div>
+
+					</div>
+
+					<?php do_action( 'bp_after_blog_post' ) ?>
+
+				<?php endwhile; ?>
+
+				<div class="navigation">
+
+					<div class="alignleft"><?php next_posts_link( __( '&larr; Previous Entries', 'buddypress' ) ) ?></div>
+					<div class="alignright"><?php previous_posts_link( __( 'Next Entries &rarr;', 'buddypress' ) ) ?></div>
+
+				</div>
+
+			<?php else : ?>
+
+				<h2 class="center"><?php _e( 'Not Found', 'buddypress' ) ?></h2>
+				<?php locate_template( array( 'searchform.php' ), true ) ?>
+
+			<?php endif; ?>
+
+		</div>
+
+		<?php do_action( 'bp_after_archive' ) ?>
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/attachment.php b/wp-content/plugins/buddypress/bp-themes/bp-default/attachment.php
new file mode 100644
index 0000000000000000000000000000000000000000..f302ece754e04971cdee60ca797b5f565081b75c
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/attachment.php
@@ -0,0 +1,47 @@
+<?php get_header(); ?>
+
+	<div id="content">
+
+		<?php do_action( 'bp_before_attachment' ) ?>
+
+		<div class="page" id="attachments-page">
+
+			<h2 class="pagetitle"><?php _e( 'Blog', 'buddypress' ) ?></h2>
+
+				<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
+
+					<?php do_action( 'bp_before_blog_post' ) ?>
+
+					<?php $attachment_link = get_the_attachment_link($post->ID, true, array(450, 800)); // This also populates the iconsize for the next line ?>
+					<?php $_post = &get_post($post->ID); $classname = ($_post->iconsize[0] <= 128 ? 'small' : '') . 'attachment'; // This lets us style narrow icons specially ?>
+
+					<div class="post" id="post-<?php the_ID(); ?>">
+
+						<h2 class="posttitle"><a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?></a> &rarr; <a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
+
+						<div class="entry">
+							<p class="<?php echo $classname; ?>"><?php echo $attachment_link; ?><br /><?php echo basename($post->guid); ?></p>
+
+							<?php the_content( __('<p class="serif">Read the rest of this entry &rarr;</p>', 'buddypress' ) ); ?>
+
+							<?php wp_link_pages( array( 'before' => __( '<p><strong>Pages:</strong> ', 'buddypress' ), 'after' => '</p>', 'next_or_number' => 'number')); ?>
+						</div>
+
+					</div>
+
+					<?php do_action( 'bp_after_blog_post' ) ?>
+
+				<?php comments_template(); ?>
+
+				<?php endwhile; else: ?>
+
+					<p><?php _e( 'Sorry, no attachments matched your criteria.', 'buddypress' ) ?></p>
+
+				<?php endif; ?>
+		</div>
+
+		<?php do_action( 'bp_after_attachment' ) ?>
+
+	</div>
+
+<?php get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/blogs/blogs-loop.php b/wp-content/plugins/buddypress/bp-themes/bp-default/blogs/blogs-loop.php
new file mode 100644
index 0000000000000000000000000000000000000000..60112df9545a0ce95a02effb65374e51ee9eaa82
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/blogs/blogs-loop.php
@@ -0,0 +1,76 @@
+<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_object_filter() */ ?>
+
+<?php do_action( 'bp_before_blogs_loop' ) ?>
+
+<?php if ( bp_has_blogs( bp_ajax_querystring( 'blogs' ) ) ) : ?>
+
+	<div id="pag-top" class="pagination">
+
+		<div class="pag-count" id="blog-dir-count-top">
+			<?php bp_blogs_pagination_count() ?>
+		</div>
+
+		<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(); ?>
+
+		<li>
+			<div class="item-avatar">
+				<a href="<?php bp_blog_permalink() ?>"><?php bp_blog_avatar('type=thumb') ?></a>
+			</div>
+
+			<div class="item">
+				<div class="item-title"><a href="<?php bp_blog_permalink() ?>"><?php bp_blog_name() ?></a></div>
+				<div class="item-meta"><span class="activity"><?php bp_blog_last_active() ?></span></div>
+
+				<?php do_action( 'bp_directory_blogs_item' ) ?>
+			</div>
+
+			<div class="action">
+
+				<?php do_action( 'bp_directory_blogs_actions' ) ?>
+
+				<div class="meta">
+					<?php bp_blog_latest_post() ?>
+				</div>
+
+			</div>
+
+			<div class="clear"></div>
+		</li>
+
+	<?php endwhile; ?>
+	</ul>
+
+	<?php do_action( 'bp_after_directory_blogs_list' ) ?>
+
+	<?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">
+		<p><?php _e( 'Sorry, there were no blogs found.', 'buddypress' ) ?></p>
+	</div>
+
+<?php endif; ?>
+
+<?php do_action( 'bp_after_blogs_loop' ) ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/blogs/create.php b/wp-content/plugins/buddypress/bp-themes/bp-default/blogs/create.php
new file mode 100644
index 0000000000000000000000000000000000000000..9006c17f92863efb2e84078c40b3531b99754d0a
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/blogs/create.php
@@ -0,0 +1,36 @@
+<?php get_header() ?>
+
+	<?php do_action( 'bp_before_directory_blogs_content' ) ?>
+
+	<div id="content">
+		<div class="padder">
+
+		<?php do_action( 'template_notices' ) ?>
+
+		<h3><?php _e( 'Create a Blog', 'buddypress' ) ?> &nbsp;<a class="button" href="<?php echo bp_get_root_domain() . '/' . BP_BLOGS_SLUG . '/' ?>"><?php _e( 'Blogs Directory', 'buddypress' ) ?></a></h3>
+
+		<?php do_action( 'bp_before_create_blog_content' ) ?>
+
+		<?php if ( bp_blog_signup_enabled() ) : ?>
+
+			<?php bp_show_blog_signup_form() ?>
+
+		<?php else: ?>
+
+			<div id="message" class="info">
+				<p><?php _e( 'Blog registration is currently disabled', 'buddypress' ); ?></p>
+			</div>
+
+		<?php endif; ?>
+
+		<?php do_action( 'bp_after_create_blog_content' ) ?>
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+	<?php do_action( 'bp_after_directory_blogs_content' ) ?>
+
+<?php get_footer() ?>
+
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/blogs/index.php b/wp-content/plugins/buddypress/bp-themes/bp-default/blogs/index.php
new file mode 100644
index 0000000000000000000000000000000000000000..a20708742517fd5dced15fc001f17eedb936e914
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/blogs/index.php
@@ -0,0 +1,55 @@
+<?php get_header() ?>
+
+	<div id="content">
+		<div class="padder">
+
+		<form action="" method="post" id="blogs-directory-form" class="dir-form">
+
+			<h3><?php _e( 'Blogs Directory', 'buddypress' ) ?><?php if ( is_user_logged_in() && bp_blog_signup_enabled() ) : ?> &nbsp;<a class="button" href="<?php echo bp_get_root_domain() . '/' . BP_BLOGS_SLUG . '/create/' ?>"><?php _e( 'Create a Blog', 'buddypress' ) ?></a><?php endif; ?></h3>
+
+			<?php do_action( 'bp_before_directory_blogs_content' ) ?>
+
+			<div id="blog-dir-search" class="dir-search">
+				<?php bp_directory_blogs_search_form() ?>
+			</div><!-- #blog-dir-search -->
+
+			<div class="item-list-tabs">
+				<ul>
+					<li class="selected" id="blogs-all"><a href="<?php bp_root_domain() ?>"><?php printf( __( 'All Blogs (%s)', 'buddypress' ), bp_get_total_blog_count() ) ?></a></li>
+
+					<?php if ( is_user_logged_in() && bp_get_total_blog_count_for_user( bp_loggedin_user_id() ) ) : ?>
+						<li id="blogs-personal"><a href="<?php echo bp_loggedin_user_domain() . BP_BLOGS_SLUG . '/my-blogs/' ?>"><?php printf( __( 'My Blogs (%s)', 'buddypress' ), bp_get_total_blog_count_for_user( bp_loggedin_user_id() ) ) ?></a></li>
+					<?php endif; ?>
+
+					<?php do_action( 'bp_blogs_directory_blog_types' ) ?>
+
+					<li id="blogs-order-select" class="last filter">
+
+						<?php _e( 'Order By:', 'buddypress' ) ?>
+						<select>
+							<option value="active"><?php _e( 'Last Active', 'buddypress' ) ?></option>
+							<option value="newest"><?php _e( 'Newest', 'buddypress' ) ?></option>
+							<option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ) ?></option>
+
+							<?php do_action( 'bp_blogs_directory_order_options' ) ?>
+						</select>
+					</li>
+				</ul>
+			</div><!-- .item-list-tabs -->
+
+			<div id="blogs-dir-list" class="blogs dir-list">
+				<?php locate_template( array( 'blogs/blogs-loop.php' ), true ) ?>
+			</div><!-- #blogs-dir-list -->
+
+			<?php do_action( 'bp_after_directory_blogs_content' ) ?>
+
+			<?php wp_nonce_field( 'directory_blogs', '_wpnonce-blogs-filter' ) ?>
+
+		</form><!-- #blogs-directory-form -->
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer() ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/comments.php b/wp-content/plugins/buddypress/bp-themes/bp-default/comments.php
new file mode 100644
index 0000000000000000000000000000000000000000..62dec24b69aadd132af6e29432872eacaf2ae887
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/comments.php
@@ -0,0 +1,183 @@
+	<?php
+		if ( post_password_required() ) :
+			echo '<h3 class="comments-header">' . __('Password Protected', 'buddypress') . '</h3>';
+			echo '<p class="alert password-protected">' . __('Enter the password to view comments.', 'buddypress') . '</p>';
+			return;
+		endif;
+
+		if ( is_page() && !have_comments() && !comments_open() && !pings_open() )
+			return;
+	?>
+
+	<?php if ( have_comments() ) : ?>
+
+		<div id="comments">
+
+			<?php
+				// Only include comments
+				$numTrackBacks = 0; $numComments = 0;
+				foreach ( (array)$comments as $comment )
+					if ( 'comment' != get_comment_type() )
+						$numTrackBacks++; 
+					else
+						$numComments++;
+			?>
+
+			<h3 id="comments">
+				<?php
+					printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', $numComments, 'buddypress' ),
+					number_format_i18n( $numComments ), '<em>' . get_the_title() . '</em>' );
+				?>
+			</h3>
+
+			<?php do_action( 'bp_before_blog_comment_list' ) ?>
+
+			<ol class="commentlist">
+				<?php wp_list_comments( array( 'callback' => 'bp_dtheme_blog_comments' ) ); ?>
+			</ol><!-- .comment-list -->
+
+			<?php do_action( 'bp_after_blog_comment_list' ) ?>
+
+			<?php if ( get_option( 'page_comments' ) ) : ?>
+
+				<div class="comment-navigation paged-navigation">
+
+					<?php paginate_comments_links(); ?>
+
+				</div>
+
+			<?php endif; ?>
+
+		</div><!-- #comments -->
+
+	<?php else : ?>
+
+		<?php if ( pings_open() && !comments_open() && is_single() ) : ?>
+
+			<p class="comments-closed pings-open">
+				<?php printf( __('Comments are closed, but <a href="%1$s" title="Trackback URL for this post">trackbacks</a> and pingbacks are open.', 'buddypress'), trackback_url( '0' ) ); ?>
+			</p>
+
+		<?php elseif ( !comments_open() && is_single() ) : ?>
+
+			<p class="comments-closed">
+				<?php _e('Comments are closed.', 'buddypress'); ?>
+			</p>
+
+		<?php endif; ?>
+
+	<?php endif; ?>
+
+		<?php if ( comments_open() ) : ?>
+
+		<div id="respond">
+
+			<div class="comment-avatar-box">
+				<div class="avb">
+					<?php if ( bp_loggedin_user_id() ) : ?>
+						<a href="<?php echo bp_loggedin_user_domain() ?>">
+							<?php echo get_avatar( bp_loggedin_user_id(), 50 ); ?>
+						</a>
+					<?php else : ?>
+						<?php echo get_avatar( 0, 50 ); ?>
+					<?php endif; ?>
+				</div>
+			</div>
+
+			<div class="comment-content">
+
+				<h3 id="reply" class="comments-header">
+					<?php comment_form_title( __( 'Leave a Reply', 'buddypress' ), __( 'Leave a Reply to %s', 'buddypress' ), true ); ?>
+				</h3>
+
+				<p id="cancel-comment-reply">
+					<?php cancel_comment_reply_link( __( 'Click here to cancel reply.', 'buddypress' ) ); ?>
+				</p>
+
+				<?php if ( get_option( 'comment_registration' ) && !$user_ID ) : ?>
+
+					<p class="alert">
+						<?php printf( __('You must be <a href="%1$s" title="Log in">logged in</a> to post a comment.', 'buddypress'), wp_login_url( get_permalink() ) ); ?>
+					</p>
+
+				<?php else : ?>
+
+					<?php do_action( 'bp_before_blog_comment_form' ) ?>
+
+					<form action="<?php echo site_url( 'wp-comments-post.php' ) ?>" method="post" id="commentform" class="standard-form">
+
+						<?php if ( $user_ID ) : ?>
+
+							<p class="log-in-out">
+								<?php printf( __('Logged in as <a href="%1$s" title="%2$s">%2$s</a>.', 'buddypress'), bp_loggedin_user_domain(), $user_identity ); ?> <a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="<?php _e('Log out of this account', 'buddypress'); ?>"><?php _e('Log out &rarr;', 'buddypress'); ?></a>
+							</p>
+
+						<?php else : ?>
+
+							<?php $req = get_option( 'require_name_email' ); ?>
+
+							<p class="form-author">
+								<label for="author"><?php _e('Name', 'buddypress'); ?> <?php if ( $req ) : ?><span class="required"><?php _e('*', 'buddypress'); ?></span><?php endif; ?></label>
+								<input type="text" class="text-input" name="author" id="author" value="<?php echo $comment_author; ?>" size="40" tabindex="1" />
+							</p>
+
+							<p class="form-email">
+								<label for="email"><?php _e('Email', 'buddypress'); ?>  <?php if ( $req ) : ?><span class="required"><?php _e('*', 'buddypress'); ?></span><?php endif; ?></label>
+								<input type="text" class="text-input" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="40" tabindex="2" />
+							</p>
+
+							<p class="form-url">
+								<label for="url"><?php _e('Website', 'buddypress'); ?></label>
+								<input type="text" class="text-input" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="40" tabindex="3" />
+							</p>
+
+						<?php endif; ?>
+
+						<p class="form-textarea">
+							<label for="comment"><?php _e('Comment', 'buddypress'); ?></label>
+							<textarea name="comment" id="comment" cols="60" rows="10" tabindex="4"></textarea>
+						</p>
+
+						<?php do_action( 'bp_blog_comment_form' ) ?>
+
+						<p class="form-submit">
+							<input class="submit-comment button" name="submit" type="submit" id="submit" tabindex="5" value="<?php _e('Submit', 'buddypress'); ?>" />
+							<?php comment_id_fields(); ?>
+						</p>
+
+						<div class="comment-action">
+							<?php do_action( 'comment_form', $post->ID ); ?>
+						</div>
+
+					</form>
+
+					<?php do_action( 'bp_after_blog_comment_form' ) ?>
+
+				<?php endif; ?>
+
+			</div><!-- .comment-content -->
+		</div><!-- #respond -->
+
+		<?php endif; ?>
+
+		<?php if ( $numTrackBacks ) : ?>
+			<div id="trackbacks">
+
+				<span class="title"><?php the_title() ?></span>
+
+				<?php if ( 1 == $numTrackBacks ) : ?>
+					<h3><?php printf( __( '%d Trackback', 'buddypress' ), $numTrackBacks ) ?></h3>
+				<?php else : ?>
+					<h3><?php printf( __( '%d Trackbacks', 'buddypress' ), $numTrackBacks ) ?></h3>
+				<?php endif; ?>
+
+				<ul id="trackbacklist">
+					<?php foreach ( (array)$comments as $comment ) : ?>
+
+						<?php if ( get_comment_type() != 'comment' ) : ?>
+							<li><h5><?php comment_author_link() ?></h5><em>on <?php comment_date() ?></em></li>
+	  					<?php endif; ?>
+					<?php endforeach; ?>
+				</ul>
+			</div>
+		<?php endif; ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/footer.php b/wp-content/plugins/buddypress/bp-themes/bp-default/footer.php
new file mode 100644
index 0000000000000000000000000000000000000000..2bfb40041426ff227a8daf94d541e8aeb2c47f67
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/footer.php
@@ -0,0 +1,18 @@
+		</div> <!-- #container -->
+
+		<?php do_action( 'bp_after_container' ) ?>
+		<?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' ), get_bloginfo( 'name' ) ); ?></p>
+
+			<?php do_action( 'bp_footer' ) ?>
+		</div><!-- #footer -->
+
+		<?php do_action( 'bp_after_footer' ) ?>
+
+		<?php wp_footer(); ?>
+
+	</body>
+
+</html>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/forums/forums-loop.php b/wp-content/plugins/buddypress/bp-themes/bp-default/forums/forums-loop.php
new file mode 100644
index 0000000000000000000000000000000000000000..157141e45250a9374c1216e7617ed813d58a06fc
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/forums/forums-loop.php
@@ -0,0 +1,100 @@
+<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_object_filter() */ ?>
+
+<?php do_action( 'bp_before_forums_loop' ) ?>
+
+<?php if ( bp_has_forum_topics( bp_ajax_querystring( 'forums' ) ) ) : ?>
+
+	<div id="pag-top" class="pagination">
+
+		<div class="pag-count" id="topic-count-top">
+			<?php bp_forum_pagination_count() ?>
+		</div>
+
+		<div class="pagination-links" id="topic-pag-top">
+			<?php bp_forum_pagination() ?>
+		</div>
+
+	</div>
+
+	<?php do_action( 'bp_before_directory_forums_list' ) ?>
+
+	<table class="forum zebra">
+		<thead>
+			<tr>
+				<th id="th-title"><?php _e( 'Topic Title', 'buddypress' ) ?></th>
+				<th id="th-poster"><?php _e( 'Latest Poster', 'buddypress' ) ?></th>
+
+				<?php if ( !bp_is_group_forum() ) : ?>
+					<th id="th-group"><?php _e( 'Posted In Group', 'buddypress' ) ?></th>
+				<?php endif; ?>
+
+				<th id="th-postcount"><?php _e( 'Posts', 'buddypress' ) ?></th>
+				<th id="th-freshness"><?php _e( 'Freshness', 'buddypress' ) ?></th>
+
+				<?php do_action( 'bp_directory_forums_extra_cell_head' ) ?>
+
+			</tr>
+		</thead>
+
+		<tbody>
+
+			<?php while ( bp_forum_topics() ) : bp_the_forum_topic(); ?>
+
+			<tr class="<?php bp_the_topic_css_class() ?>">
+				<td class="td-title">
+					<a class="topic-title" href="<?php bp_the_topic_permalink() ?>" title="<?php bp_the_topic_title() ?> - <?php _e( 'Permalink', 'buddypress' ) ?>">
+						<?php bp_the_topic_title() ?>
+					</a>
+				</td>
+				<td class="td-poster">
+					<a href="<?php bp_the_topic_permalink() ?>"><?php bp_the_topic_last_poster_avatar( 'type=thumb&width=20&height=20' ) ?></a>
+					<div class="poster-name"><?php bp_the_topic_last_poster_name() ?></div>
+				</td>
+
+				<?php if ( !bp_is_group_forum() ) : ?>
+					<td class="td-group">
+						<a href="<?php bp_the_topic_object_permalink() ?>"><?php bp_the_topic_object_avatar( 'type=thumb&width=20&height=20' ) ?></a>
+						<div class="object-name"><a href="<?php bp_the_topic_object_permalink() ?>" title="<?php bp_the_topic_object_name() ?>"><?php bp_the_topic_object_name() ?></a></div>
+					</td>
+				<?php endif; ?>
+
+				<td class="td-postcount">
+					<?php bp_the_topic_total_posts() ?>
+				</td>
+				<td class="td-freshness">
+					<?php bp_the_topic_time_since_last_post() ?>
+				</td>
+
+				<?php do_action( 'bp_directory_forums_extra_cell' ) ?>
+			</tr>
+
+			<?php do_action( 'bp_directory_forums_extra_row' ) ?>
+
+			<?php endwhile; ?>
+
+		</tbody>
+	</table>
+
+	<?php do_action( 'bp_after_directory_forums_list' ) ?>
+
+	<div id="pag-bottom" class="pagination">
+
+		<div class="pag-count" id="topic-count-bottom">
+			<?php bp_forum_pagination_count() ?>
+		</div>
+
+		<div class="pagination-links" id="topic-pag-bottom">
+			<?php bp_forum_pagination() ?>
+		</div>
+
+	</div>
+
+<?php else: ?>
+
+	<div id="message" class="info">
+		<p><?php _e( 'Sorry, there were no forum topics found.', 'buddypress' ) ?></p>
+	</div>
+
+<?php endif;?>
+
+<?php do_action( 'bp_after_forums_loop' ) ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/forums/index.php b/wp-content/plugins/buddypress/bp-themes/bp-default/forums/index.php
new file mode 100644
index 0000000000000000000000000000000000000000..d7604c18f7f27c64b51d65876adc835841e878d3
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/forums/index.php
@@ -0,0 +1,120 @@
+<?php get_header() ?>
+
+	<div id="content">
+		<div class="padder">
+
+		<form action="" method="post" id="forums-search-form" class="dir-form">
+
+			<h3><?php _e( 'Group Forums Directory', 'buddypress' ) ?><?php if ( is_user_logged_in() ) : ?> &nbsp;<a class="button" href="#new-topic" id="new-topic-button"><?php _e( 'New Topic', 'buddypress' ) ?></a><?php endif; ?></h3>
+
+			<?php do_action( 'bp_before_directory_forums_content' ) ?>
+
+			<div id="forums-dir-search" class="dir-search">
+				<?php bp_directory_forums_search_form() ?>
+			</div>
+		</form>
+
+		<div id="new-topic-post">
+			<?php if ( is_user_logged_in() ) : ?>
+
+				<?php if ( bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100' ) ) : ?>
+
+					<form action="" method="post" id="forum-topic-form" class="standard-form">
+
+						<?php do_action( 'groups_forum_new_topic_before' ) ?>
+
+						<a name="post-new"></a>
+						<h5><?php _e( 'Post a New Topic:', 'buddypress' ) ?></h5>
+
+						<label><?php _e( 'Title:', 'buddypress' ) ?></label>
+						<input type="text" name="topic_title" id="topic_title" value="" />
+
+						<label><?php _e( 'Content:', 'buddypress' ) ?></label>
+						<textarea name="topic_text" id="topic_text"></textarea>
+
+						<label><?php _e( 'Tags (comma separated):', 'buddypress' ) ?></label>
+						<input type="text" name="topic_tags" id="topic_tags" value="" />
+
+						<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 ( bp_group_is_forum_enabled() && 'public' == bp_get_group_status() ) : ?>
+
+									<option value="<?php bp_group_id() ?>"><?php bp_group_name() ?></option>
+
+								<?php endif; ?>
+
+							<?php endwhile; ?>
+
+						</select><!-- #topic_group_id -->
+
+						<?php do_action( 'groups_forum_new_topic_after' ) ?>
+
+						<div class="submit">
+							<input type="submit" name="submit_topic" id="submit" value="<?php _e( 'Post Topic', 'buddypress' ) ?>" />
+							<input type="button" name="submit_topic_cancel" id="submit_topic_cancel" value="<?php _e( 'Cancel', 'buddypress' ) ?>" />
+						</div>
+
+						<?php wp_nonce_field( 'bp_forums_new_topic' ) ?>
+
+					</form><!-- #forum-topic-form -->
+
+				<?php else : ?>
+
+					<div id="message" class="info">
+						<p><?php printf( __( "You are not a member of any groups so you don't have any group forums you can post in. To start posting, first find a group that matches the topic subject you'd like to start. If this group does not exist, why not <a href='%s'>create a new group</a>? Once you have joined or created the group you can post your topic in that group's forum.", 'buddypress' ), site_url( BP_GROUPS_SLUG . '/create/' ) ) ?></p>
+					</div>
+
+				<?php endif; ?>
+
+			<?php endif; ?>
+		</div><!-- #new-topic-post -->
+
+		<form action="" method="post" id="forums-directory-form" class="dir-form">
+
+			<div class="item-list-tabs">
+				<ul>
+					<li class="selected" id="forums-all"><a href="<?php bp_root_domain() ?>"><?php printf( __( 'All Topics (%s)', 'buddypress' ), bp_get_forum_topic_count() ) ?></a></li>
+
+					<?php if ( is_user_logged_in() && bp_get_forum_topic_count_for_user( bp_loggedin_user_id() ) ) : ?>
+						<li id="forums-personal"><a href="<?php echo bp_loggedin_user_domain() . BP_GROUPS_SLUG . '/' ?>"><?php printf( __( 'My Topics (%s)', 'buddypress' ), bp_get_forum_topic_count_for_user( bp_loggedin_user_id() ) ) ?></a></li>
+					<?php endif; ?>
+
+					<?php do_action( 'bp_forums_directory_group_types' ) ?>
+
+					<li id="forums-order-select" class="last filter">
+
+						<?php _e( 'Order By:', 'buddypress' ) ?>
+						<select>
+							<option value="active"><?php _e( 'Last Active', 'buddypress' ) ?></option>
+							<option value="popular"><?php _e( 'Most Posts', 'buddypress' ) ?></option>
+							<option value="unreplied"><?php _e( 'Unreplied', 'buddypress' ) ?></option>
+
+							<?php do_action( 'bp_forums_directory_order_options' ) ?>
+						</select>
+					</li>
+				</ul>
+			</div>
+
+			<div id="forums-dir-list" class="forums dir-list">
+				<?php locate_template( array( 'forums/forums-loop.php' ), true ) ?>
+			</div>
+
+			<?php do_action( 'bp_directory_forums_content' ) ?>
+
+			<?php wp_nonce_field( 'directory_forums', '_wpnonce-forums-filter' ) ?>
+
+			<?php do_action( 'bp_after_directory_forums_content' ) ?>
+
+		</form>
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer() ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/functions.php b/wp-content/plugins/buddypress/bp-themes/bp-default/functions.php
new file mode 100644
index 0000000000000000000000000000000000000000..2a8235d1a6fa2b8e49f555f2c0da908b21ab4e45
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/functions.php
@@ -0,0 +1,359 @@
+<?php
+
+// Stop the theme from killing WordPress if BuddyPress is not enabled.
+if ( !class_exists( 'BP_Core_User' ) )
+	return false;
+
+// Register the widget columns
+register_sidebars( 1,
+	array(
+		'name'          => 'Sidebar',
+		'before_widget' => '<div id="%1$s" class="widget %2$s">',
+		'after_widget'  => '</div>',
+		'before_title'  => '<h3 class="widgettitle">',
+		'after_title'   => '</h3>'
+	)
+);
+
+// Load the AJAX functions for the theme
+require_once( TEMPLATEPATH . '/_inc/ajax.php' );
+
+// Load the javascript for the theme
+wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) );
+
+// 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
+ *
+ * @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; ?>
+
+	<?php if ( 'pingback' == $comment->comment_type ) return false; ?>
+
+	<li id="comment-<?php comment_ID(); ?>">
+		<div class="comment-avatar-box">
+			<div class="avb">
+				<a href="<?php echo get_comment_author_url() ?>" rel="nofollow">
+					<?php if ( $comment->user_id ) : ?>
+						<?php echo bp_core_fetch_avatar( array( 'item_id' => $comment->user_id, 'width' => 50, 'height' => 50, 'email' => $comment->comment_author_email ) ); ?>
+					<?php else : ?>
+						<?php echo get_avatar( $comment, 50 ) ?>
+					<?php endif; ?>
+				</a>
+			</div>
+		</div>
+
+		<div class="comment-content">
+
+			<div class="comment-meta">
+				<a href="<?php echo get_comment_author_url() ?>" rel="nofollow"><?php echo get_comment_author(); ?></a> <?php _e( 'said:', 'buddypress' ) ?>
+				<em><?php _e( 'On', 'buddypress' ) ?> <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date() ?></a></em>
+			</div>
+
+			<?php if ( $comment->comment_approved == '0' ) : ?>
+			 	<em class="moderate"><?php _e('Your comment is awaiting moderation.'); ?></em><br />
+			<?php endif; ?>
+
+			<?php comment_text() ?>
+
+			<div class="comment-options">
+				<?php echo comment_reply_link( array('depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ?>
+				<?php edit_comment_link( __( 'Edit' ),'','' ); ?>
+			</div>
+
+		</div>
+<?php
+}
+
+/**
+ * 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 ( !bp_is_active( 'activity' ) )
+		return $page_html;
+
+	if ( 'page_on_front' != substr( $page_html, 14, 13 ) )
+		return $page_html;
+
+	$selected = false;
+	$page_html = str_replace( '</select>', '', $page_html );
+
+	if ( bp_dtheme_page_on_front() == 'activity' )
+		$selected = ' selected="selected"';
+
+	$page_html .= '<option class="level-0" value="activity"' . $selected . '>' . __( 'Activity Stream', 'buddypress' ) . '</option></select>';
+	return $page_html;
+}
+add_filter( 'wp_dropdown_pages', 'bp_dtheme_wp_pages_filter' );
+
+/**
+ * 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_super_admin() )
+		return false;
+
+	if ( 'activity' == $_POST['page_on_front'] )
+		return 'activity';
+	else
+		return $oldvalue;
+}
+add_action( 'pre_update_option_page_on_front', 'bp_dtheme_page_on_front_update', 10, 2 );
+
+/**
+ * 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;
+
+	if ( empty( $wp_query->post->ID ) )
+		return locate_template( array( 'activity/index.php' ), false );
+	else
+		return $template;
+}
+add_filter( 'page_template', 'bp_dtheme_page_on_front_template' );
+
+/**
+ * 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;
+
+	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.
+ *
+ * @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;
+
+	if ( !empty($wp_query->query_vars['page_id']) && 'activity' == $wp_query->query_vars['page_id'] )
+		$wp_query->query_vars['page_id'] = '"activity"';
+}
+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/)
+	define( 'HEADER_TEXTCOLOR', 'FFFFFF' );
+	define( 'HEADER_IMAGE', '%s/_inc/images/default_header.jpg' ); // %s is theme dir uri
+	define( 'HEADER_IMAGE_WIDTH', 1250 );
+	define( 'HEADER_IMAGE_HEIGHT', 125 );
+
+	function bp_dtheme_header_style() { ?>
+		<style type="text/css">
+			#header { background-image: url(<?php header_image() ?>); }
+			<?php if ( 'blank' == get_header_textcolor() ) { ?>
+			#header h1, #header #desc { display: none; }
+			<?php } else { ?>
+			#header h1 a, #desc { color:#<?php header_textcolor() ?>; }
+			<?php } ?>
+		</style>
+	<?php
+	}
+
+	function bp_dtheme_admin_header_style() { ?>
+		<style type="text/css">
+			#headimg {
+				position: relative;
+				color: #fff;
+				background: url(<?php header_image() ?>);
+				-moz-border-radius-bottomleft: 6px;
+				-webkit-border-bottom-left-radius: 6px;
+				-moz-border-radius-bottomright: 6px;
+				-webkit-border-bottom-right-radius: 6px;
+				margin-bottom: 20px;
+				height: 100px;
+				padding-top: 25px;
+			}
+
+			#headimg h1{
+				position: absolute;
+				bottom: 15px;
+				left: 15px;
+				width: 44%;
+				margin: 0;
+				font-family: Arial, Tahoma, sans-serif;
+			}
+			#headimg h1 a{
+				color:#<?php header_textcolor() ?>;
+				text-decoration: none;
+				border-bottom: none;
+			}
+			#headimg #desc{
+				color:#<?php header_textcolor() ?>;
+				font-size:1em;
+				margin-top:-0.5em;
+			}
+
+			#desc {
+				display: none;
+			}
+
+			<?php if ( 'blank' == get_header_textcolor() ) { ?>
+			#headimg h1, #headimg #desc {
+				display: none;
+			}
+			#headimg h1 a, #headimg #desc {
+				color:#<?php echo HEADER_TEXTCOLOR ?>;
+			}
+			<?php } ?>
+		</style>
+	<?php
+	}
+	add_custom_image_header( 'bp_dtheme_header_style', 'bp_dtheme_admin_header_style' );
+}
+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)
+ *
+ * @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>
+	</div>
+
+	<style type="text/css">#message2, #message0 { display: none; }</style>
+	<?php
+}
+if ( is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" )
+	add_action( 'admin_notices', 'bp_dtheme_show_notice' );
+
+
+// Member Buttons
+if ( bp_is_active( 'friends' ) )
+	add_action( 'bp_member_header_actions',    'bp_add_friend_button' );
+
+if ( bp_is_active( 'activity' ) )
+	add_action( 'bp_member_header_actions',    'bp_send_public_message_button' );
+
+if ( bp_is_active( 'messages' ) )
+	add_action( 'bp_member_header_actions',    'bp_send_private_message_button' );
+
+// Group Buttons
+if ( bp_is_active( 'groups' ) ) {
+	add_action( 'bp_group_header_actions',     'bp_group_join_button' );
+	add_action( 'bp_group_header_actions',     'bp_group_new_topic_button' );
+	add_action( 'bp_directory_groups_actions', 'bp_group_join_button' );
+}
+
+// Blog Buttons
+if ( bp_is_active( 'blogs' ) )
+	add_action( 'bp_directory_blogs_actions',  'bp_blogs_visit_blog_button' );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/groups/create.php b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/create.php
new file mode 100644
index 0000000000000000000000000000000000000000..b795a942e8e3f8530765446494c9ca49c7cf0b8a
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/create.php
@@ -0,0 +1,262 @@
+<?php get_header() ?>
+
+	<div id="content">
+		<div class="padder">
+
+		<form action="<?php bp_group_creation_form_action() ?>" method="post" id="create-group-form" class="standard-form" enctype="multipart/form-data">
+			<h3><?php _e( 'Create a Group', 'buddypress' ) ?> &nbsp;<a class="button" href="<?php echo bp_get_root_domain() . '/' . BP_GROUPS_SLUG . '/' ?>"><?php _e( 'Groups Directory', 'buddypress' ) ?></a></h3>
+
+			<?php do_action( 'bp_before_create_group' ) ?>
+
+			<div class="item-list-tabs no-ajax" id="group-create-tabs">
+				<ul>
+					<?php bp_group_creation_tabs(); ?>
+				</ul>
+			</div>
+
+			<?php do_action( 'template_notices' ) ?>
+
+			<div class="item-body" id="group-create-body">
+
+				<?php /* Group creation step 1: Basic group details */ ?>
+				<?php if ( bp_is_group_creation_step( 'group-details' ) ) : ?>
+
+					<?php do_action( 'bp_before_group_details_creation_step' ); ?>
+
+					<label for="group-name"><?php _e('* Group Name', 'buddypress') ?> <?php _e( '(required)', 'buddypress' )?></label>
+					<input type="text" name="group-name" id="group-name" value="<?php bp_new_group_name() ?>" />
+
+					<label for="group-desc"><?php _e('* Group Description', 'buddypress') ?> <?php _e( '(required)', 'buddypress' )?></label>
+					<textarea name="group-desc" id="group-desc"><?php bp_new_group_description() ?></textarea>
+
+					<?php do_action( 'bp_after_group_details_creation_step' ); /* Deprecated -> */ do_action( 'groups_custom_group_fields_editable' ); ?>
+
+					<?php wp_nonce_field( 'groups_create_save_group-details' ) ?>
+
+				<?php endif; ?>
+
+				<?php /* Group creation step 2: Group settings */ ?>
+				<?php if ( bp_is_group_creation_step( 'group-settings' ) ) : ?>
+
+					<?php do_action( 'bp_before_group_settings_creation_step' ); ?>
+
+					<?php if ( function_exists('bp_wire_install') ) : ?>
+					<div class="checkbox">
+						<label><input type="checkbox" name="group-show-wire" id="group-show-wire" value="1"<?php if ( bp_get_new_group_enable_wire() ) { ?> checked="checked"<?php } ?> /> <?php _e('Enable comment wire', 'buddypress') ?></label>
+					</div>
+					<?php endif; ?>
+
+					<?php if ( function_exists('bp_forums_is_installed_correctly') ) : ?>
+						<?php if ( bp_forums_is_installed_correctly() ) : ?>
+							<div class="checkbox">
+								<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_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>
+							<?php endif; ?>
+						<?php endif; ?>
+					<?php endif; ?>
+
+					<hr />
+
+					<h4><?php _e( 'Privacy Options', 'buddypress' ); ?></h4>
+
+					<div class="radio">
+						<label><input type="radio" name="group-status" value="public"<?php if ( 'public' == bp_get_new_group_status() || !bp_get_new_group_status() ) { ?> checked="checked"<?php } ?> />
+							<strong><?php _e( 'This is a public group', 'buddypress' ) ?></strong>
+							<ul>
+								<li><?php _e( 'Any site member can join this group.', 'buddypress' ) ?></li>
+								<li><?php _e( 'This group will be listed in the groups directory and in search results.', 'buddypress' ) ?></li>
+								<li><?php _e( 'Group content and activity will be visible to any site member.', 'buddypress' ) ?></li>
+							</ul>
+						</label>
+
+						<label><input type="radio" name="group-status" value="private"<?php if ( 'private' == bp_get_new_group_status() ) { ?> checked="checked"<?php } ?> />
+							<strong><?php _e( 'This is a private group', 'buddypress' ) ?></strong>
+							<ul>
+								<li><?php _e( 'Only users who request membership and are accepted can join the group.', 'buddypress' ) ?></li>
+								<li><?php _e( 'This group will be listed in the groups directory and in search results.', 'buddypress' ) ?></li>
+								<li><?php _e( 'Group content and activity will only be visible to members of the group.', 'buddypress' ) ?></li>
+							</ul>
+						</label>
+
+						<label><input type="radio" name="group-status" value="hidden"<?php if ( 'hidden' == bp_get_new_group_status() ) { ?> checked="checked"<?php } ?> />
+							<strong><?php _e('This is a hidden group', 'buddypress') ?></strong>
+							<ul>
+								<li><?php _e( 'Only users who are invited can join the group.', 'buddypress' ) ?></li>
+								<li><?php _e( 'This group will not be listed in the groups directory or search results.', 'buddypress' ) ?></li>
+								<li><?php _e( 'Group content and activity will only be visible to members of the group.', 'buddypress' ) ?></li>
+							</ul>
+						</label>
+					</div>
+
+					<?php do_action( 'bp_after_group_settings_creation_step' ); ?>
+
+					<?php wp_nonce_field( 'groups_create_save_group-settings' ) ?>
+
+				<?php endif; ?>
+
+				<?php /* Group creation step 3: Avatar Uploads */ ?>
+				<?php if ( bp_is_group_creation_step( 'group-avatar' ) ) : ?>
+
+					<?php do_action( 'bp_before_group_avatar_creation_step' ); ?>
+
+					<?php if ( !bp_get_avatar_admin_step() ) : ?>
+
+						<div class="left-menu">
+							<?php bp_new_group_avatar() ?>
+						</div><!-- .left-menu -->
+
+						<div class="main-column">
+							<p><?php _e("Upload an image to use as an avatar for this group. The image will be shown on the main group page, and in search results.", 'buddypress') ?></p>
+
+							<p>
+								<input type="file" name="file" id="file" />
+								<input type="submit" name="upload" id="upload" value="<?php _e( 'Upload Image', 'buddypress' ) ?>" />
+								<input type="hidden" name="action" id="action" value="bp_avatar_upload" />
+							</p>
+
+							<p><?php _e( 'To skip the avatar upload process, hit the "Next Step" button.', 'buddypress' ) ?></p>
+						</div><!-- .main-column -->
+
+					<?php endif; ?>
+
+					<?php if ( 'crop-image' == bp_get_avatar_admin_step() ) : ?>
+
+						<h3><?php _e( 'Crop Group Avatar', 'buddypress' ) ?></h3>
+
+						<img src="<?php bp_avatar_to_crop() ?>" id="avatar-to-crop" class="avatar" alt="<?php _e( 'Avatar to crop', 'buddypress' ) ?>" />
+
+						<div id="avatar-crop-pane">
+							<img src="<?php bp_avatar_to_crop() ?>" id="avatar-crop-preview" class="avatar" alt="<?php _e( 'Avatar preview', 'buddypress' ) ?>" />
+						</div>
+
+						<input type="submit" name="avatar-crop-submit" id="avatar-crop-submit" value="<?php _e( 'Crop Image', 'buddypress' ) ?>" />
+
+						<input type="hidden" name="image_src" id="image_src" value="<?php bp_avatar_to_crop_src() ?>" />
+						<input type="hidden" name="upload" id="upload" />
+						<input type="hidden" id="x" name="x" />
+						<input type="hidden" id="y" name="y" />
+						<input type="hidden" id="w" name="w" />
+						<input type="hidden" id="h" name="h" />
+
+					<?php endif; ?>
+
+					<?php do_action( 'bp_after_group_avatar_creation_step' ); ?>
+
+					<?php wp_nonce_field( 'groups_create_save_group-avatar' ) ?>
+
+				<?php endif; ?>
+
+				<?php /* Group creation step 4: Invite friends to group */ ?>
+				<?php if ( bp_is_group_creation_step( 'group-invites' ) ) : ?>
+
+					<?php do_action( 'bp_before_group_invites_creation_step' ); ?>
+
+					<?php if ( function_exists( 'bp_get_total_friend_count' ) && bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?>
+						<div class="left-menu">
+
+							<div id="invite-list">
+								<ul>
+									<?php bp_new_group_invite_friend_list() ?>
+								</ul>
+
+								<?php wp_nonce_field( 'groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user' ) ?>
+							</div>
+
+						</div><!-- .left-menu -->
+
+						<div class="main-column">
+
+							<div id="message" class="info">
+								<p><?php _e('Select people to invite from your friends list.', 'buddypress'); ?></p>
+							</div>
+
+							<?php /* The ID 'friend-list' is important for AJAX support. */ ?>
+							<ul id="friend-list" class="item-list">
+							<?php if ( bp_group_has_invites() ) : ?>
+
+								<?php while ( bp_group_invites() ) : bp_group_the_invite(); ?>
+
+									<li id="<?php bp_group_invite_item_id() ?>">
+										<?php bp_group_invite_user_avatar() ?>
+
+										<h4><?php bp_group_invite_user_link() ?></h4>
+										<span class="activity"><?php bp_group_invite_user_last_active() ?></span>
+
+										<div class="action">
+											<a class="remove" href="<?php bp_group_invite_user_remove_invite_url() ?>" id="<?php bp_group_invite_item_id() ?>"><?php _e( 'Remove Invite', 'buddypress' ) ?></a>
+										</div>
+									</li>
+
+								<?php endwhile; ?>
+
+								<?php wp_nonce_field( 'groups_send_invites', '_wpnonce_send_invites' ) ?>
+							<?php endif; ?>
+							</ul>
+
+						</div><!-- .main-column -->
+
+					<?php else : ?>
+
+						<div id="message" class="info">
+							<p><?php _e( 'Once you have built up friend connections you will be able to invite others to your group. You can send invites any time in the future by selecting the "Send Invites" option when viewing your new group.', 'buddypress' ); ?></p>
+						</div>
+
+					<?php endif; ?>
+
+					<?php wp_nonce_field( 'groups_create_save_group-invites' ) ?>
+					<?php do_action( 'bp_after_group_invites_creation_step' ); ?>
+
+				<?php endif; ?>
+
+				<?php do_action( 'groups_custom_create_steps' ) // Allow plugins to add custom group creation steps ?>
+
+				<?php do_action( 'bp_before_group_creation_step_buttons' ); ?>
+
+				<?php if ( 'crop-image' != bp_get_avatar_admin_step() ) : ?>
+					<div class="submit" id="previous-next">
+						<?php /* Previous Button */ ?>
+						<?php if ( !bp_is_first_group_creation_step() ) : ?>
+							<input type="button" value="&larr; <?php _e('Previous Step', 'buddypress') ?>" id="group-creation-previous" name="previous" onclick="location.href='<?php bp_group_creation_previous_link() ?>'" />
+						<?php endif; ?>
+
+						<?php /* Next Button */ ?>
+						<?php if ( !bp_is_last_group_creation_step() && !bp_is_first_group_creation_step() ) : ?>
+							<input type="submit" value="<?php _e('Next Step', 'buddypress') ?> &rarr;" id="group-creation-next" name="save" />
+						<?php endif;?>
+
+						<?php /* Create Button */ ?>
+						<?php if ( bp_is_first_group_creation_step() ) : ?>
+							<input type="submit" value="<?php _e('Create Group and Continue', 'buddypress') ?> &rarr;" id="group-creation-create" name="save" />
+						<?php endif; ?>
+
+						<?php /* Finish Button */ ?>
+						<?php if ( bp_is_last_group_creation_step() ) : ?>
+							<input type="submit" value="<?php _e('Finish', 'buddypress') ?> &rarr;" id="group-creation-finish" name="save" />
+						<?php endif; ?>
+					</div>
+				<?php endif;?>
+
+				<?php do_action( 'bp_after_group_creation_step_buttons' ); ?>
+
+				<?php /* Don't leave out this hidden field */ ?>
+				<input type="hidden" name="group_id" id="group_id" value="<?php bp_new_group_id() ?>" />
+
+				<?php do_action( 'bp_directory_groups_content' ) ?>
+
+			</div><!-- .item-body -->
+
+			<?php do_action( 'bp_after_create_group' ) ?>
+
+		</form>
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer() ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/groups/groups-loop.php b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/groups-loop.php
new file mode 100644
index 0000000000000000000000000000000000000000..c846d1b666e6a71673bf59cc0a0c43a4b93d5095
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/groups-loop.php
@@ -0,0 +1,79 @@
+<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_object_filter() */ ?>
+
+<?php do_action( 'bp_before_groups_loop' ) ?>
+
+<?php if ( bp_has_groups( bp_ajax_querystring( 'groups' ) ) ) : ?>
+
+	<div id="pag-top" class="pagination">
+
+		<div class="pag-count" id="group-dir-count-top">
+			<?php bp_groups_pagination_count() ?>
+		</div>
+
+		<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(); ?>
+
+		<li>
+			<div class="item-avatar">
+				<a href="<?php bp_group_permalink() ?>"><?php bp_group_avatar( 'type=thumb&width=50&height=50' ) ?></a>
+			</div>
+
+			<div class="item">
+				<div class="item-title"><a href="<?php bp_group_permalink() ?>"><?php bp_group_name() ?></a></div>
+				<div class="item-meta"><span class="activity"><?php printf( __( 'active %s ago', 'buddypress' ), bp_get_group_last_active() ) ?></span></div>
+
+				<div class="item-desc"><?php bp_group_description_excerpt() ?></div>
+
+				<?php do_action( 'bp_directory_groups_item' ) ?>
+
+			</div>
+
+			<div class="action">
+
+				<?php do_action( 'bp_directory_groups_actions' ) ?>
+
+				<div class="meta">
+
+					<?php bp_group_type() ?> / <?php bp_group_member_count() ?>
+
+				</div>
+
+			</div>
+
+			<div class="clear"></div>
+		</li>
+
+	<?php endwhile; ?>
+	</ul>
+
+	<?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">
+		<p><?php _e( 'There were no groups found.', 'buddypress' ) ?></p>
+	</div>
+
+<?php endif; ?>
+
+<?php do_action( 'bp_after_groups_loop' ) ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/groups/index.php b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/index.php
new file mode 100644
index 0000000000000000000000000000000000000000..64eb9fd34b58e20cc96570f6f728af7afba882f1
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/index.php
@@ -0,0 +1,57 @@
+<?php get_header() ?>
+
+	<div id="content">
+		<div class="padder">
+
+		<form action="" method="post" id="groups-directory-form" class="dir-form">
+			<h3><?php _e( 'Groups Directory', 'buddypress' ) ?><?php if ( is_user_logged_in() ) : ?> &nbsp;<a class="button" href="<?php echo bp_get_root_domain() . '/' . BP_GROUPS_SLUG . '/create/' ?>"><?php _e( 'Create a Group', 'buddypress' ) ?></a><?php endif; ?></h3>
+
+			<?php do_action( 'bp_before_directory_groups_content' ) ?>
+
+			<div id="group-dir-search" class="dir-search">
+				<?php bp_directory_groups_search_form() ?>
+			</div><!-- #group-dir-search -->
+
+			<div class="item-list-tabs">
+				<ul>
+					<li class="selected" id="groups-all"><a href="<?php echo bp_get_root_domain() . '/' . BP_GROUPS_SLUG ?>"><?php printf( __( 'All Groups (%s)', 'buddypress' ), bp_get_total_group_count() ) ?></a></li>
+
+					<?php if ( is_user_logged_in() && bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) : ?>
+						<li id="groups-personal"><a href="<?php echo bp_loggedin_user_domain() . BP_GROUPS_SLUG . '/my-groups/' ?>"><?php printf( __( 'My Groups (%s)', 'buddypress' ), bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) ?></a></li>
+					<?php endif; ?>
+
+					<?php do_action( 'bp_groups_directory_group_types' ) ?>
+
+					<li id="groups-order-select" class="last filter">
+
+						<?php _e( 'Order By:', 'buddypress' ) ?>
+						<select>
+							<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>
+							<option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ) ?></option>
+
+							<?php do_action( 'bp_groups_directory_order_options' ) ?>
+						</select>
+					</li>
+				</ul>
+			</div><!-- .item-list-tabs -->
+
+			<div id="groups-dir-list" class="groups dir-list">
+				<?php locate_template( array( 'groups/groups-loop.php' ), true ) ?>
+			</div><!-- #groups-dir-list -->
+
+			<?php do_action( 'bp_directory_groups_content' ) ?>
+
+			<?php wp_nonce_field( 'directory_groups', '_wpnonce-groups-filter' ) ?>
+
+		</form><!-- #groups-directory-form -->
+
+		<?php do_action( 'bp_after_directory_groups_content' ) ?>
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer() ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/activity.php b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/activity.php
new file mode 100644
index 0000000000000000000000000000000000000000..c8f4c825cc1643071b7e11d7a9b43d2fd2241801
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/activity.php
@@ -0,0 +1,38 @@
+<div class="item-list-tabs no-ajax" id="subnav">
+	<ul>
+		<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' ) ?>
+
+		<li id="activity-filter-select" class="last">
+			<select>
+				<option value="-1"><?php _e( 'No Filter', 'buddypress' ) ?></option>
+				<option value="activity_update"><?php _e( 'Show Updates', 'buddypress' ) ?></option>
+
+				<?php if ( bp_is_active( 'forums' ) ) : ?>
+					<option value="new_forum_topic"><?php _e( 'Show New Forum Topics', 'buddypress' ) ?></option>
+					<option value="new_forum_post"><?php _e( 'Show Forum Replies', 'buddypress' ) ?></option>
+				<?php endif; ?>
+
+				<option value="joined_group"><?php _e( 'Show New Group Memberships', 'buddypress' ) ?></option>
+
+				<?php do_action( 'bp_group_activity_filter_options' ) ?>
+			</select>
+		</li>
+	</ul>
+</div><!-- .item-list-tabs -->
+
+<?php do_action( 'bp_before_group_activity_post_form' ) ?>
+
+<?php if ( is_user_logged_in() && bp_group_is_member() ) : ?>
+	<?php locate_template( array( 'activity/post-form.php'), true ) ?>
+<?php endif; ?>
+
+<?php do_action( 'bp_after_group_activity_post_form' ) ?>
+<?php do_action( 'bp_before_group_activity_content' ) ?>
+
+<div class="activity single-group">
+	<?php locate_template( array( 'activity/activity-loop.php' ), true ) ?>
+</div><!-- .activity.single-group -->
+
+<?php do_action( 'bp_after_group_activity_content' ) ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/admin.php b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/admin.php
new file mode 100644
index 0000000000000000000000000000000000000000..b0474c46f8bd421a50a158898675892ab919fbd8
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/admin.php
@@ -0,0 +1,318 @@
+<div class="item-list-tabs no-ajax" id="subnav">
+	<ul>
+		<?php bp_group_admin_tabs(); ?>
+	</ul>
+</div><!-- .item-list-tabs -->
+
+<form action="<?php bp_group_admin_form_action() ?>" name="group-settings-form" id="group-settings-form" class="standard-form" method="post" enctype="multipart/form-data">
+
+<?php do_action( 'bp_before_group_admin_content' ) ?>
+
+<?php /* Edit Group Details */ ?>
+<?php if ( bp_is_group_admin_screen( 'edit-details' ) ) : ?>
+
+	<?php do_action( 'bp_before_group_details_admin' ); ?>
+
+	<label for="group-name">* <?php _e( 'Group Name', 'buddypress' ) ?></label>
+	<input type="text" name="group-name" id="group-name" value="<?php bp_group_name() ?>" />
+
+	<label for="group-desc">* <?php _e( 'Group Description', 'buddypress' ) ?></label>
+	<textarea name="group-desc" id="group-desc"><?php bp_group_description_editable() ?></textarea>
+
+	<?php do_action( 'groups_custom_group_fields_editable' ) ?>
+
+	<p>
+		<label for="group-notifiy-members"><?php _e( 'Notify group members of changes via email', 'buddypress' ); ?></label>
+		<input type="radio" name="group-notify-members" value="1" /> <?php _e( 'Yes', 'buddypress' ); ?>&nbsp;
+		<input type="radio" name="group-notify-members" value="0" checked="checked" /> <?php _e( 'No', 'buddypress' ); ?>&nbsp;
+	</p>
+
+	<?php do_action( 'bp_after_group_details_admin' ); ?>
+
+	<p><input type="submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?> &rarr;" id="save" name="save" /></p>
+	<?php wp_nonce_field( 'groups_edit_group_details' ) ?>
+
+<?php endif; ?>
+
+<?php /* Manage Group Settings */ ?>
+<?php if ( bp_is_group_admin_screen( 'group-settings' ) ) : ?>
+
+	<?php do_action( 'bp_before_group_settings_admin' ); ?>
+
+	<?php if ( function_exists('bp_wire_install') ) : ?>
+
+		<div class="checkbox">
+			<label><input type="checkbox" name="group-show-wire" id="group-show-wire" value="1"<?php bp_group_show_wire_setting() ?>/> <?php _e( 'Enable comment wire', 'buddypress' ) ?></label>
+		</div>
+
+	<?php endif; ?>
+
+	<?php if ( function_exists('bp_forums_is_installed_correctly') ) : ?>
+
+		<?php if ( bp_forums_is_installed_correctly() ) : ?>
+
+			<div class="checkbox">
+				<label><input type="checkbox" name="group-show-forum" id="group-show-forum" value="1"<?php bp_group_show_forum_setting() ?> /> <?php _e( 'Enable discussion forum', 'buddypress' ) ?></label>
+			</div>
+
+		<?php endif; ?>
+
+	<?php endif; ?>
+
+	<hr />
+
+	<h4><?php _e( 'Privacy Options', 'buddypress' ); ?></h4>
+
+	<div class="radio">
+		<label>
+			<input type="radio" name="group-status" value="public"<?php bp_group_show_status_setting('public') ?> />
+			<strong><?php _e( 'This is a public group', 'buddypress' ) ?></strong>
+			<ul>
+				<li><?php _e( 'Any site member can join this group.', 'buddypress' ) ?></li>
+				<li><?php _e( 'This group will be listed in the groups directory and in search results.', 'buddypress' ) ?></li>
+				<li><?php _e( 'Group content and activity will be visible to any site member.', 'buddypress' ) ?></li>
+			</ul>
+		</label>
+
+		<label>
+			<input type="radio" name="group-status" value="private"<?php bp_group_show_status_setting('private') ?> />
+			<strong><?php _e( 'This is a private group', 'buddypress' ) ?></strong>
+			<ul>
+				<li><?php _e( 'Only users who request membership and are accepted can join the group.', 'buddypress' ) ?></li>
+				<li><?php _e( 'This group will be listed in the groups directory and in search results.', 'buddypress' ) ?></li>
+				<li><?php _e( 'Group content and activity will only be visible to members of the group.', 'buddypress' ) ?></li>
+			</ul>
+		</label>
+
+		<label>
+			<input type="radio" name="group-status" value="hidden"<?php bp_group_show_status_setting('hidden') ?> />
+			<strong><?php _e( 'This is a hidden group', 'buddypress' ) ?></strong>
+			<ul>
+				<li><?php _e( 'Only users who are invited can join the group.', 'buddypress' ) ?></li>
+				<li><?php _e( 'This group will not be listed in the groups directory or search results.', 'buddypress' ) ?></li>
+				<li><?php _e( 'Group content and activity will only be visible to members of the group.', 'buddypress' ) ?></li>
+			</ul>
+		</label>
+	</div>
+
+	<?php do_action( 'bp_after_group_settings_admin' ); ?>
+
+	<p><input type="submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?> &rarr;" id="save" name="save" /></p>
+	<?php wp_nonce_field( 'groups_edit_group_settings' ) ?>
+
+<?php endif; ?>
+
+<?php /* Group Avatar Settings */ ?>
+<?php if ( bp_is_group_admin_screen( 'group-avatar' ) ) : ?>
+
+	<?php if ( 'upload-image' == bp_get_avatar_admin_step() ) : ?>
+
+			<p><?php _e("Upload an image to use as an avatar for this group. The image will be shown on the main group page, and in search results.", 'buddypress') ?></p>
+
+			<p>
+				<input type="file" name="file" id="file" />
+				<input type="submit" name="upload" id="upload" value="<?php _e( 'Upload Image', 'buddypress' ) ?>" />
+				<input type="hidden" name="action" id="action" value="bp_avatar_upload" />
+			</p>
+
+			<?php if ( bp_get_group_has_avatar() ) : ?>
+
+				<p><?php _e( "If you'd like to remove the existing avatar but not upload a new one, please use the delete avatar button.", 'buddypress' ) ?></p>
+
+				<?php bp_button( array( 'id' => 'delete_group_avatar', 'component' => 'groups', 'wrapper_id' => 'delete-group-avatar-button', 'link_class' => 'edit', 'link_href' => bp_get_group_avatar_delete_link(), 'link_title' => __( 'Delete Avatar', 'buddypress' ), 'link_text' => __( 'Delete Avatar', 'buddypress' ) ) ); ?>
+
+			<?php endif; ?>
+
+			<?php wp_nonce_field( 'bp_avatar_upload' ) ?>
+
+	<?php endif; ?>
+
+	<?php if ( 'crop-image' == bp_get_avatar_admin_step() ) : ?>
+
+		<h3><?php _e( 'Crop Avatar', 'buddypress' ) ?></h3>
+
+		<img src="<?php bp_avatar_to_crop() ?>" id="avatar-to-crop" class="avatar" alt="<?php _e( 'Avatar to crop', 'buddypress' ) ?>" />
+
+		<div id="avatar-crop-pane">
+			<img src="<?php bp_avatar_to_crop() ?>" id="avatar-crop-preview" class="avatar" alt="<?php _e( 'Avatar preview', 'buddypress' ) ?>" />
+		</div>
+
+		<input type="submit" name="avatar-crop-submit" id="avatar-crop-submit" value="<?php _e( 'Crop Image', 'buddypress' ) ?>" />
+
+		<input type="hidden" name="image_src" id="image_src" value="<?php bp_avatar_to_crop_src() ?>" />
+		<input type="hidden" id="x" name="x" />
+		<input type="hidden" id="y" name="y" />
+		<input type="hidden" id="w" name="w" />
+		<input type="hidden" id="h" name="h" />
+
+		<?php wp_nonce_field( 'bp_avatar_cropstore' ) ?>
+
+	<?php endif; ?>
+
+<?php endif; ?>
+
+<?php /* Manage Group Members */ ?>
+<?php if ( bp_is_group_admin_screen( 'manage-members' ) ) : ?>
+
+	<?php do_action( 'bp_before_group_manage_members_admin' ); ?>
+
+	<div class="bp-widget">
+		<h4><?php _e( 'Administrators', 'buddypress' ); ?></h4>
+		<?php bp_group_admin_memberlist( true ) ?>
+	</div>
+
+	<?php if ( bp_group_has_moderators() ) : ?>
+
+		<div class="bp-widget">
+			<h4><?php _e( 'Moderators', 'buddypress' ) ?></h4>
+			<?php bp_group_mod_memberlist( true ) ?>
+		</div>
+
+	<?php endif; ?>
+
+	<div class="bp-widget">
+		<h4><?php _e("Members", "buddypress"); ?></h4>
+
+		<?php if ( bp_group_has_members( 'per_page=15&exclude_banned=false' ) ) : ?>
+
+			<?php if ( bp_group_member_needs_pagination() ) : ?>
+
+				<div class="pagination no-ajax">
+
+					<div id="member-count" class="pag-count">
+						<?php bp_group_member_pagination_count() ?>
+					</div>
+
+					<div id="member-admin-pagination" class="pagination-links">
+						<?php bp_group_member_admin_pagination() ?>
+					</div>
+
+				</div>
+
+			<?php endif; ?>
+
+			<ul id="members-list" class="item-list single-line">
+				<?php while ( bp_group_members() ) : bp_group_the_member(); ?>
+
+					<li class="<?php bp_group_member_css_class(); ?>">
+						<?php bp_group_member_avatar_mini() ?>
+
+						<h5>
+							<?php bp_group_member_link() ?>
+							
+							<?php if ( bp_get_group_member_is_banned() ) _e( '(banned)', 'buddypress'); ?>
+
+							<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 : ?>
+
+								<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; ?>
+
+								| <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>
+
+		<?php else: ?>
+
+			<div id="message" class="info">
+				<p><?php _e( 'This group has no members.', 'buddypress' ); ?></p>
+			</div>
+
+		<?php endif; ?>
+
+	</div>
+
+	<?php do_action( 'bp_after_group_manage_members_admin' ); ?>
+
+<?php endif; ?>
+
+<?php /* Manage Membership Requests */ ?>
+<?php if ( bp_is_group_admin_screen( 'membership-requests' ) ) : ?>
+
+	<?php do_action( 'bp_before_group_membership_requests_admin' ); ?>
+
+	<?php if ( bp_group_has_membership_requests() ) : ?>
+
+		<ul id="request-list" class="item-list">
+			<?php while ( bp_group_membership_requests() ) : bp_group_the_membership_request(); ?>
+
+				<li>
+					<?php bp_group_request_user_avatar_thumb() ?>
+					<h4><?php bp_group_request_user_link() ?> <span class="comments"><?php bp_group_request_comment() ?></span></h4>
+					<span class="activity"><?php bp_group_request_time_since_requested() ?></span>
+
+					<?php do_action( 'bp_group_membership_requests_admin_item' ); ?>
+
+					<div class="action">
+
+						<?php bp_button( array( 'id' => 'group_membership_accept', 'component' => 'groups', 'wrapper_class' => 'accept', 'link_href' => bp_get_group_request_accept_link(), 'link_title' => __( 'Accept', 'buddypress' ), 'link_text' => __( 'Accept', 'buddypress' ) ) ); ?>
+
+						<?php bp_button( array( 'id' => 'group_membership_reject', 'component' => 'groups', 'wrapper_class' => 'reject', 'link_href' => bp_get_group_request_reject_link(), 'link_title' => __( 'Reject', 'buddypress' ), 'link_text' => __( 'Reject', 'buddypress' ) ) ); ?>
+
+						<?php do_action( 'bp_group_membership_requests_admin_item_action' ); ?>
+
+					</div>
+				</li>
+
+			<?php endwhile; ?>
+		</ul>
+
+	<?php else: ?>
+
+		<div id="message" class="info">
+			<p><?php _e( 'There are no pending membership requests.', 'buddypress' ); ?></p>
+		</div>
+
+	<?php endif; ?>
+
+	<?php do_action( 'bp_after_group_membership_requests_admin' ); ?>
+
+<?php endif; ?>
+
+<?php do_action( 'groups_custom_edit_steps' ) // Allow plugins to add custom group edit screens ?>
+
+<?php /* Delete Group Option */ ?>
+<?php if ( bp_is_group_admin_screen( 'delete-group' ) ) : ?>
+
+	<?php do_action( 'bp_before_group_delete_admin' ); ?>
+
+	<div id="message" class="info">
+		<p><?php _e( 'WARNING: Deleting this group will completely remove ALL content associated with it. There is no way back, please be careful with this option.', 'buddypress' ); ?></p>
+	</div>
+
+	<input type="checkbox" name="delete-group-understand" id="delete-group-understand" value="1" onclick="if(this.checked) { document.getElementById('delete-group-button').disabled = ''; } else { document.getElementById('delete-group-button').disabled = 'disabled'; }" /> <?php _e( 'I understand the consequences of deleting this group.', 'buddypress' ); ?>
+
+	<?php do_action( 'bp_after_group_delete_admin' ); ?>
+
+	<div class="submit">
+		<input type="submit" disabled="disabled" value="<?php _e( 'Delete Group', 'buddypress' ) ?> &rarr;" id="delete-group-button" name="delete-group-button" />
+	</div>
+
+	<input type="hidden" name="group-id" id="group-id" value="<?php bp_group_id() ?>" />
+
+	<?php wp_nonce_field( 'groups_delete_group' ) ?>
+
+<?php endif; ?>
+
+<?php /* This is important, don't forget it */ ?>
+	<input type="hidden" name="group-id" id="group-id" value="<?php bp_group_id() ?>" />
+
+<?php do_action( 'bp_after_group_admin_content' ) ?>
+
+</form><!-- #group-settings-form -->
+
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/forum.php b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/forum.php
new file mode 100644
index 0000000000000000000000000000000000000000..8b9212b5943d82a458b34d284a43c316d8696449
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/forum.php
@@ -0,0 +1,57 @@
+<?php do_action( 'bp_before_group_forum_content' ) ?>
+
+<?php if ( bp_is_group_forum_topic_edit() ) : ?>
+	<?php locate_template( array( 'groups/single/forum/edit.php' ), true ) ?>
+
+<?php elseif ( bp_is_group_forum_topic() ) : ?>
+	<?php locate_template( array( 'groups/single/forum/topic.php' ), true ) ?>
+
+<?php else : ?>
+
+	<div class="forums single-forum">
+		<?php locate_template( array( 'forums/forums-loop.php' ), true ) ?>
+	</div><!-- .forums.single-forum -->
+
+<?php endif; ?>
+
+<?php do_action( 'bp_after_group_forum_content' ) ?>
+
+<?php if ( !bp_is_group_forum_topic_edit() && !bp_is_group_forum_topic() ) : ?>
+
+	<?php if ( ( is_user_logged_in() && 'public' == bp_get_group_status() ) || bp_group_is_member() ) : ?>
+
+		<form action="" method="post" id="forum-topic-form" class="standard-form">
+			<div id="post-new-topic">
+
+				<?php do_action( 'bp_before_group_forum_post_new' ) ?>
+
+				<?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; ?>
+
+				<p id="post-new"></p>
+				<h4><?php _e( 'Post a New Topic:', 'buddypress' ) ?></h4>
+
+				<label><?php _e( 'Title:', 'buddypress' ) ?></label>
+				<input type="text" name="topic_title" id="topic_title" value="" />
+
+				<label><?php _e( 'Content:', 'buddypress' ) ?></label>
+				<textarea name="topic_text" id="topic_text"></textarea>
+
+				<label><?php _e( 'Tags (comma separated):', 'buddypress' ) ?></label>
+				<input type="text" name="topic_tags" id="topic_tags" value="" />
+
+				<?php do_action( 'bp_after_group_forum_post_new' ) ?>
+
+				<div class="submit">
+					<input type="submit" name="submit_topic" id="submit" value="<?php _e( 'Post Topic', 'buddypress' ) ?>" />
+				</div>
+
+				<?php wp_nonce_field( 'bp_forums_new_topic' ) ?>
+			</div><!-- #post-new-topic -->
+		</form><!-- #forum-topic-form -->
+
+	<?php endif; ?>
+
+<?php endif; ?>
+
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/forum/edit.php b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/forum/edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..72ea20b613cab71e8416dbde41486f98f4296bf9
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/forum/edit.php
@@ -0,0 +1,72 @@
+<?php do_action( 'bp_before_group_forum_edit_form' ) ?>
+
+<?php if ( bp_has_forum_topic_posts() ) : ?>
+
+	<form action="<?php bp_forum_topic_action() ?>" method="post" id="forum-topic-form" class="standard-form">
+
+		<div id="topic-meta">
+			<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>
+
+			<?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>
+
+		<?php if ( bp_group_is_member() ) : ?>
+
+			<?php if ( bp_is_edit_topic() ) : ?>
+
+				<div id="edit-topic">
+
+					<?php do_action( 'bp_group_before_edit_forum_topic' ) ?>
+
+					<p><strong><?php _e( 'Edit Topic:', 'buddypress' ) ?></strong></p>
+
+					<label for="topic_title"><?php _e( 'Title:', 'buddypress' ) ?></label>
+					<input type="text" name="topic_title" id="topic_title" value="<?php bp_the_topic_title() ?>" />
+
+					<label for="topic_text"><?php _e( 'Content:', 'buddypress' ) ?></label>
+					<textarea name="topic_text" id="topic_text"><?php bp_the_topic_text() ?></textarea>
+
+					<?php do_action( 'bp_group_after_edit_forum_topic' ) ?>
+
+					<p class="submit"><input type="submit" name="save_changes" id="save_changes" value="<?php _e( 'Save Changes', 'buddypress' ) ?>" /></p>
+
+					<?php wp_nonce_field( 'bp_forums_edit_topic' ) ?>
+
+				</div>
+
+			<?php else : ?>
+
+				<div id="edit-post">
+
+					<?php do_action( 'bp_group_before_edit_forum_post' ) ?>
+
+					<p><strong><?php _e( 'Edit Post:', 'buddypress' ) ?></strong></p>
+
+					<textarea name="post_text" id="post_text"><?php bp_the_topic_post_edit_text() ?></textarea>
+
+					<?php do_action( 'bp_group_after_edit_forum_post' ) ?>
+
+					<p class="submit"><input type="submit" name="save_changes" id="save_changes" value="<?php _e( 'Save Changes', 'buddypress' ) ?>" /></p>
+
+					<?php wp_nonce_field( 'bp_forums_edit_post' ) ?>
+
+				</div>
+
+			<?php endif; ?>
+
+		<?php endif; ?>
+
+	</form><!-- #forum-topic-form -->
+
+<?php else: ?>
+
+	<div id="message" class="info">
+		<p><?php _e( 'This topic does not exist.', 'buddypress' ) ?></p>
+	</div>
+
+<?php endif;?>
+
+<?php do_action( 'bp_after_group_forum_edit_form' ) ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/forum/topic.php b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/forum/topic.php
new file mode 100644
index 0000000000000000000000000000000000000000..0f941968b2b6d0545a7558c00427b5e57c7e0bf4
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/forum/topic.php
@@ -0,0 +1,126 @@
+<?php do_action( 'bp_before_group_forum_topic' ) ?>
+
+<?php if ( bp_has_forum_topic_posts() ) : ?>
+
+	<form action="<?php bp_forum_topic_action() ?>" method="post" id="forum-topic-form" class="standard-form">
+
+		<div class="pagination no-ajax">
+
+			<div id="post-count" class="pag-count">
+				<?php bp_the_topic_pagination_count() ?>
+			</div>
+
+			<div class="pagination-links" id="topic-pag">
+				<?php bp_the_topic_pagination() ?>
+			</div>
+
+		</div>
+
+		<div id="topic-meta">
+			<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>
+
+			<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>
+
+		<?php do_action( 'bp_before_group_forum_topic_posts' ) ?>
+
+		<ul id="topic-post-list" class="item-list">
+			<?php while ( bp_forum_topic_posts() ) : bp_the_forum_topic_post(); ?>
+
+				<li id="post-<?php bp_the_topic_post_id() ?>" class="<?php bp_the_topic_post_css_class() ?>">
+					<div class="poster-meta">
+						<a href="<?php bp_the_topic_post_poster_link() ?>">
+							<?php bp_the_topic_post_poster_avatar( 'width=40&height=40' ) ?>
+						</a>
+						<?php echo sprintf( __( '%s said %s ago:', 'buddypress' ), bp_get_the_topic_post_poster_name(), bp_get_the_topic_post_time_since() ) ?>
+					</div>
+
+					<div class="post-content">
+						<?php bp_the_topic_post_content() ?>
+					</div>
+
+					<div class="admin-links">
+						<?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>
+
+			<?php endwhile; ?>
+		</ul><!-- #topic-post-list -->
+
+		<?php do_action( 'bp_after_group_forum_topic_posts' ) ?>
+
+		<div class="pagination no-ajax">
+
+			<div id="post-count" class="pag-count">
+				<?php bp_the_topic_pagination_count() ?>
+			</div>
+
+			<div class="pagination-links" id="topic-pag">
+				<?php bp_the_topic_pagination() ?>
+			</div>
+
+		</div>
+
+		<?php if ( ( is_user_logged_in() && 'public' == bp_get_group_status() ) || bp_group_is_member() ) : ?>
+
+			<?php if ( bp_get_the_topic_is_last_page() ) : ?>
+
+				<?php if ( bp_get_the_topic_is_topic_open() ) : ?>
+
+					<div id="post-topic-reply">
+						<p id="post-reply"></p>
+
+						<?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; ?>
+
+						<?php do_action( 'groups_forum_new_reply_before' ) ?>
+
+						<h4><?php _e( 'Add a reply:', 'buddypress' ) ?></h4>
+
+						<textarea name="reply_text" id="reply_text"></textarea>
+
+						<div class="submit">
+							<input type="submit" name="submit_reply" id="submit" value="<?php _e( 'Post Reply', 'buddypress' ) ?>" />
+						</div>
+
+						<?php do_action( 'groups_forum_new_reply_after' ) ?>
+
+						<?php wp_nonce_field( 'bp_forums_new_reply' ) ?>
+					</div>
+
+				<?php else : ?>
+
+					<div id="message" class="info">
+						<p><?php _e( 'This topic is closed, replies are no longer accepted.', 'buddypress' ) ?></p>
+					</div>
+
+				<?php endif; ?>
+
+			<?php endif; ?>
+
+		<?php endif; ?>
+
+	</form><!-- #forum-topic-form -->
+<?php else: ?>
+
+	<div id="message" class="info">
+		<p><?php _e( 'There are no posts for this topic.', 'buddypress' ) ?></p>
+	</div>
+
+<?php endif;?>
+
+<?php do_action( 'bp_after_group_forum_topic' ) ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/group-header.php b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/group-header.php
new file mode 100644
index 0000000000000000000000000000000000000000..bb0a1cf7711022d4d84d4a94c172baa150033a98
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/group-header.php
@@ -0,0 +1,50 @@
+<?php do_action( 'bp_before_group_header' ) ?>
+
+<div id="item-actions">
+	<?php if ( bp_group_is_visible() ) : ?>
+
+		<h3><?php _e( 'Group Admins', 'buddypress' ) ?></h3>
+		<?php bp_group_list_admins() ?>
+
+		<?php do_action( 'bp_after_group_menu_admins' ) ?>
+
+		<?php if ( bp_group_has_moderators() ) : ?>
+			<?php do_action( 'bp_before_group_menu_mods' ) ?>
+
+			<h3><?php _e( 'Group Mods' , 'buddypress' ) ?></h3>
+			<?php bp_group_list_mods() ?>
+
+			<?php do_action( 'bp_after_group_menu_mods' ) ?>
+		<?php endif; ?>
+
+	<?php endif; ?>
+</div><!-- #item-actions -->
+
+<div id="item-header-avatar">
+	<a href="<?php bp_group_permalink() ?>" title="<?php bp_group_name() ?>">
+		<?php bp_group_avatar() ?>
+	</a>
+</div><!-- #item-header-avatar -->
+
+<div id="item-header-content">
+	<h2><a href="<?php bp_group_permalink() ?>" title="<?php bp_group_name() ?>"><?php bp_group_name() ?></a></h2>
+	<span class="highlight"><?php bp_group_type() ?></span> <span class="activity"><?php printf( __( 'active %s ago', 'buddypress' ), bp_get_group_last_active() ) ?></span>
+
+	<?php do_action( 'bp_before_group_header_meta' ) ?>
+
+	<div id="item-meta">
+		<?php bp_group_description() ?>
+
+		<div id="item-buttons">
+
+			<?php do_action( 'bp_group_header_actions' ); ?>
+
+		</div><!-- #item-buttons -->
+
+		<?php do_action( 'bp_group_header_meta' ) ?>
+	</div>
+</div><!-- #item-header-content -->
+
+<?php do_action( 'bp_after_group_header' ) ?>
+
+<?php do_action( 'template_notices' ) ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/home.php b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/home.php
new file mode 100644
index 0000000000000000000000000000000000000000..f8e98ea8534c1cd982886511708fa408c06e213c
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/home.php
@@ -0,0 +1,73 @@
+<?php get_header() ?>
+
+	<div id="content">
+		<div class="padder">
+			<?php if ( bp_has_groups() ) : while ( bp_groups() ) : bp_the_group(); ?>
+
+			<?php do_action( 'bp_before_group_home_content' ) ?>
+
+			<div id="item-header">
+				<?php locate_template( array( 'groups/single/group-header.php' ), true ) ?>
+			</div><!-- #item-header -->
+
+			<div id="item-nav">
+				<div class="item-list-tabs no-ajax" id="object-nav">
+					<ul>
+						<?php bp_get_options_nav() ?>
+
+						<?php do_action( 'bp_group_options_nav' ) ?>
+					</ul>
+				</div>
+			</div><!-- #item-nav -->
+
+			<div id="item-body">
+				<?php do_action( 'bp_before_group_body' ) ?>
+
+				<?php if ( bp_is_group_admin_page() && bp_group_is_visible() ) : ?>
+					<?php locate_template( array( 'groups/single/admin.php' ), true ) ?>
+
+				<?php elseif ( bp_is_group_members() && bp_group_is_visible() ) : ?>
+					<?php locate_template( array( 'groups/single/members.php' ), true ) ?>
+
+				<?php elseif ( bp_is_group_invites() && bp_group_is_visible() ) : ?>
+					<?php locate_template( array( 'groups/single/send-invites.php' ), true ) ?>
+
+				<?php elseif ( bp_is_group_forum() && bp_group_is_visible() ) : ?>
+					<?php locate_template( array( 'groups/single/forum.php' ), true ) ?>
+
+				<?php elseif ( bp_is_group_membership_request() ) : ?>
+					<?php locate_template( array( 'groups/single/request-membership.php' ), true ) ?>
+
+				<?php elseif ( bp_group_is_visible() && bp_is_active( 'activity' ) ) : ?>
+					<?php locate_template( array( 'groups/single/activity.php' ), true ) ?>
+
+				<?php elseif ( !bp_group_is_visible() ) : ?>
+					<?php /* The group is not visible, show the status message */ ?>
+
+					<?php do_action( 'bp_before_group_status_message' ) ?>
+
+					<div id="message" class="info">
+						<p><?php bp_group_status_message() ?></p>
+					</div>
+
+					<?php do_action( 'bp_after_group_status_message' ) ?>
+
+				<?php else : ?>
+					<?php
+						/* If nothing sticks, just load a group front template if one exists. */
+						locate_template( array( 'groups/single/front.php' ), true );
+					?>
+				<?php endif; ?>
+
+				<?php do_action( 'bp_after_group_body' ) ?>
+			</div><!-- #item-body -->
+
+			<?php do_action( 'bp_after_group_home_content' ) ?>
+
+			<?php endwhile; endif; ?>
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer() ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/members.php b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/members.php
new file mode 100644
index 0000000000000000000000000000000000000000..c1e7d6469384aebd28dfb759acec73381ee15f21
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/members.php
@@ -0,0 +1,54 @@
+<?php if ( bp_group_has_members( 'exclude_admins_mods=0' ) ) : ?>
+
+	<?php do_action( 'bp_before_group_members_content' ) ?>
+
+	<div class="pagination no-ajax">
+
+		<div id="member-count" class="pag-count">
+			<?php bp_group_member_pagination_count() ?>
+		</div>
+
+		<div id="member-pagination" class="pagination-links">
+			<?php bp_group_member_pagination() ?>
+		</div>
+
+	</div>
+
+	<?php do_action( 'bp_before_group_members_list' ) ?>
+
+	<ul id="member-list" class="item-list">
+		<?php while ( bp_group_members() ) : bp_group_the_member(); ?>
+
+			<li>
+				<a href="<?php bp_group_member_domain() ?>">
+					<?php bp_group_member_avatar_thumb() ?>
+				</a>
+				<h5><?php bp_group_member_link() ?></h5>
+				<span class="activity"><?php bp_group_member_joined_since() ?></span>
+
+				<?php do_action( 'bp_group_members_list_item' ) ?>
+
+				<?php if ( function_exists( 'friends_install' ) ) : ?>
+
+					<div class="action">
+						<?php bp_add_friend_button( bp_get_group_member_id(), bp_get_group_member_is_friend() ) ?>
+
+						<?php do_action( 'bp_group_members_list_item_action' ) ?>
+					</div>
+
+				<?php endif; ?>
+			</li>
+
+		<?php endwhile; ?>
+
+	</ul>
+
+	<?php do_action( 'bp_after_group_members_content' ) ?>
+
+<?php else: ?>
+
+	<div id="message" class="info">
+		<p><?php _e( 'This group has no members.', 'buddypress' ); ?></p>
+	</div>
+
+<?php endif; ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/plugins.php b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/plugins.php
new file mode 100644
index 0000000000000000000000000000000000000000..693506565076bb0c3552e9041b3fa1c1bc852d46
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/plugins.php
@@ -0,0 +1,41 @@
+<?php get_header() ?>
+
+	<div id="content">
+		<div class="padder">
+			<?php if ( bp_has_groups() ) : while ( bp_groups() ) : bp_the_group(); ?>
+
+			<?php do_action( 'bp_before_group_plugin_template' ) ?>
+
+			<div id="item-header">
+				<?php locate_template( array( 'groups/single/group-header.php' ), true ) ?>
+			</div><!-- #item-header -->
+
+			<div id="item-nav">
+				<div class="item-list-tabs no-ajax" id="object-nav">
+					<ul>
+						<?php bp_get_options_nav() ?>
+
+						<?php do_action( 'bp_group_plugin_options_nav' ) ?>
+					</ul>
+				</div>
+			</div><!-- #item-nav -->
+
+			<div id="item-body">
+
+				<?php do_action( 'bp_before_group_body' ) ?>
+
+				<?php do_action( 'bp_template_content' ) ?>
+
+				<?php do_action( 'bp_after_group_body' ) ?>
+			</div><!-- #item-body -->
+
+			<?php endwhile; endif; ?>
+
+			<?php do_action( 'bp_after_group_plugin_template' ) ?>
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer() ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/request-membership.php b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/request-membership.php
new file mode 100644
index 0000000000000000000000000000000000000000..824489e7ac3acfda7eb5b4f7b4948a7fbb9775db
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/request-membership.php
@@ -0,0 +1,18 @@
+<?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_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>
+		<textarea name="group-request-membership-comments" id="group-request-membership-comments"></textarea>
+
+		<?php do_action( 'bp_group_request_membership_content' ) ?>
+
+		<p><input type="submit" name="group-request-send" id="group-request-send" value="<?php _e( 'Send Request', 'buddypress' ) ?> &rarr;" />
+
+		<?php wp_nonce_field( 'groups_request_membership' ) ?>
+	</form><!-- #request-membership-form -->
+<?php endif; ?>
+
+<?php do_action( 'bp_after_group_request_membership_content' ) ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/send-invites.php b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/send-invites.php
new file mode 100644
index 0000000000000000000000000000000000000000..9c72e51613ba3b3793aedb8f02858e1e6d4e27d0
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/send-invites.php
@@ -0,0 +1,78 @@
+<?php do_action( 'bp_before_group_send_invites_content' ) ?>
+
+<?php if ( bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?>
+
+	<form action="<?php bp_group_send_invite_form_action() ?>" method="post" id="send-invite-form" class="standard-form">
+
+		<div class="left-menu">
+
+			<div id="invite-list">
+				<ul>
+					<?php bp_new_group_invite_friend_list() ?>
+				</ul>
+
+				<?php wp_nonce_field( 'groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user' ) ?>
+			</div>
+
+		</div><!-- .left-menu -->
+
+		<div class="main-column">
+
+			<div id="message" class="info">
+				<p><?php _e('Select people to invite from your friends list.', 'buddypress'); ?></p>
+			</div>
+
+			<?php do_action( 'bp_before_group_send_invites_list' ) ?>
+
+			<?php /* The ID 'friend-list' is important for AJAX support. */ ?>
+			<ul id="friend-list" class="item-list">
+			<?php if ( bp_group_has_invites() ) : ?>
+
+				<?php while ( bp_group_invites() ) : bp_group_the_invite(); ?>
+
+					<li id="<?php bp_group_invite_item_id() ?>">
+						<?php bp_group_invite_user_avatar() ?>
+
+						<h4><?php bp_group_invite_user_link() ?></h4>
+						<span class="activity"><?php bp_group_invite_user_last_active() ?></span>
+
+						<?php do_action( 'bp_group_send_invites_item' ) ?>
+
+						<div class="action">
+							<a class="remove" href="<?php bp_group_invite_user_remove_invite_url() ?>" id="<?php bp_group_invite_item_id() ?>"><?php _e( 'Remove Invite', 'buddypress' ) ?></a>
+
+							<?php do_action( 'bp_group_send_invites_item_action' ) ?>
+						</div>
+					</li>
+
+				<?php endwhile; ?>
+
+			<?php endif; ?>
+			</ul><!-- #friend-list -->
+
+			<?php do_action( 'bp_after_group_send_invites_list' ) ?>
+
+		</div><!-- .main-column -->
+
+		<div class="clear"></div>
+
+		<div class="submit">
+			<input type="submit" name="submit" id="submit" value="<?php _e( 'Send Invites', 'buddypress' ) ?>" />
+		</div>
+
+		<?php wp_nonce_field( 'groups_send_invites', '_wpnonce_send_invites') ?>
+
+		<?php /* This is important, don't forget it */ ?>
+		<input type="hidden" name="group_id" id="group_id" value="<?php bp_group_id() ?>" />
+
+	</form><!-- #send-invite-form -->
+
+<?php else : ?>
+
+	<div id="message" class="info">
+		<p><?php _e( 'Once you have built up friend connections you will be able to invite others to your group. You can send invites any time in the future by selecting the "Send Invites" option when viewing your new group.', 'buddypress' ); ?></p>
+	</div>
+
+<?php endif; ?>
+
+<?php do_action( 'bp_after_group_send_invites_content' ) ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/header.php b/wp-content/plugins/buddypress/bp-themes/bp-default/header.php
new file mode 100644
index 0000000000000000000000000000000000000000..158053d6892ba57d21ac291d01a0a625bc776df2
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/header.php
@@ -0,0 +1,111 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
+
+	<head profile="http://gmpg.org/xfn/11">
+
+		<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
+
+		<title><?php bp_page_title() ?></title>
+
+		<?php do_action( 'bp_head' ) ?>
+
+		<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->
+
+		<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
+
+		<?php if ( function_exists( 'bp_sitewide_activity_feed_link' ) ) : ?>
+			<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> | <?php _e('Site Wide Activity RSS Feed', 'buddypress' ) ?>" href="<?php bp_sitewide_activity_feed_link() ?>" />
+		<?php endif; ?>
+
+		<?php if ( function_exists( 'bp_member_activity_feed_link' ) && bp_is_member() ) : ?>
+			<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> | <?php bp_displayed_user_fullname() ?> | <?php _e( 'Activity RSS Feed', 'buddypress' ) ?>" href="<?php bp_member_activity_feed_link() ?>" />
+		<?php endif; ?>
+
+		<?php if ( function_exists( 'bp_group_activity_feed_link' ) && bp_is_group() ) : ?>
+			<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> | <?php bp_current_group_name() ?> | <?php _e( 'Group Activity RSS Feed', 'buddypress' ) ?>" href="<?php bp_group_activity_feed_link() ?>" />
+		<?php endif; ?>
+
+		<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> <?php _e( 'Blog Posts RSS Feed', 'buddypress' ) ?>" href="<?php bloginfo('rss2_url'); ?>" />
+		<link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> <?php _e( 'Blog Posts Atom Feed', 'buddypress' ) ?>" href="<?php bloginfo('atom_url'); ?>" />
+
+		<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
+
+		<?php wp_head(); ?>
+
+	</head>
+
+	<body <?php body_class() ?> id="bp-default">
+
+		<?php do_action( 'bp_before_header' ) ?>
+
+		<div id="header">
+
+			<h1 id="logo"><a href="<?php echo site_url() ?>" title="<?php _e( 'Home', 'buddypress' ) ?>"><?php bp_site_name() ?></a></h1>
+
+			<ul id="nav">
+				<li<?php if ( bp_is_front_page() ) : ?> class="selected"<?php endif; ?>>
+					<a href="<?php echo site_url() ?>" title="<?php _e( 'Home', 'buddypress' ) ?>"><?php _e( 'Home', 'buddypress' ) ?></a>
+				</li>
+
+				<?php if ( 'activity' != bp_dtheme_page_on_front() && bp_is_active( 'activity' ) ) : ?>
+					<li<?php if ( bp_is_page( BP_ACTIVITY_SLUG ) ) : ?> class="selected"<?php endif; ?>>
+						<a href="<?php echo site_url() ?>/<?php echo BP_ACTIVITY_SLUG ?>/" title="<?php _e( 'Activity', 'buddypress' ) ?>"><?php _e( 'Activity', 'buddypress' ) ?></a>
+					</li>
+				<?php endif; ?>
+
+				<li<?php if ( bp_is_page( BP_MEMBERS_SLUG ) || bp_is_member() ) : ?> class="selected"<?php endif; ?>>
+					<a href="<?php echo site_url() ?>/<?php echo BP_MEMBERS_SLUG ?>/" title="<?php _e( 'Members', 'buddypress' ) ?>"><?php _e( 'Members', 'buddypress' ) ?></a>
+				</li>
+
+				<?php if ( bp_is_active( 'groups' ) ) : ?>
+					<li<?php if ( bp_is_page( BP_GROUPS_SLUG ) || bp_is_group() ) : ?> class="selected"<?php endif; ?>>
+						<a href="<?php echo site_url() ?>/<?php echo BP_GROUPS_SLUG ?>/" title="<?php _e( 'Groups', 'buddypress' ) ?>"><?php _e( 'Groups', 'buddypress' ) ?></a>
+					</li>
+
+					<?php if ( bp_is_active( 'forums' ) && ( function_exists( 'bp_forums_is_installed_correctly' ) && !(int) bp_get_option( 'bp-disable-forum-directory' ) ) && bp_forums_is_installed_correctly() ) : ?>
+						<li<?php if ( bp_is_page( BP_FORUMS_SLUG ) ) : ?> class="selected"<?php endif; ?>>
+							<a href="<?php echo site_url() ?>/<?php echo BP_FORUMS_SLUG ?>/" title="<?php _e( 'Forums', 'buddypress' ) ?>"><?php _e( 'Forums', 'buddypress' ) ?></a>
+						</li>
+					<?php endif; ?>
+				<?php endif; ?>
+
+				<?php if ( bp_is_active( 'blogs' ) && bp_core_is_multisite() ) : ?>
+					<li<?php if ( bp_is_page( BP_BLOGS_SLUG ) ) : ?> class="selected"<?php endif; ?>>
+						<a href="<?php echo site_url() ?>/<?php echo BP_BLOGS_SLUG ?>/" title="<?php _e( 'Blogs', 'buddypress' ) ?>"><?php _e( 'Blogs', 'buddypress' ) ?></a>
+					</li>
+				<?php endif; ?>
+
+				<?php wp_list_pages( 'title_li=&depth=1&exclude=' . bp_dtheme_page_on_front() ); ?>
+
+				<?php do_action( 'bp_nav_items' ); ?>
+			</ul><!-- #nav -->
+
+			<div id="search-bar">
+				<div class="padder">
+
+				<?php if ( bp_search_form_enabled() ) : ?>
+
+					<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 -->
+			</div><!-- #search-bar -->
+
+			<?php do_action( 'bp_header' ) ?>
+
+		</div><!-- #header -->
+
+		<?php do_action( 'bp_after_header' ) ?>
+		<?php do_action( 'bp_before_container' ) ?>
+
+		<div id="container">
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/index.php b/wp-content/plugins/buddypress/bp-themes/bp-default/index.php
new file mode 100644
index 0000000000000000000000000000000000000000..ebcb2c6586880eb2049462e50d6e93e1fb2149af
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/index.php
@@ -0,0 +1,65 @@
+<?php get_header() ?>
+
+	<div id="content">
+		<div class="padder">
+
+		<?php do_action( 'bp_before_blog_home' ) ?>
+
+		<div class="page" id="blog-latest">
+
+			<?php if ( have_posts() ) : ?>
+
+				<?php while (have_posts()) : the_post(); ?>
+
+					<?php do_action( 'bp_before_blog_post' ) ?>
+
+					<div class="post" id="post-<?php the_ID(); ?>">
+
+						<div class="author-box">
+							<?php echo get_avatar( get_the_author_meta( 'user_email' ), '50' ); ?>
+							<p><?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></p>
+						</div>
+
+						<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() ?> <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' ) ); ?>
+							</div>
+
+							<p class="postmetadata"><span class="tags"><?php the_tags( __( 'Tags: ', 'buddypress' ), ', ', '<br />'); ?></span> <span class="comments"><?php comments_popup_link( __( 'No Comments &#187;', 'buddypress' ), __( '1 Comment &#187;', 'buddypress' ), __( '% Comments &#187;', 'buddypress' ) ); ?></span></p>
+						</div>
+
+					</div>
+
+					<?php do_action( 'bp_after_blog_post' ) ?>
+
+				<?php endwhile; ?>
+
+				<div class="navigation">
+
+					<div class="alignleft"><?php next_posts_link( __( '&larr; Previous Entries', 'buddypress' ) ) ?></div>
+					<div class="alignright"><?php previous_posts_link( __( 'Next Entries &rarr;', 'buddypress' ) ) ?></div>
+
+				</div>
+
+			<?php else : ?>
+
+				<h2 class="center"><?php _e( 'Not Found', 'buddypress' ) ?></h2>
+				<p class="center"><?php _e( 'Sorry, but you are looking for something that isn\'t here.', 'buddypress' ) ?></p>
+
+				<?php locate_template( array( 'searchform.php' ), true ) ?>
+
+			<?php endif; ?>
+		</div>
+
+		<?php do_action( 'bp_after_blog_home' ) ?>
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer() ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/links.php b/wp-content/plugins/buddypress/bp-themes/bp-default/links.php
new file mode 100644
index 0000000000000000000000000000000000000000..b5439689494c28578f4646c4fcc274145eb499c7
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/links.php
@@ -0,0 +1,29 @@
+<?php
+/*
+Template Name: Links
+*/
+?>
+
+<?php get_header() ?>
+
+	<div id="content">
+		<div class="padder">
+
+		<?php do_action( 'bp_before_blog_links' ) ?>
+
+		<div class="page" id="blog-latest">
+
+			<h2 class="pagetitle"><?php _e( 'Links', 'buddypress' ) ?></h2>
+
+			<ul id="links-list">
+				<?php get_links_list(); ?>
+			</ul>
+
+		</div>
+
+		<?php do_action( 'bp_after_blog_links' ) ?>
+
+		</div>
+	</div>
+
+<?php get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/index.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/index.php
new file mode 100644
index 0000000000000000000000000000000000000000..5fd734c742cabbb35f5a5e7cdcde8a53a0ed1acf
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/index.php
@@ -0,0 +1,60 @@
+<?php get_header() ?>
+
+	<div id="content">
+		<div class="padder">
+
+		<form action="" method="post" id="members-directory-form" class="dir-form">
+
+			<h3><?php _e( 'Members Directory', 'buddypress' ) ?></h3>
+
+			<?php do_action( 'bp_before_directory_members_content' ) ?>
+
+			<div id="members-dir-search" class="dir-search">
+				<?php bp_directory_members_search_form() ?>
+			</div><!-- #members-dir-search -->
+
+			<div class="item-list-tabs">
+				<ul>
+					<li class="selected" id="members-all"><a href="<?php bp_root_domain() ?>"><?php printf( __( 'All Members (%s)', 'buddypress' ), bp_get_total_member_count() ) ?></a></li>
+
+					<?php if ( is_user_logged_in() && function_exists( 'bp_get_total_friend_count' ) && bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?>
+						<li id="members-personal"><a href="<?php echo bp_loggedin_user_domain() . BP_FRIENDS_SLUG . '/my-friends/' ?>"><?php printf( __( 'My Friends (%s)', 'buddypress' ), bp_get_total_friend_count( bp_loggedin_user_id() ) ) ?></a></li>
+					<?php endif; ?>
+
+					<?php do_action( 'bp_members_directory_member_types' ) ?>
+
+					<li id="members-order-select" class="last filter">
+
+						<?php _e( 'Order By:', 'buddypress' ) ?>
+						<select>
+							<option value="active"><?php _e( 'Last Active', 'buddypress' ) ?></option>
+							<option value="newest"><?php _e( 'Newest Registered', 'buddypress' ) ?></option>
+
+							<?php if ( bp_is_active( 'xprofile' ) ) : ?>
+								<option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ) ?></option>
+							<?php endif; ?>
+
+							<?php do_action( 'bp_members_directory_order_options' ) ?>
+						</select>
+					</li>
+				</ul>
+			</div><!-- .item-list-tabs -->
+
+			<div id="members-dir-list" class="members dir-list">
+				<?php locate_template( array( 'members/members-loop.php' ), true ) ?>
+			</div><!-- #members-dir-list -->
+
+			<?php do_action( 'bp_directory_members_content' ) ?>
+
+			<?php wp_nonce_field( 'directory_members', '_wpnonce-member-filter' ) ?>
+
+			<?php do_action( 'bp_after_directory_members_content' ) ?>
+
+		</form><!-- #members-directory-form -->
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer() ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/members-loop.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/members-loop.php
new file mode 100644
index 0000000000000000000000000000000000000000..60a16ac512b1e4daa1328af6946a0c8f29a72893
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/members-loop.php
@@ -0,0 +1,92 @@
+<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_object_filter() */ ?>
+
+<?php do_action( 'bp_before_members_loop' ) ?>
+
+<?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>
+
+	<div id="pag-top" class="pagination">
+
+		<div class="pag-count" id="member-dir-count-top">
+			<?php bp_members_pagination_count() ?>
+		</div>
+
+		<div class="pagination-links" id="member-dir-pag-top">
+			<?php bp_members_pagination_links() ?>
+		</div>
+
+	</div>
+
+	<?php do_action( 'bp_before_directory_members_list' ) ?>
+
+	<ul id="members-list" class="item-list">
+	<?php while ( bp_members() ) : bp_the_member(); ?>
+
+		<li>
+			<div class="item-avatar">
+				<a href="<?php bp_member_permalink() ?>"><?php bp_member_avatar() ?></a>
+			</div>
+
+			<div class="item">
+				<div class="item-title">
+					<a href="<?php bp_member_permalink() ?>"><?php bp_member_name() ?></a>
+
+					<?php if ( bp_get_member_latest_update() ) : ?>
+
+						<span class="update"> - <?php bp_member_latest_update( 'length=10' ) ?></span>
+
+					<?php endif; ?>
+
+				</div>
+
+				<div class="item-meta"><span class="activity"><?php bp_member_last_active() ?></span></div>
+
+				<?php do_action( 'bp_directory_members_item' ) ?>
+
+				<?php
+				 /***
+				  * If you want to show specific profile fields here you can,
+				  * but it'll add an extra query for each member in the loop
+				  * (only one regardless of the number of fields you show):
+				  *
+				  * bp_member_profile_data( 'field=the field name' );
+				  */
+				?>
+			</div>
+
+			<div class="action">
+
+				<?php do_action( 'bp_directory_members_actions' ); ?>
+
+			</div>
+
+			<div class="clear"></div>
+		</li>
+
+	<?php endwhile; ?>
+	</ul>
+
+	<?php do_action( 'bp_after_directory_members_list' ) ?>
+
+	<?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">
+		<p><?php _e( "Sorry, no members were found.", 'buddypress' ) ?></p>
+	</div>
+
+<?php endif; ?>
+
+<?php do_action( 'bp_after_members_loop' ) ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/activity.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/activity.php
new file mode 100644
index 0000000000000000000000000000000000000000..4370ca1ab791ad7a016b166069b033d0adde89cd
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/activity.php
@@ -0,0 +1,50 @@
+<div class="item-list-tabs no-ajax" id="subnav">
+	<ul>
+		<?php bp_get_options_nav() ?>
+
+		<li id="activity-filter-select" class="last">
+			<select>
+				<option value="-1"><?php _e( 'No Filter', 'buddypress' ) ?></option>
+				<option value="activity_update"><?php _e( 'Show Updates', 'buddypress' ) ?></option>
+
+				<?php if ( 'groups' != bp_current_action() ) : ?>
+					<?php if ( bp_is_active( 'blogs' ) ) : ?>
+						<option value="new_blog_post"><?php _e( 'Show Blog Posts', 'buddypress' ) ?></option>
+						<option value="new_blog_comment"><?php _e( 'Show Blog Comments', 'buddypress' ) ?></option>
+					<?php endif; ?>
+
+					<?php if ( bp_is_active( 'friends' ) ) : ?>
+						<option value="friendship_accepted,friendship_created"><?php _e( 'Show Friendship Connections', 'buddypress' ) ?></option>
+					<?php endif; ?>
+				<?php endif; ?>
+
+				<?php if ( bp_is_active( 'forums' ) ) : ?>
+					<option value="new_forum_topic"><?php _e( 'Show New Forum Topics', 'buddypress' ) ?></option>
+					<option value="new_forum_post"><?php _e( 'Show Forum Replies', 'buddypress' ) ?></option>
+				<?php endif; ?>
+
+				<?php if ( bp_is_active( 'groups' ) ) : ?>
+					<option value="created_group"><?php _e( 'Show New Groups', 'buddypress' ) ?></option>
+					<option value="joined_group"><?php _e( 'Show New Group Memberships', 'buddypress' ) ?></option>
+				<?php endif; ?>
+
+				<?php do_action( 'bp_member_activity_filter_options' ) ?>
+			</select>
+		</li>
+	</ul>
+</div><!-- .item-list-tabs -->
+
+<?php do_action( 'bp_before_member_activity_post_form' ) ?>
+
+<?php if ( is_user_logged_in() && bp_is_my_profile() && ( '' == bp_current_action() || 'just-me' == bp_current_action() ) ) : ?>
+	<?php locate_template( array( 'activity/post-form.php'), true ) ?>
+<?php endif; ?>
+
+<?php do_action( 'bp_after_member_activity_post_form' ) ?>
+<?php do_action( 'bp_before_member_activity_content' ) ?>
+
+<div class="activity">
+	<?php locate_template( array( 'activity/activity-loop.php' ), true ) ?>
+</div><!-- .activity -->
+
+<?php do_action( 'bp_after_member_activity_content' ) ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/activity/permalink.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/activity/permalink.php
new file mode 100644
index 0000000000000000000000000000000000000000..f55cf33857c3ea9ab71262929d5dff4c0bd3f721
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/activity/permalink.php
@@ -0,0 +1,17 @@
+<?php get_header() ?>
+
+<div class="activity no-ajax">
+	<?php if ( bp_has_activities( 'display_comments=threaded&include=' . bp_current_action() ) ) : ?>
+
+		<ul id="activity-stream" class="activity-list item-list">
+		<?php while ( bp_activities() ) : bp_the_activity(); ?>
+
+			<?php locate_template( array( 'activity/entry.php' ), true ) ?>
+
+		<?php endwhile; ?>
+		</ul>
+
+	<?php endif; ?>
+</div>
+
+<?php get_footer() ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/blogs.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/blogs.php
new file mode 100644
index 0000000000000000000000000000000000000000..6e134228785c2014014f563b91df2162d206e72a
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/blogs.php
@@ -0,0 +1,24 @@
+<div class="item-list-tabs" id="subnav">
+	<ul>
+		<?php bp_get_options_nav() ?>
+
+		<li id="blogs-order-select" class="last filter">
+			<?php _e( 'Order By:', 'buddypress' ) ?>
+			<select id="blogs-all">
+				<option value="active"><?php _e( 'Last Active', 'buddypress' ) ?></option>
+				<option value="newest"><?php _e( 'Newest', 'buddypress' ) ?></option>
+				<option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ) ?></option>
+
+				<?php do_action( 'bp_member_blog_order_options' ) ?>
+			</select>
+		</li>
+	</ul>
+</div><!-- .item-list-tabs -->
+
+<?php do_action( 'bp_before_member_blogs_content' ) ?>
+
+<div class="blogs myblogs">
+	<?php locate_template( array( 'blogs/blogs-loop.php' ), true ) ?>
+</div><!-- .blogs.myblogs -->
+
+<?php do_action( 'bp_after_member_blogs_content' ) ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/friends.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/friends.php
new file mode 100644
index 0000000000000000000000000000000000000000..4d499cd3a531a99dbf2997eac91af7fa80ab68a8
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/friends.php
@@ -0,0 +1,34 @@
+<div class="item-list-tabs no-ajax" id="subnav">
+	<ul>
+		<?php if ( bp_is_my_profile() ) : ?>
+			<?php bp_get_options_nav() ?>
+		<?php endif; ?>
+
+		<li id="members-order-select" class="last filter">
+
+			<?php _e( 'Order By:', 'buddypress' ) ?>
+			<select id="members-all">
+				<option value="active"><?php _e( 'Last Active', 'buddypress' ) ?></option>
+				<option value="newest"><?php _e( 'Newest Registered', 'buddypress' ) ?></option>
+				<option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ) ?></option>
+
+				<?php do_action( 'bp_member_blog_order_options' ) ?>
+			</select>
+		</li>
+	</ul>
+</div>
+
+<?php if ( 'requests' == bp_current_action() ) : ?>
+	<?php locate_template( array( 'members/single/friends/requests.php' ), true ) ?>
+
+<?php else : ?>
+
+	<?php do_action( 'bp_before_member_friends_content' ) ?>
+
+	<div class="members friends">
+		<?php locate_template( array( 'members/members-loop.php' ), true ) ?>
+	</div><!-- .members.friends -->
+
+	<?php do_action( 'bp_after_member_friends_content' ) ?>
+
+<?php endif; ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/friends/requests.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/friends/requests.php
new file mode 100644
index 0000000000000000000000000000000000000000..f4b88af2e70ed3a08a501d7a9889615a09b6084e
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/friends/requests.php
@@ -0,0 +1,41 @@
+<?php do_action( 'bp_before_member_friend_requests_content' ) ?>
+
+<?php if ( bp_has_members( 'include=' . bp_get_friendship_requests() . '&per_page=0' ) ) : ?>
+
+	<ul id="friend-list" class="item-list">
+		<?php while ( bp_members() ) : bp_the_member(); ?>
+
+			<li id="friendship-<?php bp_friend_friendship_id() ?>">
+				<div class="item-avatar">
+					<a href="<?php bp_member_link() ?>"><?php bp_member_avatar() ?></a>
+				</div>
+
+				<div class="item">
+					<div class="item-title"><a href="<?php bp_member_link() ?>"><?php bp_member_name() ?></a></div>
+					<div class="item-meta"><span class="activity"><?php bp_member_last_active() ?></span></div>
+				</div>
+
+				<?php do_action( 'bp_friend_requests_item' ) ?>
+
+				<div class="action">
+					<a class="button accept" href="<?php bp_friend_accept_request_link() ?>"><?php _e( 'Accept', 'buddypress' ); ?></a> &nbsp;
+					<a class="button reject" href="<?php bp_friend_reject_request_link() ?>"><?php _e( 'Reject', 'buddypress' ); ?></a>
+
+					<?php do_action( 'bp_friend_requests_item_action' ) ?>
+				</div>
+			</li>
+
+		<?php endwhile; ?>
+	</ul>
+
+	<?php do_action( 'bp_friend_requests_content' ) ?>
+
+<?php else: ?>
+
+	<div id="message" class="info">
+		<p><?php _e( 'You have no pending friendship requests.', 'buddypress' ); ?></p>
+	</div>
+
+<?php endif;?>
+
+<?php do_action( 'bp_after_member_friend_requests_content' ) ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/groups.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/groups.php
new file mode 100644
index 0000000000000000000000000000000000000000..4df84c183263a8833da5712c89cd6716f59dceb4
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/groups.php
@@ -0,0 +1,37 @@
+<div class="item-list-tabs no-ajax" id="subnav">
+	<ul>
+		<?php if ( bp_is_my_profile() ) : ?>
+			<?php bp_get_options_nav() ?>
+		<?php endif; ?>
+
+		<?php if ( 'invites' != bp_current_action() ) : ?>
+		<li id="groups-order-select" class="last filter">
+
+			<?php _e( 'Order By:', 'buddypress' ) ?>
+			<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>
+				<option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ) ?></option>
+
+				<?php do_action( 'bp_member_group_order_options' ) ?>
+			</select>
+		</li>
+		<?php endif; ?>
+	</ul>
+</div><!-- .item-list-tabs -->
+
+<?php if ( 'invites' == bp_current_action() ) : ?>
+	<?php locate_template( array( 'members/single/groups/invites.php' ), true ) ?>
+
+<?php else : ?>
+
+	<?php do_action( 'bp_before_member_groups_content' ) ?>
+
+	<div class="groups mygroups">
+		<?php locate_template( array( 'groups/groups-loop.php' ), true ) ?>
+	</div>
+
+	<?php do_action( 'bp_after_member_groups_content' ) ?>
+
+<?php endif; ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/groups/invites.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/groups/invites.php
new file mode 100644
index 0000000000000000000000000000000000000000..777b153b822cf699f78b067da4a07fc62426dc83
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/groups/invites.php
@@ -0,0 +1,39 @@
+<?php do_action( 'bp_before_group_invites_content' ) ?>
+
+<?php if ( bp_has_groups( 'type=invites&user_id=' . bp_loggedin_user_id() ) ) : ?>
+
+	<ul id="group-list" class="invites item-list">
+
+		<?php while ( bp_groups() ) : bp_the_group(); ?>
+
+			<li>
+				<?php bp_group_avatar_thumb() ?>
+				<h4><a href="<?php bp_group_permalink() ?>"><?php bp_group_name() ?></a><span class="small"> - <?php printf( __( '%s members', 'buddypress' ), bp_group_total_members( false ) ) ?></span></h4>
+
+				<p class="desc">
+					<?php bp_group_description_excerpt() ?>
+				</p>
+
+				<?php do_action( 'bp_group_invites_item' ) ?>
+
+				<div class="action">
+					<a class="button accept" href="<?php bp_group_accept_invite_link() ?>"><?php _e( 'Accept', 'buddypress' ) ?></a> &nbsp;
+					<a class="button reject confirm" href="<?php bp_group_reject_invite_link() ?>"><?php _e( 'Reject', 'buddypress' ) ?></a>
+
+					<?php do_action( 'bp_group_invites_item_action' ) ?>
+
+				</div>
+			</li>
+
+		<?php endwhile; ?>
+	</ul>
+
+<?php else: ?>
+
+	<div id="message" class="info">
+		<p><?php _e( 'You have no outstanding group invites.', 'buddypress' ) ?></p>
+	</div>
+
+<?php endif;?>
+
+<?php do_action( 'bp_after_group_invites_content' ) ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/home.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/home.php
new file mode 100644
index 0000000000000000000000000000000000000000..647895e839f1bd0d20c7794b38959c95604c8692
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/home.php
@@ -0,0 +1,61 @@
+<?php get_header() ?>
+
+	<div id="content">
+		<div class="padder">
+
+			<?php do_action( 'bp_before_member_home_content' ) ?>
+
+			<div id="item-header">
+				<?php locate_template( array( 'members/single/member-header.php' ), true ) ?>
+			</div><!-- #item-header -->
+
+			<div id="item-nav">
+				<div class="item-list-tabs no-ajax" id="object-nav">
+					<ul>
+						<?php bp_get_displayed_user_nav() ?>
+
+						<?php do_action( 'bp_member_options_nav' ) ?>
+					</ul>
+				</div>
+			</div><!-- #item-nav -->
+
+			<div id="item-body">
+				<?php do_action( 'bp_before_member_body' ) ?>
+
+				<?php if ( bp_is_user_activity() || !bp_current_component() ) : ?>
+					<?php locate_template( array( 'members/single/activity.php' ), true ) ?>
+
+				<?php elseif ( bp_is_user_blogs() ) : ?>
+					<?php locate_template( array( 'members/single/blogs.php' ), true ) ?>
+
+				<?php elseif ( bp_is_user_friends() ) : ?>
+					<?php locate_template( array( 'members/single/friends.php' ), true ) ?>
+
+				<?php elseif ( bp_is_user_groups() ) : ?>
+					<?php locate_template( array( 'members/single/groups.php' ), true ) ?>
+
+				<?php elseif ( bp_is_user_messages() ) : ?>
+					<?php locate_template( array( 'members/single/messages.php' ), true ) ?>
+
+				<?php elseif ( bp_is_user_profile() ) : ?>
+					<?php locate_template( array( 'members/single/profile.php' ), true ) ?>
+
+				<?php else : ?>
+					<?php
+						/* If nothing sticks, just load a member front template if one exists. */
+						locate_template( array( 'members/single/front.php' ), true );
+					?>
+				<?php endif; ?>
+
+				<?php do_action( 'bp_after_member_body' ) ?>
+
+			</div><!-- #item-body -->
+
+			<?php do_action( 'bp_after_member_home_content' ) ?>
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer() ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/member-header.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/member-header.php
new file mode 100644
index 0000000000000000000000000000000000000000..e58766cc3a0a335ae7f7c76217b812b8d45038b5
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/member-header.php
@@ -0,0 +1,44 @@
+<?php do_action( 'bp_before_member_header' ) ?>
+
+<div id="item-header-avatar">
+	<a href="<?php bp_user_link() ?>">
+		<?php bp_displayed_user_avatar( 'type=full' ) ?>
+	</a>
+</div><!-- #item-header-avatar -->
+
+<div id="item-header-content">
+
+	<h2 class="fn"><a href="<?php bp_displayed_user_link() ?>"><?php bp_displayed_user_fullname() ?></a> <span class="highlight">@<?php bp_displayed_user_username() ?> <span>?</span></span></h2>
+	<span class="activity"><?php bp_last_activity( bp_displayed_user_id() ) ?></span>
+
+	<?php do_action( 'bp_before_member_header_meta' ) ?>
+
+	<div id="item-meta">
+		<?php if ( function_exists( 'bp_activity_latest_update' ) ) : ?>
+			<div id="latest-update">
+				<?php bp_activity_latest_update( bp_displayed_user_id() ) ?>
+			</div>
+		<?php endif; ?>
+
+		<div id="item-buttons">
+
+			<?php do_action( 'bp_member_header_actions' ); ?>
+
+		</div><!-- #item-buttons -->
+
+		<?php
+		 /***
+		  * If you'd like to show specific profile fields here use:
+		  * bp_profile_field_data( 'field=About Me' ); -- Pass the name of the field
+		  */
+		?>
+
+		<?php do_action( 'bp_profile_header_meta' ) ?>
+
+	</div><!-- #item-meta -->
+
+</div><!-- #item-header-content -->
+
+<?php do_action( 'bp_after_member_header' ) ?>
+
+<?php do_action( 'template_notices' ) ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/messages.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/messages.php
new file mode 100644
index 0000000000000000000000000000000000000000..2c3ef6b0aa21965e129fa73e1965896adf4f40e3
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/messages.php
@@ -0,0 +1,29 @@
+<div class="item-list-tabs no-ajax" id="subnav">
+	<ul>
+		<?php bp_get_options_nav() ?>
+	</ul>
+</div><!-- .item-list-tabs -->
+
+<?php if ( 'compose' == bp_current_action() ) : ?>
+	<?php locate_template( array( 'members/single/messages/compose.php' ), true ) ?>
+
+<?php elseif ( 'view' == bp_current_action() ) : ?>
+	<?php locate_template( array( 'members/single/messages/single.php' ), true ) ?>
+
+<?php else : ?>
+
+	<?php do_action( 'bp_before_member_messages_content' ) ?>
+
+	<div class="messages">
+		<?php if ( 'notices' == bp_current_action() ) : ?>
+			<?php locate_template( array( 'members/single/messages/notices-loop.php' ), true ) ?>
+
+		<?php else : ?>
+			<?php locate_template( array( 'members/single/messages/messages-loop.php' ), true ) ?>
+
+		<?php endif; ?>
+	</div><!-- .messages -->
+
+	<?php do_action( 'bp_after_member_messages_content' ) ?>
+
+<?php endif; ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/messages/compose.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/messages/compose.php
new file mode 100644
index 0000000000000000000000000000000000000000..3fc3720467dcefb4ec1361f4bb2796b1293c7267
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/messages/compose.php
@@ -0,0 +1,38 @@
+<form action="<?php bp_messages_form_action('compose') ?>" method="post" id="send_message_form" class="standard-form">
+
+	<?php do_action( 'bp_before_messages_compose_content' ) ?>
+
+	<label for="send-to-input"><?php _e("Send To (Username or Friend's Name)", 'buddypress') ?> &nbsp; <span class="ajax-loader"></span></label>
+	<ul class="first acfb-holder">
+		<li>
+			<?php bp_message_get_recipient_tabs() ?>
+			<input type="text" name="send-to-input" class="send-to-input" id="send-to-input" />
+		</li>
+	</ul>
+
+	<?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; ?>
+
+	<label for="subject"><?php _e( 'Subject', 'buddypress') ?></label>
+	<input type="text" name="subject" id="subject" value="<?php bp_messages_subject_value() ?>" />
+
+	<label for="content"><?php _e( 'Message', 'buddypress') ?></label>
+	<textarea name="content" id="message_content" rows="15" cols="40"><?php bp_messages_content_value() ?></textarea>
+
+	<input type="hidden" name="send_to_usernames" id="send-to-usernames" value="<?php bp_message_get_recipient_usernames(); ?>" class="<?php bp_message_get_recipient_usernames() ?>" />
+
+	<?php do_action( 'bp_after_messages_compose_content' ) ?>
+
+	<div class="submit">
+		<input type="submit" value="<?php _e( "Send Message", 'buddypress' ) ?> &rarr;" name="send" id="send" />
+		<span class="ajax-loader"></span>
+	</div>
+
+	<?php wp_nonce_field( 'messages_send_message' ) ?>
+</form>
+
+<script type="text/javascript">
+	document.getElementById("send-to-input").focus();
+</script>
+
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/messages/messages-loop.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/messages/messages-loop.php
new file mode 100644
index 0000000000000000000000000000000000000000..576a8311c24c6b91734ce248c6cc69b8c2e3c2d6
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/messages/messages-loop.php
@@ -0,0 +1,73 @@
+<?php do_action( 'bp_before_member_messages_loop' ) ?>
+
+<?php if ( bp_has_message_threads() ) : ?>
+
+	<div class="pagination no-ajax" id="user-pag">
+
+		<div class="pag-count" id="messages-dir-count">
+			<?php bp_messages_pagination_count() ?>
+		</div>
+
+		<div class="pagination-links" id="messages-dir-pag">
+			<?php bp_messages_pagination() ?>
+		</div>
+
+	</div><!-- .pagination -->
+
+	<?php do_action( 'bp_after_member_messages_pagination' ) ?>
+	<?php do_action( 'bp_before_member_messages_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; ?>>
+				<td width="1%" class="thread-count">
+					<span class="unread-count"><?php bp_message_thread_unread_count() ?></span>
+				</td>
+				<td width="1%" class="thread-avatar"><?php bp_message_thread_avatar() ?></td>
+
+				<?php if ( 'sentbox' != bp_current_action() ) : ?>
+					<td width="30%" class="thread-from">
+						<?php _e( 'From:', 'buddypress' ); ?> <?php bp_message_thread_from() ?><br />
+						<span class="activity"><?php bp_message_thread_last_post_date() ?></span>
+					</td>
+				<?php else: ?>
+					<td width="30%" class="thread-from">
+						<?php _e( 'To:', 'buddypress' ); ?> <?php bp_message_thread_to() ?><br />
+						<span class="activity"><?php bp_message_thread_last_post_date() ?></span>
+					</td>
+				<?php endif; ?>
+
+				<td width="50%" class="thread-info">
+					<p><a href="<?php bp_message_thread_view_link() ?>" title="<?php _e( "View Message", "buddypress" ); ?>"><?php bp_message_thread_subject() ?></a></p>
+					<p class="thread-excerpt"><?php bp_message_thread_excerpt() ?></p>
+				</td>
+
+				<?php do_action( 'bp_messages_inbox_list_item' ) ?>
+
+				<td width="13%" class="thread-options">
+					<input type="checkbox" name="message_ids[]" value="<?php bp_message_thread_id() ?>" />
+					<a class="button confirm" href="<?php bp_message_thread_delete_link() ?>" title="<?php _e( "Delete Message", "buddypress" ); ?>">x</a> &nbsp;
+				</td>
+			</tr>
+
+		<?php endwhile; ?>
+	</table><!-- #message-threads -->
+
+	<div class="messages-options-nav">
+		<?php bp_messages_options() ?>
+	</div><!-- .messages-options-nav -->
+
+	<?php do_action( 'bp_after_member_messages_threads' ) ?>
+
+	<?php do_action( 'bp_after_member_messages_options' ) ?>
+
+<?php else: ?>
+
+	<div id="message" class="info">
+		<p><?php _e( 'Sorry, no messages were found.', 'buddypress' ); ?></p>
+	</div>
+
+<?php endif;?>
+
+<?php do_action( 'bp_after_member_messages_loop' ) ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/messages/notices-loop.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/messages/notices-loop.php
new file mode 100644
index 0000000000000000000000000000000000000000..77702dcb3cd67908710d2f116c52d5471a73a8e7
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/messages/notices-loop.php
@@ -0,0 +1,54 @@
+<?php do_action( 'bp_before_notices_loop' ) ?>
+
+<?php if ( bp_has_message_threads() ) : ?>
+
+	<div class="pagination" id="user-pag">
+
+		<div class="pag-count" id="messages-dir-count">
+			<?php bp_messages_pagination_count() ?>
+		</div>
+
+		<div class="pagination-links" id="messages-dir-pag">
+			<?php bp_messages_pagination() ?>
+		</div>
+
+	</div><!-- .pagination -->
+
+	<?php do_action( 'bp_after_notices_pagination' ) ?>
+	<?php do_action( 'bp_before_notices' ) ?>
+
+	<table id="message-threads" class="zebra">
+		<?php while ( bp_message_threads() ) : bp_message_thread(); ?>
+			<tr>
+				<td width="1%">
+				</td>
+				<td width="38%">
+					<strong><?php bp_message_notice_subject() ?></strong>
+					<?php bp_message_notice_text() ?>
+				</td>
+				<td width="21%">
+					<strong><?php bp_message_is_active_notice() ?></strong>
+					<span class="activity"><?php _e("Sent:", "buddypress"); ?> <?php bp_message_notice_post_date() ?></span>
+				</td>
+
+				<?php do_action( 'bp_notices_list_item' ) ?>
+
+				<td width="10%">
+					<a class="button" href="<?php bp_message_activate_deactivate_link() ?>" class="confirm"><?php bp_message_activate_deactivate_text() ?></a>
+					<a class="button" href="<?php bp_message_notice_delete_link() ?>" class="confirm" title="<?php _e( "Delete Message", "buddypress" ); ?>">x</a>
+				</td>
+			</tr>
+		<?php endwhile; ?>
+	</table><!-- #message-threads -->
+
+	<?php do_action( 'bp_after_notices' ) ?>
+
+<?php else: ?>
+
+	<div id="message" class="info">
+		<p><?php _e( 'Sorry, no notices were found.', 'buddypress' ); ?></p>
+	</div>
+
+<?php endif;?>
+
+<?php do_action( 'bp_after_notices_loop' ) ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/messages/single.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/messages/single.php
new file mode 100644
index 0000000000000000000000000000000000000000..0dbce0ce12aaf74a690ac087e01bf273bf9b462c
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/messages/single.php
@@ -0,0 +1,98 @@
+<div id="message-thread">
+
+	<?php do_action( 'bp_before_message_thread_content' ) ?>
+
+	<?php if ( bp_thread_has_messages() ) : ?>
+
+		<h3 id="message-subject"><?php bp_the_thread_subject() ?></h3>
+
+		<p id="message-recipients">
+			<span class="highlight">
+				<?php printf( __('Sent between %s and %s', 'buddypress'), bp_get_the_thread_recipients(), '<a href="' . bp_get_loggedin_user_link() . '" title="' . bp_get_loggedin_user_fullname() . '">' . bp_get_loggedin_user_fullname() . '</a>' ) ?>
+			</span>
+		</p>
+
+		<?php do_action( 'bp_before_message_thread_list' ) ?>
+
+		<?php while ( bp_thread_messages() ) : bp_thread_the_message(); ?>
+
+			<div class="message-box">
+
+				<div class="message-metadata">
+
+					<?php do_action( 'bp_before_message_meta' ) ?>
+
+					<?php bp_the_thread_message_sender_avatar( 'type=thumb&width=30&height=30' ) ?>
+					<strong><a href="<?php bp_the_thread_message_sender_link() ?>" title="<?php bp_the_thread_message_sender_name() ?>"><?php bp_the_thread_message_sender_name() ?></a> <span class="activity"><?php bp_the_thread_message_time_since() ?></span></strong>
+
+					<?php do_action( 'bp_after_message_meta' ) ?>
+
+				</div><!-- .message-metadata -->
+
+				<?php do_action( 'bp_before_message_content' ) ?>
+
+				<div class="message-content">
+
+					<?php bp_the_thread_message_content() ?>
+
+				</div><!-- .message-content -->
+
+				<?php do_action( 'bp_after_message_content' ) ?>
+
+				<div class="clear"></div>
+
+			</div><!-- .message-box -->
+
+		<?php endwhile; ?>
+
+		<?php do_action( 'bp_after_message_thread_list' ) ?>
+
+		<?php do_action( 'bp_before_message_thread_reply' ) ?>
+
+		<form id="send-reply" action="<?php bp_messages_form_action() ?>" method="post" class="standard-form">
+
+			<div class="message-box">
+
+				<div class="message-metadata">
+
+					<?php do_action( 'bp_before_message_meta' ) ?>
+
+					<div class="avatar-box">
+						<?php bp_loggedin_user_avatar( 'type=thumb&height=30&width=30' ) ?>
+
+						<strong><?php _e( 'Send a Reply', 'buddypress' ) ?></strong>
+					</div>
+
+					<?php do_action( 'bp_after_message_meta' ) ?>
+
+				</div><!-- .message-metadata -->
+
+				<div class="message-content">
+
+					<?php do_action( 'bp_before_message_reply_box' ) ?>
+
+					<textarea name="content" id="message_content" rows="15" cols="40"></textarea>
+
+					<?php do_action( 'bp_after_message_reply_box' ) ?>
+
+					<div class="submit">
+						<input type="submit" name="send" value="<?php _e( 'Send Reply', 'buddypress' ) ?> &rarr;" id="send_reply_button"/>
+						<span class="ajax-loader"></span>
+					</div>
+
+					<input type="hidden" id="thread_id" name="thread_id" value="<?php bp_the_thread_id(); ?>" />
+					<?php wp_nonce_field( 'messages_send_message', 'send_message_nonce' ) ?>
+
+				</div><!-- .message-content -->
+
+			</div><!-- .message-box -->
+
+		</form><!-- #send-reply -->
+
+		<?php do_action( 'bp_after_message_thread_reply' ) ?>
+
+	<?php endif; ?>
+
+	<?php do_action( 'bp_after_message_thread_content' ) ?>
+
+</div>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/plugins.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/plugins.php
new file mode 100644
index 0000000000000000000000000000000000000000..67ef4ce90202cca561d344a4879f8c11768fecfd
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/plugins.php
@@ -0,0 +1,48 @@
+<?php get_header() ?>
+
+	<div id="content">
+		<div class="padder">
+
+			<?php do_action( 'bp_before_member_plugin_template' ) ?>
+
+			<div id="item-header">
+				<?php locate_template( array( 'members/single/member-header.php' ), true ) ?>
+			</div><!-- #item-header -->
+
+			<div id="item-nav">
+				<div class="item-list-tabs no-ajax" id="object-nav">
+					<ul>
+						<?php bp_get_displayed_user_nav() ?>
+
+						<?php do_action( 'bp_member_options_nav' ) ?>
+					</ul>
+				</div>
+			</div><!-- #item-nav -->
+
+			<div id="item-body">
+				<?php do_action( 'bp_before_member_body' ) ?>
+
+				<div class="item-list-tabs no-ajax" id="subnav">
+					<ul>
+						<?php bp_get_options_nav() ?>
+
+						<?php do_action( 'bp_member_plugin_options_nav' ) ?>
+					</ul>
+				</div><!-- .item-list-tabs -->
+
+				<?php do_action( 'bp_template_title' ) ?>
+
+				<?php do_action( 'bp_template_content' ) ?>
+
+				<?php do_action( 'bp_after_member_body' ) ?>
+
+			</div><!-- #item-body -->
+
+			<?php do_action( 'bp_after_member_plugin_template' ) ?>
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer() ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/profile.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/profile.php
new file mode 100644
index 0000000000000000000000000000000000000000..4118c3a4df3df3550d1a572b4c474c0ff6286754
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/profile.php
@@ -0,0 +1,24 @@
+<?php if ( bp_is_my_profile() ) : ?>
+	<div class="item-list-tabs no-ajax" id="subnav">
+		<ul>
+			<?php bp_get_options_nav() ?>
+		</ul>
+	</div><!-- .item-list-tabs -->
+<?php endif; ?>
+
+<?php do_action( 'bp_before_profile_content' ) ?>
+
+<div class="profile">
+	<?php if ( 'edit' == bp_current_action() ) : ?>
+		<?php locate_template( array( 'members/single/profile/edit.php' ), true ) ?>
+
+	<?php elseif ( 'change-avatar' == bp_current_action() ) : ?>
+		<?php locate_template( array( 'members/single/profile/change-avatar.php' ), true ) ?>
+
+	<?php else : ?>
+		<?php locate_template( array( 'members/single/profile/profile-loop.php' ), true ) ?>
+
+	<?php endif; ?>
+</div><!-- .profile -->
+
+<?php do_action( 'bp_after_profile_content' ) ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/profile/change-avatar.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/profile/change-avatar.php
new file mode 100644
index 0000000000000000000000000000000000000000..6e6a0527b2c6775b06a13415f81638d579363365
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/profile/change-avatar.php
@@ -0,0 +1,60 @@
+<h4><?php _e( 'Change Avatar', 'buddypress' ) ?></h4>
+
+<?php do_action( 'bp_before_profile_avatar_upload_content' ) ?>
+
+<?php if ( !(int)bp_get_option( 'bp-disable-avatar-uploads' ) ) : ?>
+
+	<p><?php _e( 'Your avatar will be used on your profile and throughout the site. If there is a <a href="http://gravatar.com">Gravatar</a> associated with your account email we will use that, or you can upload an image from your computer.', 'buddypress') ?></p>
+
+	<form action="" method="post" id="avatar-upload-form" enctype="multipart/form-data">
+
+		<?php if ( 'upload-image' == bp_get_avatar_admin_step() ) : ?>
+
+			<p><?php _e( 'Click below to select a JPG, GIF or PNG format photo from your computer and then click \'Upload Image\' to proceed.', 'buddypress' ) ?></p>
+
+			<p id="avatar-upload">
+				<input type="file" name="file" id="file" />
+				<input type="submit" name="upload" id="upload" value="<?php _e( 'Upload Image', 'buddypress' ) ?>" />
+				<input type="hidden" name="action" id="action" value="bp_avatar_upload" />
+			</p>
+
+			<?php if ( bp_get_user_has_avatar() ) : ?>
+				<p><?php _e( "If you'd like to delete your current avatar but not upload a new one, please use the delete avatar button.", 'buddypress' ) ?></p>
+				<p><a class="button edit" href="<?php bp_avatar_delete_link() ?>" title="<?php _e( 'Delete Avatar', 'buddypress' ) ?>"><?php _e( 'Delete My Avatar', 'buddypress' ) ?></a></p>
+			<?php endif; ?>
+
+			<?php wp_nonce_field( 'bp_avatar_upload' ) ?>
+
+		<?php endif; ?>
+
+		<?php if ( 'crop-image' == bp_get_avatar_admin_step() ) : ?>
+
+			<h5><?php _e( 'Crop Your New Avatar', 'buddypress' ) ?></h5>
+
+			<img src="<?php bp_avatar_to_crop() ?>" id="avatar-to-crop" class="avatar" alt="<?php _e( 'Avatar to crop', 'buddypress' ) ?>" />
+
+			<div id="avatar-crop-pane">
+				<img src="<?php bp_avatar_to_crop() ?>" id="avatar-crop-preview" class="avatar" alt="<?php _e( 'Avatar preview', 'buddypress' ) ?>" />
+			</div>
+
+			<input type="submit" name="avatar-crop-submit" id="avatar-crop-submit" value="<?php _e( 'Crop Image', 'buddypress' ) ?>" />
+
+			<input type="hidden" name="image_src" id="image_src" value="<?php bp_avatar_to_crop_src() ?>" />
+			<input type="hidden" id="x" name="x" />
+			<input type="hidden" id="y" name="y" />
+			<input type="hidden" id="w" name="w" />
+			<input type="hidden" id="h" name="h" />
+
+			<?php wp_nonce_field( 'bp_avatar_cropstore' ) ?>
+
+		<?php endif; ?>
+
+	</form>
+
+<?php else : ?>
+
+	<p><?php _e( 'Your avatar will be used on your profile and throughout the site. To change your avatar, please create an account with <a href="http://gravatar.com">Gravatar</a> using the same email address as you used to register with this site.', 'buddypress' ) ?></p>
+
+<?php endif; ?>
+
+<?php do_action( 'bp_after_profile_avatar_upload_content' ) ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/profile/edit.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/profile/edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..cab1c71639f8ff64d0d5694e638794e4d08978fa
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/profile/edit.php
@@ -0,0 +1,121 @@
+<?php do_action( 'bp_before_profile_edit_content' ) ?>
+
+<?php if ( bp_has_profile( 'profile_group_id=' . bp_get_current_profile_group_id() ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
+
+<form action="<?php bp_the_profile_group_edit_form_action() ?>" method="post" id="profile-edit-form" class="standard-form <?php bp_the_profile_group_slug() ?>">
+
+	<?php do_action( 'bp_before_profile_field_content' ) ?>
+
+		<h4><?php printf( __( "Editing '%s' Profile Group", "buddypress" ), bp_get_the_profile_group_name() ); ?></h4>
+
+		<ul class="button-nav">
+			<?php bp_profile_group_tabs(); ?>
+		</ul>
+
+		<div class="clear"></div>
+
+		<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
+
+			<div<?php bp_field_css_class( 'editfield' ) ?>>
+
+				<?php if ( 'textbox' == bp_get_the_profile_field_type() ) : ?>
+
+					<label for="<?php bp_the_profile_field_input_name() ?>"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></label>
+					<input type="text" name="<?php bp_the_profile_field_input_name() ?>" id="<?php bp_the_profile_field_input_name() ?>" value="<?php bp_the_profile_field_edit_value() ?>" />
+
+				<?php endif; ?>
+
+				<?php if ( 'textarea' == bp_get_the_profile_field_type() ) : ?>
+
+					<label for="<?php bp_the_profile_field_input_name() ?>"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></label>
+					<textarea rows="5" cols="40" name="<?php bp_the_profile_field_input_name() ?>" id="<?php bp_the_profile_field_input_name() ?>"><?php bp_the_profile_field_edit_value() ?></textarea>
+
+				<?php endif; ?>
+
+				<?php if ( 'selectbox' == bp_get_the_profile_field_type() ) : ?>
+
+					<label for="<?php bp_the_profile_field_input_name() ?>"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></label>
+					<select name="<?php bp_the_profile_field_input_name() ?>" id="<?php bp_the_profile_field_input_name() ?>">
+						<?php bp_the_profile_field_options() ?>
+					</select>
+
+				<?php endif; ?>
+
+				<?php if ( 'multiselectbox' == bp_get_the_profile_field_type() ) : ?>
+
+					<label for="<?php bp_the_profile_field_input_name() ?>"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></label>
+					<select name="<?php bp_the_profile_field_input_name() ?>" id="<?php bp_the_profile_field_input_name() ?>" multiple="multiple">
+						<?php bp_the_profile_field_options() ?>
+					</select>
+
+					<?php if ( !bp_get_the_profile_field_is_required() ) : ?>
+						<a class="clear-value" href="javascript:clear( '<?php bp_the_profile_field_input_name() ?>' );"><?php _e( 'Clear', 'buddypress' ) ?></a>
+					<?php endif; ?>
+
+				<?php endif; ?>
+
+				<?php if ( 'radio' == bp_get_the_profile_field_type() ) : ?>
+
+					<div class="radio">
+						<span class="label"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></span>
+
+						<?php bp_the_profile_field_options() ?>
+
+						<?php if ( !bp_get_the_profile_field_is_required() ) : ?>
+							<a class="clear-value" href="javascript:clear( '<?php bp_the_profile_field_input_name() ?>' );"><?php _e( 'Clear', 'buddypress' ) ?></a>
+						<?php endif; ?>
+					</div>
+
+				<?php endif; ?>
+
+				<?php if ( 'checkbox' == bp_get_the_profile_field_type() ) : ?>
+
+					<div class="checkbox">
+						<span class="label"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></span>
+
+						<?php bp_the_profile_field_options() ?>
+					</div>
+
+				<?php endif; ?>
+
+				<?php if ( 'datebox' == bp_get_the_profile_field_type() ) : ?>
+
+					<div class="datebox">
+						<label for="<?php bp_the_profile_field_input_name() ?>_day"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></label>
+
+						<select name="<?php bp_the_profile_field_input_name() ?>_day" id="<?php bp_the_profile_field_input_name() ?>_day">
+							<?php bp_the_profile_field_options( 'type=day' ) ?>
+						</select>
+
+						<select name="<?php bp_the_profile_field_input_name() ?>_month" id="<?php bp_the_profile_field_input_name() ?>_month">
+							<?php bp_the_profile_field_options( 'type=month' ) ?>
+						</select>
+
+						<select name="<?php bp_the_profile_field_input_name() ?>_year" id="<?php bp_the_profile_field_input_name() ?>_year">
+							<?php bp_the_profile_field_options( 'type=year' ) ?>
+						</select>
+					</div>
+
+				<?php endif; ?>
+
+				<?php do_action( 'bp_custom_profile_edit_fields' ) ?>
+
+				<p class="description"><?php bp_the_profile_field_description() ?></p>
+			</div>
+
+		<?php endwhile; ?>
+
+	<?php do_action( 'bp_after_profile_field_content' ) ?>
+
+	<div class="submit">
+		<input type="submit" name="profile-group-edit-submit" id="profile-group-edit-submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?> " />
+	</div>
+
+	<input type="hidden" name="field_ids" id="field_ids" value="<?php bp_the_profile_group_field_ids() ?>" />
+	<?php wp_nonce_field( 'bp_xprofile_edit' ) ?>
+
+</form>
+
+<?php endwhile; endif; ?>
+
+<?php do_action( 'bp_after_profile_edit_content' ) ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/profile/profile-loop.php b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/profile/profile-loop.php
new file mode 100644
index 0000000000000000000000000000000000000000..d2459aa01a34da761aa27bd2c9a971712c16a4b3
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/profile/profile-loop.php
@@ -0,0 +1,59 @@
+<?php do_action( 'bp_before_profile_loop_content' ) ?>
+
+<?php if ( function_exists('xprofile_get_profile') ) : ?>
+
+	<?php if ( bp_has_profile() ) : ?>
+
+		<?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
+
+			<?php if ( bp_profile_group_has_fields() ) : ?>
+
+				<?php do_action( 'bp_before_profile_field_content' ) ?>
+
+				<div class="bp-widget <?php bp_the_profile_group_slug() ?>">
+					<?php if ( 1 != bp_get_the_profile_group_id() ) : ?>
+						<h4><?php bp_the_profile_group_name() ?></h4>
+					<?php endif; ?>
+
+					<table class="profile-fields zebra">
+						<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
+
+							<?php if ( bp_field_has_data() ) : ?>
+								<tr<?php bp_field_css_class() ?>>
+
+									<td class="label">
+										<?php bp_the_profile_field_name() ?>
+									</td>
+
+									<td class="data">
+										<?php bp_the_profile_field_value() ?>
+									</td>
+
+								</tr>
+							<?php endif; ?>
+
+							<?php do_action( 'bp_profile_field_item' ) ?>
+
+						<?php endwhile; ?>
+					</table>
+				</div>
+
+				<?php do_action( 'bp_after_profile_field_content' ) ?>
+
+			<?php endif; ?>
+
+		<?php endwhile; ?>
+
+		<?php do_action( 'bp_profile_field_buttons' ) ?>
+
+	<?php endif; ?>
+
+<?php else : ?>
+
+	<?php /* Just load the standard WP profile information, if BP extended profiles are not loaded. */ ?>
+	<?php bp_core_get_wp_profile() ?>
+
+<?php endif; ?>
+
+<?php do_action( 'bp_after_profile_loop_content' ) ?>
+
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/page.php b/wp-content/plugins/buddypress/bp-themes/bp-default/page.php
new file mode 100644
index 0000000000000000000000000000000000000000..b64c7c4110fd0b84fc2015da3f5bec6a2ca10667
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/page.php
@@ -0,0 +1,38 @@
+<?php get_header() ?>
+
+	<div id="content">
+		<div class="padder">
+
+		<?php do_action( 'bp_before_blog_page' ) ?>
+
+		<div class="page" id="blog-page">
+
+			<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
+
+				<h2 class="pagetitle"><?php the_title(); ?></h2>
+
+				<div class="post" id="post-<?php the_ID(); ?>">
+
+					<div class="entry">
+
+						<?php the_content( __( '<p class="serif">Read the rest of this page &rarr;</p>', 'buddypress' ) ); ?>
+
+						<?php wp_link_pages( array( 'before' => __( '<p><strong>Pages:</strong> ', 'buddypress' ), 'after' => '</p>', 'next_or_number' => 'number')); ?>
+						<?php edit_post_link( __( 'Edit this entry.', 'buddypress' ), '<p>', '</p>'); ?>
+
+					</div>
+
+				</div>
+
+			<?php endwhile; endif; ?>
+
+		</div><!-- .page -->
+
+		<?php do_action( 'bp_after_blog_page' ) ?>
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/registration/activate.php b/wp-content/plugins/buddypress/bp-themes/bp-default/registration/activate.php
new file mode 100644
index 0000000000000000000000000000000000000000..fb20fd087162c6d12f846d5fbad9657e6e5c050d
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/registration/activate.php
@@ -0,0 +1,58 @@
+<?php /* This template is only used on multisite installations */ ?>
+
+<?php get_header(); ?>
+
+	<div id="content">
+		<div class="padder">
+
+		<?php do_action( 'bp_before_activation_page' ) ?>
+
+		<div class="page" id="activate-page">
+
+			<?php do_action( 'template_notices' ) ?>
+
+			<?php if ( bp_account_was_activated() ) : ?>
+
+				<h2 class="widgettitle"><?php _e( 'Account Activated', 'buddypress' ) ?></h2>
+
+				<?php do_action( 'bp_before_activate_content' ) ?>
+
+				<?php if ( isset( $_GET['e'] ) ) : ?>
+					<p><?php _e( 'Your account was activated successfully! Your account details have been sent to you in a separate email.', 'buddypress' ) ?></p>
+				<?php else : ?>
+					<p><?php _e( 'Your account was activated successfully! You can now log in with the username and password you provided when you signed up.', 'buddypress' ) ?></p>
+				<?php endif; ?>
+
+			<?php else : ?>
+
+				<h3><?php _e( 'Activate your Account', 'buddypress' ) ?></h3>
+
+				<?php do_action( 'bp_before_activate_content' ) ?>
+
+				<p><?php _e( 'Please provide a valid activation key.', 'buddypress' ) ?></p>
+
+				<form action="" method="get" class="standard-form" id="activation-form">
+
+					<label for="key"><?php _e( 'Activation Key:', 'buddypress' ) ?></label>
+					<input type="text" name="key" id="key" value="" />
+
+					<p class="submit">
+						<input type="submit" name="submit" value="<?php _e( 'Activate', 'buddypress' ) ?> &rarr;" />
+					</p>
+
+				</form>
+
+			<?php endif; ?>
+
+			<?php do_action( 'bp_after_activate_content' ) ?>
+
+		</div><!-- .page -->
+
+		<?php do_action( 'bp_after_activation_page' ) ?>
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer(); ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/registration/register.php b/wp-content/plugins/buddypress/bp-themes/bp-default/registration/register.php
new file mode 100644
index 0000000000000000000000000000000000000000..d50d195851b969f0a711f43c53fa874f7e4e4f74
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/registration/register.php
@@ -0,0 +1,310 @@
+<?php get_header() ?>
+
+	<div id="content">
+		<div class="padder">
+
+		<?php do_action( 'bp_before_register_page' ) ?>
+
+		<div class="page" id="register-page">
+
+			<form action="" name="signup_form" id="signup_form" class="standard-form" method="post" enctype="multipart/form-data">
+
+			<?php if ( 'request-details' == bp_get_current_signup_step() ) : ?>
+
+				<h2><?php _e( 'Create an Account', 'buddypress' ) ?></h2>
+
+				<?php do_action( 'template_notices' ) ?>
+
+				<p><?php _e( 'Registering for this site is easy, just fill in the fields below and we\'ll get a new account set up for you in no time.', 'buddypress' ) ?></p>
+
+				<?php do_action( 'bp_before_account_details_fields' ) ?>
+
+				<div class="register-section" id="basic-details-section">
+
+					<?php /***** Basic Account Details ******/ ?>
+
+					<h4><?php _e( 'Account Details', 'buddypress' ) ?></h4>
+
+					<label for="signup_username"><?php _e( 'Username', 'buddypress' ) ?> <?php _e( '(required)', 'buddypress' ) ?></label>
+					<?php do_action( 'bp_signup_username_errors' ) ?>
+					<input type="text" name="signup_username" id="signup_username" value="<?php bp_signup_username_value() ?>" />
+
+					<label for="signup_email"><?php _e( 'Email Address', 'buddypress' ) ?> <?php _e( '(required)', 'buddypress' ) ?></label>
+					<?php do_action( 'bp_signup_email_errors' ) ?>
+					<input type="text" name="signup_email" id="signup_email" value="<?php bp_signup_email_value() ?>" />
+
+					<label for="signup_password"><?php _e( 'Choose a Password', 'buddypress' ) ?> <?php _e( '(required)', 'buddypress' ) ?></label>
+					<?php do_action( 'bp_signup_password_errors' ) ?>
+					<input type="password" name="signup_password" id="signup_password" value="" />
+
+					<label for="signup_password_confirm"><?php _e( 'Confirm Password', 'buddypress' ) ?> <?php _e( '(required)', 'buddypress' ) ?></label>
+					<?php do_action( 'bp_signup_password_confirm_errors' ) ?>
+					<input type="password" name="signup_password_confirm" id="signup_password_confirm" value="" />
+
+				</div><!-- #basic-details-section -->
+
+				<?php do_action( 'bp_after_account_details_fields' ) ?>
+
+				<?php /***** Extra Profile Details ******/ ?>
+
+				<?php if ( bp_is_active( 'xprofile' ) ) : ?>
+
+					<?php do_action( 'bp_before_signup_profile_fields' ) ?>
+
+					<div class="register-section" id="profile-details-section">
+
+						<h4><?php _e( 'Profile Details', 'buddypress' ) ?></h4>
+
+						<?php /* Use the profile field loop to render input fields for the 'base' profile field group */ ?>
+						<?php if ( function_exists( 'bp_has_profile' ) ) : if ( bp_has_profile( 'profile_group_id=1' ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
+
+						<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
+
+							<div class="editfield">
+
+								<?php if ( 'textbox' == bp_get_the_profile_field_type() ) : ?>
+
+									<label for="<?php bp_the_profile_field_input_name() ?>"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></label>
+									<?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ) ?>
+									<input type="text" name="<?php bp_the_profile_field_input_name() ?>" id="<?php bp_the_profile_field_input_name() ?>" value="<?php bp_the_profile_field_edit_value() ?>" />
+
+								<?php endif; ?>
+
+								<?php if ( 'textarea' == bp_get_the_profile_field_type() ) : ?>
+
+									<label for="<?php bp_the_profile_field_input_name() ?>"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></label>
+									<?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ) ?>
+									<textarea rows="5" cols="40" name="<?php bp_the_profile_field_input_name() ?>" id="<?php bp_the_profile_field_input_name() ?>"><?php bp_the_profile_field_edit_value() ?></textarea>
+
+								<?php endif; ?>
+
+								<?php if ( 'selectbox' == bp_get_the_profile_field_type() ) : ?>
+
+									<label for="<?php bp_the_profile_field_input_name() ?>"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></label>
+									<?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ) ?>
+									<select name="<?php bp_the_profile_field_input_name() ?>" id="<?php bp_the_profile_field_input_name() ?>">
+										<?php bp_the_profile_field_options() ?>
+									</select>
+
+								<?php endif; ?>
+
+								<?php if ( 'multiselectbox' == bp_get_the_profile_field_type() ) : ?>
+
+									<label for="<?php bp_the_profile_field_input_name() ?>"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></label>
+									<?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ) ?>
+									<select name="<?php bp_the_profile_field_input_name() ?>" id="<?php bp_the_profile_field_input_name() ?>" multiple="multiple">
+										<?php bp_the_profile_field_options() ?>
+									</select>
+
+								<?php endif; ?>
+
+								<?php if ( 'radio' == bp_get_the_profile_field_type() ) : ?>
+
+									<div class="radio">
+										<span class="label"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></span>
+
+										<?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ) ?>
+										<?php bp_the_profile_field_options() ?>
+
+										<?php if ( !bp_get_the_profile_field_is_required() ) : ?>
+											<a class="clear-value" href="javascript:clear( '<?php bp_the_profile_field_input_name() ?>' );"><?php _e( 'Clear', 'buddypress' ) ?></a>
+										<?php endif; ?>
+									</div>
+
+								<?php endif; ?>
+
+								<?php if ( 'checkbox' == bp_get_the_profile_field_type() ) : ?>
+
+									<div class="checkbox">
+										<span class="label"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></span>
+
+										<?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ) ?>
+										<?php bp_the_profile_field_options() ?>
+									</div>
+
+								<?php endif; ?>
+
+								<?php if ( 'datebox' == bp_get_the_profile_field_type() ) : ?>
+
+									<div class="datebox">
+										<label for="<?php bp_the_profile_field_input_name() ?>_day"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></label>
+										<?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ) ?>
+
+										<select name="<?php bp_the_profile_field_input_name() ?>_day" id="<?php bp_the_profile_field_input_name() ?>_day">
+											<?php bp_the_profile_field_options( 'type=day' ) ?>
+										</select>
+
+										<select name="<?php bp_the_profile_field_input_name() ?>_month" id="<?php bp_the_profile_field_input_name() ?>_month">
+											<?php bp_the_profile_field_options( 'type=month' ) ?>
+										</select>
+
+										<select name="<?php bp_the_profile_field_input_name() ?>_year" id="<?php bp_the_profile_field_input_name() ?>_year">
+											<?php bp_the_profile_field_options( 'type=year' ) ?>
+										</select>
+									</div>
+
+								<?php endif; ?>
+
+								<?php do_action( 'bp_custom_profile_edit_fields' ) ?>
+
+								<p class="description"><?php bp_the_profile_field_description() ?></p>
+
+							</div>
+
+						<?php endwhile; ?>
+
+						<input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="<?php bp_the_profile_group_field_ids() ?>" />
+
+						<?php endwhile; endif; endif; ?>
+
+					</div><!-- #profile-details-section -->
+
+					<?php do_action( 'bp_after_signup_profile_fields' ) ?>
+
+				<?php endif; ?>
+				
+				<?php if ( bp_get_blog_signup_allowed() ) : ?>
+
+					<?php do_action( 'bp_before_blog_details_fields' ) ?>
+
+					<?php /***** Blog Creation Details ******/ ?>
+
+					<div class="register-section" id="blog-details-section">
+
+						<h4><?php _e( 'Blog Details', 'buddypress' ) ?></h4>
+
+						<p><input type="checkbox" name="signup_with_blog" id="signup_with_blog" value="1"<?php if ( (int) bp_get_signup_with_blog_value() ) : ?> checked="checked"<?php endif; ?> /> <?php _e( 'Yes, I\'d like to create a new blog', 'buddypress' ) ?></p>
+
+						<div id="blog-details"<?php if ( (int) bp_get_signup_with_blog_value() ) : ?>class="show"<?php endif; ?>>
+
+							<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 ( 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() ?>" />
+							<?php endif; ?>
+
+							<label for="signup_blog_title"><?php _e( 'Blog Title', 'buddypress' ) ?> <?php _e( '(required)', 'buddypress' ) ?></label>
+							<?php do_action( 'bp_signup_blog_title_errors' ) ?>
+							<input type="text" name="signup_blog_title" id="signup_blog_title" value="<?php bp_signup_blog_title_value() ?>" />
+
+							<span class="label"><?php _e( 'I would like my blog to appear in search engines, and in public listings around this site', 'buddypress' ) ?>:</span>
+							<?php do_action( 'bp_signup_blog_privacy_errors' ) ?>
+
+							<label><input type="radio" name="signup_blog_privacy" id="signup_blog_privacy_public" value="public"<?php if ( 'public' == bp_get_signup_blog_privacy_value() || !bp_get_signup_blog_privacy_value() ) : ?> checked="checked"<?php endif; ?> /> <?php _e( 'Yes' ) ?></label>
+							<label><input type="radio" name="signup_blog_privacy" id="signup_blog_privacy_private" value="private"<?php if ( 'private' == bp_get_signup_blog_privacy_value() ) : ?> checked="checked"<?php endif; ?> /> <?php _e( 'No' ) ?></label>
+
+						</div>
+
+					</div><!-- #blog-details-section -->
+
+					<?php do_action( 'bp_after_blog_details_fields' ) ?>
+
+				<?php endif; ?>
+
+				<?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;" />
+				</div>
+
+				<?php do_action( 'bp_after_registration_submit_buttons' ) ?>
+
+				<?php wp_nonce_field( 'bp_new_signup' ) ?>
+
+			<?php endif; // request-details signup step ?>
+
+			<?php if ( 'completed-confirmation' == bp_get_current_signup_step() ) : ?>
+
+				<h2><?php _e( 'Sign Up Complete!', 'buddypress' ) ?></h2>
+
+				<?php do_action( 'template_notices' ) ?>
+
+				<?php if ( bp_registration_needs_activation() ) : ?>
+					<p><?php _e( 'You have successfully created your account! To begin using this site you will need to activate your account via the email we have just sent to your address.', 'buddypress' ) ?></p>
+				<?php else : ?>
+					<p><?php _e( 'You have successfully created your account! Please log in using the username and password you have just created.', 'buddypress' ) ?></p>
+				<?php endif; ?>
+
+				<?php if ( bp_is_active( 'xprofile' ) && !(int)bp_get_option( 'bp-disable-avatar-uploads' ) ) : ?>
+
+					<?php if ( 'upload-image' == bp_get_avatar_admin_step() ) : ?>
+
+						<h4><?php _e( 'Your Current Avatar', 'buddypress' ) ?></h4>
+						<p><?php _e( "We've fetched an avatar for your new account. If you'd like to change this, why not upload a new one?", 'buddypress' ) ?></p>
+
+						<div id="signup-avatar">
+							<?php bp_signup_avatar() ?>
+						</div>
+
+						<p>
+							<input type="file" name="file" id="file" />
+							<input type="submit" name="upload" id="upload" value="<?php _e( 'Upload Image', 'buddypress' ) ?>" />
+							<input type="hidden" name="action" id="action" value="bp_avatar_upload" />
+							<input type="hidden" name="signup_email" id="signup_email" value="<?php bp_signup_email_value() ?>" />
+							<input type="hidden" name="signup_username" id="signup_username" value="<?php bp_signup_username_value() ?>" />
+						</p>
+
+						<?php wp_nonce_field( 'bp_avatar_upload' ) ?>
+
+					<?php endif; ?>
+
+					<?php if ( 'crop-image' == bp_get_avatar_admin_step() ) : ?>
+
+						<h3><?php _e( 'Crop Your New Avatar', 'buddypress' ) ?></h3>
+
+						<img src="<?php bp_avatar_to_crop() ?>" id="avatar-to-crop" class="avatar" alt="<?php _e( 'Avatar to crop', 'buddypress' ) ?>" />
+
+						<div id="avatar-crop-pane">
+							<img src="<?php bp_avatar_to_crop() ?>" id="avatar-crop-preview" class="avatar" alt="<?php _e( 'Avatar preview', 'buddypress' ) ?>" />
+						</div>
+
+						<input type="submit" name="avatar-crop-submit" id="avatar-crop-submit" value="<?php _e( 'Crop Image', 'buddypress' ) ?>" />
+
+						<input type="hidden" name="signup_email" id="signup_email" value="<?php bp_signup_email_value() ?>" />
+						<input type="hidden" name="signup_username" id="signup_username" value="<?php bp_signup_username_value() ?>" />
+						<input type="hidden" name="signup_avatar_dir" id="signup_avatar_dir" value="<?php bp_signup_avatar_dir_value() ?>" />
+
+						<input type="hidden" name="image_src" id="image_src" value="<?php bp_avatar_to_crop_src() ?>" />
+						<input type="hidden" id="x" name="x" />
+						<input type="hidden" id="y" name="y" />
+						<input type="hidden" id="w" name="w" />
+						<input type="hidden" id="h" name="h" />
+
+						<?php wp_nonce_field( 'bp_avatar_cropstore' ) ?>
+
+					<?php endif; ?>
+
+				<?php endif; ?>
+
+			<?php endif; // completed-confirmation signup step ?>
+
+			<?php do_action( 'bp_custom_signup_steps' ) ?>
+
+			</form>
+
+		</div>
+
+		<?php do_action( 'bp_after_register_page' ) ?>
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+	<?php do_action( 'bp_after_directory_activity_content' ) ?>
+
+	<script type="text/javascript">
+		jQuery(document).ready( function() {
+			if ( jQuery('div#blog-details').length && !jQuery('div#blog-details').hasClass('show') )
+				jQuery('div#blog-details').toggle();
+
+			jQuery( 'input#signup_with_blog' ).click( function() {
+				jQuery('div#blog-details').fadeOut().toggle();
+			});
+		});
+	</script>
+
+<?php get_footer() ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/rtl.css b/wp-content/plugins/buddypress/bp-themes/bp-default/rtl.css
new file mode 100644
index 0000000000000000000000000000000000000000..09ce7e947a05838777de90dacc014ecedb888a46
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/rtl.css
@@ -0,0 +1,743 @@
+/*
+Theme Name: BuddyPress Default
+*/
+
+/***
+ * Right to left styles. This will transform the theme to read from right to left
+ * for languages that support this method.
+ */
+
+body {
+	direction:rtl;
+	unicode-bidi:embed;
+}
+
+/***
+ * The default theme styles.
+ */
+/* > Global Elements
+-------------------------------------------------------------- */
+
+body {
+	background: #eaeaea url( _inc/images/background.gif ) top right repeat-x;
+}
+.clear { clear: right; }
+
+img.avatar {
+	float: right;
+}
+
+/* > Header
+-------------------------------------------------------------- */
+
+	#header #search-bar {
+		left: 0;
+		right:auto;
+		text-align: left;
+	}
+
+		#header #search-bar input[type=text] {
+			margin-left: 4px;
+			margin-right: 0;
+		}
+
+		#header #search-bar input[type=submit] {
+			margin-right: 4px;
+			margin-left: 0;
+		}
+
+	#header h1 {
+		left: auto;
+		right: 20px;
+	}
+
+/* > Navigation
+-------------------------------------------------------------- */
+
+ul#nav {
+	left: 15px;
+	right: auto;
+}
+	ul#nav li {
+		float: right;
+		margin: 0 0 0 5px;
+	}
+/* > Container
+-------------------------------------------------------------- */
+
+div#container {
+	border-left: 0;
+	border-right: 1px solid #e0e0e0;
+}
+
+/* > Sidebar
+-------------------------------------------------------------- */
+
+div#sidebar {
+	float: right;
+	margin-right: -226px;
+	margin-left:0;
+	border-right: 1px solid #e4e4e4;
+	border-left: 0;
+	-moz-border-radius-topleft: 3px;
+	-webkit-border-top-left-radius: 3px;
+	-moz-border-radius-topright: 0;
+	-webkit-border-top-right-radius: 0;
+	background: url( _inc/images/sidebar_back.gif ) top right repeat-x;
+}
+	div#sidebar div#sidebar-me img.avatar {
+		float: right;
+		margin: 0 0 15px 10px;
+	}
+
+	div#sidebar ul#bp-nav {
+		clear: right;
+	}
+
+	div#sidebar h3.widgettitle {
+		margin: 25px -19px 10px -20px;
+		clear: right;
+	}
+
+	div#sidebar ul.item-list img.avatar {
+		margin-left: 10px;
+		margin-right: 0;
+	}
+
+	div#sidebar div.item-options {
+		margin: -10px -19px 0 -20px;
+	}
+
+	div#sidebar div.item-meta, div#sidebar div.item-content {
+		margin-right: 38px;
+		margin-left: 0;
+	}
+
+/* > Content
+-------------------------------------------------------------- */
+
+div#content {
+	float: right;
+	-moz-border-radius-topleft: 0;
+	-moz-border-radius-topright: 6px;
+	-webkit-border-top-right-radius: 6px;
+	-webkit-border-top-left-radius: 0;
+	-moz-border-radius-bottomleft: 0;
+	-moz-border-radius-bottomright: 6px;
+	-webkit-border-bottom-right-radius: 6px;
+	-webkit-border-bottom-left-radius: 0;
+}
+
+div#content .padder {
+	margin-left: 225px;
+	margin-right: 0;
+	border-left: 1px solid #e4e4e4;
+	border-right: 0;
+	-moz-border-radius-topright: 6px;
+	-moz-border-radius-topleft: 0;
+	-webkit-border-top-right-radius: 6px;
+	-webkit-border-top-left-radius: 0;
+	-moz-border-radius-bottomright: 6px;
+	-moz-border-radius-bottomleft: 0;
+	-webkit-border-bottom-right-radius: 6px;
+	-webkit-border-bottom-left-radius: 0;
+}
+	div#content .left-menu {
+		float: right;
+	}
+
+	div#content .main-column {
+		margin-right: 190px;
+		margin-left: 0;
+	}
+
+/* > Item Headers (Profiles, Groups)
+-------------------------------------------------------------- */
+
+	div#item-header img.avatar {
+		float: right;
+		margin: 0 0 25px 15px;
+	}
+
+	div#item-header span.activity {
+		margin: 0 4px 5px 0;
+	}
+
+	div#item-header div#item-actions {
+		float: left;
+		margin: 0 15px 15px 0;
+		text-align: left;
+	}
+		div#item-header ul li {
+			float: left;
+		}
+
+	div#item-header div.generic-button, div#item-header a.button {
+		float: right;
+		margin: 10px 0 0 10px;
+	}
+
+
+/* > Item Lists (Activity, Friend, Group lists)
+-------------------------------------------------------------- */
+
+		ul.item-list li img.avatar {
+			float: right;
+			margin: 0 0 10px 10px;
+		}
+
+		ul.item-list li div.item-desc {
+			margin: 10px 64px 0 0;
+		}
+
+		ul.item-list li div.action {
+			left: 0;
+			right:auto;
+			text-align: left;
+		}
+
+/* > Item Tabs
+-------------------------------------------------------------- */
+
+div.item-list-tabs {
+	clear: right;
+}
+		div.item-list-tabs ul li {
+			float: right;
+			margin: 5px 5px 0 0;
+		}
+			div.item-list-tabs ul li:first-child {
+				margin-left:0;
+				margin-right: 20px;
+			}
+
+			div.item-list-tabs ul li.last {
+				float: left;
+				margin: 7px 0 0 20px;
+			}
+
+			ul li.loading a {
+				background-position: 8% 50%;
+				padding-left: 30px !important;
+				padding-right: 0 !important;
+			}
+				div#item-nav ul li.loading a {
+					background-position: 12% 50%;
+				}
+
+	div.item-list-tabs ul li.feed a {
+		background-position:right center;
+		padding-right: 20px;
+		padding-left: 0;
+	}
+
+/* > Item Body
+-------------------------------------------------------------- */
+
+span.activity, div#message p {
+	border-left: 1px solid #FFE8C4;
+	border-right: 0;
+}
+
+/* > Directories (Members, Groups, Blogs, Forums)
+-------------------------------------------------------------- */
+
+div.dir-search {
+	float: left;
+}
+
+/* > Pagination
+-------------------------------------------------------------- */
+
+	div.pagination .pag-count {
+		float: right;
+	}
+
+	div.pagination .pagination-links {
+		float: left;
+	}
+
+/* > Buttons
+-------------------------------------------------------------- */
+
+a.button, input[type=submit], input[type=button],
+ul.button-nav li a, div.generic-button a {
+	background-position:right top;
+}
+	div.accept, div.reject {
+		float: right;
+		margin-left: 0;
+		margin-right: 10px;
+	}
+
+ul.button-nav li {
+	float: right;
+	margin: 0 0 10px 10px;
+}
+
+/* > AJAX Loaders
+-------------------------------------------------------------- */
+
+.ajax-loader {
+	background-position:right center !important;
+}
+
+a.loading {
+	background-position: 5% 50% !important;
+	padding-left: 25px !important;
+	padding-right: 0 !important;
+}
+
+/* > Input Forms
+-------------------------------------------------------------- */
+
+			form.standard-form#signup_form div.submit { float: left; }
+			form.standard-form#signup_form div.signup-avatar { margin-left: 15px; margin-right:0;}
+
+		form.standard-form div.submit input {
+			margin-left: 15px;
+			margin-right: 0;
+		}
+
+	form.standard-form div.radio ul {
+		margin: 10px 38px 15px 0;
+	}
+
+form.standard-form #basic-details-section, form.standard-form #blog-details-section,
+form.standard-form #profile-details-section {
+	float: right;
+}
+	form.standard-form #profile-details-section { float: left; }
+	form.standard-form #blog-details-section {
+		clear: right;
+	}
+
+
+/* > Data Tables
+-------------------------------------------------------------- */
+		table tr td.label {
+			border-left: 1px solid #eaeaea;
+			border-right: 0;
+		}
+
+
+	table.forum tr.closed td.td-title {
+		padding-right: 35px;
+		padding-left: 0;
+		background-position: 5% 50%;
+	}
+
+	table.forum tr > td:first-child, table.forum tr > th:first-child {
+		padding-right: 15px;
+		padding-left: 0;
+	}
+
+	table.forum tr > td:last-child, table.forum tr > th:last-child {
+		padding-left: 15px;
+		padding-right: 0;
+	}
+
+	table.forum tr th#th-title, table.forum tr th#th-poster,
+	table.forum tr th#th-group, table.forum td.td-poster,
+	table.forum td.td-group, table.forum td.td-title { text-align: right; }
+
+	table.forum td img.avatar {
+		margin-left: 5px;
+		margin-right: 0;
+	}
+
+/* > Activity Stream Posting
+-------------------------------------------------------------- */
+
+	form#whats-new-form h5 {
+		margin-right: 76px;
+		margin-left: 0;
+	}
+
+	form#whats-new-form #whats-new-avatar {
+		float: right;
+	}
+
+	form#whats-new-form #whats-new-content {
+		margin-right: 54px;
+		padding-right: 22px;
+	}
+
+	form#whats-new-form #whats-new-submit {
+		float: left;
+	}
+
+/* > Activity Stream Listing
+-------------------------------------------------------------- */
+
+	.activity-list li.mini .activity-avatar img.avatar,
+	.activity-list li.mini .activity-avatar img.FB_profile_pic {
+		margin-right: 36px;
+		margin-left: 0;
+	}
+		.activity-list li.activity_comment .activity-avatar img.avatar,
+		.activity-list li.activity_comment .activity-avatar img.FB_profile_pic {
+			margin-right: 20px;
+			margin-left: 0;
+		}
+
+		body.activity-permalink .activity-list li .activity-avatar img.avatar,
+		body.activity-permalink .activity-list li .activity-avatar img.FB_profile_pic {
+			margin-right: 0;
+		}
+
+	.activity-list li.mini .activity-content {
+		margin-left: 175px;
+		margin-right: 0;
+	}
+
+	.activity-list li.mini .activity-content p {
+		float: right;
+	}
+
+	.activity-list li.mini .activity-meta {
+		left: 0;
+		right: auto;
+	}
+		body.activity-permalink .activity-list li.mini .activity-meta {
+			left: 15px;
+			right: auto;
+		}
+
+	.activity-list li.mini .activity-comments {
+		clear: right;
+	}
+
+.activity-list li .activity-inreplyto {
+	margin-right: 70px;
+	margin-left: 0;
+	padding-right: 25px;
+	padding-left: 0;
+	background-position: 5% 0;
+}
+
+.activity-list .activity-content {
+	margin-right: 70px;
+	margin-left: 0;
+}
+	body.activity-permalink .activity-list li .activity-content {
+		border-left: 1px solid #ddd;
+		border-right: 0;
+		margin-right: 135px;
+		margin-left: 0;
+	}
+		body.activity-permalink .activity-list li .activity-content > p {
+			background-position: top right;
+			margin-right: -35px;
+			margin-left: 0;
+			padding: 5px 38px 0 0;
+		}
+
+	.activity-list .activity-content > p > a:first-child, span.highlight,
+	.activity-list .activity-content > .comment-header > a:first-child {
+		border-left: 1px solid #a1dcfa;
+		border-right: 0;
+		margin-left: 3px;
+		margin-right: 0;
+	}
+
+	.activity-list .activity-content .activity-inner,
+	.activity-list .activity-content blockquote {
+		margin: 15px 5px 15px 0;
+		overflow: hidden;
+	}
+
+	.activity-list .activity-content img.thumbnail {
+		float: right;
+		margin: 0 0 5px 10px;
+	}
+
+.activity-list li.load-more {
+	border-left: 1px solid #ddd;
+	border-right: 0;
+}
+
+/* > Activity Stream Comments
+-------------------------------------------------------------- */
+
+div.activity-meta {
+	margin: 0 3px 20px 0;
+	clear: right;
+}
+
+.activity-list div.activity-meta a {
+	border-left: 1px solid #ddd;
+	border-right: 0;
+	margin-left: 3px;
+	margin-right: 0;
+}
+	.activity-list div.activity-meta a.acomment-reply {
+		border-left: 1px solid #FFE8C4;
+		border-right: 0;
+	}
+
+
+div.activity-comments {
+	margin: 0 75px 0 0;
+}
+
+	body.activity-permalink div.activity-comments {
+		margin-right: 135px;
+		margin-left: 0;
+	}
+
+	div.activity-comments ul {
+		clear: right;
+	}
+
+	div.activity-comments ul li {
+		padding: 10px 0 10px 15px;
+		margin-right: 15px;
+		margin-left: 0;
+	}
+		body.activity-permalink div.activity-comments ul li {
+			padding: 15px 0 15px 15px;
+		}
+
+	div.activity-comments ul li > ul {
+		margin-right: 25px;
+		margin-left: 0;
+	}
+
+	div.activity-comments div.acomment-avatar img {
+		float: right;
+		margin-left: 10px;
+		margin-right: 0;
+	}
+
+	div.activity-comments div.acomment-content {
+		margin-right: 39px;
+		margin-right: 0;
+	}
+
+	div.activity-comments form.ac-form {
+		margin: 10px 33px 10px 0;
+		border-left: 1px solid #ddd;
+		border-right: 0;
+	}
+		div.activity-comments li form.ac-form {
+			margin-left: 15px;
+			margin-right: 0;
+		}
+
+		div.activity-comments form.root {
+			margin-right: 0;
+		}
+
+		div.activity-comments form.loading {
+			background-position: 88% 95%;
+		}
+
+		div.activity-comments form div.ac-reply-avatar {
+			float: right;
+		}
+
+		div.activity-comments form div.ac-reply-content {
+			margin-right: 25px;
+			margin-left: 0;
+			padding-right: 15px;
+			padding-left: 0;
+		}
+
+/* > Private Message Threads
+-------------------------------------------------------------- */
+
+	div.messages-options-nav {
+		text-align: left;
+}
+
+	div#message-thread img.avatar {
+		float: right;
+		margin: 0 0 0 10px;
+	}
+
+		div#message-thread strong span.activity {
+			margin: 4px 10px 0 0;
+		}
+
+	div#message-thread div.message-content {
+		margin-right: 45px;
+		margin-left: 0;
+	}
+
+	div#message-thread div.message-options {
+		text-align: left;
+	}
+
+/* > Group Forum Topics
+-------------------------------------------------------------- */
+
+	ul#topic-post-list li div.post-content {
+		margin-right: 54px;
+		margin-left: 0;
+	}
+
+div.admin-links {
+	left: 25px;
+	right: auto
+}
+	div#topic-meta div.admin-links {
+		left: 0;
+		right: auto;
+	}
+
+
+/* > WordPress Blog Styles
+-------------------------------------------------------------- */
+
+	.navigation, .paged-navigation, .comment-navigation {
+		font-family: sans-serif;
+	}
+		div.navigation .alignright {
+			float: left;
+		}
+
+		div.navigation .alignleft {
+			float: right;
+		}
+
+	div.post ul, div.post ol, div.post dl { margin: 0 1.5em 18px 0; }
+	div.post dl { margin-right: 0; }
+
+	div.post code { font-family: "Monaco", courier, sans-serif; }
+	div.post blockquote {
+		font-family: sans-serif;
+	}
+
+		div.post table th { text-align: right; }
+
+	div.post div.author-box, div.comment-avatar-box {
+		float: right;
+		margin: 0 0 15px 15px;
+		font-family: sans-serif;
+	}
+
+	div.post div.post-content, div.comment-content {
+		margin-right: 105px;
+		margin-left: 0;
+	}
+
+	div.post p.date, div.post p.postmetadata, div.comment-meta, div.comment-options {
+		font-family: sans-serif;
+	}
+
+	div.post p.postmetadata {
+		clear: right;
+	}
+
+	div.post .tags { float: right; }
+	div.post .comments { float: left; }
+
+
+	div.post dd.wp-caption p.wp-caption-text, div.post .wp-caption p.wp-caption-text {
+		padding: 0 0 5px 4px;
+	}
+
+/* > WordPress Blog Comment Styles
+-------------------------------------------------------------- */
+
+	div.comment-meta em {
+		float: left;
+	}
+
+/***
+ * The admin bar styles.
+ */
+
+#wp-admin-bar {
+	right: 0;
+	left: auto;
+}
+
+#wp-admin-bar div#admin-bar-logo {
+	right: 10px;
+	left: auto;
+}
+
+#wp-admin-bar li {
+	text-align: right;
+}
+
+	#wp-admin-bar li.no-arrow a {
+		padding-left: 15px;
+		padding-right: 0;
+	}
+
+
+#admin-bar-logo {
+	float: right;
+}
+
+/*******************/
+
+#wp-admin-bar ul li { /* all list items */
+	float: right;
+	background: url( _inc/images/admin-menu-arrow.gif ) 12% 53% no-repeat;
+	padding-left: 11px;
+	padding-right: 0;
+}
+	#wp-admin-bar ul li.no-arrow {
+		padding-left: 0;
+	}
+
+
+#wp-admin-bar ul li.align-right {
+	left: 0;
+	right: auto;
+}
+
+
+/* second-level lists */
+
+#wp-admin-bar ul li ul {
+	right: -999em;
+	left:auto;
+	margin-right: 0;
+}
+
+#wp-admin-bar ul li ul li {
+	float: right;
+}
+
+/* third-and-above-level lists */
+
+#wp-admin-bar ul li ul ul {
+	margin: -25px 184px 0 0;
+}
+
+#wp-admin-bar ul li:hover ul, #wp-admin-bar ul li li:hover ul, #wp-admin-bar ul li.sfhover ul, #wp-admin-bar ul li ul li.sfhover ul { /* lists nested under hovered list items */
+	right: auto;
+}
+
+#wp-admin-bar ul li.align-right:hover ul {
+	left: 0;
+	right:auto;
+}
+
+#wp-admin-bar ul li:hover ul ul, #wp-admin-bar li.sfhover ul li ul {
+	right: -999em;
+	left: auto;
+}
+
+/* Menu item css */
+
+#wp-admin-bar img.avatar {
+	float: right;
+	margin-left: 8px;
+	margin-right: 0;
+}
+
+#wp-admin-bar span.activity {
+	margin-right: 34px;
+	margin-left: 0;
+}
+
+#wp-admin-bar ul li#bp-adminbar-notifications-menu a span {
+	margin-right: 2px;
+	margin-left: 0;
+}
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/screenshot.png b/wp-content/plugins/buddypress/bp-themes/bp-default/screenshot.png
new file mode 100644
index 0000000000000000000000000000000000000000..68928f7a41d1e89b7d6d3c5370813e4342832631
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-themes/bp-default/screenshot.png differ
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/search.php b/wp-content/plugins/buddypress/bp-themes/bp-default/search.php
new file mode 100644
index 0000000000000000000000000000000000000000..e226cbd8a103667154726d8cdd1bd6a1e2c9a375
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/search.php
@@ -0,0 +1,71 @@
+<?php get_header() ?>
+
+	<div id="content">
+		<div class="padder">
+
+		<?php do_action( 'bp_before_blog_search' ) ?>
+
+		<div class="page" id="blog-search">
+
+			<h2 class="pagetitle"><?php _e( 'Blog', 'buddypress' ) ?></h2>
+
+			<?php if (have_posts()) : ?>
+
+				<h3 class="pagetitle"><?php _e( 'Search Results', 'buddypress' ) ?></h3>
+
+				<div class="navigation">
+					<div class="alignleft"><?php next_posts_link( __( '&larr; Previous Entries', 'buddypress' ) ) ?></div>
+					<div class="alignright"><?php previous_posts_link( __( 'Next Entries &rarr;', 'buddypress' ) ) ?></div>
+				</div>
+
+				<?php while (have_posts()) : the_post(); ?>
+
+					<?php do_action( 'bp_before_blog_post' ) ?>
+
+					<div class="post" id="post-<?php the_ID(); ?>">
+
+						<div class="author-box">
+							<?php echo get_avatar( get_the_author_email(), '50' ); ?>
+							<p><?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></p>
+						</div>
+
+						<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() ?> <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' ) ); ?>
+							</div>
+
+							<p class="postmetadata"><span class="tags"><?php the_tags( __( 'Tags: ', 'buddypress' ), ', ', '<br />'); ?></span> <span class="comments"><?php comments_popup_link( __( 'No Comments &#187;', 'buddypress' ), __( '1 Comment &#187;', 'buddypress' ), __( '% Comments &#187;', 'buddypress' ) ); ?></span></p>
+						</div>
+
+					</div>
+
+					<?php do_action( 'bp_after_blog_post' ) ?>
+
+				<?php endwhile; ?>
+
+				<div class="navigation">
+					<div class="alignleft"><?php next_posts_link( __( '&larr; Previous Entries', 'buddypress' ) ) ?></div>
+					<div class="alignright"><?php previous_posts_link( __( 'Next Entries &rarr;', 'buddypress' ) ) ?></div>
+				</div>
+
+			<?php else : ?>
+
+				<h2 class="center"><?php _e( 'No posts found. Try a different search?', 'buddypress' ) ?></h2>
+				<?php locate_template( array( '/searchform.php'), true ) ?>
+
+			<?php endif; ?>
+
+		</div>
+
+		<?php do_action( 'bp_after_blog_search' ) ?>
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer() ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/searchform.php b/wp-content/plugins/buddypress/bp-themes/bp-default/searchform.php
new file mode 100755
index 0000000000000000000000000000000000000000..cbcdaeda7f76376ee0ae1a1948623ce7b626d66c
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/searchform.php
@@ -0,0 +1,10 @@
+<?php do_action( 'bp_before_blog_search_form' ) ?>
+
+<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
+	<input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
+	<input type="submit" id="searchsubmit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
+
+	<?php do_action( 'bp_blog_search_form' ) ?>
+</form>
+
+<?php do_action( 'bp_after_blog_search_form' ) ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/sidebar.php b/wp-content/plugins/buddypress/bp-themes/bp-default/sidebar.php
new file mode 100644
index 0000000000000000000000000000000000000000..ba968c09f15b01af59733c6c3d13b52c8c9446c0
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/sidebar.php
@@ -0,0 +1,76 @@
+<?php do_action( 'bp_before_sidebar' ) ?>
+
+<div id="sidebar">
+	<div class="padder">
+
+	<?php do_action( 'bp_inside_before_sidebar' ) ?>
+
+	<?php if ( is_user_logged_in() ) : ?>
+
+		<?php do_action( 'bp_before_sidebar_me' ) ?>
+
+		<div id="sidebar-me">
+			<a href="<?php echo bp_loggedin_user_domain() ?>">
+				<?php bp_loggedin_user_avatar( 'type=thumb&width=40&height=40' ) ?>
+			</a>
+
+			<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' ) ?>
+		</div>
+
+		<?php do_action( 'bp_after_sidebar_me' ) ?>
+
+		<?php if ( function_exists( 'bp_message_get_notices' ) ) : ?>
+			<?php bp_message_get_notices(); /* Site wide notices to all users */ ?>
+		<?php endif; ?>
+
+	<?php else : ?>
+
+		<?php do_action( 'bp_before_sidebar_login_form' ) ?>
+
+		<p id="login-text">
+			<?php _e( 'To start connecting please log in first.', 'buddypress' ) ?>
+			<?php if ( bp_get_signup_allowed() ) : ?>
+				<?php printf( __( ' You can also <a href="%s" title="Create an account">create an account</a>.', 'buddypress' ), site_url( BP_REGISTER_SLUG . '/' ) ) ?>
+			<?php endif; ?>
+		</p>
+
+		<form name="login-form" id="sidebar-login-form" class="standard-form" action="<?php echo site_url( 'wp-login.php', 'login_post' ) ?>" method="post">
+			<label><?php _e( 'Username', 'buddypress' ) ?><br />
+			<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>
+
+			<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="sidebar-rememberme" value="forever" /> <?php _e( 'Remember Me', 'buddypress' ) ?></label></p>
+
+			<?php do_action( 'bp_sidebar_login_form' ) ?>
+			<input type="submit" name="wp-submit" id="sidebar-wp-submit" value="<?php _e('Log In'); ?>" tabindex="100" />
+			<input type="hidden" name="testcookie" value="1" />
+		</form>
+
+		<?php do_action( 'bp_after_sidebar_login_form' ) ?>
+
+	<?php endif; ?>
+
+	<?php /* Show forum tags on the forums directory */
+	if ( BP_FORUMS_SLUG == bp_current_component() && bp_is_directory() ) : ?>
+		<div id="forum-directory-tags" class="widget tags">
+
+			<h3 class="widgettitle"><?php _e( 'Forum Topic Tags', 'buddypress' ) ?></h3>
+			<?php if ( function_exists('bp_forums_tag_heat_map') ) : ?>
+				<div id="tag-text"><?php bp_forums_tag_heat_map(); ?></div>
+			<?php endif; ?>
+		</div>
+	<?php endif; ?>
+
+	<?php dynamic_sidebar( 'sidebar' ) ?>
+
+	<?php do_action( 'bp_inside_after_sidebar' ) ?>
+
+	</div><!-- .padder -->
+</div><!-- #sidebar -->
+
+<?php do_action( 'bp_after_sidebar' ) ?>
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/single.php b/wp-content/plugins/buddypress/bp-themes/bp-default/single.php
new file mode 100644
index 0000000000000000000000000000000000000000..82716ad625611ba820013a84beb3f0fe65f33be6
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/single.php
@@ -0,0 +1,59 @@
+<?php get_header() ?>
+
+	<div id="content">
+		<div class="padder">
+
+		<?php do_action( 'bp_before_blog_single_post' ) ?>
+
+		<div class="page" id="blog-single">
+
+			<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
+
+				<div class="item-options">
+
+					<div class="alignleft"><?php next_posts_link( __( '&larr; Previous Entries', 'buddypress' ) ) ?></div>
+					<div class="alignright"><?php previous_posts_link( __( 'Next Entries &rarr;', 'buddypress' ) ) ?></div>
+
+				</div>
+
+				<div class="post" id="post-<?php the_ID(); ?>">
+
+					<div class="author-box">
+						<?php echo get_avatar( get_the_author_meta( 'user_email' ), '50' ); ?>
+						<p><?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></p>
+					</div>
+
+					<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() ?> <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' ) ); ?>
+
+							<?php wp_link_pages(array('before' => __( '<p><strong>Pages:</strong> ', 'buddypress' ), 'after' => '</p>', 'next_or_number' => 'number')); ?>
+						</div>
+
+						<p class="postmetadata"><span class="tags"><?php the_tags( __( 'Tags: ', 'buddypress' ), ', ', '<br />'); ?></span> <span class="comments"><?php comments_popup_link( __( 'No Comments &#187;', 'buddypress' ), __( '1 Comment &#187;', 'buddypress' ), __( '% Comments &#187;', 'buddypress' ) ); ?></span></p>
+					</div>
+
+				</div>
+
+			<?php comments_template(); ?>
+
+			<?php endwhile; else: ?>
+
+				<p><?php _e( 'Sorry, no posts matched your criteria.', 'buddypress' ) ?></p>
+
+			<?php endif; ?>
+
+		</div>
+
+		<?php do_action( 'bp_after_blog_single_post' ) ?>
+
+		</div><!-- .padder -->
+	</div><!-- #content -->
+
+	<?php locate_template( array( 'sidebar.php' ), true ) ?>
+
+<?php get_footer() ?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-themes/bp-default/style.css b/wp-content/plugins/buddypress/bp-themes/bp-default/style.css
new file mode 100644
index 0000000000000000000000000000000000000000..8273295f6b67ecabb30f5d11706eee9a75e49ee3
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-themes/bp-default/style.css
@@ -0,0 +1,26 @@
+/*
+Theme Name: BuddyPress Default
+Theme URI: http://buddypress.org/extend/themes/
+Description: The default theme for BuddyPress.
+Version: 1.2.6
+Author: BuddyPress.org
+Author URI: http://buddypress.org
+Tags: buddypress, two-columns, custom-header, white, blue
+
+** IMPORTANT - DO NOT COPY THIS THEME **
+If you want to make a custom theme based on this theme, DO NOT copy and edit it. By
+doing this you will make upgrades and maintainence much harder for yourself.
+Instead, please read this codex page on how to build a BuddyPress child theme:
+
+http://codex.buddypress.org/how-to-guides/building-a-buddypress-child-theme/
+*/
+
+/***
+ * The default theme styles.
+ */
+@import url( _inc/css/default.css );
+
+/***
+ * The admin bar default styles
+ */
+@import url( _inc/css/adminbar.css );
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-xprofile.php b/wp-content/plugins/buddypress/bp-xprofile.php
new file mode 100644
index 0000000000000000000000000000000000000000..4916ffc2e955e3adc540797435fd1a09247af198
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-xprofile.php
@@ -0,0 +1,1024 @@
+<?php
+define ( 'BP_XPROFILE_DB_VERSION', '1870' );
+
+/* Define the slug for the component */
+if ( !defined( 'BP_XPROFILE_SLUG' ) )
+	define ( 'BP_XPROFILE_SLUG', 'profile' );
+
+require ( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-admin.php' );
+require ( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-classes.php' );
+require ( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-filters.php' );
+require ( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-templatetags.php' );
+require ( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-cssjs.php' );
+
+/**
+ * xprofile_install()
+ *
+ * Set up the database tables needed for the xprofile component.
+ *
+ * @package BuddyPress XProfile
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @uses dbDelta() Takes SQL statements and compares them to any existing tables and creates/updates them.
+ * @uses add_site_option() adds a value for a meta_key into the wp_sitemeta table
+ */
+function xprofile_install() {
+	global $bp, $wpdb;
+
+	if ( !empty($wpdb->charset) )
+		$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
+
+	bp_core_activate_site_options( array( 'bp-xprofile-base-group-name' => 'Base', 'bp-xprofile-fullname-field-name' => 'Name' ) );
+
+	$sql[] = "CREATE TABLE {$bp->profile->table_name_groups} (
+			  id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
+			  name varchar(150) NOT NULL,
+			  description mediumtext NOT NULL,
+			  can_delete tinyint(1) NOT NULL,
+			  KEY can_delete (can_delete)
+	) {$charset_collate};";
+
+	$sql[] = "CREATE TABLE {$bp->profile->table_name_fields} (
+			  id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
+			  group_id bigint(20) unsigned NOT NULL,
+			  parent_id bigint(20) unsigned NOT NULL,
+			  type varchar(150) NOT NULL,
+			  name varchar(150) NOT NULL,
+			  description longtext NOT NULL,
+			  is_required tinyint(1) NOT NULL DEFAULT '0',
+			  is_default_option tinyint(1) NOT NULL DEFAULT '0',
+			  field_order bigint(20) NOT NULL DEFAULT '0',
+			  option_order bigint(20) NOT NULL DEFAULT '0',
+			  order_by varchar(15) NOT NULL,
+			  can_delete tinyint(1) NOT NULL DEFAULT '1',
+			  KEY group_id (group_id),
+			  KEY parent_id (parent_id),
+			  KEY field_order (field_order),
+			  KEY can_delete (can_delete),
+			  KEY is_required (is_required)
+	) {$charset_collate};";
+
+	$sql[] = "CREATE TABLE {$bp->profile->table_name_data} (
+			  id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
+			  field_id bigint(20) unsigned NOT NULL,
+			  user_id bigint(20) unsigned NOT NULL,
+			  value longtext NOT NULL,
+			  last_updated datetime NOT NULL,
+			  KEY field_id (field_id),
+			  KEY user_id (user_id)
+	) {$charset_collate};";
+
+	if ( '' == get_site_option( 'bp-xprofile-db-version' ) ) {
+		if ( !$wpdb->get_var( "SELECT id FROM {$bp->profile->table_name_groups} WHERE id = 1" ) )
+			$sql[] = "INSERT INTO {$bp->profile->table_name_groups} VALUES ( 1, '" . get_site_option( 'bp-xprofile-base-group-name' ) . "', '', 0 );";
+
+		if ( !$wpdb->get_var( "SELECT id FROM {$bp->profile->table_name_fields} WHERE id = 1" ) )
+			$sql[] = "INSERT INTO {$bp->profile->table_name_fields} VALUES ( 1, 1, 0, 'textbox', '" . get_site_option( 'bp-xprofile-fullname-field-name' ) . "', '', 1, 0, 0, 0, '', 0 );";
+
+	}
+
+	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
+	dbDelta($sql);
+
+	do_action( 'xprofile_install' );
+
+	update_site_option( 'bp-xprofile-db-version', BP_XPROFILE_DB_VERSION );
+}
+
+/**
+ * xprofile_setup_globals()
+ *
+ * Add the profile globals to the $bp global for use across the installation
+ *
+ * @package BuddyPress XProfile
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @global $wpdb WordPress DB access object.
+ * @uses site_url() Returns the site URL
+ */
+function xprofile_setup_globals() {
+	global $bp, $wpdb;
+
+	/* Assign the base group and fullname field names to constants to use in SQL statements */
+	define ( 'BP_XPROFILE_BASE_GROUP_NAME', $bp->site_options['bp-xprofile-base-group-name'] );
+	define ( 'BP_XPROFILE_FULLNAME_FIELD_NAME', $bp->site_options['bp-xprofile-fullname-field-name'] );
+
+	/* For internal identification */
+	$bp->profile->id = 'profile';
+
+	$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';
+
+	/* Register this in the active components array */
+	$bp->active_components[$bp->profile->slug] = $bp->profile->id;
+
+	/* Set the support field type ids */
+	$bp->profile->field_types = apply_filters( 'xprofile_field_types', array( 'textbox', 'textarea', 'radio', 'checkbox', 'selectbox', 'multiselectbox', 'datebox' ) );
+
+	do_action( 'xprofile_setup_globals' );
+}
+add_action( 'bp_setup_globals', 'xprofile_setup_globals' );
+
+/**
+ * xprofile_add_admin_menu()
+ *
+ * Creates the administration interface menus and checks to see if the DB
+ * tables are set up.
+ *
+ * @package BuddyPress XProfile
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @global $wpdb WordPress DB access object.
+ * @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
+ * @uses xprofile_install() Runs the DB table installation function
+ * @return
+ */
+function xprofile_add_admin_menu() {
+	global $wpdb, $bp;
+
+	if ( !is_super_admin() )
+		return false;
+
+	/* Add the administration tab under the "Site Admin" tab for site administrators */
+	add_submenu_page( 'bp-general-settings', __("Profile Field Setup", 'buddypress'), __("Profile Field Setup", 'buddypress'), 'manage_options', 'bp-profile-setup', "xprofile_admin" );
+
+	/* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
+	if ( get_site_option( 'bp-xprofile-db-version' ) < BP_XPROFILE_DB_VERSION )
+		xprofile_install();
+}
+add_action( 'admin_menu', 'xprofile_add_admin_menu' );
+
+/**
+ * xprofile_setup_nav()
+ *
+ * Sets up the navigation items for the xprofile component
+ *
+ * @package BuddyPress XProfile
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @uses bp_core_new_nav_item() Adds a navigation item to the top level buddypress navigation
+ * @uses bp_core_new_subnav_item() Adds a sub navigation item to a nav item
+ * @uses bp_is_my_profile() Returns true if the current user being viewed is equal the logged in user
+ * @uses bp_core_fetch_avatar() Returns the either the thumb or full avatar URL for the user_id passed
+ */
+function xprofile_setup_nav() {
+	global $bp;
+
+	/* Add 'Profile' to the main navigation */
+	bp_core_new_nav_item( array( 'name' => __( 'Profile', 'buddypress' ), 'slug' => $bp->profile->slug, 'position' => 20, 'screen_function' => 'xprofile_screen_display_profile', 'default_subnav_slug' => 'public', 'item_css_id' => $bp->profile->id ) );
+
+	$profile_link = $bp->loggedin_user->domain . $bp->profile->slug . '/';
+
+	/* Add the subnav items to the profile */
+	bp_core_new_subnav_item( array( 'name' => __( 'Public', 'buddypress' ), 'slug' => 'public', 'parent_url' => $profile_link, 'parent_slug' => $bp->profile->slug, 'screen_function' => 'xprofile_screen_display_profile', 'position' => 10 ) );
+	bp_core_new_subnav_item( array( 'name' => __( 'Edit Profile', 'buddypress' ), 'slug' => 'edit', 'parent_url' => $profile_link, 'parent_slug' => $bp->profile->slug, 'screen_function' => 'xprofile_screen_edit_profile', 'position' => 20 ) );
+	bp_core_new_subnav_item( array( 'name' => __( 'Change Avatar', 'buddypress' ), 'slug' => 'change-avatar', 'parent_url' => $profile_link, 'parent_slug' => $bp->profile->slug, 'screen_function' => 'xprofile_screen_change_avatar', 'position' => 30 ) );
+
+	if ( $bp->current_component == $bp->profile->slug ) {
+		if ( bp_is_my_profile() ) {
+			$bp->bp_options_title = __( 'My Profile', 'buddypress' );
+		} else {
+			$bp->bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => 'thumb' ) );
+			$bp->bp_options_title = $bp->displayed_user->fullname;
+		}
+	}
+
+	do_action( 'xprofile_setup_nav' );
+}
+add_action( 'bp_setup_nav', 'xprofile_setup_nav' );
+
+/**
+ * xprofile_setup_adminbar_menu()
+ *
+ * Adds an admin bar menu to any profile page providing site admin options for that user.
+ *
+ * @package BuddyPress XProfile
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ */
+function xprofile_setup_adminbar_menu() {
+	global $bp;
+
+	if ( !$bp->displayed_user->id )
+		return false;
+
+	/* Don't show this menu to non site admins or if you're viewing your own 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' ), 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 : ?>
+				<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' ), esc_attr( $bp->displayed_user->fullname ) ) ?></a></li>
+
+			<?php do_action( 'xprofile_adminbar_menu_items' ) ?>
+		</ul>
+	</li>
+	<?php
+}
+add_action( 'bp_adminbar_menus', 'xprofile_setup_adminbar_menu', 20 );
+
+/********************************************************************************
+ * Screen Functions
+ *
+ * Screen functions are the controllers of BuddyPress. They will execute when their
+ * specific URL is caught. They will first save or manipulate data using business
+ * functions, then pass on the user to a template file.
+ */
+
+/**
+ * xprofile_screen_display_profile()
+ *
+ * Handles the display of the profile page by loading the correct template file.
+ *
+ * @package BuddyPress Xprofile
+ * @uses bp_core_load_template() Looks for and loads a template file within the current member theme (folder/filename)
+ */
+function xprofile_screen_display_profile() {
+	global $bp;
+
+	do_action( 'xprofile_screen_display_profile', $_GET['new'] );
+	bp_core_load_template( apply_filters( 'xprofile_template_display_profile', 'members/single/home' ) );
+}
+
+/**
+ * xprofile_screen_edit_profile()
+ *
+ * Handles the display of the profile edit page by loading the correct template file.
+ * Also checks to make sure this can only be accessed for the logged in users profile.
+ *
+ * @package BuddyPress Xprofile
+ * @uses bp_is_my_profile() Checks to make sure the current user being viewed equals the logged in user
+ * @uses bp_core_load_template() Looks for and loads a template file within the current member theme (folder/filename)
+ */
+function xprofile_screen_edit_profile() {
+	global $bp;
+
+	if ( !bp_is_my_profile() && !is_super_admin() )
+		return false;
+
+	/* Make sure a group is set. */
+	if ( empty( $bp->action_variables[1] ) )
+		bp_core_redirect( $bp->displayed_user->domain . BP_XPROFILE_SLUG . '/edit/group/1' );
+
+	/* Check the field group exists */
+	if ( !xprofile_get_field_group( $bp->action_variables[1] ) )
+		bp_core_redirect( $bp->root_domain );
+
+	/* Check to see if any new information has been submitted */
+	if ( isset( $_POST['field_ids'] ) ) {
+
+		/* Check the nonce */
+		check_admin_referer( 'bp_xprofile_edit' );
+
+		/* Check we have field ID's */
+		if ( empty( $_POST['field_ids'] ) )
+			bp_core_redirect( $bp->displayed_user->domain . BP_XPROFILE_SLUG . '/edit/group/' . $bp->action_variables[1] . '/' );
+
+		/* Explode the posted field IDs into an array so we know which fields have been submitted */
+		$posted_field_ids = explode( ',', $_POST['field_ids'] );
+
+		$is_required = array();
+
+		/* Loop through the posted fields formatting any datebox values then validate the field */
+		foreach ( (array)$posted_field_ids as $field_id ) {
+			if ( !isset( $_POST['field_' . $field_id] ) ) {
+
+				if ( is_numeric( $_POST['field_' . $field_id . '_day'] ) ) {
+					/* Concatenate the values. */
+					$date_value = $_POST['field_' . $field_id . '_day'] . ' ' .
+							      $_POST['field_' . $field_id . '_month'] . ' ' .
+								  $_POST['field_' . $field_id . '_year'];
+
+					/* Turn the concatenated value into a timestamp */
+					$_POST['field_' . $field_id] = strtotime( $date_value );
+				}
+
+			}
+
+			$is_required[$field_id] = xprofile_check_is_required_field( $field_id );
+			if ( $is_required[$field_id] && empty( $_POST['field_' . $field_id] ) )
+				$errors = true;
+		}
+
+		if ( !empty( $errors ) )
+			bp_core_add_message( __( 'Please make sure you fill in all required fields in this profile field group before saving.', 'buddypress' ), 'error' );
+		else {
+			/* Reset the errors var */
+			$errors = false;
+
+			/* Now we've checked for required fields, lets save the values. */
+			foreach ( (array)$posted_field_ids as $field_id ) {
+				if ( !xprofile_set_field_data( $field_id, $bp->displayed_user->id, $_POST['field_' . $field_id], $is_required[$field_id] ) )
+					$errors = true;
+				else
+					do_action( 'xprofile_profile_field_data_updated', $field_id, $_POST['field_' . $field_id] );
+			}
+
+			do_action( 'xprofile_updated_profile', $bp->displayed_user->id, $posted_field_ids, $errors );
+
+			/* Set the feedback messages */
+			if ( $errors )
+				bp_core_add_message( __( 'There was a problem updating some of your profile information, please try again.', 'buddypress' ), 'error' );
+			else
+				bp_core_add_message( __( 'Changes saved.', 'buddypress' ) );
+
+			/* Redirect back to the edit screen to display the updates and message */
+			bp_core_redirect( $bp->displayed_user->domain . BP_XPROFILE_SLUG . '/edit/group/' . $bp->action_variables[1] . '/' );
+		}
+	}
+
+	do_action( 'xprofile_screen_edit_profile' );
+	bp_core_load_template( apply_filters( 'xprofile_template_edit_profile', 'members/single/home' ) );
+}
+
+/**
+ * xprofile_screen_change_avatar()
+ *
+ * Handles the uploading and cropping of a user avatar. Displays the change avatar page.
+ *
+ * @package BuddyPress Xprofile
+ * @uses bp_is_my_profile() Checks to make sure the current user being viewed equals the logged in user
+ * @uses bp_core_load_template() Looks for and loads a template file within the current member theme (folder/filename)
+ */
+function xprofile_screen_change_avatar() {
+	global $bp;
+
+	if ( !bp_is_my_profile() && !is_super_admin() )
+		return false;
+
+	$bp->avatar_admin->step = 'upload-image';
+
+	if ( !empty( $_FILES ) ) {
+
+		/* Check the nonce */
+		check_admin_referer( 'bp_avatar_upload' );
+
+		/* Pass the file to the avatar upload handler */
+		if ( bp_core_avatar_handle_upload( $_FILES, 'xprofile_avatar_upload_dir' ) ) {
+			$bp->avatar_admin->step = 'crop-image';
+
+			/* Make sure we include the jQuery jCrop file for image cropping */
+			add_action( 'wp', 'bp_core_add_jquery_cropper' );
+		}
+	}
+
+	/* If the image cropping is done, crop the image and save a full/thumb version */
+	if ( isset( $_POST['avatar-crop-submit'] ) ) {
+
+		/* Check the nonce */
+		check_admin_referer( 'bp_avatar_cropstore' );
+
+		if ( !bp_core_avatar_handle_crop( array( 'item_id' => $bp->displayed_user->id, 'original_file' => $_POST['image_src'], 'crop_x' => $_POST['x'], 'crop_y' => $_POST['y'], 'crop_w' => $_POST['w'], 'crop_h' => $_POST['h'] ) ) )
+			bp_core_add_message( __( 'There was a problem cropping your avatar, please try uploading it again', 'buddypress' ), 'error' );
+		else {
+			bp_core_add_message( __( 'Your new avatar was uploaded successfully!', 'buddypress' ) );
+			do_action( 'xprofile_avatar_uploaded' );
+		}
+	}
+
+	do_action( 'xprofile_screen_change_avatar' );
+
+	bp_core_load_template( apply_filters( 'xprofile_template_change_avatar', 'members/single/home' ) );
+}
+
+/********************************************************************************
+ * Action Functions
+ *
+ * Action functions are exactly the same as screen functions, however they do not
+ * have a template screen associated with them. Usually they will send the user
+ * back to the default screen after execution.
+ */
+
+/**
+ * xprofile_action_delete_avatar()
+ *
+ * This function runs when an action is set for a screen:
+ * example.com/members/andy/profile/change-avatar/ [delete-avatar]
+ *
+ * The function will delete the active avatar for a user.
+ *
+ * @package BuddyPress Xprofile
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @uses bp_core_delete_avatar() Deletes the active avatar for the logged in user.
+ * @uses add_action() Runs a specific function for an action when it fires.
+ * @uses bp_core_load_template() Looks for and loads a template file within the current member theme (folder/filename)
+ */
+function xprofile_action_delete_avatar() {
+	global $bp;
+
+	if ( $bp->profile->slug != $bp->current_component || 'change-avatar' != $bp->current_action || 'delete-avatar' != $bp->action_variables[0] )
+		return false;
+
+	/* Check the nonce */
+	check_admin_referer( 'bp_delete_avatar_link' );
+
+	if ( !bp_is_my_profile() && !is_super_admin() )
+		return false;
+
+	if ( bp_core_delete_existing_avatar( array( 'item_id' => $bp->displayed_user->id ) ) )
+		bp_core_add_message( __( 'Your avatar was deleted successfully!', 'buddypress' ) );
+	else
+		bp_core_add_message( __( 'There was a problem deleting that avatar, please try again.', 'buddypress' ), 'error' );
+
+	bp_core_redirect( wp_get_referer() );
+}
+add_action( 'wp', 'xprofile_action_delete_avatar', 3 );
+
+/********************************************************************************
+ * Activity & Notification Functions
+ *
+ * These functions handle the recording, deleting and formatting of activity and
+ * notifications for the user and for this specific component.
+ */
+
+function xprofile_register_activity_actions() {
+	global $bp;
+
+	if ( !function_exists( 'bp_activity_set_action' ) )
+		return false;
+
+	/* Register the activity stream actions for this component */
+	bp_activity_set_action( $bp->profile->id, 'new_member', __( 'New member registered', 'buddypress' ) );
+	bp_activity_set_action( $bp->profile->id, 'updated_profile', __( 'Updated Profile', 'buddypress' ) );
+
+	do_action( 'xprofile_register_activity_actions' );
+}
+add_action( 'bp_register_activity_actions', 'xprofile_register_activity_actions' );
+
+/**
+ * xprofile_record_activity()
+ *
+ * Records activity for the logged in user within the profile component so that
+ * it will show in the users activity stream (if installed)
+ *
+ * @package BuddyPress XProfile
+ * @param $args Array containing all variables used after extract() call
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @uses bp_activity_record() Adds an entry to the activity component tables for a specific activity
+ */
+function xprofile_record_activity( $args = true ) {
+	global $bp;
+
+	if ( !function_exists( 'bp_activity_add' ) )
+		return false;
+
+	$defaults = array(
+		'user_id' => $bp->loggedin_user->id,
+		'action' => '',
+		'content' => '',
+		'primary_link' => '',
+		'component' => $bp->profile->id,
+		'type' => false,
+		'item_id' => false,
+		'secondary_item_id' => false,
+		'recorded_time' => bp_core_current_time(),
+		'hide_sitewide' => false
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	return bp_activity_add( array( 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
+}
+
+/**
+ * xprofile_delete_activity()
+ *
+ * Deletes activity for a user within the profile component so that
+ * it will be removed from the users activity stream and sitewide stream (if installed)
+ *
+ * @package BuddyPress XProfile
+ * @param $args Array containing all variables used after extract() call
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @uses bp_activity_delete() Deletes an entry to the activity component tables for a specific activity
+ */
+function xprofile_delete_activity( $args = '' ) {
+	global $bp;
+
+	if ( function_exists('bp_activity_delete_by_item_id') ) {
+		extract($args);
+		bp_activity_delete_by_item_id( array( 'item_id' => $item_id, 'component' => $bp->profile->id, 'type' => $type, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) );
+	}
+}
+
+function xprofile_register_activity_action( $key, $value ) {
+	global $bp;
+
+	if ( !function_exists( 'bp_activity_set_action' ) )
+		return false;
+
+	return apply_filters( 'xprofile_register_activity_action', bp_activity_set_action( $bp->profile->id, $key, $value ), $key, $value );
+}
+
+
+/********************************************************************************
+ * Business Functions
+ *
+ * Business functions are where all the magic happens in BuddyPress. They will
+ * handle the actual saving or manipulation of information. Usually they will
+ * hand off to a database class for data access, then return
+ * true or false on success or failure.
+ */
+
+/*** Field Group Management **************************************************/
+
+function xprofile_insert_field_group( $args = '' ) {
+	$defaults = array(
+		'field_group_id' => false,
+		'name' => false,
+		'description' => '',
+		'can_delete' => true
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	if ( !$name )
+		return false;
+
+	$field_group = new BP_XProfile_Group( $field_group_id );
+	$field_group->name = $name;
+	$field_group->description = $description;
+	$field_group->can_delete = $can_delete;
+
+	return $field_group->save();
+}
+
+function xprofile_get_field_group( $field_group_id ) {
+	$field_group = new BP_XProfile_Group( $field_group_id );
+
+	if ( empty( $field_group->id ) )
+		return false;
+
+	return $field_group;
+}
+
+function xprofile_delete_field_group( $field_group_id ) {
+	$field_group = new BP_XProfile_Group( $field_group_id );
+	return $field_group->delete();
+}
+
+
+/*** Field Management *********************************************************/
+
+function xprofile_insert_field( $args = '' ) {
+	global $bp;
+
+	extract( $args );
+
+	/**
+	 * Possible parameters (pass as assoc array):
+	 *	'field_id'
+	 *	'field_group_id'
+	 *	'parent_id'
+	 *	'type'
+	 *	'name'
+	 *	'description'
+	 *	'is_required'
+	 *	'can_delete'
+	 *	'field_order'
+	 *	'order_by'
+	 *	'is_default_option'
+	 *	'option_order'
+	 */
+
+	/* Check we have the minimum details */
+	if ( !$field_group_id )
+		return false;
+
+	/* Check this is a valid field type */
+	if ( !in_array( $type, (array) $bp->profile->field_types ) )
+		return false;
+
+	/* Instantiate a new field object */
+	if ( $field_id )
+		$field = new BP_XProfile_Field( $field_id );
+	else
+		$field = new BP_XProfile_Field;
+
+	$field->group_id = $field_group_id;
+
+	if ( !empty( $parent_id ) )
+		$field->parent_id = $parent_id;
+
+	if ( !empty( $type ) )
+		$field->type = $type;
+
+	if ( !empty( $name ) )
+		$field->name = $name;
+
+	if ( !empty( $description ) )
+		$field->description = $description;
+
+	if ( !empty( $is_required ) )
+		$field->is_required = $is_required;
+
+	if ( !empty( $can_delete ) )
+		$field->can_delete = $can_delete;
+
+	if ( !empty( $field_order ) )
+		$field->field_order = $field_order;
+
+	if ( !empty( $order_by ) )
+		$field->order_by = $order_by;
+
+	if ( !empty( $is_default_option ) )
+		$field->is_default_option = $is_default_option;
+
+	if ( !empty( $option_order ) )
+		$field->option_order = $option_order;
+
+	if ( !$field->save() )
+		return false;
+
+	return true;
+}
+
+function xprofile_get_field( $field_id ) {
+	return new BP_XProfile_Field( $field_id );
+}
+
+function xprofile_delete_field( $field_id ) {
+	$field = new BP_XProfile_Field( $field_id );
+	return $field->delete();
+}
+
+
+/*** Field Data Management *****************************************************/
+
+/**
+ * xprofile_get_field_data()
+ *
+ * Fetches profile data for a specific field for the user.
+ *
+ * @package BuddyPress Core
+ * @param $field The ID of the field, or the $name of the field.
+ * @param $user_id The ID of the user
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @uses BP_XProfile_ProfileData::get_value_byfieldname() Fetches the value based on the params passed.
+ * @return The profile field data.
+ */
+function xprofile_get_field_data( $field, $user_id = null ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = $bp->displayed_user->id;
+
+	if ( !$user_id )
+		return false;
+
+	if ( is_numeric( $field ) )
+		$field_id = $field;
+	else
+		$field_id = xprofile_get_field_id_from_name( $field );
+
+	if ( !$field_id )
+		return false;
+
+	return apply_filters( 'xprofile_get_field_data', BP_XProfile_ProfileData::get_value_byid( $field_id, $user_id ) );
+}
+
+/**
+ * xprofile_set_field_data()
+ *
+ * A simple function to set profile data for a specific field for a specific user.
+ *
+ * @package BuddyPress Core
+ * @param $field The ID of the field, or the $name of the field.
+ * @param $user_id The ID of the user
+ * @param $value The value for the field you want to set for the user.
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @uses xprofile_get_field_id_from_name() Gets the ID for the field based on the name.
+ * @return true on success, false on failure.
+ */
+function xprofile_set_field_data( $field, $user_id, $value, $is_required = false ) {
+	if ( is_numeric( $field ) )
+		$field_id = $field;
+	else
+		$field_id = xprofile_get_field_id_from_name( $field );
+
+	if ( !$field_id )
+		return false;
+
+	if ( $is_required && ( empty( $value ) || !strlen( trim( $value ) ) ) )
+		return false;
+
+	/* If the value is empty, then delete any field data that exists */
+	if ( empty( $value ) ) {
+		xprofile_delete_field_data( $field_id, $user_id );
+		return true;
+	}
+
+	$field = new BP_XProfile_Field( $field_id );
+
+	/* Check the value is an acceptable value */
+	if ( 'checkbox' == $field->type || 'radio' == $field->type || 'selectbox' == $field->type || 'multiselectbox' == $field->type ) {
+		$options = $field->get_children();
+
+		foreach( $options as $option )
+			$possible_values[] = $option->name;
+
+		if ( is_array( $value ) ) {
+			foreach( $value as $i => $single ) {
+				if ( !in_array( $single, (array)$possible_values ) )
+					unset( $value[$i] );
+			}
+
+			if ( empty( $value ) )
+				return false;
+
+			/* Reset the keys by merging with an empty array */
+			$value = array_merge( array(), $value );
+		} else {
+			if ( !in_array( $value, (array)$possible_values ) )
+				return false;
+		}
+	}
+
+	$field = new BP_XProfile_ProfileData();
+	$field->field_id = $field_id;
+	$field->user_id = $user_id;
+	$field->value = maybe_serialize( $value );
+
+	return $field->save();
+}
+
+function xprofile_delete_field_data( $field, $user_id ) {
+	if ( is_numeric( $field ) )
+		$field_id = $field;
+	else
+		$field_id = xprofile_get_field_id_from_name( $field );
+
+	if ( empty( $field_id ) || empty( $user_id ) )
+		return false;
+
+	$field = new BP_XProfile_ProfileData( $field_id, $user_id );
+	return $field->delete();
+}
+
+function xprofile_check_is_required_field( $field_id ) {
+	$field = new BP_Xprofile_Field( $field_id );
+
+	if ( (int)$field->is_required )
+		return true;
+
+	return false;
+}
+
+/**
+ * xprofile_get_field_id_from_name()
+ *
+ * Returns the ID for the field based on the field name.
+ *
+ * @package BuddyPress Core
+ * @param $field_name The name of the field to get the ID for.
+ * @return int $field_id on success, false on failure.
+ */
+function xprofile_get_field_id_from_name( $field_name ) {
+	return BP_Xprofile_Field::get_id_from_name( $field_name );
+}
+
+/**
+ * xprofile_get_random_profile_data()
+ *
+ * Fetches a random piece of profile data for the user.
+ *
+ * @package BuddyPress Core
+ * @param $user_id User ID of the user to get random data for
+ * @param $exclude_fullname whether or not to exclude the full name field as random data.
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @global $wpdb WordPress DB access object.
+ * @global $current_user WordPress global variable containing current logged in user information
+ * @uses xprofile_format_profile_field() Formats profile field data so it is suitable for display.
+ * @return $field_data The fetched random data for the user.
+ */
+function xprofile_get_random_profile_data( $user_id, $exclude_fullname = true ) {
+	$field_data = BP_XProfile_ProfileData::get_random( $user_id, $exclude_fullname );
+	$field_data[0]->value = xprofile_format_profile_field( $field_data[0]->type, $field_data[0]->value );
+
+	if ( !$field_data[0]->value || empty( $field_data[0]->value ) )
+		return false;
+
+	return apply_filters( 'xprofile_get_random_profile_data', $field_data );
+}
+
+/**
+ * xprofile_format_profile_field()
+ *
+ * Formats a profile field according to its type. [ TODO: Should really be moved to filters ]
+ *
+ * @package BuddyPress Core
+ * @param $field_type The type of field: datebox, selectbox, textbox etc
+ * @param $field_value The actual value
+ * @uses bp_format_time() Formats a time value based on the WordPress date format setting
+ * @return $field_value The formatted value
+ */
+function xprofile_format_profile_field( $field_type, $field_value ) {
+	if ( !isset($field_value) || empty( $field_value ) )
+		return false;
+
+	$field_value = bp_unserialize_profile_field( $field_value );
+
+	if ( 'datebox' == $field_type ) {
+		$field_value = bp_format_time( $field_value, true );
+	} else {
+		$content = $field_value;
+		$field_value = str_replace(']]>', ']]&gt;', $content);
+	}
+
+	return stripslashes_deep( $field_value );
+}
+
+function xprofile_update_field_position( $field_id, $position ) {
+	return BP_XProfile_Field::update_position( $field_id, $position);
+}
+
+/**
+ * xprofile_avatar_upload_dir()
+ *
+ * Setup the avatar upload directory for a user.
+ *
+ * @package BuddyPress Core
+ * @param $directory The root directory name
+ * @param $user_id The user ID.
+ * @return array() containing the path and URL plus some other settings.
+ */
+function xprofile_avatar_upload_dir( $directory = false, $user_id = false ) {
+	global $bp;
+
+	if ( !$user_id )
+		$user_id = $bp->displayed_user->id;
+
+	if ( !$directory )
+		$directory = 'avatars';
+
+	$path  = BP_AVATAR_UPLOAD_PATH . '/avatars/' . $user_id;
+	$newbdir = $path;
+
+	if ( !file_exists( $path ) )
+		@wp_mkdir_p( $path );
+
+	$newurl  = BP_AVATAR_URL . '/avatars/' . $user_id;
+	$newburl = $newurl;
+	$newsubdir = '/avatars/' . $user_id;
+
+	return apply_filters( 'xprofile_avatar_upload_dir', array( 'path' => $path, 'url' => $newurl, 'subdir' => $newsubdir, 'basedir' => $newbdir, 'baseurl' => $newburl, 'error' => false ) );
+}
+
+/**
+ * xprofile_sync_wp_profile()
+ *
+ * Syncs Xprofile data to the standard built in WordPress profile data.
+ *
+ * @package BuddyPress Core
+ */
+function xprofile_sync_wp_profile( $user_id = false ) {
+	global $bp, $wpdb;
+
+	if ( (int)$bp->site_options['bp-disable-profile-sync'] )
+		return true;
+
+	if ( empty( $user_id ) )
+		$user_id = $bp->loggedin_user->id;
+
+	if ( empty( $user_id ) )
+		return false;
+
+	$fullname = xprofile_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id );
+	$space = strpos( $fullname, ' ' );
+
+	if ( false === $space ) {
+		$firstname = $fullname;
+		$lastname = '';
+	} else {
+		$firstname = substr( $fullname, 0, $space );
+		$lastname = trim( substr( $fullname, $space, strlen($fullname) ) );
+	}
+
+	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 ) );
+}
+add_action( 'xprofile_updated_profile', 'xprofile_sync_wp_profile' );
+add_action( 'bp_core_signup_user', 'xprofile_sync_wp_profile' );
+
+
+/* xprofile_sync_bp_profile()
+ *
+ * Syncs the standard built in WordPress profile data to XProfile.
+ *
+ * @since 1.2.4
+ * @package BuddyPress Core
+ */
+function xprofile_sync_bp_profile( &$errors, $update, &$user ) {
+	global $bp;
+
+	if ( (int)$bp->site_options['bp-disable-profile-sync'] || !$update || $errors->get_error_codes() )
+		return;
+
+	xprofile_set_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user->ID, $user->display_name );
+}
+add_action( 'user_profile_update_errors', 'xprofile_sync_bp_profile', 10, 3 );
+
+/**
+ * xprofile_remove_screen_notifications()
+ *
+ * Removes notifications from the notification menu when a user clicks on them and
+ * is taken to a specific screen.
+ *
+ * @package BuddyPress Core
+ */
+function xprofile_remove_screen_notifications() {
+	global $bp;
+
+	bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->profile->id, 'new_at_mention' );
+}
+add_action( 'bp_activity_screen_my_activity', 'xprofile_remove_screen_notifications' );
+add_action( 'bp_activity_screen_single_activity_permalink', 'xprofile_remove_screen_notifications' );
+
+
+/**
+ * xprofile_remove_data_on_user_deletion()
+ *
+ * When a user is deleted, we need to clean up the database and remove all the
+ * profile data from each table. Also we need to clean anything up in the usermeta table
+ * that this component uses.
+ *
+ * @package BuddyPress XProfile
+ * @param $user_id The ID of the deleted user
+ * @uses get_user_meta() Get a user meta value based on meta key from wp_usermeta
+ * @uses delete_user_meta() Delete user meta value based on meta key from wp_usermeta
+ * @uses delete_data_for_user() Removes all profile data from the xprofile tables for the user
+ */
+function xprofile_remove_data( $user_id ) {
+	BP_XProfile_ProfileData::delete_data_for_user( $user_id );
+
+	// delete any avatar files.
+	@unlink( get_user_meta( $user_id, 'bp_core_avatar_v1_path', true ) );
+	@unlink( get_user_meta( $user_id, 'bp_core_avatar_v2_path', true ) );
+
+	// unset the usermeta for avatars from the usermeta table.
+	delete_user_meta( $user_id, 'bp_core_avatar_v1' );
+	delete_user_meta( $user_id, 'bp_core_avatar_v1_path' );
+	delete_user_meta( $user_id, 'bp_core_avatar_v2' );
+	delete_user_meta( $user_id, 'bp_core_avatar_v2_path' );
+}
+add_action( 'wpmu_delete_user', 'xprofile_remove_data' );
+add_action( 'delete_user', 'xprofile_remove_data' );
+add_action( 'make_spam_user', 'xprofile_remove_data' );
+
+
+/********************************************************************************
+ * Caching
+ *
+ * Caching functions handle the clearing of cached objects and pages on specific
+ * actions throughout BuddyPress.
+ */
+
+function xprofile_clear_profile_groups_object_cache( $group_obj ) {
+	wp_cache_delete( 'xprofile_groups', 'bp' );
+	wp_cache_delete( 'xprofile_groups_inc_empty', 'bp' );
+	wp_cache_delete( 'xprofile_group_' . $group_obj->id );
+
+	/* Clear the sitewide activity cache */
+	wp_cache_delete( 'sitewide_activity', 'bp' );
+}
+
+function xprofile_clear_profile_data_object_cache( $group_id ) {
+	global $bp;
+	wp_cache_delete( 'xprofile_fields_' . $group_id . '_' . $bp->loggedin_user->id, 'bp' );
+	wp_cache_delete( 'bp_user_fullname_' . $bp->loggedin_user->id, 'bp' );
+	wp_cache_delete( 'online_users', 'bp' );
+	wp_cache_delete( 'newest_users', 'bp' );
+	wp_cache_delete( 'popular_users', 'bp' );
+
+	/* Clear the sitewide activity cache */
+	wp_cache_delete( 'sitewide_activity', 'bp' );
+}
+
+// List actions to clear object caches on
+add_action( 'xprofile_groups_deleted_group', 'xprofile_clear_profile_groups_object_cache' );
+add_action( 'xprofile_groups_saved_group', 'xprofile_clear_profile_groups_object_cache' );
+add_action( 'xprofile_updated_profile', 'xprofile_clear_profile_data_object_cache' );
+
+// List actions to clear super cached pages on, if super cache is installed
+add_action( 'xprofile_updated_profile', 'bp_core_clear_cache' );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-xprofile/admin/css/admin.css b/wp-content/plugins/buddypress/bp-xprofile/admin/css/admin.css
new file mode 100644
index 0000000000000000000000000000000000000000..b766abfcbba0964ae3a0d6752b21e6d11d3eed88
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-xprofile/admin/css/admin.css
@@ -0,0 +1,92 @@
+table.field-group tbody {
+	cursor: move;
+}
+	table.field-group tbody tr.nodrag {
+		cursor: default !important;
+	}
+
+table.field-group tbody tr:hover {
+	background-color: #fffee9;
+}
+	
+table.field-group tr.header td {
+	border-bottom: 2px solid #eee;
+	font-weight: bold;
+}
+
+tr.core td { color: #999; }
+
+	ul.forTab {
+		list-style: none;
+		padding: 0;
+		margin: 0 0 0 1em;
+	}
+		ul.forTab li {
+			margin: 0 0 1em 0;
+		}
+	
+			ul.forTab li label {
+				display: block;
+				
+			}
+	
+			ul.forTab li input {
+				font-size: 1.4em;
+			}
+	
+	p.success { background: green;}
+	p.err {
+		border-top: 2px solid red;
+		border-bottom: 2px solid red;
+		color: red;
+		padding: 5px 0;
+		width: 40%;
+	}
+	
+	span.desc, span.signup-description {
+		display: block;
+		font-size: 11px;
+		color: #555;
+	}
+
+	select.multi-select {
+		width:90%;
+		height:10em !important;
+	}
+
+ul.multi-checkbox {
+	margin: 0 5px 0 0px;
+	padding: .5em .9em;
+	height: 10em;
+	overflow: auto;
+	list-style: none;
+	border: solid 1px #ccc;
+	width: 90%;
+}
+
+ul.multi-checkbox li {
+	padding: 0;
+	margin: 0;
+}
+
+div.options-box {
+	margin-left: 20px !important;
+	margin-right: 10px !important;
+	border-left: 4px solid #EAF3FA;
+	padding-left: 15px;
+}
+
+th a {
+	background: #fff;
+	padding: 2px 5px;
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	top: -2px;
+}
+
+textarea#description {
+	border: 1px solid #ddd;
+	width: 85%;
+}
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-xprofile/admin/images/move.gif b/wp-content/plugins/buddypress/bp-xprofile/admin/images/move.gif
new file mode 100644
index 0000000000000000000000000000000000000000..748fbf9b74bd84a57a6828fa68198c67f2fed4f5
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-xprofile/admin/images/move.gif differ
diff --git a/wp-content/plugins/buddypress/bp-xprofile/admin/images/tick.gif b/wp-content/plugins/buddypress/bp-xprofile/admin/images/tick.gif
new file mode 100644
index 0000000000000000000000000000000000000000..a3189f4c5ae084117de3bb3d4d9baca289ea2a48
Binary files /dev/null and b/wp-content/plugins/buddypress/bp-xprofile/admin/images/tick.gif differ
diff --git a/wp-content/plugins/buddypress/bp-xprofile/admin/js/admin.js b/wp-content/plugins/buddypress/bp-xprofile/admin/js/admin.js
new file mode 100644
index 0000000000000000000000000000000000000000..6302caad3fe99719368b698fe866aa86c9139ec6
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-xprofile/admin/js/admin.js
@@ -0,0 +1,136 @@
+function add_option(forWhat) {
+	var holder = document.getElementById(forWhat + "_more");
+	var theId = document.getElementById(forWhat + '_option_number').value;
+
+	var newDiv = document.createElement('p');
+	newDiv.setAttribute('id', forWhat + '_div' + theId);
+
+	var newOption = document.createElement('input');
+	newOption.setAttribute('type', 'text');
+	newOption.setAttribute('name', forWhat + '_option[' + theId + ']');
+	newOption.setAttribute('id', forWhat + '_option' + theId);
+
+	var label = document.createElement('label');
+	label.setAttribute('for', forWhat + '_option' + theId);
+	
+	var txt = document.createTextNode("Option " + theId + ": ");
+	label.appendChild(txt);
+	
+	var isDefault = document.createElement('input');
+	
+	if(forWhat == 'checkbox' || forWhat == 'multiselectbox') {
+		isDefault.setAttribute('type', 'checkbox');
+		isDefault.setAttribute('name', 'isDefault_' + forWhat + '_option[' + theId + ']');
+	} else {
+		isDefault.setAttribute('type', 'radio');
+		isDefault.setAttribute('name', 'isDefault_' + forWhat + '_option');					
+	}
+	
+	isDefault.setAttribute('value', theId);
+	
+	var label1 = document.createElement('label');
+	var txt1 = document.createTextNode(" Default Value ");
+	
+	label1.appendChild(txt1);
+	label1.setAttribute('for', 'isDefault_' + forWhat + '_option[]');
+	toDelete = document.createElement('a');
+	
+	toDeleteText = document.createTextNode('[x]');
+	toDelete.setAttribute('href',"javascript:hide('" + forWhat + '_div' + theId + "')");
+	
+	toDelete.setAttribute('class','delete');
+
+	toDelete.appendChild(toDeleteText);
+
+	newDiv.appendChild(label);
+	newDiv.appendChild(newOption);
+	newDiv.appendChild(document.createTextNode(" "));
+	newDiv.appendChild(isDefault);
+	newDiv.appendChild(label1);	
+	newDiv.appendChild(toDelete);	
+	holder.appendChild(newDiv);
+	
+	
+	theId++
+	document.getElementById(forWhat + "_option_number").value = theId;
+}
+
+function show_options(forWhat) {
+	document.getElementById("radio").style.display = "none";
+	document.getElementById("selectbox").style.display = "none";
+	document.getElementById("multiselectbox").style.display = "none";
+	document.getElementById("checkbox").style.display = "none";
+	
+	if(forWhat == "radio") {
+		document.getElementById("radio").style.display = "";
+	}
+	
+	if(forWhat == "selectbox") {
+		document.getElementById("selectbox").style.display = "";						
+	}
+	
+	if(forWhat == "multiselectbox") {
+		document.getElementById("multiselectbox").style.display = "";						
+	}
+	
+	if(forWhat == "checkbox") {
+		document.getElementById("checkbox").style.display = "";						
+	}
+}
+
+function hide(id) {
+	if ( !document.getElementById(id) ) return false;
+	
+	document.getElementById(id).style.display = "none";
+	document.getElementById(id).value = '';
+}
+
+// Set up deleting options ajax
+jQuery(document).ready( function() {
+	
+	jQuery("a.ajax-option-delete").click( 
+		function() {
+			var theId = this.id.split('-');
+			theId = theId[1];
+			
+			jQuery.post( ajaxurl, {
+				action: 'xprofile_delete_option',
+				'cookie': encodeURIComponent(document.cookie),
+				'_wpnonce': jQuery("input#_wpnonce").val(),
+				
+				'option_id': theId
+			},
+			function(response)
+			{});
+		}
+	);				
+});
+
+var fixHelper = function(e, ui) {
+	ui.children().each(function() {
+		jQuery(this).width( jQuery(this).width() );
+	});
+	return ui;
+};
+
+jQuery(document).ready( function() {
+	jQuery("table.field-group tbody").sortable( {
+		cursor: 'move',
+		axis: 'y',
+		helper: fixHelper,
+		distance: 1,
+		cancel: 'tr.nodrag',
+		update: function() { 
+			jQuery.post( ajaxurl, {
+				action: 'xprofile_reorder_fields',
+				'cookie': encodeURIComponent(document.cookie),
+				'_wpnonce_reorder_fields': jQuery("input#_wpnonce_reorder_fields").val(),
+				
+				'field_order': jQuery(this).sortable('serialize')
+			},
+			function(response)
+			{});
+
+		}
+	});
+} );
diff --git a/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-admin.php b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-admin.php
new file mode 100644
index 0000000000000000000000000000000000000000..41f0342affd55192ed65d7a5dfad881ec72a7768
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-admin.php
@@ -0,0 +1,301 @@
+<?php
+
+
+/**************************************************************************
+ xprofile_admin()
+
+ Handles all actions for the admin area for creating, editing and deleting
+ profile groups and fields.
+ **************************************************************************/
+
+function xprofile_admin( $message = '', $type = 'error' ) {
+	global $bp;
+
+	$type = preg_replace( '|[^a-z]|i', '', $type );
+
+	$groups = BP_XProfile_Group::get( array(
+		'fetch_fields' => true
+	) );
+
+	if ( isset($_GET['mode']) && isset($_GET['group_id']) && 'add_field' == $_GET['mode'] ) {
+		xprofile_admin_manage_field($_GET['group_id']);
+	} else if ( isset($_GET['mode']) && isset($_GET['group_id']) && isset($_GET['field_id']) && 'edit_field' == $_GET['mode'] ) {
+		xprofile_admin_manage_field($_GET['group_id'], $_GET['field_id']);
+	} else if ( isset($_GET['mode']) && isset($_GET['field_id']) && 'delete_field' == $_GET['mode'] ) {
+		xprofile_admin_delete_field($_GET['field_id'], 'field');
+	} else if ( isset($_GET['mode']) && isset($_GET['option_id']) && 'delete_option' == $_GET['mode'] ) {
+		xprofile_admin_delete_field($_GET['option_id'], 'option');
+	} else if ( isset($_GET['mode']) && 'add_group' == $_GET['mode'] ) {
+		xprofile_admin_manage_group();
+	} else if ( isset($_GET['mode']) && isset($_GET['group_id']) && 'delete_group' == $_GET['mode'] ) {
+		xprofile_admin_delete_group($_GET['group_id']);
+	} else if ( isset($_GET['mode']) && isset($_GET['group_id']) && 'edit_group' == $_GET['mode'] ) {
+		xprofile_admin_manage_group($_GET['group_id']);
+	} else {
+?>
+	<div class="wrap">
+
+		<h2><?php _e( 'Profile Field Setup', 'buddypress') ?></h2>
+		<br />
+		<p><?php _e( 'Your users will distinguish themselves through their profile page. You must give them profile fields that allow them to describe themselves in a way that is relevant to the theme of your social network.', 'buddypress') ?></p>
+		<p><?php _e('NOTE: Any fields in the first group will appear on the signup page.', 'buddypress'); ?></p>
+
+		<form action="" id="profile-field-form" method="post">
+
+			<?php wp_nonce_field( 'bp_reorder_fields', '_wpnonce_reorder_fields' ); ?>
+
+			<?php
+				if ( $message != '' ) {
+					$type = ( $type == 'error' ) ? 'error' : 'updated';
+			?>
+				<div id="message" class="<?php echo $type; ?> fade">
+					<p><?php echo wp_specialchars( esc_attr( $message ) ); ?></p>
+				</div>
+			<?php }
+
+			if ( $groups ) { ?>
+				<?php
+				for ( $i = 0; $i < count($groups); $i++ ) { // TODO: foreach
+				?>
+					<p>
+					<table id="group_<?php echo $groups[$i]->id;?>" class="widefat field-group">
+						<thead>
+						    <tr>
+								<th scope="col" width="10">&nbsp;</th>
+						    	<th scope="col" colspan="<?php if ( $groups[$i]->can_delete ) { ?>3<?php } else { ?>5<?php } ?>"><?php echo esc_attr( $groups[$i]->name ); ?></th>
+								<?php if ( $groups[$i]->can_delete ) { ?>
+									<th scope="col"><a class="edit" href="admin.php?page=bp-profile-setup&amp;mode=edit_group&amp;group_id=<?php echo esc_attr( $groups[$i]->id ); ?>"><?php _e( 'Edit', 'buddypress' ) ?></a></th>
+						    		<th scope="col"><a class="delete" href="admin.php?page=bp-profile-setup&amp;mode=delete_group&amp;group_id=<?php echo esc_attr( $groups[$i]->id ); ?>"><?php _e( 'Delete', 'buddypress' ) ?></a></th>
+								<?php } ?>
+							</tr>
+							<tr class="header">
+								<td>&nbsp;</td>
+						    	<td><?php _e( 'Field Name', 'buddypress' ) ?></td>
+						    	<td width="14%"><?php _e( 'Field Type', 'buddypress' ) ?></td>
+						    	<td width="6%"><?php _e( 'Required?', 'buddypress' ) ?></td>
+						    	<td colspan="2" width="10%" style="text-align:center;"><?php _e( 'Action', 'buddypress' ) ?></td>
+						    </tr>
+						</thead>
+						<tbody id="the-list">
+
+						  <?php if ( $groups[$i]->fields ) { ?>
+
+						    	<?php for ( $j = 0; $j < count($groups[$i]->fields); $j++ ) { ?>
+
+									<?php if ( 0 == $j % 2 ) { $class = ""; } else { $class = "alternate"; } ?>
+									<?php $field = new BP_XProfile_Field($groups[$i]->fields[$j]->id); ?>
+									<?php if ( !$field->can_delete ) { $class .= ' core'; } ?>
+
+									<tr id="field_<?php echo esc_attr( $field->id ); ?>" class="sortable<?php if ( $class ) { echo ' ' . $class; } ?>">
+								    	<td width="10"><img src="<?php echo BP_PLUGIN_URL ?>/bp-xprofile/admin/images/move.gif" alt="<?php _e( 'Drag', 'buddypress' ) ?>" /></td>
+										<td><span title="<?php echo $field->description; ?>"><?php echo esc_attr( $field->name ); ?> <?php if(!$field->can_delete) { ?> <?php _e( '(Core Field)', 'buddypress' ) ?><?php } ?></span></td>
+								    	<td><?php echo esc_attr( $field->type ); ?></td>
+								    	<td style="text-align:center;"><?php if ( $field->is_required ) { echo '<img src="' . BP_PLUGIN_URL . '/bp-xprofile/admin/images/tick.gif" alt="' . __( 'Yes', 'buddypress' ) . '" />'; } else { ?>--<?php } ?></td>
+								    	<td style="text-align:center;"><?php if ( !$field->can_delete ) { ?><strike><?php _e( 'Edit', 'buddypress' ) ?></strike><?php } else { ?><a class="edit" href="admin.php?page=bp-profile-setup&amp;group_id=<?php echo esc_attr( $groups[$i]->id ); ?>&amp;field_id=<?php echo esc_attr( $field->id ); ?>&amp;mode=edit_field"><?php _e( 'Edit', 'buddypress' ) ?></a><?php } ?></td>
+								    	<td style="text-align:center;"><?php if ( !$field->can_delete ) { ?><strike><?php _e( 'Delete', 'buddypress' ) ?></strike><?php } else { ?><a class="delete" href="admin.php?page=bp-profile-setup&amp;field_id=<?php echo esc_attr( $field->id ); ?>&amp;mode=delete_field"><?php _e( 'Delete', 'buddypress' ) ?></a><?php } ?></td>
+								    </tr>
+
+								<?php } ?>
+
+							<?php } else { ?>
+
+								<tr class="nodrag">
+									<td colspan="6"><?php _e( 'There are no fields in this group.', 'buddypress' ) ?></td>
+								</tr>
+
+							<?php } ?>
+
+						</tbody>
+
+						<tfoot>
+
+								<tr class="nodrag">
+									<td colspan="6"><a href="admin.php?page=bp-profile-setup&amp;group_id=<?php echo esc_attr( $groups[$i]->id ); ?>&amp;mode=add_field"><?php _e( 'Add New Field', 'buddypress' ) ?></a></td>
+								</tr>
+
+						</tfoot>
+
+					</table>
+					</p>
+
+				<?php } /* End For */ ?>
+
+					<p>
+						<a class="button" href="admin.php?page=bp-profile-setup&amp;mode=add_group"><?php _e( 'Add New Field Group', 'buddypress' ) ?></a>
+					</p>
+
+			<?php } else { ?>
+				<div id="message" class="error"><p><?php _e('You have no groups.', 'buddypress' ); ?></p></div>
+				<p><a href="admin.php?page=bp-profile-setup&amp;mode=add_group"><?php _e( 'Add New Group', 'buddypress' ) ?></a></p>
+			<?php } ?>
+
+		</form>
+
+	</div>
+<?php
+	}
+}
+
+
+/**************************************************************************
+ xprofile_admin_manage_group()
+
+ Handles the adding or editing of groups.
+ **************************************************************************/
+
+function xprofile_admin_manage_group( $group_id = null ) {
+	global $message, $type;
+
+	$group = new BP_XProfile_Group($group_id);
+
+	if ( isset($_POST['saveGroup']) ) {
+		if ( BP_XProfile_Group::admin_validate($_POST) ) {
+			$group->name = wp_filter_kses( $_POST['group_name'] );
+			$group->description = wp_filter_kses( $_POST['group_desc'] );
+
+			if ( !$group->save() ) {
+				$message = __('There was an error saving the group. Please try again', 'buddypress');
+				$type = 'error';
+			} else {
+				$message = __('The group was saved successfully.', 'buddypress');
+				$type = 'success';
+
+				do_action( 'xprofile_groups_saved_group', $group );
+			}
+
+			unset($_GET['mode']);
+			xprofile_admin( $message, $type );
+
+		} else {
+			$group->render_admin_form($message);
+		}
+	} else {
+		$group->render_admin_form();
+	}
+}
+
+/**************************************************************************
+ xprofile_admin_delete_group()
+
+ Handles the deletion of profile data groups.
+ **************************************************************************/
+
+function xprofile_admin_delete_group( $group_id ) {
+	global $message, $type;
+
+	$group = new BP_XProfile_Group($group_id);
+
+	if ( !$group->delete() ) {
+		$message = __('There was an error deleting the group. Please try again', 'buddypress');
+		$type = 'error';
+	} else {
+		$message = __('The group was deleted successfully.', 'buddypress');
+		$type = 'success';
+
+		do_action( 'xprofile_groups_deleted_group', $group );
+	}
+
+	unset($_GET['mode']); // TODO: wtf?
+	xprofile_admin( $message, $type );
+}
+
+
+/**************************************************************************
+ xprofile_admin_manage_field()
+
+ Handles the adding or editing of profile field data for a user.
+ **************************************************************************/
+
+function xprofile_admin_manage_field( $group_id, $field_id = null ) {
+	global $bp, $wpdb, $message, $groups;
+
+	$field = new BP_XProfile_Field($field_id);
+	$field->group_id = $group_id;
+
+	if ( isset($_POST['saveField']) ) {
+		if ( BP_XProfile_Field::admin_validate() ) {
+			$field->name = wp_filter_kses( $_POST['title'] );
+			$field->description = wp_filter_kses( $_POST['description'] );
+			$field->is_required = wp_filter_kses( $_POST['required'] );
+			$field->type = wp_filter_kses( $_POST['fieldtype'] );
+			$field->order_by = wp_filter_kses( $_POST["sort_order_{$field->type}"] );
+
+			$field->field_order = $wpdb->get_var( $wpdb->prepare( "SELECT field_order FROM {$bp->profile->table_name_fields} WHERE id = %d", $field_id ) );
+
+			if ( !$field->field_order ) {
+				$field->field_order = (int) $wpdb->get_var( $wpdb->prepare( "SELECT max(field_order) FROM {$bp->profile->table_name_fields} WHERE group_id = %d", $group_id ) );
+				$field->field_order++;
+			}
+
+			if ( !$field->save() ) {
+				$message = __('There was an error saving the field. Please try again', 'buddypress');
+				$type = 'error';
+
+				unset($_GET['mode']);
+				xprofile_admin($message, $type);
+			} else {
+				$message = __('The field was saved successfully.', 'buddypress');
+				$type = 'success';
+
+				unset($_GET['mode']);
+
+				do_action( 'xprofile_fields_saved_field', $field );
+
+				$groups = BP_XProfile_Group::get();
+				xprofile_admin( $message, $type );
+			}
+		} else {
+			$field->render_admin_form($message);
+		}
+	} else {
+		$field->render_admin_form();
+	}
+}
+
+/**************************************************************************
+ xprofile_admin_delete_field()
+
+ Handles the deletion of a profile field [or option].
+**************************************************************************/
+
+function xprofile_admin_delete_field( $field_id, $type = 'field' ) {
+	global $message, $type;
+
+	if ( 'field' == $type ) {
+		$type = __('field', 'buddypress');
+	} else {
+		$type = __('option', 'buddypress');
+	}
+
+	$field = new BP_XProfile_Field($field_id);
+
+	if ( !$field->delete() ) {
+		$message = sprintf( __('There was an error deleting the %s. Please try again', 'buddypress'), $type);
+		$type = 'error';
+	} else {
+		$message = sprintf( __('The %s was deleted successfully!', 'buddypress'), $type);
+		$type = 'success';
+
+		do_action( 'xprofile_fields_deleted_field', $field );
+	}
+
+	unset($_GET['mode']);
+	xprofile_admin($message, $type);
+}
+
+function xprofile_ajax_reorder_fields() {
+	global $bp;
+
+	/* Check the nonce */
+	check_admin_referer( 'bp_reorder_fields', '_wpnonce_reorder_fields' );
+
+	if ( empty( $_POST['field_order'] ) )
+		return false;
+
+	parse_str($_POST['field_order'], $order );
+
+	foreach ( (array) $order['field'] as $position => $field_id ) {
+		xprofile_update_field_position( (int) $field_id, (int) $position );
+	}
+}
+add_action( 'wp_ajax_xprofile_reorder_fields', 'xprofile_ajax_reorder_fields' );
diff --git a/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-classes.php b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-classes.php
new file mode 100644
index 0000000000000000000000000000000000000000..9597c46d909bc47829805639757a5230dd6d6208
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-classes.php
@@ -0,0 +1,912 @@
+<?php
+
+Class BP_XProfile_Group {
+	var $id = null;
+	var $name;
+	var $description;
+	var $can_delete;
+	var $fields;
+
+	function bp_xprofile_group( $id = null ) {
+		global $bp, $wpdb;
+
+		if ( $id ) {
+			$this->populate( $id );
+		}
+	}
+
+	function populate( $id ) {
+		global $wpdb, $bp;
+
+		$sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_groups} WHERE id = %d", $id );
+
+		if ( !$group = $wpdb->get_row($sql) )
+			return false;
+
+		$this->id = $group->id;
+		$this->name = $group->name;
+		$this->description = $group->description;
+		$this->can_delete = $group->can_delete;
+	}
+
+	function save() {
+		global $wpdb, $bp;
+
+		$this->name = apply_filters( 'xprofile_group_name_before_save', $this->name, $this->id );
+		$this->description = apply_filters( 'xprofile_group_description_before_save', $this->description, $this->id );
+
+		do_action( 'xprofile_group_before_save', $this );
+
+		if ( $this->id ) {
+			$sql = $wpdb->prepare( "UPDATE {$bp->profile->table_name_groups} SET name = %s, description = %s WHERE id = %d", $this->name, $this->description, $this->id );
+		} else {
+			$sql = $wpdb->prepare( "INSERT INTO {$bp->profile->table_name_groups} (name, description, can_delete) VALUES (%s, %s, 1)", $this->name, $this->description );
+		}
+
+		if ( !$wpdb->query($sql) )
+			return false;
+
+		do_action( 'xprofile_group_after_save', $this );
+
+		if ( $this->id )
+			return $this->id;
+		else
+			return $wpdb->insert_id;
+	}
+
+	function delete() {
+		global $wpdb, $bp;
+
+		if ( !$this->can_delete )
+			return false;
+
+		$sql = $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_groups} WHERE id = %d", $this->id );
+
+		if ( !$wpdb->query($sql) ) {
+			return false;
+		} else {
+			// Now the group is deleted, remove the group's fields.
+			if ( BP_XProfile_Field::delete_for_group($this->id) ) {
+				// Now delete all the profile data for the groups fields
+				for ( $i = 0; $i < count($this->fields); $i++ ) {
+					BP_XProfile_ProfileData::delete_for_field($this->fields[$i]->id);
+				}
+			}
+
+			return true;
+		}
+	}
+
+	/** Static Functions **/
+
+	function get( $args = '' ) {
+		global $wpdb, $bp;
+
+		$defaults = array(
+			'profile_group_id' => false,
+			'user_id' => $bp->displayed_user->id,
+			'hide_empty_groups' => false,
+			'fetch_fields' => false,
+			'fetch_field_data' => false
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		if ( $profile_group_id )
+			$group_id_sql = $wpdb->prepare( 'WHERE g.id = %d', $profile_group_id );
+
+		if ( $hide_empty_groups )
+			$groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT g.* FROM {$bp->profile->table_name_groups} g INNER JOIN {$bp->profile->table_name_fields} f ON g.id = f.group_id {$group_id_sql} ORDER BY g.id ASC" ) );
+		else
+			$groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT g.* FROM {$bp->profile->table_name_groups} g {$group_id_sql} ORDER BY g.id ASC" ) );
+
+		if ( !$fetch_fields )
+			return $groups;
+
+		/* Get the group ids */
+		foreach( (array)$groups as $group )
+			$group_ids[] = $group->id;
+
+		$group_ids = implode( ',', (array) $group_ids );
+
+		if ( empty( $group_ids ) )
+			return $groups;
+
+		/* Fetch the fields */
+		$fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, name, description, type, group_id, is_required FROM {$bp->profile->table_name_fields} WHERE group_id IN ( {$group_ids} ) AND parent_id = 0 ORDER BY field_order" ) );
+
+		if ( empty( $fields ) )
+			return $groups;
+
+		if ( $fetch_field_data ) {
+			/* Fetch the field data for the user. */
+			foreach( (array)$fields as $field )
+				$field_ids[] = $field->id;
+
+			$field_ids = implode( ',', (array) $field_ids );
+
+			if ( !empty( $field_ids ) )
+				$field_data = $wpdb->get_results( $wpdb->prepare( "SELECT field_id, value FROM {$bp->profile->table_name_data} WHERE field_id IN ( {$field_ids} ) AND user_id = %d", $user_id ) );
+
+			if ( !empty( $field_data ) ) {
+				foreach( (array)$fields as $field_key => $field ) {
+					foreach( (array)$field_data as $data ) {
+						if ( $field->id == $data->field_id )
+							$fields[$field_key]->data->value = $data->value;
+					}
+				}
+			}
+		}
+
+		/* Merge the field array back in with the group array */
+		foreach( (array)$groups as $group_key => $group ) {
+			foreach( (array)$fields as $field ) {
+				if ( $group->id == $field->group_id )
+					$groups[$group_key]->fields[] = $field;
+			}
+		}
+
+		return $groups;
+	}
+
+	function admin_validate() {
+		global $message;
+
+		// Validate Form
+		if ( empty( $_POST['group_name'] ) ) {
+			$message = __('Please make sure you give the group a name.', 'buddypress');
+			return false;
+		} else {
+			return true;
+		}
+	}
+
+	// ADMIN AREA HTML. TODO: Get this out of here.
+
+	function render_admin_form() {
+		global $message;
+
+		if ( !$this->id ) {
+			$title = __('Add New Field Group', 'buddypress');
+			$action = "admin.php?page=bp-profile-setup&amp;mode=add_group";
+		} else {
+			$title = __('Edit Field Group', 'buddypress');
+			$action = "admin.php?page=bp-profile-setup&amp;mode=edit_group&amp;group_id=" . $this->id;
+		}
+	?>
+		<div class="wrap">
+
+			<h2><?php echo $title; ?></h2>
+			<br />
+
+			<?php
+				if ( $message != '' ) {
+					$type = ( 'error' == $type ) ? 'error' : 'updated';
+			?>
+				<div id="message" class="<?php echo $type; ?> fade">
+					<p><?php echo $message; ?></p>
+				</div>
+			<?php } ?>
+
+			<form action="<?php echo esc_attr( $action ); ?>" method="post">
+
+				<div id="titlediv">
+					<label for="group_name"><?php _e( "Field Group Name", 'buddypress') ?></label>
+					<div>
+						<input type="text" name="group_name" id="group_name" value="<?php echo esc_attr( $this->name ) ?>" style="width:50%" />
+					</div>
+				</div>
+
+				<p class="submit" style="text-align: left">
+					<input type="submit" name="saveGroup" value="<?php echo esc_attr( $title ); ?> &rarr;" />
+				</p>
+
+			</form>
+		</div>
+
+		<?php
+	}
+}
+
+
+Class BP_XProfile_Field {
+	var $id;
+	var $group_id;
+	var $parent_id;
+	var $type;
+	var $name;
+	var $description;
+	var $is_required;
+	var $can_delete;
+	var $field_order;
+	var $option_order;
+	var $order_by;
+	var $is_default_option;
+
+	var $data;
+	var $message = null;
+	var $message_type = 'err';
+
+	function bp_xprofile_field( $id = null, $user_id = null, $get_data = true ) {
+		if ( $id ) {
+			$this->populate( $id, $user_id, $get_data );
+		}
+	}
+
+	function populate( $id, $user_id, $get_data ) {
+		global $wpdb, $userdata, $bp;
+
+		if ( is_null($user_id) ) {
+			$user_id = $userdata->ID;
+		}
+
+		$sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_fields} WHERE id = %d", $id );
+
+		if ( $field = $wpdb->get_row($sql) ) {
+			$this->id = $field->id;
+			$this->group_id = $field->group_id;
+			$this->parent_id = $field->parent_id;
+			$this->type = $field->type;
+			$this->name = stripslashes($field->name);
+			$this->description = stripslashes($field->description);
+			$this->is_required = $field->is_required;
+			$this->can_delete = $field->can_delete;
+			$this->field_order = $field->field_order;
+			$this->option_order = $field->option_order;
+			$this->order_by = $field->order_by;
+			$this->is_default_option = $field->is_default_option;
+
+			if ( $get_data ) {
+				$this->data = $this->get_field_data($user_id);
+			}
+		}
+	}
+
+	function delete() {
+		global $wpdb, $bp;
+
+		if ( !$this->id ||
+			// Prevent deletion by url when can_delete is false.
+			!$this->can_delete ||
+			// Prevent deletion of option 1 since this invalidates fields with options.
+			( $this->parent_id && $this->option_order == 1 ) )
+			return false;
+
+		if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_fields} WHERE id = %d OR parent_id = %d", $this->id, $this->id ) ) )
+			return false;
+
+		// delete the data in the DB for this field
+		BP_XProfile_ProfileData::delete_for_field($this->id);
+
+		return true;
+	}
+
+	function save() {
+		global $wpdb, $bp;
+
+		$error = false;
+
+		$this->group_id = apply_filters( 'xprofile_field_group_id_before_save', $this->group_id, $this->id );
+		$this->parent_id = apply_filters( 'xprofile_field_parent_id_before_save', $this->parent_id, $this->id );
+		$this->type = apply_filters( 'xprofile_field_type_before_save', $this->type, $this->id );
+		$this->name = apply_filters( 'xprofile_field_name_before_save', $this->name, $this->id );
+		$this->description = apply_filters( 'xprofile_field_description_before_save', $this->description, $this->id );
+		$this->is_required = apply_filters( 'xprofile_field_is_required_before_save', $this->is_required, $this->id );
+		$this->order_by = apply_filters( 'xprofile_field_order_by_before_save', $this->order_by, $this->id );
+		$this->field_order = apply_filters( 'xprofile_field_field_order_before_save', $this->field_order, $this->id );
+
+		do_action( 'xprofile_field_before_save', $this );
+
+		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, %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.
+		// The described situation will return 0 here.
+		if ( $wpdb->query($sql) !== null ) {
+
+			if ( $this->id )
+				$field_id = $this->id;
+			else
+				$field_id = $wpdb->insert_id;
+
+			// Only do this if we are editing an existing field
+			if ( $this->id != null ) {
+				// Remove any radio or dropdown options for this
+				// field. They will be re-added if needed.
+				// This stops orphan options if the user changes a
+				// field from a radio button field to a text box.
+				$this->delete_children();
+			}
+
+			// Check to see if this is a field with child options.
+			// We need to add the options to the db, if it is.
+			if ( 'radio' == $this->type || 'selectbox' == $this->type || 'checkbox' == $this->type || 'multiselectbox' == $this->type ) {
+				if ( $this->id ) {
+					$parent_id = $this->id;
+				} else {
+					$parent_id = $wpdb->insert_id;
+				}
+
+				if ( 'radio' == $this->type ) {
+
+					$options = $_POST['radio_option'];
+					$defaults = $_POST['isDefault_radio_option'];
+
+				} else if ( 'selectbox' == $this->type ) {
+
+					$options = $_POST['selectbox_option'];
+					$defaults = $_POST['isDefault_selectbox_option'];
+
+				} else if ( 'multiselectbox' == $this->type ) {
+
+					$options = $_POST['multiselectbox_option'];
+					$defaults = $_POST['isDefault_multiselectbox_option'];
+
+				} else if ( 'checkbox' == $this->type ) {
+
+					$options = $_POST['checkbox_option'];
+					$defaults = $_POST['isDefault_checkbox_option'];
+
+				}
+
+				$counter = 1;
+				if ( $options ) {
+					foreach ( (array)$options as $option_key => $option_value ) {
+						$is_default = 0;
+
+						if ( is_array($defaults) ) {
+							if ( isset($defaults[$option_key]) )
+								$is_default = 1;
+						} else {
+							if ( (int) $defaults == $option_key )
+								$is_default = 1;
+						}
+
+						if ( '' != $option_value ) {
+							if ( !$wpdb->query( $wpdb->prepare("INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, is_default_option, field_order, option_order, order_by, can_delete) VALUES (%d, %d, 'option', %s, '', 0, %d, 0, %d, '', 1)", (int)$this->group_id, (int)$parent_id, $option_value, (int)$is_default, (int)$counter ) ) )
+								return false;
+						}
+
+						$counter++;
+					}
+				}
+			}
+		} else {
+			$error = true;
+		}
+
+		if ( !$error ) {
+			do_action( 'xprofile_field_after_save', $this );
+			return $field_id;
+		} else {
+			return false;
+		}
+	}
+
+	function get_field_data($user_id) {
+		return new BP_XProfile_ProfileData($this->id, $user_id);
+	}
+
+	 function get_children($for_editing = false) {
+		global $wpdb, $bp;
+
+		// This is done here so we don't have problems with sql injection
+		if ( 'asc' == $this->order_by && !$for_editing ) {
+			$sort_sql = 'ORDER BY name ASC';
+		} else if ( 'desc' == $this->order_by && !$for_editing ) {
+			$sort_sql = 'ORDER BY name DESC';
+		} else {
+			$sort_sql = 'ORDER BY option_order ASC';
+		}
+
+		//This eliminates a problem with getting all fields when there is no id for the object
+		if ( !$this->id ) {
+			$parent_id = -1;
+		} else {
+			$parent_id = $this->id;
+		}
+
+		$sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_fields} WHERE parent_id = %d AND group_id = %d $sort_sql", $parent_id, $this->group_id );
+
+		if ( !$children = $wpdb->get_results($sql) )
+			return false;
+
+		return apply_filters( 'bp_xprofile_field_get_children', $children );
+	}
+
+	function delete_children() {
+		global $wpdb, $bp;
+
+		$sql = $wpdb->prepare("DELETE FROM {$bp->profile->table_name_fields} WHERE parent_id = %d", $this->id);
+
+		$wpdb->query($sql);
+	}
+
+	// Static Functions
+
+	function get_type( $field_id ) {
+		global $wpdb, $bp;
+
+		if ( $field_id ) {
+			$sql = $wpdb->prepare( "SELECT type FROM {$bp->profile->table_name_fields} WHERE id = %d", $field_id );
+
+			if ( !$field_type = $wpdb->get_var($sql) )
+				return false;
+
+			return $field_type;
+		}
+
+		return false;
+	}
+
+	function delete_for_group( $group_id ) {
+		global $wpdb, $bp;
+
+		if ( $group_id ) {
+			$sql = $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_fields} WHERE group_id = %d", $group_id );
+
+			if ( $wpdb->get_var($sql) === false ) {
+				return false;
+			}
+
+			return true;
+		}
+
+		return false;
+	}
+
+	function get_id_from_name( $field_name ) {
+		global $wpdb, $bp;
+
+		if ( !$bp->profile->table_name_fields || !$field_name )
+			return false;
+
+		return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE name = %s", $field_name ) );
+	}
+
+	function update_position( $field_id, $position ) {
+		global $wpdb, $bp;
+
+		if ( !is_numeric( $position ) )
+			return false;
+
+		return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->profile->table_name_fields} SET field_order = %d WHERE id = %d", $position, $field_id ) );
+	}
+
+	// ADMIN AREA HTML. TODO: Get this out of here.
+
+	function render_admin_form_children() {
+		//This function populates the items for radio buttons checkboxes and drop down boxes
+		$input_types = array( 'checkbox', 'selectbox', 'multiselectbox', 'radio' );
+
+		foreach ( $input_types as $type ) {
+			$default_name = '';
+
+			if ( 'multiselectbox' == $type || 'checkbox' == $type )
+				$default_input = 'checkbox';
+			else
+				$default_input = 'radio'; ?>
+
+			<div id="<?php echo $type ?>" class="options-box" style="<?php if ( $this->type != $type ) { ?>display: none;<?php } ?> margin-left: 15px;">
+				<h4><?php _e('Please enter options for this Field:', 'buddypress') ?></h4>
+				<p><?php _e( 'Order By:', 'buddypress' ) ?>
+
+					<select name="sort_order_<?php echo $type ?>" id="sort_order_<?php echo $type ?>" >
+						<option value="default" <?php if ( 'default' == $this->order_by ) {?> selected="selected"<?php } ?> ><?php _e( 'Order Entered', 'buddypress' ) ?></option>
+						<option value="asc" <?php if ( 'asc' == $this->order_by ) {?> selected="selected"<?php } ?>><?php _e( 'Name - Ascending', 'buddypress' ) ?></option>
+						<option value="desc" <?php if ( 'desc' == $this->order_by ) {?> selected="selected"<?php } ?>><?php _e( 'Name - Descending', 'buddypress' ) ?></option>
+					</select>
+
+				<?php
+				if ( !$options = $this->get_children(true) ) {
+					$i = 1;
+					while ( isset( $_POST[$type . '_option'][$i] ) ) {
+						(array) $options[] = (object) array(
+							'id' => -1,
+							'name' => $_POST[$type . '_option'][$i],
+							'is_default_option' => ( 'multiselectbox' != $type &&
+								'checkbox' != $type &&
+								$_POST["isDefault_{$type}_option"] == $i ) ?
+									1 :
+									$_POST["isDefault_{$type}_option"][$i]
+						);
+
+						$i++;
+					}
+				}
+
+				if ( !empty( $options ) ) {
+					for ( $i = 0; $i < count( $options ); $i++ ) {
+						$j = $i + 1;
+
+						if ( 'multiselectbox' == $type || 'checkbox' == $type )
+							$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 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 ) : ?>
+
+								   <a href="admin.php?page=bp-profile-setup&amp;mode=delete_option&amp;option_id=<?php echo $options[$i]->id ?>" class="ajax-option-delete" id="delete-<?php echo $options[$i]->id ?>">[x]</a>
+
+							<?php endif ?>
+
+						</p>
+
+					<?php } // end for ?>
+
+					<input type="hidden" name="<?php echo $type ?>_option_number" id="<?php echo $type ?>_option_number" value="<?php echo $j + 1 ?>" />
+
+				<?php
+				} else {
+					if ( 'multiselectbox' == $type || 'checkbox' == $type )
+						$default_name = '[1]'; ?>
+
+					<p><?php _e('Option', 'buddypress') ?> 1: <input type="text" name="<?php echo $type ?>_option[1]" id="<?php echo $type ?>_option1" />
+					<input type="<?php echo $default_input ?>" name="isDefault_<?php echo $type ?>_option<?php echo $default_name; ?>" id="isDefault_<?php echo $type ?>_option" value="1" /> <?php _e( 'Default Value', 'buddypress' ) ?>
+					<input type="hidden" name="<?php echo $type ?>_option_number" id="<?php echo $type ?>_option_number" value="2" />
+
+				<?php } // end if ?>
+
+				<div id="<?php echo $type ?>_more"></div>
+				<p><a href="javascript:add_option('<?php echo $type ?>')"><?php _e('Add Another Option', 'buddypress') ?></a></p>
+			</div>
+
+		<?php }
+	}
+
+	function render_admin_form( $message = '' ) {
+		if ( !$this->id ) {
+			$title = __('Add Field', 'buddypress');
+			$action = "admin.php?page=bp-profile-setup&amp;group_id=" . $this->group_id . "&amp;mode=add_field";
+
+			$this->name			= $_POST['title'];
+			$this->description	= $_POST['description'];
+			$this->is_required	= $_POST['required'];
+			$this->type			= $_POST['fieldtype'];
+			$this->order_by		= $_POST["sort_order_{$this->type}"];
+		} else {
+			$title = __('Edit Field', 'buddypress');
+			$action = "admin.php?page=bp-profile-setup&amp;mode=edit_field&amp;group_id=" . $this->group_id . "&amp;field_id=" . $this->id;
+		}
+	?>
+
+	<div class="wrap">
+
+		<h2><?php echo $title; ?></h2>
+		<br />
+
+		<?php
+			if ( $message != '' ) {
+		?>
+			<div id="message" class="error fade">
+				<p><?php echo $message; ?></p>
+			</div>
+		<?php } ?>
+
+		<form action="<?php echo $action ?>" method="post">
+			<div id="poststuff">
+				<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 esc_attr( $this->name ) ?>" style="width:50%" />
+					</div>
+				</div>
+
+				<div id="titlediv" class="inside">
+					<h3><label for="description"><?php _e("Field Description", 'buddypress') ?></label></h3>
+					<div id="titlewrap">
+						<textarea name="description" id="description" rows="8" cols="60"><?php echo htmlspecialchars( $this->description ); ?></textarea>
+					</div>
+				</div>
+
+				<div id="titlediv">
+					<h3><label for="required"><?php _e("Is This Field Required?", 'buddypress') ?> *</label></h3>
+					<select name="required" id="required" style="width: 30%">
+						<option value="0"<?php if ( $this->is_required == '0' ) { ?> selected="selected"<?php } ?>><?php _e( 'Not Required', 'buddypress' ) ?></option>
+						<option value="1"<?php if ( $this->is_required == '1' ) { ?> selected="selected"<?php } ?>><?php _e( 'Required', 'buddypress' ) ?></option>
+					</select>
+				</div>
+
+				<div id="titlediv">
+					<h3><label for="fieldtype"><?php _e("Field Type", 'buddypress') ?> *</label></h3>
+					<select name="fieldtype" id="fieldtype" onchange="show_options(this.value)" style="width: 30%">
+						<option value="textbox"<?php if ( $this->type == 'textbox' ) {?> selected="selected"<?php } ?>><?php _e( 'Text Box', 'buddypress' ) ?></option>
+						<option value="textarea"<?php if ( $this->type == 'textarea' ) {?> selected="selected"<?php } ?>><?php _e( 'Multi-line Text Box', 'buddypress' ) ?></option>
+						<option value="datebox"<?php if ( $this->type == 'datebox' ) {?> selected="selected"<?php } ?>><?php _e( 'Date Selector', 'buddypress' ) ?></option>
+						<option value="radio"<?php if ( $this->type == 'radio' ) {?> selected="selected"<?php } ?>><?php _e( 'Radio Buttons', 'buddypress' ) ?></option>
+						<option value="selectbox"<?php if ( $this->type == 'selectbox' ) {?> selected="selected"<?php } ?>><?php _e( 'Drop Down Select Box', 'buddypress' ) ?></option>
+						<option value="multiselectbox"<?php if ( $this->type == 'multiselectbox' ) {?> selected="selected"<?php } ?>><?php _e( 'Multi Select Box', 'buddypress' ) ?></option>
+						<option value="checkbox"<?php if ( $this->type == 'checkbox' ) {?> selected="selected"<?php } ?>><?php _e( 'Checkboxes', 'buddypress' ) ?></option>
+					</select>
+				</div>
+
+				<?php $this->render_admin_form_children() ?>
+
+				<p class="submit">
+						&nbsp;<input type="submit" value="<?php _e("Save", 'buddypress') ?> &rarr;" name="saveField" id="saveField" style="font-weight: bold" />
+						 <?php _e('or', 'buddypress') ?> <a href="admin.php?page=bp-profile-setup" style="color: red"><?php _e( 'Cancel', 'buddypress' ) ?></a>
+				</p>
+
+			</div>
+
+			<div class="clear"></div>
+
+			<?php if ( function_exists('wp_nonce_field') )
+				wp_nonce_field('xprofile_delete_option');
+			?>
+
+		</form>
+	</div>
+
+	<?php
+	}
+
+	function admin_validate() {
+		global $message;
+
+		// Validate Form
+		if ( '' == $_POST['title'] || '' == $_POST['required'] || '' == $_POST['fieldtype'] ) {
+			$message = __('Please make sure you fill out all required fields.', 'buddypress');
+			return false;
+		} else if ( empty($_POST['field_file']) && $_POST['fieldtype'] == 'radio' && empty($_POST['radio_option'][1]) ) {
+			$message = __('Radio button field types require at least one option. Please add options below.', 'buddypress');
+			return false;
+		} else if ( empty($_POST['field_file']) && $_POST['fieldtype'] == 'selectbox' && empty($_POST['selectbox_option'][1]) ) {
+			$message = __('Select box field types require at least one option. Please add options below.', 'buddypress');
+			return false;
+		} else if ( empty($_POST['field_file']) && $_POST['fieldtype'] == 'multiselectbox' && empty($_POST['multiselectbox_option'][1]) ) {
+			$message = __('Select box field types require at least one option. Please add options below.', 'buddypress');
+			return false;
+		} else if ( empty($_POST['field_file']) && $_POST['fieldtype'] == 'checkbox' && empty($_POST['checkbox_option'][1]) ) {
+			$message = __('Checkbox field types require at least one option. Please add options below.', 'buddypress');
+			return false;
+		} else {
+			return true;
+		}
+	}
+}
+
+
+Class BP_XProfile_ProfileData {
+	var $id;
+	var $user_id;
+	var $field_id;
+	var $value;
+	var $last_updated;
+
+	function bp_xprofile_profiledata( $field_id = null, $user_id = null ) {
+		if ( $field_id ) {
+			$this->populate( $field_id, $user_id );
+		}
+	}
+
+	function populate( $field_id, $user_id )  {
+		global $wpdb, $bp;
+
+		$sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id = %d", $field_id, $user_id );
+
+		if ( $profiledata = $wpdb->get_row($sql) ) {
+
+			$this->id = $profiledata->id;
+			$this->user_id = $profiledata->user_id;
+			$this->field_id = $profiledata->field_id;
+			$this->value = stripslashes($profiledata->value);
+			$this->last_updated = $profiledata->last_updated;
+		}
+	}
+
+	function exists() {
+		global $wpdb, $bp;
+
+		// check to see if there is data already for the user.
+		$sql = $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_data} WHERE user_id = %d AND field_id = %d", $this->user_id, $this->field_id );
+
+		if ( !$wpdb->get_row($sql) )
+			return false;
+
+		return true;
+	}
+
+	function is_valid_field() {
+		global $wpdb, $bp;
+
+		// check to see if this data is actually for a valid field.
+		$sql = $wpdb->prepare("SELECT id FROM {$bp->profile->table_name_fields} WHERE id = %d", $this->field_id );
+
+		if ( !$wpdb->get_row($sql) )
+			return false;
+
+		return true;
+	}
+
+	function save() {
+		global $wpdb, $bp;
+
+		$this->user_id = apply_filters( 'xprofile_data_user_id_before_save', $this->user_id, $this->id );
+		$this->field_id = apply_filters( 'xprofile_data_field_id_before_save', $this->field_id, $this->id );
+		$this->value = apply_filters( 'xprofile_data_value_before_save', $this->value, $this->id );
+		$this->last_updated = apply_filters( 'xprofile_data_last_updated_before_save', date( 'Y-m-d H:i:s' ), $this->id );
+
+		do_action( 'xprofile_data_before_save', $this );
+
+		if ( $this->is_valid_field() ) {
+			if ( $this->exists() && !empty( $this->value ) && strlen( trim( $this->value ) ) ) {
+				$result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->profile->table_name_data} SET value = %s, last_updated = %s WHERE user_id = %d AND field_id = %d", $this->value, $this->last_updated, $this->user_id, $this->field_id ) );
+			} else if ( $this->exists() && empty( $this->value ) ) {
+				// Data removed, delete the entry.
+				$result = $this->delete();
+			} else {
+				$result = $wpdb->query( $wpdb->prepare("INSERT INTO {$bp->profile->table_name_data} (user_id, field_id, value, last_updated) VALUES (%d, %d, %s, %s)", $this->user_id, $this->field_id, $this->value, $this->last_updated ) );
+			}
+
+			if ( !$result )
+				return false;
+
+			do_action( 'xprofile_data_after_save', $this );
+
+			return true;
+		}
+
+		return false;
+	}
+
+	function delete() {
+		global $wpdb, $bp;
+
+		if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id = %d", $this->field_id, $this->user_id ) ) )
+			return false;
+
+		return true;
+	}
+
+	/** Static Functions **/
+
+	/**
+	 * BP_XProfile_ProfileData::get_all_for_user()
+	 *
+	 * Get all of the profile information for a specific user.
+	 */
+	function get_all_for_user( $user_id ) {
+		global $wpdb, $bp;
+
+		$results = $wpdb->get_results( $wpdb->prepare( "SELECT g.id as field_group_id, g.name as field_group_name, f.id as field_id, f.name as field_name, f.type as field_type, d.value as field_data, u.user_login, u.user_nicename, u.user_email FROM {$bp->profile->table_name_groups} g LEFT JOIN {$bp->profile->table_name_fields} f ON g.id = f.group_id INNER JOIN {$bp->profile->table_name_data} d ON f.id = d.field_id LEFT JOIN {$wpdb->users} u ON d.user_id = u.ID WHERE d.user_id = %d AND d.value != ''", $user_id ) );
+
+		if ( $results ) {
+			$profile_data['user_login'] = $results[0]->user_login;
+			$profile_data['user_nicename'] = $results[0]->user_nicename;
+			$profile_data['user_email'] = $results[0]->user_email;
+
+			foreach( (array) $results as $field ) {
+				$profile_data[$field->field_name] = array(
+					'field_group_id' => $field->field_group_id,
+					'field_group_name' => $field->field_group_name,
+					'field_id' => $field->field_id,
+					'field_type' => $field->field_type,
+					'field_data' => $field->field_data
+				);
+			}
+		}
+
+		return $profile_data;
+	}
+
+	function get_value_byid( $field_id, $user_ids = null ) {
+		global $wpdb, $bp;
+
+		if ( !$user_ids )
+			$user_ids = $bp->displayed_user->id;
+
+		if ( !$bp->profile )
+			xprofile_setup_globals();
+
+		if ( is_array( $user_ids ) ) {
+			$user_ids = implode( ',', (array)$user_ids );
+			$data = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, value FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id IN ({$user_ids})", $field_id ) );
+		} else {
+			$data = $wpdb->get_var( $wpdb->prepare( "SELECT value FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id = %d", $field_id, $user_ids ) );
+		}
+
+		return maybe_unserialize( $data );
+	}
+
+	function get_value_byfieldname( $fields, $user_id = null ) {
+		global $bp, $wpdb;
+
+		if ( !$fields )
+			return false;
+
+		if ( !$user_id )
+			$user_id = $bp->displayed_user->id;
+
+		if ( !$bp->profile )
+			xprofile_setup_globals();
+
+		$field_sql = '';
+
+		if ( is_array($fields) ) {
+			for ( $i = 0; $i < count($fields); $i++ ) {
+				if ( $i == 0 )
+					$field_sql .= $wpdb->prepare( "AND ( f.name = %s ", $fields[$i] );
+				else
+					$field_sql .= $wpdb->prepare( "OR f.name = %s ", $fields[$i] );
+			}
+
+			$field_sql .= ')';
+		} else {
+			$field_sql .= $wpdb->prepare( "AND f.name = %s", $fields );
+		}
+
+		$sql = $wpdb->prepare( "SELECT d.value, f.name FROM {$bp->profile->table_name_data} d, {$bp->profile->table_name_fields} f WHERE d.field_id = f.id AND d.user_id = %d AND f.parent_id = 0 $field_sql", $user_id );
+
+		if ( !$values = $wpdb->get_results($sql) )
+			return false;
+
+		$new_values = array();
+
+		if ( is_array($fields) ) {
+			for ( $i = 0; $i < count($values); $i++ ) {
+				for ( $j = 0; $j < count($fields); $j++ ) {
+					if ( $values[$i]->name == $fields[$j] ) {
+						$new_values[$fields[$j]] = $values[$i]->value;
+					} else if ( !array_key_exists( $fields[$j], $new_values ) ) {
+						$new_values[$fields[$j]] = NULL;
+					}
+				}
+			}
+		} else {
+			$new_values = $values[0]->value;
+		}
+
+		return $new_values;
+	}
+
+	function delete_for_field( $field_id ) {
+		global $wpdb, $userdata, $bp;
+
+		if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_data} WHERE field_id = %d", $field_id ) ) )
+			return false;
+
+		return true;
+	}
+
+	function get_last_updated( $user_id ) {
+		global $wpdb, $bp;
+
+		$last_updated = $wpdb->get_var( $wpdb->prepare( "SELECT last_updated FROM {$bp->profile->table_name_data} WHERE user_id = %d ORDER BY last_updated LIMIT 1", $user_id ) );
+
+		return $last_updated;
+	}
+
+	function delete_data_for_user( $user_id ) {
+		global $wpdb, $bp;
+
+		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_data} WHERE user_id = %d", $user_id ) );
+	}
+
+	function get_random( $user_id, $exclude_fullname ) {
+		global $wpdb, $bp;
+
+		if ( $exclude_fullname )
+			$exclude_sql = $wpdb->prepare( " AND pf.id != 1" );
+
+		return $wpdb->get_results( $wpdb->prepare( "SELECT pf.type, pf.name, pd.value FROM {$bp->profile->table_name_data} pd INNER JOIN {$bp->profile->table_name_fields} pf ON pd.field_id = pf.id AND pd.user_id = %d {$exclude_sql} ORDER BY RAND() LIMIT 1", $user_id ) );
+	}
+
+	function get_fullname( $user_id = false ) {
+		global $bp;
+
+		if ( !$user_id )
+			$user_id = $bp->displayed_user->id;
+
+		$data = xprofile_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id );
+
+		return $data[BP_XPROFILE_FULLNAME_FIELD_NAME];
+	}
+}
+?>
diff --git a/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-cssjs.php b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-cssjs.php
new file mode 100644
index 0000000000000000000000000000000000000000..76acc5d22b93a9ff29cabc4b3bb3eefdb077132b
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-cssjs.php
@@ -0,0 +1,16 @@
+<?php
+
+function xprofile_add_admin_css() {
+	wp_enqueue_style( 'xprofile-admin-css', BP_PLUGIN_URL . '/bp-xprofile/admin/css/admin.css' );
+}
+add_action( 'admin_menu', 'xprofile_add_admin_css' );
+
+function xprofile_add_admin_js() {
+	if ( strpos( $_GET['page'], 'bp-profile-setup' ) !== false ) {
+		wp_enqueue_script( array( "jquery-ui-sortable" ) );
+		wp_enqueue_script( 'xprofile-admin-js', BP_PLUGIN_URL . '/bp-xprofile/admin/js/admin.js', array( 'jquery' ) );
+	}
+}
+add_action( 'admin_menu', 'xprofile_add_admin_js', 1 );
+
+?>
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-filters.php b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-filters.php
new file mode 100644
index 0000000000000000000000000000000000000000..0fd053ef501f567cfab7261b2d2579e3e9102138
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-filters.php
@@ -0,0 +1,147 @@
+<?php
+
+/* Apply WordPress defined filters */
+
+add_filter( 'bp_get_the_profile_field_value',         'wp_filter_kses', 1 );
+add_filter( 'bp_get_the_profile_field_name',          'wp_filter_kses', 1 );
+add_filter( 'bp_get_the_profile_field_edit_value',    'wp_filter_kses', 1 );
+add_filter( 'bp_get_the_profile_field_description',   'wp_filter_kses', 1 );
+
+add_filter( 'bp_get_the_profile_field_value',         'wptexturize'        );
+add_filter( 'bp_get_the_profile_field_value',         'convert_smilies', 2 );
+add_filter( 'bp_get_the_profile_field_value',         'convert_chars'      );
+add_filter( 'bp_get_the_profile_field_value',         'wpautop'            );
+add_filter( 'bp_get_the_profile_field_value',         'make_clickable'     );
+add_filter( 'bp_get_the_profile_field_value',         'force_balance_tags' );
+
+add_filter( 'bp_get_the_profile_field_value',         'stripslashes' );
+add_filter( 'bp_get_the_profile_field_edit_value',    'stripslashes' );
+add_filter( 'bp_get_the_profile_field_name',          'stripslashes' );
+add_filter( 'bp_get_the_profile_field_description',   'stripslashes' );
+
+add_filter( 'xprofile_get_field_data',                'wp_filter_kses', 1 );
+add_filter( 'xprofile_field_name_before_save',        'wp_filter_kses', 1 );
+add_filter( 'xprofile_field_description_before_save', 'wp_filter_kses', 1 );
+
+add_filter( 'xprofile_get_field_data',                'force_balance_tags' );
+add_filter( 'xprofile_field_name_before_save',        'force_balance_tags' );
+add_filter( 'xprofile_field_description_before_save', 'force_balance_tags' );
+
+add_filter( 'xprofile_get_field_data',                'stripslashes' );
+
+/* Custom BuddyPress filters */
+
+add_filter( 'bp_get_the_profile_field_value',         'xprofile_filter_format_field_value', 1, 2 );
+add_filter( 'bp_get_the_site_member_profile_data',    'xprofile_filter_format_field_value', 1, 2 );
+add_filter( 'bp_get_the_profile_field_value',         'xprofile_filter_link_profile_data', 50, 2 );
+
+add_filter( 'xprofile_data_value_before_save',        'xprofile_sanitize_data_value_before_save', 1, 2 );
+
+/**
+ * xprofile_sanitize_data_value_before_save ( $field_value, $field_id )
+ *
+ * Safely runs profile field data through kses and force_balance_tags.
+ *
+ * @param string $field_value
+ * @param int $field_id
+ * @return string
+ */
+function xprofile_sanitize_data_value_before_save ( $field_value, $field_id ) {
+
+	// Return if empty
+	if ( empty( $field_value ) )
+		return;
+
+	// Value might be serialized
+	$field_value = maybe_unserialize( $field_value );
+
+	// Filter single value
+	if ( !is_array( $field_value ) ) {
+		$kses_field_value     = wp_filter_kses( $field_value );
+		$filtered_field_value = force_balance_tags( $kses_field_value );
+
+	// Filter each array item independently
+	} else {
+		foreach ( (array)$field_value as $value ) {
+			$kses_field_value       = wp_filter_kses( $value );
+			$filtered_values[] = force_balance_tags( $kses_field_value );
+		}
+
+		$filtered_field_value = serialize( $filtered_values );
+	}
+
+	return $filtered_field_value;
+}
+
+function xprofile_filter_format_field_value( $field_value, $field_type = '' ) {
+	if ( !isset( $field_value ) || empty( $field_value ) )
+		return false;
+
+	if ( 'datebox' == $field_type )
+		$field_value = bp_format_time( $field_value, true );
+	else
+		$field_value = str_replace(']]>', ']]&gt;', $field_value );
+
+	return stripslashes( $field_value );
+}
+
+function xprofile_filter_link_profile_data( $field_value, $field_type = 'textbox' ) {
+	if ( 'datebox' == $field_type )
+		return $field_value;
+
+	if ( !strpos( $field_value, ',' ) && ( count( explode( ' ', $field_value ) ) > 5 ) )
+		return $field_value;
+
+	$values = explode( ',', $field_value );
+
+	if ( $values ) {
+		foreach ( (array)$values as $value ) {
+			$value = trim( $value );
+
+			// If the value is a URL, skip it and just make it clickable.
+			if ( preg_match( '@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', $value ) ) {
+				$new_values[] = make_clickable( $value );
+			} else {
+				if ( count( explode( ' ', $value ) ) > 5 ) {
+					$new_values[] = $value;
+				} else {
+					$new_values[] = '<a href="' . site_url( BP_MEMBERS_SLUG ) . '/?s=' . strip_tags( $value ) . '">' . $value . '</a>';
+				}
+			}
+		}
+
+		$values = implode( ', ', $new_values );
+	}
+
+	return $values;
+}
+
+function xprofile_filter_comments( $comments, $post_id ) {
+	foreach( (array)$comments as $comment ) {
+		if ( $comment->user_id ) {
+			$user_ids[] = $comment->user_id;
+		}
+	}
+
+	if ( empty( $user_ids ) )
+		return $comments;
+
+	if ( $fullnames = BP_XProfile_ProfileData::get_value_byid( 1, $user_ids ) ) {
+		foreach( (array)$fullnames as $user ) {
+			$users[$user->user_id] = trim($user->value);
+		}
+	}
+
+	foreach( (array)$comments as $i => $comment ) {
+		if ( !empty( $comment->user_id ) ) {
+			if ( !empty( $users[$comment->user_id] ) ) {
+				$comments[$i]->comment_author = $users[$comment->user_id];
+			}
+		}
+	}
+
+	return $comments;
+}
+add_filter( 'comments_array', 'xprofile_filter_comments', 10, 2 );
+
+?>
diff --git a/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-templatetags.php b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-templatetags.php
new file mode 100644
index 0000000000000000000000000000000000000000..78163357afa7f84003472eb26de0944c27fdd286
--- /dev/null
+++ b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-templatetags.php
@@ -0,0 +1,700 @@
+<?php
+
+/***************************************************************************
+ * XProfile Data Display Template Tags
+ **/
+
+Class BP_XProfile_Data_Template {
+	var $current_group = -1;
+	var $group_count;
+	var $groups;
+	var $group;
+
+	var $current_field = -1;
+	var $field_count;
+	var $field_has_data;
+	var $field;
+
+	var $in_the_loop;
+	var $user_id;
+
+	function bp_xprofile_data_template( $user_id, $profile_group_id ) {
+		$this->groups = BP_XProfile_Group::get( array(
+			'profile_group_id' => $profile_group_id,
+			'user_id' => $user_id,
+			'hide_empty_groups' => true,
+			'fetch_fields' => true,
+			'fetch_field_data' => true
+		) );
+
+		$this->group_count = count($this->groups);
+		$this->user_id = $user_id;
+	}
+
+	function has_groups() {
+		if ( $this->group_count )
+			return true;
+
+		return false;
+	}
+
+	function next_group() {
+		$this->current_group++;
+
+		$this->group = $this->groups[$this->current_group];
+		$this->group->fields = apply_filters( 'xprofile_group_fields', $this->group->fields, $this->group->id );
+		$this->field_count = count( $this->group->fields );
+
+		return $this->group;
+	}
+
+	function rewind_groups() {
+		$this->current_group = -1;
+		if ( $this->group_count > 0 ) {
+			$this->group = $this->groups[0];
+		}
+	}
+
+	function profile_groups() {
+		if ( $this->current_group + 1 < $this->group_count ) {
+			return true;
+		} elseif ( $this->current_group + 1 == $this->group_count ) {
+			do_action('xprofile_template_loop_end');
+			// Do some cleaning up after the loop
+			$this->rewind_groups();
+		}
+
+		$this->in_the_loop = false;
+		return false;
+	}
+
+	function the_profile_group() {
+		global $group;
+
+		$this->in_the_loop = true;
+		$group = $this->next_group();
+
+		if ( 0 == $this->current_group ) // loop has just started
+			do_action('xprofile_template_loop_start');
+	}
+
+	/**** FIELDS ****/
+
+	function next_field() {
+		$this->current_field++;
+
+		$this->field = $this->group->fields[$this->current_field];
+		return $this->field;
+	}
+
+	function rewind_fields() {
+		$this->current_field = -1;
+		if ( $this->field_count > 0 ) {
+			$this->field = $this->group->fields[0];
+		}
+	}
+
+	function has_fields() {
+		$has_data = false;
+
+		for ( $i = 0; $i < count( $this->group->fields ); $i++ ) {
+			$field = &$this->group->fields[$i];
+
+			if ( $field->data->value != null ) {
+				$has_data = true;
+			}
+		}
+
+		if ( $has_data )
+			return true;
+
+		return false;
+	}
+
+	function profile_fields() {
+		if ( $this->current_field + 1 < $this->field_count ) {
+			return true;
+		} elseif ( $this->current_field + 1 == $this->field_count ) {
+			// Do some cleaning up after the loop
+			$this->rewind_fields();
+		}
+
+		return false;
+	}
+
+	function the_profile_field() {
+		global $field;
+
+		$field = $this->next_field();
+
+		if ( !empty( $field->data->value ) ) {
+			$this->field_has_data = true;
+		}
+		else {
+			$this->field_has_data = false;
+		}
+	}
+}
+
+function xprofile_get_profile() {
+	locate_template( array( 'profile/profile-loop.php'), true );
+}
+
+function bp_has_profile( $args = '' ) {
+	global $bp, $profile_template;
+
+	$defaults = array(
+		'user_id' => $bp->displayed_user->id,
+		'profile_group_id' => false
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	extract( $r, EXTR_SKIP );
+
+	$profile_template = new BP_XProfile_Data_Template( $user_id, $profile_group_id );
+	return apply_filters( 'bp_has_profile', $profile_template->has_groups(), &$profile_template );
+}
+
+function bp_profile_groups() {
+	global $profile_template;
+	return $profile_template->profile_groups();
+}
+
+function bp_the_profile_group() {
+	global $profile_template;
+	return $profile_template->the_profile_group();
+}
+
+function bp_profile_group_has_fields() {
+	global $profile_template;
+	return $profile_template->has_fields();
+}
+
+function bp_field_css_class( $class = false ) {
+	echo bp_get_field_css_class( $class );
+}
+	function bp_get_field_css_class( $class = false ) {
+		global $profile_template;
+
+		$css_classes = array();
+
+		if ( $class )
+			$css_classes[] = sanitize_title( esc_attr( $class ) );
+
+		/* Set a class with the field ID */
+		$css_classes[] = 'field_' . $profile_template->field->id;
+
+		/* Set a class with the field name (sanitized) */
+		$css_classes[] = 'field_' . sanitize_title( $profile_template->field->name );
+
+		if ( $profile_template->current_field % 2 == 1 )
+			$css_classes[] = 'alt';
+
+		$css_classes = apply_filters( 'bp_field_css_classes', &$css_classes );
+
+		return apply_filters( 'bp_get_field_css_class', ' class="' . implode( ' ', $css_classes ) . '"' );
+	}
+
+function bp_field_has_data() {
+	global $profile_template;
+	return $profile_template->field_has_data;
+}
+
+function bp_field_has_public_data() {
+	global $profile_template;
+
+	if ( $profile_template->field_has_data )
+		return true;
+
+	return false;
+}
+
+function bp_the_profile_group_id() {
+	echo bp_get_the_profile_group_id();
+}
+	function bp_get_the_profile_group_id() {
+		global $group;
+		return apply_filters( 'bp_get_the_profile_group_id', $group->id );
+	}
+
+function bp_the_profile_group_name() {
+	echo bp_get_the_profile_group_name();
+}
+	function bp_get_the_profile_group_name() {
+		global $group;
+		return apply_filters( 'bp_get_the_profile_group_name', $group->name );
+	}
+
+function bp_the_profile_group_slug() {
+	echo bp_get_the_profile_group_slug();
+}
+	function bp_get_the_profile_group_slug() {
+		global $group;
+		return apply_filters( 'bp_get_the_profile_group_slug', sanitize_title( $group->name ) );
+	}
+
+function bp_the_profile_group_description() {
+	echo bp_get_the_profile_group_description();
+}
+	function bp_get_the_profile_group_description() {
+		global $group;
+		echo apply_filters( 'bp_get_the_profile_group_description', $group->description );
+	}
+
+function bp_the_profile_group_edit_form_action() {
+	echo bp_get_the_profile_group_edit_form_action();
+}
+	function bp_get_the_profile_group_edit_form_action() {
+		global $bp, $group;
+
+		return apply_filters( 'bp_get_the_profile_group_edit_form_action', $bp->displayed_user->domain . BP_XPROFILE_SLUG . '/edit/group/' . $group->id . '/' );
+	}
+
+function bp_the_profile_group_field_ids() {
+	echo bp_get_the_profile_group_field_ids();
+}
+	function bp_get_the_profile_group_field_ids() {
+		global $group;
+
+		foreach ( (array) $group->fields as $field )
+			$field_ids .= $field->id . ',';
+
+		return substr( $field_ids, 0, -1 );
+	}
+
+function bp_profile_fields() {
+	global $profile_template;
+	return $profile_template->profile_fields();
+}
+
+function bp_the_profile_field() {
+	global $profile_template;
+	return $profile_template->the_profile_field();
+}
+
+function bp_the_profile_field_id() {
+	echo bp_get_the_profile_field_id();
+}
+	function bp_get_the_profile_field_id() {
+		global $field;
+		return apply_filters( 'bp_get_the_profile_field_id', $field->id );
+	}
+
+function bp_the_profile_field_name() {
+	echo bp_get_the_profile_field_name();
+}
+	function bp_get_the_profile_field_name() {
+		global $field;
+
+		return apply_filters( 'bp_get_the_profile_field_name', $field->name );
+	}
+
+function bp_the_profile_field_value() {
+	echo bp_get_the_profile_field_value();
+}
+	function bp_get_the_profile_field_value() {
+		global $field;
+
+		$field->data->value = bp_unserialize_profile_field( $field->data->value );
+
+		return apply_filters( 'bp_get_the_profile_field_value', $field->data->value, $field->type, $field->id );
+	}
+
+function bp_the_profile_field_edit_value() {
+	echo bp_get_the_profile_field_edit_value();
+}
+	function bp_get_the_profile_field_edit_value() {
+		global $field;
+
+		/**
+		 * Check to see if the posted value is different, if it is re-display this
+		 * value as long as it's not empty and a required field.
+		 */
+		if ( isset( $_POST['field_' . $field->id] ) && ( $field->data->value != $_POST['field_' . $field->id] ) ) {
+			if ( !empty( $_POST['field_' . $field->id] ) )
+				$field->data->value = $_POST['field_' . $field->id];
+		}
+
+		$field->data->value = bp_unserialize_profile_field( $field->data->value );
+
+		return apply_filters( 'bp_get_the_profile_field_edit_value', esc_html( $field->data->value ) );
+	}
+
+function bp_the_profile_field_type() {
+	echo bp_get_the_profile_field_type();
+}
+	function bp_get_the_profile_field_type() {
+		global $field;
+
+		return apply_filters( 'bp_the_profile_field_type', $field->type );
+	}
+
+function bp_the_profile_field_description() {
+	echo bp_get_the_profile_field_description();
+}
+	function bp_get_the_profile_field_description() {
+		global $field;
+
+		return apply_filters( 'bp_get_the_profile_field_description', $field->description );
+	}
+
+function bp_the_profile_field_input_name() {
+	echo bp_get_the_profile_field_input_name();
+}
+	function bp_get_the_profile_field_input_name() {
+		global $field;
+
+		$array_box = false;
+		if ( 'multiselectbox' == $field->type )
+			$array_box = '[]';
+
+		return apply_filters( 'bp_get_the_profile_field_input_name', 'field_' . $field->id . $array_box );
+	}
+
+function bp_the_profile_field_options( $args = '' ) {
+	echo bp_get_the_profile_field_options( $args );
+}
+	function bp_get_the_profile_field_options( $args = '' ) {
+		global $field;
+
+		$defaults = array(
+			'type' => false
+		);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		if ( !method_exists( $field, 'get_children' ) )
+			$field = new BP_XProfile_Field( $field->id );
+
+		$options = $field->get_children();
+
+		switch ( $field->type ) {
+
+			case 'selectbox': case 'multiselectbox':
+				if ( 'multiselectbox' != $field->type )
+					$html .= '<option value="">--------</option>';
+
+				for ( $k = 0; $k < count($options); $k++ ) {
+					$option_values = BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id );
+					$option_values = (array)$option_values;
+
+					/* Check for updated posted values, but errors preventing them from being saved first time */
+					foreach( (array)$option_values as $i => $option_value ) {
+						if ( isset( $_POST['field_' . $field->id] ) && $_POST['field_' . $field->id] != $option_value ) {
+							if ( !empty( $_POST['field_' . $field->id] ) )
+								$option_values[$i] = $_POST['field_' . $field->id];
+						}
+					}
+
+					if ( in_array( $options[$k]->name, (array)$option_values ) || $options[$k]->is_default_option ) {
+						$selected = ' selected="selected"';
+					} else {
+						$selected = '';
+					}
+
+					$html .= apply_filters( 'bp_get_the_profile_field_options_select', '<option' . $selected . ' value="' . esc_attr( $options[$k]->name ) . '">' . esc_attr( $options[$k]->name ) . '</option>', $options[$k] );
+				}
+				break;
+
+			case 'radio':
+				$html = '<div id="field_' . $field->id . '">';
+
+				for ( $k = 0; $k < count($options); $k++ ) {
+					$option_value = BP_XProfile_ProfileData::get_value_byid($options[$k]->parent_id);
+
+					/* Check for updated posted values, but errors preventing them from being saved first time */
+					if ( isset( $_POST['field_' . $field->id] ) && $option_value != $_POST['field_' . $field->id] ) {
+						if ( !empty( $_POST['field_' . $field->id] ) )
+							$option_value = $_POST['field_' . $field->id];
+					}
+
+					if ( $option_value == $options[$k]->name || $value == $options[$k]->name || $options[$k]->is_default_option ) {
+						$selected = ' checked="checked"';
+					} 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="' . esc_attr( $options[$k]->name ) . '"> ' . esc_attr( $options[$k]->name ) . '</label>', $options[$k] );
+				}
+
+				$html .= '</div>';
+				break;
+
+			case 'checkbox':
+				$option_values = BP_XProfile_ProfileData::get_value_byid($options[0]->parent_id);
+
+				/* Check for updated posted values, but errors preventing them from being saved first time */
+				if ( isset( $_POST['field_' . $field->id] ) && $option_values != maybe_serialize( $_POST['field_' . $field->id] ) ) {
+					if ( !empty( $_POST['field_' . $field->id] ) )
+						$option_values = $_POST['field_' . $field->id];
+				}
+
+				$option_values = maybe_unserialize($option_values);
+
+				for ( $k = 0; $k < count($options); $k++ ) {
+					for ( $j = 0; $j < count($option_values); $j++ ) {
+						if ( $option_values[$j] == $options[$k]->name || @in_array( $options[$k]->name, $value ) || $options[$k]->is_default_option ) {
+							$selected = ' checked="checked"';
+							break;
+						}
+					}
+
+					$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;
+
+			case 'datebox':
+
+				if ( !empty( $field->data->value ) ) {
+					$day = date("j", $field->data->value);
+					$month = date("F", $field->data->value);
+					$year = date("Y", $field->data->value);
+					$default_select = ' selected="selected"';
+				}
+
+				/* Check for updated posted values, but errors preventing them from being saved first time */
+				if ( !empty( $_POST['field_' . $field->id . '_day'] ) ) {
+					if ( $day != $_POST['field_' . $field->id . '_day'] )
+						$day = $_POST['field_' . $field->id . '_day'];
+				}
+
+				if ( !empty( $_POST['field_' . $field->id . '_month'] ) ) {
+					if ( $month != $_POST['field_' . $field->id . '_month'] )
+						$month = $_POST['field_' . $field->id . '_month'];
+				}
+
+				if ( !empty( $_POST['field_' . $field->id . '_year'] ) ) {
+					if ( $year != date( "j", $_POST['field_' . $field->id . '_year'] ) )
+						$year = $_POST['field_' . $field->id . '_year'];
+				}
+
+				switch ( $type ) {
+					case 'day':
+						$html .= '<option value=""' . esc_attr( $default_select ) . '>--</option>';
+
+						for ( $i = 1; $i < 32; $i++ ) {
+							if ( $day == $i ) {
+								$selected = ' selected = "selected"';
+							} else {
+								$selected = '';
+							}
+							$html .= '<option value="' . $i .'"' . $selected . '>' . $i . '</option>';
+						}
+						break;
+
+					case 'month':
+						$eng_months = array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' );
+
+						$months = array( __( 'January', 'buddypress' ), __( 'February', 'buddypress' ), __( 'March', 'buddypress' ),
+								 __( 'April', 'buddypress' ), __( 'May', 'buddypress' ), __( 'June', 'buddypress' ),
+								 __( 'July', 'buddypress' ), __( 'August', 'buddypress' ), __( 'September', 'buddypress' ),
+								 __( 'October', 'buddypress' ), __( 'November', 'buddypress' ), __( 'December', 'buddypress' )
+								);
+
+						$html .= '<option value=""' . esc_attr( $default_select ) . '>------</option>';
+
+						for ( $i = 0; $i < 12; $i++ ) {
+							if ( $month == $eng_months[$i] ) {
+								$selected = ' selected = "selected"';
+							} else {
+								$selected = '';
+							}
+
+							$html .= '<option value="' . $eng_months[$i] . '"' . $selected . '>' . $months[$i] . '</option>';
+						}
+						break;
+
+					case 'year':
+						$html .= '<option value=""' . esc_attr( $default_select ) . '>----</option>';
+
+						for ( $i = date( 'Y', time() ); $i > 1899; $i-- ) {
+							if ( $year == $i ) {
+								$selected = ' selected = "selected"';
+							} else {
+								$selected = '';
+							}
+
+							$html .= '<option value="' . $i .'"' . $selected . '>' . $i . '</option>';
+						}
+						break;
+				}
+
+				apply_filters( 'bp_get_the_profile_field_datebox', $html, $day, $month, $year, $default_select );
+
+				break;
+		}
+
+		return $html;
+	}
+
+function bp_the_profile_field_is_required() {
+	echo bp_get_the_profile_field_is_required();
+}
+	function bp_get_the_profile_field_is_required() {
+		global $field;
+
+		return apply_filters( 'bp_get_the_profile_field_is_required', (int)$field->is_required );
+	}
+
+function bp_unserialize_profile_field( $value ) {
+	if ( is_serialized($value) ) {
+		$field_value = maybe_unserialize($value);
+		$field_value = implode( ', ', $field_value );
+		return $field_value;
+	}
+
+	return $value;
+}
+
+function bp_profile_field_data( $args = '' ) {
+	echo bp_get_profile_field_data( $args );
+}
+	function bp_get_profile_field_data( $args = '' ) {
+		$defaults = array(
+			'field' => false, // Field name or ID.
+			'user_id' => $bp->displayed_user->id
+			);
+
+		$r = wp_parse_args( $args, $defaults );
+		extract( $r, EXTR_SKIP );
+
+		return apply_filters( 'bp_get_profile_field_data', xprofile_get_field_data( $field, $user_id ) );
+	}
+
+function bp_profile_group_tabs() {
+	global $bp, $group_name;
+
+	if ( !$groups = wp_cache_get( 'xprofile_groups_inc_empty', 'bp' ) ) {
+		$groups = BP_XProfile_Group::get( array( 'fetch_fields' => true ) );
+		wp_cache_set( 'xprofile_groups_inc_empty', $groups, 'bp' );
+	}
+
+	if ( empty( $group_name ) )
+		$group_name = bp_profile_group_name(false);
+
+	for ( $i = 0; $i < count($groups); $i++ ) {
+		if ( $group_name == $groups[$i]->name ) {
+			$selected = ' class="current"';
+		} else {
+			$selected = '';
+		}
+
+		if ( $groups[$i]->fields )
+			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' );
+}
+
+function bp_profile_group_name( $deprecated = true ) {
+	global $bp;
+
+	$group_id = $bp->action_variables[1];
+
+	if ( !is_numeric( $group_id ) )
+		$group_id = 1;
+
+	if ( !$group = wp_cache_get( 'xprofile_group_' . $group_id, 'bp' ) ) {
+		$group = new BP_XProfile_Group($group_id);
+		wp_cache_set( 'xprofile_group_' . $group_id, $group, 'bp' );
+	}
+
+	if ( !$deprecated ) {
+		return bp_get_profile_group_name();
+	} else {
+		echo bp_get_profile_group_name();
+	}
+}
+	function bp_get_profile_group_name() {
+		global $bp;
+
+		$group_id = $bp->action_variables[1];
+
+		if ( !is_numeric( $group_id ) )
+			$group_id = 1;
+
+		if ( !$group = wp_cache_get( 'xprofile_group_' . $group_id, 'bp' ) ) {
+			$group = new BP_XProfile_Group($group_id);
+			wp_cache_set( 'xprofile_group_' . $group_id, $group, 'bp' );
+		}
+
+		return apply_filters( 'bp_get_profile_group_name', $group->name );
+	}
+
+function bp_avatar_upload_form() {
+	global $bp;
+
+	if ( !(int)$bp->site_options['bp-disable-avatar-uploads'] )
+		bp_core_avatar_admin( null, $bp->loggedin_user->domain . $bp->profile->slug . '/change-avatar/', $bp->loggedin_user->domain . $bp->profile->slug . '/delete-avatar/' );
+	else
+		_e( 'Avatar uploads are currently disabled. Why not use a <a href="http://gravatar.com" target="_blank">gravatar</a> instead?', 'buddypress' );
+}
+
+function bp_profile_last_updated() {
+	global $bp;
+
+	$last_updated = bp_get_profile_last_updated();
+
+	if ( !$last_updated ) {
+		_e( 'Profile not recently updated', 'buddypress' ) . '.';
+	} else {
+		echo $last_updated;
+	}
+}
+	function bp_get_profile_last_updated() {
+		global $bp;
+
+		$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 ) ) ) );
+
+		return false;
+	}
+
+function bp_current_profile_group_id() {
+	echo bp_get_current_profile_group_id();
+}
+	function bp_get_current_profile_group_id() {
+		global $bp;
+
+		if ( !$profile_group_id = $bp->action_variables[1] )
+			$profile_group_id = 1;
+
+		return apply_filters( 'bp_get_current_profile_group_id', $profile_group_id ); // admin/profile/edit/[group-id]
+	}
+
+function bp_avatar_delete_link() {
+	echo bp_get_avatar_delete_link();
+}
+	function bp_get_avatar_delete_link() {
+		global $bp;
+
+		return apply_filters( 'bp_get_avatar_delete_link', wp_nonce_url( $bp->displayed_user->domain . $bp->profile->slug . '/change-avatar/delete-avatar/', 'bp_delete_avatar_link' ) );
+	}
+
+function bp_get_user_has_avatar() {
+	if ( !bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'no_grav' => true ) ) )
+		return false;
+
+	return true;
+}
+
+function bp_edit_profile_button() {
+	global $bp;
+
+	bp_button( array (
+		'id'                => 'edit_profile',
+		'component'         => 'xprofile',
+		'must_be_logged_in' => true,
+		'block_self'        => true,
+		'link_href'         => trailingslashit( $bp->displayed_user->domain . $bp->profile->slug . '/edit' ),
+		'link_class'        => 'edit',
+		'link_text'         => __( 'Edit Profile', 'buddypress' ),
+		'link_title'        => __( 'Edit Profile', 'buddypress' ),
+	) );
+}
+
+?>
diff --git a/wp-content/plugins/buddypress/favicon.ico b/wp-content/plugins/buddypress/favicon.ico
new file mode 100644
index 0000000000000000000000000000000000000000..3f5eadcbc5c7bc36eead0f6eb6be212e9445aac5
Binary files /dev/null and b/wp-content/plugins/buddypress/favicon.ico differ
diff --git a/wp-content/plugins/buddypress/license.txt b/wp-content/plugins/buddypress/license.txt
new file mode 100644
index 0000000000000000000000000000000000000000..b5fcfa6e7a5343eec02d2d25805773efbdf65121
--- /dev/null
+++ b/wp-content/plugins/buddypress/license.txt
@@ -0,0 +1,280 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                          675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
diff --git a/wp-content/plugins/buddypress/readme.txt b/wp-content/plugins/buddypress/readme.txt
new file mode 100644
index 0000000000000000000000000000000000000000..70d409b008ae038a6cae8d4a268437dc5a439b39
--- /dev/null
+++ b/wp-content/plugins/buddypress/readme.txt
@@ -0,0 +1,131 @@
+=== Plugin Name ===
+Contributors: apeatling, johnjamesjacoby, djpaul, boonebgorges, MrMaz
+Tags: buddypress, social networking, activity, profiles, messaging, friends, groups, forums, microblogging, twitter, facebook, mingle, social, community, networks, networking, cms
+Requires at least: 3.0
+Tested up to: 3.0
+Stable tag: 1.2.6
+
+== Description ==
+
+Social networking in a box. Build a social network for your company, school, sports team or niche community all based on the power and flexibility of WordPress.
+
+BuddyPress will let users register on your site and start creating profiles, posting messages, making connections, creating and interacting in groups and much more.
+
+<h4>Try the Demo</h4>
+
+If you're interested in seeing what a default installation of BuddyPress has to offer, try out the BuddyPress test drive! This site is a community of BuddyPress users looking to try out and discuss the latest features of BuddyPress.
+
+<a href="http://testbp.org/">BuddyPress Test Drive</a>
+
+<h4>Who's Using BuddyPress?</h4>
+
+More and more WordPress with BuddyPress powered sites are popping up. You can take a look at some of the best sites on the <a href="http://buddypress.org/demo/">BuddyPress demo page</a> or the <a href="http://wordpress.org/showcase/flavor/buddypress/">BuddyPress section of the WordPress showcase</a>.
+
+<h4>Plugins: Adding So Much More</h4>
+
+BuddyPress boasts an ever growing array of new features developed by the awesome plugin development community. Some of most popular BuddyPress plugins currently available are:
+
+*	<a href="http://wordpress.org/extend/plugins/wp-fb-autoconnect">WP-FB-AutoConnect</a> - allow your users to instantly log in to your site using their Facebook credentials.
+*	<a href="http://wordpress.org/extend/plugins/buddypress-like">BuddyPress Like</a> - add a "like" button to site activity.
+*	<a href="http://wordpress.org/extend/plugins/buddypress-links">BuddyPress Links</a> - rich media embedding for your BuddyPress powered site.
+*	<a href="http://wordpress.org/extend/plugins/tweetstream">BuddyPress Tweetstream</a> - allow your users to sync and post to their Twitter stream.
+*	<a href="http://wordpress.org/extend/plugins/facestream">BuddyPress Facestream</a> - allow your users to sync and post to their Facebook stream.
+*	<a href="http://wordpress.org/extend/plugins/bp-album">BuddyPress Album+</a> - allow your users to upload photos and create albums.
+*	<a href="http://wordpress.org/extend/plugins/buddypress-group-documents">BuddyPress Group Documents</a> - add file upload and document repositories to your groups.
+*	<a href="http://wordpress.org/extend/plugins/bp-profile-privacy">BuddyPress Profile Privacy</a> - allow your users to set privacy options on their profile data.
+*	<a href="http://wordpress.org/extend/plugins/welcome-pack">BuddyPress Welcome Pack</a> - set defaults for new users, auto join them to groups or send welcome messages.
+*	<a href="http://wordpress.org/extend/plugins/bp-groupblog">BuddyPress Group Blog</a> (WordPress MU only) - allow your groups to include a fully functional WordPress blog.
+*	<a href="http://wordpress.org/extend/plugins/buddypress-group-wiki/">BuddyPress Group Wiki</a> - add wiki functionality to your groups so all members can contribute to pages.
+
+There are already more than 125 BuddyPress plugins available, the list is growing every day. For a full list of plugins, please visit the <a href="http://buddypress.org/extend/plugins/">BuddyPress.org plugins page</a>. You can also install any of these plugins automatically through the plugin installer menu inside of your WordPress installation.
+
+<h4>More Information</h4>
+
+Visit the <a href="http://buddypress.org/">BuddyPress website</a> for more information about BuddyPress.
+
+== Installation ==
+
+You can download and install BuddyPress using the built in WordPress plugin installer. If you download BuddyPress manually, make sure it is uploaded to "/wp-content/plugins/buddypress/".
+
+Activate BuddyPress in the "Plugins" admin panel using the "Activate" link.
+
+You will need to enable permalink support in your WordPress installation for BuddyPress pages to function correctly. You can set this up using the "Settings > Permalinks" menu in your WordPress admin area.
+
+Finally, you will need to activate a BuddyPress compatible theme. Two BuddyPress themes are bundled with the plugin, you can activate these using the "Appearance > Themes" menu in your WordPress admin area. To install other BuddyPress compatible themes, use the "Appearance > Add New Themes" menu and select the "buddypress" checkbox before hitting the "Find Themes" button.
+
+--- Forums Support ---
+
+BuddyPress also includes support for discussion forums. Each group created on your site can have its own discussion forum. If you'd like to enable this feature please use the "BuddyPress > Forums Setup" menu in your WordPress admin area and follow the on screen instructions.
+
+== Frequently Asked Questions ==
+
+= Can I use my existing WordPress theme? =
+
+Of course! First install and activate BuddyPress, then download and activate the <a href="http://wordpress.org/extend/plugins/bp-template-pack/">template extension pack</a>. This plugin will run you through the process step-by-step.
+
+Be sure to also try out the default theme bundled with BuddyPress. It provides all the awesome features of a standard WordPress blog, but also integrates the BuddyPress features both seamlessly and beautfully. It's also really easy to modify with custom header support, widget support and via a <a href="http://codex.buddypress.org/how-to-guides/building-a-buddypress-child-theme/">child theme</a>.
+
+= Will this work on standard WordPress and WordPress MU? =
+
+Yes! BuddyPress will run on both versions of WordPress. If you are using WordPress MU then BuddyPress will support the global tracking of blogs, posts and comments.
+
+= Where can I get support? =
+
+The support forums can be found here: http://buddypress.org/forums/
+
+= Where can I find documentation? =
+
+The documentation codex can be found here: http://codex.buddypress.org/
+
+= Where can I report a bug? =
+
+Bugs can be reported here: http://trac.buddypress.org/newticket/
+
+= Where can checkout the latest bleeding edge? =
+
+BuddyPress subversion trunk can be found at: http://svn.buddypress.org/trunk/
+
+== Screenshots ==
+
+1. **Activity Streams** - Global, personal and group activity streams with threaded commenting, direct posting, favoriting and @mentions. All with full RSS feed and email notification support.
+2. **Extended Profiles** - Fully editable profile fields allow you to define the fields users can fill in to describe themselves. Tailor profile fields to suit your audience.
+3. **Extensible Groups** - Powerful public, private or hidden groups allow your users to break the discussion down into specific topics. Extend groups with your own custom features using the group extension API.
+4. **Friend Connections** - Let your users make connections so they can track the activity of others, or filter on only those users they care about the most.
+5. **Private Messaging** - Private messaging will allow your users to talk to each other directly, and in private. Not just limited to one on one discussions, your users can send messages to multiple recipients.
+6. **Discussion Forums** - Full powered discussion forums built directly into groups allow for more conventional in-depth conversations.
+7. **WordPress Blogging** - Start a blog built on the best blogging software in the world. Even allow each of your users to start their own full powered WordPress blog (with WordPress MU). Track new posts and comments across your site.
+
+== Languages ==
+
+BuddyPress is available in more than 20 languages. For more information about BuddyPress in your language please select a langauge site from the list below. Is your language missing? Please send a message to the <a href="http://lists.automattic.com/mailman/listinfo/wp-polyglots">WP-Polygots</a> mailing list and request for your language to be set up.
+
+*	<a href="http://br.buddypress.org/">Brasil</a>
+*	<a href="http://ca.buddypress.org/">Català</a>
+*	<a href="http://de.buddypress.org/">Deutsch</a>
+*	<a href="http://es.buddypress.org/">Español</a>
+*	<a href="http://fr.buddypress.org/">Français</a>
+*	<a href="http://id.buddypress.org/">Indonesia</a>
+*	<a href="http://it.buddypress.org/">Italia</a>
+*	<a href="http://lv.buddypress.org/">Latviešu valodā</a>
+*	<a href="http://nl.buddypress.org/">Nederland</a>
+*	<a href="http://pl.buddypress.org/">Polska</a>
+*	<a href="http://pt.buddypress.org/">Portugal</a>
+*	<a href="http://ru.buddypress.org/">Русский</a>
+*	<a href="http://fi.buddypress.org/">Suomi</a>
+*	<a href="http://th.buddypress.org/">Thai</a>
+*	<a href="http://uk.buddypress.org/">Україна</a>
+*	<a href="http://ja.buddypress.org/">日本語</a>
+*	<a href="http://cn.buddypress.org/">简体中文</a>
+*	<a href="http://ko.buddypress.org/">한국어</a>
+*	<a href="http://tw.buddypress.org/">正體中文</a>
+
+The <a href="http://i18n.svn.buddypress.org/">BuddyPress langauge file repository</a> includes some language that have not yet set up a localization site.
+
+== Upgrade Notice ==
+
+= 1.2.6 =
+Bug fixes and improved WordPress 3.0 support. Important upgrade.
+
+== Changelog ==
+
+See http://buddypress.org/about/release-history/ for a list of changes.
\ No newline at end of file
diff --git a/wp-content/plugins/buddypress/screenshot-1.gif b/wp-content/plugins/buddypress/screenshot-1.gif
new file mode 100644
index 0000000000000000000000000000000000000000..79f178d37a80a3687bbcf4fb9e7584a2927d8ac2
Binary files /dev/null and b/wp-content/plugins/buddypress/screenshot-1.gif differ
diff --git a/wp-content/plugins/buddypress/screenshot-2.gif b/wp-content/plugins/buddypress/screenshot-2.gif
new file mode 100644
index 0000000000000000000000000000000000000000..c50923288c72e389d549754e86bd31384259583b
Binary files /dev/null and b/wp-content/plugins/buddypress/screenshot-2.gif differ
diff --git a/wp-content/plugins/buddypress/screenshot-3.gif b/wp-content/plugins/buddypress/screenshot-3.gif
new file mode 100644
index 0000000000000000000000000000000000000000..63bdbff95975784cb073dc0936ff217703e44119
Binary files /dev/null and b/wp-content/plugins/buddypress/screenshot-3.gif differ
diff --git a/wp-content/plugins/buddypress/screenshot-4.gif b/wp-content/plugins/buddypress/screenshot-4.gif
new file mode 100644
index 0000000000000000000000000000000000000000..d63126f9de04a3847eba8eb274d221cbd9ca95c0
Binary files /dev/null and b/wp-content/plugins/buddypress/screenshot-4.gif differ
diff --git a/wp-content/plugins/buddypress/screenshot-5.gif b/wp-content/plugins/buddypress/screenshot-5.gif
new file mode 100644
index 0000000000000000000000000000000000000000..ff8ff65dd1d9716df1cff602b5768571b834c858
Binary files /dev/null and b/wp-content/plugins/buddypress/screenshot-5.gif differ
diff --git a/wp-content/plugins/buddypress/screenshot-6.gif b/wp-content/plugins/buddypress/screenshot-6.gif
new file mode 100644
index 0000000000000000000000000000000000000000..45dce03f06bfef3a2596f96833a26265062506b4
Binary files /dev/null and b/wp-content/plugins/buddypress/screenshot-6.gif differ
diff --git a/wp-content/plugins/buddypress/screenshot-7.gif b/wp-content/plugins/buddypress/screenshot-7.gif
new file mode 100644
index 0000000000000000000000000000000000000000..2410089858343790f0ec499db91f1d29d82e2931
Binary files /dev/null and b/wp-content/plugins/buddypress/screenshot-7.gif differ