Skip to:
Content

bbPress.org

Changeset 5847


Ignore:
Timestamp:
07/15/2015 09:41:49 PM (6 years ago)
Author:
johnjamesjacoby
Message:

BuddyPress: Do not filter admin toolbar URLs if not on BuddyPress root blog.

This changeset addresses a multisite implementation issue where user profiles would link to invalid URLs when BuddyPress is network activated and bbPress is active on the non-root blog.

Props imath. Fixes #2713.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/extend/buddypress/loader.php

    r5770 r5847  
    257257        if ( is_user_logged_in() ) {
    258258
    259             // Setup the logged in user variables
    260             $user_domain = bp_loggedin_user_domain();
    261             $forums_link = trailingslashit( $user_domain . $this->slug );
     259            // If BuddyPress is network activated and bbPress is
     260            // not activated on a the root blog but on any child one
     261            if ( ! bp_is_root_blog() ) {
     262                $my_account_link       = bbp_get_user_profile_url();
     263                $my_topics_link        = bbp_get_user_topics_created_url();
     264                $my_replies_link       = bbp_get_user_replies_created_url();
     265                $my_favorites_link     = bbp_get_favorites_permalink();
     266                $my_subscriptions_link = bbp_get_subscriptions_permalink();
     267            } else {
     268
     269                // Setup the logged in user variables
     270                $user_domain = bp_loggedin_user_domain();
     271                $forums_link = trailingslashit( $user_domain . $this->slug );
     272
     273                $my_account_link       = trailingslashit( $forums_link );
     274                $my_topics_link        = trailingslashit( $forums_link . bbp_get_topic_archive_slug() );
     275                $my_replies_link       = trailingslashit( $forums_link . bbp_get_reply_archive_slug() );
     276                $my_favorites_link     = trailingslashit( $forums_link . bbp_get_user_favorites_slug() );
     277                $my_subscriptions_link = trailingslashit( $forums_link . bbp_get_user_subscriptions_slug() );
     278            }
    262279
    263280            // Add the "My Account" sub menus
     
    266283                'id'     => 'my-account-' . $this->id,
    267284                'title'  => __( 'Forums', 'bbpress' ),
    268                 'href'   => trailingslashit( $forums_link )
     285                'href'   => $my_account_link
    269286            );
    270287
     
    274291                'id'     => 'my-account-' . $this->id . '-topics',
    275292                'title'  => __( 'Topics Started', 'bbpress' ),
    276                 'href'   => trailingslashit( $forums_link . bbp_get_topic_archive_slug() )
     293                'href'   => $my_topics_link
    277294            );
    278295
     
    282299                'id'     => 'my-account-' . $this->id . '-replies',
    283300                'title'  => __( 'Replies Created', 'bbpress' ),
    284                 'href'   => trailingslashit( $forums_link . bbp_get_reply_archive_slug() )
     301                'href'   => $my_replies_link
    285302            );
    286303
     
    290307                'id'     => 'my-account-' . $this->id . '-favorites',
    291308                'title'  => __( 'Favorite Topics', 'bbpress' ),
    292                 'href'   => trailingslashit( $forums_link . bbp_get_user_favorites_slug() )
     309                'href'   => $my_favorites_link
    293310            );
    294311
     
    298315                'id'     => 'my-account-' . $this->id . '-subscriptions',
    299316                'title'  => __( 'Subscribed Topics', 'bbpress' ),
    300                 'href'   => trailingslashit( $forums_link . bbp_get_user_subscriptions_slug() )
     317                'href'   => $my_subscriptions_link
    301318            );
    302319        }
Note: See TracChangeset for help on using the changeset viewer.