Changeset 1718 for trunk/bp-core.php
- Timestamp:
- 08/27/2009 09:18:10 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/bp-core.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core.php
r1717 r1718 136 136 /* Sets up container used for the avatar of the current component being viewed. Rendered by bp_get_options_avatar() */ 137 137 $bp->bp_options_avatar = ''; 138 139 /* Contains an array of all the active components. The key is the slug, value the internal ID of the component */ 140 $bp->active_components = array(); 138 141 139 142 /* Fetches the default Gravatar image to use if the user/group/blog has no avatar or gravatar */ … … 553 556 'parent_url' => false, // URL of the parent item 554 557 'item_css_id' => false, // The CSS ID to apply to the HTML of the nav item 555 'user_has_access' => true, // Can the user see this nav item?558 'user_has_access' => true, // Can the logged in user see this nav item? 556 559 'site_admin_only' => false, // Can only site admins see this nav item? 557 'position' => 90, // Index of where should this nav itembe positioned560 'position' => 90, // Index of where this nav item should be positioned 558 561 'screen_function' => false // The name of the function to run when clicked 559 562 ); … … 579 582 'css_id' => $item_css_id, 580 583 'position' => $position 581 ); 584 ); 582 585 583 586 if ( $bp->current_action == $slug && $bp->current_component == $parent_slug && $user_has_access ) { … … 649 652 650 653 /** 651 * bp_core_add_nav_default()652 *653 * Set a default action for a nav item, when a sub nav item has not yet been selected.654 *655 * @package BuddyPress Core656 * @param $parent_id The id of the parent navigation item.657 * @param $function The function to run when this sub nav item is selected.658 * @param $slug The slug of the sub nav item to highlight.659 * @uses is_site_admin() returns true if the current user is a site admin, false if not660 * @uses bp_is_home() Returns true if the current user being viewed is equal the logged in user661 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()662 */663 function bp_core_add_nav_default( $parent_id, $function, $slug = false, $user_has_access = true, $admin_only = false ) {664 global $bp;665 666 if ( !$user_has_access && !bp_is_home() )667 return false;668 669 if ( $admin_only && !is_site_admin() )670 return false;671 672 if ( $bp->current_component == $parent_id && !$bp->current_action ) {673 if ( function_exists($function) ) {674 add_action( 'wp', $function, 3 );675 }676 677 if ( $slug )678 $bp->current_action = $slug;679 }680 }681 682 /**683 654 * bp_core_load_template() 684 655 *
Note: See TracChangeset
for help on using the changeset viewer.