Changeset 3917 for trunk/bp-xprofile/bp-xprofile-loader.php
- Timestamp:
- 01/25/2011 08:58:56 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/bp-xprofile-loader.php
r3790 r3917 19 19 */ 20 20 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 ); 22 46 } 23 47 … … 43 67 define ( 'BP_XPROFILE_FULLNAME_FIELD_NAME', stripslashes( $bp->site_options['bp-xprofile-fullname-field-name'] ) ); 44 68 45 // Do some slug checks46 $this->slug = BP_XPROFILE_SLUG;47 $this->root_slug = isset( $bp->pages->xprofile->slug ) ? $bp->pages->xprofile->slug : $this->slug;48 49 // Tables50 $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 // Notifications56 $this->notification_callback = 'xprofile_format_notifications';57 58 // Register this in the active components array59 $bp->active_components[$this->id] = $this->id;60 61 69 // Set the support field type ids 62 70 $this->field_types = apply_filters( 'xprofile_field_types', array( … … 69 77 'datebox' 70 78 ) ); 71 }72 79 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 ); 85 96 } 86 97 … … 94 105 95 106 // Add 'Profile' to the main navigation 96 bp_core_new_nav_item(array(107 $main_nav = array( 97 108 'name' => __( 'Profile', 'buddypress' ), 98 109 'slug' => $this->slug, … … 101 112 'default_subnav_slug' => 'public', 102 113 'item_css_id' => $this->id 103 ) );114 ); 104 115 105 116 $profile_link = trailingslashit( $bp->loggedin_user->domain . $this->slug ); 106 117 107 118 // Add the subnav items to the profile 108 bp_core_new_subnav_item(array(119 $sub_nav[] = array( 109 120 'name' => __( 'Public', 'buddypress' ), 110 121 'slug' => 'public', … … 113 124 'screen_function' => 'xprofile_screen_display_profile', 114 125 'position' => 10 115 ) );126 ); 116 127 117 128 // Edit Profile 118 bp_core_new_subnav_item(array(129 $sub_nav[] = array( 119 130 'name' => __( 'Edit Profile', 'buddypress' ), 120 131 'slug' => 'edit', … … 123 134 'screen_function' => 'xprofile_screen_edit_profile', 124 135 'position' => 20 125 ) );136 ); 126 137 127 138 // Change Avatar 128 bp_core_new_subnav_item(array(139 $sub_nav[] = array( 129 140 'name' => __( 'Change Avatar', 'buddypress' ), 130 141 'slug' => 'change-avatar', … … 133 144 'screen_function' => 'xprofile_screen_change_avatar', 134 145 'position' => 30 135 ) );146 ); 136 147 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() ) { 138 160 if ( bp_is_my_profile() ) { 139 161 $bp->bp_options_title = __( 'My Profile', 'buddypress' ); … … 146 168 } 147 169 } 170 171 parent::_setup_title(); 148 172 } 149 173 }
Note: See TracChangeset
for help on using the changeset viewer.