Skip to:
Content

BuddyPress.org

Ticket #6214: 6214.patch

File 6214.patch, 3.0 KB (added by imath, 12 years ago)
  • src/bp-activity/bp-activity-loader.php

    diff --git src/bp-activity/bp-activity-loader.php src/bp-activity/bp-activity-loader.php
    index c8a3e35..179324b 100644
    class BP_Activity_Component extends BP_Component {  
    187187                }
    188188
    189189                // Favorite activity items
    190                 $sub_nav[] = array(
    191                         'name'            => _x( 'Favorites', 'Profile activity screen sub nav', 'buddypress' ),
    192                         'slug'            => 'favorites',
    193                         'parent_url'      => $activity_link,
    194                         'parent_slug'     => $this->slug,
    195                         'screen_function' => 'bp_activity_screen_favorites',
    196                         'position'        => 30,
    197                         'item_css_id'     => 'activity-favs'
    198                 );
     190                if ( bp_activity_can_favorite() ) {
     191                        $sub_nav[] = array(
     192                                'name'            => _x( 'Favorites', 'Profile activity screen sub nav', 'buddypress' ),
     193                                'slug'            => 'favorites',
     194                                'parent_url'      => $activity_link,
     195                                'parent_slug'     => $this->slug,
     196                                'screen_function' => 'bp_activity_screen_favorites',
     197                                'position'        => 30,
     198                                'item_css_id'     => 'activity-favs'
     199                        );
     200                }
    199201
    200202                // Additional menu if friends is active
    201203                if ( bp_is_active( 'friends' ) ) {
    … … class BP_Activity_Component extends BP_Component {  
    291293                        }
    292294
    293295                        // Favorites
    294                         $wp_admin_nav[] = array(
    295                                 'parent' => 'my-account-' . $this->id,
    296                                 'id'     => 'my-account-' . $this->id . '-favorites',
    297                                 'title'  => _x( 'Favorites', 'My Account Activity sub nav', 'buddypress' ),
    298                                 'href'   => trailingslashit( $activity_link . 'favorites' )
    299                         );
     296                        // Favorite activity items
     297                        if ( bp_activity_can_favorite() ) {
     298                                $wp_admin_nav[] = array(
     299                                        'parent' => 'my-account-' . $this->id,
     300                                        'id'     => 'my-account-' . $this->id . '-favorites',
     301                                        'title'  => _x( 'Favorites', 'My Account Activity sub nav', 'buddypress' ),
     302                                        'href'   => trailingslashit( $activity_link . 'favorites' )
     303                                );
     304                        }
    300305
    301306                        // Friends?
    302307                        if ( bp_is_active( 'friends' ) ) {
  • src/bp-activity/bp-activity-template.php

    diff --git src/bp-activity/bp-activity-template.php src/bp-activity/bp-activity-template.php
    index 746a779..f607b68 100644
    function bp_total_favorite_count_for_user( $user_id = 0 ) {  
    33853385         * @return int The total favorite count for the specified user.
    33863386         */
    33873387        function bp_get_total_favorite_count_for_user( $user_id = 0 ) {
     3388                $retval = false;
    33883389
    3389                 // Default to displayed user if none is passed
    3390                 $user_id = empty( $user_id )
    3391                         ? bp_displayed_user_id()
    3392                         : $user_id;
     3390                if ( bp_activity_can_favorite() ) {
     3391                        // Default to displayed user if none is passed
     3392                        $user_id = empty( $user_id )
     3393                                ? bp_displayed_user_id()
     3394                                : $user_id;
    33933395
    3394                 // Get user meta if user ID exists
    3395                 $retval = ! empty( $user_id )
    3396                         ? bp_activity_total_favorites_for_user( $user_id )
    3397                         : false;
     3396                        // Get user meta if user ID exists
     3397                        if ( ! empty( $user_id ) ) {
     3398                                $retval = bp_activity_total_favorites_for_user( $user_id );
     3399                        }
     3400                }
    33983401
    33993402                /**
    34003403                 * Filters the total favorite count for a user.