Skip to:
Content

BuddyPress.org

Ticket #5020: 5020.01.patch

File 5020.01.patch, 39.0 KB (added by r-a-y, 11 years ago)

Updated patch to fix mentions feed

  • bp-activity/bp-activity-actions.php

    add_action( 'bp_actions', 'bp_activity_action_remove_favorite' ); 
    421421 * @return bool False on failure
    422422 */
    423423function bp_activity_action_sitewide_feed() {
    424         global $bp, $wp_query;
     424        global $bp;
    425425
    426         if ( !bp_is_activity_component() || !bp_is_current_action( 'feed' ) || bp_is_user() || !empty( $bp->groups->current_group ) )
     426        if ( ! bp_is_activity_component() || ! bp_is_current_action( 'feed' ) || bp_is_user() || ! empty( $bp->groups->current_group ) )
    427427                return false;
    428428
    429         $wp_query->is_404 = false;
    430         status_header( 200 );
     429        // setup the feed
     430        buddypress()->activity->feed = new BP_Feed( array(
     431                'id'            => 'sitewide',
     432
     433                /* translators: Sitewide activity RSS title - "Site Name | Site Wide Activity" */
     434                'title'         => sprintf( __( '%s | Site Wide Activity', 'buddypress' ), bp_get_site_name() ),
    431435
    432         include_once( 'feeds/bp-activity-sitewide-feed.php' );
    433         die;
     436                'link'          => bp_get_activity_directory_permalink() . 'feed',
     437                'description'   => __( 'Activity feed for the entire site.', 'buddypress' ),
     438                'activity_args' => 'display_comments=threaded'
     439        ) );
    434440}
    435441add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
    436442
    add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' ); 
    447453 * @return bool False on failure
    448454 */
    449455function bp_activity_action_personal_feed() {
    450         global $wp_query;
    451 
    452         if ( !bp_is_user_activity() || !bp_is_current_action( 'feed' ) )
     456        if ( ! bp_is_user_activity() || ! bp_is_current_action( 'feed' ) ) {
    453457                return false;
     458        }
     459
     460        // setup the feed
     461        buddypress()->activity->feed = new BP_Feed( array(
     462                'id'            => 'personal',
    454463
    455         $wp_query->is_404 = false;
    456         status_header( 200 );
     464                /* translators: Personal activity RSS title - "[Site Name] | [User Display Name] | Activity Feed" */
     465                'title'         => sprintf( __( '%1$s | %2$s | Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
    457466
    458         include_once( 'feeds/bp-activity-personal-feed.php' );
    459         die;
     467                'link'          => bp_displayed_user_domain() . bp_get_activity_slug() . '/feed',
     468                'description'   => sprintf( __( 'Activity feed for %s.', 'buddypress' ), bp_get_displayed_user_fullname() ),
     469                'activity_args' => 'user_id=' . bp_displayed_user_id()
     470        ) );
    460471}
    461472add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
    462473
    add_action( 'bp_actions', 'bp_activity_action_personal_feed' ); 
    476487 * @return bool False on failure
    477488 */
    478489function bp_activity_action_friends_feed() {
    479         global $wp_query;
    480 
    481         if ( !bp_is_active( 'friends' ) || !bp_is_user_activity() || !bp_is_current_action( bp_get_friends_slug() ) || !bp_is_action_variable( 'feed', 0 ) )
     490        if ( ! bp_is_active( 'friends' ) || ! bp_is_user_activity() || ! bp_is_current_action( bp_get_friends_slug() ) || ! bp_is_action_variable( 'feed', 0 ) ) {
    482491                return false;
     492        }
    483493
    484         $wp_query->is_404 = false;
    485         status_header( 200 );
     494        // setup the feed
     495        buddypress()->activity->feed = new BP_Feed( array(
     496                'id'            => 'friends',
    486497
    487         include_once( 'feeds/bp-activity-friends-feed.php' );
    488         die;
     498                /* translators: Friends activity RSS title - "[Site Name] | [User Display Name] | Friends Activity Feed" */
     499                'title'         => sprintf( __( '%1$s | %2$s | Friends Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
     500
     501                'link'          => bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/feed',
     502                'description'   => sprintf( __( "Activity feed for %s' friends.", 'buddypress' ), bp_get_displayed_user_fullname() ),
     503                'activity_args' => 'scope=friends'
     504        ) );
    489505}
    490506add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
    491507
    add_action( 'bp_actions', 'bp_activity_action_friends_feed' ); 
    505521 * @return bool False on failure
    506522 */
    507523function bp_activity_action_my_groups_feed() {
    508         global $wp_query;
    509 
    510         if ( !bp_is_active( 'groups' ) || !bp_is_user_activity() || !bp_is_current_action( bp_get_groups_slug() ) || !bp_is_action_variable( 'feed', 0 ) )
     524        if ( ! bp_is_active( 'groups' ) || ! bp_is_user_activity() || ! bp_is_current_action( bp_get_groups_slug() ) || ! bp_is_action_variable( 'feed', 0 ) ) {
    511525                return false;
     526        }
    512527
    513         $wp_query->is_404 = false;
    514         status_header( 200 );
    515 
    516         include_once( 'feeds/bp-activity-mygroups-feed.php' );
    517         die;
     528        // get displayed user's group IDs
     529        $groups    = groups_get_user_groups();
     530        $group_ids = implode( ',', $groups['groups'] );
     531
     532        // setup the feed
     533        buddypress()->activity->feed = new BP_Feed( array(
     534                'id'            => 'mygroups',
     535
     536                /* translators: Member groups activity RSS title - "[Site Name] | [User Display Name] | Groups Activity Feed" */
     537                'title'         => sprintf( __( '%1$s | %2$s | Group Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
     538
     539                'link'          => bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/feed',
     540                'description'   => sprintf( __( "Public group activity feed of which %s is a member of.", 'buddypress' ), bp_get_displayed_user_fullname() ),
     541                'activity_args' => array(
     542                        'object'           => buddypress()->groups->id,
     543                        'primary_id'       => $group_ids,
     544                        'display_comments' => 'threaded'
     545                )
     546        ) );
    518547}
    519548add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
    520549
    add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' ); 
    532561 * @return bool False on failure
    533562 */
    534563function bp_activity_action_mentions_feed() {
    535         global $wp_query;
    536 
    537         if ( !bp_is_user_activity() || !bp_is_current_action( 'mentions' ) || !bp_is_action_variable( 'feed', 0 ) )
     564        if ( ! bp_is_user_activity() || ! bp_is_current_action( 'mentions' ) || ! bp_is_action_variable( 'feed', 0 ) ) {
    538565                return false;
     566        }
     567
     568        // setup the feed
     569        buddypress()->activity->feed = new BP_Feed( array(
     570                'id'            => 'mentions',
    539571
    540         $wp_query->is_404 = false;
    541         status_header( 200 );
     572                /* translators: User mentions activity RSS title - "[Site Name] | [User Display Name] | Mentions" */
     573                'title'         => sprintf( __( '%1$s | %2$s | Mentions', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
    542574
    543         include_once( 'feeds/bp-activity-mentions-feed.php' );
    544         die;
     575                'link'          => bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed',
     576                'description'   => sprintf( __( "Activity feed mentioning %s.", 'buddypress' ), bp_get_displayed_user_fullname() ),
     577                'activity_args' => array(
     578                        'search_terms' => '@' . bp_core_get_username( bp_displayed_user_id() )
     579                )
     580        ) );
    545581}
    546582add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );
    547583
    add_action( 'bp_actions', 'bp_activity_action_mentions_feed' ); 
    559595 * @return bool False on failure
    560596 */
    561597function bp_activity_action_favorites_feed() {
    562         global $wp_query;
    563 
    564         if ( !bp_is_user_activity() || !bp_is_current_action( 'favorites' ) || !bp_is_action_variable( 'feed', 0 ) )
     598        if ( ! bp_is_user_activity() || ! bp_is_current_action( 'favorites' ) || ! bp_is_action_variable( 'feed', 0 ) ) {
    565599                return false;
     600        }
     601
     602        // get displayed user's favorite activity IDs
     603        $favs = bp_activity_get_user_favorites( bp_displayed_user_id() );
     604        $fav_ids = implode( ',', (array) $favs );
     605
     606        // setup the feed
     607        buddypress()->activity->feed = new BP_Feed( array(
     608                'id'            => 'favorites',
    566609
    567         $wp_query->is_404 = false;
    568         status_header( 200 );
     610                /* translators: User activity favorites RSS title - "[Site Name] | [User Display Name] | Favorites" */
     611                'title'         => sprintf( __( '%1$s | %2$s | Favorites', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
    569612
    570         include_once( 'feeds/bp-activity-favorites-feed.php' );
    571         die;
     613                'link'          => bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/feed',
     614                'description'   => sprintf( __( "Activity feed of %s' favorites.", 'buddypress' ), bp_get_displayed_user_fullname() ),
     615                'activity_args' => 'include=' . $fav_ids
     616        ) );
    572617}
    573618add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
    574619
  • bp-activity/bp-activity-classes.php

    class BP_Activity_Activity { 
    256256                        $activity_user_ids = wp_list_pluck( $activities, 'user_id' );
    257257                        $activity_user_ids = implode( ',', wp_parse_id_list( $activity_user_ids ) );
    258258
    259                         if ( !empty( $activity_user_ids ) ) {                           
     259                        if ( !empty( $activity_user_ids ) ) {
    260260                                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})" ) ) {
    261261                                        foreach ( (array) $names as $name )
    262262                                                $tmp_names[$name->user_id] = $name->user_fullname;
    class BP_Activity_Activity { 
    726726                return $wpdb->get_var( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET hide_sitewide = 1 WHERE user_id = %d", $user_id ) );
    727727        }
    728728}
     729
     730/**
     731 * Create an RSS feed using the activity component.
     732 *
     733 * You should only construct a new feed when you've validated that you're on
     734 * the appropriate screen.
     735 *
     736 * See {@link bp_activity_action_sitewide_feed()} as an example.
     737 *
     738 * Accepted parameters:
     739 *   id               - internal id for the feed; should be alphanumeric only
     740 *                      (required)
     741 *   title            - RSS feed title
     742 *   link             - Relevant link for the RSS feed
     743 *   description      - RSS feed description
     744 *   ttl              - Time-to-live (see inline doc in constructor)
     745 *   update_period    - Part of the syndication module (see inline doc in
     746 *                      constructor for more info)
     747 *   update_frequency - Part of the syndication module (see inline doc in
     748 *                      constructor for more info)
     749 *   max              - Number of feed items to display
     750 *   activity_args    - Arguments passed to {@link bp_has_activities()}
     751 *
     752 * @since BuddyPress (1.8)
     753 */
     754class BP_Feed {
     755        /**
     756         * Holds our custom class properties.
     757         *
     758         * These variables are stored in a protected array that is magically
     759         * updated using PHP 5.2+ methods.
     760         *
     761         * @see BP_Feed::__construct() This is where $data is added
     762         * @var array
     763         */
     764        protected $data;
     765
     766        /**
     767         * Magic method for checking the existence of a certain data variable.
     768         *
     769         * @param string $key
     770         */
     771        public function __isset( $key ) { return isset( $this->data[$key] ); }
     772
     773        /**
     774         * Magic method for getting a certain data variable.
     775         *
     776         * @param string $key
     777         */
     778        public function __get( $key ) { return isset( $this->data[$key] ) ? $this->data[$key] : null; }
     779
     780        /**
     781         * Constructor.
     782         *
     783         * @param $args Array
     784         */
     785        public function __construct( $args = array() ) {
     786                // If feeds are disabled, stop now!
     787                if ( ! apply_filters( 'bp_activity_enable_feeds', true ) ) {
     788                        return;
     789                }
     790
     791                // Setup data
     792                $this->data = wp_parse_args( $args, array(
     793                        // Internal identifier for the RSS feed - should be alphanumeric only
     794                        'id'               => '',
     795
     796                        // RSS title - should be plain-text
     797                        'title'            => '',
     798
     799                        // relevant link for the RSS feed
     800                        'link'             => '',
     801
     802                        // RSS description - should be plain-text
     803                        'description'      => '',
     804
     805                        // Time-to-live - number of minutes to cache the data before an aggregator
     806                        // requests it again.  This is only acknowledged if the RSS client supports it
     807                        //
     808                        // See: http://www.rssboard.org/rss-profile#element-channel-ttl
     809                        //      http://www.kbcafe.com/rss/rssfeedstate.html#ttl
     810                        'ttl'              => '30',
     811
     812                        // Syndication module - similar to ttl, but not really supported by RSS
     813                        // clients
     814                        //
     815                        // See: http://web.resource.org/rss/1.0/modules/syndication/#description
     816                        //      http://www.kbcafe.com/rss/rssfeedstate.html#syndicationmodule
     817                        'update_period'    => 'hourly',
     818                        'update_frequency' => 2,
     819
     820                        // Number of items to display
     821                        'max'              => 50,
     822
     823                        // Activity arguments passed to bp_has_activities()
     824                        'activity_args'    => array()
     825                ) );
     826
     827                // Plugins can use this filter to modify the feed before it is setup
     828                do_action_ref_array( 'bp_feed_prefetch', array( &$this ) );
     829
     830                // Setup class properties
     831                $this->setup_properties();
     832
     833                // Check if id is valid
     834                if ( empty( $this->id ) ) {
     835                        _doing_it_wrong( 'BP_Feed', __( "RSS feed 'id' must be defined", 'buddypress' ), 'BP 1.8' );
     836                        return;
     837                }
     838
     839                // Setup feed hooks
     840                $this->setup_hooks();
     841
     842                // Output the feed
     843                $this->output();
     844
     845                // Kill the rest of the output
     846                die();
     847        }
     848
     849        /** SETUP ****************************************************************/
     850
     851        /**
     852         * Setup and validate the class properties.
     853         */
     854        protected function setup_properties() {
     855                $this->id               = sanitize_title( $this->id );
     856                $this->title            = strip_tags( $this->title );
     857                $this->link             = esc_url_raw( $this->link );
     858                $this->description      = strip_tags( $this->description );
     859                $this->ttl              = (int) $this->ttl;
     860                $this->update_period    = strip_tags( $this->update_period );
     861                $this->update_frequency = (int) $this->update_frequency;
     862
     863                $this->activity_args    = wp_parse_args( $this->activity_args, array(
     864                        'max'              => $this->max,
     865                        'display_comments' => 'stream'
     866                ) );
     867        }
     868
     869        /**
     870         * Setup some hooks that are used in the feed.
     871         *
     872         * Currently, these hooks are used to maintain backwards compatibility with
     873         * the RSS feeds previous to BP 1.8.
     874         */
     875        protected function setup_hooks() {
     876                add_action( 'bp_feed_rss_attributes',   array( $this, 'backpat_rss_attributes' ) );
     877                add_action( 'bp_feed_channel_elements', array( $this, 'backpat_channel_elements' ) );
     878                add_action( 'bp_feed_item_elements',    array( $this, 'backpat_item_elements' ) );
     879        }
     880
     881        /** BACKPAT HOOKS ********************************************************/
     882
     883        public function backpat_rss_attributes() {
     884                do_action( 'bp_activity_' . $this->id . '_feed' );
     885        }
     886
     887        public function backpat_channel_elements() {
     888                do_action( 'bp_activity_' . $this->id . '_feed_head' );
     889        }
     890
     891        public function backpat_item_elements() {
     892                switch ( $this->id ) {
     893
     894                        // sitewide and friends feeds use the 'personal' hook
     895                        case 'sitewide' :
     896                        case 'friends' :
     897                                $id = 'personal';
     898
     899                                break;
     900
     901                        default :
     902                                $id = $this->id;
     903
     904                                break;
     905                }
     906
     907                do_action( 'bp_activity_' . $id . '_feed_item' );
     908        }
     909
     910        /** HELPERS **************************************************************/
     911
     912        /**
     913         * Output the feed's item content.
     914         */
     915        protected function feed_content() {
     916                bp_activity_feed_item_description();
     917
     918                switch ( $this->id ) {
     919
     920                        // also output parent activity item if we're on a specific feed
     921                        case 'favorites' :
     922                        case 'friends' :
     923                        case 'mentions' :
     924                        case 'personal' :
     925
     926                                if ( 'activity_comment' == bp_get_activity_action_name() ) :
     927                        ?>
     928                                <strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
     929                                <?php bp_activity_parent_content() ?>
     930                        <?php
     931                                endif;
     932
     933                                break;
     934                }
     935        }
     936
     937        /** OUTPUT ***************************************************************/
     938
     939        /**
     940         * Output the RSS feed.
     941         */
     942        protected function output() {
     943                // set up some additional headers if not on a directory page
     944                // this is done b/c BP uses pseudo-pages
     945                if ( ! bp_is_directory() ) {
     946                        global $wp_query;
     947
     948                        $wp_query->is_404 = false;
     949                        status_header( 200 );
     950                }
     951
     952                header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
     953                echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?'.'>';
     954        ?>
     955
     956<rss version="2.0"
     957        xmlns:content="http://purl.org/rss/1.0/modules/content/"
     958        xmlns:atom="http://www.w3.org/2005/Atom"
     959        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
     960        xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
     961        <?php do_action( 'bp_feed_rss_attributes' ); ?>
     962>
     963
     964<channel>
     965        <title><?php echo $this->title; ?></title>
     966        <link><?php echo $this->link; ?></link>
     967        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
     968        <description><?php echo $this->description ?></description>
     969        <lastBuildDate><?php echo mysql2date( 'D, d M Y H:i:s O', bp_activity_get_last_updated(), false ); ?></lastBuildDate>
     970        <generator>http://buddypress.org/?v=<?php bp_version(); ?></generator>
     971        <language><?php bloginfo_rss( 'language' ); ?></language>
     972        <ttl><?php echo $this->ttl; ?></ttl>
     973        <sy:updatePeriod><?php echo $this->update_period; ?></sy:updatePeriod>
     974        <sy:updateFrequency><?php echo $this->update_frequency; ?></sy:updateFrequency>
     975        <?php do_action( 'bp_feed_channel_elements' ); ?>
     976
     977        <?php if ( bp_has_activities( $this->activity_args ) ) : ?>
     978                <?php while ( bp_activities() ) : bp_the_activity(); ?>
     979                        <item>
     980                                <guid isPermaLink="true"><?php bp_activity_thread_permalink(); ?></guid>
     981                                <title><?php echo stripslashes( bp_get_activity_feed_item_title() ); ?></title>
     982                                <link><?php bp_activity_thread_permalink() ?></link>
     983                                <pubDate><?php echo mysql2date( 'D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false ); ?></pubDate>
     984
     985                                <?php if ( bp_get_activity_feed_item_description() ) : ?>
     986                                        <content:encoded><![CDATA[<?php $this->feed_content(); ?>]]></content:encoded>
     987                                <?php endif; ?>
     988
     989                                <?php if ( bp_activity_can_comment() ) : ?>
     990                                        <slash:comments><?php bp_activity_comment_count(); ?></slash:comments>
     991                                <?php endif; ?>
     992
     993                                <?php do_action( 'bp_feed_item_elements' ); ?>
     994                        </item>
     995                <?php endwhile; ?>
     996
     997        <?php endif; ?>
     998</channel>
     999</rss><?php
     1000        }
     1001}
  • deleted file bp-activity/feeds/bp-activity-favorites-feed.php

    deleted file mode 100644
    + -  
    1 <?php
    2 
    3 /**
    4  * RSS2 Feed Template for displaying a member's favorite activity
    5  *
    6  * @package BuddyPress
    7  * @subpackage ActivityFeeds
    8  */
    9 
    10 // Exit if accessed directly
    11 if ( !defined( 'ABSPATH' ) ) exit;
    12 
    13 header('Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
    14 header('Status: 200 OK');
    15 echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?'.'>'; ?>
    16 
    17 <rss version="2.0"
    18         xmlns:content="http://purl.org/rss/1.0/modules/content/"
    19         xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    20         xmlns:dc="http://purl.org/dc/elements/1.1/"
    21         xmlns:atom="http://www.w3.org/2005/Atom"
    22         <?php do_action('bp_activity_favorites_feed'); ?>
    23 >
    24 
    25 <channel>
    26         <?php /* translators: Favorited activity RSS title - "[Site Name] | [Displayed User Name] | Favorite Activity" */ ?>
    27         <title><?php printf( '%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_displayed_user_fullname(), __( 'Favorite Activity', 'buddypress' ) ) ?></title>
    28         <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    29         <link><?php echo home_url( bp_get_activity_root_slug() . '/#my-favorites/' ) ?></link>
    30         <description><?php printf( __( '%s - Favorite Activity', 'buddypress' ), bp_get_displayed_user_fullname() ) ?></description>
    31         <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
    32         <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
    33         <language><?php bloginfo_rss( 'language' ); ?></language>
    34 
    35         <?php do_action('bp_activity_favorites_feed_head'); ?>
    36 
    37         <?php
    38                 $favs = bp_activity_get_user_favorites( bp_displayed_user_id() );
    39                 $fav_ids = implode( ',', (array) $favs );
    40         ?>
    41 
    42         <?php if ( bp_has_activities( 'include=' . $fav_ids . '&max=50&display_comments=stream' ) ) : ?>
    43                 <?php while ( bp_activities() ) : bp_the_activity(); ?>
    44 
    45                         <item>
    46                                 <guid><?php bp_activity_thread_permalink() ?></guid>
    47                                 <title><?php bp_activity_feed_item_title() ?></title>
    48                                 <link><?php echo bp_activity_thread_permalink() ?></link>
    49                                 <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
    50 
    51                                 <description>
    52                                         <![CDATA[
    53                                         <?php bp_activity_feed_item_description() ?>
    54 
    55                                         <?php if ( bp_activity_can_comment() ) : ?>
    56                                                 <p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
    57                                         <?php endif; ?>
    58 
    59                                         <?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
    60                                                 <br /><strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
    61                                                 <?php bp_activity_parent_content() ?>
    62                                         <?php endif; ?>
    63                                         ]]>
    64                                 </description>
    65 
    66                                 <?php do_action('bp_activity_favorites_feed_item'); ?>
    67 
    68                         </item>
    69 
    70                 <?php endwhile; ?>
    71         <?php endif; ?>
    72 
    73 </channel>
    74 </rss>
  • deleted file bp-activity/feeds/bp-activity-friends-feed.php

    deleted file mode 100644
    + -  
    1 <?php
    2 
    3 /**
    4  * RSS2 Feed Template for displaying a member's friends activity stream.
    5  *
    6  * @package BuddyPress
    7  * @subpackage ActivityFeeds
    8  */
    9 
    10 // Exit if accessed directly
    11 if ( !defined( 'ABSPATH' ) ) exit;
    12 
    13 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
    14 header('Status: 200 OK');
    15 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
    16 
    17 <rss version="2.0"
    18         xmlns:content="http://purl.org/rss/1.0/modules/content/"
    19         xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    20         xmlns:dc="http://purl.org/dc/elements/1.1/"
    21         xmlns:atom="http://www.w3.org/2005/Atom"
    22         <?php do_action('bp_activity_friends_feed'); ?>
    23 >
    24 
    25 <channel>
    26         <?php /* translators: Member friends activity RSS title - "[Site Name] | Friends Activity" */ ?>
    27         <title><?php bp_site_name() ?> | <?php bp_displayed_user_fullname(); ?> | <?php _e( 'Friends Activity', 'buddypress' ); ?></title>
    28         <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    29         <link><?php echo bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/feed'; ?></link>
    30         <description><?php printf( __( '%s - Friends Activity Feed', 'buddypress' ), bp_get_displayed_user_fullname() ); ?></description>
    31         <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
    32         <generator>http://buddypress.org/?v=<?php echo BP_VERSION; ?></generator>
    33         <language><?php bloginfo_rss( 'language' ); ?></language>
    34         <?php do_action('bp_activity_friends_feed_head'); ?>
    35 
    36         <?php if ( bp_has_activities( 'scope=friends&max=50&display_comments=stream' ) ) : ?>
    37                 <?php while ( bp_activities() ) : bp_the_activity(); ?>
    38                         <item>
    39                                 <guid><?php bp_activity_thread_permalink(); ?></guid>
    40                                 <title><?php bp_activity_feed_item_title(); ?></title>
    41                                 <link><?php echo bp_activity_thread_permalink(); ?></link>
    42                                 <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
    43 
    44                                 <description>
    45                                         <![CDATA[
    46                                         <?php bp_activity_feed_item_description(); ?>
    47 
    48                                         <?php if ( bp_activity_can_comment() ) : ?>
    49                                                 <p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
    50                                         <?php endif; ?>
    51 
    52                                         <?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
    53                                                 <br /><strong><?php _e( 'In reply to', 'buddypress' ); ?></strong> -
    54                                                 <?php bp_activity_parent_content(); ?>
    55                                         <?php endif; ?>
    56                                         ]]>
    57                                 </description>
    58                                 <?php do_action('bp_activity_personal_feed_item'); ?>
    59                         </item>
    60                 <?php endwhile; ?>
    61 
    62         <?php endif; ?>
    63 </channel>
    64 </rss>
  • deleted file bp-activity/feeds/bp-activity-group-feed.php

    deleted file mode 100644
    + -  
    1 <?php
    2 
    3 /**
    4  * RSS2 Feed Template for displaying a group activity stream
    5  *
    6  * @package BuddyPress
    7  * @subpackage ActivityFeeds
    8  */
    9 
    10 // Exit if accessed directly
    11 if ( !defined( 'ABSPATH' ) ) exit;
    12 
    13 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
    14 header('Status: 200 OK');
    15 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
    16 
    17 <rss version="2.0"
    18         xmlns:content="http://purl.org/rss/1.0/modules/content/"
    19         xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    20         xmlns:dc="http://purl.org/dc/elements/1.1/"
    21         xmlns:atom="http://www.w3.org/2005/Atom"
    22         <?php do_action('bp_activity_group_feed'); ?>
    23 >
    24 
    25 <channel>
    26         <?php /* translators: Single group activity RSS title - "[Site Name] | [Group Name] | Group Activity" */ ?>
    27         <title><?php printf( '%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_current_group_name(), __( 'Group Activity', 'buddypress' ) ) ?></title>
    28         <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    29         <link><?php echo bp_get_group_permalink( $bp->groups->current_group ) . bp_get_activity_slug() . '/feed' ?></link>
    30         <description><?php printf( __( '%s - Group Activity Feed', 'buddypress' ), $bp->groups->current_group->name  ) ?></description>
    31         <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
    32         <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
    33         <language><?php bloginfo_rss( 'language' ); ?></language>
    34         <?php do_action('bp_activity_group_feed_head'); ?>
    35 
    36         <?php if ( bp_has_activities( 'object=' . $bp->groups->id . '&primary_id=' . $bp->groups->current_group->id . '&max=50&display_comments=threaded' ) ) : ?>
    37                 <?php while ( bp_activities() ) : bp_the_activity(); ?>
    38                         <item>
    39                                 <guid><?php bp_activity_thread_permalink() ?></guid>
    40                                 <title><?php bp_activity_feed_item_title() ?></title>
    41                                 <link><?php echo bp_activity_thread_permalink() ?></link>
    42                                 <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
    43 
    44                                 <description>
    45                                         <![CDATA[
    46                                                 <?php bp_activity_feed_item_description() ?>
    47 
    48                                                 <?php if ( bp_activity_can_comment() ) : ?>
    49                                                         <p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
    50                                                 <?php endif; ?>
    51                                         ]]>
    52                                 </description>
    53                                 <?php do_action('bp_activity_group_feed_item'); ?>
    54                         </item>
    55                 <?php endwhile; ?>
    56 
    57         <?php endif; ?>
    58 </channel>
    59 </rss>
  • deleted file bp-activity/feeds/bp-activity-mentions-feed.php

    deleted file mode 100644
    + -  
    1 <?php
    2 
    3 /**
    4  * RSS2 Feed Template for displaying a member's activity mentions
    5  *
    6  * @package BuddyPress
    7  * @subpackage ActivityFeeds
    8  */
    9 
    10 // Exit if accessed directly
    11 if ( !defined( 'ABSPATH' ) ) exit;
    12 
    13 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
    14 header('Status: 200 OK');
    15 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
    16 
    17 <rss version="2.0"
    18         xmlns:content="http://purl.org/rss/1.0/modules/content/"
    19         xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    20         xmlns:dc="http://purl.org/dc/elements/1.1/"
    21         xmlns:atom="http://www.w3.org/2005/Atom"
    22         <?php do_action('bp_activity_mentions_feed'); ?>
    23 >
    24 
    25 <channel>
    26         <?php /* translators: Mentions RSS title - "[Site Name] | [Displayed User Name] | Mentions" */ ?>
    27         <title><?php printf( '%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_displayed_user_fullname(), __( 'Mentions', 'buddypress' ) ) ?></title>
    28         <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    29         <link><?php echo home_url( bp_get_activity_root_slug() . '/#mentions/' ) ?></link>
    30         <?php /* translators: Mentions RSS title - "[Site Name] | [Displayed User Name] | Mentions" */ ?>
    31         <description><?php printf( __( '%s - Mentions', 'buddypress' ), bp_get_displayed_user_fullname() ) ?></description>
    32         <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
    33         <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
    34         <language><?php bloginfo_rss( 'language' ); ?></language>
    35         <?php do_action('bp_activity_mentions_feed_head'); ?>
    36 
    37         <?php if ( bp_has_activities( 'max=50&display_comments=stream&search_terms=@' . bp_core_get_username( bp_displayed_user_id() ) ) ) : ?>
    38                 <?php while ( bp_activities() ) : bp_the_activity(); ?>
    39                         <item>
    40                                 <guid><?php bp_activity_thread_permalink() ?></guid>
    41                                 <title><?php bp_activity_feed_item_title() ?></title>
    42                                 <link><?php echo bp_activity_thread_permalink() ?></link>
    43                                 <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
    44 
    45                                 <description>
    46                                         <![CDATA[
    47                                         <?php bp_activity_feed_item_description() ?>
    48 
    49                                         <?php if ( bp_activity_can_comment() ) : ?>
    50                                                 <p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
    51                                         <?php endif; ?>
    52 
    53                                         <?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
    54                                                 <br /><strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
    55                                                 <?php bp_activity_parent_content() ?>
    56                                         <?php endif; ?>
    57                                         ]]>
    58                                 </description>
    59                                 <?php do_action('bp_activity_mentions_feed_item'); ?>
    60                         </item>
    61                 <?php endwhile; ?>
    62 
    63         <?php endif; ?>
    64 </channel>
    65 </rss>
  • deleted file bp-activity/feeds/bp-activity-mygroups-feed.php

    deleted file mode 100644
    + -  
    1 <?php
    2 
    3 /**
    4  * RSS2 Feed Template for displaying a member's group's activity
    5  *
    6  * @package BuddyPress
    7  * @subpackage ActivityFeeds
    8  */
    9 
    10 // Exit if accessed directly
    11 if ( !defined( 'ABSPATH' ) ) exit;
    12 
    13 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
    14 header('Status: 200 OK');
    15 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
    16 
    17 <rss version="2.0"
    18         xmlns:content="http://purl.org/rss/1.0/modules/content/"
    19         xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    20         xmlns:dc="http://purl.org/dc/elements/1.1/"
    21         xmlns:atom="http://www.w3.org/2005/Atom"
    22         <?php do_action('bp_activity_mygroups_feed'); ?>
    23 >
    24 
    25 <channel>
    26         <?php /* translators: Member groups activity RSS title - "[Site Name] | [Displayed User Name] | My Groups - Public Activity" */ ?>
    27         <title><?php printf( '%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_displayed_user_fullname(), __( 'My Groups - Public Activity', 'buddypress' ) ) ?></title>
    28         <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    29         <link><?php echo home_url( bp_get_activity_root_slug() . '/#my-groups/' ) ?></link>
    30         <?php /* translators: Member groups activity RSS description - "[Displayed user name] - My Groups - Public Activity" */ ?>
    31         <description><?php printf( __( '%1$s - My Groups - Public Activity', 'buddypress' ), bp_get_displayed_user_fullname() ) ?></description>
    32         <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
    33         <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
    34         <language><?php bloginfo_rss( 'language' ); ?></language>
    35         <?php do_action('bp_activity_mygroups_feed_head'); ?>
    36 
    37         <?php
    38                 $groups = groups_get_user_groups( bp_loggedin_user_id() );
    39                 $group_ids = implode( ',', $groups['groups'] );
    40         ?>
    41 
    42         <?php if ( bp_has_activities( 'object=' . $bp->groups->id . '&primary_id=' . $group_ids . '&max=50&display_comments=threaded' ) ) : ?>
    43                 <?php while ( bp_activities() ) : bp_the_activity(); ?>
    44                         <item>
    45                                 <guid><?php bp_activity_thread_permalink() ?></guid>
    46                                 <title><?php bp_activity_feed_item_title() ?></title>
    47                                 <link><?php echo bp_activity_thread_permalink() ?></link>
    48                                 <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
    49 
    50                                 <description>
    51                                         <![CDATA[
    52                                                 <?php bp_activity_feed_item_description() ?>
    53 
    54                                                 <?php if ( bp_activity_can_comment() ) : ?>
    55                                                         <p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
    56                                                 <?php endif; ?>
    57                                         ]]>
    58                                 </description>
    59                                 <?php do_action('bp_activity_mygroups_feed_item'); ?>
    60                         </item>
    61                 <?php endwhile; ?>
    62 
    63         <?php endif; ?>
    64 </channel>
    65 </rss>
  • deleted file bp-activity/feeds/bp-activity-personal-feed.php

    deleted file mode 100644
    + -  
    1 <?php
    2 
    3 /**
    4  * RSS2 Feed Template for displaying a member's activity stream.
    5  *
    6  * @package BuddyPress
    7  * @subpackage ActivityFeeds
    8  */
    9 
    10 // Exit if accessed directly
    11 if ( !defined( 'ABSPATH' ) ) exit;
    12 
    13 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
    14 header('Status: 200 OK');
    15 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
    16 
    17 <rss version="2.0"
    18         xmlns:content="http://purl.org/rss/1.0/modules/content/"
    19         xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    20         xmlns:dc="http://purl.org/dc/elements/1.1/"
    21         xmlns:atom="http://www.w3.org/2005/Atom"
    22         <?php do_action('bp_activity_personal_feed'); ?>
    23 >
    24 
    25 <channel>
    26         <?php /* translators: Personal activity RSS title - "[Site Name] | [Displayed User Name] | Activity" */ ?>
    27         <title><?php printf( '%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_displayed_user_fullname(), __( 'Activity', 'buddypress' ) ) ?></title>
    28         <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    29         <link><?php echo bp_displayed_user_domain() . bp_get_activity_slug() . '/feed' ?></link>
    30         <description><?php printf( __( '%s - Activity Feed', 'buddypress' ), bp_get_displayed_user_fullname() ) ?></description>
    31         <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
    32         <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
    33         <language><?php bloginfo_rss( 'language' ); ?></language>
    34         <?php do_action('bp_activity_personal_feed_head'); ?>
    35 
    36         <?php if ( bp_has_activities( 'user_id=' . bp_displayed_user_id() . '&max=50&display_comments=stream' ) ) : ?>
    37                 <?php while ( bp_activities() ) : bp_the_activity(); ?>
    38                         <item>
    39                                 <guid><?php bp_activity_thread_permalink() ?></guid>
    40                                 <title><?php bp_activity_feed_item_title() ?></title>
    41                                 <link><?php echo bp_activity_thread_permalink() ?></link>
    42                                 <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
    43 
    44                                 <description>
    45                                         <![CDATA[
    46                                         <?php bp_activity_feed_item_description() ?>
    47 
    48                                         <?php if ( bp_activity_can_comment() ) : ?>
    49                                                 <p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
    50                                         <?php endif; ?>
    51 
    52                                         <?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
    53                                                 <br /><strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
    54                                                 <?php bp_activity_parent_content() ?>
    55                                         <?php endif; ?>
    56                                         ]]>
    57                                 </description>
    58                                 <?php do_action('bp_activity_personal_feed_item'); ?>
    59                         </item>
    60                 <?php endwhile; ?>
    61 
    62         <?php endif; ?>
    63 </channel>
    64 </rss>
  • deleted file bp-activity/feeds/bp-activity-sitewide-feed.php

    deleted file mode 100644
    + -  
    1 <?php
    2 
    3 /**
    4  * RSS2 Feed Template for displaying the site wide activity stream.
    5  *
    6  * @package BuddyPress
    7  * @subpackage ActivityFeeds
    8  */
    9 
    10 // Exit if accessed directly
    11 if ( !defined( 'ABSPATH' ) ) exit;
    12 
    13 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
    14 header('Status: 200 OK');
    15 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
    16 
    17 <rss version="2.0"
    18         xmlns:content="http://purl.org/rss/1.0/modules/content/"
    19         xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    20         xmlns:dc="http://purl.org/dc/elements/1.1/"
    21         xmlns:atom="http://www.w3.org/2005/Atom"
    22         <?php do_action('bp_activity_sitewide_feed'); ?>
    23 >
    24 
    25 <channel>
    26         <?php /* translators: Sitewide activity RSS title - "[Site Name] | Site Wide Activity" */ ?>
    27         <title><?php printf( '%1$s | %2$s', bp_get_site_name(), __( 'Site Wide Activity', 'buddypress' ) ) ?></title>
    28         <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    29         <link><?php echo bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/feed' ?></link>
    30         <description><?php _e( 'Site Wide Activity Feed', 'buddypress' ) ?></description>
    31         <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
    32         <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
    33         <language><?php bloginfo_rss( 'language' ); ?></language>
    34         <?php do_action('bp_activity_sitewide_feed_head'); ?>
    35 
    36         <?php if ( bp_has_activities( 'type=sitewide&max=50&display_comments=threaded' ) ) : ?>
    37                 <?php while ( bp_activities() ) : bp_the_activity(); ?>
    38                         <item>
    39                                 <guid><?php bp_activity_thread_permalink() ?></guid>
    40                                 <title><?php bp_activity_feed_item_title() ?></title>
    41                                 <link><?php bp_activity_thread_permalink() ?></link>
    42                                 <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
    43 
    44                                 <description>
    45                                         <![CDATA[
    46                                         <?php bp_activity_feed_item_description() ?>
    47 
    48                                         <?php if ( bp_activity_can_comment() ) : ?>
    49                                                 <p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
    50                                         <?php endif; ?>
    51                                         ]]>
    52                                 </description>
    53                         <?php do_action('bp_activity_personal_feed_item'); ?>
    54                         </item>
    55                 <?php endwhile; ?>
    56 
    57         <?php endif; ?>
    58 </channel>
    59 </rss>
  • bp-groups/bp-groups-actions.php

    function groups_action_redirect_to_random_group() { 
    307307}
    308308add_action( 'bp_actions', 'groups_action_redirect_to_random_group' );
    309309
     310/**
     311 * Load the activity feed for the specific group.
     312 *
     313 * @since BuddyPress (v1.2)
     314 */
    310315function groups_action_group_feed() {
    311         global $bp, $wp_query;
     316        global $bp;
    312317
    313         if ( !bp_is_active( 'activity' ) || !bp_is_groups_component() || !isset( $bp->groups->current_group ) || !bp_is_current_action( 'feed' ) )
     318        if ( ! bp_is_active( 'activity' ) || ! bp_is_groups_component() || ! groups_get_current_group() || ! bp_is_current_action( 'feed' ) )
    314319                return false;
    315320
    316         $wp_query->is_404 = false;
    317         status_header( 200 );
    318 
    319321        if ( 'public' != $bp->groups->current_group->status ) {
    320                 if ( !groups_is_user_member( bp_loggedin_user_id(), $bp->groups->current_group->id ) )
     322                if ( !groups_is_user_member( bp_loggedin_user_id(), bp_get_current_group_id() ) )
    321323                        return false;
    322324        }
    323325
    324         include_once( BP_PLUGIN_DIR . '/bp-activity/feeds/bp-activity-group-feed.php' );
    325         die;
     326        // setup the feed
     327        buddypress()->activity->feed = new BP_Feed( array(
     328                'id'            => 'group',
     329
     330                /* translators: Member groups activity RSS title - "[Site Name] | [Group Name] | Activity" */
     331                'title'         => sprintf( __( '%1$s | %2$s | Activity', 'buddypress' ), bp_get_site_name(), bp_get_current_group_name() ),
     332
     333                'link'          => bp_get_group_permalink( groups_get_current_group() ) . bp_get_activity_slug() . '/feed',
     334                'description'   => sprintf( __( "Group activity feed of %s.", 'buddypress' ), bp_get_current_group_name() ),
     335                'activity_args' => array(
     336                        'object'           => buddypress()->groups->id,
     337                        'primary_id'       => bp_get_current_group_id(),
     338                        'display_comments' => 'threaded'
     339                )
     340        ) );
    326341}
    327342add_action( 'bp_actions', 'groups_action_group_feed' );