Skip to:
Content

BuddyPress.org

Changeset 1759 for trunk/bp-core.php


Ignore:
Timestamp:
09/02/2009 05:32:54 PM (16 years ago)
Author:
apeatling
Message:

Fixed subnav access issues.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core.php

    r1755 r1759  
    277277       
    278278    /* Add the administration tab under the "Site Admin" tab for site administrators */
    279     bp_core_add_admin_menu_page( array( 'menu_title' => __( 'BuddyPress', 'buddypress' ), 'page_title' => __( 'BuddyPress', 'buddypress' ), 'access_level' => 10, 'file' => 'bp-core.php', 'function' => 'bp_core_admin_settings', 'position' => 2 ) );
     279    bp_core_add_admin_menu_page( array(
     280        'menu_title' => __( 'BuddyPress', 'buddypress' ),
     281        'page_title' => __( 'BuddyPress', 'buddypress' ),
     282        'access_level' => 10, 'file' => 'bp-core.php',
     283        'function' => 'bp_core_admin_settings',
     284        'position' => 2
     285    ) );
     286   
    280287    add_submenu_page( 'bp-core.php', __( 'General Settings', 'buddypress'), __( 'General Settings', 'buddypress' ), 1, 'bp-core.php', 'bp_core_admin_settings' );
    281288    add_submenu_page( 'bp-core.php', __( 'Component Setup', 'buddypress'), __( 'Component Setup', 'buddypress' ), 2, __FILE__, 'bp_core_admin_component_setup' );
     
    322329
    323330        /* Add the subnav items to the profile */
    324         bp_core_new_subnav_item( array( 'name' => __( 'Public', 'buddypress' ), 'slug' => 'public', 'parent_url' => $profile_link, 'parent_slug' => 'profile', 'screen_function' => 'xprofile_screen_display_profile', 'position' => 10 ) );
     331        bp_core_new_subnav_item( array(
     332            'name' => __( 'Public', 'buddypress' ),
     333            'slug' => 'public',
     334            'parent_url' => $profile_link,
     335            'parent_slug' => 'profile',
     336            'screen_function' => 'xprofile_screen_display_profile',
     337            'position' => 10
     338        ) );
    325339
    326340        if ( 'profile' == $bp->current_component ) {
     
    572586        return false;
    573587   
    574     /* If the logged in user does not have access */
    575     if ( !$user_has_access )
    576         return false;
    577    
    578588    /* If this is for site admins only and the user is not one, don't create the subnav item */
    579589    if ( $site_admin_only && !is_site_admin() )
     
    588598        'slug' => $slug,
    589599        'css_id' => $item_css_id,
    590         'position' => $position
     600        'position' => $position,
     601        'user_has_access' => $user_has_access
    591602    );
    592603       
    593     if ( $bp->current_action == $slug && $bp->current_component == $parent_slug ) {
     604    if ( ( $bp->current_action == $slug && $bp->current_component == $parent_slug ) && $user_has_access ) {
    594605        if ( !is_object($screen_function[0]) )
    595606            add_action( 'wp', $screen_function, 3 );
Note: See TracChangeset for help on using the changeset viewer.