Skip to:
Content

BuddyPress.org

Changeset 1718


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

Fixes #723

Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity.php

    r1707 r1718  
    6060    $bp->activity->table_name = $wpdb->base_prefix . 'bp_activity_user_activity_cached';
    6161    $bp->activity->slug = BP_ACTIVITY_SLUG;
     62   
     63    /* Register this in the active components array */
     64    $bp->active_components[$bp->activity->slug] = $bp->activity->id;
    6265}
    6366add_action( 'plugins_loaded', 'bp_activity_setup_globals', 5 );
     
    8285
    8386    /* Add 'Activity' to the main navigation */
    84     bp_core_new_nav_item( array( 'name' => __( 'Activity', 'buddypress' ), 'slug' => $bp->activity->slug, 'position' => 10, 'screen_function' => 'bp_activity_screen_my_activity', 'default_subnav_slug' => 'just-me' ) );
     87    bp_core_new_nav_item( array( 'name' => __( 'Activity', 'buddypress' ), 'slug' => $bp->activity->slug, 'position' => 10, 'screen_function' => 'bp_activity_screen_my_activity', 'default_subnav_slug' => 'just-me', 'item_css_id' => $bp->activity->id ) );
    8588
    8689    $activity_link = $bp->loggedin_user->domain . $bp->activity->slug . '/';
  • trunk/bp-blogs.php

    r1705 r1718  
    117117    $bp->blogs->format_notification_function = 'bp_blogs_format_notifications';
    118118    $bp->blogs->slug = BP_BLOGS_SLUG;
     119
     120    /* Register this in the active components array */
     121    $bp->active_components[$bp->blogs->slug] = $bp->blogs->id;
    119122}
    120123add_action( 'plugins_loaded', 'bp_blogs_setup_globals', 5 );   
     
    140143   
    141144    /* Add 'Blogs' to the main navigation */
    142     bp_core_new_nav_item( array( 'name' => __( 'Blogs', 'buddypress' ), 'slug' => $bp->blogs->slug, 'position' => 30, 'screen_function' => 'bp_blogs_screen_my_blogs', 'default_subnav_slug' => 'my-blogs' ) );
     145    bp_core_new_nav_item( array( 'name' => __( 'Blogs', 'buddypress' ), 'slug' => $bp->blogs->slug, 'position' => 30, 'screen_function' => 'bp_blogs_screen_my_blogs', 'default_subnav_slug' => 'my-blogs', 'item_css_id' => $bp->blogs->id ) );
    143146   
    144147    $blogs_link = $bp->loggedin_user->domain . $bp->blogs->slug . '/';
  • 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 *
  • trunk/bp-core/bp-core-catchuri.php

    r1715 r1718  
    115115            unset($bp_uri[2]);
    116116        }
    117        
     117
    118118        /* Reset the keys by merging with an empty array */
    119119        $bp_uri = array_merge( array(), $bp_uri );
     120
    120121    }
    121122
  • trunk/bp-core/bp-core-settings.php

    r1687 r1718  
    11<?php
     2
     3if ( !defined( 'BP_SETTINGS_SLUG' ) )
     4    define( 'BP_SETTINGS_SLUG', 'settings' );
     5   
    26function bp_core_add_settings_nav() {
    37    global $bp;
     8   
     9    /* Set up settings as a sudo-component for identification and nav selection */
     10    $bp->settings->id = 'settings';
     11    $bp->settings->slug = BP_SETTINGS_SLUG;
     12   
     13    /* Register this in the active components array */
     14    $bp->active_components[$bp->settings->slug] = $bp->settings->id;
    415
    516    /* Add the settings navigation item */
    6     bp_core_new_nav_item( array( 'name' => __('Settings', 'buddypress'), 'slug' => 'settings', 'position' => 100, 'show_for_displayed_user' => false, 'screen_function' => 'bp_core_screen_general_settings', 'default_subnav_slug' => 'general' ) );
     17    bp_core_new_nav_item( array( 'name' => __('Settings', 'buddypress'), 'slug' => $bp->settings->slug, 'position' => 100, 'show_for_displayed_user' => false, 'screen_function' => 'bp_core_screen_general_settings', 'default_subnav_slug' => 'general' ) );
    718
    819    $settings_link = $bp->loggedin_user->domain . 'settings/';
    920   
    10     bp_core_new_subnav_item( array( 'name' => __( 'General', 'buddypress' ), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => 'settings', 'screen_function' => 'bp_core_screen_general_settings', 'position' => 10, 'user_has_access' => bp_is_home() ) );
    11     bp_core_new_subnav_item( array( 'name' => __( 'Notifications', 'buddypress' ), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => 'settings', 'screen_function' => 'bp_core_screen_notification_settings', 'position' => 20, 'user_has_access' => bp_is_home() ) );
     21    bp_core_new_subnav_item( array( 'name' => __( 'General', 'buddypress' ), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $bp->settings->slug, 'screen_function' => 'bp_core_screen_general_settings', 'position' => 10, 'user_has_access' => bp_is_home() ) );
     22    bp_core_new_subnav_item( array( 'name' => __( 'Notifications', 'buddypress' ), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $bp->settings->slug, 'screen_function' => 'bp_core_screen_notification_settings', 'position' => 20, 'user_has_access' => bp_is_home() ) );
    1223   
    1324    if ( !is_site_admin() )
    14         bp_core_new_subnav_item( array( 'name' => __( 'Delete Account', 'buddypress' ), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => 'settings', 'screen_function' => 'bp_core_screen_delete_account', 'position' => 90, 'user_has_access' => bp_is_home() ) );
     25        bp_core_new_subnav_item( array( 'name' => __( 'Delete Account', 'buddypress' ), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $bp->settings->slug, 'screen_function' => 'bp_core_screen_delete_account', 'position' => 90, 'user_has_access' => bp_is_home() ) );
    1526}
    1627add_action( 'wp', 'bp_core_add_settings_nav', 2 );
     
    2132function bp_core_screen_general_settings() {
    2233    global $current_user, $bp_settings_updated, $pass_error;
     34   
     35    $bp_settings_updated = false;
     36    $pass_error = false;
     37   
     38    if ( isset($_POST['submit']) && check_admin_referer('bp_settings_general') ) {
     39        require_once( WPINC . '/registration.php' );
     40       
     41        // Form has been submitted and nonce checks out, lets do it.
     42       
     43        if ( $_POST['email'] != '' )
     44            $current_user->user_email = wp_specialchars( trim( $_POST['email'] ) );
     45
     46        if ( $_POST['pass1'] != '' && $_POST['pass2'] != '' ) {
     47            if ( $_POST['pass1'] == $_POST['pass2'] && !strpos( " " . $_POST['pass1'], "\\" ) )
     48                $current_user->user_pass = $_POST['pass1'];
     49            else
     50                $pass_error = true;
     51        } else if ( empty( $_POST['pass1'] ) && !empty( $_POST['pass2'] ) || !empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) {
     52            $pass_error = true;
     53        } else {
     54            unset( $current_user->user_pass );
     55        }
     56       
     57        if ( !$pass_error && wp_update_user( get_object_vars( $current_user ) ) )
     58            $bp_settings_updated = true;
     59    }
     60   
     61    add_action( 'bp_template_title', 'bp_core_screen_general_settings_title' );
     62    add_action( 'bp_template_content', 'bp_core_screen_general_settings_content' );
     63   
     64    bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'plugin-template' ) );
     65}
     66
     67function bp_core_screen_general_settings_title() {
     68    _e( 'General Settings', 'buddypress' );
     69}
     70
     71function bp_core_screen_general_settings_content() {
     72    global $bp, $current_user, $bp_settings_updated, $pass_error; ?>
     73
     74    <?php if ( $bp_settings_updated && !$pass_error ) { ?>
     75        <div id="message" class="updated fade">
     76            <p><?php _e( 'Changes Saved.', 'buddypress' ) ?></p>
     77        </div>
     78    <?php } ?>
     79   
     80    <?php if ( $pass_error && !$bp_settings_updated ) { ?>
     81        <div id="message" class="error fade">
     82            <p><?php _e( 'Your passwords did not match', 'buddypress' ) ?></p>
     83        </div> 
     84    <?php } ?>
     85
     86    <form action="<?php echo $bp->loggedin_user->domain . 'settings/general' ?>" method="post" class="standard-form" id="settings-form">
     87        <label for="email"><?php _e( 'Account Email', 'buddypress' ) ?></label>
     88        <input type="text" name="email" id="email" value="<?php echo attribute_escape( $current_user->user_email ); ?>" class="settings-input" />
     89           
     90        <label for="pass1"><?php _e( 'Change Password <span>(leave blank for no change)</span>', 'buddypress' ) ?></label>
     91        <input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small" /> &nbsp;<?php _e( 'New Password', 'buddypress' ) ?>
     92        <input type="password" name="pass2" id="pass2" size="16" value="" class="settings-input small" /> &nbsp;<?php _e( 'Repeat New Password', 'buddypress' ) ?>
     93   
     94        <p class="submit"><input type="submit" name="submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?>" id="submit" class="auto"/></p>
     95        <?php wp_nonce_field('bp_settings_general') ?>
     96    </form>
     97<?php
     98}
     99
     100/***** NOTIFICATION SETTINGS ******/
     101
     102function bp_core_screen_notification_settings() {
     103    global $current_user, $bp_settings_updated;
     104   
     105    $bp_settings_updated = false;
     106   
     107    if ( $_POST['submit'] && check_admin_referer('bp_settings_notifications') ) {
     108        if ( $_POST['notifications'] ) {
     109            foreach ( $_POST['notifications'] as $key => $value ) {
     110                update_usermeta( (int)$current_user->id, $key, $value );
     111            }
     112        }
     113       
     114        $bp_settings_updated = true;
     115    }
     116       
     117    add_action( 'bp_template_title', 'bp_core_screen_notification_settings_title' );
     118    add_action( 'bp_template_content', 'bp_core_screen_notification_settings_content' );
     119   
     120    bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'plugin-template' ) );
     121}
     122
     123function bp_core_screen_notification_settings_title() {
     124    _e( 'Notification Settings', 'buddypress' );
     125}
     126
     127function bp_core_screen_notification_settings_content() {
     128    global $bp, $current_user, $bp_settings_updated; ?>
     129
     130    <?php if ( $bp_settings_updated ) { ?>
     131        <div id="message" class="updated fade">
     132            <p><?php _e( 'Changes Saved.', 'buddypress' ) ?></p>
     133        </div>
     134    <?php } ?>
     135   
     136    <form action="<?php echo $bp->loggedin_user->domain . 'settings/notifications' ?>" method="post" id="settings-form">
     137        <h3><?php _e( 'Email Notifications', 'buddypress' ) ?></h3>
     138        <p><?php _e( 'Send a notification by email when:', 'buddypress' ) ?></p>
     139       
     140        <?php do_action( 'bp_notification_settings' ) ?>
     141       
     142        <p class="submit"><input type="submit" name="submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?>" id="submit" class="auto"/></p>     
     143       
     144        <?php wp_nonce_field('bp_settings_notifications') ?>
     145       
     146    </form>
     147<?php
     148}
     149
     150/**** DELETE ACCOUNT ****/
     151
     152function bp_core_screen_delete_account() {
     153    global $current_user, $bp_settings_updated, $pass_error;
     154   
     155    if ( isset( $_POST['delete-account-button'] ) && check_admin_referer('delete-account') ) {
     156        if ( !check_admin_referer( 'delete-account' ) )
     157            return false;
     158       
     159        // delete the users account
     160        if ( bp_core_delete_account() )
     161            bp_core_redirect( site_url() );
     162    }
    23163   
    24164    $bp_settings_updated = false;
     
    50190    }
    51191   
    52     add_action( 'bp_template_title', 'bp_core_screen_general_settings_title' );
    53     add_action( 'bp_template_content', 'bp_core_screen_general_settings_content' );
    54    
    55     bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'plugin-template' ) );
    56 }
    57 
    58 function bp_core_screen_general_settings_title() {
    59     _e( 'General Settings', 'buddypress' );
    60 }
    61 
    62 function bp_core_screen_general_settings_content() {
    63     global $bp, $current_user, $bp_settings_updated, $pass_error; ?>
    64 
    65     <?php if ( $bp_settings_updated && !$pass_error ) { ?>
    66         <div id="message" class="updated fade">
    67             <p><?php _e( 'Changes Saved.', 'buddypress' ) ?></p>
    68         </div>
    69     <?php } ?>
    70    
    71     <?php if ( $pass_error && !$bp_settings_updated ) { ?>
    72         <div id="message" class="error fade">
    73             <p><?php _e( 'Your passwords did not match', 'buddypress' ) ?></p>
    74         </div> 
    75     <?php } ?>
    76 
    77     <form action="<?php echo $bp->loggedin_user->domain . 'settings/general' ?>" method="post" class="standard-form" id="settings-form">
    78         <label for="email"><?php _e( 'Account Email', 'buddypress' ) ?></label>
    79         <input type="text" name="email" id="email" value="<?php echo attribute_escape( $current_user->user_email ); ?>" class="settings-input" />
    80            
    81         <label for="pass1"><?php _e( 'Change Password <span>(leave blank for no change)</span>', 'buddypress' ) ?></label>
    82         <input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small" /> &nbsp;<?php _e( 'New Password', 'buddypress' ) ?>
    83         <input type="password" name="pass2" id="pass2" size="16" value="" class="settings-input small" /> &nbsp;<?php _e( 'Repeat New Password', 'buddypress' ) ?>
    84    
    85         <p class="submit"><input type="submit" name="submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?>" id="submit" class="auto"/></p>
    86         <?php wp_nonce_field('bp_settings_general') ?>
    87     </form>
    88 <?php
    89 }
    90 
    91 /***** NOTIFICATION SETTINGS ******/
    92 
    93 function bp_core_screen_notification_settings() {
    94     global $current_user, $bp_settings_updated;
    95    
    96     $bp_settings_updated = false;
    97    
    98     if ( $_POST['submit'] && check_admin_referer('bp_settings_notifications') ) {
    99         if ( $_POST['notifications'] ) {
    100             foreach ( $_POST['notifications'] as $key => $value ) {
    101                 update_usermeta( (int)$current_user->id, $key, $value );
    102             }
    103         }
    104        
    105         $bp_settings_updated = true;
    106     }
    107        
    108     add_action( 'bp_template_title', 'bp_core_screen_notification_settings_title' );
    109     add_action( 'bp_template_content', 'bp_core_screen_notification_settings_content' );
    110    
    111     bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'plugin-template' ) );
    112 }
    113 
    114 function bp_core_screen_notification_settings_title() {
    115     _e( 'Notification Settings', 'buddypress' );
    116 }
    117 
    118 function bp_core_screen_notification_settings_content() {
    119     global $bp, $current_user, $bp_settings_updated; ?>
    120 
    121     <?php if ( $bp_settings_updated ) { ?>
    122         <div id="message" class="updated fade">
    123             <p><?php _e( 'Changes Saved.', 'buddypress' ) ?></p>
    124         </div>
    125     <?php } ?>
    126    
    127     <form action="<?php echo $bp->loggedin_user->domain . 'settings/notifications' ?>" method="post" id="settings-form">
    128         <h3><?php _e( 'Email Notifications', 'buddypress' ) ?></h3>
    129         <p><?php _e( 'Send a notification by email when:', 'buddypress' ) ?></p>
    130        
    131         <?php do_action( 'bp_notification_settings' ) ?>
    132        
    133         <p class="submit"><input type="submit" name="submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?>" id="submit" class="auto"/></p>     
    134        
    135         <?php wp_nonce_field('bp_settings_notifications') ?>
    136        
    137     </form>
    138 <?php
    139 }
    140 
    141 /**** DELETE ACCOUNT ****/
    142 
    143 function bp_core_screen_delete_account() {
    144     global $current_user, $bp_settings_updated, $pass_error;
    145    
    146     if ( isset( $_POST['delete-account-button'] ) && check_admin_referer('delete-account') ) {
    147         if ( !check_admin_referer( 'delete-account' ) )
    148             return false;
    149        
    150         // delete the users account
    151         if ( bp_core_delete_account() )
    152             bp_core_redirect( site_url() );
    153     }
    154    
    155     $bp_settings_updated = false;
    156     $pass_error = false;
    157    
    158     if ( isset($_POST['submit']) && check_admin_referer('bp_settings_general') ) {
    159         require_once( WPINC . '/registration.php' );
    160        
    161         // Form has been submitted and nonce checks out, lets do it.
    162        
    163         if ( $_POST['email'] != '' ) {
    164             $current_user->user_email = wp_specialchars( trim( $_POST['email'] ));
    165         }
    166 
    167         if ( $_POST['pass1'] != '' && $_POST['pass2'] != '' ) {
    168             if ( $_POST['pass1'] == $_POST['pass2'] && !strpos( " " . $_POST['pass1'], "\\" ) ) {
    169                 $current_user->user_pass = $_POST['pass1'];
    170             } else {
    171                 $pass_error = true;
    172             }
    173         } else if ( empty( $_POST['pass1'] ) && !empty( $_POST['pass2'] ) || !empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) {
    174             $pass_error = true;
    175         } else {
    176             unset( $current_user->user_pass );
    177         }
    178        
    179         if ( !$pass_error && wp_update_user( get_object_vars( $current_user ) ) )
    180             $bp_settings_updated = true;
    181     }
    182    
    183192    add_action( 'bp_template_title', 'bp_core_screen_delete_account_title' );
    184193    add_action( 'bp_template_content', 'bp_core_screen_delete_account_content' );
  • trunk/bp-core/bp-core-templatetags.php

    r1714 r1718  
    2222    foreach( (array) $bp->bp_nav as $nav_item ) {
    2323        /* If the current component matches the nav item id, then add a highlight CSS class. */
    24         if ( $bp->current_component == $nav_item['css_id'] ) {
     24        if ( $bp->active_components[$bp->current_component] == $nav_item['css_id'] ) {
    2525            $selected = ' class="current"';
    2626        } else {
     
    3535           
    3636            if ( function_exists('friends_install') ) {
    37                 if ( $nav_item['css_id'] == $bp->friends->slug ) {
     37                if ( $nav_item['css_id'] == $bp->friends->id ) {
    3838                    if ( friends_check_friendship( $bp->loggedin_user->id, $bp->displayed_user->id ) )
    3939                        $selected = ' class="current"';
  • trunk/bp-core/deprecated/bp-core-deprecated.php

    r1655 r1718  
    940940}
    941941
     942/* DEPRECATED - use the param 'default_subnav_slug' in bp_core_new_nav_item() */
     943function bp_core_add_nav_default( $parent_id, $function, $slug = false, $user_has_access = true, $admin_only = false ) {
     944    global $bp;
     945   
     946    if ( !$user_has_access && !bp_is_home() )
     947        return false;
     948       
     949    if ( $admin_only && !is_site_admin() )
     950        return false;
     951
     952    if ( $bp->current_component == $parent_id && !$bp->current_action ) {
     953        if ( function_exists($function) ) {
     954            add_action( 'wp', $function, 3 );
     955        }
     956       
     957        if ( $slug )
     958            $bp->current_action = $slug;
     959    }
     960}
     961
  • trunk/bp-forums.php

    r1705 r1718  
    33/* Define the parent forum ID */
    44if ( !defined( 'BP_FORUMS_PARENT_FORUM_ID' ) )
    5     define ( 'BP_FORUMS_PARENT_FORUM_ID', 1 );
     5    define( 'BP_FORUMS_PARENT_FORUM_ID', 1 );
     6   
     7if ( !defined( 'BP_FORUMS_SLUG' ) )
     8    define( 'BP_FORUMS_SLUG', 'forums' );
    69
    710require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-bbpress.php' );
     
    1821    $bp->forums->image_base = BP_PLUGIN_URL . '/bp-forums/images';
    1922    $bp->forums->bbconfig = get_site_option( 'bb-config-location' );
     23    $bp->forums->slug = BP_FORUMS_SLUG;
     24
     25    /* Register this in the active components array */
     26    $bp->active_components[$bp->forums->slug] = $bp->forums->id;
    2027}
    2128add_action( 'plugins_loaded', 'bp_forums_setup', 5 );
  • trunk/bp-friends.php

    r1705 r1718  
    4848    $bp->friends->slug = BP_FRIENDS_SLUG;
    4949
     50    /* Register this in the active components array */
     51    $bp->active_components[$bp->friends->slug] = $bp->friends->id;
    5052}
    5153add_action( 'plugins_loaded', 'friends_setup_globals', 5 );
     
    6870   
    6971    /* Add 'Friends' to the main navigation */
    70     bp_core_new_nav_item( array( 'name' => __('Friends', 'buddypress'), 'slug' => $bp->friends->slug, 'position' => 60, 'screen_function' => 'friends_screen_my_friends', 'default_subnav_slug' => 'my-friends' ) );
     72    bp_core_new_nav_item( array( 'name' => __('Friends', 'buddypress'), 'slug' => $bp->friends->slug, 'position' => 60, 'screen_function' => 'friends_screen_my_friends', 'default_subnav_slug' => 'my-friends', 'item_css_id' => $bp->friends->id ) );
    7173   
    7274    $friends_link = $bp->loggedin_user->domain . $bp->friends->slug . '/';
  • trunk/bp-groups.php

    r1714 r1718  
    131131    $bp->groups->format_notification_function = 'groups_format_notifications';
    132132    $bp->groups->slug = BP_GROUPS_SLUG;
    133    
     133
     134    /* Register this in the active components array */
     135    $bp->active_components[$bp->groups->slug] = $bp->groups->id;
     136       
    134137    if ( function_exists('bp_wire_install') )
    135138        $bp->groups->table_name_wire = $wpdb->base_prefix . 'bp_groups_wire';
     
    209212
    210213    /* Add 'Groups' to the main navigation */
    211     bp_core_new_nav_item( array( 'name' => __('Groups', 'buddypress'), 'slug' => $bp->groups->slug, 'position' => 70, 'screen_function' => 'groups_screen_my_groups', 'default_subnav_slug' => 'my-groups' ) );
     214    bp_core_new_nav_item( array( 'name' => __('Groups', 'buddypress'), 'slug' => $bp->groups->slug, 'position' => 70, 'screen_function' => 'groups_screen_my_groups', 'default_subnav_slug' => 'my-groups', 'item_css_id' => $bp->groups->id ) );
    212215   
    213216    $groups_link = $bp->loggedin_user->domain . $bp->groups->slug . '/';
     
    277280
    278281            if ( $bp->groups->current_group->enable_wire && function_exists('bp_wire_install') )
    279                 bp_core_new_subnav_item( array( 'name' => __( 'Wire', 'buddypress' ), 'slug' => 'wire', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_wire', 'position' => 50, 'user_has_access' => $bp->groups->current_group->user_has_access, 'item_css_id' => 'group-wire'  ) );
     282                bp_core_new_subnav_item( array( 'name' => __( 'Wire', 'buddypress' ), 'slug' => BP_WIRE_SLUG, 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_wire', 'position' => 50, 'user_has_access' => $bp->groups->current_group->user_has_access, 'item_css_id' => 'group-wire'  ) );
    280283
    281284            bp_core_new_subnav_item( array( 'name' => __( 'Members', 'buddypress' ), 'slug' => 'members', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_members', 'position' => 60, 'user_has_access' => $bp->groups->current_group->user_has_access, 'item_css_id' => 'group-members'  ) );
  • trunk/bp-groups/bp-groups-classes.php

    r1706 r1718  
    1212    var $enable_forum;
    1313    var $date_created;
    14    
    15     var $avatar_thumb;
    16     var $avatar_full;
    17    
     14
    1815    var $user_dataset;
    1916   
     
    5249            $this->date_created = strtotime($group->date_created);
    5350            $this->total_member_count = groups_get_groupmeta( $this->id, 'total_member_count' );
    54 
    55             $gravatar_url = apply_filters( 'bp_gravatar_url', 'http://www.gravatar.com/avatar/' );
    56            
    57             if ( !$group->avatar_thumb || strpos( $group->avatar_thumb, 'none-thumbnail' ) )
    58                 $this->avatar_thumb =  $gravatar_url . md5( $this->id . '@' . $bp->root_domain ) . '?d=identicon&amp;s=50';
    59             else
    60                 $this->avatar_thumb = $group->avatar_thumb;
    61            
    62             if ( !$group->avatar_full || strpos( $group->avatar_thumb, 'none-' ) )
    63                 $this->avatar_full = $gravatar_url . md5( $this->id . '@' . $bp->root_domain ) . '?d=identicon&amp;s=150';
    64             else
    65                 $this->avatar_full = $group->avatar_full;
    6651           
    6752            if ( $get_user_dataset ) {
     
    9580        $this->enable_forum = apply_filters( 'groups_group_enable_forum_before_save', $this->enable_forum, $this->id );
    9681        $this->date_created = apply_filters( 'groups_group_date_created_before_save', $this->date_created, $this->id );
    97         $this->avatar_thumb = apply_filters( 'groups_group_avatar_thumb_before_save', $this->avatar_thumb, $this->id );
    98         $this->avatar_full = apply_filters( 'groups_group_avatar_full_before_save', $this->avatar_full, $this->id );
    9982
    10083        do_action( 'groups_group_before_save', $this );
     
    11194                    enable_wire = %d,
    11295                    enable_forum = %d,
    113                     date_created = FROM_UNIXTIME(%d),
    114                     avatar_thumb = %s,
    115                     avatar_full = %s
     96                    date_created = FROM_UNIXTIME(%d)
    11697                WHERE
    11798                    id = %d
     
    125106                    $this->enable_wire,
    126107                    $this->enable_forum,
    127                     $this->date_created,
    128                     $this->avatar_thumb,
    129                     $this->avatar_full,
     108                    $this->date_created,
    130109                    $this->id
    131110            );
     
    141120                    enable_wire,
    142121                    enable_forum,
    143                     date_created,
    144                     avatar_thumb,
    145                     avatar_full
     122                    date_created
    146123                ) VALUES (
    147                     %d, %s, %s, %s, %s, %s, %d, %d, FROM_UNIXTIME(%d), %s, %s
     124                    %d, %s, %s, %s, %s, %s, %d, %d, FROM_UNIXTIME(%d)
    148125                )",
    149126                    $this->creator_id,
     
    155132                    $this->enable_wire,
    156133                    $this->enable_forum,
    157                     $this->date_created,
    158                     $this->avatar_thumb,
    159                     $this->avatar_full
     134                    $this->date_created
    160135            );
    161136        }
  • trunk/bp-messages.php

    r1705 r1718  
    8585    $bp->messages->format_notification_function = 'messages_format_notifications';
    8686    $bp->messages->slug = BP_MESSAGES_SLUG;
     87
     88    /* Register this in the active components array */
     89    $bp->active_components[$bp->messages->slug] = $bp->messages->id;
    8790}
    8891add_action( 'plugins_loaded', 'messages_setup_globals', 5 );   
     
    111114
    112115    /* Add 'Messages' to the main navigation */
    113     bp_core_new_nav_item( array( 'name' => __('Messages', 'buddypress'), 'slug' => $bp->messages->slug, 'position' => 50, 'show_for_displayed_user' => false, 'screen_function' => 'messages_screen_inbox', 'default_subnav_slug' => 'inbox'  ) );
     116    bp_core_new_nav_item( array( 'name' => __('Messages', 'buddypress'), 'slug' => $bp->messages->slug, 'position' => 50, 'show_for_displayed_user' => false, 'screen_function' => 'messages_screen_inbox', 'default_subnav_slug' => 'inbox', 'item_css_id' => $bp->messages->id ) );
    114117   
    115118    $messages_link = $bp->loggedin_user->domain . $bp->messages->slug . '/';
  • trunk/bp-status.php

    r1687 r1718  
    55require ( BP_PLUGIN_DIR . '/bp-status/bp-status-templatetags.php' );
    66require ( BP_PLUGIN_DIR . '/bp-status/bp-status-filters.php' );
     7
     8function bp_status_setup_globals() {
     9    global $bp, $wpdb;
     10
     11    /* For internal identification */
     12    $bp->status->id = 'status';
     13    $bp->status->slug = BP_STATUS_SLUG;
     14
     15    /* Register this in the active components array */
     16    $bp->active_components[$bp->status->slug] = $bp->status->id;
     17}
     18add_action( 'plugins_loaded', 'bp_status_setup_globals', 5 );   
     19add_action( 'admin_menu', 'bp_status_setup_globals', 1 );
    720
    821function bp_status_record_activity( $user_id, $content, $primary_link ) {
  • trunk/bp-wire.php

    r1705 r1718  
    2424   
    2525    $bp->wire->slug = BP_WIRE_SLUG;
     26   
     27    /* Register this in the active components array */
     28    $bp->active_components[$bp->wire->slug] = $bp->wire->id;
    2629}
    2730add_action( 'plugins_loaded', 'bp_wire_setup_globals', 5 );
     
    3235
    3336    /* Add 'Wire' to the main navigation */
    34     bp_core_new_nav_item( array( 'name' => __('Wire', 'buddypress'), 'slug' => $bp->wire->slug, 'position' => 40, 'screen_function' => 'bp_wire_screen_latest', 'default_subnav_slug' => 'all-posts', '' ) );
     37    bp_core_new_nav_item( array( 'name' => __('Wire', 'buddypress'), 'slug' => $bp->wire->slug, 'position' => 40, 'screen_function' => 'bp_wire_screen_latest', 'default_subnav_slug' => 'all-posts', 'item_css_id' => $bp->wire->id ) );
    3538
    3639    $wire_link = $bp->loggedin_user->domain . $bp->wire->slug . '/';
  • trunk/bp-wire/bp-wire-templatetags.php

    r1691 r1718  
    2929           
    3030        } else {
    31             $this->table_name = $bp->{$component_slug}->table_name_wire;
     31            $this->table_name = $bp->{$bp->active_components[$component_slug]}->table_name_wire;
    3232        }
    3333       
     
    8383            return true;
    8484        } elseif ( $this->current_wire_post + 1 == $this->wire_post_count ) {
    85             do_action('loop_end');
     85            do_action('bp_wire_loop_end');
    8686            // Do some cleaning up after the loop
    8787            $this->rewind_wire_posts();
     
    9999
    100100        if ( 0 == $this->current_wire_post ) // loop has just started
    101             do_action('loop_start');
     101            do_action('bp_wire_loop_start');
    102102    }
    103103}
     
    316316            return apply_filters( 'bp_get_wire_get_action', $bp->displayed_user->domain . $bp->wire->slug . '/post/' );
    317317        } else {
    318             return apply_filters( 'bp_get_wire_get_action', site_url() . '/' . $bp->{$bp->current_component}->slug . '/' . $uri . '/' . $bp->wire->slug . '/post/' );
     318            return apply_filters( 'bp_get_wire_get_action', site_url() . '/' . $bp->{$bp->active_components[$bp->current_component]}->slug . '/' . $uri . '/' . $bp->wire->slug . '/post/' );
    319319        }
    320320    }
  • trunk/bp-xprofile.php

    r1715 r1718  
    141141    $bp->profile->format_notification_function = 'xprofile_format_notifications';
    142142    $bp->profile->slug = BP_XPROFILE_SLUG;
    143    
     143
     144    /* Register this in the active components array */
     145    $bp->active_components[$bp->profile->slug] = $bp->profile->id;
     146       
    144147    $bp->profile->field_types = apply_filters( 'xprofile_field_types', array( 'textbox', 'textarea', 'radio', 'checkbox', 'selectbox', 'multiselectbox', 'datebox' ) );
    145148
     
    200203   
    201204    /* Add 'Profile' to the main navigation */
    202     bp_core_new_nav_item( array( 'name' => __('Profile', 'buddypress'), 'slug' => $bp->profile->slug, 'position' => 20, 'screen_function' => 'xprofile_screen_display_profile', 'default_subnav_slug' => 'public' ) );
     205    bp_core_new_nav_item( array( 'name' => __('Profile', 'buddypress'), 'slug' => $bp->profile->slug, 'position' => 20, 'screen_function' => 'xprofile_screen_display_profile', 'default_subnav_slug' => 'public', 'item_css_id' => $bp->profile->id ) );
    203206
    204207    $profile_link = $bp->loggedin_user->domain . $bp->profile->slug . '/';
Note: See TracChangeset for help on using the changeset viewer.