Changeset 10163 for trunk/src/bp-xprofile/bp-xprofile-loader.php
- Timestamp:
- 10/01/2015 04:18:13 AM (10 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-xprofile/bp-xprofile-loader.php (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-loader.php
r10157 r10163 16 16 17 17 /** 18 * Profile field types 18 * Profile field types. 19 19 * 20 20 * @since 1.5.0 … … 33 33 34 34 /** 35 * Start the xprofile component creation process 35 * Start the xprofile component creation process. 36 36 * 37 37 * @since 1.5.0 … … 51 51 52 52 /** 53 * Include files 53 * Include files. 54 * 55 * @param array $includes 54 56 */ 55 57 public function includes( $includes = array() ) { … … 76 78 77 79 /** 78 * Setup globals 80 * Setup globals. 79 81 * 80 82 * The BP_XPROFILE_SLUG constant is deprecated, and only used here for … … 82 84 * 83 85 * @since 1.5.0 86 * 87 * @param array $args Array of globals to set up. 84 88 */ 85 89 public function setup_globals( $args = array() ) { 86 90 $bp = buddypress(); 87 91 88 // Define a slug, if necessary 92 // Define a slug, if necessary. 89 93 if ( !defined( 'BP_XPROFILE_SLUG' ) ) { 90 94 define( 'BP_XPROFILE_SLUG', 'profile' ); … … 93 97 // Assign the base group and fullname field names to constants 94 98 // to use in SQL statements. 95 // Defined conditionally to accommodate unit tests 99 // Defined conditionally to accommodate unit tests. 96 100 if ( ! defined( 'BP_XPROFILE_BASE_GROUP_NAME' ) ) { 97 101 define( 'BP_XPROFILE_BASE_GROUP_NAME', stripslashes( bp_core_get_root_option( 'avatar_default' ) ) ); … … 113 117 // 'option' is a special case. It is not a top-level field, so 114 118 // does not have an associated BP_XProfile_Field_Type class, 115 // but it must be whitelisted 119 // but it must be whitelisted. 116 120 $this->field_types[] = 'option'; 117 121 118 // Register the visibility levels. See bp_xprofile_get_visibility_levels() to filter 122 // Register the visibility levels. See bp_xprofile_get_visibility_levels() to filter. 119 123 $this->visibility_levels = array( 120 124 'public' => array( … … 139 143 } 140 144 141 // Tables 145 // Tables. 142 146 $global_tables = array( 143 147 'table_name_data' => $bp->table_prefix . 'bp_xprofile_data', … … 168 172 * 169 173 * @global BuddyPress $bp The one true BuddyPress instance 174 * 175 * @param array $main_nav Array of main nav items to set up. 176 * @param array $sub_nav Array of sub nav items to set up. 170 177 */ 171 178 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 172 179 173 // Determine user to use 180 // Determine user to use. 174 181 if ( bp_displayed_user_domain() ) { 175 182 $user_domain = bp_displayed_user_domain(); … … 184 191 $profile_link = trailingslashit( $user_domain . $slug ); 185 192 186 // Add 'Profile' to the main navigation 193 // Add 'Profile' to the main navigation. 187 194 $main_nav = array( 188 195 'name' => _x( 'Profile', 'Profile header menu', 'buddypress' ), … … 194 201 ); 195 202 196 // Add the subnav items to the profile 203 // Add the subnav items to the profile. 197 204 $sub_nav[] = array( 198 205 'name' => _x( 'View', 'Profile header sub menu', 'buddypress' ), … … 204 211 ); 205 212 206 // Edit Profile 213 // Edit Profile. 207 214 $sub_nav[] = array( 208 215 'name' => _x( 'Edit','Profile header sub menu', 'buddypress' ), … … 215 222 ); 216 223 217 // Change Avatar 224 // Change Avatar. 218 225 if ( buddypress()->avatar->show_avatars ) { 219 226 $sub_nav[] = array( … … 242 249 243 250 // The Settings > Profile nav item can only be set up after 244 // the Settings component has run its own nav routine 251 // the Settings component has run its own nav routine. 245 252 add_action( 'bp_settings_setup_nav', array( $this, 'setup_settings_nav' ) ); 246 253 … … 261 268 } 262 269 263 // Determine user to use 270 // Determine user to use. 264 271 if ( bp_displayed_user_domain() ) { 265 272 $user_domain = bp_displayed_user_domain(); … … 270 277 } 271 278 272 // Get the settings slug 279 // Get the settings slug. 273 280 $settings_slug = bp_get_settings_slug(); 274 281 … … 285 292 286 293 /** 287 * Set up the Toolbar 294 * Set up the Admin Bar. 295 * 296 * @param array $wp_admin_nav Admin Bar items. 288 297 */ 289 298 public function setup_admin_bar( $wp_admin_nav = array() ) { 290 299 291 // Menus for logged in user 300 // Menus for logged in user. 292 301 if ( is_user_logged_in() ) { 293 302 294 // Profile link 303 // Profile link. 295 304 $profile_link = trailingslashit( bp_loggedin_user_domain() . bp_get_profile_slug() ); 296 305 297 // Add the "Profile" sub menu 306 // Add the "Profile" sub menu. 298 307 $wp_admin_nav[] = array( 299 308 'parent' => buddypress()->my_account_menu_id, … … 303 312 ); 304 313 305 // View Profile 314 // View Profile. 306 315 $wp_admin_nav[] = array( 307 316 'parent' => 'my-account-' . $this->id, … … 311 320 ); 312 321 313 // Edit Profile 322 // Edit Profile. 314 323 $wp_admin_nav[] = array( 315 324 'parent' => 'my-account-' . $this->id, … … 319 328 ); 320 329 321 // Edit Avatar 330 // Edit Avatar. 322 331 if ( buddypress()->avatar->show_avatars ) { 323 332 $wp_admin_nav[] = array( … … 352 361 353 362 /** 354 * Sets up the title for pages and <title> 363 * Sets up the title for pages and <title>. 355 364 */ 356 365 public function setup_title() { … … 375 384 376 385 /** 377 * Setup cache groups 386 * Setup cache groups. 378 387 * 379 388 * @since 2.2.0 … … 381 390 public function setup_cache_groups() { 382 391 383 // Global groups 392 // Global groups. 384 393 wp_cache_add_global_groups( array( 385 394 'bp_xprofile', … … 398 407 * 399 408 * @param array $wp_admin_nav The settings adminbar nav array. 409 * 400 410 * @return array 401 411 */ 402 412 public function setup_settings_admin_nav( $wp_admin_nav ) { 403 413 404 // Setup the logged in user variables 414 // Setup the logged in user variables. 405 415 $settings_link = trailingslashit( bp_loggedin_user_domain() . bp_get_settings_slug() ); 406 416 407 // Add the "Profile" subnav item 417 // Add the "Profile" subnav item. 408 418 $wp_admin_nav[] = array( 409 419 'parent' => 'my-account-' . buddypress()->settings->id,
Note: See TracChangeset
for help on using the changeset viewer.