Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/27/2021 06:59:23 AM (4 years ago)
Author:
imath
Message:

BP Nouveau: introduce a function to get active component slugs

bp_nouveau_get_component_slug() accepts the component's ID as an argument and uses the bp_get_{$component_id}_slug() corresponding function to get its slug only if the component is active.

Replace all occurences of bp_get_{$component_id}_slug() by bp_nouveau_get_component_slug( $component_id ) to prevent errors.

Fixes #8464

File:
1 edited

Legend:

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

    r12907 r12908  
    44 *
    55 * @since 3.0.0
    6  * @version 7.0.0
     6 * @version 8.0.0
    77 */
    88
     
    22402240        $output = '';
    22412241
    2242         if ( bp_get_notifications_slug() === bp_current_component() ) {
     2242        if ( bp_nouveau_get_component_slug( 'notifications' ) === bp_current_component() ) {
    22432243            $output = bp_nouveau_get_notifications_filters();
    22442244
     
    27212721
    27222722                if ( $retval ) {
    2723                     $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/feed' );
     2723                    $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/feed' );
    27242724                }
    27252725
    2726                 if ( bp_is_active( 'friends' ) && bp_is_current_action( bp_get_friends_slug() ) ) {
     2726                if ( bp_is_active( 'friends' ) && bp_is_current_action( bp_nouveau_get_component_slug( 'friends' ) ) ) {
    27272727                    $retval = bp_activity_is_feed_enable( 'friends' );
    27282728
    27292729                    if ( $retval ) {
    2730                         $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/feed' );
     2730                        $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/' . bp_nouveau_get_component_slug( 'friends' ) . '/feed' );
    27312731                    }
    2732                 } elseif ( bp_is_active( 'groups' ) && bp_is_current_action( bp_get_groups_slug() ) ) {
     2732                } elseif ( bp_is_active( 'groups' ) && bp_is_current_action( bp_nouveau_get_component_slug( 'groups' ) ) ) {
    27332733                    $retval = bp_activity_is_feed_enable( 'mygroups' );
    27342734
    27352735                    if ( $retval ) {
    2736                         $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/feed' );
     2736                        $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/' . bp_nouveau_get_component_slug( 'groups' ) . '/feed' );
    27372737                    }
    27382738                } elseif ( bp_activity_do_mentions() && bp_is_current_action( 'mentions' ) ) {
     
    27402740
    27412741                    if ( $retval ) {
    2742                         $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed' );
     2742                        $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/mentions/feed' );
    27432743                    }
    27442744                } elseif ( bp_activity_can_favorite() && bp_is_current_action( 'favorites' ) ) {
     
    27462746
    27472747                    if ( $retval ) {
    2748                         $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/feed' );
     2748                        $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/favorites/feed' );
    27492749                    }
    27502750                }
Note: See TracChangeset for help on using the changeset viewer.