Skip to:
Content

BuddyPress.org

Ticket #8454: 8454.patch

File 8454.patch, 28.5 KB (added by imath, 2 years ago)
  • src/bp-activity/actions/feeds.php

    diff --git src/bp-activity/actions/feeds.php src/bp-activity/actions/feeds.php
    index 567d437d0..99a48e8ee 100644
     
    1717function bp_activity_action_sitewide_feed() {
    1818        $bp = buddypress();
    1919
    20         if ( ! bp_is_activity_component() || ! bp_is_current_action( 'feed' ) || bp_is_user() || ! empty( $bp->groups->current_group ) )
     20        if ( ! bp_is_activity_component() || ! bp_is_current_action( 'feed' ) || bp_is_user() || ! empty( $bp->groups->current_group ) ) {
    2121                return false;
     22        }
     23
     24        $link = bp_get_activity_directory_permalink();
    2225
    2326        // Setup the feed.
    2427        buddypress()->activity->feed = new BP_Activity_Feed( array(
    function bp_activity_action_sitewide_feed() { 
    2629
    2730                /* translators: %s Site Name */
    2831                'title'         => sprintf( __( '%s | Site-Wide Activity', 'buddypress' ), bp_get_site_name() ),
    29                 'link'          => bp_get_activity_directory_permalink(),
     32                'link'          => $link,
    3033                'description'   => __( 'Activity feed for the entire site.', 'buddypress' ),
    3134                'activity_args' => 'display_comments=threaded'
    3235        ) );
     36
     37        if ( ! buddypress()->activity->feed->enabled ) {
     38                bp_core_redirect( $link );
     39        }
    3340}
    3441add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
    3542
    function bp_activity_action_personal_feed() { 
    4552                return false;
    4653        }
    4754
     55        $link = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() );
     56
    4857        // Setup the feed.
    4958        buddypress()->activity->feed = new BP_Activity_Feed( array(
    5059                'id'            => 'personal',
    5160
    5261                /* translators: 1: Site Name. 2: User Display Name. */
    5362                'title'         => sprintf( _x( '%1$s | %2$s | Activity', 'Personal activity feed title', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
    54                 'link'          => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() ),
     63                'link'          => $link,
    5564
    5665                /* translators: %s: User Display Name */
    5766                'description'   => sprintf( __( 'Activity feed for %s.', 'buddypress' ), bp_get_displayed_user_fullname() ),
    5867                'activity_args' => 'user_id=' . bp_displayed_user_id()
    5968        ) );
     69
     70        if ( ! buddypress()->activity->feed->enabled ) {
     71                bp_core_redirect( $link );
     72        }
    6073}
    6174add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
    6275
    function bp_activity_action_friends_feed() { 
    7285                return false;
    7386        }
    7487
     88        $link = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() );
     89
    7590        // Setup the feed.
    7691        buddypress()->activity->feed = new BP_Activity_Feed( array(
    7792                'id'            => 'friends',
    7893
    7994                /* translators: 1: Site Name 2: User Display Name */
    8095                'title'         => sprintf( __( '%1$s | %2$s | Friends Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
    81                 'link'          => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() ),
     96                'link'          => $link,
    8297
    8398                /* translators: %s: User Display Name */
    8499                'description'   => sprintf( __( "Activity feed for %s's friends.", 'buddypress' ), bp_get_displayed_user_fullname() ),
    85100                'activity_args' => 'scope=friends'
    86101        ) );
     102
     103        if ( ! buddypress()->activity->feed->enabled ) {
     104                bp_core_redirect( $link );
     105        }
    87106}
    88107add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
    89108
    function bp_activity_action_my_groups_feed() { 
    102121        // Get displayed user's group IDs.
    103122        $groups    = groups_get_user_groups();
    104123        $group_ids = implode( ',', $groups['groups'] );
     124        $link      = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() );
    105125
    106126        // Setup the feed.
    107127        buddypress()->activity->feed = new BP_Activity_Feed( array(
    function bp_activity_action_my_groups_feed() { 
    109129
    110130                /* translators: 1: Site Name 2: User Display Name */
    111131                'title'         => sprintf( __( '%1$s | %2$s | Group Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
    112                 'link'          => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() ),
     132                'link'          => $link,
    113133
    114134                /* translators: %s: User Display Name */
    115135                'description'   => sprintf( __( "Public group activity feed of which %s is a member.", 'buddypress' ), bp_get_displayed_user_fullname() ),
    function bp_activity_action_my_groups_feed() { 
    119139                        'display_comments' => 'threaded'
    120140                )
    121141        ) );
     142
     143        if ( ! buddypress()->activity->feed->enabled ) {
     144                bp_core_redirect( $link );
     145        }
    122146}
    123147add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
    124148
    function bp_activity_action_mentions_feed() { 
    134158                return false;
    135159        }
    136160
    137         if ( !bp_is_user_activity() || ! bp_is_current_action( 'mentions' ) || ! bp_is_action_variable( 'feed', 0 ) ) {
     161        if ( ! bp_is_user_activity() || ! bp_is_current_action( 'mentions' ) || ! bp_is_action_variable( 'feed', 0 ) ) {
    138162                return false;
    139163        }
    140164
     165        $link = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions' );
     166
    141167        // Setup the feed.
    142168        buddypress()->activity->feed = new BP_Activity_Feed( array(
    143169                'id'            => 'mentions',
    144170
    145171                /* translators: 1: Site Name 2: User Display Name */
    146172                'title'         => sprintf( __( '%1$s | %2$s | Mentions', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
    147                 'link'          => bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/',
     173                'link'          => $link,
    148174
    149175                /* translators: %s: User Display Name */
    150176                'description'   => sprintf( __( "Activity feed mentioning %s.", 'buddypress' ), bp_get_displayed_user_fullname() ),
    function bp_activity_action_mentions_feed() { 
    152178                        'search_terms' => '@' . bp_core_get_username( bp_displayed_user_id() )
    153179                )
    154180        ) );
     181
     182        if ( ! buddypress()->activity->feed->enabled ) {
     183                bp_core_redirect( $link );
     184        }
    155185}
    156186add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );
    157187
    function bp_activity_action_favorites_feed() { 
    168198        }
    169199
    170200        // Get displayed user's favorite activity IDs.
    171         $favs = bp_activity_get_user_favorites( bp_displayed_user_id() );
     201        $favs    = bp_activity_get_user_favorites( bp_displayed_user_id() );
    172202        $fav_ids = implode( ',', (array) $favs );
     203        $link    = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites' );
    173204
    174205        // Setup the feed.
    175206        buddypress()->activity->feed = new BP_Activity_Feed( array(
    function bp_activity_action_favorites_feed() { 
    177208
    178209                /* translators: 1: Site Name 2: User Display Name */
    179210                'title'         => sprintf( __( '%1$s | %2$s | Favorites', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
    180                 'link'          => bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/',
     211                'link'          => $link,
    181212
    182213                /* translators: %s: User Display Name */
    183214                'description'   => sprintf( __( "Activity feed of %s's favorites.", 'buddypress' ), bp_get_displayed_user_fullname() ),
    184215                'activity_args' => 'include=' . $fav_ids
    185216        ) );
     217
     218        if ( ! buddypress()->activity->feed->enabled ) {
     219                bp_core_redirect( $link );
     220        }
    186221}
    187222add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
  • src/bp-activity/bp-activity-functions.php

    diff --git src/bp-activity/bp-activity-functions.php src/bp-activity/bp-activity-functions.php
    index fc05f2a5a..1a4fe39b2 100644
    function bp_activity_personal_data_exporter( $email_address, $page ) { 
    42654265                'done' => $done,
    42664266        );
    42674267}
     4268
     4269/**
     4270 * Checks whether an activity feed is enabled.
     4271 *
     4272 * @since 8.0.0
     4273 *
     4274 * @param string $feed_id The feed identifier. Possible values are:
     4275 *                        'sitewide', 'personal', 'friends', 'mygroups', 'mentions', 'favorites'.
     4276 */
     4277function bp_activity_is_feed_enable( $feed_id = '' ) {
     4278        /**
     4279         * Filters if BuddyPress should consider feeds enabled. If disabled, it will return early.
     4280         *
     4281         * @since 1.8.0
     4282         * @since 8.0.0 Adds the `$feed_id` parameter.
     4283         *
     4284         * @param bool   $value   Defaults to true aka feeds are enabled.
     4285         * @param string $feed_id The feed identifier.
     4286         */
     4287        return (bool) apply_filters( 'bp_activity_enable_feeds', true, $feed_id );
     4288}
  • src/bp-activity/classes/class-bp-activity-feed.php

    diff --git src/bp-activity/classes/class-bp-activity-feed.php src/bp-activity/classes/class-bp-activity-feed.php
    index e319101e6..8b2388a22 100644
    class BP_Activity_Feed { 
    8787         * @param array $args Optional.
    8888         */
    8989        public function __construct( $args = array() ) {
     90                $feed_id = '';
    9091
    91                 /**
    92                  * Filters if BuddyPress should consider feeds enabled. If disabled, it will return early.
    93                  *
    94                  * @since 1.8.0
    95                  *
    96                  * @param bool true Default true aka feeds are enabled.
    97                  */
    98                 if ( false === (bool) apply_filters( 'bp_activity_enable_feeds', true ) ) {
     92                if ( isset( $args['id'] ) ) {
     93                        $feed_id = sanitize_key( $args['id'] );
     94                }
     95
     96                if ( false === bp_activity_is_feed_enable( $feed_id ) ) {
    9997                        global $wp_query;
    10098
    10199                        // Set feed flag to false.
    102100                        $wp_query->is_feed = false;
    103101
    104                         return false;
    105                 }
    106 
    107                 // Setup data.
    108                 $this->data = wp_parse_args( $args, array(
    109                         // Internal identifier for the RSS feed - should be alphanumeric only.
    110                         'id'               => '',
    111 
    112                         // RSS title - should be plain-text.
    113                         'title'            => '',
    114 
    115                         // Relevant link for the RSS feed.
    116                         'link'             => '',
    117 
    118                         // RSS description - should be plain-text.
    119                         'description'      => '',
    120 
    121                         // Time-to-live - number of minutes to cache the data before an aggregator
    122                         // requests it again.  This is only acknowledged if the RSS client supports it
    123                         //
    124                         // See: http://www.rssboard.org/rss-profile#element-channel-ttl.
    125                         // See: http://www.kbcafe.com/rss/rssfeedstate.html#ttl.
    126                         'ttl'              => '30',
    127 
    128                         // Syndication module - similar to ttl, but not really supported by RSS
    129                         // clients
    130                         //
    131                         // See: http://web.resource.org/rss/1.0/modules/syndication/#description.
    132                         // See: http://www.kbcafe.com/rss/rssfeedstate.html#syndicationmodule.
    133                         'update_period'    => 'hourly',
    134                         'update_frequency' => 2,
    135 
    136                         // Number of items to display.
    137                         'max'              => 50,
     102                        $this->data = array(
     103                                'enabled' => false,
     104                        );
     105                } else {
     106                        // Setup data.
     107                        $this->data = wp_parse_args( $args, array(
     108                                // Internal identifier for the RSS feed - should be alphanumeric only.
     109                                'id'               => '',
     110
     111                                // RSS title - should be plain-text.
     112                                'title'            => '',
     113
     114                                // Relevant link for the RSS feed.
     115                                'link'             => '',
     116
     117                                // RSS description - should be plain-text.
     118                                'description'      => '',
     119
     120                                // Time-to-live - number of minutes to cache the data before an aggregator
     121                                // requests it again.  This is only acknowledged if the RSS client supports it
     122                                //
     123                                // See: http://www.rssboard.org/rss-profile#element-channel-ttl.
     124                                // See: http://www.kbcafe.com/rss/rssfeedstate.html#ttl.
     125                                'ttl'              => '30',
     126
     127                                // Syndication module - similar to ttl, but not really supported by RSS
     128                                // clients
     129                                //
     130                                // See: http://web.resource.org/rss/1.0/modules/syndication/#description.
     131                                // See: http://www.kbcafe.com/rss/rssfeedstate.html#syndicationmodule.
     132                                'update_period'    => 'hourly',
     133                                'update_frequency' => 2,
     134
     135                                // Number of items to display.
     136                                'max'              => 50,
     137
     138                                // Activity arguments passed to bp_has_activities().
     139                                'activity_args'    => array(),
     140
     141                                // The activity feed is enabled.
     142                                'enabled'          => false,
     143                        ) );
     144
     145                        /**
     146                         * Fires before the feed is setup so plugins can modify.
     147                         *
     148                         * @since 1.8.0
     149                         *
     150                         * @param BP_Activity_Feed $this Current instance of activity feed. Passed by reference.
     151                         */
     152                        do_action_ref_array( 'bp_activity_feed_prefetch', array( &$this ) );
     153
     154                        // Setup class properties.
     155                        $this->setup_properties();
     156
     157                        // Check if id is valid.
     158                        if ( empty( $this->id ) ) {
     159                                _doing_it_wrong( 'BP_Activity_Feed', __( "RSS feed 'id' must be defined", 'buddypress' ), 'BP 1.8' );
     160                                return false;
     161                        }
    138162
    139                         // Activity arguments passed to bp_has_activities().
    140                         'activity_args'    => array()
    141                 ) );
     163                        /**
     164                         * Fires after the feed is setup so plugins can modify.
     165                         *
     166                         * @since 1.8.0
     167                         *
     168                         * @param BP_Activity_Feed $this Current instance of activity feed. Passed by reference.
     169                         */
     170                        do_action_ref_array( 'bp_activity_feed_postfetch', array( &$this ) );
    142171
    143                 /**
    144                  * Fires before the feed is setup so plugins can modify.
    145                  *
    146                  * @since 1.8.0
    147                  *
    148                  * @param BP_Activity_Feed $this Current instance of activity feed. Passed by reference.
    149                  */
    150                 do_action_ref_array( 'bp_activity_feed_prefetch', array( &$this ) );
     172                        // Setup feed hooks.
     173                        $this->setup_hooks();
    151174
    152                 // Setup class properties.
    153                 $this->setup_properties();
     175                        // Output the feed.
     176                        $this->output();
    154177
    155                 // Check if id is valid.
    156                 if ( empty( $this->id ) ) {
    157                         _doing_it_wrong( 'BP_Activity_Feed', __( "RSS feed 'id' must be defined", 'buddypress' ), 'BP 1.8' );
    158                         return false;
     178                        // Kill the rest of the output.
     179                        die();
    159180                }
    160 
    161                 /**
    162                  * Fires after the feed is setup so plugins can modify.
    163                  *
    164                  * @since 1.8.0
    165                  *
    166                  * @param BP_Activity_Feed $this Current instance of activity feed. Passed by reference.
    167                  */
    168                 do_action_ref_array( 'bp_activity_feed_postfetch', array( &$this ) );
    169 
    170                 // Setup feed hooks.
    171                 $this->setup_hooks();
    172 
    173                 // Output the feed.
    174                 $this->output();
    175 
    176                 // Kill the rest of the output.
    177                 die();
    178181        }
    179182
    180183        /** SETUP ****************************************************************/
  • src/bp-templates/bp-legacy/buddypress/activity/index.php

    diff --git src/bp-templates/bp-legacy/buddypress/activity/index.php src/bp-templates/bp-legacy/buddypress/activity/index.php
    index e6c0ad610..a26e65231 100644
    do_action( 'bp_before_directory_activity' ); ?> 
    189189
    190190        <div class="item-list-tabs no-ajax" id="subnav" aria-label="<?php esc_attr_e( 'Activity secondary navigation', 'buddypress' ); ?>" role="navigation">
    191191                <ul>
    192                         <li class="feed"><a href="<?php bp_sitewide_activity_feed_link(); ?>" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( 'RSS Feed', 'buddypress' ); ?>" aria-label="<?php esc_attr_e( 'RSS Feed', 'buddypress' ); ?>"><?php _e( 'RSS', 'buddypress' ); ?></a></li>
     192                        <?php if ( bp_activity_is_feed_enable( 'sitewide' ) ) : ?>
     193                                <li class="feed">
     194                                        <a href="<?php bp_sitewide_activity_feed_link(); ?>" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( 'RSS Feed', 'buddypress' ); ?>" aria-label="<?php esc_attr_e( 'RSS Feed', 'buddypress' ); ?>">
     195                                                <?php esc_html_e( 'RSS', 'buddypress' ); ?>
     196                                        </a>
     197                                </li>
     198                        <?php endif; ?>
    193199
    194200                        <?php
    195201
  • src/bp-templates/bp-legacy/buddypress/groups/single/activity.php

    diff --git src/bp-templates/bp-legacy/buddypress/groups/single/activity.php src/bp-templates/bp-legacy/buddypress/groups/single/activity.php
    index 5d66f4396..71dc12b11 100644
     
    1010?>
    1111<div class="item-list-tabs no-ajax" id="subnav" aria-label="<?php esc_attr_e( 'Group secondary navigation', 'buddypress' ); ?>" role="navigation">
    1212        <ul>
    13                 <li class="feed"><a href="<?php bp_group_activity_feed_link(); ?>" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( 'RSS Feed', 'buddypress' ); ?>" aria-label="<?php esc_attr_e( 'RSS Feed', 'buddypress' ); ?>"><?php _e( 'RSS', 'buddypress' ); ?></a></li>
     13                <?php if ( bp_activity_is_feed_enable( 'group' ) ) : ?>
     14                        <li class="feed">
     15                                <a href="<?php bp_group_activity_feed_link(); ?>" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( 'RSS Feed', 'buddypress' ); ?>" aria-label="<?php esc_attr_e( 'RSS Feed', 'buddypress' ); ?>">
     16                                        <?php _e( 'RSS', 'buddypress' ); ?>
     17                                </a>
     18                        </li>
     19                <?php endif; ?>
    1420
    1521                <?php
    1622
  • src/bp-templates/bp-nouveau/buddypress/common/search-and-filters-bar.php

    diff --git src/bp-templates/bp-nouveau/buddypress/common/search-and-filters-bar.php src/bp-templates/bp-nouveau/buddypress/common/search-and-filters-bar.php
    index 20441b2f3..9e81912f5 100644
     
    33 * BP Nouveau Search & filters bar
    44 *
    55 * @since 3.0.0
    6  * @version 3.1.0
     6 * @version 8.0.0
    77 */
    88?>
    99<div class="subnav-filters filters no-ajax" id="subnav-filters">
    1010
    1111        <?php if ( 'friends' !== bp_current_component() ) : ?>
    12         <div class="subnav-search clearfix">
     12                <div class="subnav-search clearfix">
    1313
    14                 <?php if ( 'activity' === bp_current_component() ) : ?>
    15                         <div class="feed"><a href="<?php bp_sitewide_activity_feed_link(); ?>" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( 'RSS Feed', 'buddypress' ); ?>"><span class="bp-screen-reader-text"><?php esc_html_e( 'RSS', 'buddypress' ); ?></span></a></div>
    16                 <?php endif; ?>
     14                        <?php if ( bp_nouveau_is_feed_enable() ) : ?>
     15                                <div id="activity-rss-feed" class="feed">
     16                                        <a href="<?php bp_nouveau_activity_rss_link(); ?>" class="bp-tooltip" data-bp-tooltip="<?php bp_nouveau_activity_rss_tooltip(); ?>">
     17                                                <span class="bp-screen-reader-text"><?php bp_nouveau_activity_rss_screen_reader_text(); ?></span>
     18                                        </a>
     19                                </div>
     20                        <?php endif; ?>
    1721
    18                 <?php bp_nouveau_search_form(); ?>
     22                        <?php bp_nouveau_search_form(); ?>
    1923
    20         </div>
     24                </div>
    2125        <?php endif; ?>
    2226
    23                 <?php if ( bp_is_user() && ! bp_is_current_action( 'requests' ) ) : ?>
    24                         <?php bp_get_template_part( 'common/filters/user-screens-filters' ); ?>
    25                 <?php elseif ( 'groups' === bp_current_component() ) : ?>
    26                         <?php bp_get_template_part( 'common/filters/groups-screens-filters' ); ?>
    27                 <?php else : ?>
    28                         <?php bp_get_template_part( 'common/filters/directory-filters' ); ?>
    29                 <?php endif; ?>
     27        <?php if ( bp_is_user() && ! bp_is_current_action( 'requests' ) ) : ?>
     28                <?php bp_get_template_part( 'common/filters/user-screens-filters' ); ?>
     29        <?php elseif ( 'groups' === bp_current_component() ) : ?>
     30                <?php bp_get_template_part( 'common/filters/groups-screens-filters' ); ?>
     31        <?php else : ?>
     32                <?php bp_get_template_part( 'common/filters/directory-filters' ); ?>
     33        <?php endif; ?>
    3034
    3135</div><!-- search & filters -->
  • src/bp-templates/bp-nouveau/buddypress/groups/single/activity.php

    diff --git src/bp-templates/bp-nouveau/buddypress/groups/single/activity.php src/bp-templates/bp-nouveau/buddypress/groups/single/activity.php
    index 716ef6f67..15465529d 100644
     
    33 * BuddyPress - Groups Activity
    44 *
    55 * @since 3.0.0
    6  * @version 3.1.0
     6 * @version 8.0.0
    77 */
    8 
    98?>
    109
    1110<h2 class="bp-screen-title<?php echo ( ! bp_is_group_home() ) ? ' bp-screen-reader-text' : ''; ?>">
     
    1716<div class="subnav-filters filters clearfix">
    1817
    1918        <ul>
    20 
    21                 <li class="feed"><a href="<?php bp_group_activity_feed_link(); ?>" class="bp-tooltip no-ajax" data-bp-tooltip="<?php esc_attr_e( 'RSS Feed', 'buddypress' ); ?>"><span class="bp-screen-reader-text"><?php esc_html_e( 'RSS', 'buddypress' ); ?></span></a></li>
     19                <?php if ( bp_activity_is_feed_enable( 'group' ) ) : ?>
     20                        <li class="feed">
     21                                <a href="<?php bp_group_activity_feed_link(); ?>" class="bp-tooltip no-ajax" data-bp-tooltip="<?php esc_attr_e( 'RSS Feed', 'buddypress' ); ?>">
     22                                        <span class="bp-screen-reader-text"><?php esc_html_e( 'RSS', 'buddypress' ); ?></span>
     23                                </a>
     24                        </li>
     25                <?php endif; ?>
    2226
    2327                <li class="group-act-search"><?php bp_nouveau_search_form(); ?></li>
    24 
    2528        </ul>
    2629
    27                 <?php bp_get_template_part( 'common/filters/groups-screens-filters' ); ?>
     30        <?php bp_get_template_part( 'common/filters/groups-screens-filters' ); ?>
    2831</div><!-- // .subnav-filters -->
    2932
    3033<?php bp_nouveau_group_hook( 'before', 'activity_content' ); ?>
    3134
    3235<div id="activity-stream" class="activity single-group" data-bp-list="activity">
    3336
    34                 <li id="bp-activity-ajax-loader"><?php bp_nouveau_user_feedback( 'group-activity-loading' ); ?></li>
     37        <div id="bp-activity-ajax-loader"><?php bp_nouveau_user_feedback( 'group-activity-loading' ); ?></div>
    3538
    3639</div><!-- .activity -->
    3740
  • src/bp-templates/bp-nouveau/buddypress/members/single/activity.php

    diff --git src/bp-templates/bp-nouveau/buddypress/members/single/activity.php src/bp-templates/bp-nouveau/buddypress/members/single/activity.php
    index b0a94c270..4e7117c14 100644
     
    33 * BuddyPress - Users Activity
    44 *
    55 * @since 3.0.0
    6  * @version 3.0.0
     6 * @version 8.0.0
    77 */
    8 
    98?>
    109
    1110<nav class="<?php bp_nouveau_single_item_subnav_classes(); ?>" id="subnav" role="navigation" aria-label="<?php esc_attr_e( 'Activity menu', 'buddypress' ); ?>">
     
    3029
    3130        <div id="bp-ajax-loader"><?php bp_nouveau_user_feedback( 'member-activity-loading' ); ?></div>
    3231
    33         <ul  class="<?php bp_nouveau_loop_classes(); ?>" >
    34 
    35         </ul>
     32        <ul class="<?php bp_nouveau_loop_classes(); ?>"></ul>
    3633
    3734</div><!-- .activity -->
    3835
  • src/bp-templates/bp-nouveau/includes/activity/loader.php

    diff --git src/bp-templates/bp-nouveau/includes/activity/loader.php src/bp-templates/bp-nouveau/includes/activity/loader.php
    index d3b569192..9f74fc3ba 100644
     
    33 * BP Nouveau Activity
    44 *
    55 * @since 3.0.0
    6  * @version 3.0.0
     6 * @version 8.0.0
    77 */
    88
    99// Exit if accessed directly.
    defined( 'ABSPATH' ) || exit; 
    1515 * @since 3.0.0
    1616 */
    1717class BP_Nouveau_Activity {
     18        /**
     19         * Nouveau Activity directory.
     20         *
     21         * @since 3.0.0
     22         * @var string
     23         */
     24        public $dir = '';
     25
     26        /**
     27         * RSS feed link data.
     28         *
     29         * @since 3.0.0
     30         * @var string
     31         */
     32        public $current_rss_feed = array();
     33
    1834        /**
    1935         * Constructor
    2036         *
  • src/bp-templates/bp-nouveau/includes/activity/template-tags.php

    diff --git src/bp-templates/bp-nouveau/includes/activity/template-tags.php src/bp-templates/bp-nouveau/includes/activity/template-tags.php
    index 29e4d7273..e1ad849ff 100644
     
    33 * Activity Template tags
    44 *
    55 * @since 3.0.0
    6  * @version 5.0.0
     6 * @version 8.0.0
    77 */
    88
    99// Exit if accessed directly.
    function bp_nouveau_activity_comment_buttons( $args = array() ) { 
    912912
    913913                return $return;
    914914        }
     915
     916/**
     917 * Outputs the Activity RSS link.
     918 *
     919 * @since 8.0.0
     920 */
     921function bp_nouveau_activity_rss_link() {
     922        echo esc_url( bp_nouveau_activity_get_rss_link() );
     923}
     924
     925        /**
     926         * Returns the Activity RSS link.
     927         *
     928         * @since 8.0.0
     929         *
     930         * @return string The Activity RSS link.
     931         */
     932        function bp_nouveau_activity_get_rss_link() {
     933                $bp_nouveau = bp_nouveau();
     934                $link       = '';
     935
     936                if ( isset( $bp_nouveau->activity->current_rss_feed['link'] ) ) {
     937                        $link = $bp_nouveau->activity->current_rss_feed['link'];
     938                }
     939
     940                /**
     941                 * Filter here to edit the Activity RSS link.
     942                 *
     943                 * @since 8.0.0
     944                 *
     945                 * @param string The Activity RSS link.
     946                 */
     947                return apply_filters( 'bp_nouveau_activity_get_rss_link', $link );
     948        }
     949
     950/**
     951 * Outputs the Activity RSS Tooltip.
     952 *
     953 * @since 8.0.0
     954 */
     955function bp_nouveau_activity_rss_tooltip() {
     956        echo esc_attr( bp_nouveau_activity_get_rss_tooltip() );
     957}
     958
     959        /**
     960         * Returns the Activity RSS Tooltip.
     961         *
     962         * @since 8.0.0
     963         *
     964         * @return string The Activity RSS Tooltip.
     965         */
     966        function bp_nouveau_activity_get_rss_tooltip() {
     967                $bp_nouveau = bp_nouveau();
     968                $tooltip       = '';
     969
     970                if ( isset( $bp_nouveau->activity->current_rss_feed['tooltip'] ) ) {
     971                        $tooltip = $bp_nouveau->activity->current_rss_feed['tooltip'];
     972                }
     973
     974                /**
     975                 * Filter here to edit the Activity RSS Tooltip.
     976                 *
     977                 * @since 8.0.0
     978                 *
     979                 * @param string The Activity RSS Tooltip.
     980                 */
     981                return apply_filters( 'bp_nouveau_activity_get_rss_tooltip', $tooltip );
     982        }
     983
     984/**
     985 * Outputs the Activity RSS screen reader text.
     986 *
     987 * @since 8.0.0
     988 */
     989function bp_nouveau_activity_rss_screen_reader_text() {
     990        echo esc_attr( bp_nouveau_activity_get_rss_screen_reader_text() );
     991}
     992
     993        /**
     994         * Returns the Activity RSS screen reader text.
     995         *
     996         * @since 8.0.0
     997         *
     998         * @return string The Activity RSS screen reader text.
     999         */
     1000        function bp_nouveau_activity_get_rss_screen_reader_text() {
     1001                $bp_nouveau         = bp_nouveau();
     1002                $screen_reader_text = '';
     1003
     1004                if ( isset( $bp_nouveau->activity->current_rss_feed['tooltip'] ) ) {
     1005                        $screen_reader_text = $bp_nouveau->activity->current_rss_feed['tooltip'];
     1006                }
     1007
     1008                /**
     1009                 * Filter here to edit the Activity RSS screen reader text.
     1010                 *
     1011                 * @since 8.0.0
     1012                 *
     1013                 * @param string The Activity RSS screen reader text.
     1014                 */
     1015                return apply_filters( 'bp_nouveau_activity_get_rss_screen_reader_text', $screen_reader_text );
     1016        }
  • src/bp-templates/bp-nouveau/includes/template-tags.php

    diff --git src/bp-templates/bp-nouveau/includes/template-tags.php src/bp-templates/bp-nouveau/includes/template-tags.php
    index 3439280fb..0d688a509 100644
     
    33 * Common template tags
    44 *
    55 * @since 3.0.0
    6  * @version 7.0.0
     6 * @version 8.0.0
    77 */
    88
    99// Exit if accessed directly.
    function nouveau_error_template( $message = '', $type = '' ) { 
    26832683
    26842684        <?php
    26852685}
     2686
     2687/**
     2688 * Checks whether the Activity RSS links should be output.
     2689 *
     2690 * @since 8.0.0
     2691 *
     2692 * @return bool True to output the Activity RSS link. False otherwise.
     2693 */
     2694function bp_nouveau_is_feed_enable() {
     2695        $retval     = false;
     2696        $bp_nouveau = bp_nouveau();
     2697
     2698        if ( bp_is_active( 'activity' ) && 'activity' === bp_current_component() ) {
     2699                if ( isset( $bp_nouveau->activity->current_rss_feed ) ) {
     2700                        $bp_nouveau->activity->current_rss_feed = array(
     2701                                'link'               => '',
     2702                                'tooltip'            => _x( 'RSS Feed', 'BP RSS Tooltip', 'buddypress' ),
     2703                                'screen_reader_text' => _x( 'RSS', 'BP RSS screen reader text', 'buddypress' ),
     2704                        );
     2705
     2706                        if ( ! bp_is_user() && ! bp_is_group() ) {
     2707                                $retval = bp_activity_is_feed_enable( 'sitewide' );
     2708
     2709                                if ( $retval ) {
     2710                                        $bp_nouveau->activity->current_rss_feed['link'] = bp_get_sitewide_activity_feed_link();
     2711                                }
     2712                        } elseif ( bp_is_user_activity() ) {
     2713                                $retval = bp_activity_is_feed_enable( 'personal' );
     2714
     2715                                if ( $retval ) {
     2716                                        $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/feed' );
     2717                                }
     2718
     2719                                if ( bp_is_active( 'friends' ) && bp_is_current_action( bp_get_friends_slug() ) ) {
     2720                                        $retval = bp_activity_is_feed_enable( 'friends' );
     2721
     2722                                        if ( $retval ) {
     2723                                                $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/feed' );
     2724                                        }
     2725                                } elseif ( bp_is_active( 'groups' ) && bp_is_current_action( bp_get_groups_slug() ) ) {
     2726                                        $retval = bp_activity_is_feed_enable( 'mygroups' );
     2727
     2728                                        if ( $retval ) {
     2729                                                $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/feed' );
     2730                                        }
     2731                                } elseif ( bp_activity_do_mentions() && bp_is_current_action( 'mentions' ) ) {
     2732                                        $retval = bp_activity_is_feed_enable( 'mentions' );
     2733
     2734                                        if ( $retval ) {
     2735                                                $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed' );
     2736                                        }
     2737                                } elseif ( bp_activity_can_favorite() && bp_is_current_action( 'favorites' ) ) {
     2738                                        $retval = bp_activity_is_feed_enable( 'mentions' );
     2739
     2740                                        if ( $retval ) {
     2741                                                $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/feed' );
     2742                                        }
     2743                                }
     2744                        }
     2745                }
     2746        }
     2747
     2748        return $retval;
     2749}
  • src/bp-templates/bp-nouveau/js/buddypress-activity.js

    diff --git src/bp-templates/bp-nouveau/js/buddypress-activity.js src/bp-templates/bp-nouveau/js/buddypress-activity.js
    index 0eab0891a..aee2a7802 100644
    window.bp = window.bp || {}; 
    6464
    6565                        // Inject Activities
    6666                        $( '#buddypress [data-bp-list="activity"]' ).on( 'click', 'li.load-newest, li.load-more', this.injectActivities.bind( this ) );
     67                        $( '#buddypress [data-bp-list]' ).on( 'bp_ajax_request', this.updateRssLink );
    6768
    6869                        // Hightlight new activities & clean up the stream
    6970                        $( '#buddypress' ).on( 'bp_ajax_request', '[data-bp-list="activity"]', this.scopeLoaded.bind( this ) );
    window.bp = window.bp || {}; 
    833834                        } else if ( event.ctrlKey && 13 === keyCode && $( element ).val() ) {
    834835                                $( element ).closest( 'form' ).find( '[type=submit]' ).first().trigger( 'click' );
    835836                        }
     837                },
     838
     839                updateRssLink: function( event, data ) {
     840                        var rssLink = data.response.feed_url || '';
     841
     842                        if ( rssLink && $( '#activity-rss-feed' ).length ) {
     843                                $( '#activity-rss-feed' ).find( 'a' ).first().prop( 'href', rssLink );
     844                        }
    836845                }
    837846        };
    838847