Skip to:
Content

BuddyPress.org

Changeset 1718 for trunk/bp-core.php


Ignore:
Timestamp:
08/27/2009 09:18:10 PM (17 years ago)
Author:
apeatling
Message:

Fixes #723

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core.php

    r1717 r1718  
    136136    /* Sets up container used for the avatar of the current component being viewed. Rendered by bp_get_options_avatar() */
    137137    $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();
    138141   
    139142    /* Fetches the default Gravatar image to use if the user/group/blog has no avatar or gravatar */
     
    553556        'parent_url' => false, // URL of the parent item
    554557        '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?
    556559        'site_admin_only' => false, // Can only site admins see this nav item?
    557         'position' => 90, // Index of where should this nav item be positioned
     560        'position' => 90, // Index of where this nav item should be positioned
    558561        'screen_function' => false // The name of the function to run when clicked
    559562    );
     
    579582        'css_id' => $item_css_id,
    580583        'position' => $position
    581     );   
     584    );
    582585       
    583586    if ( $bp->current_action == $slug && $bp->current_component == $parent_slug && $user_has_access ) {
     
    649652
    650653/**
    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 Core
    656  * @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 not
    660  * @uses bp_is_home() Returns true if the current user being viewed is equal the logged in user
    661  * @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 /**
    683654 * bp_core_load_template()
    684655 *
Note: See TracChangeset for help on using the changeset viewer.