Index: src/bp-activity/bp-activity-admin.php
===================================================================
--- src/bp-activity/bp-activity-admin.php	(revision 10496)
+++ src/bp-activity/bp-activity-admin.php	(working copy)
@@ -16,6 +16,8 @@
 // Include WP's list table class.
 if ( !class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
 
+require dirname( __FILE__ ) . '/classes/class-bp-activity-list-table.php';
+
 // Per_page screen option. Has to be hooked in extremely early.
 if ( is_admin() && ! empty( $_REQUEST['page'] ) && 'bp-activity' == $_REQUEST['page'] )
 	add_filter( 'set-screen-option', 'bp_activity_admin_screen_options', 10, 3 );
@@ -1038,816 +1040,3 @@
 
 <?php
 }
-
-/**
- * List table class for the Activity component admin page.
- *
- * @since 1.6.0
- */
-class BP_Activity_List_Table extends WP_List_Table {
-
-	/**
-	 * What type of view is being displayed?
-	 *
-	 * E.g. "all", "pending", "approved", "spam"...
-	 *
-	 * @since 1.6.0
-	 * @var string $view
-	 */
-	public $view = 'all';
-
-	/**
-	 * How many activity items have been marked as spam.
-	 *
-	 * @since 1.6.0
-	 * @var int $spam_count
-	 */
-	public $spam_count = 0;
-
-	/**
-	 * Store activity-to-user-ID mappings for use in the In Response To column.
-	 *
-	 * @since 1.6.0
-	 * @var array $activity_user_id
-	 */
-	protected $activity_user_id = array();
-
-	/**
-	 * If users can comment on blog & forum activity items.
-	 *
-	 * @link https://buddypress.trac.wordpress.org/ticket/6277
-	 *
-	 * @since 2.2.2
-	 * @var bool $disable_blogforum_comments
-	 */
-	public $disable_blogforum_comments = false;
-
-	/**
-	 * Constructor.
-	 *
-	 * @since 1.6.0
-	 */
-	public function __construct() {
-
-		// See if activity commenting is enabled for blog / forum activity items.
-		$this->disable_blogforum_comments = bp_disable_blogforum_comments();
-
-		// Define singular and plural labels, as well as whether we support AJAX.
-		parent::__construct( array(
-			'ajax'     => false,
-			'plural'   => 'activities',
-			'singular' => 'activity',
-			'screen'   => get_current_screen(),
-		) );
-	}
-
-	/**
-	 * Handle filtering of data, sorting, pagination, and any other data manipulation prior to rendering.
-	 *
-	 * @since 1.6.0
-	 */
-	function prepare_items() {
-
-		// Option defaults.
-		$filter           = array();
-		$include_id       = false;
-		$search_terms     = false;
-		$sort             = 'DESC';
-		$spam             = 'ham_only';
-
-		// Set current page.
-		$page = $this->get_pagenum();
-
-		// Set per page from the screen options.
-		$per_page = $this->get_items_per_page( str_replace( '-', '_', "{$this->screen->id}_per_page" ) );
-
-		// Check if we're on the "Spam" view.
-		if ( !empty( $_REQUEST['activity_status'] ) && 'spam' == $_REQUEST['activity_status'] ) {
-			$spam       = 'spam_only';
-			$this->view = 'spam';
-		}
-
-		// Sort order.
-		if ( !empty( $_REQUEST['order'] ) && 'desc' != $_REQUEST['order'] )
-			$sort = 'ASC';
-
-		// Order by.
-		/*if ( !empty( $_REQUEST['orderby'] ) ) {
-		}*/
-
-		// Filter.
-		if ( !empty( $_REQUEST['activity_type'] ) )
-			$filter = array( 'action' => $_REQUEST['activity_type'] );
-
-		// Are we doing a search?
-		if ( !empty( $_REQUEST['s'] ) )
-			$search_terms = $_REQUEST['s'];
-
-		// Check if user has clicked on a specific activity (if so, fetch only that, and any related, activity).
-		if ( !empty( $_REQUEST['aid'] ) )
-			$include_id = (int) $_REQUEST['aid'];
-
-		// Get the spam total (ignoring any search query or filter).
-		$spams = bp_activity_get( array(
-			'display_comments' => 'stream',
-			'show_hidden'      => true,
-			'spam'             => 'spam_only',
-			'count_total'      => 'count_query',
-		) );
-		$this->spam_count = $spams['total'];
-		unset( $spams );
-
-		// Get the activities from the database.
-		$activities = bp_activity_get( array(
-			'display_comments' => 'stream',
-			'filter'           => $filter,
-			'in'               => $include_id,
-			'page'             => $page,
-			'per_page'         => $per_page,
-			'search_terms'     => $search_terms,
-			'show_hidden'      => true,
-			// 'sort'             => $sort,
-			'spam'             => $spam,
-			'count_total'      => 'count_query',
-		) );
-
-		// If we're viewing a specific activity, flatten all activities into a single array.
-		if ( $include_id ) {
-			$activities['activities'] = BP_Activity_List_Table::flatten_activity_array( $activities['activities'] );
-			$activities['total']      = count( $activities['activities'] );
-
-			// Sort the array by the activity object's date_recorded value.
-			usort( $activities['activities'], create_function( '$a, $b', 'return $a->date_recorded > $b->date_recorded;' ) );
-		}
-
-		// The bp_activity_get function returns an array of objects; cast these to arrays for WP_List_Table.
-		$new_activities = array();
-		foreach ( $activities['activities'] as $activity_item ) {
-			$new_activities[] = (array) $activity_item;
-
-			// Build an array of activity-to-user ID mappings for better efficiency in the In Response To column.
-			$this->activity_user_id[$activity_item->id] = $activity_item->user_id;
-		}
-
-		// Set raw data to display.
-		$this->items       = $new_activities;
-
-		// Store information needed for handling table pagination.
-		$this->set_pagination_args( array(
-			'per_page'    => $per_page,
-			'total_items' => $activities['total'],
-			'total_pages' => ceil( $activities['total'] / $per_page )
-		) );
-
-		// Don't truncate activity items; bp_activity_truncate_entry() needs to be used inside a BP_Activity_Template loop.
-		remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
-	}
-
-	/**
-	 * Get an array of all the columns on the page.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @return array Column headers.
-	 */
-	function get_column_info() {
-		$this->_column_headers = array(
-			$this->get_columns(),
-			array(),
-			$this->get_sortable_columns(),
-			$this->get_default_primary_column_name(),
-		);
-
-		return $this->_column_headers;
-	}
-
-	/**
-	 * Get name of default primary column
-	 *
-	 * @since 2.3.3
-	 *
-	 * @return string
-	 */
-	protected function get_default_primary_column_name() {
-		return 'author';
-	}
-
-	/**
-	 * Display a message on screen when no items are found (e.g. no search matches).
-	 *
-	 * @since 1.6.0
-	 */
-	function no_items() {
-		_e( 'No activities found.', 'buddypress' );
-	}
-
-	/**
-	 * Output the Activity data table.
-	 *
-	 * @since 1.6.0
-	 */
-	function display() {
-		$this->display_tablenav( 'top' ); ?>
-
-		<h2 class="screen-reader-text"><?php _e( 'Activities list', 'buddypress' ); ?></h2>
-
-		<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0">
-			<thead>
-				<tr>
-					<?php $this->print_column_headers(); ?>
-				</tr>
-			</thead>
-
-			<tfoot>
-				<tr>
-					<?php $this->print_column_headers( false ); ?>
-				</tr>
-			</tfoot>
-
-			<tbody id="the-comment-list">
-				<?php $this->display_rows_or_placeholder(); ?>
-			</tbody>
-		</table>
-		<?php
-
-		$this->display_tablenav( 'bottom' );
-	}
-
-	/**
-	 * Generate content for a single row of the table.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param object $item The current item.
-	 */
-	function single_row( $item ) {
-		static $even = false;
-
-		if ( $even ) {
-			$row_class = ' class="even"';
-		} else {
-			$row_class = ' class="alternate odd"';
-		}
-
-		if ( 'activity_comment' === $item['type'] ) {
-			$root_id = $item['item_id'];
-		} else {
-			$root_id = $item['id'];
-		}
-
-		echo '<tr' . $row_class . ' id="activity-' . esc_attr( $item['id'] ) . '" data-parent_id="' . esc_attr( $item['id'] ) . '" data-root_id="' . esc_attr( $root_id ) . '">';
-		echo $this->single_row_columns( $item );
-		echo '</tr>';
-
-		$even = ! $even;
-	}
-
-	/**
-	 * Get the list of views available on this table (e.g. "all", "spam").
-	 *
-	 * @since 1.6.0
-	 */
-	function get_views() {
-		$url_base = add_query_arg( array( 'page' => 'bp-activity' ), bp_get_admin_url( 'admin.php' ) ); ?>
-
-		<h2 class="screen-reader-text"><?php _e( 'Filter activities list', 'buddypress' ); ?></h2>
-
-		<ul class="subsubsub">
-			<li class="all"><a href="<?php echo esc_url( $url_base ); ?>" class="<?php if ( 'spam' != $this->view ) echo 'current'; ?>"><?php _e( 'All', 'buddypress' ); ?></a> |</li>
-			<li class="spam"><a href="<?php echo esc_url( add_query_arg( array( 'activity_status' => 'spam' ), $url_base ) ); ?>" class="<?php if ( 'spam' == $this->view ) echo 'current'; ?>"><?php printf( __( 'Spam <span class="count">(%s)</span>', 'buddypress' ), number_format_i18n( $this->spam_count ) ); ?></a></li>
-
-			<?php
-
-			/**
-			 * Fires inside listing of views so plugins can add their own.
-			 *
-			 * @since 1.6.0
-			 *
-			 * @param string $url_base Current URL base for view.
-			 * @param string $view     Current view being displayed.
-			 */
-			do_action( 'bp_activity_list_table_get_views', $url_base, $this->view ); ?>
-		</ul>
-	<?php
-	}
-
-	/**
-	 * Get bulk actions.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @return array Key/value pairs for the bulk actions dropdown.
-	 */
-	function get_bulk_actions() {
-		$actions = array();
-		$actions['bulk_spam']   = __( 'Mark as Spam', 'buddypress' );
-		$actions['bulk_ham']    = __( 'Not Spam', 'buddypress' );
-		$actions['bulk_delete'] = __( 'Delete Permanently', 'buddypress' );
-
-		/**
-		 * Filters the default bulk actions so plugins can add custom actions.
-		 *
-		 * @since 1.6.0
-		 *
-		 * @param array $actions Default available actions for bulk operations.
-		 */
-		return apply_filters( 'bp_activity_list_table_get_bulk_actions', $actions );
-	}
-
-	/**
-	 * Get the table column titles.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @see WP_List_Table::single_row_columns()
-	 *
-	 * @return array The columns to appear in the Activity list table.
-	 */
-	function get_columns() {
-		/**
-		 * Filters the titles for the columns for the activity list table.
-		 *
-		 * @since 2.4.0
-		 *
-		 * @param array $value Array of slugs and titles for the columns.
-		 */
-		return apply_filters( 'bp_activity_list_table_get_columns', array(
-			'cb'       => '<input name type="checkbox" />',
-			'author'   => _x('Author', 'Admin SWA column header', 'buddypress' ),
-			'comment'  => _x( 'Activity', 'Admin SWA column header', 'buddypress' ),
-			'action'   => _x( 'Action', 'Admin SWA column header', 'buddypress' ),
-			'response' => _x( 'In Response To', 'Admin SWA column header', 'buddypress' ),
-		) );
-	}
-
-	/**
-	 * Get the column names for sortable columns.
-	 *
-	 * Currently, returns an empty array (no columns are sortable).
-	 *
-	 * @since 1.6.0
-	 * @todo For this to work, BP_Activity_Activity::get() needs updating
-	 *       to support ordering by specific fields.
-	 *
-	 * @return array The columns that can be sorted on the Activity screen.
-	 */
-	function get_sortable_columns() {
-		return array();
-
-		/*return array(
-			'author' => array( 'activity_author', false ),  // Intentionally not using "=>"
-		);*/
-	}
-
-	/**
-	 * Markup for the "filter" part of the form (i.e. which activity type to display).
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param string $which 'top' or 'bottom'.
-	 */
-	function extra_tablenav( $which ) {
-
-		// Bail on bottom table nav.
-		if ( 'bottom' === $which ) {
-			return;
-		}
-
-		// Is any filter currently selected?
-		$selected = ( ! empty( $_REQUEST['activity_type'] ) ) ? $_REQUEST['activity_type'] : '';
-
-		// Get the actions.
-		$activity_actions = bp_activity_get_actions(); ?>
-
-		<div class="alignleft actions">
-			<label for="activity-type" class="screen-reader-text"><?php _e( 'Filter by activity type', 'buddypress' ); ?></label>
-			<select name="activity_type" id="activity-type">
-				<option value="" <?php selected( ! $selected ); ?>><?php _e( 'View all actions', 'buddypress' ); ?></option>
-
-				<?php foreach ( $activity_actions as $component => $actions ) : ?>
-
-					<optgroup label="<?php echo ucfirst( $component ); ?>">
-
-						<?php foreach ( $actions as $action_key => $action_values ) : ?>
-
-							<?php
-
-							// Skip the incorrectly named pre-1.6 action.
-							if ( 'friends_register_activity_action' !== $action_key ) : ?>
-
-								<option value="<?php echo esc_attr( $action_key ); ?>" <?php selected( $action_key,  $selected ); ?>><?php echo esc_html( $action_values[ 'value' ] ); ?></option>
-
-							<?php endif; ?>
-
-						<?php endforeach; ?>
-
-					</optgroup>
-
-				<?php endforeach; ?>
-
-			</select>
-
-			<?php submit_button( __( 'Filter', 'buddypress' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) ); ?>
-		</div>
-
-	<?php
-	}
-
-	/**
-	 * Override WP_List_Table::row_actions().
-	 *
-	 * Basically a duplicate of the row_actions() method, but removes the
-	 * unnecessary <button> addition.
-	 *
-	 * @since 2.3.3
-	 * @since 2.3.4 Visibility set to public for compatibility with WP < 4.0.0.
-	 *
-	 * @param array $actions The list of actions.
-	 * @param bool  $always_visible Whether the actions should be always visible.
-	 * @return string
-	 */
-	public function row_actions( $actions, $always_visible = false ) {
-		$action_count = count( $actions );
-		$i = 0;
-
-		if ( !$action_count )
-			return '';
-
-		$out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
-		foreach ( $actions as $action => $link ) {
-			++$i;
-			( $i == $action_count ) ? $sep = '' : $sep = ' | ';
-			$out .= "<span class='$action'>$link$sep</span>";
-		}
-		$out .= '</div>';
-
-		return $out;
-	}
-
-	/**
-	 * Checkbox column markup.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @see WP_List_Table::single_row_columns()
-	 *
-	 * @param array $item A singular item (one full row).
-	 */
-	function column_cb( $item ) {
-		printf( '<label class="screen-reader-text" for="aid-%1$d">' . __( 'Select activity item %1$d', 'buddypress' ) . '</label><input type="checkbox" name="aid[]" value="%1$d" id="aid-%1$d" />', $item['id'] );
-	}
-
-	/**
-	 * Author column markup.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @see WP_List_Table::single_row_columns()
-	 *
-	 * @param array $item A singular item (one full row).
-	 */
-	function column_author( $item ) {
-		echo '<strong>' . get_avatar( $item['user_id'], '32' ) . ' ' . bp_core_get_userlink( $item['user_id'] ) . '</strong>';
-	}
-
-	/**
-	 * Action column markup.
-	 *
-	 * @since 2.0.0
-	 *
-	 * @see WP_List_Table::single_row_columns()
-	 *
-	 * @param array $item A singular item (one full row).
-	 */
-	function column_action( $item ) {
-		$actions = bp_activity_admin_get_activity_actions();
-
-		if ( isset( $actions[ $item['type'] ] ) ) {
-			echo $actions[ $item['type'] ];
-		} else {
-			printf( __( 'Unregistered action - %s', 'buddypress' ), $item['type'] );
-		}
-	}
-
-	/**
-	 * Content column, and "quick admin" rollover actions.
-	 *
-	 * Called "comment" in the CSS so we can re-use some WP core CSS.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @see WP_List_Table::single_row_columns()
-	 *
-	 * @param array $item A singular item (one full row).
-	 */
-	function column_comment( $item ) {
-		// Determine what type of item (row) we're dealing with.
-		if ( $item['is_spam'] )
-			$item_status = 'spam';
-		else
-			$item_status = 'all';
-
-		// Preorder items: Reply | Edit | Spam | Delete Permanently.
-		$actions = array(
-			'reply'  => '',
-			'edit'   => '',
-			'spam'   => '', 'unspam' => '',
-			'delete' => '',
-		);
-
-		// Build actions URLs.
-		$base_url   = bp_get_admin_url( 'admin.php?page=bp-activity&amp;aid=' . $item['id'] );
-		$spam_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'spam-activity_' . $item['id'] ) );
-
-		$delete_url = $base_url . "&amp;action=delete&amp;$spam_nonce";
-		$edit_url   = $base_url . '&amp;action=edit';
-		$ham_url    = $base_url . "&amp;action=ham&amp;$spam_nonce";
-		$spam_url   = $base_url . "&amp;action=spam&amp;$spam_nonce";
-
-		// Rollover actions.
-		// Reply - JavaScript only; implemented by AJAX.
-		if ( 'spam' != $item_status ) {
-			if ( $this->can_comment( $item ) ) {
-				$actions['reply'] = sprintf( '<a href="#" class="reply hide-if-no-js">%s</a>', __( 'Reply', 'buddypress' ) );
-			} else {
-				$actions['reply'] = sprintf( '<span class="form-input-tip" title="%s">%s</span>', __( 'Replies are disabled for this activity item', 'buddypress' ), __( 'Replies disabled', 'buddypress' ) );
-			}
-
-			// Edit.
-			$actions['edit'] = sprintf( '<a href="%s">%s</a>', $edit_url, __( 'Edit', 'buddypress' ) );
-		}
-
-		// Spam/unspam.
-		if ( 'spam' == $item_status )
-			$actions['unspam'] = sprintf( '<a href="%s">%s</a>', $ham_url, __( 'Not Spam', 'buddypress' ) );
-		else
-			$actions['spam'] = sprintf( '<a href="%s">%s</a>', $spam_url, __( 'Spam', 'buddypress' ) );
-
-		// Delete.
-		$actions['delete'] = sprintf( '<a href="%s" onclick="%s">%s</a>', $delete_url, "javascript:return confirm('" . esc_js( __( 'Are you sure?', 'buddypress' ) ) . "'); ", __( 'Delete Permanently', 'buddypress' ) );
-
-		// Start timestamp.
-		echo '<div class="submitted-on">';
-
-		/**
-		 * Filters available actions for plugins to alter.
-		 *
-		 * @since 1.6.0
-		 *
-		 * @param array $actions Array of available actions user could use.
-		 * @param array $item    Current item being added to page.
-		 */
-		$actions = apply_filters( 'bp_activity_admin_comment_row_actions', array_filter( $actions ), $item );
-
-		/* translators: 2: activity admin ui date/time */
-		printf(
-			__( 'Submitted on <a href="%1$s">%2$s at %3$s</a>', 'buddypress' ),
-			bp_activity_get_permalink( $item['id'] ),
-			date_i18n( bp_get_option( 'date_format' ), strtotime( $item['date_recorded'] ) ),
-			get_date_from_gmt( $item['date_recorded'], bp_get_option( 'time_format' ) )
-		);
-
-		// End timestamp.
-		echo '</div>';
-
-		// Get activity content - if not set, use the action.
-		if ( ! empty( $item['content'] ) ) {
-
-			/**
-			 * Filters current activity item content.
-			 *
-			 * @since 1.2.0
-			 *
-			 * @param array $item Array index holding current activity item content.
-			 */
-			$content = apply_filters_ref_array( 'bp_get_activity_content_body', array( $item['content'] ) );
-		} else {
-			/**
-			 * Filters current activity item action.
-			 *
-			 * @since 1.2.0
-			 *
-			 * @var array $item Array index holding current activity item action.
-			 */
-			$content = apply_filters_ref_array( 'bp_get_activity_action', array( $item['action'] ) );
-		}
-
-		/**
-		 * Filter here to add extra output to the activity content into the Administration.
-		 *
-		 * @since  2.4.0
-		 *
-		 * @param  string $content The activity content.
-		 * @param  array  $item    The activity object converted into an array.
-		 */
-		echo apply_filters( 'bp_activity_admin_comment_content', $content, $item ) . ' ' . $this->row_actions( $actions );
-	}
-
-	/**
-	 * "In response to" column markup.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @see WP_List_Table::single_row_columns()
-	 *
-	 * @param array $item A singular item (one full row).
-	 */
-	function column_response( $item ) {
-
-		// Is $item is a root activity?
-		?>
-
-		<div class="response-links">
-
-		<?php
-		// Activity permalink.
-		$activity_permalink = '';
-		if ( ! $item['is_spam'] ) {
-			$activity_permalink = '<a href="' . bp_activity_get_permalink( $item['id'], (object) $item ) . '" class="comments-view-item-link">' . __( 'View Activity', 'buddypress' ) . '</a>';
-		}
-
-		/**
-		 * Filters default list of default root activity types.
-		 *
-		 * @since 1.6.0
-		 *
-		 * @param array $value Array of default activity types.
-		 * @param array $item  Current item being displayed.
-		 */
-		if ( empty( $item['item_id'] ) || ! in_array( $item['type'], apply_filters( 'bp_activity_admin_root_activity_types', array( 'activity_comment' ), $item ) ) ) {
-			echo $activity_permalink;
-
-			$comment_count     = !empty( $item['children'] ) ? bp_activity_recurse_comment_count( (object) $item ) : 0;
-			$root_activity_url = bp_get_admin_url( 'admin.php?page=bp-activity&amp;aid=' . $item['id'] );
-
-			// If the activity has comments, display a link to the activity's permalink, with its comment count in a speech bubble.
-			if ( $comment_count ) {
-				$title_attr = sprintf( _n( '%s related activity', '%s related activities', $comment_count, 'buddypress' ), number_format_i18n( $comment_count ) );
-				printf( '<a href="%1$s" title="%2$s" class="post-com-count post-com-count-approved"><span class="comment-count comment-count-approved">%3$s</span></a>', esc_url( $root_activity_url ), esc_attr( $title_attr ), number_format_i18n( $comment_count ) );
-			}
-
-		// For non-root activities, display a link to the replied-to activity's author's profile.
-		} else {
-			echo '<strong>' . get_avatar( $this->get_activity_user_id( $item['item_id'] ), '32' ) . ' ' . bp_core_get_userlink( $this->get_activity_user_id( $item['item_id'] ) ) . '</strong><br />';
-			echo $activity_permalink;
-		}
-		?>
-
-		</div>
-
-		<?php
-	}
-
-	/**
-	 * Allow plugins to add their custom column.
-	 *
-	 * @since 2.4.0
-	 *
-	 * @param array  $item        Information about the current row.
-	 * @param string $column_name The column name.
-	 * @return string
-	 */
-	public function column_default( $item = array(), $column_name = '' ) {
-
-		/**
-		 * Filters a string to allow plugins to add custom column content.
-		 *
-		 * @since 2.4.0
-		 *
-		 * @param string $value       Empty string.
-		 * @param string $column_name Name of the column being rendered.
-		 * @param array  $item        The current activity item in the loop.
-		 */
-		return apply_filters( 'bp_activity_admin_get_custom_column', '', $column_name, $item );
-	}
-
-	/**
-	 * Get the user id associated with a given activity item.
-	 *
-	 * Wraps bp_activity_get_specific(), with some additional logic for
-	 * avoiding duplicate queries.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param int $activity_id Activity ID to retrieve User ID for.
-	 * @return int User ID of the activity item in question.
-	 */
-	protected function get_activity_user_id( $activity_id ) {
-		// If there is an existing activity/user ID mapping, just return the user ID.
-		if ( ! empty( $this->activity_user_id[$activity_id] ) ) {
-			return $this->activity_user_id[$activity_id];
-
-		/*
-		 * We don't have a mapping. This means the $activity_id is not on the current
-		 * page of results, so fetch its details from the database.
-		 */
-		} else {
-			$activity = bp_activity_get_specific( array( 'activity_ids' => $activity_id, 'show_hidden' => true, 'spam' => 'all', ) );
-
-			/*
-			 * If, somehow, the referenced activity has been deleted, leaving its associated
-			 * activities as orphans, use the logged in user's ID to avoid errors.
-			 */
-			if ( empty( $activity['activities'] ) )
-				return bp_loggedin_user_id();
-
-			// Store the new activity/user ID mapping for any later re-use.
-			$this->activity_user_id[ $activity['activities'][0]->id ] = $activity['activities'][0]->user_id;
-
-			// Return the user ID.
-			return $activity['activities'][0]->user_id;
-		}
-	}
-
-	/**
-	 * Checks if an activity item can be replied to.
-	 *
-	 * This method merges functionality from {@link bp_activity_can_comment()} and
-	 * {@link bp_blogs_disable_activity_commenting()}. This is done because the activity
-	 * list table doesn't use a BuddyPress activity loop, which prevents those
-	 * functions from working as intended.
-	 *
-	 * @since 2.0.0
-	 *
-	 * @param array $item An array version of the BP_Activity_Activity object.
-	 * @return bool $can_comment
-	 */
-	protected function can_comment( $item  ) {
-		$can_comment = true;
-
-		if ( $this->disable_blogforum_comments ) {
-			switch ( $item['type'] ) {
-				case 'new_blog_post' :
-				case 'new_blog_comment' :
-				case 'new_forum_topic' :
-				case 'new_forum_post' :
-					$can_comment = false;
-					break;
-			}
-
-		// Activity comments supported.
-		} else {
-			// Activity comment.
-			if ( 'activity_comment' == $item['type'] ) {
-				// Blogs.
-				if ( bp_is_active( 'blogs' ) ) {
-					// Grab the parent activity entry.
-					$parent_activity = new BP_Activity_Activity( $item['item_id'] );
-
-					// Fetch blog post comment depth and if the blog post's comments are open.
-					bp_blogs_setup_activity_loop_globals( $parent_activity );
-
-					// Check if the activity item can be replied to.
-					if ( false === bp_blogs_can_comment_reply( true, $item ) ) {
-						$can_comment = false;
-					}
-				}
-
-			// Blog post.
-			} elseif ( 'new_blog_post' == $item['type'] ) {
-				if ( bp_is_active( 'blogs' ) ) {
-					bp_blogs_setup_activity_loop_globals( (object) $item );
-
-					if ( empty( buddypress()->blogs->allow_comments[$item['id']] ) ) {
-						$can_comment = false;
-					}
-				}
-			}
-		}
-
-		/**
-		 * Filters if an activity item can be commented on or not.
-		 *
-		 * @since 2.0.0
-		 *
-		 * @param bool $can_comment Whether an activity item can be commented on or not.
-		 */
-		return apply_filters( 'bp_activity_list_table_can_comment', $can_comment );
-	}
-
-	/**
-	 * Flatten the activity array.
-	 *
-	 * In some cases, BuddyPress gives us a structured tree of activity
-	 * items plus their comments. This method converts it to a flat array.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param array $tree Source array.
-	 * @return array Flattened array.
-	 */
-	public static function flatten_activity_array( $tree ){
-		foreach ( (array) $tree as $node ) {
-			if ( isset( $node->children ) ) {
-
-				foreach ( BP_Activity_List_Table::flatten_activity_array( $node->children ) as $child ) {
-					$tree[] = $child;
-				}
-
-				unset( $node->children );
-			}
-		}
-
-		return $tree;
-	}
-}
Index: src/bp-activity/bp-activity-akismet.php
===================================================================
--- src/bp-activity/bp-activity-akismet.php	(revision 10496)
+++ src/bp-activity/bp-activity-akismet.php	(working copy)
@@ -10,646 +10,8 @@
 // Exit if accessed directly.
 defined( 'ABSPATH' ) || exit;
 
-/**
- * Akismet support for the Activity component.
- *
- * @since 1.6.0
- * @since 2.3.0 We only support Akismet 3+.
- */
-class BP_Akismet {
+require dirname( __FILE__ ) . '/classes/class-bp-akismet.php';
 
-	/**
-	 * The activity last marked as spam.
-	 *
-	 * @since 1.6.0
-	 * @var BP_Activity_Activity
-	 */
-	protected $last_activity = null;
-
-	/**
-	 * Constructor.
-	 *
-	 * @since 1.6.0
-	 */
-	public function __construct() {
-		$this->setup_actions();
-	}
-
-	/**
-	 * Hook Akismet into the activity stream.
-	 *
-	 * @since 1.6.0
-	 */
-	protected function setup_actions() {
-		// Add nonces to activity stream lists.
-		add_action( 'bp_after_activity_post_form', array( $this, 'add_activity_stream_nonce' ) );
-		add_action( 'bp_activity_entry_comments',  array( $this, 'add_activity_stream_nonce' ) );
-
-		// Add a "mark as spam" button to individual activity items.
-		add_action( 'bp_activity_entry_meta',      array( $this, 'add_activity_spam_button' ) );
-		add_action( 'bp_activity_comment_options', array( $this, 'add_activity_comment_spam_button' ) );
-
-		// Check activity for spam.
-		add_action( 'bp_activity_before_save',     array( $this, 'check_activity' ), 4, 1 );
-
-		// Tidy up member's latest (activity) update.
-		add_action( 'bp_activity_posted_update',   array( $this, 'check_member_activity_update' ), 1, 3 );
-
-		// Hooks to extend Activity core spam/ham functions for Akismet.
-		add_action( 'bp_activity_mark_as_spam',    array( $this, 'mark_as_spam' ), 10, 2 );
-		add_action( 'bp_activity_mark_as_ham',     array( $this, 'mark_as_ham' ),  10, 2 );
-
-		// Hook into the Activity wp-admin screen.
-		add_action( 'bp_activity_admin_comment_row_actions', array( $this, 'comment_row_action' ), 10, 2 );
-		add_action( 'bp_activity_admin_load',                array( $this, 'add_history_metabox' ) );
-	}
-
-	/**
-	 * Add a history item to the hover links in an activity's row.
-	 *
-	 * This function lifted with love from the Akismet WordPress plugin's
-	 * akismet_comment_row_action() function. Thanks!
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param array $actions  The hover links.
-	 * @param array $activity The activity for the current row being processed.
-	 * @return array The hover links.
-	 */
-	function comment_row_action( $actions, $activity ) {
-		$akismet_result = bp_activity_get_meta( $activity['id'], '_bp_akismet_result' );
-		$user_result    = bp_activity_get_meta( $activity['id'], '_bp_akismet_user_result' );
-		$desc           = '';
-
-		if ( !$user_result || $user_result == $akismet_result ) {
-			// Show the original Akismet result if the user hasn't overridden it, or if their decision was the same.
-			if ( 'true' == $akismet_result && $activity['is_spam'] )
-				$desc = __( 'Flagged as spam by Akismet', 'buddypress' );
-
-			elseif ( 'false' == $akismet_result && !$activity['is_spam'] )
-				$desc = __( 'Cleared by Akismet', 'buddypress' );
-
-		} else {
-			$who = bp_activity_get_meta( $activity['id'], '_bp_akismet_user' );
-
-			if ( 'true' == $user_result )
-				$desc = sprintf( __( 'Flagged as spam by %s', 'buddypress' ), $who );
-			else
-				$desc = sprintf( __( 'Un-spammed by %s', 'buddypress' ), $who );
-		}
-
-		// Add a History item to the hover links, just after Edit.
-		if ( $akismet_result ) {
-			$b = array();
-			foreach ( $actions as $k => $item ) {
-				$b[ $k ] = $item;
-				if ( $k == 'edit' )
-					$b['history'] = '<a href="' . esc_url( bp_get_admin_url( 'admin.php?page=bp-activity&amp;action=edit&aid=' . $activity['id'] ) ) . '#bp_activity_history"> '. __( 'History', 'buddypress' ) . '</a>';
-			}
-
-			$actions = $b;
-		}
-
-		if ( $desc )
-			echo '<span class="akismet-status"><a href="' . esc_url( bp_get_admin_url( 'admin.php?page=bp-activity&amp;action=edit&aid=' . $activity['id'] ) ) . '#bp_activity_history">' . htmlspecialchars( $desc ) . '</a></span>';
-
-		/**
-		 * Filters the list of actions for the current activity's row.
-		 *
-		 * @since 1.6.0
-		 *
-		 * @param array $actions Array of available actions for the current activity item's row.
-		 */
-		return apply_filters( 'bp_akismet_comment_row_action', $actions );
-	}
-
-	/**
-	 * Generate nonces for activity forms.
-	 *
-	 * These nonces appear in the member profile status form, as well as in
-	 * the reply form of each activity item. The nonces are, in turn, used
-	 * by Akismet to help detect spam activity.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @see https://plugins.trac.wordpress.org/ticket/1232
-	 */
-	public function add_activity_stream_nonce() {
-		$form_id = '_bp_as_nonce';
-		$value   = '_bp_as_nonce_' . bp_loggedin_user_id();
-
-		// If we're in the activity stream loop, we can use the current item's ID to make the nonce unique.
-		if ( 'bp_activity_entry_comments' == current_filter() ) {
-			$form_id .= '_' . bp_get_activity_id();
-			$value   .= '_' . bp_get_activity_id();
-		}
-
-		wp_nonce_field( $value, $form_id, false );
-	}
-
-	/**
-	 * Clean up the bp_latest_update usermeta in case of spamming.
-	 *
-	 * Run just after an update is posted, this method check to see whether
-	 * the newly created update has been marked as spam by Akismet. If so,
-	 * the cached update is cleared from the user's 'bp_latest_update'
-	 * usermeta, ensuring that it won't appear in the member header and
-	 * elsewhere in the theme.
-	 *
-	 * This can't be done in BP_Akismet::check_activity() due to the
-	 * default AJAX implementation; see bp_dtheme_post_update().
-	 *
-	 * @since 1.6.0
-	 *
-	 * @see bp_dtheme_post_update()
-	 *
-	 * @param string $content     Activity update text.
-	 * @param int    $user_id     User ID.
-	 * @param int    $activity_id Activity ID.
-	 */
-	public function check_member_activity_update( $content, $user_id, $activity_id ) {
-		// By default, only handle activity updates and activity comments.
-		if ( empty( $this->last_activity ) || !in_array( $this->last_activity->type, BP_Akismet::get_activity_types() ) )
-			return;
-
-		// Was this $activity_id just marked as spam? If not, bail out.
-		if ( !$this->last_activity->id || $activity_id != $this->last_activity->id || 'false' == $this->last_activity->akismet_submission['bp_as_result'] )
-			return;
-
-		// It was, so delete the member's latest activity update.
-		bp_delete_user_meta( $user_id, 'bp_latest_update' );
-	}
-
-	/**
-	 * Adds a "mark as spam" button to each activity item for site admins.
-	 *
-	 * This function is intended to be used inside the activity stream loop.
-	 *
-	 * @since 1.6.0
-	 */
-	public function add_activity_spam_button() {
-		if ( !bp_activity_user_can_mark_spam() )
-			return;
-
-		// By default, only handle activity updates and activity comments.
-		if ( !in_array( bp_get_activity_type(), BP_Akismet::get_activity_types() ) )
-			return;
-
-		bp_button(
-			array(
-				'block_self' => false,
-				'component'  => 'activity',
-				'id'         => 'activity_make_spam_' . bp_get_activity_id(),
-				'link_class' => 'bp-secondary-action spam-activity confirm button item-button',
-				'link_href'  => wp_nonce_url( bp_get_root_domain() . '/' . bp_get_activity_slug() . '/spam/' . bp_get_activity_id() . '/', 'bp_activity_akismet_spam_' . bp_get_activity_id() ),
-				'link_text'  => __( 'Spam', 'buddypress' ),
-				'wrapper'    => false,
-			)
-		);
-	}
-
-	/**
-	 * Adds a "mark as spam" button to each activity COMMENT item for site admins.
-	 *
-	 * This function is intended to be used inside the activity stream loop.
-	 *
-	 * @since 1.6.0
-	 */
-	public function add_activity_comment_spam_button() {
-		if ( !bp_activity_user_can_mark_spam() )
-			return;
-
-		// By default, only handle activity updates and activity comments.
-		$current_comment = bp_activity_current_comment();
-		if ( empty( $current_comment ) || !in_array( $current_comment->type, BP_Akismet::get_activity_types() ) )
-			return;
-
-		bp_button(
-			array(
-				'block_self' => false,
-				'component'  => 'activity',
-				'id'         => 'activity_make_spam_' . bp_get_activity_comment_id(),
-				'link_class' => 'bp-secondary-action spam-activity-comment confirm',
-				'link_href'  => wp_nonce_url( bp_get_root_domain() . '/' . bp_get_activity_slug() . '/spam/' . bp_get_activity_comment_id() . '/?cid=' . bp_get_activity_comment_id(), 'bp_activity_akismet_spam_' . bp_get_activity_comment_id() ),
-				'link_text'  => __( 'Spam', 'buddypress' ),
-				'wrapper'    => false,
-			)
-		);
-	}
-
-	/**
-	 * Get a filterable list of activity types that Akismet should automatically check for spam.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @static
-	 *
-	 * @return array $value List of activity types.
-	 */
-	public static function get_activity_types() {
-
-		/**
-		 * Filters the list of activity types that Akismet should automatically check for spam.
-		 *
-		 * @since 1.6.0
-		 *
-		 * @param array $value Array of default activity types for Akismet to check.
-		 */
-		return apply_filters( 'bp_akismet_get_activity_types', array( 'activity_comment', 'activity_update' ) );
-	}
-
-	/**
-	 * Mark activity item as spam.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param BP_Activity_Activity $activity Activity item being spammed.
-	 * @param string               $source   Either "by_a_person" (e.g. a person has
-	 *                                       manually marked the activity as spam) or
-	 *                                       "by_akismet" (automatically spammed).
-	 */
-	public function mark_as_spam( $activity, $source ) {
-		// Record this item so we can do some tidyup in BP_Akismet::check_member_activity_update().
-		$this->last_activity = $activity;
-
-		/**
-		 * Fires after marking an activity item has been marked as spam.
-		 *
-		 * @since 1.6.0
-		 *
-		 * @param BP_Activity_Activity $activity Activity object being marked as spam.
-		 * @param string               $source   Source of the whom marked as spam.
-		 *                                       Either "by_a_person" (e.g. a person has
-		 *                                       manually marked the activity as spam)
-		 *                                       or "by_akismet".
-		 */
-		do_action( 'bp_activity_akismet_mark_as_spam', $activity, $source );
-	}
-
-	/**
-	 * Mark activity item as ham.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param BP_Activity_Activity $activity Activity item being hammed.
-	 * @param string               $source   Either "by_a_person" (e.g. a person has
-	 *                                       manually marked the activity as ham) or
-	 *                                       "by_akismet" (automatically hammed).
-	 */
-	public function mark_as_ham( $activity, $source ) {
-		// If the activity was, originally, automatically marked as spam by Akismet, run the @mentions filter as it would have been skipped.
-		if ( 'true' == bp_activity_get_meta( $activity->id, '_bp_akismet_result' ) && !bp_activity_get_meta( $activity->id, '_bp_akismet_user_result' ) )
-			$activity->content = bp_activity_at_name_filter( $activity->content, $activity->id );
-
-		/**
-		 * Fires after marking an activity item has been marked as ham.
-		 *
-		 * @since 1.6.0
-		 *
-		 * @param BP_Activity_Activity $activity Activity object being marked as ham.
-		 * @param string               $source   Source of the whom marked as ham.
-		 *                                       Either "by_a_person" (e.g. a person has
-		 *                                       manually marked the activity as ham) or
-		 *                                       "by_akismet" (automatically hammed).
-		 */
-		do_action( 'bp_activity_akismet_mark_as_ham', $activity, $source );
-	}
-
-	/**
-	 * Build a data package for the Akismet service to inspect.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @see http://akismet.com/development/api/#comment-check
-	 * @static
-	 *
-	 * @param BP_Activity_Activity $activity Activity item data.
-	 * @return array $activity_data
-	 */
-	public static function build_akismet_data_package( $activity ) {
-		$userdata = get_userdata( $activity->user_id );
-
-		$activity_data                          = array();
-		$activity_data['akismet_comment_nonce'] = 'inactive';
-		$activity_data['comment_author']        = $userdata->display_name;
-		$activity_data['comment_author_email']  = $userdata->user_email;
-		$activity_data['comment_author_url']    = bp_core_get_userlink( $userdata->ID, false, true);
-		$activity_data['comment_content']       = $activity->content;
-		$activity_data['comment_type']          = $activity->type;
-		$activity_data['permalink']             = bp_activity_get_permalink( $activity->id, $activity );
-		$activity_data['user_ID']               = $userdata->ID;
-		$activity_data['user_role']             = Akismet::get_user_roles( $userdata->ID );
-
-		/**
-		 * Get the nonce if the new activity was submitted through the "what's up, Paul?" form.
-		 * This helps Akismet ensure that the update was a valid form submission.
-		 */
-		if ( !empty( $_POST['_bp_as_nonce'] ) )
-			$activity_data['akismet_comment_nonce'] = wp_verify_nonce( $_POST['_bp_as_nonce'], "_bp_as_nonce_{$userdata->ID}" ) ? 'passed' : 'failed';
-
-		/**
-		 * If the new activity was a reply to an existing item, check the nonce with the activity parent ID.
-		 * This helps Akismet ensure that the update was a valid form submission.
-		 */
-		elseif ( !empty( $activity->secondary_item_id ) && !empty( $_POST['_bp_as_nonce_' . $activity->secondary_item_id] ) )
-			$activity_data['akismet_comment_nonce'] = wp_verify_nonce( $_POST["_bp_as_nonce_{$activity->secondary_item_id}"], "_bp_as_nonce_{$userdata->ID}_{$activity->secondary_item_id}" ) ? 'passed' : 'failed';
-
-		/**
-		 * Filters activity data before being sent to Akismet to inspect.
-		 *
-		 * @since 1.6.0
-		 *
-		 * @param array                $activity_data Array of activity data for Akismet to inspect.
-		 * @param BP_Activity_Activity $activity      Activity item data.
-		 */
-		return apply_filters( 'bp_akismet_build_akismet_data_package', $activity_data, $activity );
-	}
-
-	/**
-	 * Check if the activity item is spam or ham.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @see http://akismet.com/development/api/
-	 * @todo Spam counter?
-	 * @todo Auto-delete old spam?
-	 *
-	 * @param BP_Activity_Activity $activity The activity item to check.
-	 */
-	public function check_activity( $activity ) {
-		// By default, only handle activity updates and activity comments.
-		if ( !in_array( $activity->type, BP_Akismet::get_activity_types() ) )
-			return;
-
-		// Make sure last_activity is clear to avoid any confusion.
-		$this->last_activity = null;
-
-		// Build data package for Akismet.
-		$activity_data = BP_Akismet::build_akismet_data_package( $activity );
-
-		// Check with Akismet to see if this is spam.
-		$activity_data = $this->send_akismet_request( $activity_data, 'check', 'spam' );
-
-		// Record this item.
-		$this->last_activity = $activity;
-
-		// Store a copy of the data that was submitted to Akismet.
-		$this->last_activity->akismet_submission = $activity_data;
-
-		// Spam.
-		if ( 'true' == $activity_data['bp_as_result'] ) {
-			/**
-			 * Fires after an activity item has been proven to be spam, but before officially being marked as spam.
-			 *
-			 * @since 1.6.0
-			 *
-			 * @param BP_Activity_Activity $activity      The activity item proven to be spam.
-			 * @param array                $activity_data Array of activity data for item including
-			 *                                            Akismet check results data.
-			 */
-			do_action_ref_array( 'bp_activity_akismet_spam_caught', array( &$activity, $activity_data ) );
-
-			// Mark as spam.
-			bp_activity_mark_as_spam( $activity, 'by_akismet' );
-		}
-
-		// Update activity meta after a spam check.
-		add_action( 'bp_activity_after_save', array( $this, 'update_activity_akismet_meta' ), 1, 1 );
-	}
-
-	/**
-	 * Update activity meta after a manual spam change (user-initiated).
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param BP_Activity_Activity $activity The activity to check.
-	 */
-	public function update_activity_spam_meta( $activity ) {
-		// By default, only handle activity updates and activity comments.
-		if ( !in_array( $activity->type, BP_Akismet::get_activity_types() ) )
-			return;
-
-		$this->update_activity_history( $activity->id, sprintf( __( '%s reported this activity as spam', 'buddypress' ), bp_get_loggedin_user_username() ), 'report-spam' );
-		bp_activity_update_meta( $activity->id, '_bp_akismet_user_result', 'true' );
-		bp_activity_update_meta( $activity->id, '_bp_akismet_user', bp_get_loggedin_user_username() );
-	}
-
-	/**
-	 * Update activity meta after a manual ham change (user-initiated).
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param BP_Activity_Activity $activity The activity to check.
-	 */
-	public function update_activity_ham_meta( $activity ) {
-		// By default, only handle activity updates and activity comments.
-		if ( !in_array( $activity->type, BP_Akismet::get_activity_types() ) )
-			return;
-
-		$this->update_activity_history( $activity->id, sprintf( __( '%s reported this activity as not spam', 'buddypress' ), bp_get_loggedin_user_username() ), 'report-ham' );
-		bp_activity_update_meta( $activity->id, '_bp_akismet_user_result', 'false' );
-		bp_activity_update_meta( $activity->id, '_bp_akismet_user', bp_get_loggedin_user_username() );
-	}
-
-	/**
-	 * Update activity meta after an automatic spam check (not user-initiated).
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param BP_Activity_Activity $activity The activity to check.
-	 */
-	public function update_activity_akismet_meta( $activity ) {
-		// Check we're dealing with what was last updated by Akismet.
-		if ( empty( $this->last_activity ) || !empty( $this->last_activity ) && $activity->id != $this->last_activity->id )
-			return;
-
-		// By default, only handle activity updates and activity comments.
-		if ( !in_array( $this->last_activity->type, BP_Akismet::get_activity_types() ) )
-			return;
-
-		// Spam.
-		if ( 'true' == $this->last_activity->akismet_submission['bp_as_result'] ) {
-			bp_activity_update_meta( $activity->id, '_bp_akismet_result', 'true' );
-			$this->update_activity_history( $activity->id, __( 'Akismet caught this item as spam', 'buddypress' ), 'check-spam' );
-
-		// Not spam.
-		} elseif ( 'false' == $this->last_activity->akismet_submission['bp_as_result'] ) {
-			bp_activity_update_meta( $activity->id, '_bp_akismet_result', 'false' );
-			$this->update_activity_history( $activity->id, __( 'Akismet cleared this item', 'buddypress' ), 'check-ham' );
-
-		// Uh oh, something's gone horribly wrong. Unexpected result.
-		} else {
-			bp_activity_update_meta( $activity->id, '_bp_akismet_error', bp_core_current_time() );
-			$this->update_activity_history( $activity->id, sprintf( __( 'Akismet was unable to check this item (response: %s), will automatically retry again later.', 'buddypress' ), $this->last_activity->akismet_submission['bp_as_result'] ), 'check-error' );
-		}
-
-		// Record the original data which was submitted to Akismet for checking.
-		bp_activity_update_meta( $activity->id, '_bp_akismet_submission', $this->last_activity->akismet_submission );
-	}
-
-	/**
-	 * Contact Akismet to check if this is spam or ham.
-	 *
-	 * Props to WordPress core Akismet plugin for a lot of this.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param array  $activity_data Packet of information to submit to Akismet.
-	 * @param string $check         "check" or "submit".
-	 * @param string $spam          "spam" or "ham".
-	 * @return array $activity_data Activity data, with Akismet data added.
-	 */
-	public function send_akismet_request( $activity_data, $check = 'check', $spam = 'spam' ) {
-		$query_string = $path = '';
-
-		$activity_data['blog']         = bp_get_option( 'home' );
-		$activity_data['blog_charset'] = bp_get_option( 'blog_charset' );
-		$activity_data['blog_lang']    = get_locale();
-		$activity_data['referrer']     = $_SERVER['HTTP_REFERER'];
-		$activity_data['user_agent']   = bp_core_current_user_ua();
-		$activity_data['user_ip']      = bp_core_current_user_ip();
-
-		if ( Akismet::is_test_mode() )
-			$activity_data['is_test'] = 'true';
-
-		// Loop through _POST args and rekey strings.
-		foreach ( $_POST as $key => $value )
-			if ( is_string( $value ) && 'cookie' != $key )
-				$activity_data['POST_' . $key] = $value;
-
-		// Keys to ignore.
-		$ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' );
-
-		// Loop through _SERVER args and remove whitelisted keys.
-		foreach ( $_SERVER as $key => $value ) {
-
-			// Key should not be ignored.
-			if ( !in_array( $key, $ignore ) && is_string( $value ) ) {
-				$activity_data[$key] = $value;
-
-			// Key should be ignored.
-			} else {
-				$activity_data[$key] = '';
-			}
-		}
-
-		foreach ( $activity_data as $key => $data )
-			$query_string .= $key . '=' . urlencode( stripslashes( $data ) ) . '&';
-
-		if ( 'check' == $check )
-			$path = 'comment-check';
-		elseif ( 'submit' == $check )
-			$path = 'submit-' . $spam;
-
-		// Send to Akismet.
-		add_filter( 'akismet_ua', array( $this, 'buddypress_ua' ) );
-		$response = Akismet::http_post( $query_string, $path );
-		remove_filter( 'akismet_ua', array( $this, 'buddypress_ua' ) );
-
-		// Get the response.
-		if ( ! empty( $response[1] ) && ! is_wp_error( $response[1] ) )
-			$activity_data['bp_as_result'] = $response[1];
-		else
-			$activity_data['bp_as_result'] = false;
-
-		// Perform a daily tidy up.
-		if ( ! wp_next_scheduled( 'bp_activity_akismet_delete_old_metadata' ) )
-			wp_schedule_event( time(), 'daily', 'bp_activity_akismet_delete_old_metadata' );
-
-		return $activity_data;
-	}
-
-	/**
-	 * Filters user agent when sending to Akismet to add BuddyPress info.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param string $user_agent User agent string, as generated by Akismet.
-	 * @return string $user_agent Modified user agent string.
-	 */
-	public function buddypress_ua( $user_agent ) {
-		$user_agent = 'BuddyPress/' . bp_get_version() . ' | Akismet/'. constant( 'AKISMET_VERSION' );
-		return $user_agent;
-	}
-
-	/**
-	 * Adds a "History" meta box to the activity edit screen.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param string $screen_action The type of screen that has been requested.
-	 */
-	function add_history_metabox( $screen_action ) {
-		// Only proceed if we're on the edit screen.
-		if ( 'edit' != $screen_action )
-			return;
-
-		// Display meta box with a low priority (low position on screen by default).
-		add_meta_box( 'bp_activity_history',  __( 'Activity History', 'buddypress' ), array( $this, 'history_metabox' ), get_current_screen()->id, 'normal', 'low' );
-	}
-
-	/**
-	 * History meta box for the Activity admin edit screen.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @see https://buddypress.trac.wordpress.org/ticket/3907
-	 * @todo Update activity meta to allow >1 record with the same key (iterate through $history).
-	 *
-	 * @param object $item Activity item.
-	 */
-	function history_metabox( $item ) {
-		$history = BP_Akismet::get_activity_history( $item->id );
-
-		if ( empty( $history ) )
-			return;
-
-		echo '<div class="akismet-history"><div>';
-		printf( _x( '%1$s &mdash; %2$s', 'x hours ago - akismet cleared this item', 'buddypress' ), '<span>' . bp_core_time_since( $history[2] ) . '</span>', esc_html( $history[1] ) );
-		echo '</div></div>';
-	}
-
-	/**
-	 * Update an activity item's Akismet history.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param int    $activity_id Activity item ID.
-	 * @param string $message     Human-readable description of what's changed.
-	 * @param string $event       The type of check we were carrying out.
-	 */
-	public function update_activity_history( $activity_id = 0, $message = '', $event = '' ) {
-		$event = array(
-			'event'   => $event,
-			'message' => $message,
-			'time'    => Akismet::_get_microtime(),
-			'user'    => bp_loggedin_user_id(),
-		);
-
-		// Save the history data.
-		bp_activity_update_meta( $activity_id, '_bp_akismet_history', $event );
-	}
-
-	/**
-	 * Get an activity item's Akismet history.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param int $activity_id Activity item ID.
-	 * @return array The activity item's Akismet history.
-	 */
-	public function get_activity_history( $activity_id = 0 ) {
-		$history = bp_activity_get_meta( $activity_id, '_bp_akismet_history' );
-		if ( $history === false )
-			$history = array();
-
-		// Sort it by the time recorded.
-		usort( $history, 'akismet_cmp_time' );
-
-		return $history;
-	}
-}
-
 /**
  * Delete old spam activity meta data.
  *
Index: src/bp-activity/bp-activity-loader.php
===================================================================
--- src/bp-activity/bp-activity-loader.php	(revision 10496)
+++ src/bp-activity/bp-activity-loader.php	(working copy)
@@ -12,381 +12,8 @@
 // Exit if accessed directly.
 defined( 'ABSPATH' ) || exit;
 
-/**
- * Main Activity Class.
- *
- * @since 1.5.0
- */
-class BP_Activity_Component extends BP_Component {
+require dirname( __FILE__ ) . '/classes/class-bp-activity-loader.php';
 
-	/**
-	 * Start the activity component setup process.
-	 *
-	 * @since 1.5.0
-	 */
-	public function __construct() {
-		parent::start(
-			'activity',
-			__( 'Activity Streams', 'buddypress' ),
-			buddypress()->plugin_dir,
-			array(
-				'adminbar_myaccount_order' => 10,
-				'search_query_arg' => 'activity_search',
-			)
-		);
-	}
-
-	/**
-	 * Include component files.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @see BP_Component::includes() for a description of arguments.
-	 *
-	 * @param array $includes See BP_Component::includes() for a description.
-	 */
-	public function includes( $includes = array() ) {
-
-		// Files to include.
-		$includes = array(
-			'cssjs',
-			'actions',
-			'screens',
-			'filters',
-			'classes',
-			'template',
-			'functions',
-			'notifications',
-			'cache'
-		);
-
-		// Load Akismet support if Akismet is configured.
-		$akismet_key = bp_get_option( 'wordpress_api_key' );
-
-		/** This filter is documented in bp-activity/bp-activity-actions.php */
-		if ( defined( 'AKISMET_VERSION' ) && class_exists( 'Akismet' ) && ( ! empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) && apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) {
-			$includes[] = 'akismet';
-		}
-
-		if ( is_admin() ) {
-			$includes[] = 'admin';
-		}
-
-		parent::includes( $includes );
-	}
-
-	/**
-	 * Set up component global variables.
-	 *
-	 * The BP_ACTIVITY_SLUG constant is deprecated, and only used here for
-	 * backwards compatibility.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @see BP_Component::setup_globals() for a description of arguments.
-	 *
-	 * @param array $args See BP_Component::setup_globals() for a description.
-	 */
-	public function setup_globals( $args = array() ) {
-		$bp = buddypress();
-
-		// Define a slug, if necessary.
-		if ( ! defined( 'BP_ACTIVITY_SLUG' ) ) {
-			define( 'BP_ACTIVITY_SLUG', $this->id );
-		}
-
-		// Global tables for activity component.
-		$global_tables = array(
-			'table_name'      => $bp->table_prefix . 'bp_activity',
-			'table_name_meta' => $bp->table_prefix . 'bp_activity_meta',
-		);
-
-		// Metadata tables for groups component.
-		$meta_tables = array(
-			'activity' => $bp->table_prefix . 'bp_activity_meta',
-		);
-
-		// All globals for activity component.
-		// Note that global_tables is included in this array.
-		$args = array(
-			'slug'                  => BP_ACTIVITY_SLUG,
-			'root_slug'             => isset( $bp->pages->activity->slug ) ? $bp->pages->activity->slug : BP_ACTIVITY_SLUG,
-			'has_directory'         => true,
-			'directory_title'       => _x( 'Site-Wide Activity', 'component directory title', 'buddypress' ),
-			'notification_callback' => 'bp_activity_format_notifications',
-			'search_string'         => __( 'Search Activity...', 'buddypress' ),
-			'global_tables'         => $global_tables,
-			'meta_tables'           => $meta_tables,
-		);
-
-		parent::setup_globals( $args );
-	}
-
-	/**
-	 * Set up component navigation.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @see BP_Component::setup_nav() for a description of arguments.
-	 * @uses bp_is_active()
-	 * @uses is_user_logged_in()
-	 * @uses bp_get_friends_slug()
-	 * @uses bp_get_groups_slug()
-	 *
-	 * @param array $main_nav Optional. See BP_Component::setup_nav() for description.
-	 * @param array $sub_nav  Optional. See BP_Component::setup_nav() for description.
-	 */
-	public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
-
-		// Stop if there is no user displayed or logged in.
-		if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) {
-			return;
-		}
-
-		// Determine user to use.
-		if ( bp_displayed_user_domain() ) {
-			$user_domain = bp_displayed_user_domain();
-		} elseif ( bp_loggedin_user_domain() ) {
-			$user_domain = bp_loggedin_user_domain();
-		} else {
-			return;
-		}
-
-		$slug          = bp_get_activity_slug();
-		$activity_link = trailingslashit( $user_domain . $slug );
-
-		// Add 'Activity' to the main navigation.
-		$main_nav = array(
-			'name'                => _x( 'Activity', 'Profile activity screen nav', 'buddypress' ),
-			'slug'                => $slug,
-			'position'            => 10,
-			'screen_function'     => 'bp_activity_screen_my_activity',
-			'default_subnav_slug' => 'just-me',
-			'item_css_id'         => $this->id
-		);
-
-		// Add the subnav items to the activity nav item if we are using a theme that supports this.
-		$sub_nav[] = array(
-			'name'            => _x( 'Personal', 'Profile activity screen sub nav', 'buddypress' ),
-			'slug'            => 'just-me',
-			'parent_url'      => $activity_link,
-			'parent_slug'     => $slug,
-			'screen_function' => 'bp_activity_screen_my_activity',
-			'position'        => 10
-		);
-
-		// Check @mentions.
-		if ( bp_activity_do_mentions() ) {
-			$sub_nav[] = array(
-				'name'            => _x( 'Mentions', 'Profile activity screen sub nav', 'buddypress' ),
-				'slug'            => 'mentions',
-				'parent_url'      => $activity_link,
-				'parent_slug'     => $slug,
-				'screen_function' => 'bp_activity_screen_mentions',
-				'position'        => 20,
-				'item_css_id'     => 'activity-mentions'
-			);
-		}
-
-		// Favorite activity items.
-		if ( bp_activity_can_favorite() ) {
-			$sub_nav[] = array(
-				'name'            => _x( 'Favorites', 'Profile activity screen sub nav', 'buddypress' ),
-				'slug'            => 'favorites',
-				'parent_url'      => $activity_link,
-				'parent_slug'     => $slug,
-				'screen_function' => 'bp_activity_screen_favorites',
-				'position'        => 30,
-				'item_css_id'     => 'activity-favs'
-			);
-		}
-
-		// Additional menu if friends is active.
-		if ( bp_is_active( 'friends' ) ) {
-			$sub_nav[] = array(
-				'name'            => _x( 'Friends', 'Profile activity screen sub nav', 'buddypress' ),
-				'slug'            => bp_get_friends_slug(),
-				'parent_url'      => $activity_link,
-				'parent_slug'     => $slug,
-				'screen_function' => 'bp_activity_screen_friends',
-				'position'        => 40,
-				'item_css_id'     => 'activity-friends'
-			) ;
-		}
-
-		// Additional menu if groups is active.
-		if ( bp_is_active( 'groups' ) ) {
-			$sub_nav[] = array(
-				'name'            => _x( 'Groups', 'Profile activity screen sub nav', 'buddypress' ),
-				'slug'            => bp_get_groups_slug(),
-				'parent_url'      => $activity_link,
-				'parent_slug'     => $slug,
-				'screen_function' => 'bp_activity_screen_groups',
-				'position'        => 50,
-				'item_css_id'     => 'activity-groups'
-			);
-		}
-
-		parent::setup_nav( $main_nav, $sub_nav );
-	}
-
-	/**
-	 * Set up the component entries in the WordPress Admin Bar.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @see BP_Component::setup_nav() for a description of the $wp_admin_nav
-	 *      parameter array.
-	 * @uses is_user_logged_in()
-	 * @uses trailingslashit()
-	 * @uses bp_get_total_mention_count_for_user()
-	 * @uses bp_loggedin_user_id()
-	 * @uses bp_is_active()
-	 * @uses bp_get_friends_slug()
-	 * @uses bp_get_groups_slug()
-	 *
-	 * @param array $wp_admin_nav See BP_Component::setup_admin_bar() for a
-	 *                            description.
-	 */
-	public function setup_admin_bar( $wp_admin_nav = array() ) {
-
-		// Menus for logged in user.
-		if ( is_user_logged_in() ) {
-
-			// Setup the logged in user variables.
-			$activity_link = trailingslashit( bp_loggedin_user_domain() . bp_get_activity_slug() );
-
-			// Unread message count.
-			if ( bp_activity_do_mentions() ) {
-				$count = bp_get_total_mention_count_for_user( bp_loggedin_user_id() );
-				if ( !empty( $count ) ) {
-					$title = sprintf( _x( 'Mentions <span class="count">%s</span>', 'Toolbar Mention logged in user', 'buddypress' ), bp_core_number_format( $count ) );
-				} else {
-					$title = _x( 'Mentions', 'Toolbar Mention logged in user', 'buddypress' );
-				}
-			}
-
-			// Add the "Activity" sub menu.
-			$wp_admin_nav[] = array(
-				'parent' => buddypress()->my_account_menu_id,
-				'id'     => 'my-account-' . $this->id,
-				'title'  => _x( 'Activity', 'My Account Activity sub nav', 'buddypress' ),
-				'href'   => $activity_link
-			);
-
-			// Personal.
-			$wp_admin_nav[] = array(
-				'parent' => 'my-account-' . $this->id,
-				'id'     => 'my-account-' . $this->id . '-personal',
-				'title'  => _x( 'Personal', 'My Account Activity sub nav', 'buddypress' ),
-				'href'   => $activity_link
-			);
-
-			// Mentions.
-			if ( bp_activity_do_mentions() ) {
-				$wp_admin_nav[] = array(
-					'parent' => 'my-account-' . $this->id,
-					'id'     => 'my-account-' . $this->id . '-mentions',
-					'title'  => $title,
-					'href'   => trailingslashit( $activity_link . 'mentions' )
-				);
-			}
-
-			// Favorite activity items.
-			if ( bp_activity_can_favorite() ) {
-				$wp_admin_nav[] = array(
-					'parent' => 'my-account-' . $this->id,
-					'id'     => 'my-account-' . $this->id . '-favorites',
-					'title'  => _x( 'Favorites', 'My Account Activity sub nav', 'buddypress' ),
-					'href'   => trailingslashit( $activity_link . 'favorites' )
-				);
-			}
-
-			// Friends?
-			if ( bp_is_active( 'friends' ) ) {
-				$wp_admin_nav[] = array(
-					'parent' => 'my-account-' . $this->id,
-					'id'     => 'my-account-' . $this->id . '-friends',
-					'title'  => _x( 'Friends', 'My Account Activity sub nav', 'buddypress' ),
-					'href'   => trailingslashit( $activity_link . bp_get_friends_slug() )
-				);
-			}
-
-			// Groups?
-			if ( bp_is_active( 'groups' ) ) {
-				$wp_admin_nav[] = array(
-					'parent' => 'my-account-' . $this->id,
-					'id'     => 'my-account-' . $this->id . '-groups',
-					'title'  => _x( 'Groups', 'My Account Activity sub nav', 'buddypress' ),
-					'href'   => trailingslashit( $activity_link . bp_get_groups_slug() )
-				);
-			}
-		}
-
-		parent::setup_admin_bar( $wp_admin_nav );
-	}
-
-	/**
-	 * Set up the title for pages and <title>.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @uses bp_is_activity_component()
-	 * @uses bp_is_my_profile()
-	 * @uses bp_core_fetch_avatar()
-	 */
-	public function setup_title() {
-
-		// Adjust title based on view.
-		if ( bp_is_activity_component() ) {
-			$bp = buddypress();
-
-			if ( bp_is_my_profile() ) {
-				$bp->bp_options_title = _x( 'My Activity', 'Page and <title>', 'buddypress' );
-			} else {
-				$bp->bp_options_avatar = bp_core_fetch_avatar( array(
-					'item_id' => bp_displayed_user_id(),
-					'type'    => 'thumb',
-					'alt'	  => sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_get_displayed_user_fullname() )
-				) );
-				$bp->bp_options_title  = bp_get_displayed_user_fullname();
-			}
-		}
-
-		parent::setup_title();
-	}
-
-	/**
-	 * Set up actions necessary for the component.
-	 *
-	 * @since 1.6.0
-	 */
-	public function setup_actions() {
-
-		// Spam prevention.
-		add_action( 'bp_include', 'bp_activity_setup_akismet' );
-
-		parent::setup_actions();
-	}
-
-	/**
-	 * Setup cache groups.
-	 *
-	 * @since 2.2.0
-	 */
-	public function setup_cache_groups() {
-
-		// Global groups.
-		wp_cache_add_global_groups( array(
-			'bp_activity',
-			'bp_activity_comments',
-			'activity_meta'
-		) );
-
-		parent::setup_cache_groups();
-	}
-}
-
 /**
  * Bootstrap the Activity component.
  *
Index: src/bp-activity/bp-activity-screens.php
===================================================================
--- src/bp-activity/bp-activity-screens.php	(revision 10496)
+++ src/bp-activity/bp-activity-screens.php	(working copy)
@@ -14,6 +14,8 @@
 // Exit if accessed directly.
 defined( 'ABSPATH' ) || exit;
 
+require dirname( __FILE__ ) . '/classes/class-bp-activity-theme-compat.php';
+
 /**
  * Load the Activity directory.
  *
@@ -416,173 +418,4 @@
 
 /** Theme Compatibility *******************************************************/
 
-/**
- * The main theme compat class for BuddyPress Activity.
- *
- * This class sets up the necessary theme compatibility actions to safely output
- * activity template parts to the_title and the_content areas of a theme.
- *
- * @since 1.7.0
- */
-class BP_Activity_Theme_Compat {
-
-	/**
-	 * Set up the activity component theme compatibility.
-	 *
-	 * @since 1.7.0
-	 */
-	public function __construct() {
-		add_action( 'bp_setup_theme_compat', array( $this, 'is_activity' ) );
-	}
-
-	/**
-	 * Set up the theme compatibility hooks, if we're looking at an activity page.
-	 *
-	 * @since 1.7.0
-	 */
-	public function is_activity() {
-
-		// Bail if not looking at a group.
-		if ( ! bp_is_activity_component() )
-			return;
-
-		// Activity Directory.
-		if ( ! bp_displayed_user_id() && ! bp_current_action() ) {
-			bp_update_is_directory( true, 'activity' );
-
-			/** This action is documented in bp-activity/bp-activity-screens.php */
-			do_action( 'bp_activity_screen_index' );
-
-			add_filter( 'bp_get_buddypress_template',                array( $this, 'directory_template_hierarchy' ) );
-			add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'directory_dummy_post' ) );
-			add_filter( 'bp_replace_the_content',                    array( $this, 'directory_content'    ) );
-
-		// Single activity.
-		} elseif ( bp_is_single_activity() ) {
-			add_filter( 'bp_get_buddypress_template',                array( $this, 'single_template_hierarchy' ) );
-			add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'single_dummy_post' ) );
-			add_filter( 'bp_replace_the_content',                    array( $this, 'single_dummy_content'    ) );
-		}
-	}
-
-	/** Directory *************************************************************/
-
-	/**
-	 * Add template hierarchy to theme compat for the activity directory page.
-	 *
-	 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
-	 *
-	 * @since 1.8.0
-	 *
-	 * @param string $templates The templates from bp_get_theme_compat_templates().
-	 * @return array $templates Array of custom templates to look for.
-	 */
-	public function directory_template_hierarchy( $templates ) {
-
-		/**
-		 * Filters the template hierarchy for the activity directory page.
-		 *
-		 * @since 1.8.0
-		 *
-		 * @param array $index-directory Array holding template names to be merged into template list.
-		 */
-		$new_templates = apply_filters( 'bp_template_hierarchy_activity_directory', array(
-			'activity/index-directory.php'
-		) );
-
-		// Merge new templates with existing stack
-		// @see bp_get_theme_compat_templates().
-		$templates = array_merge( (array) $new_templates, $templates );
-
-		return $templates;
-	}
-
-	/**
-	 * Update the global $post with directory data.
-	 *
-	 * @since 1.7.0
-	 */
-	public function directory_dummy_post() {
-		bp_theme_compat_reset_post( array(
-			'ID'             => 0,
-			'post_title'     => bp_get_directory_title( 'activity' ),
-			'post_author'    => 0,
-			'post_date'      => 0,
-			'post_content'   => '',
-			'post_type'      => 'page',
-			'post_status'    => 'publish',
-			'is_page'        => true,
-			'comment_status' => 'closed'
-		) );
-	}
-
-	/**
-	 * Filter the_content with the groups index template part.
-	 *
-	 * @since 1.7.0
-	 */
-	public function directory_content() {
-		return bp_buffer_template_part( 'activity/index', null, false );
-	}
-
-	/** Single ****************************************************************/
-
-	/**
-	 * Add custom template hierarchy to theme compat for activity permalink pages.
-	 *
-	 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
-	 *
-	 * @since 1.8.0
-	 *
-	 * @param string $templates The templates from bp_get_theme_compat_templates().
-	 * @return array $templates Array of custom templates to look for.
-	 */
-	public function single_template_hierarchy( $templates ) {
-
-		/**
-		 * Filters the template hierarchy for the activity permalink pages.
-		 *
-		 * @since 1.8.0
-		 *
-		 * @param array $index Array holding template names to be merged into template list.
-		 */
-		$new_templates = apply_filters( 'bp_template_hierarchy_activity_single_item', array(
-			'activity/single/index.php'
-		) );
-
-		// Merge new templates with existing stack
-		// @see bp_get_theme_compat_templates().
-		$templates = array_merge( (array) $new_templates, $templates );
-
-		return $templates;
-	}
-
-	/**
-	 * Update the global $post with the displayed user's data.
-	 *
-	 * @since 1.7.0
-	 */
-	public function single_dummy_post() {
-		bp_theme_compat_reset_post( array(
-			'ID'             => 0,
-			'post_title'     => __( 'Activity', 'buddypress' ),
-			'post_author'    => 0,
-			'post_date'      => 0,
-			'post_content'   => '',
-			'post_type'      => 'page',
-			'post_status'    => 'publish',
-			'is_page'        => true,
-			'comment_status' => 'closed'
-		) );
-	}
-
-	/**
-	 * Filter the_content with the members' activity permalink template part.
-	 *
-	 * @since 1.7.0
-	 */
-	public function single_dummy_content() {
-		return bp_buffer_template_part( 'activity/single/home', null, false );
-	}
-}
 new BP_Activity_Theme_Compat();
Index: src/bp-activity/bp-activity-template.php
===================================================================
--- src/bp-activity/bp-activity-template.php	(revision 10496)
+++ src/bp-activity/bp-activity-template.php	(working copy)
@@ -10,6 +10,8 @@
 // Exit if accessed directly.
 defined( 'ABSPATH' ) || exit;
 
+require dirname( __FILE__ ) . '/classes/class-bp-activity-template.php';
+
 /**
  * Output the activity component slug.
  *
@@ -107,404 +109,6 @@
 	}
 
 /**
- * The main activity template loop class.
- *
- * This is responsible for loading a group of activity items and displaying them.
- *
- * @since 1.0.0
- */
-class BP_Activity_Template {
-
-	/**
-	 * The loop iterator.
-	 *
-	 * @since 1.0.0
-	 * @var int
-	 */
-	public $current_activity = -1;
-
-	/**
-	 * The activity count.
-	 *
-	 * @since 1.0.0
-	 * @var int
-	 */
-	public $activity_count;
-
-	/**
-	 * The total activity count.
-	 *
-	 * @since 1.0.0
-	 * @var int
-	 */
-	public $total_activity_count;
-
-	/**
-	 * Array of activities located by the query.
-	 *
-	 * @since 1.0.0
-	 * @var array
-	 */
-	public $activities;
-
-	/**
-	 * The activity object currently being iterated on.
-	 *
-	 * @since 1.0.0
-	 * @var object
-	 */
-	public $activity;
-
-	/**
-	 * A flag for whether the loop is currently being iterated.
-	 *
-	 * @since 1.0.0
-	 * @var bool
-	 */
-	public $in_the_loop;
-
-	/**
-	 * URL parameter key for activity pagination. Default: 'acpage'.
-	 *
-	 * @since 2.1.0
-	 * @var string
-	 */
-	public $pag_arg;
-
-	/**
-	 * The page number being requested.
-	 *
-	 * @since 1.0.0
-	 * @var int
-	 */
-	public $pag_page;
-
-	/**
-	 * The number of items being requested per page.
-	 *
-	 * @since 1.0.0
-	 * @var int
-	 */
-	public $pag_num;
-
-	/**
-	 * An HTML string containing pagination links.
-	 *
-	 * @since 1.0.0
-	 * @var string
-	 */
-	public $pag_links;
-
-	/**
-	 * The displayed user's full name.
-	 *
-	 * @since 1.0.0
-	 * @var string
-	 */
-	public $full_name;
-
-	/**
-	 * Constructor method.
-	 *
-	 * The arguments passed to this class constructor are of the same
-	 * format as {@link BP_Activity_Activity::get()}.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @see BP_Activity_Activity::get() for a description of the argument
-	 *      structure, as well as default values.
-	 *
-	 * @param array $args {
-	 *     Array of arguments. Supports all arguments from
-	 *     BP_Activity_Activity::get(), as well as 'page_arg' and
-	 *     'include'. Default values for 'per_page' and 'display_comments'
-	 *     differ from the originating function, and are described below.
-	 *     @type string      $page_arg         The string used as a query parameter in
-	 *                                         pagination links. Default: 'acpage'.
-	 *     @type array|bool  $include          Pass an array of activity IDs to
-	 *                                         retrieve only those items, or false to noop the 'include'
-	 *                                         parameter. 'include' differs from 'in' in that 'in' forms
-	 *                                         an IN clause that works in conjunction with other filters
-	 *                                         passed to the function, while 'include' is interpreted as
-	 *                                         an exact list of items to retrieve, which skips all other
-	 *                                         filter-related parameters. Default: false.
-	 *     @type int|bool    $per_page         Default: 20.
-	 *     @type string|bool $display_comments Default: 'threaded'.
-	 * }
-	 */
-	public function __construct( $args ) {
-		$bp = buddypress();
-
-		// Backward compatibility with old method of passing arguments.
-		if ( !is_array( $args ) || func_num_args() > 1 ) {
-			_deprecated_argument( __METHOD__, '1.6', sprintf( __( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
-
-			$old_args_keys = array(
-				0 => 'page',
-				1 => 'per_page',
-				2 => 'max',
-				3 => 'include',
-				4 => 'sort',
-				5 => 'filter',
-				6 => 'search_terms',
-				7 => 'display_comments',
-				8 => 'show_hidden',
-				9 => 'exclude',
-				10 => 'in',
-				11 => 'spam',
-				12 => 'page_arg'
-			);
-
-			$func_args = func_get_args();
-			$args = bp_core_parse_args_array( $old_args_keys, $func_args );
-		}
-
-		$defaults = array(
-			'page'              => 1,
-			'per_page'          => 20,
-			'page_arg'          => 'acpage',
-			'max'               => false,
-			'fields'            => 'all',
-			'count_total'       => false,
-			'sort'              => false,
-			'include'           => false,
-			'exclude'           => false,
-			'in'                => false,
-			'filter'            => false,
-			'scope'             => false,
-			'search_terms'      => false,
-			'meta_query'        => false,
-			'date_query'        => false,
-			'filter_query'      => false,
-			'display_comments'  => 'threaded',
-			'show_hidden'       => false,
-			'spam'              => 'ham_only',
-			'update_meta_cache' => true,
-		);
-		$r = wp_parse_args( $args, $defaults );
-		extract( $r );
-
-		$this->pag_arg  = sanitize_key( $r['page_arg'] );
-		$this->pag_page = bp_sanitize_pagination_arg( $this->pag_arg, $r['page']     );
-		$this->pag_num  = bp_sanitize_pagination_arg( 'num',          $r['per_page'] );
-
-		// Check if blog/forum replies are disabled.
-		$this->disable_blogforum_replies = (bool) bp_core_get_root_option( 'bp-disable-blogforum-comments' );
-
-		// Get an array of the logged in user's favorite activities.
-		$this->my_favs = maybe_unserialize( bp_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,
-				'count_total'       => $count_total,
-				'page'              => $this->pag_page,
-				'per_page'          => $this->pag_num,
-				'sort'              => $sort,
-				'display_comments'  => $display_comments,
-				'show_hidden'       => $show_hidden,
-				'spam'              => $spam,
-				'update_meta_cache' => $update_meta_cache,
-			) );
-
-		// Fetch all activity items.
-		} else {
-			$this->activities = bp_activity_get( array(
-				'display_comments'  => $display_comments,
-				'max'               => $max,
-				'count_total'       => $count_total,
-				'per_page'          => $this->pag_num,
-				'page'              => $this->pag_page,
-				'sort'              => $sort,
-				'search_terms'      => $search_terms,
-				'meta_query'        => $meta_query,
-				'date_query'        => $date_query,
-				'filter_query'      => $filter_query,
-				'filter'            => $filter,
-				'scope'             => $scope,
-				'show_hidden'       => $show_hidden,
-				'exclude'           => $exclude,
-				'in'                => $in,
-				'spam'              => $spam,
-				'update_meta_cache' => $update_meta_cache,
-			) );
-		}
-
-		// The total_activity_count property will be set only if a
-		// 'count_total' query has taken place.
-		if ( ! is_null( $this->activities['total'] ) ) {
-			if ( ! $max || $max >= (int) $this->activities['total'] ) {
-				$this->total_activity_count = (int) $this->activities['total'];
-			} else {
-				$this->total_activity_count = (int) $max;
-			}
-		}
-
-		$this->has_more_items = $this->activities['has_more_items'];
-
-		$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_get_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( $this->pag_arg, '%#%' ),
-				'format'    => '',
-				'total'     => ceil( (int) $this->total_activity_count / (int) $this->pag_num ),
-				'current'   => (int) $this->pag_page,
-				'prev_text' => _x( '&larr;', 'Activity pagination previous text', 'buddypress' ),
-				'next_text' => _x( '&rarr;', 'Activity pagination next text', 'buddypress' ),
-				'mid_size'  => 1,
-				'add_args'  => array(),
-			) );
-		}
-	}
-
-	/**
-	 * Whether there are activity items available in the loop.
-	 *
-	 * @since 1.0.0
-	 *
-	 * @see bp_has_activities()
-	 *
-	 * @return bool True if there are items in the loop, otherwise false.
-	 */
-	function has_activities() {
-		if ( $this->activity_count ) {
-			return true;
-		}
-
-		return false;
-	}
-
-	/**
-	 * Set up the next activity item and iterate index.
-	 *
-	 * @since 1.0.0
-	 *
-	 * @return object The next activity item to iterate over.
-	 */
-	public function next_activity() {
-		$this->current_activity++;
-		$this->activity = $this->activities[ $this->current_activity ];
-
-		return $this->activity;
-	}
-
-	/**
-	 * Rewind the posts and reset post index.
-	 *
-	 * @since 1.0.0
-	 */
-	public function rewind_activities() {
-		$this->current_activity = -1;
-		if ( $this->activity_count > 0 ) {
-			$this->activity = $this->activities[0];
-		}
-	}
-
-	/**
-	 * Whether there are activity items left in the loop to iterate over.
-	 *
-	 * This method is used by {@link bp_activities()} as part of the while loop
-	 * that controls iteration inside the activities loop, eg:
-	 *     while ( bp_activities() ) { ...
-	 *
-	 * @since 1.0.0
-	 *
-	 * @see bp_activities()
-	 *
-	 * @return bool True if there are more activity items to show,
-	 *              otherwise false.
-	 */
-	public function user_activities() {
-		if ( ( $this->current_activity + 1 ) < $this->activity_count ) {
-			return true;
-		} elseif ( ( $this->current_activity + 1 ) == $this->activity_count ) {
-
-			/**
-			 * Fires right before the rewinding of activity posts.
-			 *
-			 * @since 1.1.0
-			 */
-			do_action( 'activity_loop_end' );
-
-			// Do some cleaning up after the loop.
-			$this->rewind_activities();
-		}
-
-		$this->in_the_loop = false;
-
-		return false;
-	}
-
-	/**
-	 * Set up the current activity item inside the loop.
-	 *
-	 * Used by {@link bp_the_activity()} to set up the current activity item
-	 * data while looping, so that template tags used during that iteration
-	 * make reference to the current activity item.
-	 *
-	 * @since 1.0.0
-	 *
-	 * @see bp_the_activity()
-	 */
-	public function the_activity() {
-
-		$this->in_the_loop = true;
-		$this->activity    = $this->next_activity();
-
-		if ( is_array( $this->activity ) ) {
-			$this->activity = (object) $this->activity;
-		}
-
-		// Loop has just started.
-		if ( $this->current_activity == 0 ) {
-
-			/**
-			 * Fires if the current activity item is the first in the activity loop.
-			 *
-			 * @since 1.1.0
-			 */
-			do_action('activity_loop_start');
-		}
-	}
-}
-
-/**
  * Initialize the activity loop.
  *
  * Based on the $args passed, bp_has_activities() populates the
Index: src/bp-activity/classes/class-bp-activity-list-table.php
===================================================================
--- src/bp-activity/classes/class-bp-activity-list-table.php	(revision 10496)
+++ src/bp-activity/classes/class-bp-activity-list-table.php	(working copy)
@@ -1,1045 +1,6 @@
 <?php
-/**
- * BuddyPress Activity component admin screen.
- *
- * Props to WordPress core for the Comments admin screen, and its contextual
- * help text, on which this implementation is heavily based.
- *
- * @package BuddyPress
- * @subpackage ActivityAdmin
- * @since 1.6.0
- */
 
-// Exit if accessed directly.
-defined( 'ABSPATH' ) || exit;
-
-// Include WP's list table class.
-if ( !class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
-
-// Per_page screen option. Has to be hooked in extremely early.
-if ( is_admin() && ! empty( $_REQUEST['page'] ) && 'bp-activity' == $_REQUEST['page'] )
-	add_filter( 'set-screen-option', 'bp_activity_admin_screen_options', 10, 3 );
-
 /**
- * Register the Activity component admin screen.
- *
- * @since 1.6.0
- */
-function bp_activity_add_admin_menu() {
-
-	// Add our screen.
-	$hook = add_menu_page(
-		_x( 'Activity', 'Admin Dashbord SWA page title', 'buddypress' ),
-		_x( 'Activity', 'Admin Dashbord SWA menu', 'buddypress' ),
-		'bp_moderate',
-		'bp-activity',
-		'bp_activity_admin',
-		'div'
-	);
-
-	// Hook into early actions to load custom CSS and our init handler.
-	add_action( "load-$hook", 'bp_activity_admin_load' );
-}
-add_action( bp_core_admin_hook(), 'bp_activity_add_admin_menu' );
-
-/**
- * Add activity component to custom menus array.
- *
- * Several BuddyPress components have top-level menu items in the Dashboard,
- * which all appear together in the middle of the Dashboard menu. This function
- * adds the Activity page to the array of these menu items.
- *
- * @since 1.7.0
- *
- * @param array $custom_menus The list of top-level BP menu items.
- * @return array $custom_menus List of top-level BP menu items, with Activity added.
- */
-function bp_activity_admin_menu_order( $custom_menus = array() ) {
-	array_push( $custom_menus, 'bp-activity' );
-	return $custom_menus;
-}
-add_filter( 'bp_admin_menu_order', 'bp_activity_admin_menu_order' );
-
-/**
- * AJAX receiver for Activity replies via the admin screen.
- *
- * Processes requests to add new activity comments, and echoes HTML for a new
- * table row.
- *
- * @since 1.6.0
- */
-function bp_activity_admin_reply() {
-	// Check nonce.
-	check_ajax_referer( 'bp-activity-admin-reply', '_ajax_nonce-bp-activity-admin-reply' );
-
-	$parent_id = ! empty( $_REQUEST['parent_id'] ) ? (int) $_REQUEST['parent_id'] : 0;
-	$root_id   = ! empty( $_REQUEST['root_id'] )   ? (int) $_REQUEST['root_id']   : 0;
-
-	// $parent_id is required
-	if ( empty( $parent_id ) )
-		die( '-1' );
-
-	// If $root_id not set (e.g. for root items), use $parent_id.
-	if ( empty( $root_id ) )
-		$root_id = $parent_id;
-
-	// Check that a reply has been entered.
-	if ( empty( $_REQUEST['content'] ) )
-		die( __( 'ERROR: Please type a reply.', 'buddypress' ) );
-
-	// Check parent activity exists.
-	$parent_activity = new BP_Activity_Activity( $parent_id );
-	if ( empty( $parent_activity->component ) )
-		die( __( 'ERROR: The item you are trying to reply to cannot be found, or it has been deleted.', 'buddypress' ) );
-
-	// @todo: Check if user is allowed to create new activity items
-	// if ( ! current_user_can( 'bp_new_activity' ) )
-	if ( ! current_user_can( 'bp_moderate' ) )
-		die( '-1' );
-
-	// Add new activity comment.
-	$new_activity_id = bp_activity_new_comment( array(
-		'activity_id' => $root_id,              // ID of the root activity item.
-		'content'     => $_REQUEST['content'],
-		'parent_id'   => $parent_id,            // ID of a parent comment.
-	) );
-
-	// Fetch the new activity item, as we need it to create table markup to return.
-	$new_activity = new BP_Activity_Activity( $new_activity_id );
-
-	// This needs to be set for the BP_Activity_List_Table constructor to work.
-	set_current_screen( 'toplevel_page_bp-activity' );
-
-	// Set up an output buffer.
-	ob_start();
-	$list_table = new BP_Activity_List_Table();
-	$list_table->single_row( (array) $new_activity );
-
-	// Get table markup.
-	$response =  array(
-		'data'     => ob_get_contents(),
-		'id'       => $new_activity_id,
-		'position' => -1,
-		'what'     => 'bp_activity',
-	);
-	ob_end_clean();
-
-	// Send response.
-	$r = new WP_Ajax_Response();
-	$r->add( $response );
-	$r->send();
-
-	exit();
-}
-add_action( 'wp_ajax_bp-activity-admin-reply', 'bp_activity_admin_reply' );
-
-/**
- * Handle save/update of screen options for the Activity component admin screen.
- *
- * @since 1.6.0
- *
- * @param string $value     Will always be false unless another plugin filters it first.
- * @param string $option    Screen option name.
- * @param string $new_value Screen option form value.
- * @return string Option value. False to abandon update.
- */
-function bp_activity_admin_screen_options( $value, $option, $new_value ) {
-	if ( 'toplevel_page_bp_activity_per_page' != $option && 'toplevel_page_bp_activity_network_per_page' != $option )
-		return $value;
-
-	// Per page.
-	$new_value = (int) $new_value;
-	if ( $new_value < 1 || $new_value > 999 )
-		return $value;
-
-	return $new_value;
-}
-
-/**
- * Hide the advanced edit meta boxes by default, so we don't clutter the screen.
- *
- * @since 1.6.0
- *
- * @param array     $hidden Array of items to hide.
- * @param WP_Screen $screen Screen identifier.
- * @return array Hidden Meta Boxes.
- */
-function bp_activity_admin_edit_hidden_metaboxes( $hidden, $screen ) {
-	if ( empty( $screen->id ) || 'toplevel_page_bp-activity' != $screen->id && 'toplevel_page_bp-activity_network' != $screen->id )
-		return $hidden;
-
-	// Hide the primary link meta box by default.
-	$hidden  = array_merge( (array) $hidden, array( 'bp_activity_itemids', 'bp_activity_link', 'bp_activity_type', 'bp_activity_userid', ) );
-
-	/**
-	 * Filters default hidden metaboxes so plugins can alter list.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param array     $hidden Default metaboxes to hide.
-	 * @param WP_Screen $screen Screen identifier.
-	 */
-	return apply_filters( 'bp_hide_meta_boxes', array_unique( $hidden ), $screen );
-}
-add_filter( 'default_hidden_meta_boxes', 'bp_activity_admin_edit_hidden_metaboxes', 10, 2 );
-
-/**
- * Set up the Activity admin page.
- *
- * Does the following:
- *   - Register contextual help and screen options for this admin page.
- *   - Enqueues scripts and styles.
- *   - Catches POST and GET requests related to Activity.
- *
- * @since 1.6.0
- *
- * @global object                 $bp                     BuddyPress global settings.
- * @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table.
- */
-function bp_activity_admin_load() {
-	global $bp_activity_list_table;
-
-	$bp = buddypress();
-
-	// Decide whether to load the dev version of the CSS and JavaScript.
-	$min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : 'min.';
-
-	$doaction = bp_admin_list_table_current_bulk_action();
-
-	/**
-	 * Fires at top of Activity admin page.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param string $doaction Current $_GET action being performed in admin screen.
-	 */
-	do_action( 'bp_activity_admin_load', $doaction );
-
-	// Edit screen.
-	if ( 'edit' == $doaction && ! empty( $_GET['aid'] ) ) {
-		// Columns screen option.
-		add_screen_option( 'layout_columns', array( 'default' => 2, 'max' => 2, ) );
-
-		get_current_screen()->add_help_tab( array(
-			'id'      => 'bp-activity-edit-overview',
-			'title'   => __( 'Overview', 'buddypress' ),
-			'content' =>
-				'<p>' . __( 'You edit activities made on your site similar to the way you edit a comment. This is useful if you need to change which page the activity links to, or when you notice that the author has made a typographical error.', 'buddypress' ) . '</p>' .
-				'<p>' . __( 'The two big editing areas for the activity title and content are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Primary Item/Secondary Item, Link, Type, Author ID) or to choose a 1- or 2-column layout for this screen.', 'buddypress' ) . '</p>' .
-				'<p>' . __( 'You can also moderate the activity from this screen using the Status box, where you can also change the timestamp of the activity.', 'buddypress' ) . '</p>'
-		) );
-
-		get_current_screen()->add_help_tab( array(
-			'id'      => 'bp-activity-edit-advanced',
-			'title'   => __( 'Item, Link, Type', 'buddypress' ),
-			'content' =>
-				'<p>' . __( '<strong>Primary Item/Secondary Item</strong> - These identify the object that created the activity. For example, the fields could reference a comment left on a specific site. Some types of activity may only use one, or none, of these fields.', 'buddypress' ) . '</p>' .
-				'<p>' . __( '<strong>Link</strong> - Used by some types of activity (e.g blog posts and comments, and forum topics and replies) to store a link back to the original content.', 'buddypress' ) . '</p>' .
-				'<p>' . __( '<strong>Type</strong> - Each distinct kind of activity has its own type. For example, <code>created_group</code> is used when a group is created and <code>joined_group</code> is used when a user joins a group.', 'buddypress' ) . '</p>' .
-				'<p>' . __( 'For information about when and how BuddyPress uses all of these settings, see the Managing Activity link in the panel to the side.', 'buddypress' ) . '</p>'
-		) );
-
-		// Help panel - sidebar links.
-		get_current_screen()->set_help_sidebar(
-			'<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
-			'<p>' . __( '<a href="https://codex.buddypress.org/administrator-guide/activity-stream-management-panels/">Managing Activity</a>', 'buddypress' ) . '</p>' .
-			'<p>' . __( '<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
-		);
-
-		// Register metaboxes for the edit screen.
-		add_meta_box( 'submitdiv',           _x( 'Status', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_status', get_current_screen()->id, 'side', 'core' );
-		add_meta_box( 'bp_activity_itemids', _x( 'Primary Item/Secondary Item', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_itemids', get_current_screen()->id, 'normal', 'core' );
-		add_meta_box( 'bp_activity_link',    _x( 'Link', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_link', get_current_screen()->id, 'normal', 'core' );
-		add_meta_box( 'bp_activity_type',    _x( 'Type', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_type', get_current_screen()->id, 'normal', 'core' );
-		add_meta_box( 'bp_activity_userid',  _x( 'Author ID', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_userid', get_current_screen()->id, 'normal', 'core' );
-
-		/**
-		 * Fires after the registration of all of the default activity meta boxes.
-		 *
-		 * @since 2.4.0
-		 */
-		do_action( 'bp_activity_admin_meta_boxes' );
-
-		// Enqueue JavaScript files.
-		wp_enqueue_script( 'postbox' );
-		wp_enqueue_script( 'dashboard' );
-		wp_enqueue_script( 'comment' );
-
-	// Index screen.
-	} else {
-		// Create the Activity screen list table.
-		$bp_activity_list_table = new BP_Activity_List_Table();
-
-		// The per_page screen option.
-		add_screen_option( 'per_page', array( 'label' => _x( 'Activity', 'Activity items per page (screen options)', 'buddypress' )) );
-
-		// Help panel - overview text.
-		get_current_screen()->add_help_tab( array(
-			'id'      => 'bp-activity-overview',
-			'title'   => __( 'Overview', 'buddypress' ),
-			'content' =>
-				'<p>' . __( 'You can manage activities made on your site similar to the way you manage comments and other content. This screen is customizable in the same ways as other management screens, and you can act on activities using the on-hover action links or the Bulk Actions.', 'buddypress' ) . '</p>' .
-				'<p>' . __( 'There are many different types of activities. Some are generated automatically by BuddyPress and other plugins, and some are entered directly by a user in the form of status update. To help manage the different activity types, use the filter dropdown box to switch between them.', 'buddypress' ) . '</p>'
-		) );
-
-		// Help panel - moderation text.
-		get_current_screen()->add_help_tab( array(
-			'id'		=> 'bp-activity-moderating',
-			'title'		=> __( 'Moderating Activity', 'buddypress' ),
-			'content'	=>
-				'<p>' . __( 'In the <strong>Activity</strong> column, above each activity it says &#8220;Submitted on,&#8221; followed by the date and time the activity item was generated on your site. Clicking on the date/time link will take you to that activity on your live site. Hovering over any activity gives you options to reply, edit, spam mark, or delete that activity.', 'buddypress' ) . '</p>' .
-				'<p>' . __( "In the <strong>In Response To</strong> column, if the activity was in reply to another activity, it shows that activity's author's picture and name, and a link to that activity on your live site. If there is a small bubble, the number in it shows how many other activities are related to this one; these are usually comments. Clicking the bubble will filter the activity screen to show only related activity items.", 'buddypress' ) . '</p>'
-		) );
-
-		// Help panel - sidebar links.
-		get_current_screen()->set_help_sidebar(
-			'<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
-			'<p>' . __( '<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
-		);
-
-		// Add accessible hidden heading and text for Activity screen pagination.
-		if ( bp_get_major_wp_version() >= 4.4 ) {
-			get_current_screen()->set_screen_reader_content( array(
-				'heading_pagination' => __( 'Activity list navigation', 'buddypress' ),
-			) );
-		}
-	}
-
-	// Enqueue CSS and JavaScript.
-	wp_enqueue_script( 'bp_activity_admin_js', $bp->plugin_url . "bp-activity/admin/js/admin.{$min}js",   array( 'jquery', 'wp-ajax-response' ), bp_get_version(), true );
-	wp_localize_script( 'bp_activity_admin_js', 'bp_activity_admin_vars', array(
-		'page' => get_current_screen()->id
-	) );
-	wp_enqueue_style( 'bp_activity_admin_css', $bp->plugin_url . "bp-activity/admin/css/admin.{$min}css", array(),                               bp_get_version()       );
-
-	wp_style_add_data( 'bp_activity_admin_css', 'rtl', true );
-	if ( $min ) {
-		wp_style_add_data( 'bp_activity_admin_css', 'suffix', $min );
-	}
-
-	/**
-	 * Fires after the activity js and style has been enqueued.
-	 *
-	 * @since 2.4.0
-	 */
-	do_action( 'bp_activity_admin_enqueue_scripts' );
-
-	// Handle spam/un-spam/delete of activities.
-	if ( !empty( $doaction ) && ! in_array( $doaction, array( '-1', 'edit', 'save', ) ) ) {
-
-		// Build redirection URL.
-		$redirect_to = remove_query_arg( array( 'aid', 'deleted', 'error', 'spammed', 'unspammed', ), wp_get_referer() );
-		$redirect_to = add_query_arg( 'paged', $bp_activity_list_table->get_pagenum(), $redirect_to );
-
-		// Get activity IDs.
-		$activity_ids = array_map( 'absint', (array) $_REQUEST['aid'] );
-
-		/**
-		 * Filters list of IDs being spammed/un-spammed/deleted.
-		 *
-		 * @since 1.6.0
-		 *
-		 * @param array $activity_ids Activity IDs to spam/un-spam/delete.
-		 */
-		$activity_ids = apply_filters( 'bp_activity_admin_action_activity_ids', $activity_ids );
-
-		// Is this a bulk request?
-		if ( 'bulk_' == substr( $doaction, 0, 5 ) && ! empty( $_REQUEST['aid'] ) ) {
-			// Check this is a valid form submission.
-			check_admin_referer( 'bulk-activities' );
-
-			// Trim 'bulk_' off the action name to avoid duplicating a ton of code.
-			$doaction = substr( $doaction, 5 );
-
-		// This is a request to delete, spam, or un-spam, a single item.
-		} elseif ( !empty( $_REQUEST['aid'] ) ) {
-
-			// Check this is a valid form submission.
-			check_admin_referer( 'spam-activity_' . $activity_ids[0] );
-		}
-
-		// Initialise counters for how many of each type of item we perform an action on.
-		$deleted = $spammed = $unspammed = 0;
-
-		// Store any errors that occurs when updating the database items.
-		$errors = array();
-
-		// "We'd like to shoot the monster, could you move, please?"
-		foreach ( $activity_ids as $activity_id ) {
-			// @todo: Check the permissions on each
-			// if ( ! current_user_can( 'bp_edit_activity', $activity_id ) )
-			// continue;
-			// Get the activity from the database.
-			$activity = new BP_Activity_Activity( $activity_id );
-			if ( empty( $activity->component ) ) {
-				$errors[] = $activity_id;
-				continue;
-			}
-
-			switch ( $doaction ) {
-				case 'delete' :
-					if ( 'activity_comment' == $activity->type )
-						bp_activity_delete_comment( $activity->item_id, $activity->id );
-					else
-						bp_activity_delete( array( 'id' => $activity->id ) );
-
-					$deleted++;
-					break;
-
-				case 'ham' :
-					/**
-					 * Remove moderation and blacklist checks in case we want to ham an activity
-					 * which contains one of these listed keys.
-					 */
-					remove_action( 'bp_activity_before_save', 'bp_activity_check_moderation_keys', 2, 1 );
-					remove_action( 'bp_activity_before_save', 'bp_activity_check_blacklist_keys',  2, 1 );
-
-					bp_activity_mark_as_ham( $activity );
-					$result = $activity->save();
-
-					// Check for any error during activity save.
-					if ( ! $result )
-						$errors[] = $activity->id;
-					else
-						$unspammed++;
-					break;
-
-				case 'spam' :
-					bp_activity_mark_as_spam( $activity );
-					$result = $activity->save();
-
-					// Check for any error during activity save.
-					if ( ! $result )
-						$errors[] = $activity->id;
-					else
-						$spammed++;
-					break;
-
-				default:
-					break;
-			}
-
-			// Release memory.
-			unset( $activity );
-		}
-
-		/**
-		 * Fires before redirect for plugins to do something with activity.
-		 *
-		 * Passes an activity array counts how many were spam, not spam, deleted, and IDs that were errors.
-		 *
-		 * @since 1.6.0
-		 *
-		 * @param array  $value        Array holding spam, not spam, deleted counts, error IDs.
-		 * @param string $redirect_to  URL to redirect to.
-		 * @param array  $activity_ids Original array of activity IDs.
-		 */
-		do_action( 'bp_activity_admin_action_after', array( $spammed, $unspammed, $deleted, $errors ), $redirect_to, $activity_ids );
-
-		// Add arguments to the redirect URL so that on page reload, we can easily display what we've just done.
-		if ( $spammed )
-			$redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to );
-
-		if ( $unspammed )
-			$redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to );
-
-		if ( $deleted )
-			$redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to );
-
-		// If an error occurred, pass back the activity ID that failed.
-		if ( ! empty( $errors ) )
-			$redirect_to = add_query_arg( 'error', implode ( ',', array_map( 'absint', $errors ) ), $redirect_to );
-
-		/**
-		 * Filters redirect URL after activity spamming/un-spamming/deletion occurs.
-		 *
-		 * @since 1.6.0
-		 *
-		 * @param string $redirect_to URL to redirect to.
-		 */
-		wp_redirect( apply_filters( 'bp_activity_admin_action_redirect', $redirect_to ) );
-		exit;
-
-
-	// Save the edit.
-	} elseif ( $doaction && 'save' == $doaction ) {
-		// Build redirection URL.
-		$redirect_to = remove_query_arg( array( 'action', 'aid', 'deleted', 'error', 'spammed', 'unspammed', ), $_SERVER['REQUEST_URI'] );
-
-		// Get activity ID.
-		$activity_id = (int) $_REQUEST['aid'];
-
-		// Check this is a valid form submission.
-		check_admin_referer( 'edit-activity_' . $activity_id );
-
-		// Get the activity from the database.
-		$activity = new BP_Activity_Activity( $activity_id );
-
-		// If the activity doesn't exist, just redirect back to the index.
-		if ( empty( $activity->component ) ) {
-			wp_redirect( $redirect_to );
-			exit;
-		}
-
-		// Check the form for the updated properties.
-		// Store any error that occurs when updating the database item.
-		$error = 0;
-
-		// Activity spam status.
-		$prev_spam_status = $new_spam_status = false;
-		if ( ! empty( $_POST['activity_status'] ) ) {
-			$prev_spam_status = $activity->is_spam;
-			$new_spam_status  = ( 'spam' == $_POST['activity_status'] ) ? true : false;
-		}
-
-		// Activity action.
-		if ( isset( $_POST['bp-activities-action'] ) )
-			$activity->action = $_POST['bp-activities-action'];
-
-		// Activity content.
-		if ( isset( $_POST['bp-activities-content'] ) )
-			$activity->content = $_POST['bp-activities-content'];
-
-		// Activity primary link.
-		if ( ! empty( $_POST['bp-activities-link'] ) )
-			$activity->primary_link = $_POST['bp-activities-link'];
-
-		// Activity user ID.
-		if ( ! empty( $_POST['bp-activities-userid'] ) )
-			$activity->user_id = (int) $_POST['bp-activities-userid'];
-
-		// Activity item primary ID.
-		if ( isset( $_POST['bp-activities-primaryid'] ) )
-			$activity->item_id = (int) $_POST['bp-activities-primaryid'];
-
-		// Activity item secondary ID.
-		if ( isset( $_POST['bp-activities-secondaryid'] ) )
-			$activity->secondary_item_id = (int) $_POST['bp-activities-secondaryid'];
-
-		// Activity type.
-		if ( ! empty( $_POST['bp-activities-type'] ) ) {
-			$actions = bp_activity_admin_get_activity_actions();
-
-			// Check that the new type is a registered activity type.
-			if ( in_array( $_POST['bp-activities-type'], $actions ) ) {
-				$activity->type = $_POST['bp-activities-type'];
-			}
-		}
-
-		// Activity timestamp.
-		if ( ! empty( $_POST['aa'] ) && ! empty( $_POST['mm'] ) && ! empty( $_POST['jj'] ) && ! empty( $_POST['hh'] ) && ! empty( $_POST['mn'] ) && ! empty( $_POST['ss'] ) ) {
-			$aa = $_POST['aa'];
-			$mm = $_POST['mm'];
-			$jj = $_POST['jj'];
-			$hh = $_POST['hh'];
-			$mn = $_POST['mn'];
-			$ss = $_POST['ss'];
-			$aa = ( $aa <= 0 ) ? date( 'Y' ) : $aa;
-			$mm = ( $mm <= 0 ) ? date( 'n' ) : $mm;
-			$jj = ( $jj > 31 ) ? 31 : $jj;
-			$jj = ( $jj <= 0 ) ? date( 'j' ) : $jj;
-			$hh = ( $hh > 23 ) ? $hh -24 : $hh;
-			$mn = ( $mn > 59 ) ? $mn -60 : $mn;
-			$ss = ( $ss > 59 ) ? $ss -60 : $ss;
-
-			// Reconstruct the date into a timestamp.
-			$gmt_date = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss );
-
-			$activity->date_recorded = $gmt_date;
-		}
-
-		// Has the spam status has changed?
-		if ( $new_spam_status != $prev_spam_status ) {
-			if ( $new_spam_status )
-				bp_activity_mark_as_spam( $activity );
-			else
-				bp_activity_mark_as_ham( $activity );
-		}
-
-		// Save.
-		$result = $activity->save();
-
-		// Clear the activity stream first page cache, in case this activity's timestamp was changed.
-		wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
-
-		// Check for any error during activity save.
-		if ( false === $result )
-			$error = $activity->id;
-
-		/**
-		 * Fires before redirect so plugins can do something first on save action.
-		 *
-		 * @since 1.6.0
-		 *
-		 * @param array $value Array holding activity object and ID that holds error.
-		 */
-		do_action_ref_array( 'bp_activity_admin_edit_after', array( &$activity, $error ) );
-
-		// If an error occurred, pass back the activity ID that failed.
-		if ( $error )
-			$redirect_to = add_query_arg( 'error', (int) $error, $redirect_to );
-		else
-			$redirect_to = add_query_arg( 'updated', (int) $activity->id, $redirect_to );
-
-		/**
-		 * Filters URL to redirect to after saving.
-		 *
-		 * @since 1.6.0
-		 *
-		 * @param string $redirect_to URL to redirect to.
-		 */
-		wp_redirect( apply_filters( 'bp_activity_admin_edit_redirect', $redirect_to ) );
-		exit;
-
-
-	// If a referrer and a nonce is supplied, but no action, redirect back.
-	} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
-		wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
-		exit;
-	}
-}
-
-/**
- * Output the Activity component admin screens.
- *
- * @since 1.6.0
- */
-function bp_activity_admin() {
-	// Decide whether to load the index or edit screen.
-	$doaction = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
-
-	// Display the single activity edit screen.
-	if ( 'edit' == $doaction && ! empty( $_GET['aid'] ) )
-		bp_activity_admin_edit();
-
-	// Otherwise, display the Activity index screen.
-	else
-		bp_activity_admin_index();
-}
-
-/**
- * Display the single activity edit screen.
- *
- * @since 1.6.0
- */
-function bp_activity_admin_edit() {
-
-	// @todo: Check if user is allowed to edit activity items
-	// if ( ! current_user_can( 'bp_edit_activity' ) )
-	if ( ! is_super_admin() )
-		die( '-1' );
-
-	// Get the activity from the database.
-	$activity = bp_activity_get( array(
-		'in'               => ! empty( $_REQUEST['aid'] ) ? (int) $_REQUEST['aid'] : 0,
-		'max'              => 1,
-		'show_hidden'      => true,
-		'spam'             => 'all',
-		'display_comments' => 0
-	) );
-
-	if ( ! empty( $activity['activities'][0] ) ) {
-		$activity = $activity['activities'][0];
-
-		// Workaround to use WP's touch_time() without duplicating that function.
-		$GLOBALS['comment'] = new stdClass;
-		$GLOBALS['comment']->comment_date = $activity->date_recorded;
-	} else {
-		$activity = '';
-	}
-
-	// Construct URL for form.
-	$form_url = remove_query_arg( array( 'action', 'deleted', 'error', 'spammed', 'unspammed', ), $_SERVER['REQUEST_URI'] );
-	$form_url = add_query_arg( 'action', 'save', $form_url );
-
-	/**
-	 * Fires before activity edit form is displays so plugins can modify the activity.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param array $value Array holding single activity object that was passed by reference.
-	 */
-	do_action_ref_array( 'bp_activity_admin_edit', array( &$activity ) ); ?>
-
-	<div class="wrap">
-		<h1><?php printf( __( 'Editing Activity (ID #%s)', 'buddypress' ), number_format_i18n( (int) $_REQUEST['aid'] ) ); ?></h1>
-
-		<?php if ( ! empty( $activity ) ) : ?>
-
-			<form action="<?php echo esc_url( $form_url ); ?>" id="bp-activities-edit-form" method="post">
-				<div id="poststuff">
-
-					<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
-						<div id="post-body-content">
-							<div id="postdiv">
-								<div id="bp_activity_action" class="postbox">
-									<h2><?php _e( 'Action', 'buddypress' ); ?></h2>
-									<div class="inside">
-										<?php wp_editor( stripslashes( $activity->action ), 'bp-activities-action', array( 'media_buttons' => false, 'textarea_rows' => 7, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?>
-									</div>
-								</div>
-
-								<div id="bp_activity_content" class="postbox">
-									<h2><?php _e( 'Content', 'buddypress' ); ?></h2>
-									<div class="inside">
-										<?php wp_editor( stripslashes( $activity->content ), 'bp-activities-content', array( 'media_buttons' => false, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?>
-									</div>
-								</div>
-							</div>
-						</div><!-- #post-body-content -->
-
-						<div id="postbox-container-1" class="postbox-container">
-							<?php do_meta_boxes( get_current_screen()->id, 'side', $activity ); ?>
-						</div>
-
-						<div id="postbox-container-2" class="postbox-container">
-							<?php do_meta_boxes( get_current_screen()->id, 'normal', $activity ); ?>
-							<?php do_meta_boxes( get_current_screen()->id, 'advanced', $activity ); ?>
-						</div>
-					</div><!-- #post-body -->
-
-				</div><!-- #poststuff -->
-				<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
-				<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
-				<?php wp_nonce_field( 'edit-activity_' . $activity->id ); ?>
-			</form>
-
-		<?php else : ?>
-			<p>
-				<?php _e( 'No activity found with this ID.', 'buddypress' ); ?>
-				<a href="<?php echo esc_url( bp_get_admin_url( 'admin.php?page=bp-activity' ) ); ?>"><?php _e( 'Go back and try again.', 'buddypress' ); ?></a>
-			</p>
-		<?php endif; ?>
-
-	</div><!-- .wrap -->
-
-<?php
-}
-
-/**
- * Status metabox for the Activity admin edit screen.
- *
- * @since 1.6.0
- *
- * @param object $item Activity item.
- */
-function bp_activity_admin_edit_metabox_status( $item ) {
-?>
-
-	<div class="submitbox" id="submitcomment">
-
-		<div id="minor-publishing">
-			<div id="minor-publishing-actions">
-				<div id="preview-action">
-					<a class="button preview" href="<?php echo esc_attr( bp_activity_get_permalink( $item->id, $item ) ); ?>" target="_blank"><?php _e( 'View Activity', 'buddypress' ); ?></a>
-				</div>
-
-				<div class="clear"></div>
-			</div><!-- #minor-publishing-actions -->
-
-			<div id="misc-publishing-actions">
-				<div class="misc-pub-section" id="comment-status-radio">
-					<label class="approved" for="activity-status-approved"><input type="radio" name="activity_status" id="activity-status-approved" value="ham" <?php checked( $item->is_spam, 0 ); ?>><?php _e( 'Approved', 'buddypress' ); ?></label><br />
-					<label class="spam" for="activity-status-spam"><input type="radio" name="activity_status" id="activity-status-spam" value="spam" <?php checked( $item->is_spam, 1 ); ?>><?php _e( 'Spam', 'buddypress' ); ?></label>
-				</div>
-
-				<div class="misc-pub-section curtime misc-pub-section-last">
-					<?php
-					// Translators: Publish box date format, see http://php.net/date.
-					$datef = __( 'M j, Y @ G:i', 'buddypress' );
-					$date  = date_i18n( $datef, strtotime( $item->date_recorded ) );
-					?>
-					<span id="timestamp"><?php printf( __( 'Submitted on: %s', 'buddypress' ), '<strong>' . $date . '</strong>' ); ?></span>&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e( 'Edit', 'buddypress' ); ?></a>
-
-					<div id='timestampdiv' class='hide-if-js'>
-						<?php touch_time( 1, 0, 5 ); ?>
-					</div><!-- #timestampdiv -->
-				</div>
-			</div> <!-- #misc-publishing-actions -->
-
-			<div class="clear"></div>
-		</div><!-- #minor-publishing -->
-
-		<div id="major-publishing-actions">
-			<div id="publishing-action">
-				<?php submit_button( __( 'Update', 'buddypress' ), 'primary', 'save', false ); ?>
-			</div>
-			<div class="clear"></div>
-		</div><!-- #major-publishing-actions -->
-
-	</div><!-- #submitcomment -->
-
-<?php
-}
-
-/**
- * Primary link metabox for the Activity admin edit screen.
- *
- * @since 1.6.0
- *
- * @param object $item Activity item.
- */
-function bp_activity_admin_edit_metabox_link( $item ) {
-?>
-
-	<label class="screen-reader-text" for="bp-activities-link"><?php _e( 'Link', 'buddypress' ); ?></label>
-	<input type="url" name="bp-activities-link" id="bp-activities-link" value="<?php echo esc_url( $item->primary_link ); ?>" aria-describedby="bp-activities-link-description" />
-	<p id="bp-activities-link-description"><?php _e( 'Activity generated by posts and comments, forum topics and replies, and some plugins, uses the link field for a permalink back to the content item.', 'buddypress' ); ?></p>
-
-<?php
-}
-
-/**
- * User ID metabox for the Activity admin edit screen.
- *
- * @since 1.6.0
- *
- * @param object $item Activity item.
- */
-function bp_activity_admin_edit_metabox_userid( $item ) {
-?>
-
-	<label class="screen-reader-text" for="bp-activities-userid"><?php _e( 'Author ID', 'buddypress' ); ?></label>
-	<input type="number" name="bp-activities-userid" id="bp-activities-userid" value="<?php echo esc_attr( $item->user_id ); ?>" min="1" />
-
-<?php
-}
-
-/**
- * Get flattened array of all registered activity actions.
- *
- * Format is [activity_type] => Pretty name for activity type.
- *
- * @since 2.0.0
- *
- * @return array $actions
- */
-function bp_activity_admin_get_activity_actions() {
-	$actions  = array();
-
-	// Walk through the registered actions, and build an array of actions/values.
-	foreach ( bp_activity_get_actions() as $action ) {
-		$action = array_values( (array) $action );
-
-		for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ ) {
-			$actions[ $action[$i]['key'] ] = $action[$i]['value'];
-		}
-	}
-
-	// This was a mis-named activity type from before BP 1.6.
-	unset( $actions['friends_register_activity_action'] );
-
-	// Sort array by the human-readable value.
-	natsort( $actions );
-
-	return $actions;
-}
-
-/**
- * Activity type metabox for the Activity admin edit screen.
- *
- * @since 1.6.0
- *
- * @param object $item Activity item.
- */
-function bp_activity_admin_edit_metabox_type( $item ) {
-	$bp = buddypress();
-
-	$actions  = array();
-	$selected = $item->type;
-
-	// Walk through the registered actions, and build an array of actions/values.
-	foreach ( bp_activity_get_actions() as $action ) {
-		$action = array_values( (array) $action );
-
-		for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ )
-			$actions[ $action[$i]['key'] ] = $action[$i]['value'];
-	}
-
-	// This was a mis-named activity type from before BP 1.6.
-	unset( $actions['friends_register_activity_action'] );
-
-	// Sort array by the human-readable value.
-	natsort( $actions );
-
-	/*
-	 * If the activity type is not registered properly (eg, a plugin has
-	 * not called bp_activity_set_action()), add the raw type to the end
-	 * of the list.
-	 */
-	if ( ! isset( $actions[ $selected ] ) ) {
-		_doing_it_wrong( __FUNCTION__, sprintf( __( 'This activity item has a type (%s) that is not registered using bp_activity_set_action(), so no label is available.', 'buddypress' ), $selected ), '2.0.0' );
-		$actions[ $selected ] = $selected;
-	}
-
-	?>
-
-	<label for="bp-activities-type" class="screen-reader-text"><?php esc_html_e( 'Select activity type', 'buddypress' ); ?></label>
-	<select name="bp-activities-type" id="bp-activities-type">
-		<?php foreach ( $actions as $k => $v ) : ?>
-			<option value="<?php echo esc_attr( $k ); ?>" <?php selected( $k,  $selected ); ?>><?php echo esc_html( $v ); ?></option>
-		<?php endforeach; ?>
-	</select>
-
-<?php
-}
-
-/**
- * Primary item ID/Secondary item ID metabox for the Activity admin edit screen.
- *
- * @since 1.6.0
- *
- * @param object $item Activity item.
- */
-function bp_activity_admin_edit_metabox_itemids( $item ) {
-?>
-
-	<label for="bp-activities-primaryid"><?php _e( 'Primary Item ID', 'buddypress' ); ?></label>
-	<input type="number" name="bp-activities-primaryid" id="bp-activities-primaryid" value="<?php echo esc_attr( $item->item_id ); ?>" min="0" />
-	<br />
-
-	<label for="bp-activities-secondaryid"><?php _e( 'Secondary Item ID', 'buddypress' ); ?></label>
-	<input type="number" name="bp-activities-secondaryid" id="bp-activities-secondaryid" value="<?php echo esc_attr( $item->secondary_item_id ); ?>" min="0" />
-
-	<p><?php _e( 'These identify the object that created this activity. For example, the fields could reference a pair of site and comment IDs.', 'buddypress' ); ?></p>
-
-<?php
-}
-
-/**
- * Display the Activity admin index screen, which contains a list of all the activities.
- *
- * @since 1.6.0
- *
- * @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table.
- * @global string                 $plugin_page            The current plugin page.
- */
-function bp_activity_admin_index() {
-	global $bp_activity_list_table, $plugin_page;
-
-	$messages = array();
-
-	// If the user has just made a change to an activity item, build status messages.
-	if ( ! empty( $_REQUEST['deleted'] ) || ! empty( $_REQUEST['spammed'] ) || ! empty( $_REQUEST['unspammed'] ) || ! empty( $_REQUEST['error'] ) || ! empty( $_REQUEST['updated'] ) ) {
-		$deleted   = ! empty( $_REQUEST['deleted']   ) ? (int) $_REQUEST['deleted']   : 0;
-		$errors    = ! empty( $_REQUEST['error']     ) ? $_REQUEST['error']           : '';
-		$spammed   = ! empty( $_REQUEST['spammed']   ) ? (int) $_REQUEST['spammed']   : 0;
-		$unspammed = ! empty( $_REQUEST['unspammed'] ) ? (int) $_REQUEST['unspammed'] : 0;
-		$updated   = ! empty( $_REQUEST['updated']   ) ? (int) $_REQUEST['updated']   : 0;
-
-		$errors = array_map( 'absint', explode( ',', $errors ) );
-
-		// Make sure we don't get any empty values in $errors.
-		for ( $i = 0, $errors_count = count( $errors ); $i < $errors_count; $i++ ) {
-			if ( 0 === $errors[$i] ) {
-				unset( $errors[$i] );
-			}
-		}
-
-		// Reindex array.
-		$errors = array_values( $errors );
-
-		if ( $deleted > 0 )
-			$messages[] = sprintf( _n( '%s activity item has been permanently deleted.', '%s activity items have been permanently deleted.', $deleted, 'buddypress' ), number_format_i18n( $deleted ) );
-
-		if ( ! empty( $errors ) ) {
-			if ( 1 == count( $errors ) ) {
-				$messages[] = sprintf( __( 'An error occurred when trying to update activity ID #%s.', 'buddypress' ), number_format_i18n( $errors[0] ) );
-
-			} else {
-				$error_msg  = __( 'Errors occurred when trying to update these activity items:', 'buddypress' );
-				$error_msg .= '<ul class="activity-errors">';
-
-				// Display each error as a list item.
-				foreach ( $errors as $error ) {
-					// Translators: This is a bulleted list of item IDs.
-					$error_msg .= '<li>' . sprintf( __( '#%s', 'buddypress' ), number_format_i18n( $error ) ) . '</li>';
-				}
-
-				$error_msg  .= '</ul>';
-				$messages[] = $error_msg;
-			}
-		}
-
-		if ( $spammed > 0 )
-			$messages[] = sprintf( _n( '%s activity item has been successfully spammed.', '%s activity items have been successfully spammed.', $spammed, 'buddypress' ), number_format_i18n( $spammed ) );
-
-		if ( $unspammed > 0 )
-			$messages[] = sprintf( _n( '%s activity item has been successfully unspammed.', '%s activity items have been successfully unspammed.', $unspammed, 'buddypress' ), number_format_i18n( $unspammed ) );
-
-		if ( $updated > 0 )
-			$messages[] = __( 'The activity item has been updated successfully.', 'buddypress' );
-	}
-
-	// Prepare the activity items for display.
-	$bp_activity_list_table->prepare_items();
-
-	/**
-	 * Fires before edit form is displayed so plugins can modify the activity messages.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param array $messages Array of messages to display at top of page.
-	 */
-	do_action( 'bp_activity_admin_index', $messages ); ?>
-
-	<div class="wrap">
-		<h1>
-			<?php if ( !empty( $_REQUEST['aid'] ) ) : ?>
-				<?php printf( __( 'Activity related to ID #%s', 'buddypress' ), number_format_i18n( (int) $_REQUEST['aid'] ) ); ?>
-			<?php else : ?>
-				<?php _ex( 'Activity', 'Admin SWA page', 'buddypress' ); ?>
-			<?php endif; ?>
-
-			<?php if ( !empty( $_REQUEST['s'] ) ) : ?>
-				<span class="subtitle"><?php printf( __( 'Search results for &#8220;%s&#8221;', 'buddypress' ), wp_html_excerpt( esc_html( stripslashes( $_REQUEST['s'] ) ), 50 ) ); ?></span>
-			<?php endif; ?>
-		</h1>
-
-		<?php // If the user has just made a change to an activity item, display the status messages. ?>
-		<?php if ( !empty( $messages ) ) : ?>
-			<div id="moderated" class="<?php echo ( ! empty( $_REQUEST['error'] ) ) ? 'error' : 'updated'; ?>"><p><?php echo implode( "<br/>\n", $messages ); ?></p></div>
-		<?php endif; ?>
-
-		<?php // Display each activity on its own row. ?>
-		<?php $bp_activity_list_table->views(); ?>
-
-		<form id="bp-activities-form" action="" method="get">
-			<?php $bp_activity_list_table->search_box( __( 'Search all Activity', 'buddypress' ), 'bp-activity' ); ?>
-			<input type="hidden" name="page" value="<?php echo esc_attr( $plugin_page ); ?>" />
-			<?php $bp_activity_list_table->display(); ?>
-		</form>
-
-		<?php // This markup is used for the reply form. ?>
-		<table style="display: none;">
-			<tr id="bp-activities-container" style="display: none;">
-				<td colspan="4">
-					<form method="get" action="">
-
-						<h3 id="bp-replyhead"><?php _e( 'Reply to Activity', 'buddypress' ); ?></h3>
-						<?php wp_editor( '', 'bp-activities', array( 'dfw' => false, 'media_buttons' => false, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ), 'tinymce' => false, ) ); ?>
-
-						<p id="bp-replysubmit" class="submit">
-							<a href="#" class="cancel button-secondary alignleft"><?php _e( 'Cancel', 'buddypress' ); ?></a>
-							<a href="#" class="save button-primary alignright"><?php _e( 'Reply', 'buddypress' ); ?></a>
-
-							<img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
-							<span class="error" style="display:none;"></span>
-							<br class="clear" />
-						</p>
-
-						<?php wp_nonce_field( 'bp-activity-admin-reply', '_ajax_nonce-bp-activity-admin-reply', false ); ?>
-
-					</form>
-				</td>
-			</tr>
-		</table>
-	</div>
-
-<?php
-}
-
-/**
  * List table class for the Activity component admin page.
  *
  * @since 1.6.0
Index: src/bp-activity/classes/class-bp-activity-loader.php
===================================================================
--- src/bp-activity/classes/class-bp-activity-loader.php	(revision 10496)
+++ src/bp-activity/classes/class-bp-activity-loader.php	(working copy)
@@ -1,9 +1,7 @@
 <?php
 /**
- * BuddyPress Activity Streams Loader.
+ * Activity component class.
  *
- * An activity stream component, for users, groups, and site tracking.
- *
  * @package BuddyPress
  * @subpackage ActivityCore
  * @since 1.5.0
@@ -386,13 +384,3 @@
 		parent::setup_cache_groups();
 	}
 }
-
-/**
- * Bootstrap the Activity component.
- *
- * @since 1.6.0
- */
-function bp_setup_activity() {
-	buddypress()->activity = new BP_Activity_Component();
-}
-add_action( 'bp_setup_components', 'bp_setup_activity', 6 );
Index: src/bp-activity/classes/class-bp-activity-template.php
===================================================================
--- src/bp-activity/classes/class-bp-activity-template.php	(revision 10496)
+++ src/bp-activity/classes/class-bp-activity-template.php	(working copy)
@@ -11,102 +11,6 @@
 defined( 'ABSPATH' ) || exit;
 
 /**
- * Output the activity component slug.
- *
- * @since 1.5.0
- *
- * @uses bp_get_activity_slug()
- */
-function bp_activity_slug() {
-	echo bp_get_activity_slug();
-}
-	/**
-	 * Return the activity component slug.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @uses apply_filters() To call the 'bp_get_activity_slug' hook.
-	 *
-	 * @return string The activity component slug.
-	 */
-	function bp_get_activity_slug() {
-
-		/**
-		 * Filters the activity component slug.
-		 *
-		 * @since 1.5.0
-		 *
-		 * @param string $slug Activity component slug.
-		 */
-		return apply_filters( 'bp_get_activity_slug', buddypress()->activity->slug );
-	}
-
-/**
- * Output the activity component root slug.
- *
- * @since 1.5.0
- *
- * @uses bp_get_activity_root_slug()
- */
-function bp_activity_root_slug() {
-	echo bp_get_activity_root_slug();
-}
-	/**
-	 * Return the activity component root slug.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @uses apply_filters() To call the 'bp_get_activity_root_slug' hook.
-	 *
-	 * @return string The activity component root slug.
-	 */
-	function bp_get_activity_root_slug() {
-
-		/**
-		 * Filters the activity component root slug.
-		 *
-		 * @since 1.5.0
-		 *
-		 * @param string $root_slug Activity component root slug.
-		 */
-		return apply_filters( 'bp_get_activity_root_slug', buddypress()->activity->root_slug );
-	}
-
-/**
- * Output activity directory permalink.
- *
- * @since 1.5.0
- *
- * @uses bp_get_activity_directory_permalink()
- */
-function bp_activity_directory_permalink() {
-	echo esc_url( bp_get_activity_directory_permalink() );
-}
-	/**
-	 * Return activity directory permalink.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @uses trailingslashit()
-	 * @uses bp_get_root_domain()
-	 * @uses bp_get_activity_root_slug()
-	 * @uses apply_filters() To call the 'bp_get_activity_directory_permalink' hook.
-	 *
-	 * @return string Activity directory permalink.
-	 */
-	function bp_get_activity_directory_permalink() {
-
-		/**
-		 * Filters the activity directory permalink.
-		 *
-		 * @since 1.5.0
-		 *
-		 * @param string $url Permalink url for the activity directory.
-		 */
-		return apply_filters( 'bp_get_activity_directory_permalink', trailingslashit( bp_get_root_domain() . '/' . bp_get_activity_root_slug() ) );
-	}
-
-/**
  * The main activity template loop class.
  *
  * This is responsible for loading a group of activity items and displaying them.
@@ -503,4035 +407,3 @@
 		}
 	}
 }
-
-/**
- * Initialize the activity loop.
- *
- * Based on the $args passed, bp_has_activities() populates the
- * $activities_template global, enabling the use of BuddyPress templates and
- * template functions to display a list of activity items.
- *
- * @since 1.0.0
- * @since 2.4.0 Introduced the `$fields` parameter.
- *
- * @global object $activities_template {@link BP_Activity_Template}
- * @uses groups_is_user_member()
- * @uses bp_current_action()
- * @uses bp_is_current_action()
- * @uses bp_get_activity_slug()
- * @uses bp_action_variable()
- * @uses wp_parse_args()
- * @uses bp_is_active()
- * @uses friends_get_friend_user_ids()
- * @uses groups_get_user_groups()
- * @uses bp_activity_get_user_favorites()
- * @uses apply_filters() To call the 'bp_has_activities' hook.
- *
- * @param array|string $args {
- *     Arguments for limiting the contents of the activity loop. Most arguments
- *     are in the same format as {@link BP_Activity_Activity::get()}. However,
- *     because the format of the arguments accepted here differs in a number of
- *     ways, and because bp_has_activities() determines some default arguments in
- *     a dynamic fashion, we list all accepted arguments here as well.
- *
- *     Arguments can be passed as an associative array, or as a URL querystring
- *     (eg, 'user_id=4&display_comments=threaded').
- *
- *     @type int               $page             Which page of results to fetch. Using page=1 without per_page will result
- *                                               in no pagination. Default: 1.
- *     @type int|bool          $per_page         Number of results per page. Default: 20.
- *     @type string            $page_arg         String used as a query parameter in pagination links. Default: 'acpage'.
- *     @type int|bool          $max              Maximum number of results to return. Default: false (unlimited).
- *     @type string            $fields           Activity fields to retrieve. 'all' to fetch entire activity objects,
- *                                               'ids' to get only the activity IDs. Default 'all'.
- *     @type string|bool       $count_total      If true, an additional DB query is run to count the total activity items
- *                                               for the query. Default: false.
- *     @type string            $sort             'ASC' or 'DESC'. Default: 'DESC'.
- *     @type array|bool        $exclude          Array of activity IDs to exclude. Default: false.
- *     @type array|bool        $in               Array of IDs to limit query by (IN). 'in' is intended to be used in
- *                                               conjunction with other filter parameters. Default: false.
- *     @type array|bool        $include          Array of exact activity IDs to query. Providing an 'include' array will
- *                                               override all other filters passed in the argument array. When viewing the
- *                                               permalink page for a single activity item, this value defaults to the ID of
- *                                               that item. Otherwise the default is false.
- *     @type array             $meta_query       Limit by activitymeta by passing an array of meta_query conditions. See
- *                                               {@link WP_Meta_Query::queries} for a description of the syntax.
- *     @type array             $date_query       Limit by date by passing an array of date_query conditions. See first
- *                                               parameter of {@link WP_Date_Query::__construct()} for syntax.
- *     @type array             $filter_query     Advanced activity filtering.  See {@link BP_Activity_Query::__construct()}.
- *     @type string            $search_terms     Limit results by a search term. Default: false.
- *     @type string            $scope            Use a BuddyPress pre-built filter.
- *                                                 - 'just-me' retrieves items belonging only to a user; this is equivalent
- *                                                   to passing a 'user_id' argument.
- *                                                 - 'friends' retrieves items belonging to the friends of a user.
- *                                                 - 'groups' retrieves items belonging to groups to which a user belongs to.
- *                                                 - 'favorites' retrieves a user's favorited activity items.
- *                                                 - 'mentions' retrieves items where a user has received an @-mention.
- *                                               The default value of 'scope' is set to one of the above if that value
- *                                               appears in the appropriate place in the URL; eg, 'scope' will be 'groups'
- *                                               when visiting http://example.com/members/joe/activity/groups/. Otherwise
- *                                               defaults to false.
- *     @type int|array|bool    $user_id          The ID(s) of user(s) whose activity should be fetched. Pass a single ID or
- *                                               an array of IDs. When viewing a user profile page (but not that user's
- *                                               activity subpages, ie My Friends, My Groups, etc), 'user_id' defaults to
- *                                               the ID of the displayed user. Otherwise the default is false.
- *     @type string|array|bool $object           Filters by the `component` column in the database, which is generally the
- *                                               component ID in the case of BuddyPress components, or the plugin slug in
- *                                               the case of plugins. For example, 'groups' will limit results to those that
- *                                               are associated with the BP Groups component. Accepts a single component
- *                                               string, or an array of multiple components. Defaults to 'groups' when
- *                                               viewing the page of a single group, the My Groups activity filter, or the
- *                                               Activity > Groups filter of a user profile. Otherwise defaults to false.
- *     @type string|array|bool $action           Filters by the `type` column in the database, which is a string
- *                                               categorizing the activity item (eg, 'new_blog_post', 'created_group').
- *                                               Accepts a comma-delimited string or an array of types. Default: false.
- *     @type int|array|bool    $primary_id       Filters by the `item_id` column in the database. The meaning of
- *                                               'primary_id' differs between components/types; for example, in the case of
- *                                               'created_group', 'primary_id' is the ID of the group. Accepts a single ID,
- *                                               or an array of multiple IDs. When viewing a single group, defaults to the
- *                                               current group ID. When viewing a user's Groups stream page, defaults to the
- *                                               IDs of the user's groups. Otherwise defaults to false.
- *     @type int|array|bool    $secondary_id     Filters by the `secondary_item_id` column in the database. The meaning of
- *                                               'secondary_id' differs between components/types. Accepts a single ID, or an
- *                                               array of multiple IDs. Defaults to false.
- *     @type int               $offset           Return only activity items with an ID greater than or equal to this one.
- *                                               Note that providing an offset will disable pagination. Default: false.
- *     @type string|bool       $display_comments How to handle activity comments. Possible values:
- *                                                 - 'threaded' - comments appear in a threaded tree, under their parent
- *                                                   items.
- *                                                 - 'stream' - the activity stream is presented in a flat manner, with
- *                                                   comments sorted in chronological order alongside other activity items.
- *                                                 - false - don't fetch activity comments at all.
- *                                               Default: 'threaded'.
- *     @type bool              $show_hidden      Whether to show items marked hide_sitewide. Defaults to false, except in
- *                                               the following cases:
- *                                                 - User is viewing his own activity stream.
- *                                                 - User is viewing the activity stream of a non-public group of which he
- *                                                   is a member.
- *     @type string|bool       $spam             Spam status. 'ham_only', 'spam_only', or false to show all activity
- *                                               regardless of spam status. Default: 'ham_only'.
- *     @type bool              $populate_extras  Whether to pre-fetch the activity metadata for the queried items.
- *                                               Default: true.
- * }
- * @return bool Returns true when activities are found, otherwise false.
- */
-function bp_has_activities( $args = '' ) {
-	global $activities_template;
-
-	// Get BuddyPress.
-	$bp = buddypress();
-
-	/*
-	 * Smart Defaults.
-	 */
-
-	// User filtering.
-	$user_id = bp_displayed_user_id()
-		? bp_displayed_user_id()
-		: false;
-
-	// Group filtering.
-	if ( bp_is_group() ) {
-		$object      = $bp->groups->id;
-		$primary_id  = bp_get_current_group_id();
-		$show_hidden = (bool) ( groups_is_user_member( bp_loggedin_user_id(), $primary_id ) || bp_current_user_can( 'bp_moderate' ) );
-	} else {
-		$object      = false;
-		$primary_id  = false;
-		$show_hidden = false;
-	}
-
-	// The default scope should recognize custom slugs.
-	$scope = array_key_exists( bp_current_action(), (array) $bp->loaded_components )
-		? $bp->loaded_components[ bp_current_action() ]
-		: bp_current_action();
-
-	// Support for permalinks on single item pages: /groups/my-group/activity/124/.
-	$include = bp_is_current_action( bp_get_activity_slug() )
-		? bp_action_variable( 0 )
-		: false;
-
-	$search_terms_default = false;
-	$search_query_arg = bp_core_get_component_search_query_arg( 'activity' );
-	if ( ! empty( $_REQUEST[ $search_query_arg ] ) ) {
-		$search_terms_default = stripslashes( $_REQUEST[ $search_query_arg ] );
-	}
-
-	/*
-	 * Parse Args.
-	 */
-
-	// Note: any params used for filtering can be a single value, or multiple
-	// values comma separated.
-	$r = bp_parse_args( $args, 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 IDs comma-separated.
-		'exclude'           => false,        // Pass an activity_id or string of IDs comma-separated.
-		'in'                => false,        // Comma-separated list or array of activity IDs among which to search.
-		'sort'              => 'DESC',       // Sort DESC or ASC.
-		'page'              => 1,            // Which page to load.
-		'per_page'          => 20,           // Number of items per page.
-		'page_arg'          => 'acpage',     // See https://buddypress.trac.wordpress.org/ticket/3679.
-		'max'               => false,        // Max number to return.
-		'fields'            => 'all',
-		'count_total'       => false,
-		'show_hidden'       => $show_hidden, // Show activity items that are hidden site-wide?
-		'spam'              => 'ham_only',   // Hide spammed items.
-
-		// Scope - pre-built activity filters for a user (friends/groups/favorites/mentions).
-		'scope'             => $scope,
-
-		// 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.
-		'offset'            => false,        // Return only items >= this ID.
-		'since'             => false,        // Return only items recorded since this Y-m-d H:i:s date.
-
-		'meta_query'        => false,        // Filter on activity meta. See WP_Meta_Query for format.
-		'date_query'        => false,        // Filter by date. See first parameter of WP_Date_Query for format.
-		'filter_query'      => false,        // Advanced filtering.  See BP_Activity_Query for format.
-
-		// Searching.
-		'search_terms'      => $search_terms_default,
-		'update_meta_cache' => true,
-	), 'has_activities' );
-
-	/*
-	 * Smart Overrides.
-	 */
-
-	// Translate various values for 'display_comments'
-	// This allows disabling comments via ?display_comments=0
-	// or =none or =false. Final true is a strict type check. See #5029.
-	if ( in_array( $r['display_comments'], array( 0, '0', 'none', 'false' ), true ) ) {
-		$r['display_comments'] = false;
-	}
-
-	// Ignore pagination if an offset is passed.
-	if ( ! empty( $r['offset'] ) ) {
-		$r['page'] = 0;
-	}
-
-	// Search terms.
-	if ( ! empty( $_REQUEST['s'] ) && empty( $r['search_terms'] ) ) {
-		$r['search_terms'] = $_REQUEST['s'];
-	}
-
-	// Do not exceed the maximum per page.
-	if ( ! empty( $r['max'] ) && ( (int) $r['per_page'] > (int) $r['max'] ) ) {
-		$r['per_page'] = $r['max'];
-	}
-
-	/**
-	 * Filters whether BuddyPress should enable afilter support.
-	 *
-	 * Support for basic filters in earlier BP versions is disabled by default.
-	 * To enable, put add_filter( 'bp_activity_enable_afilter_support', '__return_true' );
-	 * into bp-custom.php or your theme's functions.php.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param bool $value True if BuddyPress should enable afilter support.
-	 */
-	if ( isset( $_GET['afilter'] ) && apply_filters( 'bp_activity_enable_afilter_support', false ) ) {
-		$r['filter'] = array(
-			'object' => $_GET['afilter']
-		);
-	} elseif ( ! empty( $r['user_id'] ) || ! empty( $r['object'] ) || ! empty( $r['action'] ) || ! empty( $r['primary_id'] ) || ! empty( $r['secondary_id'] ) || ! empty( $r['offset'] ) || ! empty( $r['since'] ) ) {
-		$r['filter'] = array(
-			'user_id'      => $r['user_id'],
-			'object'       => $r['object'],
-			'action'       => $r['action'],
-			'primary_id'   => $r['primary_id'],
-			'secondary_id' => $r['secondary_id'],
-			'offset'       => $r['offset'],
-			'since'        => $r['since']
-		);
-	} else {
-		$r['filter'] = false;
-	}
-
-	// If specific activity items have been requested, override the $hide_spam
-	// argument. This prevents backpat errors with AJAX.
-	if ( ! empty( $r['include'] ) && ( 'ham_only' === $r['spam'] ) ) {
-		$r['spam'] = 'all';
-	}
-
-	/*
-	 * Query
-	 */
-
-	$activities_template = new BP_Activity_Template( $r );
-
-	/**
-	 * Filters whether or not there are activity items to display.
-	 *
-	 * @since 1.1.0
-	 *
-	 * @param bool   $value               Whether or not there are activity items to display.
-	 * @param string $activities_template Current activities template being used.
-	 * @param array  $r                   Array of arguments passed into the BP_Activity_Template class.
-	 */
-	return apply_filters( 'bp_has_activities', $activities_template->has_activities(), $activities_template, $r );
-}
-
-/**
- * Determine if there are still activities left in the loop.
- *
- * @since 1.0.0
- *
- * @global object $activities_template {@link BP_Activity_Template}
- * @uses BP_Activity_Template::user_activities() {@link BP_Activity_Template::user_activities()}
- *
- * @return bool Returns true when activities are found.
- */
-function bp_activities() {
-	global $activities_template;
-	return $activities_template->user_activities();
-}
-
-/**
- * Get the current activity object in the loop.
- *
- * @since 1.0.0
- *
- * @global object $activities_template {@link BP_Activity_Template}
- * @uses BP_Activity_Template::the_activity() {@link BP_Activity_Template::the_activity()}
- *
- * @return object The current activity within the loop.
- */
-function bp_the_activity() {
-	global $activities_template;
-	return $activities_template->the_activity();
-}
-
-/**
- * Output the URL for the Load More link.
- *
- * @since 2.1.0
- */
-function bp_activity_load_more_link() {
-	echo esc_url( bp_get_activity_load_more_link() );
-}
-	/**
-	 * Get the URL for the Load More link.
-	 *
-	 * @since 2.1.0
-	 *
-	 * @return string $link
-	 */
-	function bp_get_activity_load_more_link() {
-		global $activities_template;
-
-		$url  = bp_get_requested_url();
-		$link = add_query_arg( $activities_template->pag_arg, $activities_template->pag_page + 1, $url );
-
-		/**
-		 * Filters the Load More link URL.
-		 *
-		 * @since 2.1.0
-		 *
-		 * @param string $link                The "Load More" link URL with appropriate query args.
-		 * @param string $url                 The original URL.
-		 * @param object $activities_template The activity template loop global.
-		 */
-		return apply_filters( 'bp_get_activity_load_more_link', $link, $url, $activities_template );
-	}
-
-/**
- * Output the activity pagination count.
- *
- * @since 1.0.0
- *
- * @global object $activities_template {@link BP_Activity_Template}
- * @uses BP_Activity_Template::the_activity() {@link BP_Activity_Template::the_activity()}
- */
-function bp_activity_pagination_count() {
-	echo bp_get_activity_pagination_count();
-}
-
-	/**
-	 * Return the activity pagination count.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses bp_core_number_format()
-	 *
-	 * @return string The pagination text.
-	 */
-	function bp_get_activity_pagination_count() {
-		global $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 );
-
-		if ( 1 == $activities_template->total_activity_count ) {
-			$message = __( 'Viewing 1 item', 'buddypress' );
-		} else {
-			$message = sprintf( _n( 'Viewing %1$s - %2$s of %3$s item', 'Viewing %1$s - %2$s of %3$s items', $activities_template->total_activity_count, 'buddypress' ), $from_num, $to_num, $total );
-		}
-
-		return $message;
-	}
-
-/**
- * Output the activity pagination links.
- *
- * @since 1.0.0
- *
- * @uses bp_get_activity_pagination_links()
- */
-function bp_activity_pagination_links() {
-	echo bp_get_activity_pagination_links();
-}
-
-	/**
-	 * Return the activity pagination links.
-	 *
-	 * @since 1.0.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_pagination_links' hook.
-	 *
-	 * @return string The pagination links.
-	 */
-	function bp_get_activity_pagination_links() {
-		global $activities_template;
-
-		/**
-		 * Filters the activity pagination link output.
-		 *
-		 * @since 1.0.0
-		 *
-		 * @param string $pag_links Output for the activity pagination links.
-		 */
-		return apply_filters( 'bp_get_activity_pagination_links', $activities_template->pag_links );
-	}
-
-/**
- * Return true when there are more activity items to be shown than currently appear.
- *
- * @since 1.5.0
- *
- * @global object $activities_template {@link BP_Activity_Template}
- * @uses apply_filters() To call the 'bp_activity_has_more_items' hook.
- *
- * @return bool $has_more_items True if more items, false if not.
- */
-function bp_activity_has_more_items() {
-	global $activities_template;
-
-	if ( ! empty( $activities_template->has_more_items )  ) {
-		$has_more_items = true;
-	} else {
-		$remaining_pages = 0;
-
-		if ( ! empty( $activities_template->pag_page ) ) {
-			$remaining_pages = floor( ( $activities_template->total_activity_count - 1 ) / ( $activities_template->pag_num * $activities_template->pag_page ) );
-		}
-
-		$has_more_items = (int) $remaining_pages > 0;
-	}
-
-	/**
-	 * Filters whether there are more activity items to display.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @param bool $has_more_items Whether or not there are more activity items to display.
-	 */
-	return apply_filters( 'bp_activity_has_more_items', $has_more_items );
-}
-
-/**
- * Output the activity count.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_count()
- */
-function bp_activity_count() {
-	echo bp_get_activity_count();
-}
-
-	/**
-	 * Return the activity count.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_count' hook.
-	 *
-	 * @return int The activity count.
-	 */
-	function bp_get_activity_count() {
-		global $activities_template;
-
-		/**
-		 * Filters the activity count for the activity template.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param int $activity_count The count for total activity.
-		 */
-		return apply_filters( 'bp_get_activity_count', (int) $activities_template->activity_count );
-	}
-
-/**
- * Output the number of activities per page.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_per_page()
- */
-function bp_activity_per_page() {
-	echo bp_get_activity_per_page();
-}
-
-	/**
-	 * Return the number of activities per page.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_per_page' hook.
-	 *
-	 * @return int The activities per page.
-	 */
-	function bp_get_activity_per_page() {
-		global $activities_template;
-
-		/**
-		 * Filters the activity posts per page value.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param int $pag_num How many post should be displayed for pagination.
-		 */
-		return apply_filters( 'bp_get_activity_per_page', (int) $activities_template->pag_num );
-	}
-
-/**
- * Output the activities title.
- *
- * @since 1.0.0
- *
- * @uses bp_get_activities_title()
- * @todo Deprecate.
- */
-function bp_activities_title() {
-	echo bp_get_activities_title();
-}
-
-	/**
-	 * Return the activities title.
-	 *
-	 * @since 1.0.0
-	 *
-	 * @global string $bp_activity_title
-	 * @uses apply_filters() To call the 'bp_get_activities_title' hook.
-	 * @todo Deprecate.
-	 *
-	 * @return string The activities title.
-	 */
-	function bp_get_activities_title() {
-		global $bp_activity_title;
-
-		/**
-		 * Filters the activities title for the activity template.
-		 *
-		 * @since 1.0.0
-		 *
-		 * @param string $bp_activity_title The title to be displayed.
-		 */
-		return apply_filters( 'bp_get_activities_title', $bp_activity_title );
-	}
-
-/**
- * {@internal Missing Description}
- *
- * @since 1.0.0
- *
- * @uses bp_get_activities_no_activity()
- * @todo Deprecate.
- */
-function bp_activities_no_activity() {
-	echo bp_get_activities_no_activity();
-}
-
-	/**
-	 * {@internal Missing Description}
-	 *
-	 * @since 1.0.0
-	 *
-	 * @global string $bp_activity_no_activity
-	 * @uses apply_filters() To call the 'bp_get_activities_no_activity' hook.
-	 * @todo Deprecate.
-	 *
-	 * @return string
-	 */
-	function bp_get_activities_no_activity() {
-		global $bp_activity_no_activity;
-
-		/**
-		 * Filters the text used when there is no activity to display.
-		 *
-		 * @since 1.0.0
-		 *
-		 * @param string $bp_activity_no_activity Text to display for no activity.
-		 */
-		return apply_filters( 'bp_get_activities_no_activity', $bp_activity_no_activity );
-	}
-
-/**
- * Output the activity ID.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_id()
- */
-function bp_activity_id() {
-	echo bp_get_activity_id();
-}
-
-	/**
-	 * Return the activity ID.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_id' hook.
-	 *
-	 * @return int The activity ID.
-	 */
-	function bp_get_activity_id() {
-		global $activities_template;
-
-		/**
-		 * Filters the activity ID being displayed.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param int $id The activity ID.
-		 */
-		return apply_filters( 'bp_get_activity_id', $activities_template->activity->id );
-	}
-
-/**
- * Output the activity item ID.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_item_id()
- */
-function bp_activity_item_id() {
-	echo bp_get_activity_item_id();
-}
-
-	/**
-	 * Return the activity item ID.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_item_id' hook.
-	 *
-	 * @return int The activity item ID.
-	 */
-	function bp_get_activity_item_id() {
-		global $activities_template;
-
-		/**
-		 * Filters the activity item ID being displayed.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param int $item_id The activity item ID.
-		 */
-		return apply_filters( 'bp_get_activity_item_id', $activities_template->activity->item_id );
-	}
-
-/**
- * Output the activity secondary item ID.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_secondary_item_id()
- */
-function bp_activity_secondary_item_id() {
-	echo bp_get_activity_secondary_item_id();
-}
-
-	/**
-	 * Return the activity secondary item ID.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_secondary_item_id' hook.
-	 *
-	 * @return int The activity secondary item ID.
-	 */
-	function bp_get_activity_secondary_item_id() {
-		global $activities_template;
-
-		/**
-		 * Filters the activity secondary item ID being displayed.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param int $secondary_item_id The activity secondary item ID.
-		 */
-		return apply_filters( 'bp_get_activity_secondary_item_id', $activities_template->activity->secondary_item_id );
-	}
-
-/**
- * Output the date the activity was recorded.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_date_recorded()
- */
-function bp_activity_date_recorded() {
-	echo bp_get_activity_date_recorded();
-}
-
-	/**
-	 * Return the date the activity was recorded.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_date_recorded' hook.
-	 *
-	 * @return string The date the activity was recorded.
-	 */
-	function bp_get_activity_date_recorded() {
-		global $activities_template;
-
-		/**
-		 * Filters the date the activity was recorded.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param int $date_recorded The activity's date.
-		 */
-		return apply_filters( 'bp_get_activity_date_recorded', $activities_template->activity->date_recorded );
-	}
-
-/**
- * Output the display name of the member who posted the activity.
- *
- * @since 2.1.0
- *
- * @uses bp_get_activity_member_display_name()
- */
-function bp_activity_member_display_name() {
-	echo bp_get_activity_member_display_name();
-}
-
-	/**
-	 * Return the display name of the member who posted the activity.
-	 *
-	 * @since 2.1.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_member_display_name' hook.
-	 *
-	 * @return string The date the activity was recorded.
-	 */
-	function bp_get_activity_member_display_name() {
-		global $activities_template;
-
-		$retval = isset( $activities_template->activity->display_name )
-			? $activities_template->activity->display_name
-			: '';
-
-		/**
-		 * Filters the display name of the member who posted the activity.
-		 *
-		 * @since 2.1.0
-		 *
-		 * @param int $retval Display name for the member who posted.
-		 */
-		return apply_filters( 'bp_get_activity_member_display_name', $retval );
-	}
-
-/**
- * Output the activity object name.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_object_name()
- */
-function bp_activity_object_name() {
-	echo bp_get_activity_object_name();
-}
-
-	/**
-	 * Return the activity object name.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_object_name' hook.
-	 *
-	 * @return string The activity object name.
-	 */
-	function bp_get_activity_object_name() {
-		global $activities_template;
-
-		/**
-		 * Filters the activity object name.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string $activity_component The activity object name.
-		 */
-		return apply_filters( 'bp_get_activity_object_name', $activities_template->activity->component );
-	}
-
-/**
- * Output the activity type.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_type()
- */
-function bp_activity_type() {
-	echo bp_get_activity_type();
-}
-
-	/**
-	 * Return the activity type.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_type' hook.
-	 *
-	 * @return string The activity type.
-	 */
-	function bp_get_activity_type() {
-		global $activities_template;
-
-		/**
-		 * Filters the activity type.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string $activity_type The activity type.
-		 */
-		return apply_filters( 'bp_get_activity_type', $activities_template->activity->type );
-	}
-
-	/**
-	 * Output the activity action name.
-	 *
-	 * Just a wrapper for bp_activity_type().
-	 *
-	 * @since 1.2.0
-	 * @deprecated 1.5.0
-	 *
-	 * @todo Properly deprecate in favor of bp_activity_type() and
-	 *       remove redundant echo
-	 *
-	 * @uses bp_activity_type()
-	 */
-	function bp_activity_action_name() { echo bp_activity_type(); }
-
-	/**
-	 * Return the activity type.
-	 *
-	 * Just a wrapper for bp_get_activity_type().
-	 *
-	 * @since 1.2.0
-	 * @deprecated 1.5.0
-	 *
-	 * @todo Properly deprecate in favor of bp_get_activity_type().
-	 *
-	 * @uses bp_get_activity_type()
-	 *
-	 * @return string The activity type.
-	 */
-	function bp_get_activity_action_name() { return bp_get_activity_type(); }
-
-/**
- * Output the activity user ID.
- *
- * @since 1.1.0
- *
- * @uses bp_get_activity_user_id()
- */
-function bp_activity_user_id() {
-	echo bp_get_activity_user_id();
-}
-
-	/**
-	 * Return the activity user ID.
-	 *
-	 * @since 1.1.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_user_id' hook.
-	 *
-	 * @return int The activity user ID.
-	 */
-	function bp_get_activity_user_id() {
-		global $activities_template;
-
-		/**
-		 * Filters the activity user ID.
-		 *
-		 * @since 1.1.0
-		 *
-		 * @param int $user_id The activity user ID.
-		 */
-		return apply_filters( 'bp_get_activity_user_id', $activities_template->activity->user_id );
-	}
-
-/**
- * Output the activity user link.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_user_link()
- */
-function bp_activity_user_link() {
-	echo bp_get_activity_user_link();
-}
-
-	/**
-	 * Return the activity user link.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses bp_core_get_user_domain()
-	 * @uses apply_filters() To call the 'bp_get_activity_user_link' hook.
-	 *
-	 * @return string $link The activity user link.
-	 */
-	function bp_get_activity_user_link() {
-		global $activities_template;
-
-		if ( empty( $activities_template->activity->user_id ) || empty( $activities_template->activity->user_nicename ) || empty( $activities_template->activity->user_login ) ) {
-			$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 );
-		}
-
-		/**
-		 * Filters the activity user link.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string $link The activity user link.
-		 */
-		return apply_filters( 'bp_get_activity_user_link', $link );
-	}
-
-/**
- * Output the avatar of the user that performed the action.
- *
- * @since 1.1.0
- *
- * @see bp_get_activity_avatar() for description of arguments.
- * @uses bp_get_activity_avatar()
- *
- * @param array|string $args See {@link bp_get_activity_avatar()} for description.
- */
-function bp_activity_avatar( $args = '' ) {
-	echo bp_get_activity_avatar( $args );
-}
-	/**
-	 * Return the avatar of the user that performed the action.
-	 *
-	 * @since 1.1.0
-	 *
-	 * @see bp_core_fetch_avatar() For a description of the arguments.
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses bp_is_single_activity()
-	 * @uses wp_parse_args()
-	 * @uses apply_filters() To call the 'bp_get_activity_avatar_object_' . $current_activity_item->component hook.
-	 * @uses apply_filters() To call the 'bp_get_activity_avatar_item_id' hook.
-	 * @uses bp_core_fetch_avatar()
-	 * @uses apply_filters() To call the 'bp_get_activity_avatar' hook.
-	 *
-	 * @param array|string $args  {
-	 *     Arguments are listed here with an explanation of their defaults.
-	 *     For more information about the arguments, see
-	 *     {@link bp_core_fetch_avatar()}.
-	 *     @type string      $alt     Default: 'Profile picture of [user name]' if
-	 *                                activity user name is available, otherwise 'Profile picture'.
-	 *     @type string      $class   Default: 'avatar'.
-	 *     @type string|bool $email   Default: Email of the activity's
-	 *                                associated user, if available. Otherwise false.
-	 *     @type string      $type    Default: 'full' when viewing a single activity
-	 *                                permalink page, otherwise 'thumb'.
-	 *     @type int|bool    $user_id Default: ID of the activity's user.
-	 * }
-	 * @return string User avatar string.
-	 */
-	function bp_get_activity_avatar( $args = '' ) {
-		global $activities_template;
-
-		$bp = buddypress();
-
-		// On activity permalink pages, default to the full-size avatar.
-		$type_default = bp_is_single_activity() ? 'full' : 'thumb';
-
-		// Within the activity comment loop, the current activity should be set
-		// to current_comment. Otherwise, just use activity.
-		$current_activity_item = isset( $activities_template->activity->current_comment ) ? $activities_template->activity->current_comment : $activities_template->activity;
-
-		// Activity user display name.
-		$dn_default  = isset( $current_activity_item->display_name ) ? $current_activity_item->display_name : '';
-
-		// Prepend some descriptive text to alt.
-		$alt_default = !empty( $dn_default ) ? sprintf( __( 'Profile picture of %s', 'buddypress' ), $dn_default ) : __( 'Profile picture', 'buddypress' );
-
-		$defaults = array(
-			'alt'     => $alt_default,
-			'class'   => 'avatar',
-			'email'   => false,
-			'type'    => $type_default,
-			'user_id' => false
-		);
-
-		$r = wp_parse_args( $args, $defaults );
-		extract( $r, EXTR_SKIP );
-
-		if ( !isset( $height ) && !isset( $width ) ) {
-
-			// Backpat.
-			if ( isset( $bp->avatar->full->height ) || isset( $bp->avatar->thumb->height ) ) {
-				$height = ( 'full' == $type ) ? $bp->avatar->full->height : $bp->avatar->thumb->height;
-			} else {
-				$height = 20;
-			}
-
-			// Backpat.
-			if ( isset( $bp->avatar->full->width ) || isset( $bp->avatar->thumb->width ) ) {
-				$width = ( 'full' == $type ) ? $bp->avatar->full->width : $bp->avatar->thumb->width;
-			} else {
-				$width = 20;
-			}
-		}
-
-		/**
-		 * Filters the activity avatar object based on current activity item component.
-		 *
-		 * This is a variable filter dependent on the component used.
-		 * Possible hooks are bp_get_activity_avatar_object_blog,
-		 * bp_get_activity_avatar_object_group, and bp_get_activity_avatar_object_user.
-		 *
-		 * @since 1.1.0
-		 *
-		 * @param string $component Component being displayed.
-		 */
-		$object  = apply_filters( 'bp_get_activity_avatar_object_' . $current_activity_item->component, 'user' );
-		$item_id = !empty( $user_id ) ? $user_id : $current_activity_item->user_id;
-
-		/**
-		 * Filters the activity avatar item ID.
-		 *
-		 * @since 1.2.10
-		 *
-		 * @param int $item_id Item ID for the activity avatar.
-		 */
-		$item_id = apply_filters( 'bp_get_activity_avatar_item_id', $item_id );
-
-		// If this is a user object pass the users' email address for Gravatar so we don't have to prefetch it.
-		if ( 'user' == $object && empty( $user_id ) && empty( $email ) && isset( $current_activity_item->user_email ) ) {
-			$email = $current_activity_item->user_email;
-		}
-
-		/**
-		 * Filters the value returned by bp_core_fetch_avatar.
-		 *
-		 * @since 1.1.3
-		 *
-		 * @param array $value Array of arguments calculated for use with bp_core_fetch_avatar.
-		 */
-		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
-		) ) );
-	}
-
-/**
- * Output the avatar of the object that action was performed on.
- *
- * @since 1.2.0
- *
- * @see bp_get_activity_secondary_avatar() for description of arguments.
- * @uses bp_get_activity_secondary_avatar()
- *
- * @param array|string $args See {@link bp_get_activity_secondary_avatar} for description.
- */
-function bp_activity_secondary_avatar( $args = '' ) {
-	echo bp_get_activity_secondary_avatar( $args );
-}
-
-	/**
-	 * Return the avatar of the object that action was performed on.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @see bp_core_fetch_avatar() for description of arguments.
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses wp_parse_args()
-	 * @uses get_blog_option()
-	 * @uses apply_filters() To call the 'bp_get_activity_secondary_avatar_object_' . $activities_template->activity->component hook.
-	 * @uses apply_filters() To call the 'bp_get_activity_secondary_avatar_item_id' hook.
-	 * @uses bp_core_fetch_avatar()
-	 * @uses apply_filters() To call the 'bp_get_activity_secondary_avatar' hook.
-	 *
-	 * @param array|string $args  {
-	 *     For a complete description of arguments, see {@link bp_core_fetch_avatar()}.
-	 *     @type string      $alt     Default value varies based on current activity
-	 *                                item component.
-	 *     @type string      $type    Default: 'full' when viewing a single activity
-	 *                                permalink page, otherwise 'thumb'.
-	 *     @type string      $class   Default: 'avatar'.
-	 *     @type string|bool $email   Default: email of the activity's user.
-	 *     @type int|bool    $user_id Default: ID of the activity's user.
-	 * }
-	 * @return string The secondary avatar.
-	 */
-	function bp_get_activity_secondary_avatar( $args = '' ) {
-		global $activities_template;
-
-		$r = wp_parse_args( $args, array(
-			'alt'        => '',
-			'type'       => 'thumb',
-			'width'      => 20,
-			'height'     => 20,
-			'class'      => 'avatar',
-			'link_class' => '',
-			'linked'     => true,
-			'email'      => false
-		) );
-		extract( $r, EXTR_SKIP );
-
-		// Set item_id and object (default to user).
-		switch ( $activities_template->activity->component ) {
-			case 'groups' :
-				if ( bp_disable_group_avatar_uploads() ) {
-					return false;
-				}
-
-				$object  = 'group';
-				$item_id = $activities_template->activity->item_id;
-				$link    = '';
-				$name    = '';
-
-				// Only if groups is active.
-				if ( bp_is_active( 'groups' ) ) {
-					$group = groups_get_group( array(
-						'group_id'          => $item_id,
-						'populate_extras'   => false,
-						'update_meta_cache' => false,
-					) );
-					$link  = bp_get_group_permalink( $group );
-					$name  = $group->name;
-				}
-
-				if ( empty( $alt ) ) {
-					$alt = __( 'Group logo', 'buddypress' );
-
-					if ( ! empty( $name ) ) {
-						$alt = sprintf( __( 'Group logo of %s', 'buddypress' ), $name );
-					}
-				}
-
-				break;
-			case 'blogs' :
-				$object  = 'blog';
-				$item_id = $activities_template->activity->item_id;
-				$link    = home_url();
-
-				if ( empty( $alt ) ) {
-					$alt = sprintf( __( 'Profile picture of the author of the site %s', 'buddypress' ), get_blog_option( $item_id, 'blogname' ) );
-				}
-
-				break;
-			case 'friends' :
-				$object  = 'user';
-				$item_id = $activities_template->activity->secondary_item_id;
-				$link    = bp_core_get_userlink( $item_id, false, true );
-
-				if ( empty( $alt ) ) {
-					$alt = sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_core_get_user_displayname( $activities_template->activity->secondary_item_id ) );
-				}
-
-				break;
-			default :
-				$object  = 'user';
-				$item_id = $activities_template->activity->user_id;
-				$email   = $activities_template->activity->user_email;
-				$link    = bp_core_get_userlink( $item_id, false, true );
-
-				if ( empty( $alt ) ) {
-					$alt = sprintf( __( 'Profile picture of %s', 'buddypress' ), $activities_template->activity->display_name );
-				}
-
-				break;
-		}
-
-		/**
-		 * Filters the activity secondary avatar object based on current activity item component.
-		 *
-		 * This is a variable filter dependent on the component used. Possible hooks are
-		 * bp_get_activity_secondary_avatar_object_blog, bp_get_activity_secondary_avatar_object_group,
-		 * and bp_get_activity_secondary_avatar_object_user.
-		 *
-		 * @since 1.2.10
-		 *
-		 * @param string $object Component being displayed.
-		 */
-		$object  = apply_filters( 'bp_get_activity_secondary_avatar_object_' . $activities_template->activity->component, $object );
-
-		/**
-		 * Filters the activity secondary avatar item ID.
-		 *
-		 * @since 1.2.10
-		 *
-		 * @param int $item_id ID for the secondary avatar item.
-		 */
-		$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;
-		}
-
-		// Get the avatar.
-		$avatar = bp_core_fetch_avatar( array(
-			'item_id' => $item_id,
-			'object'  => $object,
-			'type'    => $type,
-			'alt'     => $alt,
-			'class'   => $class,
-			'width'   => $width,
-			'height'  => $height,
-			'email'   => $email
-		) );
-
-		if ( !empty( $linked ) ) {
-
-			/**
-			 * Filters the secondary avatar link for current activity.
-			 *
-			 * @since 1.7.0
-			 *
-			 * @param string $link      Link to wrap the avatar image in.
-			 * @param string $component Activity component being acted on.
-			 */
-			$link = apply_filters( 'bp_get_activity_secondary_avatar_link', $link, $activities_template->activity->component );
-
-			/**
-			 * Filters the determined avatar for the secondary activity item.
-			 *
-			 * @since 1.2.10
-			 *
-			 * @param string $avatar Formatted HTML <img> element, or raw avatar URL.
-			 */
-			$avatar = apply_filters( 'bp_get_activity_secondary_avatar', $avatar );
-
-			return sprintf( '<a href="%s" class="%s">%s</a>',
-				$link,
-				$link_class,
-				$avatar
-			);
-		}
-
-		/** This filter is documented in bp-activity/bp-activity-template.php */
-		return apply_filters( 'bp_get_activity_secondary_avatar', $avatar );
-	}
-
-/**
- * Output the activity action.
- *
- * @since 1.2.0
- *
- * @param array $args See bp_get_activity_action().
- * @uses bp_get_activity_action()
- */
-function bp_activity_action( $args = array() ) {
-	echo bp_get_activity_action( $args );
-}
-
-	/**
-	 * Return the activity action.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters_ref_array() To call the 'bp_get_activity_action_pre_meta' hook.
-	 * @uses bp_insert_activity_meta()
-	 * @uses apply_filters_ref_array() To call the 'bp_get_activity_action' hook.
-	 *
-	 * @param array $args {
-	 *     @type bool $no_timestamp Whether to exclude the timestamp.
-	 * }
-	 *
-	 * @return string The activity action.
-	 */
-	function bp_get_activity_action( $args = array() ) {
-		global $activities_template;
-
-		$r = wp_parse_args( $args, array(
-			'no_timestamp' => false,
-		) );
-
-		/**
-		 * Filters the activity action before the action is inserted as meta.
-		 *
-		 * @since 1.2.10
-		 *
-		 * @param array $value Array containing the current action, the current activity, and the $args array passed into the function.
-		 */
-		$action = apply_filters_ref_array( 'bp_get_activity_action_pre_meta', array(
-			$activities_template->activity->action,
-			&$activities_template->activity,
-			$r
-		) );
-
-		// Prepend the activity action meta (link, time since, etc...).
-		if ( ! empty( $action ) && empty( $r['no_timestamp'] ) ) {
-			$action = bp_insert_activity_meta( $action );
-		}
-
-		/**
-		 * Filters the activity action after the action has been inserted as meta.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param array $value Array containing the current action, the current activity, and the $args array passed into the function.
-		 */
-		return apply_filters_ref_array( 'bp_get_activity_action', array(
-			$action,
-			&$activities_template->activity,
-			$r
-		) );
-	}
-
-/**
- * Output the activity content body.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_content_body()
- */
-function bp_activity_content_body() {
-	echo bp_get_activity_content_body();
-}
-
-	/**
-	 * Return the activity content body.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses bp_insert_activity_meta()
-	 * @uses apply_filters_ref_array() To call the 'bp_get_activity_content_body' hook.
-	 *
-	 * @return string The 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 );
-		}
-
-		/**
-		 * Filters the activity content body.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param array $value Array containing the current activity content body and the current activity.
-		 */
-		return apply_filters_ref_array( 'bp_get_activity_content_body', array( $activities_template->activity->content, &$activities_template->activity ) );
-	}
-
-/**
- * Does the activity have content?
- *
- * @since 1.2.0
- *
- * @global object $activities_template {@link BP_Activity_Template}
- *
- * @return bool True if activity has content, false otherwise.
- */
-function bp_activity_has_content() {
-	global $activities_template;
-
-	if ( ! empty( $activities_template->activity->content ) ) {
-		return true;
-	}
-
-	return false;
-}
-
-/**
- * Output the activity content.
- *
- * @since 1.0.0
- * @deprecated 1.5.0
- *
- * @todo properly deprecate this function.
- *
- * @uses bp_get_activity_content()
- */
-function bp_activity_content() {
-	echo bp_get_activity_content();
-}
-
-	/**
-	 * Return the activity content.
-	 *
-	 * @since 1.0.0
-	 * @deprecated 1.5.0
-	 *
-	 * @todo properly deprecate this function.
-	 *
-	 * @uses bp_get_activity_action()
-	 * @uses bp_get_activity_content_body()
-	 * @uses apply_filters() To call the 'bp_get_activity_content' hook.
-	 *
-	 * @return string The activity content.
-	 */
-	function bp_get_activity_content() {
-
-		/**
-		 * If you want to filter activity update content, please use
-		 * the filter 'bp_get_activity_content_body'.
-		 *
-		 * This function is mainly for backwards compatibility.
-		 */
-		$content = bp_get_activity_action() . ' ' . bp_get_activity_content_body();
-		return apply_filters( 'bp_get_activity_content', $content );
-	}
-
-/**
- * Attach metadata about an activity item to the activity content.
- *
- * This metadata includes the time since the item was posted (which will appear
- * as a link to the item's permalink).
- *
- * @since 1.2.0
- *
- * @global object $activities_template {@link BP_Activity_Template}
- * @uses bp_core_time_since()
- * @uses apply_filters_ref_array() To call the 'bp_activity_time_since' hook.
- * @uses bp_is_single_activity()
- * @uses bp_activity_get_permalink()
- * @uses esc_attr__()
- * @uses apply_filters_ref_array() To call the 'bp_activity_permalink' hook.
- * @uses apply_filters() To call the 'bp_insert_activity_meta' hook.
- *
- * @param string $content The activity content.
- * @return string The activity content with the metadata string attached.
- */
-function bp_insert_activity_meta( $content = '' ) {
-	global $activities_template;
-
-	// Strip any legacy time since placeholders from BP 1.0-1.1.
-	$new_content = str_replace( '<span class="time-since">%s</span>', '', $content );
-
-	// Get the time since this activity was recorded.
-	$date_recorded  = bp_core_time_since( $activities_template->activity->date_recorded );
-
-	/**
-	 * Filters the activity item time since markup.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @param array $value Array containing the time since markup and the current activity component.
-	 */
-	$time_since = apply_filters_ref_array( 'bp_activity_time_since', array(
-		'<span class="time-since">' . $date_recorded . '</span>',
-		&$activities_template->activity
-	) );
-
-	// Insert the permalink.
-	if ( ! bp_is_single_activity() ) {
-
-		// Setup variables for activity meta.
-		$activity_permalink = bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity );
-		$activity_meta      = sprintf( '%1$s <a href="%2$s" class="view activity-time-since" title="%3$s">%4$s</a>',
-			$new_content,
-			$activity_permalink,
-			esc_attr__( 'View Discussion', 'buddypress' ),
-			$time_since
-		);
-
-		/**
-		 * Filters the activity permalink to be added to the activity content.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param array $value Array containing the html markup for the activity permalink, after being parsed by
-		 *                     sprintf and current activity component.
-		 */
-		$new_content = apply_filters_ref_array( 'bp_activity_permalink', array(
-			$activity_meta,
-			&$activities_template->activity
-		) );
-	} else {
-		$new_content .= str_pad( $time_since, strlen( $time_since ) + 2, ' ', STR_PAD_BOTH );
-	}
-
-	/**
-	 * Filters the activity content after activity metadata has been attached.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @param string $content Activity content with the activity metadata added.
-	 */
-	return apply_filters( 'bp_insert_activity_meta', $new_content, $content );
-}
-
-/**
- * Determine if the current user can delete an activity item.
- *
- * @since 1.2.0
- *
- * @global object $activities_template {@link BP_Activity_Template}
- * @uses apply_filters() To call the 'bp_activity_user_can_delete' hook.
- *
- * @param object|bool $activity Optional. Falls back on the current item in the loop.
- * @return bool True if can delete, false otherwise.
- */
-function bp_activity_user_can_delete( $activity = false ) {
-	global $activities_template;
-
-	// Try to use current activity if none was passed.
-	if ( empty( $activity ) && ! empty( $activities_template->activity ) ) {
-		$activity = $activities_template->activity;
-	}
-
-	// If current_comment is set, we'll use that in place of the main activity.
-	if ( isset( $activity->current_comment ) ) {
-		$activity = $activity->current_comment;
-	}
-
-	// Assume the user cannot delete the activity item.
-	$can_delete = false;
-
-	// Only logged in users can delete activity.
-	if ( is_user_logged_in() ) {
-
-		// Community moderators can always delete activity (at least for now).
-		if ( bp_current_user_can( 'bp_moderate' ) ) {
-			$can_delete = true;
-		}
-
-		// Users are allowed to delete their own activity. This is actually
-		// quite powerful, because doing so also deletes all comments to that
-		// activity item. We should revisit this eventually.
-		if ( isset( $activity->user_id ) && ( (int) $activity->user_id === bp_loggedin_user_id() ) ) {
-			$can_delete = true;
-		}
-
-		// Viewing a single item, and this user is an admin of that item.
-		if ( bp_is_single_item() && bp_is_item_admin() ) {
-			$can_delete = true;
-		}
-	}
-
-	/**
-	 * Filters whether the current user can delete an activity item.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @param bool   $can_delete Whether the user can delete the item.
-	 * @param object $activity   Current activity item object.
-	 */
-	return (bool) apply_filters( 'bp_activity_user_can_delete', $can_delete, $activity );
-}
-
-/**
- * Output the activity parent content.
- *
- * @since 1.2.0
- *
- * @see bp_get_activity_parent_content() for a description of arguments.
- * @uses bp_get_activity_parent_content()
- *
- * @param array|string $args See {@link bp_get_activity_parent_content} for description.
- */
-function bp_activity_parent_content( $args = '' ) {
-	echo bp_get_activity_parent_content($args);
-}
-
-	/**
-	 * Return the activity content.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_parent_content' hook.
-	 *
-	 * @param string $args Unused. Left over from an earlier implementation.
-	 * @return mixed False on failure, otherwise the activity parent content.
-	 */
-	function bp_get_activity_parent_content( $args = '' ) {
-		global $activities_template;
-
-		// Bail if no activity on no item ID.
-		if ( empty( $activities_template->activity ) || empty( $activities_template->activity->item_id ) ) {
-			return false;
-		}
-
-		// Get the ID of the parent activity content.
-		$parent_id = (int) $activities_template->activity->item_id;
-
-		// Bail if no parent content.
-		if ( empty( $activities_template->activity_parents[ $parent_id ] ) ) {
-			return false;
-		}
-
-		// Bail if no action.
-		if ( empty( $activities_template->activity_parents[ $parent_id ]->action ) ) {
-			return false;
-		}
-
-		// Content always includes action.
-		$content = $activities_template->activity_parents[ $parent_id ]->action;
-
-		// Maybe append activity content, if it exists.
-		if ( ! empty( $activities_template->activity_parents[ $parent_id ]->content ) ) {
-			$content .= ' ' . $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 );
-
-		/**
-		 * Filters the activity parent content.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string $content Content set to be displayed as parent content.
-		 */
-		return apply_filters( 'bp_get_activity_parent_content', $content );
-	}
-
-/**
- * Output the parent activity's user ID.
- *
- * @since 1.7.0
- */
-function bp_activity_parent_user_id() {
-	echo bp_get_activity_parent_user_id();
-}
-
-	/**
-	 * Return the parent activity's user ID.
-	 *
-	 * @since 1.7.0
-	 *
-	 * @global BP_Activity_Template $activities_template
-	 *
-	 * @return bool|int False if parent activity can't be found, otherwise
-	 *                  the parent activity's user ID.
-	 */
-	function bp_get_activity_parent_user_id() {
-		global $activities_template;
-
-		// Bail if no activity on no item ID.
-		if ( empty( $activities_template->activity ) || empty( $activities_template->activity->item_id ) ) {
-			return false;
-		}
-
-		// Get the ID of the parent activity content.
-		$parent_id = (int) $activities_template->activity->item_id;
-
-		// Bail if no parent item.
-		if ( empty( $activities_template->activity_parents[ $parent_id ] ) ) {
-			return false;
-		}
-
-		// Bail if no parent user ID.
-		if ( empty( $activities_template->activity_parents[ $parent_id ]->user_id ) ) {
-			return false;
-		}
-
-		$retval = $activities_template->activity_parents[ $parent_id ]->user_id;
-
-		/**
-		 * Filters the activity parent item's user ID.
-		 *
-		 * @since 1.7.0
-		 *
-		 * @param int $retval ID for the activity parent's user.
-		 */
-		return (int) apply_filters( 'bp_get_activity_parent_user_id', $retval );
-	}
-
-/**
- * Output whether or not the current activity is in a current user's favorites.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_is_favorite()
- */
-function bp_activity_is_favorite() {
-	echo bp_get_activity_is_favorite();
-}
-
-	/**
-	 * Return whether the current activity is in a current user's favorites.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_is_favorite' hook.
-	 *
-	 * @return bool True if user favorite, false otherwise.
-	 */
-	function bp_get_activity_is_favorite() {
-		global $activities_template;
-
-		/**
-		 * Filters whether the current activity item is in the current user's favorites.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param bool $value Whether or not the current activity item is in the current user's favorites.
-		 */
-		return (bool) apply_filters( 'bp_get_activity_is_favorite', in_array( $activities_template->activity->id, (array) $activities_template->my_favs ) );
-	}
-
-/**
- * Output the comment markup for an activity item.
- *
- * @since 1.2.0
- *
- * @todo deprecate $args param
- *
- * @param array|string $args See {@link bp_activity_get_comments} for description.
- */
-function bp_activity_comments( $args = '' ) {
-	echo bp_activity_get_comments( $args );
-}
-
-	/**
-	 * Get the comment markup for an activity item.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @todo deprecate $args param
-	 * @todo Given that checks for children already happen in bp_activity_recurse_comments(),
-	 *       this function can probably be streamlined or removed.
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses bp_activity_recurse_comments()
-	 *
-	 * @param string $args Unused. Left over from an earlier implementation.
-	 * @return bool
-	 */
-	function bp_activity_get_comments( $args = '' ) {
-		global $activities_template;
-
-		if ( empty( $activities_template->activity->children ) ) {
-			return false;
-		}
-
-		bp_activity_recurse_comments( $activities_template->activity );
-	}
-
-		/**
-		 * Loops through a level of activity comments and loads the template for each.
-		 *
-		 * Note: The recursion itself used to happen entirely in this function. Now it is
-		 * split between here and the comment.php template.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @global object $activities_template {@link BP_Activity_Template}
-		 * @uses locate_template()
-		 *
-		 * @param object $comment The activity object currently being recursed.
-		 * @return bool|string
-		 */
-		function bp_activity_recurse_comments( $comment ) {
-			global $activities_template;
-
-			if ( empty( $comment ) ) {
-				return false;
-			}
-
-			if ( empty( $comment->children ) ) {
-				return false;
-			}
-
-			/**
-			 * Filters the opening tag for the template that lists activity comments.
-			 *
-			 * @since 1.6.0
-			 *
-			 * @param string $value Opening tag for the HTML markup to use.
-			 */
-			echo apply_filters( 'bp_activity_recurse_comments_start_ul', '<ul>' );
-			foreach ( (array) $comment->children as $comment_child ) {
-
-				// Put the comment into the global so it's available to filters.
-				$activities_template->activity->current_comment = $comment_child;
-
-				$template = bp_locate_template( 'activity/comment.php', false, false );
-
-				// Backward compatibility. In older versions of BP, the markup was
-				// generated in the PHP instead of a template. This ensures that
-				// older themes (which are not children of bp-default and won't
-				// have the new template) will still work.
-				if ( !$template ) {
-					$template = buddypress()->plugin_dir . '/bp-themes/bp-default/activity/comment.php';
-				}
-
-				load_template( $template, false );
-
-				unset( $activities_template->activity->current_comment );
-			}
-
-			/**
-			 * Filters the closing tag for the template that list activity comments.
-			 *
-			 * @since  1.6.0
-			 *
-			 * @param string $value Closing tag for the HTML markup to use.
-			 */
-			echo apply_filters( 'bp_activity_recurse_comments_end_ul', '</ul>' );
-		}
-
-/**
- * Utility function that returns the comment currently being recursed.
- *
- * @since 1.5.0
- *
- * @global object $activities_template {@link BP_Activity_Template}
- * @uses apply_filters() To call the 'bp_activity_current_comment' hook.
- *
- * @return object|bool $current_comment The activity comment currently being
- *                                      displayed. False on failure.
- */
-function bp_activity_current_comment() {
-	global $activities_template;
-
-	$current_comment = !empty( $activities_template->activity->current_comment )
-		? $activities_template->activity->current_comment
-		: false;
-
-	/**
-	 * Filters the current comment being recursed.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @param object|bool $current_comment The activity comment currently being displayed. False on failure.
-	 */
-	return apply_filters( 'bp_activity_current_comment', $current_comment );
-}
-
-
-/**
- * Output the ID of the activity comment currently being displayed.
- *
- * @since 1.5.0
- *
- * @uses bp_get_activity_comment_id()
- */
-function bp_activity_comment_id() {
-	echo bp_get_activity_comment_id();
-}
-
-	/**
-	 * Return the ID of the activity comment currently being displayed.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_activity_comment_id' hook.
-	 *
-	 * @return int|bool $comment_id The ID of the activity comment currently
-	 *                              being displayed, false if none is found.
-	 */
-	function bp_get_activity_comment_id() {
-		global $activities_template;
-
-		$comment_id = isset( $activities_template->activity->current_comment->id ) ? $activities_template->activity->current_comment->id : false;
-
-		/**
-		 * Filters the ID of the activity comment currently being displayed.
-		 *
-		 * @since 1.5.0
-		 *
-		 * @param int|bool $comment_id ID for the comment currently being displayed.
-		 */
-		return apply_filters( 'bp_activity_comment_id', $comment_id );
-	}
-
-/**
- * Output the ID of the author of the activity comment currently being displayed.
- *
- * @since 1.5.0
- *
- * @uses bp_get_activity_comment_user_id()
- */
-function bp_activity_comment_user_id() {
-	echo bp_get_activity_comment_user_id();
-}
-
-	/**
-	 * Return the ID of the author of the activity comment currently being displayed.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_activity_comment_user_id' hook.
-	 *
-	 * @return int|bool $user_id The user_id of the author of the displayed
-	 *                           activity comment. False on failure.
-	 */
-	function bp_get_activity_comment_user_id() {
-		global $activities_template;
-
-		$user_id = isset( $activities_template->activity->current_comment->user_id ) ? $activities_template->activity->current_comment->user_id : false;
-
-		/**
-		 * Filters the ID of the author of the activity comment currently being displayed.
-		 *
-		 * @since 1.5.0
-		 *
-		 * @param int|bool $user_id ID for the author of the comment currently being displayed.
-		 */
-		return apply_filters( 'bp_activity_comment_user_id', $user_id );
-	}
-
-/**
- * Output the author link for the activity comment currently being displayed.
- *
- * @since 1.5.0
- *
- * @uses bp_get_activity_comment_user_link()
- */
-function bp_activity_comment_user_link() {
-	echo bp_get_activity_comment_user_link();
-}
-
-	/**
-	 * Return the author link for the activity comment currently being displayed.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @uses bp_core_get_user_domain()
-	 * @uses bp_get_activity_comment_user_id()
-	 * @uses apply_filters() To call the 'bp_activity_comment_user_link' hook.
-	 *
-	 * @return string $user_link The URL of the activity comment author's profile.
-	 */
-	function bp_get_activity_comment_user_link() {
-		$user_link = bp_core_get_user_domain( bp_get_activity_comment_user_id() );
-
-		/**
-		 * Filters the author link for the activity comment currently being displayed.
-		 *
-		 * @since 1.5.0
-		 *
-		 * @param string $user_link Link for the author of the activity comment currently being displayed.
-		 */
-		return apply_filters( 'bp_activity_comment_user_link', $user_link );
-	}
-
-/**
- * Output the author name for the activity comment currently being displayed.
- *
- * @since 1.5.0
- *
- * @uses bp_get_activity_comment_name()
- */
-function bp_activity_comment_name() {
-	echo bp_get_activity_comment_name();
-}
-
-	/**
-	 * Return the author name for the activity comment currently being displayed.
-	 *
-	 * The use of the 'bp_acomment_name' filter is deprecated. Please use
-	 * 'bp_activity_comment_name'.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_acomment_name' hook.
-	 * @uses apply_filters() To call the 'bp_activity_comment_name' hook.
-	 *
-	 * @return string $name The full name of the activity comment author.
-	 */
-	function bp_get_activity_comment_name() {
-		global $activities_template;
-
-		if ( isset( $activities_template->activity->current_comment->user_fullname ) ) {
-
-			$name = apply_filters( 'bp_acomment_name', $activities_template->activity->current_comment->user_fullname, $activities_template->activity->current_comment );  // Backward compatibility.
-		} else {
-			$name = $activities_template->activity->current_comment->display_name;
-		}
-
-		/**
-		 * Filters the name of the author for the activity comment.
-		 *
-		 * @since 1.5.0
-		 *
-		 * @param string $name Name to be displayed with the activity comment.
-		 */
-		return apply_filters( 'bp_activity_comment_name', $name );
-	}
-
-/**
- * Output the formatted date_recorded of the activity comment currently being displayed.
- *
- * @since 1.5.0
- *
- * @uses bp_get_activity_comment_date_recorded()
- */
-function bp_activity_comment_date_recorded() {
-	echo bp_get_activity_comment_date_recorded();
-}
-
-	/**
-	 * Return the formatted date_recorded for the activity comment currently being displayed.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @uses bp_core_time_since()
-	 * @uses apply_filters() To call the 'bp_activity_comment_date_recorded' hook.
-	 *
-	 * @return string|bool $date_recorded Time since the activity was recorded,
-	 *                                    in the form "%s ago". False on failure.
-	 */
-	function bp_get_activity_comment_date_recorded() {
-
-		/**
-		 * Filters the recorded date of the activity comment currently being displayed.
-		 *
-		 * @since 1.5.0
-		 *
-		 * @param string|bool Date for the activity comment currently being displayed.
-		 */
-		return apply_filters( 'bp_activity_comment_date_recorded', bp_core_time_since( bp_get_activity_comment_date_recorded_raw() ) );
-	}
-
-/**
- * Output the date_recorded of the activity comment currently being displayed.
- *
- * @since 2.3.0
- *
- * @uses bp_get_activity_comment_date_recorded()
- */
-function bp_activity_comment_date_recorded_raw() {
-	echo bp_get_activity_comment_date_recorded_raw();
-}
-
-	/**
-	 * Return the date_recorded for the activity comment currently being displayed.
-	 *
-	 * @since 2.3.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses bp_core_time_since()
-	 * @uses apply_filters() To call the 'bp_activity_comment_date_recorded' hook.
-	 *
-	 * @return string|bool $date_recorded Time since the activity was recorded,
-	 *                                    in the form "%s ago". False on failure.
-	 */
-	function bp_get_activity_comment_date_recorded_raw() {
-		global $activities_template;
-
-		/**
-		 * Filters the raw recorded date of the activity comment currently being displayed.
-		 *
-		 * @since 2.3.0
-		 *
-		 * @param string|bool Raw date for the activity comment currently being displayed.
-		 */
-		return apply_filters( 'bp_activity_comment_date_recorded', $activities_template->activity->current_comment->date_recorded );
-	}
-
-/**
- * Output the 'delete' URL for the activity comment currently being displayed.
- *
- * @since 1.5.0
- *
- * @uses bp_get_activity_comment_delete_link()
- */
-function bp_activity_comment_delete_link() {
-	echo bp_get_activity_comment_delete_link();
-}
-
-	/**
-	 * Gets the 'delete' URL for the activity comment currently being displayed.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @uses wp_nonce_url()
-	 * @uses bp_get_root_domain()
-	 * @uses bp_get_activity_slug()
-	 * @uses bp_get_activity_comment_id()
-	 * @uses apply_filters() To call the 'bp_activity_comment_delete_link' hook.
-	 *
-	 * @return string $link The nonced URL for deleting the current
-	 *                      activity comment.
-	 */
-	function bp_get_activity_comment_delete_link() {
-		$link = wp_nonce_url( bp_get_root_domain() . '/' . bp_get_activity_slug() . '/delete/' . bp_get_activity_comment_id() . '?cid=' . bp_get_activity_comment_id(), 'bp_activity_delete_link' );
-
-		/**
-		 * Filters the link used for deleting the activity comment currently being displayed.
-		 *
-		 * @since 1.5.0
-		 *
-		 * @param string $link Link to use for deleting the currently displayed activity comment.
-		 */
-		return apply_filters( 'bp_activity_comment_delete_link', $link );
-	}
-
-/**
- * Output the content of the activity comment currently being displayed.
- *
- * @since 1.5.0
- *
- * @uses bp_get_activity_comment_content()
- */
-function bp_activity_comment_content() {
-	echo bp_get_activity_comment_content();
-}
-
-	/**
-	 * Return the content of the activity comment currently being displayed.
-	 *
-	 * The content is run through two filters. 'bp_get_activity_content'
-	 * will apply all filters applied to activity items in general. Use
-	 * 'bp_activity_comment_content' to modify the content of activity
-	 * comments only.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_content' hook.
-	 * @uses apply_filters() To call the 'bp_activity_comment_content' hook.
-	 *
-	 * @return string $content The content of the current activity comment.
-	 */
-	function bp_get_activity_comment_content() {
-		global $activities_template;
-
-		/** This filter is documented in bp-activity/bp-activity-template.php */
-		$content = apply_filters( 'bp_get_activity_content', $activities_template->activity->current_comment->content );
-
-		/**
-		 * Filters the content of the current activity comment.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string $content The content of the current activity comment.
-		 */
-		return apply_filters( 'bp_activity_comment_content', $content );
-	}
-
-/**
- * Output the activity comment count.
- *
- * @since 1.2.0
- *
- * @uses bp_activity_get_comment_count()
- */
-function bp_activity_comment_count() {
-	echo bp_activity_get_comment_count();
-}
-
-	/**
-	 * Return the comment count of an activity item.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses bp_activity_recurse_comment_count()
-	 * @uses apply_filters() To call the 'bp_activity_get_comment_count' hook.
-	 *
-	 * @param array|null $deprecated Deprecated.
-	 * @return int $count The activity comment count.
-	 */
-	function bp_activity_get_comment_count( $deprecated = null ) {
-		global $activities_template;
-
-		// Deprecated notice about $args.
-		if ( ! empty( $deprecated ) ) {
-			_deprecated_argument( __FUNCTION__, '1.2', sprintf( __( '%1$s no longer accepts arguments. See the inline documentation at %2$s for more details.', 'buddypress' ), __FUNCTION__, __FILE__ ) );
-		}
-
-		// Get the count using the purpose-built recursive function.
-		$count = ! empty( $activities_template->activity->children )
-			? bp_activity_recurse_comment_count( $activities_template->activity )
-			: 0;
-
-		/**
-		 * Filters the activity comment count.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param int $count The activity comment count.
-		 */
-		return apply_filters( 'bp_activity_get_comment_count', (int) $count );
-	}
-
-		/**
-		 * Return the total number of comments to the current comment.
-		 *
-		 * This function recursively adds the total number of comments each
-		 * activity child has, and returns them.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @uses bp_activity_recurse_comment_count()
-		 * @uses apply_filters() To call the 'bp_activity_recurse_comment_count' hook.
-		 *
-		 * @param object $comment Activity comment object.
-		 * @param int    $count The current iteration count.
-		 * @return int $count The activity comment count.
-		 */
-		function bp_activity_recurse_comment_count( $comment, $count = 0 ) {
-
-			// Copy the count.
-			$new_count = $count;
-
-			// Loop through children and recursively count comments.
-			if ( ! empty( $comment->children ) ) {
-				foreach ( (array) $comment->children as $comment ) {
-					$new_count++;
-					$new_count = bp_activity_recurse_comment_count( $comment, $new_count );
-				}
-			}
-
-			/**
-			 * Filters the total number of comments for the current comment.
-			 *
-			 * @since 2.1.0
-			 *
-			 * @param int    $new_count New total count for the current comment.
-			 * @param object $comment   Activity comment object.
-			 * @param int    $count     Current iteration count for the current comment.
-			 */
-			return apply_filters( 'bp_activity_recurse_comment_count', $new_count, $comment, $count );
-		}
-
-/**
- * Output the depth of the current activity comment.
- *
- * @since 2.0.0
- */
-function bp_activity_comment_depth() {
-	echo bp_activity_get_comment_depth();
-}
-	/**
-	 * Return the current activity comment depth.
-	 *
-	 * @since 2.0.0
-	 *
-	 * @return int $depth Depth for the current activity comment.
-	 */
-	function bp_activity_get_comment_depth() {
-		global $activities_template;
-
-		/**
-		 * Filters the comment depth of the current activity comment.
-		 *
-		 * @since 2.0.0
-		 *
-		 * @param int $depth Depth for the current activity comment.
-		 */
-		return apply_filters( 'bp_activity_get_comment_depth', $activities_template->activity->current_comment->depth );
-	}
-
-/**
- * Output the activity comment link.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_comment_link()
- */
-function bp_activity_comment_link() {
-	echo bp_get_activity_comment_link();
-}
-
-	/**
-	 * Return the activity comment link.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_comment_link' hook.
-	 *
-	 * @return string The activity comment link.
-	 */
-	function bp_get_activity_comment_link() {
-		global $activities_template;
-
-		/**
-		 * Filters the comment link for the current activity comment.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string $value Constructed URL parameters with activity IDs.
-		 */
-		return apply_filters( 'bp_get_activity_comment_link', '?ac=' . $activities_template->activity->id . '/#ac-form-' . $activities_template->activity->id );
-	}
-
-/**
- * Output the activity comment form no JavaScript display CSS.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_comment_form_nojs_display()
- */
-function bp_activity_comment_form_nojs_display() {
-	echo bp_get_activity_comment_form_nojs_display();
-}
-
-	/**
-	 * Return the activity comment form no JavaScript display CSS.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 *
-	 * @return string|bool The activity comment form no JavaScript
-	 *                     display CSS. False on failure.
-	 */
-	function bp_get_activity_comment_form_nojs_display() {
-		global $activities_template;
-
-		if ( isset( $_GET['ac'] ) && ( $_GET['ac'] === ( $activities_template->activity->id . '/' ) ) ) {
-			return 'style="display: block"';
-		}
-
-		return false;
-	}
-
-/**
- * Output the activity comment form action.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_comment_form_action()
- */
-function bp_activity_comment_form_action() {
-	echo bp_get_activity_comment_form_action();
-}
-
-	/**
-	 * Return the activity comment form action.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @uses home_url()
-	 * @uses bp_get_activity_root_slug()
-	 * @uses apply_filters() To call the 'bp_get_activity_comment_form_action' hook.
-	 *
-	 * @return string The activity comment form action.
-	 */
-	function bp_get_activity_comment_form_action() {
-
-		/**
-		 * Filters the activity comment form action URL.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string $value URL to use in the comment form's action attribute.
-		 */
-		return apply_filters( 'bp_get_activity_comment_form_action', home_url( bp_get_activity_root_slug() . '/reply/' ) );
-	}
-
-/**
- * Output the activity permalink ID.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_permalink_id()
- */
-function bp_activity_permalink_id() {
-	echo bp_get_activity_permalink_id();
-}
-
-	/**
-	 * Return the activity permalink ID.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @uses apply_filters() To call the 'bp_get_activity_permalink_id' hook.
-	 *
-	 * @return string The activity permalink ID.
-	 */
-	function bp_get_activity_permalink_id() {
-
-		/**
-		 * Filters the activity action permalink ID.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string $value Current action for the activity item.
-		 */
-		return apply_filters( 'bp_get_activity_permalink_id', bp_current_action() );
-	}
-
-/**
- * Output the activity thread permalink.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_permalink_id()
- */
-function bp_activity_thread_permalink() {
-	echo bp_get_activity_thread_permalink();
-}
-
-	/**
-	 * Return the activity thread permalink.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @uses bp_activity_get_permalink()
-	 * @uses apply_filters() To call the 'bp_get_activity_thread_permalink' hook.
-	 *
-	 * @return string $link The activity thread permalink.
-	 */
-	function bp_get_activity_thread_permalink() {
-		global $activities_template;
-
-		$link = bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity );
-
-		/**
-		 * Filters the activity thread permalink.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string $link The activity thread permalink.
-		 */
-		return apply_filters( 'bp_get_activity_thread_permalink', $link );
-	}
-
-/**
- * Output the activity comment permalink.
- *
- * @since 1.8.0
- *
- * @uses bp_get_activity_permalink_id()
- */
-function bp_activity_comment_permalink() {
-	echo bp_get_activity_comment_permalink();
-}
-	/**
-	 * Return the activity comment permalink.
-	 *
-	 * @since 1.8.0
-	 *
-	 * @uses bp_activity_get_permalink()
-	 * @uses apply_filters() To call the 'bp_get_activity_comment_permalink' hook.
-	 *
-	 * @return string $link The activity comment permalink.
-	 */
-	function bp_get_activity_comment_permalink() {
-		global $activities_template;
-
-		// Check that comment exists.
-		$comment_id = isset( $activities_template->activity->current_comment->id )
-			? $activities_template->activity->current_comment->id
-			: 0;
-
-		// Setup the comment link.
-		$comment_link = ! empty( $comment_id )
-			? '#acomment-' .$comment_id
-			: false;
-
-		// Append comment ID to end of activity permalink.
-		$link = bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ) . $comment_link;
-
-		/**
-		 * Filters the activity comment permalink.
-		 *
-		 * @since 1.8.0
-		 *
-		 * @param string $link       Activity comment permalink.
-		 * @param int    $comment_id ID for the current activity comment.
-		 */
-		return apply_filters( 'bp_get_activity_comment_permalink', $link, $comment_id );
-	}
-
-/**
- * Output the activity favorite link.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_favorite_link()
- */
-function bp_activity_favorite_link() {
-	echo bp_get_activity_favorite_link();
-}
-
-	/**
-	 * Return the activity favorite link.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses wp_nonce_url()
-	 * @uses home_url()
-	 * @uses bp_get_activity_root_slug()
-	 * @uses apply_filters() To call the 'bp_get_activity_favorite_link' hook.
-	 *
-	 * @return string The activity favorite link.
-	 */
-	function bp_get_activity_favorite_link() {
-		global $activities_template;
-
-		/**
-		 * Filters the activity favorite link.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string $value Constructed link for favoriting the activity comment.
-		 */
-		return apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/favorite/' . $activities_template->activity->id . '/' ), 'mark_favorite' ) );
-	}
-
-/**
- * Output the activity unfavorite link.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_unfavorite_link()
- */
-function bp_activity_unfavorite_link() {
-	echo bp_get_activity_unfavorite_link();
-}
-
-	/**
-	 * Return the activity unfavorite link.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses wp_nonce_url()
-	 * @uses home_url()
-	 * @uses bp_get_activity_root_slug()
-	 * @uses apply_filters() To call the 'bp_get_activity_unfavorite_link' hook.
-	 *
-	 * @return string The activity unfavorite link.
-	 */
-	function bp_get_activity_unfavorite_link() {
-		global $activities_template;
-
-		/**
-		 * Filters the activity unfavorite link.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string $value Constructed link for unfavoriting the activity comment.
-		 */
-		return apply_filters( 'bp_get_activity_unfavorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/unfavorite/' . $activities_template->activity->id . '/' ), 'unmark_favorite' ) );
-	}
-
-/**
- * Output the activity CSS class.
- *
- * @since 1.0.0
- *
- * @uses bp_get_activity_css_class()
- */
-function bp_activity_css_class() {
-	echo bp_get_activity_css_class();
-}
-
-	/**
-	 * Return the current activity item's CSS class.
-	 *
-	 * @since 1.0.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_activity_mini_activity_types' hook.
-	 * @uses bp_activity_get_comment_count()
-	 * @uses bp_activity_can_comment()
-	 * @uses apply_filters() To call the 'bp_get_activity_css_class' hook.
-	 *
-	 * @return string The activity item's CSS class.
-	 */
-	function bp_get_activity_css_class() {
-		global $activities_template;
-
-		/**
-		 * Filters the available mini activity actions available as CSS classes.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param array $value Array of classes used to determine classes applied to HTML element.
-		 */
-		$mini_activity_actions = apply_filters( 'bp_activity_mini_activity_types', array(
-			'friendship_accepted',
-			'friendship_created',
-			'new_blog',
-			'joined_group',
-			'created_group',
-			'new_member'
-		) );
-
-		$class = ' activity-item';
-
-		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';
-		}
-
-		/**
-		 * Filters the determined classes to add to the HTML element.
-		 *
-		 * @since 1.0.0
-		 *
-		 * @param string $value Classes to be added to the HTML element.
-		 */
-		return apply_filters( 'bp_get_activity_css_class', $activities_template->activity->component . ' ' . $activities_template->activity->type . $class );
-	}
-
-/**
- * Output the activity delete link.
- *
- * @since 1.1.0
- *
- * @uses bp_get_activity_delete_link()
- */
-function bp_activity_delete_link() {
-	echo bp_get_activity_delete_link();
-}
-
-	/**
-	 * Return the activity delete link.
-	 *
-	 * @since 1.1.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses bp_get_root_domain()
-	 * @uses bp_get_activity_root_slug()
-	 * @uses bp_is_activity_component()
-	 * @uses bp_current_action()
-	 * @uses wp_get_referer()
-	 * @uses wp_nonce_url()
-	 * @uses apply_filters() To call the 'bp_get_activity_delete_link' hook.
-	 *
-	 * @return string $link Activity delete link. Contains $redirect_to arg
-	 *                      if on single activity page.
-	 */
-	function bp_get_activity_delete_link() {
-
-		$url   = bp_get_activity_delete_url();
-		$class = 'delete-activity';
-
-		// Determine if we're on a single activity page, and customize accordingly.
-		if ( bp_is_activity_component() && is_numeric( bp_current_action() ) ) {
-			$class = 'delete-activity-single';
-		}
-
-		$link = '<a href="' . esc_url( $url ) . '" class="button item-button bp-secondary-action ' . $class . ' confirm" rel="nofollow">' . __( 'Delete', 'buddypress' ) . '</a>';
-
-		/**
-		 * Filters the activity delete link.
-		 *
-		 * @since 1.1.0
-		 *
-		 * @param string $link Activity delete HTML link.
-		 */
-		return apply_filters( 'bp_get_activity_delete_link', $link );
-	}
-
-/**
- * Output the URL to delete a single activity stream item.
- *
- * @since 2.1.0
- *
- * @uses bp_get_activity_delete_link()
- */
-function bp_activity_delete_url() {
-	echo esc_url( bp_get_activity_delete_url() );
-}
-	/**
-	 * Return the URL to delete a single activity item.
-	 *
-	 * @since 2.1.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses bp_get_root_domain()
-	 * @uses bp_get_activity_root_slug()
-	 * @uses bp_is_activity_component()
-	 * @uses bp_current_action()
-	 * @uses add_query_arg()
-	 * @uses wp_get_referer()
-	 * @uses wp_nonce_url()
-	 * @uses apply_filters() To call the 'bp_get_activity_delete_link' hook.
-	 *
-	 * @return string $link Activity delete link. Contains $redirect_to arg
-	 *                      if on single activity page.
-	 */
-	function bp_get_activity_delete_url() {
-		global $activities_template;
-
-		$url = trailingslashit( bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/delete/' . $activities_template->activity->id );
-
-		// Determine if we're on a single activity page, and customize accordingly.
-		if ( bp_is_activity_component() && is_numeric( bp_current_action() ) ) {
-			$url = add_query_arg( array( 'redirect_to' => wp_get_referer() ), $url );
-		}
-
-		$url = wp_nonce_url( $url, 'bp_activity_delete_link' );
-
-		/**
-		 * Filters the activity delete URL.
-		 *
-		 * @since 2.1.0
-		 *
-		 * @param string $url Activity delete URL.
-		 */
-		return apply_filters( 'bp_get_activity_delete_url', $url );
-	}
-
-/**
- * Output the activity latest update link.
- *
- * @since 1.2.0
- *
- * @see bp_get_activity_latest_update() for description of parameters.
- * @uses bp_get_activity_latest_update()
- *
- * @param int $user_id See {@link bp_get_activity_latest_update()} for description.
- */
-function bp_activity_latest_update( $user_id = 0 ) {
-	echo bp_get_activity_latest_update( $user_id );
-}
-
-	/**
-	 * Return the activity latest update link.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @uses bp_is_user_inactive()
-	 * @uses bp_core_is_user_deleted()
-	 * @uses bp_get_user_meta()
-	 * @uses apply_filters() To call the 'bp_get_activity_latest_update_excerpt' hook.
-	 * @uses bp_create_excerpt()
-	 * @uses bp_get_root_domain()
-	 * @uses bp_get_activity_root_slug()
-	 * @uses apply_filters() To call the 'bp_get_activity_latest_update' hook.
-	 *
-	 * @param int $user_id If empty, will fall back on displayed user.
-	 * @return string|bool $latest_update The activity latest update link.
-	 *                                    False on failure.
-	 */
-	function bp_get_activity_latest_update( $user_id = 0 ) {
-
-		if ( empty( $user_id ) ) {
-			$user_id = bp_displayed_user_id();
-		}
-
-		if ( bp_is_user_inactive( $user_id ) ) {
-			return false;
-		}
-
-		if ( !$update = bp_get_user_meta( $user_id, 'bp_latest_update', true ) ) {
-			return false;
-		}
-
-		/**
-		 * Filters the latest update excerpt.
-		 *
-		 * @since 1.2.10
-		 *
-		 * @param string $value The excerpt for the latest update.
-		 */
-		$latest_update = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 358 ) ) ) );
-
-		$latest_update = sprintf(
-			'%s <a href="%s">%s</a>',
-			$latest_update,
-			esc_url_raw( bp_activity_get_permalink( $update['id'] ) ),
-			esc_attr__( 'View', 'buddypress' )
-		);
-
-		/**
-		 * Filters the latest update excerpt with view link appended to the end.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string $latest_update The latest update with "view" link appended to it.
-		 */
-		return apply_filters( 'bp_get_activity_latest_update', $latest_update );
-	}
-
-/**
- * Output the activity filter links.
- *
- * @since 1.1.0
- *
- * @see bp_get_activity_filter_links() for description of parameters.
- * @uses bp_get_activity_filter_links()
- *
- * @param array|bool $args See {@link bp_get_activity_filter_links()} for description.
- */
-function bp_activity_filter_links( $args = false ) {
-	echo bp_get_activity_filter_links( $args );
-}
-
-	/**
-	 * Return the activity filter links.
-	 *
-	 * @since 1.1.0
-	 *
-	 * @uses wp_parse_args()
-	 * @uses BP_Activity_Activity::get_recorded_components() {@link BP_Activity_Activity}
-	 * @uses esc_attr()
-	 * @uses add_query_arg()
-	 * @uses remove_query_arg()
-	 * @uses apply_filters() To call the 'bp_get_activity_filter_link_href' hook.
-	 * @uses apply_filters() To call the 'bp_get_activity_filter_links' hook.
-	 *
-	 * @param array|bool $args {
-	 *     @type string $style The type of markup to use for the links.
-	 *                         'list', 'paragraph', or 'span'. Default: 'list'.
-	 * }
-	 * @return string|bool $component_links The activity filter links.
-	 *         False on failure.
-	 */
-	function bp_get_activity_filter_links( $args = false ) {
-
-		$r = wp_parse_args( $args, array(
-			'style' => 'list'
-		) );
-
-		// Define local variable.
-		$component_links = array();
-
-		// Fetch the names of components that have activity recorded in the DB.
-		$components = BP_Activity_Activity::get_recorded_components();
-
-		if ( empty( $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 {
-				$selected = '';
-			}
-
-			$component = esc_attr( $component );
-
-			switch ( $r['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 );
-
-			/**
-			 * Filters the activity filter link URL for the current activity component.
-			 *
-			 * @since 1.1.0
-			 *
-			 * @param string $link      The URL for the current component.
-			 * @param string $component The current component getting links constructed for.
-			 */
-			$link = apply_filters( 'bp_get_activity_filter_link_href', $link, $component );
-
-			$component_links[] = $before . '<a href="' . esc_url( $link ) . '">' . ucwords( $component ) . '</a>' . $after;
-		}
-
-		$link = remove_query_arg( 'afilter' , $link );
-
-		if ( isset( $_GET['afilter'] ) ) {
-			$component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' . esc_url( $link ) . '">' . __( 'Clear Filter', 'buddypress' ) . '</a></' . $tag . '>';
-		}
-
-		/**
-		 * Filters all of the constructed filter links.
-		 *
-		 * @since 1.1.0
-		 *
-		 * @param string $value All of the links to be displayed to the user.
-		 */
-		return apply_filters( 'bp_get_activity_filter_links', implode( "\n", $component_links ) );
-	}
-
-/**
- * Determine if a comment can be made on an activity item.
- *
- * @since 1.2.0
- *
- * @global object $activities_template {@link BP_Activity_Template}
- * @uses bp_get_activity_action_name()
- * @uses apply_filters() To call the 'bp_activity_can_comment' hook.
- *
- * @return bool $can_comment True if item can receive comments.
- */
-function bp_activity_can_comment() {
-	global $activities_template;
-	$bp = buddypress();
-
-	// Assume activity can be commented on.
-	$can_comment = true;
-
-	// Determine ability to comment based on activity action name.
-	$activity_action = bp_get_activity_action_name();
-
-	$turn_off = 0;
-	if ( ! empty( $activities_template->disable_blogforum_replies ) ) {
-		$turn_off = 1;
-	}
-
-	$maybe_turn_off = array_fill_keys( array(
-		'new_blog_post',
-		'new_blog_comment',
-		'new_forum_topic',
-		'new_forum_post',
-	), $turn_off );
-
-	$maybe_turn_off['activity_comment'] = 1;
-
-	// Fetch all the tracked post types once.
-	if ( empty( $bp->activity->track ) ) {
-		$bp->activity->track = bp_activity_get_post_types_tracking_args();
-	}
-
-	foreach ( $bp->activity->track as $action => $tracking_args ) {
-		if ( empty( $tracking_args->activity_comment ) ) {
-			$maybe_turn_off[ $action ] = $turn_off;
-		}
-	}
-
-	$can_comment = empty( $maybe_turn_off[ $activity_action ] );
-
-	/**
-	 * Filters whether a comment can be made on an activity item.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @param bool   $can_comment     Status on if activity can be commented on.
-	 * @param string $activity_action Current activity action being checked on.
-	 */
-	return apply_filters( 'bp_activity_can_comment', $can_comment, $activity_action );
-}
-
-/**
- * Determine whether a comment can be made on an activity reply item.
- *
- * @since 1.5.0
- *
- * @param  bool|object $comment     Activity comment.
- * @return bool        $can_comment True if comment can receive comments,
- *                                  otherwise false.
- */
-function bp_activity_can_comment_reply( $comment = false ) {
-
-	// Assume activity can be commented on.
-	$can_comment = true;
-
-	// Check that comment exists.
-	if ( empty( $comment ) ) {
-		$comment = bp_activity_current_comment();
-	}
-
-	if ( ! empty( $comment ) ) {
-
-		// Fall back on current comment in activity loop.
-		$comment_depth = isset( $comment->depth )
-			? intval( $comment->depth )
-			: bp_activity_get_comment_depth();
-
-		// Threading is turned on, so check the depth.
-		if ( get_option( 'thread_comments' ) ) {
-			$can_comment = (bool) ( $comment_depth < get_option( 'thread_comments_depth' ) );
-
-		// No threading for comment replies if no threading for comments.
-		} else {
-			$can_comment = false;
-		}
-	}
-
-	/**
-	 * Filters whether a comment can be made on an activity reply item.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @param bool   $can_comment Status on if activity reply can be commented on.
-	 * @param string $comment     Current comment being checked on.
-	 */
-	return (bool) apply_filters( 'bp_activity_can_comment_reply', $can_comment, $comment );
-}
-
-/**
- * Determine whether favorites are allowed.
- *
- * Defaults to true, but can be modified by plugins.
- *
- * @since 1.5.0
- *
- * @uses apply_filters() To call the 'bp_activity_can_favorite' hook.
- *
- * @return bool True if comment can receive comments.
- */
-function bp_activity_can_favorite() {
-
-	/**
-	 * Filters whether or not users can favorite activity items.
-	 *
-	 * @since 1.5.0
-	 *
-	 * @param bool $value Whether or not favoriting is enabled.
-	 */
-	return apply_filters( 'bp_activity_can_favorite', true );
-}
-
-/**
- * Output the total favorite count for a specified user.
- *
- * @since 1.2.0
- *
- * @see bp_get_total_favorite_count_for_user() for description of parameters.
- * @uses bp_get_total_favorite_count_for_user()
- *
- * @param int $user_id See {@link bp_get_total_favorite_count_for_user()}.
- */
-function bp_total_favorite_count_for_user( $user_id = 0 ) {
-	echo bp_get_total_favorite_count_for_user( $user_id );
-}
-
-	/**
-	 * Return the total favorite count for a specified user.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @uses bp_activity_total_favorites_for_user()
-	 * @uses apply_filters() To call the 'bp_get_total_favorite_count_for_user' hook.
-	 *
-	 * @param int $user_id ID of user being queried. Default: displayed user ID.
-	 * @return int The total favorite count for the specified user.
-	 */
-	function bp_get_total_favorite_count_for_user( $user_id = 0 ) {
-		$retval = false;
-
-		if ( bp_activity_can_favorite() ) {
-			// Default to displayed user if none is passed.
-			$user_id = empty( $user_id )
-				? bp_displayed_user_id()
-				: $user_id;
-
-			// Get user meta if user ID exists.
-			if ( ! empty( $user_id ) ) {
-				$retval = bp_activity_total_favorites_for_user( $user_id );
-			}
-		}
-
-		/**
-		 * Filters the total favorite count for a user.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param int|bool $retval Total favorite count for a user. False on no favorites.
-		 */
-		return apply_filters( 'bp_get_total_favorite_count_for_user', $retval );
-	}
-
-
-/**
- * Output the total mention count for a specified user.
- *
- * @since 1.2.0
- *
- * @see bp_get_total_mention_count_for_user() for description of parameters.
- * @uses bp_get_total_favorite_count_for_user()
- *
- * @param int $user_id See {@link bp_get_total_mention_count_for_user()}.
- */
-function bp_total_mention_count_for_user( $user_id = 0 ) {
-	echo bp_get_total_mention_count_for_user( $user_id );
-}
-
-	/**
-	 * Return the total mention count for a specified user.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @uses bp_get_user_meta()
-	 * @uses apply_filters() To call the 'bp_get_total_mention_count_for_user' hook.
-	 *
-	 * @param int $user_id ID of user being queried. Default: displayed user ID.
-	 * @return int The total mention count for the specified user.
-	 */
-	function bp_get_total_mention_count_for_user( $user_id = 0 ) {
-
-		// Default to displayed user if none is passed.
-		$user_id = empty( $user_id )
-			? bp_displayed_user_id()
-			: $user_id;
-
-		// Get user meta if user ID exists.
-		$retval = ! empty( $user_id )
-			? bp_get_user_meta( $user_id, 'bp_new_mention_count', true )
-			: false;
-
-		/**
-		 * Filters the total mention count for a user.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param int|bool $retval Total mention count for a user. False on no mentions.
-		 */
-		return apply_filters( 'bp_get_total_mention_count_for_user', $retval );
-	}
-
-/**
- * Output the public message link for displayed user.
- *
- * @since 1.2.0
- *
- * @uses bp_get_send_public_message_link()
- */
-function bp_send_public_message_link() {
-	echo esc_url( bp_get_send_public_message_link() );
-}
-
-	/**
-	 * Return the public message link for the displayed user.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @uses is_user_logged_in()
-	 * @uses bp_is_my_profile()
-	 * @uses bp_is_user()
-	 * @uses wp_nonce_url()
-	 * @uses bp_get_activity_directory_permalink()
-	 * @uses apply_filters() To call the 'bp_get_send_public_message_link' hook.
-	 *
-	 * @return string The public message link for the displayed user.
-	 */
-	function bp_get_send_public_message_link() {
-
-		// No link if not logged in, not looking at someone else's profile.
-		if ( ! is_user_logged_in() || ! bp_is_user() || bp_is_my_profile() ) {
-			$retval = '';
-		} else {
-			$args   = array( 'r' => bp_get_displayed_user_mentionname() );
-			$url    = add_query_arg( $args, bp_get_activity_directory_permalink() );
-			$retval = wp_nonce_url( $url );
-		}
-
-		/**
-		 * Filters the public message link for the displayed user.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string $retval The URL for the public message link.
-		 */
-		return apply_filters( 'bp_get_send_public_message_link', $retval );
-	}
-
-/**
- * Recurse through all activity comments and return the activity comment IDs.
- *
- * @since 2.0.0
- *
- * @param array $activity Array of activities generated from {@link bp_activity_get()}.
- * @param array $activity_ids Used for recursion purposes in this function.
- * @return array
- */
-function bp_activity_recurse_comments_activity_ids( $activity = array(), $activity_ids = array() ) {
-	if ( is_array( $activity ) && ! empty( $activity['activities'] ) ) {
-		$activity = $activity['activities'][0];
-	}
-
-	if ( ! empty( $activity->children ) ) {
-		foreach ($activity->children as $child ) {
-			$activity_ids[] = $child->id;
-
-			if( ! empty( $child->children ) ) {
-				$activity_ids = bp_activity_recurse_comments_activity_ids( $child, $activity_ids );
-			}
-		}
-	}
-
-	return $activity_ids;
-}
-
-/**
- * Output the mentioned user display name.
- *
- * @since 1.2.0
- *
- * @see bp_get_mentioned_user_display_name() for description of parameters.
- * @uses bp_get_mentioned_user_display_name()
- *
- * @param int|string|bool $user_id_or_username See {@link bp_get_mentioned_user_display_name()}.
- */
-function bp_mentioned_user_display_name( $user_id_or_username = false ) {
-	echo bp_get_mentioned_user_display_name( $user_id_or_username );
-}
-
-	/**
-	 * Returns the mentioned user display name.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @uses bp_core_get_user_displayname()
-	 * @uses apply_filters() To call the 'bp_get_mentioned_user_display_name' hook.
-	 *
-	 * @param int|string|bool $user_id_or_username User ID or username.
-	 * @return string The mentioned user's display name.
-	 */
-	function bp_get_mentioned_user_display_name( $user_id_or_username = false ) {
-
-		// Get user display name.
-		$name = bp_core_get_user_displayname( $user_id_or_username );
-
-		// If user somehow has no name, return this really lame string.
-		if ( empty( $name ) ) {
-			$name = __( 'a user', 'buddypress' );
-		}
-
-		/**
-		 * Filters the mentioned user display name.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string     $name                Display name for the mentioned user.
-		 * @param int|string $user_id_or_username User ID or username use for query.
-		 */
-		return apply_filters( 'bp_get_mentioned_user_display_name', $name, $user_id_or_username );
-	}
-
-/**
- * Output button for sending a public message (an @-mention).
- *
- * @since 1.2.0
- *
- * @see bp_get_send_public_message_button() for description of parameters.
- * @uses bp_get_send_public_message_button()
- *
- * @param array|string $args See {@link bp_get_send_public_message_button()}.
- */
-function bp_send_public_message_button( $args = '' ) {
-	echo bp_get_send_public_message_button( $args );
-}
-
-	/**
-	 * Return button for sending a public message (an @-mention).
-	 *
-	 * @since 1.2.0
-	 *
-	 * @uses bp_get_send_public_message_link()
-	 * @uses wp_parse_args()
-	 * @uses bp_get_button()
-	 * @uses apply_filters() To call the 'bp_get_send_public_message_button' hook.
-	 *
-	 * @param array|string $args {
-	 *     All arguments are optional. See {@link BP_Button} for complete
-	 *     descriptions.
-	 *     @type string $id                Default: 'public_message'.
-	 *     @type string $component         Default: 'activity'.
-	 *     @type bool   $must_be_logged_in Default: true.
-	 *     @type bool   $block_self        Default: true.
-	 *     @type string $wrapper_id        Default: 'post-mention'.
-	 *     @type string $link_href         Default: the public message link for
-	 *                                     the current member in the loop.
-	 *     @type string $link_title        Default: 'Send a public message on your
-	 *                                     activity stream.'.
-	 *     @type string $link_text         Default: 'Public Message'.
-	 *     @type string $link_class        Default: 'activity-button mention'.
-	 * }
-	 * @return string The button for sending a public message.
-	 */
-	function bp_get_send_public_message_button( $args = '' ) {
-
-		$r = bp_parse_args( $args, 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'        => __( 'Send a public message on your activity stream.', 'buddypress' ),
-			'link_text'         => __( 'Public Message', 'buddypress' ),
-			'link_class'        => 'activity-button mention'
-		) );
-
-		/**
-		 * Filters the public message button HTML.
-		 *
-		 * @since 1.2.10
-		 *
-		 * @param array $r Array of arguments for the public message button HTML.
-		 */
-		return bp_get_button( apply_filters( 'bp_get_send_public_message_button', $r ) );
-	}
-
-/**
- * Output the activity post form action.
- *
- * @since 1.2.0
- *
- * @uses bp_get_activity_post_form_action()
- */
-function bp_activity_post_form_action() {
-	echo bp_get_activity_post_form_action();
-}
-
-	/**
-	 * Return the activity post form action.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @uses home_url()
-	 * @uses bp_get_activity_root_slug()
-	 * @uses apply_filters() To call the 'bp_get_activity_post_form_action' hook.
-	 *
-	 * @return string The activity post form action.
-	 */
-	function bp_get_activity_post_form_action() {
-
-		/**
-		 * Filters the action url used for the activity post form.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string $value URL to be used for the activity post form.
-		 */
-		return apply_filters( 'bp_get_activity_post_form_action', home_url( bp_get_activity_root_slug() . '/post/' ) );
-	}
-
-/**
- * Echo a list of linked avatars of users who have commented on the current activity item.
- *
- * Use this function to easily output activity comment authors' avatars.
- *
- * Avatars are wrapped in <li> elements, but you've got to provide your own
- * <ul> or <ol> wrapper markup.
- *
- * @since 1.7.0
- *
- * @see bp_core_fetch_avatar() for a description of arguments.
- *
- * @param array $args See {@link bp_core_fetch_avatar()}.
- */
-function bp_activity_comments_user_avatars( $args = array() ) {
-
-	$r = bp_parse_args( $args, array(
-		'height' => false,
-		'html'   => true,
-		'type'   => 'thumb',
-		'width'  => false,
-	) );
-
-	// Get the user IDs of everyone who has left a comment to the current activity item.
-	$user_ids = bp_activity_get_comments_user_ids();
-	$output   = array();
-	$retval   = '';
-
-	if ( ! empty( $user_ids ) ) {
-		foreach ( (array) $user_ids as $user_id ) {
-
-			// Skip an empty user ID.
-			if ( empty( $user_id ) ) {
-				continue;
-			}
-
-			// Get profile link for this user.
-			$profile_link = bp_core_get_user_domain( $user_id );
-
-			// Get avatar for this user.
-			$image_html   = bp_core_fetch_avatar( array(
-				'item_id' => $user_id,
-				'height'  => $r['height'],
-				'html'    => $r['html'],
-				'type'    => $r['type'],
-				'width'   => $r['width']
-			) );
-
-			// If user has link & avatar, add them to the output array.
-			if ( ! empty( $profile_link ) && ! empty( $image_html ) ) {
-				$output[] = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $profile_link ), $image_html );
-			}
-		}
-
-		// If output array is not empty, wrap everything in some list items.
-		if ( ! empty( $output ) ) {
-			$retval = '<li>' . implode( '</li><li>', $output ) . '</li>';
-		}
-	}
-
-	/**
-	 * Filters the list of linked avatars for users who have commented on the current activity item.
-	 *
-	 * @since 1.7.0
-	 *
-	 * @param string $retval HTML markup for the list of avatars.
-	 * @param array  $r      Array of arguments used for each avatar.
-	 * @param array  $output Array of each avatar found, before imploded into single string.
-	 */
-	echo apply_filters( 'bp_activity_comments_user_avatars', $retval, $r, $output );
-}
-
-/**
- * Return the IDs of every user who's left a comment on the current activity item.
- *
- * @since 1.7.0
- *
- * @return bool|array An array of IDs, or false if none are found.
- */
-function bp_activity_get_comments_user_ids() {
-	global $activities_template;
-
-	$user_ids = ! empty( $activities_template->activity->children )
-		? (array) bp_activity_recurse_comments_user_ids( $activities_template->activity->children )
-		: array();
-
-	/**
-	 * Filters the list of user IDs for the current activity item.
-	 *
-	 * @since 1.7.0
-	 *
-	 * @param array $value Array of unique user IDs for the current activity item.
-	 */
-	return apply_filters( 'bp_activity_get_comments_user_ids', array_unique( $user_ids ) );
-}
-
-	/**
-	 * Recurse through all activity comments and collect the IDs of the users who wrote them.
-	 *
-	 * @since 1.7.0
-	 *
-	 * @param array $comments Array of {@link BP_Activity_Activity} items.
-	 * @return array Array of user IDs.
-	 */
-	function bp_activity_recurse_comments_user_ids( array $comments = array() ) {
-
-		// Default user ID's array.
-		$user_ids = array();
-
-		// Loop through comments and try to get user ID's.
-		if ( ! empty( $comments ) ) {
-			foreach ( $comments as $comment ) {
-
-				// If a user is a spammer, their activity items will have been
-				// automatically marked as spam. Skip these.
-				if ( ! empty( $comment->is_spam ) ) {
-					continue;
-				}
-
-				// Add user ID to array.
-				$user_ids[] = $comment->user_id;
-
-				// Check for commentception.
-				if ( ! empty( $comment->children ) ) {
-					$user_ids = array_merge( $user_ids, bp_activity_recurse_comments_user_ids( $comment->children ) );
-				}
-			}
-		}
-
-		/**
-		 * Filters the list of user IDs for the current activity comment item.
-		 *
-		 * @since 2.1.0
-		 *
-		 * @param array $user_ids Array of user IDs for the current activity comment item.
-		 * @param array $comments Array of comments being checked for user IDs.
-		 */
-		return apply_filters( 'bp_activity_recurse_comments_user_ids', $user_ids, $comments );
-	}
-
-/**
- * Output the mentionname for the displayed user.
- *
- * @since 1.9.0
- */
-function bp_displayed_user_mentionname() {
-	echo bp_get_displayed_user_mentionname();
-}
-	/**
-	 * Get the mentionname for the displayed user.
-	 *
-	 * @since 1.9.0
-	 *
-	 * @return string Mentionname for the displayed user, if available.
-	 */
-	function bp_get_displayed_user_mentionname() {
-
-		/**
-		 * Filters the mentionname for the displayed user.
-		 *
-		 * @since 1.9.0
-		 *
-		 * @param string $value The mentionanme for the displayed user.
-		 */
-		return apply_filters( 'bp_get_displayed_user_mentionname', bp_activity_get_user_mentionname( bp_displayed_user_id() ) );
-	}
-
-/**
- * Echo a list of all registered activity types for use in dropdowns or checkbox lists.
- *
- * @since 1.7.0
- *
- * @param string       $output Optional. Either 'select' or 'checkbox'. Default: 'select'.
- * @param array|string $args {
- *     Optional extra arguments.
- *     @type string       $checkbox_name When returning checkboxes, sets the 'name'
- *                                       attribute.
- *     @type array|string $selected      A list of types that should be checked/
- *                                       selected.
- * }
- */
-function bp_activity_types_list( $output = 'select', $args = '' ) {
-
-	$args = bp_parse_args( $args, array(
-		'checkbox_name' => 'bp_activity_types',
-		'selected'      => array(),
-	) );
-
-	$activities = bp_activity_get_types();
-	natsort( $activities );
-
-	// Loop through the activity types and output markup.
-	foreach ( $activities as $type => $description ) {
-
-		// See if we need to preselect the current type.
-		$checked  = checked(  true, in_array( $type, (array) $args['selected'] ), false );
-		$selected = selected( true, in_array( $type, (array) $args['selected'] ), false );
-
-		// Switch output based on the element.
-		switch ( $output ) {
-			case 'select' :
-				printf( '<option value="%1$s" %2$s>%3$s</option>', esc_attr( $type ), $selected, esc_html( $description ) );
-				break;
-			case 'checkbox' :
-				printf( '<label style="" for="%1$s[]">%2$s<input type="checkbox" id="%1$s[]" name="%1$s[]" value="%3$s" %4$s/></label>', esc_attr( $args['checkbox_name'] ), esc_html( $description ), esc_attr( $args['checkbox_name'] ), esc_attr( $args['checkbox_name'] ), esc_attr( $type ), $checked );
-				break;
-		}
-
-		/**
-		 * Fires at the end of the listing of activity types.
-		 *
-		 * This is a variable action hook. The actual hook to use will depend on the output type specified.
-		 * Two default hooks are bp_activity_types_list_select and bp_activity_types_list_checkbox.
-		 *
-		 * @since 1.7.0
-		 *
-		 * @param array  $args        Array of arguments passed into function.
-		 * @param string $type        Activity type being rendered in the output.
-		 * @param string $description Description of the activity type being rendered.
-		 */
-		do_action( 'bp_activity_types_list_' . $output, $args, $type, $description );
-	}
-
-	// Backpat with BP-Default for dropdown boxes only.
-	if ( 'select' === $output ) {
-		do_action( 'bp_activity_filter_options' );
-	}
-}
-
-
-/* RSS Feed Template Tags ****************************************************/
-
-/**
- * Output the sitewide activity feed link.
- *
- * @since 1.0.0
- *
- * @uses bp_get_sitewide_activity_feed_link()
- */
-function bp_sitewide_activity_feed_link() {
-	echo bp_get_sitewide_activity_feed_link();
-}
-
-	/**
-	 * Returns the sitewide activity feed link.
-	 *
-	 * @since 1.0.0
-	 *
-	 * @uses home_url()
-	 * @uses bp_get_activity_root_slug()
-	 * @uses apply_filters() To call the 'bp_get_sitewide_activity_feed_link' hook.
-	 *
-	 * @return string The sitewide activity feed link.
-	 */
-	function bp_get_sitewide_activity_feed_link() {
-
-		/**
-		 * Filters the sidewide activity feed link.
-		 *
-		 * @since 1.0.0
-		 *
-		 * @param string $value The feed link for sitewide activity.
-		 */
-		return apply_filters( 'bp_get_sitewide_activity_feed_link', bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/feed/' );
-	}
-
-/**
- * Output the member activity feed link.
- *
- * @since 1.2.0
- *
- * @uses bp_get_member_activity_feed_link()
- */
-function bp_member_activity_feed_link() {
-	echo bp_get_member_activity_feed_link();
-}
-
-/**
- * Output the member activity feed link.
- *
- * @since 1.0.0
- * @deprecated 1.2.0
- *
- * @todo properly deprecate in favor of bp_member_activity_feed_link().
- *
- * @uses bp_get_member_activity_feed_link()
- */
-function bp_activities_member_rss_link() { echo bp_get_member_activity_feed_link(); }
-
-	/**
-	 * Return the member activity feed link.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @uses bp_is_profile_component()
-	 * @uses bp_is_current_action()
-	 * @uses bp_displayed_user_domain()
-	 * @uses bp_get_activity_slug()
-	 * @uses bp_is_active()
-	 * @uses bp_get_friends_slug()
-	 * @uses bp_get_groups_slug()
-	 * @uses apply_filters() To call the 'bp_get_activities_member_rss_link' hook.
-	 *
-	 * @return string $link The member activity feed link.
-	 */
-	function bp_get_member_activity_feed_link() {
-
-		// Single member activity feed link.
-		if ( bp_is_profile_component() || bp_is_current_action( 'just-me' ) ) {
-			$link = bp_displayed_user_domain() . bp_get_activity_slug() . '/feed/';
-
-		// Friend feed link.
-		} elseif ( bp_is_active( 'friends' ) && bp_is_current_action( bp_get_friends_slug() ) ) {
-			$link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/feed/';
-
-		// Group feed link.
-		} elseif ( bp_is_active( 'groups'  ) && bp_is_current_action( bp_get_groups_slug()  ) ) {
-			$link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/feed/';
-
-		// Favorites activity feed link.
-		} elseif ( 'favorites' === bp_current_action() ) {
-			$link = bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/feed/';
-
-		// Mentions activity feed link.
-		} elseif ( ( 'mentions' === bp_current_action() ) && bp_activity_do_mentions() ) {
-			$link = bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed/';
-
-		// No feed link.
-		} else {
-			$link = '';
-		}
-
-		/**
-		 * Filters the member activity feed link.
-		 *
-		 * @since 1.0.0
-		 *
-		 * @param string $link URL for the member activity feed.
-		 */
-		return apply_filters( 'bp_get_activities_member_rss_link', $link );
-	}
-
-	/**
-	 * Return the member activity feed link.
-	 *
-	 * @since 1.0.0
-	 * @deprecated 1.2.0
-	 *
-	 * @todo properly deprecate in favor of bp_get_member_activity_feed_link().
-	 *
-	 * @uses bp_get_member_activity_feed_link()
-	 *
-	 * @return string The member activity feed link.
-	 */
-	function bp_get_activities_member_rss_link() { return bp_get_member_activity_feed_link(); }
-
-
-/** Template tags for RSS feed output ****************************************/
-
-/**
- * Outputs the activity feed item guid.
- *
- * @since 1.0.0
- *
- * @uses bp_activity_feed_item_guid()
- */
-function bp_activity_feed_item_guid() {
-	echo bp_get_activity_feed_item_guid();
-}
-
-	/**
-	 * Returns the activity feed item guid.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_feed_item_guid' hook.
-	 *
-	 * @return string The activity feed item guid.
-	 */
-	function bp_get_activity_feed_item_guid() {
-		global $activities_template;
-
-		/**
-		 * Filters the activity feed item guid.
-		 *
-		 * @since 1.1.3
-		 *
-		 * @param string $value Calculated md5 value for the activity feed item.
-		 */
-		return apply_filters( 'bp_get_activity_feed_item_guid', md5( $activities_template->activity->date_recorded . '-' . $activities_template->activity->content ) );
-	}
-
-/**
- * Output the activity feed item title.
- *
- * @since 1.0.0
- *
- * @uses bp_get_activity_feed_item_title()
- */
-function bp_activity_feed_item_title() {
-	echo bp_get_activity_feed_item_title();
-}
-
-	/**
-	 * Return the activity feed item title.
-	 *
-	 * @since 1.0.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses ent2ncr()
-	 * @uses convert_chars()
-	 * @uses bp_create_excerpt()
-	 * @uses apply_filters() To call the 'bp_get_activity_feed_item_title' hook.
-	 *
-	 * @return string $title The 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   = strip_tags( ent2ncr( trim( convert_chars( $content[0] ) ) ) );
-
-		if ( ':' === substr( $title, -1 ) ) {
-			$title = substr( $title, 0, -1 );
-		}
-
-		if ( 'activity_update' === $activities_template->activity->type ) {
-			$title .= ': ' . strip_tags( ent2ncr( trim( convert_chars( bp_create_excerpt( $activities_template->activity->content, 70, array( 'ending' => " [&#133;]" ) ) ) ) ) );
-		}
-
-		/**
-		 * Filters the activity feed item title.
-		 *
-		 * @since 1.0.0
-		 *
-		 * @param string $title The title for the activity feed item.
-		 */
-		return apply_filters( 'bp_get_activity_feed_item_title', $title );
-	}
-
-/**
- * Output the activity feed item link.
- *
- * @since 1.0.0
- *
- * @uses bp_get_activity_feed_item_link()
- */
-function bp_activity_feed_item_link() {
-	echo bp_get_activity_feed_item_link();
-}
-
-	/**
-	 * Return the activity feed item link.
-	 *
-	 * @since 1.0.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_feed_item_link' hook.
-	 *
-	 * @return string The activity feed item link.
-	 */
-	function bp_get_activity_feed_item_link() {
-		global $activities_template;
-
-		$retval = ! empty( $activities_template->activity->primary_link )
-			? $activities_template->activity->primary_link
-			: '';
-
-		/**
-		 * Filters the activity feed item link.
-		 *
-		 * @since 1.0.0
-		 *
-		 * @param string $retval The URL for the activity feed item.
-		 */
-		return apply_filters( 'bp_get_activity_feed_item_link', $retval );
-	}
-
-/**
- * Output the activity feed item date.
- *
- * @since 1.0.0
- *
- * @uses bp_get_activity_feed_item_date()
- */
-function bp_activity_feed_item_date() {
-	echo bp_get_activity_feed_item_date();
-}
-
-	/**
-	 * Return the activity feed item date.
-	 *
-	 * @since 1.0.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses apply_filters() To call the 'bp_get_activity_feed_item_date' hook.
-	 *
-	 * @return string The activity feed item date.
-	 */
-	function bp_get_activity_feed_item_date() {
-		global $activities_template;
-
-		$retval = ! empty( $activities_template->activity->date_recorded )
-			? $activities_template->activity->date_recorded
-			: '';
-
-		/**
-		 * Filters the activity feed item date.
-		 *
-		 * @since 1.0.0
-		 *
-		 * @param string $retval The date for the activity feed item.
-		 */
-		return apply_filters( 'bp_get_activity_feed_item_date', $retval );
-	}
-
-/**
- * Output the activity feed item description.
- *
- * @since 1.0.0
- *
- * @uses bp_get_activity_feed_item_description()
- */
-function bp_activity_feed_item_description() {
-	echo bp_get_activity_feed_item_description();
-}
-
-	/**
-	 * Return the activity feed item description.
-	 *
-	 * @since 1.0.0
-	 *
-	 * @global object $activities_template {@link BP_Activity_Template}
-	 * @uses ent2ncr()
-	 * @uses convert_chars()
-	 * @uses apply_filters() To call the 'bp_get_activity_feed_item_description' hook.
-	 *
-	 * @return string The activity feed item description.
-	 */
-	function bp_get_activity_feed_item_description() {
-		global $activities_template;
-
-		// Get the content, if exists.
-		$content = ! empty( $activities_template->activity->content )
-			? $activities_template->activity->content
-			: '';
-
-		// Perform a few string conversions on the content, if it's not empty.
-		if ( ! empty( $content ) ) {
-			$content = ent2ncr( convert_chars( str_replace( '%s', '', $content ) ) );
-		}
-
-		/**
-		 * Filters the activity feed item description.
-		 *
-		 * @since 1.0.0
-		 *
-		 * @param string $content The description for the activity feed item.
-		 */
-		return apply_filters( 'bp_get_activity_feed_item_description', $content );
-	}
-
-/**
- * Template tag so we can hook activity feed to <head>.
- *
- * @since 1.5.0
- *
- * @uses bloginfo()
- * @uses bp_sitewide_activity_feed_link()
- */
-function bp_activity_sitewide_feed() {
-?>
-
-	<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
-}
-add_action( 'bp_head', 'bp_activity_sitewide_feed' );
-
-/**
- * Display available filters depending on the scope.
- *
- * @since 2.1.0
- *
- * @param string $context The current context. 'activity', 'member',
- *                        'member_groups', 'group'.
- * @uses bp_get_activity_show_filters()
- */
-function bp_activity_show_filters( $context = '' ) {
-	echo bp_get_activity_show_filters( $context );
-}
-	/**
-	 * Get available filters depending on the scope.
-	 *
-	 * @since 2.1.0
-	 *
-	 * @param string $context The current context. 'activity', 'member',
-	 *                        'member_groups', 'group'.
-	 *
-	 * @return string HTML for <option> values.
-	 */
-	function bp_get_activity_show_filters( $context = '' ) {
-		// Set default context based on current page.
-		if ( empty( $context ) ) {
-
-			// On member pages, default to 'member', unless this
-			// is a user's Groups activity.
-			if ( bp_is_user() ) {
-				if ( bp_is_active( 'groups' ) && bp_is_current_action( bp_get_groups_slug() ) ) {
-					$context = 'member_groups';
-				} else {
-					$context = 'member';
-				}
-
-			// On individual group pages, default to 'group'.
-			} elseif ( bp_is_active( 'groups' ) && bp_is_group() ) {
-				$context = 'group';
-
-			// 'activity' everywhere else.
-			} else {
-				$context = 'activity';
-			}
-		}
-
-		$filters = array();
-
-		// Walk through the registered actions, and prepare an the
-		// select box options.
-		foreach ( bp_activity_get_actions() as $actions ) {
-			foreach ( $actions as $action ) {
-				if ( ! in_array( $context, (array) $action['context'] ) ) {
-					continue;
-				}
-
-				// Friends activity collapses two filters into one.
-				if ( in_array( $action['key'], array( 'friendship_accepted', 'friendship_created' ) ) ) {
-					$action['key'] = 'friendship_accepted,friendship_created';
-				}
-
-				$filters[ $action['key'] ] = $action['label'];
-			}
-		}
-
-		/**
-		 * Filters the options available in the activity filter dropdown.
-		 *
-		 * @since 2.2.0
-		 *
-		 * @param array  $filters Array of filter options for the given context, in the following format: $option_value => $option_name.
-		 * @param string $context Context for the filter. 'activity', 'member', 'member_groups', 'group'.
-		 */
-		$filters = apply_filters( 'bp_get_activity_show_filters_options', $filters, $context );
-
-		// Build the options output.
-		$output = '';
-
-		if ( ! empty( $filters ) ) {
-			foreach ( $filters as $value => $filter ) {
-				$output .= '<option value="' . esc_attr( $value ) . '">' . esc_html( $filter ) . '</option>' . "\n";
-			}
-		}
-
-		/**
-		 * Filters the HTML markup result for the activity filter dropdown.
-		 *
-		 * @since 2.1.0
-		 *
-		 * @param string $output  HTML output for the activity filter dropdown.
-		 * @param array  $filters Array of filter options for the given context, in the following format: $option_value => $option_name.
-		 * @param string $context Context for the filter. 'activity', 'member', 'member_groups', 'group'.
-		 */
-		return apply_filters( 'bp_get_activity_show_filters', $output, $filters, $context );
-	}
Index: src/bp-activity/classes/class-bp-activity-theme-compat.php
===================================================================
--- src/bp-activity/classes/class-bp-activity-theme-compat.php	(revision 10496)
+++ src/bp-activity/classes/class-bp-activity-theme-compat.php	(working copy)
@@ -1,422 +1,6 @@
 <?php
-/**
- * BuddyPress Activity Screens.
- *
- * The functions in this file detect, with each page load, whether an Activity
- * component page is being requested. If so, it parses any necessary data from
- * the URL, and tells BuddyPress to load the appropriate template.
- *
- * @package BuddyPress
- * @subpackage ActivityScreens
- * @since 1.5.0
- */
 
-// Exit if accessed directly.
-defined( 'ABSPATH' ) || exit;
-
 /**
- * Load the Activity directory.
- *
- * @since 1.5.0
- *
- * @uses bp_displayed_user_id()
- * @uses bp_is_activity_component()
- * @uses bp_current_action()
- * @uses bp_update_is_directory()
- * @uses do_action() To call the 'bp_activity_screen_index' hook.
- * @uses bp_core_load_template()
- * @uses apply_filters() To call the 'bp_activity_screen_index' hook.
- */
-function bp_activity_screen_index() {
-	if ( bp_is_activity_directory() ) {
-		bp_update_is_directory( true, 'activity' );
-
-		/**
-		 * Fires right before the loading of the Activity directory screen template file.
-		 *
-		 * @since 1.5.0
-		 */
-		do_action( 'bp_activity_screen_index' );
-
-		/**
-		 * Filters the template to load for the Activity directory screen.
-		 *
-		 * @since 1.5.0
-		 *
-		 * @param string $template Path to the activity template to load.
-		 */
-		bp_core_load_template( apply_filters( 'bp_activity_screen_index', 'activity/index' ) );
-	}
-}
-add_action( 'bp_screens', 'bp_activity_screen_index' );
-
-/**
- * Load the 'My Activity' page.
- *
- * @since 1.0.0
- *
- * @uses do_action() To call the 'bp_activity_screen_my_activity' hook.
- * @uses bp_core_load_template()
- * @uses apply_filters() To call the 'bp_activity_template_my_activity' hook.
- */
-function bp_activity_screen_my_activity() {
-
-	/**
-	 * Fires right before the loading of the "My Activity" screen template file.
-	 *
-	 * @since 1.0.0
-	 */
-	do_action( 'bp_activity_screen_my_activity' );
-
-	/**
-	 * Filters the template to load for the "My Activity" screen.
-	 *
-	 * @since 1.0.0
-	 *
-	 * @param string $template Path to the activity template to load.
-	 */
-	bp_core_load_template( apply_filters( 'bp_activity_template_my_activity', 'members/single/home' ) );
-}
-
-/**
- * Load the 'My Friends' activity page.
- *
- * @since 1.0.0
- *
- * @uses bp_is_active()
- * @uses bp_update_is_item_admin()
- * @uses bp_current_user_can()
- * @uses do_action() To call the 'bp_activity_screen_friends' hook.
- * @uses bp_core_load_template()
- * @uses apply_filters() To call the 'bp_activity_template_friends_activity' hook.
- */
-function bp_activity_screen_friends() {
-	if ( !bp_is_active( 'friends' ) )
-		return false;
-
-	bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
-
-	/**
-	 * Fires right before the loading of the "My Friends" screen template file.
-	 *
-	 * @since 1.2.0
-	 */
-	do_action( 'bp_activity_screen_friends' );
-
-	/**
-	 * Filters the template to load for the "My Friends" screen.
-	 *
-	 * @since 1.0.0
-	 *
-	 * @param string $template Path to the activity template to load.
-	 */
-	bp_core_load_template( apply_filters( 'bp_activity_template_friends_activity', 'members/single/home' ) );
-}
-
-/**
- * Load the 'My Groups' activity page.
- *
- * @since 1.2.0
- *
- * @uses bp_is_active()
- * @uses bp_update_is_item_admin()
- * @uses bp_current_user_can()
- * @uses do_action() To call the 'bp_activity_screen_groups' hook.
- * @uses bp_core_load_template()
- * @uses apply_filters() To call the 'bp_activity_template_groups_activity' hook.
- */
-function bp_activity_screen_groups() {
-	if ( !bp_is_active( 'groups' ) )
-		return false;
-
-	bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
-
-	/**
-	 * Fires right before the loading of the "My Groups" screen template file.
-	 *
-	 * @since 1.2.0
-	 */
-	do_action( 'bp_activity_screen_groups' );
-
-	/**
-	 * Filters the template to load for the "My Groups" screen.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @param string $template Path to the activity template to load.
-	 */
-	bp_core_load_template( apply_filters( 'bp_activity_template_groups_activity', 'members/single/home' ) );
-}
-
-/**
- * Load the 'Favorites' activity page.
- *
- * @since 1.2.0
- *
- * @uses bp_update_is_item_admin()
- * @uses bp_current_user_can()
- * @uses do_action() To call the 'bp_activity_screen_favorites' hook.
- * @uses bp_core_load_template()
- * @uses apply_filters() To call the 'bp_activity_template_favorite_activity' hook.
- */
-function bp_activity_screen_favorites() {
-	bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
-
-	/**
-	 * Fires right before the loading of the "Favorites" screen template file.
-	 *
-	 * @since 1.2.0
-	 */
-	do_action( 'bp_activity_screen_favorites' );
-
-	/**
-	 * Filters the template to load for the "Favorites" screen.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @param string $template Path to the activity template to load.
-	 */
-	bp_core_load_template( apply_filters( 'bp_activity_template_favorite_activity', 'members/single/home' ) );
-}
-
-/**
- * Load the 'Mentions' activity page.
- *
- * @since 1.2.0
- *
- * @uses bp_update_is_item_admin()
- * @uses bp_current_user_can()
- * @uses do_action() To call the 'bp_activity_screen_mentions' hook.
- * @uses bp_core_load_template()
- * @uses apply_filters() To call the 'bp_activity_template_mention_activity' hook.
- */
-function bp_activity_screen_mentions() {
-	bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
-
-	/**
-	 * Fires right before the loading of the "Mentions" screen template file.
-	 *
-	 * @since 1.2.0
-	 */
-	do_action( 'bp_activity_screen_mentions' );
-
-	/**
-	 * Filters the template to load for the "Mentions" screen.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @param string $template Path to the activity template to load.
-	 */
-	bp_core_load_template( apply_filters( 'bp_activity_template_mention_activity', 'members/single/home' ) );
-}
-
-/**
- * Reset the logged-in user's new mentions data when he visits his mentions screen.
- *
- * @since 1.5.0
- *
- * @uses bp_is_my_profile()
- * @uses bp_activity_clear_new_mentions()
- * @uses bp_loggedin_user_id()
- */
-function bp_activity_reset_my_new_mentions() {
-	if ( bp_is_my_profile() )
-		bp_activity_clear_new_mentions( bp_loggedin_user_id() );
-}
-add_action( 'bp_activity_screen_mentions', 'bp_activity_reset_my_new_mentions' );
-
-/**
- * Load the page for a single activity item.
- *
- * @since 1.2.0
- *
- * @uses bp_is_activity_component()
- * @uses bp_activity_get_specific()
- * @uses bp_current_action()
- * @uses bp_action_variables()
- * @uses bp_do_404()
- * @uses bp_is_active()
- * @uses groups_get_group()
- * @uses groups_is_user_member()
- * @uses apply_filters_ref_array() To call the 'bp_activity_permalink_access' hook.
- * @uses do_action() To call the 'bp_activity_screen_single_activity_permalink' hook.
- * @uses bp_core_add_message()
- * @uses is_user_logged_in()
- * @uses bp_core_redirect()
- * @uses site_url()
- * @uses esc_url()
- * @uses bp_get_root_domain()
- * @uses bp_get_activity_root_slug()
- * @uses bp_core_load_template()
- * @uses apply_filters() To call the 'bp_activity_template_profile_activity_permalink' hook.
- */
-function bp_activity_screen_single_activity_permalink() {
-	$bp = buddypress();
-
-	// No displayed user or not viewing activity component.
-	if ( !bp_is_activity_component() )
-		return false;
-
-	if ( ! 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(), 'show_hidden' => true, 'spam' => 'ham_only', ) );
-
-	// 404 if activity does not exist
-	if ( empty( $activity['activities'][0] ) || bp_action_variables() ) {
-		bp_do_404();
-		return;
-
-	} else {
-		$activity = $activity['activities'][0];
-	}
-
-	// Default access is true.
-	$has_access = true;
-
-	// If activity is from a group, do an extra cap check.
-	if ( isset( $bp->groups->id ) && $activity->component == $bp->groups->id ) {
-
-		// Activity is from a group, but groups is currently disabled.
-		if ( !bp_is_active( 'groups') ) {
-			bp_do_404();
-			return;
-		}
-
-		// Check to see if the group is not public, if so, check the
-		// user has access to see this activity.
-		if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) {
-
-			// Group is not public.
-			if ( 'public' != $group->status ) {
-
-				// User is not a member of group.
-				if ( !groups_is_user_member( bp_loggedin_user_id(), $group->id ) ) {
-					$has_access = false;
-				}
-			}
-		}
-	}
-
-	/**
-	 * Filters the access permission for a single activity view.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @param array $access Array holding the current $has_access value and current activity item instance.
-	 */
-	$has_access = apply_filters_ref_array( 'bp_activity_permalink_access', array( $has_access, &$activity ) );
-
-	/**
-	 * Fires before the loading of a single activity template file.
-	 *
-	 * @since 1.2.0
-	 *
-	 * @param BP_Activity_Activity $activity   Object representing the current activity item being displayed.
-	 * @param bool                 $has_access Whether or not the current user has access to view activity.
-	 */
-	do_action( 'bp_activity_screen_single_activity_permalink', $activity, $has_access );
-
-	// Access is specifically disallowed.
-	if ( false === $has_access ) {
-
-		// User feedback.
-		bp_core_add_message( __( 'You do not have access to this activity.', 'buddypress' ), 'error' );
-
-		// Redirect based on logged in status.
-		if ( is_user_logged_in() ) {
-			$url = bp_loggedin_user_domain();
-
-		} else {
-			$url = sprintf(
-				site_url( 'wp-login.php?redirect_to=%s' ),
-				urlencode( esc_url_raw( bp_activity_get_permalink( (int) bp_current_action() ) ) )
-			);
-		}
-
-		bp_core_redirect( $url );
-	}
-
-	/**
-	 * Filters the template to load for a single activity screen.
-	 *
-	 * @since 1.0.0
-	 *
-	 * @param string $template Path to the activity template to load.
-	 */
-	bp_core_load_template( apply_filters( 'bp_activity_template_profile_activity_permalink', 'members/single/activity/permalink' ) );
-}
-add_action( 'bp_screens', 'bp_activity_screen_single_activity_permalink' );
-
-/**
- * Add activity notifications settings to the notifications settings page.
- *
- * @since 1.2.0
- *
- * @uses bp_get_user_meta()
- * @uses bp_core_get_username()
- * @uses do_action() To call the 'bp_activity_screen_notification_settings' hook.
- */
-function bp_activity_screen_notification_settings() {
-
-	if ( bp_activity_do_mentions() ) {
-		if ( ! $mention = bp_get_user_meta( bp_displayed_user_id(), 'notification_activity_new_mention', true ) ) {
-			$mention = 'yes';
-		}
-	}
-
-	if ( ! $reply = bp_get_user_meta( bp_displayed_user_id(), 'notification_activity_new_reply', true ) ) {
-		$reply = 'yes';
-	}
-
-	?>
-
-	<table class="notification-settings" id="activity-notification-settings">
-		<thead>
-			<tr>
-				<th class="icon">&nbsp;</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>
-			<?php if ( bp_activity_do_mentions() ) : ?>
-				<tr id="activity-notification-settings-mentions">
-					<td>&nbsp;</td>
-					<td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( bp_displayed_user_id() ) ) ?></td>
-					<td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" id="notification-activity-new-mention-yes" value="yes" <?php checked( $mention, 'yes', true ) ?>/><label for="notification-activity-new-mention-yes" class="bp-screen-reader-text"><?php _e( 'Yes, send email', 'buddypress' ); ?></label></td>
-					<td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" id="notification-activity-new-mention-no" value="no" <?php checked( $mention, 'no', true ) ?>/><label for="notification-activity-new-mention-no" class="bp-screen-reader-text"><?php _e( 'No, do not send email', 'buddypress' ); ?></label></td>
-				</tr>
-			<?php endif; ?>
-
-			<tr id="activity-notification-settings-replies">
-				<td>&nbsp;</td>
-				<td><?php _e( "A member replies to an update or comment you've posted", 'buddypress' ) ?></td>
-				<td class="yes"><input type="radio" name="notifications[notification_activity_new_reply]" id="notification-activity-new-reply-yes" value="yes" <?php checked( $reply, 'yes', true ) ?>/><label for="notification-activity-new-reply-yes" class="bp-screen-reader-text"><?php _e( 'Yes, send email', 'buddypress' ); ?></label></td>
-				<td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" id="notification-activity-new-reply-no" value="no" <?php checked( $reply, 'no', true ) ?>/><label for="notification-activity-new-reply-no" class="bp-screen-reader-text"><?php _e( 'No, do not send email', 'buddypress' ); ?></label></td>
-			</tr>
-
-			<?php
-
-			/**
-			 * Fires inside the closing </tbody> tag for activity screen notification settings.
-			 *
-			 * @since 1.2.0
-			 */
-			do_action( 'bp_activity_screen_notification_settings' ) ?>
-		</tbody>
-	</table>
-
-<?php
-}
-add_action( 'bp_notification_settings', 'bp_activity_screen_notification_settings', 1 );
-
-/** Theme Compatibility *******************************************************/
-
-/**
  * The main theme compat class for BuddyPress Activity.
  *
  * This class sets up the necessary theme compatibility actions to safely output
@@ -585,4 +169,3 @@
 		return bp_buffer_template_part( 'activity/single/home', null, false );
 	}
 }
-new BP_Activity_Theme_Compat();
Index: src/bp-activity/classes/class-bp-akismet.php
===================================================================
--- src/bp-activity/classes/class-bp-akismet.php	(revision 10496)
+++ src/bp-activity/classes/class-bp-akismet.php	(working copy)
@@ -649,41 +649,3 @@
 		return $history;
 	}
 }
-
-/**
- * Delete old spam activity meta data.
- *
- * This is done as a clean-up mechanism, as _bp_akismet_submission meta can
- * grow to be quite large.
- *
- * @since 1.6.0
- *
- * @global wpdb $wpdb WordPress database object.
- */
-function bp_activity_akismet_delete_old_metadata() {
-	global $wpdb;
-
-	$bp = buddypress();
-
-	/**
-	 * Filters the threshold for how many days old Akismet metadata needs to be before being automatically deleted.
-	 *
-	 * @since 1.6.0
-	 *
-	 * @param integer 15 How many days old metadata needs to be.
-	 */
-	$interval = apply_filters( 'bp_activity_akismet_delete_meta_interval', 15 );
-
-	// Enforce a minimum of 1 day.
-	$interval = max( 1, absint( $interval ) );
-
-	// _bp_akismet_submission meta values are large, so expire them after $interval days regardless of the activity status
-	$sql          = $wpdb->prepare( "SELECT a.id FROM {$bp->activity->table_name} a LEFT JOIN {$bp->activity->table_name_meta} m ON a.id = m.activity_id WHERE m.meta_key = %s AND DATE_SUB(%s, INTERVAL {$interval} DAY) > a.date_recorded LIMIT 10000", '_bp_akismet_submission', current_time( 'mysql', 1 ) );
-	$activity_ids = $wpdb->get_col( $sql );
-
-	if ( ! empty( $activity_ids ) ) {
-		foreach ( $activity_ids as $activity_id )
-			bp_activity_delete_meta( $activity_id, '_bp_akismet_submission' );
-	}
-}
-add_action( 'bp_activity_akismet_delete_old_metadata', 'bp_activity_akismet_delete_old_metadata' );
