Skip to:
Content

bbPress.org

Changeset 4616


Ignore:
Timestamp:
12/21/2012 08:46:31 AM (14 years ago)
Author:
johnjamesjacoby
Message:

When viewing BuddyPress member profile pages, set the $wp_query variables to indicate if viewing favorites or subscriptions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/extend/buddypress/members.php

    r4397 r4616  
    4242         */
    4343        private function setup_actions() {
     44
     45                // Allow unsubscribe/unfavorite links to work
     46                add_action( 'bp_template_redirect', array( $this, 'set_member_forum_query_vars' ) );
    4447
    4548                /** Favorites *********************************************************/
    … …  
    140143                return $url;
    141144        }
     145
     146        /**
     147         * Set favorites and subscriptions query variables if viewing member profile
     148         * pages.
     149         *
     150         * @since bbPress (r4615)
     151         *
     152         * @global WP_Query $wp_query
     153         * @return If not viewing your own profile
     154         */
     155        public function set_member_forum_query_vars() {
     156
     157                // Special handling for forum component
     158                if ( ! bp_is_my_profile() )
     159                        return;
     160
     161                global $wp_query;
     162
     163                // 'favorites' action
     164                if ( bbp_is_favorites_active() && bp_is_current_action( 'favorites' ) ) {
     165                        $wp_query->bbp_is_single_user_favs = true;
     166
     167                // 'subscriptions' action
     168                } elseif ( bbp_is_subscriptions_active() && bp_is_current_action( 'subscriptions' ) ) {
     169                        $wp_query->bbp_is_single_user_subs = true;
     170                }
     171        }
    142172}
    143173endif;
Note: See TracChangeset for help on using the changeset viewer.