Skip to:
Content

bbPress.org

Changeset 6326


Ignore:
Timestamp:
02/26/2017 08:46:22 PM (8 years ago)
Author:
johnjamesjacoby
Message:

Engagements/BuddyPress: Finish integration, and clean-up favorites & subscriptions support.

See #3068.

Location:
trunk/src/includes/extend/buddypress
Files:
2 edited

Legend:

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

    r6321 r6326  
    278278                $my_topics_link        = bbp_get_user_topics_created_url( $user_id );
    279279                $my_replies_link       = bbp_get_user_replies_created_url( $user_id );
     280                $my_engagements_link   = bbp_get_user_engagements_url( $user_id );
    280281                $my_favorites_link     = bbp_get_favorites_permalink( $user_id );
    281282                $my_subscriptions_link = bbp_get_subscriptions_permalink( $user_id );
     
    289290                $my_topics_link        = trailingslashit( $forums_link . bbp_get_topic_archive_slug() );
    290291                $my_replies_link       = trailingslashit( $forums_link . bbp_get_reply_archive_slug() );
     292                $my_engagements_link   = trailingslashit( $forums_link . bbp_get_user_engagements_slug() );
    291293                $my_favorites_link     = trailingslashit( $forums_link . bbp_get_user_favorites_slug() );
    292294                $my_subscriptions_link = trailingslashit( $forums_link . bbp_get_user_subscriptions_slug() );
     
    317319            );
    318320
     321            // Engagements
     322            if ( bbp_is_engagements_active() ) {
     323                $wp_admin_nav[] = array(
     324                    'parent' => 'my-account-' . $this->id,
     325                    'id'     => 'my-account-' . $this->id . '-engagements',
     326                    'title'  => __( 'Engagements', 'bbpress' ),
     327                    'href'   => $my_engagements_link
     328                );
     329            }
     330
    319331            // Favorites
    320             $wp_admin_nav[] = array(
    321                 'parent' => 'my-account-' . $this->id,
    322                 'id'     => 'my-account-' . $this->id . '-favorites',
    323                 'title'  => __( 'Favorite Topics', 'bbpress' ),
    324                 'href'   => $my_favorites_link
    325             );
     332            if ( bbp_is_favorites_active() ) {
     333                $wp_admin_nav[] = array(
     334                    'parent' => 'my-account-' . $this->id,
     335                    'id'     => 'my-account-' . $this->id . '-favorites',
     336                    'title'  => __( 'Favorite Topics', 'bbpress' ),
     337                    'href'   => $my_favorites_link
     338                );
     339            }
    326340
    327341            // Subscriptions
    328             $wp_admin_nav[] = array(
    329                 'parent' => 'my-account-' . $this->id,
    330                 'id'     => 'my-account-' . $this->id . '-subscriptions',
    331                 'title'  => __( 'Subscribed Topics', 'bbpress' ),
    332                 'href'   => $my_subscriptions_link
    333             );
     342            if ( bbp_is_subscriptions_active() ) {
     343                $wp_admin_nav[] = array(
     344                    'parent' => 'my-account-' . $this->id,
     345                    'id'     => 'my-account-' . $this->id . '-subscriptions',
     346                    'title'  => __( 'Subscribed Topics', 'bbpress' ),
     347                    'href'   => $my_subscriptions_link
     348                );
     349            }
    334350        }
    335351
  • trunk/src/includes/extend/buddypress/members.php

    r6321 r6326  
    6969     */
    7070    private function setup_filters() {
    71         add_filter( 'bbp_pre_get_user_profile_url',    array( $this, 'user_profile_url'            )        );
    72         add_filter( 'bbp_get_favorites_permalink',     array( $this, 'get_favorites_permalink'     ), 10, 2 );
    73         add_filter( 'bbp_get_subscriptions_permalink', array( $this, 'get_subscriptions_permalink' ), 10, 2 );
     71        add_filter( 'bbp_pre_get_user_profile_url',     array( $this, 'user_profile_url'            )        );
     72        add_filter( 'bbp_pre_get_user_engagements_url', array( $this, 'get_engagements_permalink'   )        );
     73        add_filter( 'bbp_get_favorites_permalink',      array( $this, 'get_favorites_permalink'     ), 10, 2 );
     74        add_filter( 'bbp_get_subscriptions_permalink',  array( $this, 'get_subscriptions_permalink' ), 10, 2 );
    7475    }
    7576
     
    180181     * @return string
    181182     */
    182     public function get_engagements_permalink( $url, $user_id ) {
     183    public function get_engagements_permalink( $user_id ) {
    183184
    184185        // Do not filter if not on BuddyPress root blog
     
    217218        } elseif ( bbp_is_subscriptions_active() && bp_is_current_action( bbp_get_user_subscriptions_slug() ) ) {
    218219            $wp_query->bbp_is_single_user_subs = true;
     220
     221        // 'engagements' action
     222        } elseif ( bbp_is_engagements_active() && bp_is_current_action( bbp_get_user_engagements_slug() ) ) {
     223            $wp_query->bbp_is_single_user_engagements = true;
    219224        }
    220225    }
Note: See TracChangeset for help on using the changeset viewer.