Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/25/2011 08:58:56 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Rename new 'bp-users' component to 'bp-members' for consistency through-out project.
Core, Messages, and Friends Components now use the BP_Component class.
Split Friends and Messages components into smaller files.
Change references to 'profile' to 'xprofile' through-out project for consistency.
Introduce 'bp_actions' and 'bp_screens' standard hooks to replace the usage of 'wp' through-out project.
Move component loader sequence into bp-core-bootstrap.php,
Move old root_component action into 1.3 deprecated file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-settings/bp-settings-loader.php

    r3778 r3917  
    99     */
    1010    function BP_Settings_Component() {
    11         parent::start( 'settings', __( 'Settings', 'buddypress' ) );
     11        parent::start(
     12            'settings',
     13            __( 'Settings', 'buddypress' ),
     14            BP_PLUGIN_DIR
     15        );
     16    }
     17
     18    /**
     19     * Include files
     20     *
     21     * @global obj $bp
     22     */
     23    function _includes() {
     24        // Files to include
     25        $includes = array(
     26            'actions',
     27            'screens',
     28            'template',
     29            'functions',
     30        );
     31
     32        parent::_includes( $includes );
    1233    }
    1334
     
    2849            define( 'BP_SETTINGS_SLUG', $this->id );
    2950
    30         // Do some slug checks
    31         $this->slug      = BP_SETTINGS_SLUG;
    32         $this->root_slug = isset( $bp->pages->settings->slug ) ? $bp->pages->settings->slug : $this->slug;
    33        
    34         // Register this in the active components array
    35         $bp->active_components[$this->id] = $this->id;
    36     }
     51        // All globals for messaging component.
     52        // Note that global_tables is included in this array.
     53        $globals = array(
     54            'slug'      => BP_SETTINGS_SLUG,
     55            'root_slug' => isset( $bp->pages->settings->slug ) ? $bp->pages->settings->slug : BP_SETTINGS_SLUG,
     56        );
    3757
    38     /**
    39      * Include files
    40      *
    41      * @global obj $bp
    42      */
    43     function _includes() {
    44         require_once( BP_PLUGIN_DIR . '/bp-settings/bp-settings-actions.php'   );
    45         require_once( BP_PLUGIN_DIR . '/bp-settings/bp-settings-screens.php'   );
    46         require_once( BP_PLUGIN_DIR . '/bp-settings/bp-settings-template.php'  );
    47         require_once( BP_PLUGIN_DIR . '/bp-settings/bp-settings-functions.php' );
     58        parent::_setup_globals( $globals );
    4859    }
    4960
     
    5768
    5869        // Add the settings navigation item
    59         bp_core_new_nav_item( array(
     70        $main_nav = array(
    6071            'name'                    => __( 'Settings', 'buddypress' ),
    6172            'slug'                    => $this->slug,
    6273            'position'                => 100,
    63             'show_for_displayed_user' => bp_users_can_edit_settings(),
     74            'show_for_displayed_user' => bp_members_can_edit_settings(),
    6475            'screen_function'         => 'bp_settings_screen_general_settings',
    6576            'default_subnav_slug'     => 'general'
    66         ) );
     77        );
    6778
    68         $settings_link = trailingslashit( $bp->displayed_user->domain . $bp->settings->slug );
     79        $settings_link = trailingslashit( $bp->displayed_user->domain . $this->slug );
    6980
    7081        // Add General Settings nav item
    71         bp_core_new_subnav_item( array(
     82        $sub_nav[] = array(
    7283            'name'            => __( 'General', 'buddypress' ),
    7384            'slug'            => 'general',
     
    7687            'screen_function' => 'bp_settings_screen_general_settings',
    7788            'position'        => 10,
    78             'user_has_access' => bp_users_can_edit_settings()
    79         ) );
     89            'user_has_access' => bp_members_can_edit_settings()
     90        );
    8091
    8192        // Add Notifications nav item
    82         bp_core_new_subnav_item( array(
     93        $sub_nav[] = array(
    8394            'name'            => __( 'Notifications', 'buddypress' ),
    8495            'slug'            => 'notifications',
     
    8798            'screen_function' => 'bp_settings_screen_notification_settings',
    8899            'position'        => 20,
    89             'user_has_access' => bp_users_can_edit_settings()
    90         ) );
     100            'user_has_access' => bp_members_can_edit_settings()
     101        );
    91102
    92103        // Add Delete Account nav item
    93104        if ( !is_super_admin() && empty( $bp->site_options['bp-disable-account-deletion'] ) ) {
    94             bp_core_new_subnav_item( array(
     105            $sub_nav[] = array(
    95106                'name'            => __( 'Delete Account', 'buddypress' ),
    96107                'slug'            => 'delete-account',
     
    100111                'position'        => 90,
    101112                'user_has_access' => bp_is_my_profile()
    102             ) );
     113            );
    103114        }
     115
     116        parent::_setup_nav( $main_nav, $sub_nav );
    104117    }
    105118}
Note: See TracChangeset for help on using the changeset viewer.