Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/27/2021 04:56:32 AM (9 months ago)
Author:
imath
Message:

Improve ways to disable BP RSS feeds

Returning false to the filter bp_activity_enable_feeds is completely disabling all RSS feeds and will now avoid the output of an empty link.

A second argument has been added to the filter to allow to disable a specific feed in particular, one of these feed identifiers:

  • 'sitewide',
  • 'personal',
  • 'friends',
  • 'mygroups',
  • 'mentions',
  • 'favorites'.

The BP Nouveau Template pack has also been improved to update the user's profile activity RSS feed links according to the context.

Props sippis

Fixes #8454

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/includes/activity/template-tags.php

    r12358 r12907  
    44 *
    55 * @since 3.0.0
    6  * @version 5.0.0
     6 * @version 8.0.0
    77 */
    88
     
    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    }
Note: See TracChangeset for help on using the changeset viewer.