Index: bp-activity/bp-activity-actions.php
===================================================================
--- bp-activity/bp-activity-actions.php
+++ bp-activity/bp-activity-actions.php
@@ -421,16 +421,22 @@ add_action( 'bp_actions', 'bp_activity_action_remove_favorite' );
  * @return bool False on failure
  */
 function bp_activity_action_sitewide_feed() {
-	global $bp, $wp_query;
+	global $bp;
 
-	if ( !bp_is_activity_component() || !bp_is_current_action( 'feed' ) || bp_is_user() || !empty( $bp->groups->current_group ) )
+	if ( ! bp_is_activity_component() || ! bp_is_current_action( 'feed' ) || bp_is_user() || ! empty( $bp->groups->current_group ) )
 		return false;
 
-	$wp_query->is_404 = false;
-	status_header( 200 );
+	// setup the feed
+	buddypress()->activity->feed = new BP_Feed( array(
+		'id'            => 'sitewide',
+
+		/* translators: Sitewide activity RSS title - "Site Name | Site Wide Activity" */
+		'title'         => sprintf( __( '%s | Site Wide Activity', 'buddypress' ), bp_get_site_name() ),
 
-	include_once( 'feeds/bp-activity-sitewide-feed.php' );
-	die;
+		'link'          => bp_get_activity_directory_permalink() . 'feed',
+		'description'   => __( 'Activity feed for the entire site.', 'buddypress' ),
+		'activity_args' => 'display_comments=threaded'
+	) );
 }
 add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
 
@@ -447,16 +453,21 @@ add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
  * @return bool False on failure
  */
 function bp_activity_action_personal_feed() {
-	global $wp_query;
-
-	if ( !bp_is_user_activity() || !bp_is_current_action( 'feed' ) )
+	if ( ! bp_is_user_activity() || ! bp_is_current_action( 'feed' ) ) {
 		return false;
+	}
+
+	// setup the feed
+	buddypress()->activity->feed = new BP_Feed( array(
+		'id'            => 'personal',
 
-	$wp_query->is_404 = false;
-	status_header( 200 );
+		/* translators: Personal activity RSS title - "[Site Name] | [User Display Name] | Activity Feed" */
+		'title'         => sprintf( __( '%1$s | %2$s | Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
 
-	include_once( 'feeds/bp-activity-personal-feed.php' );
-	die;
+		'link'          => bp_displayed_user_domain() . bp_get_activity_slug() . '/feed',
+		'description'   => sprintf( __( 'Activity feed for %s.', 'buddypress' ), bp_get_displayed_user_fullname() ),
+		'activity_args' => 'user_id=' . bp_displayed_user_id()
+	) );
 }
 add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
 
@@ -476,16 +487,21 @@ add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
  * @return bool False on failure
  */
 function bp_activity_action_friends_feed() {
-	global $wp_query;
-
-	if ( !bp_is_active( 'friends' ) || !bp_is_user_activity() || !bp_is_current_action( bp_get_friends_slug() ) || !bp_is_action_variable( 'feed', 0 ) )
+	if ( ! bp_is_active( 'friends' ) || ! bp_is_user_activity() || ! bp_is_current_action( bp_get_friends_slug() ) || ! bp_is_action_variable( 'feed', 0 ) ) {
 		return false;
+	}
 
-	$wp_query->is_404 = false;
-	status_header( 200 );
+	// setup the feed
+	buddypress()->activity->feed = new BP_Feed( array(
+		'id'            => 'friends',
 
-	include_once( 'feeds/bp-activity-friends-feed.php' );
-	die;
+		/* translators: Friends activity RSS title - "[Site Name] | [User Display Name] | Friends Activity Feed" */
+		'title'         => sprintf( __( '%1$s | %2$s | Friends Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
+
+		'link'          => bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/feed',
+		'description'   => sprintf( __( "Activity feed for %s' friends.", 'buddypress' ), bp_get_displayed_user_fullname() ),
+		'activity_args' => 'scope=friends'
+	) );
 }
 add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
 
@@ -505,16 +521,29 @@ add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
  * @return bool False on failure
  */
 function bp_activity_action_my_groups_feed() {
-	global $wp_query;
-
-	if ( !bp_is_active( 'groups' ) || !bp_is_user_activity() || !bp_is_current_action( bp_get_groups_slug() ) || !bp_is_action_variable( 'feed', 0 ) )
+	if ( ! bp_is_active( 'groups' ) || ! bp_is_user_activity() || ! bp_is_current_action( bp_get_groups_slug() ) || ! bp_is_action_variable( 'feed', 0 ) ) {
 		return false;
+	}
 
-	$wp_query->is_404 = false;
-	status_header( 200 );
-
-	include_once( 'feeds/bp-activity-mygroups-feed.php' );
-	die;
+	// get displayed user's group IDs
+	$groups    = groups_get_user_groups();
+	$group_ids = implode( ',', $groups['groups'] );
+
+	// setup the feed
+	buddypress()->activity->feed = new BP_Feed( array(
+		'id'            => 'mygroups',
+
+		/* translators: Member groups activity RSS title - "[Site Name] | [User Display Name] | Groups Activity Feed" */
+		'title'         => sprintf( __( '%1$s | %2$s | Group Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
+
+		'link'          => bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/feed',
+		'description'   => sprintf( __( "Public group activity feed of which %s is a member of.", 'buddypress' ), bp_get_displayed_user_fullname() ),
+		'activity_args' => array(
+			'object'           => buddypress()->groups->id,
+			'primary_id'       => $group_ids,
+			'display_comments' => 'threaded'
+		)
+	) );
 }
 add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
 
@@ -532,16 +561,23 @@ add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
  * @return bool False on failure
  */
 function bp_activity_action_mentions_feed() {
-	global $wp_query;
-
-	if ( !bp_is_user_activity() || !bp_is_current_action( 'mentions' ) || !bp_is_action_variable( 'feed', 0 ) )
+	if ( ! bp_is_user_activity() || ! bp_is_current_action( 'mentions' ) || ! bp_is_action_variable( 'feed', 0 ) ) {
 		return false;
+	}
+
+	// setup the feed
+	buddypress()->activity->feed = new BP_Feed( array(
+		'id'            => 'mentions',
 
-	$wp_query->is_404 = false;
-	status_header( 200 );
+		/* translators: User mentions activity RSS title - "[Site Name] | [User Display Name] | Mentions" */
+		'title'         => sprintf( __( '%1$s | %2$s | Mentions', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
 
-	include_once( 'feeds/bp-activity-mentions-feed.php' );
-	die;
+		'link'          => bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed',
+		'description'   => sprintf( __( "Activity feed mentioning %s.", 'buddypress' ), bp_get_displayed_user_fullname() ),
+		'activity_args' => array(
+			'search_terms' => '@' . bp_core_get_username( bp_displayed_user_id() )
+		)
+	) );
 }
 add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );
 
@@ -559,16 +595,25 @@ add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );
  * @return bool False on failure
  */
 function bp_activity_action_favorites_feed() {
-	global $wp_query;
-
-	if ( !bp_is_user_activity() || !bp_is_current_action( 'favorites' ) || !bp_is_action_variable( 'feed', 0 ) )
+	if ( ! bp_is_user_activity() || ! bp_is_current_action( 'favorites' ) || ! bp_is_action_variable( 'feed', 0 ) ) {
 		return false;
+	}
+
+	// get displayed user's favorite activity IDs
+	$favs = bp_activity_get_user_favorites( bp_displayed_user_id() );
+	$fav_ids = implode( ',', (array) $favs );
+
+	// setup the feed
+	buddypress()->activity->feed = new BP_Feed( array(
+		'id'            => 'favorites',
 
-	$wp_query->is_404 = false;
-	status_header( 200 );
+		/* translators: User activity favorites RSS title - "[Site Name] | [User Display Name] | Favorites" */
+		'title'         => sprintf( __( '%1$s | %2$s | Favorites', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
 
-	include_once( 'feeds/bp-activity-favorites-feed.php' );
-	die;
+		'link'          => bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/feed',
+		'description'   => sprintf( __( "Activity feed of %s' favorites.", 'buddypress' ), bp_get_displayed_user_fullname() ),
+		'activity_args' => 'include=' . $fav_ids
+	) );
 }
 add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
 
Index: bp-activity/bp-activity-classes.php
===================================================================
--- bp-activity/bp-activity-classes.php
+++ bp-activity/bp-activity-classes.php
@@ -256,7 +256,7 @@ class BP_Activity_Activity {
 			$activity_user_ids = wp_list_pluck( $activities, 'user_id' );
 			$activity_user_ids = implode( ',', wp_parse_id_list( $activity_user_ids ) );
 
-			if ( !empty( $activity_user_ids ) ) {				
+			if ( !empty( $activity_user_ids ) ) {
 				if ( $names = $wpdb->get_results( "SELECT user_id, value AS user_fullname FROM {$bp->profile->table_name_data} WHERE field_id = 1 AND user_id IN ({$activity_user_ids})" ) ) {
 					foreach ( (array) $names as $name )
 						$tmp_names[$name->user_id] = $name->user_fullname;
@@ -726,3 +726,276 @@ class BP_Activity_Activity {
 		return $wpdb->get_var( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET hide_sitewide = 1 WHERE user_id = %d", $user_id ) );
 	}
 }
+
+/**
+ * Create an RSS feed using the activity component.
+ *
+ * You should only construct a new feed when you've validated that you're on
+ * the appropriate screen.
+ *
+ * See {@link bp_activity_action_sitewide_feed()} as an example.
+ *
+ * Accepted parameters:
+ *   id	              - internal id for the feed; should be alphanumeric only
+ *                      (required)
+ *   title            - RSS feed title
+ *   link             - Relevant link for the RSS feed
+ *   description      - RSS feed description
+ *   ttl              - Time-to-live (see inline doc in constructor)
+ *   update_period    - Part of the syndication module (see inline doc in
+ *                      constructor for more info)
+ *   update_frequency - Part of the syndication module (see inline doc in
+ *                      constructor for more info)
+ *   max              - Number of feed items to display
+ *   activity_args    - Arguments passed to {@link bp_has_activities()}
+ *
+ * @since BuddyPress (1.8)
+ */
+class BP_Feed {
+	/**
+	 * Holds our custom class properties.
+	 *
+	 * These variables are stored in a protected array that is magically
+	 * updated using PHP 5.2+ methods.
+	 *
+	 * @see BP_Feed::__construct() This is where $data is added
+	 * @var array
+	 */
+	protected $data;
+
+	/**
+	 * Magic method for checking the existence of a certain data variable.
+	 *
+	 * @param string $key
+	 */
+	public function __isset( $key ) { return isset( $this->data[$key] ); }
+
+	/**
+	 * Magic method for getting a certain data variable.
+	 *
+	 * @param string $key
+	 */
+	public function __get( $key ) { return isset( $this->data[$key] ) ? $this->data[$key] : null; }
+
+	/**
+	 * Constructor.
+	 *
+	 * @param $args Array
+	 */
+	public function __construct( $args = array() ) {
+		// If feeds are disabled, stop now!
+		if ( ! apply_filters( 'bp_activity_enable_feeds', true ) ) {
+			return;
+		}
+
+		// Setup data
+		$this->data = wp_parse_args( $args, array(
+			// Internal identifier for the RSS feed - should be alphanumeric only
+			'id'               => '',
+
+			// RSS title - should be plain-text
+			'title'            => '',
+
+			// relevant link for the RSS feed
+			'link'             => '',
+
+			// RSS description - should be plain-text
+			'description'      => '',
+
+			// Time-to-live - number of minutes to cache the data before an aggregator
+			// requests it again.  This is only acknowledged if the RSS client supports it
+			//
+			// See: http://www.rssboard.org/rss-profile#element-channel-ttl
+			//      http://www.kbcafe.com/rss/rssfeedstate.html#ttl
+			'ttl'              => '30',
+
+			// Syndication module - similar to ttl, but not really supported by RSS
+			// clients
+			//
+			// See: http://web.resource.org/rss/1.0/modules/syndication/#description
+			//      http://www.kbcafe.com/rss/rssfeedstate.html#syndicationmodule
+			'update_period'    => 'hourly',
+			'update_frequency' => 2,
+
+			// Number of items to display
+			'max'              => 50,
+
+			// Activity arguments passed to bp_has_activities()
+			'activity_args'    => array()
+		) );
+
+		// Plugins can use this filter to modify the feed before it is setup
+		do_action_ref_array( 'bp_feed_prefetch', array( &$this ) );
+
+		// Setup class properties
+		$this->setup_properties();
+
+		// Check if id is valid
+		if ( empty( $this->id ) ) {
+			_doing_it_wrong( 'BP_Feed', __( "RSS feed 'id' must be defined", 'buddypress' ), 'BP 1.8' );
+			return;
+		}
+
+		// Setup feed hooks
+		$this->setup_hooks();
+
+		// Output the feed
+		$this->output();
+
+		// Kill the rest of the output
+		die();
+	}
+
+	/** SETUP ****************************************************************/
+
+	/**
+	 * Setup and validate the class properties.
+	 */
+	protected function setup_properties() {
+		$this->id               = sanitize_title( $this->id );
+		$this->title            = strip_tags( $this->title );
+		$this->link             = esc_url_raw( $this->link );
+		$this->description      = strip_tags( $this->description );
+		$this->ttl              = (int) $this->ttl;
+		$this->update_period    = strip_tags( $this->update_period );
+		$this->update_frequency = (int) $this->update_frequency;
+
+		$this->activity_args    = wp_parse_args( $this->activity_args, array(
+			'max'              => $this->max,
+			'display_comments' => 'stream'
+		) );
+	}
+
+	/**
+	 * Setup some hooks that are used in the feed.
+	 *
+	 * Currently, these hooks are used to maintain backwards compatibility with
+	 * the RSS feeds previous to BP 1.8.
+	 */
+	protected function setup_hooks() {
+		add_action( 'bp_feed_rss_attributes',   array( $this, 'backpat_rss_attributes' ) );
+		add_action( 'bp_feed_channel_elements', array( $this, 'backpat_channel_elements' ) );
+		add_action( 'bp_feed_item_elements',    array( $this, 'backpat_item_elements' ) );
+	}
+
+	/** BACKPAT HOOKS ********************************************************/
+
+	public function backpat_rss_attributes() {
+		do_action( 'bp_activity_' . $this->id . '_feed' );
+	}
+
+	public function backpat_channel_elements() {
+		do_action( 'bp_activity_' . $this->id . '_feed_head' );
+	}
+
+	public function backpat_item_elements() {
+		switch ( $this->id ) {
+
+			// sitewide and friends feeds use the 'personal' hook
+			case 'sitewide' :
+			case 'friends' :
+				$id = 'personal';
+
+				break;
+
+			default :
+				$id = $this->id;
+
+				break;
+		}
+
+		do_action( 'bp_activity_' . $id . '_feed_item' );
+	}
+
+	/** HELPERS **************************************************************/
+
+	/**
+	 * Output the feed's item content.
+	 */
+	protected function feed_content() {
+		bp_activity_feed_item_description();
+
+		switch ( $this->id ) {
+
+			// also output parent activity item if we're on a specific feed
+			case 'favorites' :
+			case 'friends' :
+			case 'mentions' :
+			case 'personal' :
+
+				if ( 'activity_comment' == bp_get_activity_action_name() ) :
+			?>
+				<strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
+				<?php bp_activity_parent_content() ?>
+			<?php
+				endif;
+
+				break;
+		}
+	}
+
+	/** OUTPUT ***************************************************************/
+
+	/**
+	 * Output the RSS feed.
+	 */
+	protected function output() {
+		// set up some additional headers if not on a directory page
+		// this is done b/c BP uses pseudo-pages
+		if ( ! bp_is_directory() ) {
+			global $wp_query;
+
+			$wp_query->is_404 = false;
+			status_header( 200 );
+		}
+
+		header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
+		echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?'.'>';
+	?>
+
+<rss version="2.0"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:atom="http://www.w3.org/2005/Atom"
+	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
+	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
+	<?php do_action( 'bp_feed_rss_attributes' ); ?>
+>
+
+<channel>
+	<title><?php echo $this->title; ?></title>
+	<link><?php echo $this->link; ?></link>
+	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
+	<description><?php echo $this->description ?></description>
+	<lastBuildDate><?php echo mysql2date( 'D, d M Y H:i:s O', bp_activity_get_last_updated(), false ); ?></lastBuildDate>
+	<generator>http://buddypress.org/?v=<?php bp_version(); ?></generator>
+	<language><?php bloginfo_rss( 'language' ); ?></language>
+	<ttl><?php echo $this->ttl; ?></ttl>
+	<sy:updatePeriod><?php echo $this->update_period; ?></sy:updatePeriod>
+ 	<sy:updateFrequency><?php echo $this->update_frequency; ?></sy:updateFrequency>
+	<?php do_action( 'bp_feed_channel_elements' ); ?>
+
+	<?php if ( bp_has_activities( $this->activity_args ) ) : ?>
+		<?php while ( bp_activities() ) : bp_the_activity(); ?>
+			<item>
+				<guid isPermaLink="true"><?php bp_activity_thread_permalink(); ?></guid>
+				<title><?php echo stripslashes( bp_get_activity_feed_item_title() ); ?></title>
+				<link><?php bp_activity_thread_permalink() ?></link>
+				<pubDate><?php echo mysql2date( 'D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false ); ?></pubDate>
+
+				<?php if ( bp_get_activity_feed_item_description() ) : ?>
+					<content:encoded><![CDATA[<?php $this->feed_content(); ?>]]></content:encoded>
+				<?php endif; ?>
+
+				<?php if ( bp_activity_can_comment() ) : ?>
+					<slash:comments><?php bp_activity_comment_count(); ?></slash:comments>
+				<?php endif; ?>
+
+				<?php do_action( 'bp_feed_item_elements' ); ?>
+			</item>
+		<?php endwhile; ?>
+
+	<?php endif; ?>
+</channel>
+</rss><?php
+	}
+}
Index: bp-activity/feeds/bp-activity-favorites-feed.php
deleted file mode 100644
===================================================================
--- bp-activity/feeds/bp-activity-favorites-feed.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-
-/**
- * RSS2 Feed Template for displaying a member's favorite activity
- *
- * @package BuddyPress
- * @subpackage ActivityFeeds
- */
-
-// Exit if accessed directly
-if ( !defined( 'ABSPATH' ) ) exit;
-
-header('Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
-header('Status: 200 OK');
-echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?'.'>'; ?>
-
-<rss version="2.0"
-	xmlns:content="http://purl.org/rss/1.0/modules/content/"
-	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
-	xmlns:dc="http://purl.org/dc/elements/1.1/"
-	xmlns:atom="http://www.w3.org/2005/Atom"
-	<?php do_action('bp_activity_favorites_feed'); ?>
->
-
-<channel>
-	<?php /* translators: Favorited activity RSS title - "[Site Name] | [Displayed User Name] | Favorite Activity" */ ?>
-	<title><?php printf( '%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_displayed_user_fullname(), __( 'Favorite Activity', 'buddypress' ) ) ?></title>
-	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
-	<link><?php echo home_url( bp_get_activity_root_slug() . '/#my-favorites/' ) ?></link>
-	<description><?php printf( __( '%s - Favorite Activity', 'buddypress' ), bp_get_displayed_user_fullname() ) ?></description>
-	<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
-	<generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
-	<language><?php bloginfo_rss( 'language' ); ?></language>
-
-	<?php do_action('bp_activity_favorites_feed_head'); ?>
-
-	<?php
-		$favs = bp_activity_get_user_favorites( bp_displayed_user_id() );
-		$fav_ids = implode( ',', (array) $favs );
-	?>
-
-	<?php if ( bp_has_activities( 'include=' . $fav_ids . '&max=50&display_comments=stream' ) ) : ?>
-		<?php while ( bp_activities() ) : bp_the_activity(); ?>
-
-			<item>
-				<guid><?php bp_activity_thread_permalink() ?></guid>
-				<title><?php bp_activity_feed_item_title() ?></title>
-				<link><?php echo bp_activity_thread_permalink() ?></link>
-				<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
-
-				<description>
-					<![CDATA[
-					<?php bp_activity_feed_item_description() ?>
-
-					<?php if ( bp_activity_can_comment() ) : ?>
-						<p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
-					<?php endif; ?>
-
-					<?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
-						<br /><strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
-						<?php bp_activity_parent_content() ?>
-					<?php endif; ?>
-					]]>
-				</description>
-
-				<?php do_action('bp_activity_favorites_feed_item'); ?>
-
-			</item>
-
-		<?php endwhile; ?>
-	<?php endif; ?>
-
-</channel>
-</rss>
Index: bp-activity/feeds/bp-activity-friends-feed.php
deleted file mode 100644
===================================================================
--- bp-activity/feeds/bp-activity-friends-feed.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-/**
- * RSS2 Feed Template for displaying a member's friends activity stream.
- *
- * @package BuddyPress
- * @subpackage ActivityFeeds
- */
-
-// Exit if accessed directly
-if ( !defined( 'ABSPATH' ) ) exit;
-
-header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
-header('Status: 200 OK');
-echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
-
-<rss version="2.0"
-	xmlns:content="http://purl.org/rss/1.0/modules/content/"
-	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
-	xmlns:dc="http://purl.org/dc/elements/1.1/"
-	xmlns:atom="http://www.w3.org/2005/Atom"
-	<?php do_action('bp_activity_friends_feed'); ?>
->
-
-<channel>
-	<?php /* translators: Member friends activity RSS title - "[Site Name] | Friends Activity" */ ?>
-	<title><?php bp_site_name() ?> | <?php bp_displayed_user_fullname(); ?> | <?php _e( 'Friends Activity', 'buddypress' ); ?></title>
-	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
-	<link><?php echo bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/feed'; ?></link>
-	<description><?php printf( __( '%s - Friends Activity Feed', 'buddypress' ), bp_get_displayed_user_fullname() ); ?></description>
-	<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
-	<generator>http://buddypress.org/?v=<?php echo BP_VERSION; ?></generator>
-	<language><?php bloginfo_rss( 'language' ); ?></language>
-	<?php do_action('bp_activity_friends_feed_head'); ?>
-
-	<?php if ( bp_has_activities( 'scope=friends&max=50&display_comments=stream' ) ) : ?>
-		<?php while ( bp_activities() ) : bp_the_activity(); ?>
-			<item>
-				<guid><?php bp_activity_thread_permalink(); ?></guid>
-				<title><?php bp_activity_feed_item_title(); ?></title>
-				<link><?php echo bp_activity_thread_permalink(); ?></link>
-				<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
-
-				<description>
-					<![CDATA[
-					<?php bp_activity_feed_item_description(); ?>
-
-					<?php if ( bp_activity_can_comment() ) : ?>
-						<p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
-					<?php endif; ?>
-
-					<?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
-						<br /><strong><?php _e( 'In reply to', 'buddypress' ); ?></strong> -
-						<?php bp_activity_parent_content(); ?>
-					<?php endif; ?>
-					]]>
-				</description>
-				<?php do_action('bp_activity_personal_feed_item'); ?>
-			</item>
-		<?php endwhile; ?>
-
-	<?php endif; ?>
-</channel>
-</rss>
Index: bp-activity/feeds/bp-activity-group-feed.php
deleted file mode 100644
===================================================================
--- bp-activity/feeds/bp-activity-group-feed.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-/**
- * RSS2 Feed Template for displaying a group activity stream
- *
- * @package BuddyPress
- * @subpackage ActivityFeeds
- */
-
-// Exit if accessed directly
-if ( !defined( 'ABSPATH' ) ) exit;
-
-header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
-header('Status: 200 OK');
-echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
-
-<rss version="2.0"
-	xmlns:content="http://purl.org/rss/1.0/modules/content/"
-	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
-	xmlns:dc="http://purl.org/dc/elements/1.1/"
-	xmlns:atom="http://www.w3.org/2005/Atom"
-	<?php do_action('bp_activity_group_feed'); ?>
->
-
-<channel>
-	<?php /* translators: Single group activity RSS title - "[Site Name] | [Group Name] | Group Activity" */ ?>
-	<title><?php printf( '%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_current_group_name(), __( 'Group Activity', 'buddypress' ) ) ?></title>
-	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
-	<link><?php echo bp_get_group_permalink( $bp->groups->current_group ) . bp_get_activity_slug() . '/feed' ?></link>
-	<description><?php printf( __( '%s - Group Activity Feed', 'buddypress' ), $bp->groups->current_group->name  ) ?></description>
-	<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
-	<generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
-	<language><?php bloginfo_rss( 'language' ); ?></language>
-	<?php do_action('bp_activity_group_feed_head'); ?>
-
-	<?php if ( bp_has_activities( 'object=' . $bp->groups->id . '&primary_id=' . $bp->groups->current_group->id . '&max=50&display_comments=threaded' ) ) : ?>
-		<?php while ( bp_activities() ) : bp_the_activity(); ?>
-			<item>
-				<guid><?php bp_activity_thread_permalink() ?></guid>
-				<title><?php bp_activity_feed_item_title() ?></title>
-				<link><?php echo bp_activity_thread_permalink() ?></link>
-				<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
-
-				<description>
-					<![CDATA[
-						<?php bp_activity_feed_item_description() ?>
-
-						<?php if ( bp_activity_can_comment() ) : ?>
-							<p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
-						<?php endif; ?>
-					]]>
-				</description>
-				<?php do_action('bp_activity_group_feed_item'); ?>
-			</item>
-		<?php endwhile; ?>
-
-	<?php endif; ?>
-</channel>
-</rss>
Index: bp-activity/feeds/bp-activity-mentions-feed.php
deleted file mode 100644
===================================================================
--- bp-activity/feeds/bp-activity-mentions-feed.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-
-/**
- * RSS2 Feed Template for displaying a member's activity mentions
- *
- * @package BuddyPress
- * @subpackage ActivityFeeds
- */
-
-// Exit if accessed directly
-if ( !defined( 'ABSPATH' ) ) exit;
-
-header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
-header('Status: 200 OK');
-echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
-
-<rss version="2.0"
-	xmlns:content="http://purl.org/rss/1.0/modules/content/"
-	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
-	xmlns:dc="http://purl.org/dc/elements/1.1/"
-	xmlns:atom="http://www.w3.org/2005/Atom"
-	<?php do_action('bp_activity_mentions_feed'); ?>
->
-
-<channel>
-	<?php /* translators: Mentions RSS title - "[Site Name] | [Displayed User Name] | Mentions" */ ?>
-	<title><?php printf( '%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_displayed_user_fullname(), __( 'Mentions', 'buddypress' ) ) ?></title>
-	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
-	<link><?php echo home_url( bp_get_activity_root_slug() . '/#mentions/' ) ?></link>
-	<?php /* translators: Mentions RSS title - "[Site Name] | [Displayed User Name] | Mentions" */ ?>
-	<description><?php printf( __( '%s - Mentions', 'buddypress' ), bp_get_displayed_user_fullname() ) ?></description>
-	<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
-	<generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
-	<language><?php bloginfo_rss( 'language' ); ?></language>
-	<?php do_action('bp_activity_mentions_feed_head'); ?>
-
-	<?php if ( bp_has_activities( 'max=50&display_comments=stream&search_terms=@' . bp_core_get_username( bp_displayed_user_id() ) ) ) : ?>
-		<?php while ( bp_activities() ) : bp_the_activity(); ?>
-			<item>
-				<guid><?php bp_activity_thread_permalink() ?></guid>
-				<title><?php bp_activity_feed_item_title() ?></title>
-				<link><?php echo bp_activity_thread_permalink() ?></link>
-				<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
-
-				<description>
-					<![CDATA[
-					<?php bp_activity_feed_item_description() ?>
-
-					<?php if ( bp_activity_can_comment() ) : ?>
-						<p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
-					<?php endif; ?>
-
-					<?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
-						<br /><strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
-						<?php bp_activity_parent_content() ?>
-					<?php endif; ?>
-					]]>
-				</description>
-				<?php do_action('bp_activity_mentions_feed_item'); ?>
-			</item>
-		<?php endwhile; ?>
-
-	<?php endif; ?>
-</channel>
-</rss>
Index: bp-activity/feeds/bp-activity-mygroups-feed.php
deleted file mode 100644
===================================================================
--- bp-activity/feeds/bp-activity-mygroups-feed.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-
-/**
- * RSS2 Feed Template for displaying a member's group's activity
- *
- * @package BuddyPress
- * @subpackage ActivityFeeds
- */
-
-// Exit if accessed directly
-if ( !defined( 'ABSPATH' ) ) exit;
-
-header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
-header('Status: 200 OK');
-echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
-
-<rss version="2.0"
-	xmlns:content="http://purl.org/rss/1.0/modules/content/"
-	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
-	xmlns:dc="http://purl.org/dc/elements/1.1/"
-	xmlns:atom="http://www.w3.org/2005/Atom"
-	<?php do_action('bp_activity_mygroups_feed'); ?>
->
-
-<channel>
-	<?php /* translators: Member groups activity RSS title - "[Site Name] | [Displayed User Name] | My Groups - Public Activity" */ ?>
-	<title><?php printf( '%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_displayed_user_fullname(), __( 'My Groups - Public Activity', 'buddypress' ) ) ?></title>
-	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
-	<link><?php echo home_url( bp_get_activity_root_slug() . '/#my-groups/' ) ?></link>
-	<?php /* translators: Member groups activity RSS description - "[Displayed user name] - My Groups - Public Activity" */ ?>
-	<description><?php printf( __( '%1$s - My Groups - Public Activity', 'buddypress' ), bp_get_displayed_user_fullname() ) ?></description>
-	<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
-	<generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
-	<language><?php bloginfo_rss( 'language' ); ?></language>
-	<?php do_action('bp_activity_mygroups_feed_head'); ?>
-
-	<?php
-		$groups = groups_get_user_groups( bp_loggedin_user_id() );
-		$group_ids = implode( ',', $groups['groups'] );
-	?>
-
-	<?php if ( bp_has_activities( 'object=' . $bp->groups->id . '&primary_id=' . $group_ids . '&max=50&display_comments=threaded' ) ) : ?>
-		<?php while ( bp_activities() ) : bp_the_activity(); ?>
-			<item>
-				<guid><?php bp_activity_thread_permalink() ?></guid>
-				<title><?php bp_activity_feed_item_title() ?></title>
-				<link><?php echo bp_activity_thread_permalink() ?></link>
-				<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
-
-				<description>
-					<![CDATA[
-						<?php bp_activity_feed_item_description() ?>
-
-						<?php if ( bp_activity_can_comment() ) : ?>
-							<p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
-						<?php endif; ?>
-					]]>
-				</description>
-				<?php do_action('bp_activity_mygroups_feed_item'); ?>
-			</item>
-		<?php endwhile; ?>
-
-	<?php endif; ?>
-</channel>
-</rss>
Index: bp-activity/feeds/bp-activity-personal-feed.php
deleted file mode 100644
===================================================================
--- bp-activity/feeds/bp-activity-personal-feed.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-/**
- * RSS2 Feed Template for displaying a member's activity stream.
- *
- * @package BuddyPress
- * @subpackage ActivityFeeds
- */
-
-// Exit if accessed directly
-if ( !defined( 'ABSPATH' ) ) exit;
-
-header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
-header('Status: 200 OK');
-echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
-
-<rss version="2.0"
-	xmlns:content="http://purl.org/rss/1.0/modules/content/"
-	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
-	xmlns:dc="http://purl.org/dc/elements/1.1/"
-	xmlns:atom="http://www.w3.org/2005/Atom"
-	<?php do_action('bp_activity_personal_feed'); ?>
->
-
-<channel>
-	<?php /* translators: Personal activity RSS title - "[Site Name] | [Displayed User Name] | Activity" */ ?>
-	<title><?php printf( '%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_displayed_user_fullname(), __( 'Activity', 'buddypress' ) ) ?></title>
-	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
-	<link><?php echo bp_displayed_user_domain() . bp_get_activity_slug() . '/feed' ?></link>
-	<description><?php printf( __( '%s - Activity Feed', 'buddypress' ), bp_get_displayed_user_fullname() ) ?></description>
-	<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
-	<generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
-	<language><?php bloginfo_rss( 'language' ); ?></language>
-	<?php do_action('bp_activity_personal_feed_head'); ?>
-
-	<?php if ( bp_has_activities( 'user_id=' . bp_displayed_user_id() . '&max=50&display_comments=stream' ) ) : ?>
-		<?php while ( bp_activities() ) : bp_the_activity(); ?>
-			<item>
-				<guid><?php bp_activity_thread_permalink() ?></guid>
-				<title><?php bp_activity_feed_item_title() ?></title>
-				<link><?php echo bp_activity_thread_permalink() ?></link>
-				<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
-
-				<description>
-					<![CDATA[
-					<?php bp_activity_feed_item_description() ?>
-
-					<?php if ( bp_activity_can_comment() ) : ?>
-						<p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
-					<?php endif; ?>
-
-					<?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
-						<br /><strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
-						<?php bp_activity_parent_content() ?>
-					<?php endif; ?>
-					]]>
-				</description>
-				<?php do_action('bp_activity_personal_feed_item'); ?>
-			</item>
-		<?php endwhile; ?>
-
-	<?php endif; ?>
-</channel>
-</rss>
Index: bp-activity/feeds/bp-activity-sitewide-feed.php
deleted file mode 100644
===================================================================
--- bp-activity/feeds/bp-activity-sitewide-feed.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-/**
- * RSS2 Feed Template for displaying the site wide activity stream.
- *
- * @package BuddyPress
- * @subpackage ActivityFeeds
- */
-
-// Exit if accessed directly
-if ( !defined( 'ABSPATH' ) ) exit;
-
-header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
-header('Status: 200 OK');
-echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
-
-<rss version="2.0"
-	xmlns:content="http://purl.org/rss/1.0/modules/content/"
-	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
-	xmlns:dc="http://purl.org/dc/elements/1.1/"
-	xmlns:atom="http://www.w3.org/2005/Atom"
-	<?php do_action('bp_activity_sitewide_feed'); ?>
->
-
-<channel>
-	<?php /* translators: Sitewide activity RSS title - "[Site Name] | Site Wide Activity" */ ?>
-	<title><?php printf( '%1$s | %2$s', bp_get_site_name(), __( 'Site Wide Activity', 'buddypress' ) ) ?></title>
-	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
-	<link><?php echo bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/feed' ?></link>
-	<description><?php _e( 'Site Wide Activity Feed', 'buddypress' ) ?></description>
-	<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
-	<generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
-	<language><?php bloginfo_rss( 'language' ); ?></language>
-	<?php do_action('bp_activity_sitewide_feed_head'); ?>
-
-	<?php if ( bp_has_activities( 'type=sitewide&max=50&display_comments=threaded' ) ) : ?>
-		<?php while ( bp_activities() ) : bp_the_activity(); ?>
-			<item>
-				<guid><?php bp_activity_thread_permalink() ?></guid>
-				<title><?php bp_activity_feed_item_title() ?></title>
-				<link><?php bp_activity_thread_permalink() ?></link>
-				<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
-
-				<description>
-					<![CDATA[
-					<?php bp_activity_feed_item_description() ?>
-
-					<?php if ( bp_activity_can_comment() ) : ?>
-						<p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
-					<?php endif; ?>
-					]]>
-				</description>
-			<?php do_action('bp_activity_personal_feed_item'); ?>
-			</item>
-		<?php endwhile; ?>
-
-	<?php endif; ?>
-</channel>
-</rss>
Index: bp-groups/bp-groups-actions.php
===================================================================
--- bp-groups/bp-groups-actions.php
+++ bp-groups/bp-groups-actions.php
@@ -307,21 +307,36 @@ function groups_action_redirect_to_random_group() {
 }
 add_action( 'bp_actions', 'groups_action_redirect_to_random_group' );
 
+/**
+ * Load the activity feed for the specific group.
+ *
+ * @since BuddyPress (v1.2)
+ */
 function groups_action_group_feed() {
-	global $bp, $wp_query;
+	global $bp;
 
-	if ( !bp_is_active( 'activity' ) || !bp_is_groups_component() || !isset( $bp->groups->current_group ) || !bp_is_current_action( 'feed' ) )
+	if ( ! bp_is_active( 'activity' ) || ! bp_is_groups_component() || ! groups_get_current_group() || ! bp_is_current_action( 'feed' ) )
 		return false;
 
-	$wp_query->is_404 = false;
-	status_header( 200 );
-
 	if ( 'public' != $bp->groups->current_group->status ) {
-		if ( !groups_is_user_member( bp_loggedin_user_id(), $bp->groups->current_group->id ) )
+		if ( !groups_is_user_member( bp_loggedin_user_id(), bp_get_current_group_id() ) )
 			return false;
 	}
 
-	include_once( BP_PLUGIN_DIR . '/bp-activity/feeds/bp-activity-group-feed.php' );
-	die;
+	// setup the feed
+	buddypress()->activity->feed = new BP_Feed( array(
+		'id'            => 'group',
+
+		/* translators: Member groups activity RSS title - "[Site Name] | [Group Name] | Activity" */
+		'title'         => sprintf( __( '%1$s | %2$s | Activity', 'buddypress' ), bp_get_site_name(), bp_get_current_group_name() ),
+
+		'link'          => bp_get_group_permalink( groups_get_current_group() ) . bp_get_activity_slug() . '/feed',
+		'description'   => sprintf( __( "Group activity feed of %s.", 'buddypress' ), bp_get_current_group_name() ),
+		'activity_args' => array(
+			'object'           => buddypress()->groups->id,
+			'primary_id'       => bp_get_current_group_id(),
+			'display_comments' => 'threaded'
+		)
+	) );
 }
 add_action( 'bp_actions', 'groups_action_group_feed' );
