Skip to:
Content

BuddyPress.org

Ticket #3381: xprofile_subnav.patch

File xprofile_subnav.patch, 2.3 KB (added by slaFFik, 15 years ago)
  • bp-core/bp-core-buddybar.php

     
    8686        do_action( 'bp_core_new_nav_item', $r, $args, $defaults );
    8787}
    8888
     89function bp_is_component_subnav_exists($component = false){
     90        global $bp;
     91       
     92        if (!$component)
     93                $component = $bp->current_component;
     94       
     95        if (count($bp->bp_options_nav[$component]) > 0)
     96                return true;
     97
     98        return false;
     99}
     100
     101
    89102/**
    90103 * Modify the default subnav item to load when a top level nav item is clicked.
    91104 *
  • bp-themes/bp-default/members/single/profile.php

     
    88 */
    99
    1010?>
     11<?php if (bp_is_component_subnav_exists()) : ?>
    1112
    12 <?php if ( bp_is_my_profile() ) : ?>
    13 
    1413        <div class="item-list-tabs no-ajax" id="subnav" role="navigation">
    1514                <ul>
    1615
     
    2019        </div><!-- .item-list-tabs -->
    2120
    2221<?php endif; ?>
    23 
     22       
    2423<?php do_action( 'bp_before_profile_content' ); ?>
    2524
    2625<div class="profile" role="main">
  • bp-xprofile/bp-xprofile-loader.php

     
    118118                        'item_css_id'         => $this->id
    119119                );
    120120
    121                 $profile_link = trailingslashit( $bp->loggedin_user->domain . $this->slug );
     121                $profile_link = trailingslashit( $bp->displayed_user->domain . $this->slug );
    122122
    123123                // Add the subnav items to the profile
    124124                $sub_nav[] = array(
     
    137137                        'parent_url'      => $profile_link,
    138138                        'parent_slug'     => $this->slug,
    139139                        'screen_function' => 'xprofile_screen_edit_profile',
    140                         'position'        => 20
    141                 );
     140                        'position'        => 20,
     141                        'user_has_access' => bp_is_my_profile()         );
    142142
    143143                // Change Avatar
    144144                $sub_nav[] = array(
     
    147147                        'parent_url'      => $profile_link,
    148148                        'parent_slug'     => $this->slug,
    149149                        'screen_function' => 'xprofile_screen_change_avatar',
    150                         'position'        => 30
    151                 );
     150                        'position'        => 30,
     151                        'user_has_access' => bp_is_my_profile()         );
    152152
    153153                parent::setup_nav( $main_nav, $sub_nav );
    154154        }