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-xprofile/bp-xprofile-loader.php

    r3790 r3917  
    1919     */
    2020    function BP_XProfile_Component() {
    21         parent::start( 'profile', __( 'Extended Profiles', 'buddypress' ) );
     21        parent::start(
     22            'xprofile',
     23            __( 'Extended Profiles', 'buddypress' ),
     24            BP_PLUGIN_DIR
     25        );
     26    }
     27
     28    /**
     29     * Include files
     30     */
     31    function _includes() {
     32        $includes = array(
     33            'cssjs',
     34            'actions',
     35            'screens',
     36            'classes',
     37            'filters',
     38            'template',
     39            'functions'
     40        );
     41
     42        if ( is_admin() )
     43            $includes[] = 'admin';
     44
     45        parent::_includes( $includes );
    2246    }
    2347
     
    4367        define ( 'BP_XPROFILE_FULLNAME_FIELD_NAME', stripslashes( $bp->site_options['bp-xprofile-fullname-field-name'] ) );
    4468
    45         // Do some slug checks
    46         $this->slug      = BP_XPROFILE_SLUG;
    47         $this->root_slug = isset( $bp->pages->xprofile->slug ) ? $bp->pages->xprofile->slug : $this->slug;
    48 
    49         // Tables
    50         $this->table_name_data   = $bp->table_prefix . 'bp_xprofile_data';
    51         $this->table_name_groups = $bp->table_prefix . 'bp_xprofile_groups';
    52         $this->table_name_fields = $bp->table_prefix . 'bp_xprofile_fields';
    53         $this->table_name_meta   = $bp->table_prefix . 'bp_xprofile_meta';
    54 
    55         // Notifications
    56         $this->notification_callback = 'xprofile_format_notifications';
    57 
    58         // Register this in the active components array
    59         $bp->active_components[$this->id] = $this->id;
    60 
    6169        // Set the support field type ids
    6270        $this->field_types = apply_filters( 'xprofile_field_types', array(
     
    6977            'datebox'
    7078        ) );
    71     }
    7279
    73     /**
    74      * Include files
    75      */
    76     function _includes() {
    77         require_once( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-cssjs.php'     );
    78         require_once( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-admin.php'     );
    79         require_once( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-actions.php'   );
    80         require_once( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-screens.php'   );
    81         require_once( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-classes.php'   );
    82         require_once( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-filters.php'   );
    83         require_once( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-template.php'  );
    84         require_once( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-functions.php' );
     80        // Tables
     81        $global_tables = array(
     82            'table_name_data'   => $bp->table_prefix . 'bp_xprofile_data',
     83            'table_name_groups' => $bp->table_prefix . 'bp_xprofile_groups',
     84            'table_name_fields' => $bp->table_prefix . 'bp_xprofile_fields',
     85            'table_name_meta'   => $bp->table_prefix . 'bp_xprofile_meta',
     86        );
     87
     88        $globals = array(
     89            'slug'                  => BP_XPROFILE_SLUG,
     90            'root_slug'             => isset( $bp->pages->xprofile->slug ) ? $bp->pages->xprofile->slug : BP_XPROFILE_SLUG,
     91            'notification_callback' => 'xprofile_format_notifications',
     92            'global_tables'         => $global_tables
     93        );
     94
     95        parent::_setup_globals( $globals );
    8596    }
    8697
     
    94105
    95106        // Add 'Profile' to the main navigation
    96         bp_core_new_nav_item( array(
     107        $main_nav = array(
    97108            'name'                => __( 'Profile', 'buddypress' ),
    98109            'slug'                => $this->slug,
     
    101112            'default_subnav_slug' => 'public',
    102113            'item_css_id'         => $this->id
    103         ) );
     114        );
    104115
    105116        $profile_link = trailingslashit( $bp->loggedin_user->domain . $this->slug );
    106117
    107118        // Add the subnav items to the profile
    108         bp_core_new_subnav_item( array(
     119        $sub_nav[] = array(
    109120            'name'            => __( 'Public', 'buddypress' ),
    110121            'slug'            => 'public',
     
    113124            'screen_function' => 'xprofile_screen_display_profile',
    114125            'position'        => 10
    115         ) );
     126        );
    116127
    117128        // Edit Profile
    118         bp_core_new_subnav_item( array(
     129        $sub_nav[] = array(
    119130            'name'            => __( 'Edit Profile', 'buddypress' ),
    120131            'slug'            => 'edit',
     
    123134            'screen_function' => 'xprofile_screen_edit_profile',
    124135            'position'        => 20
    125         ) );
     136        );
    126137
    127138        // Change Avatar
    128         bp_core_new_subnav_item( array(
     139        $sub_nav[] = array(
    129140            'name'            => __( 'Change Avatar', 'buddypress' ),
    130141            'slug'            => 'change-avatar',
     
    133144            'screen_function' => 'xprofile_screen_change_avatar',
    134145            'position'        => 30
    135         ) );
     146        );
    136147
    137         if ( $bp->current_component == $this->id ) {
     148        parent::_setup_nav( $main_nav, $sub_nav );
     149    }
     150
     151    /**
     152     * Sets up the title for pages and <title>
     153     *
     154     * @global obj $bp
     155     */
     156    function _setup_title() {
     157        global $bp;
     158
     159        if ( bp_is_profile_component() ) {
    138160            if ( bp_is_my_profile() ) {
    139161                $bp->bp_options_title = __( 'My Profile', 'buddypress' );
     
    146168            }
    147169        }
     170
     171        parent::_setup_title();
    148172    }
    149173}
Note: See TracChangeset for help on using the changeset viewer.