Changeset 7212 for trunk/bp-members/bp-members-screens.php
- Timestamp:
- 06/13/2013 01:27:01 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-members/bp-members-screens.php
r7068 r7212 267 267 * 268 268 * This class sets up the necessary theme compatability actions to safely output 269 * grouptemplate parts to the_title and the_content areas of a theme.269 * member template parts to the_title and the_content areas of a theme. 270 270 * 271 271 * @since BuddyPress (1.7) … … 299 299 do_action( 'bp_members_screen_index' ); 300 300 301 add_filter( 'bp_get_buddypress_template', array( $this, 'directory_template_hierarchy' ) ); 301 302 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'directory_dummy_post' ) ); 302 303 add_filter( 'bp_replace_the_content', array( $this, 'directory_content' ) ); … … 311 312 do_action( 'bp_members_screen_display_profile' ); 312 313 314 add_filter( 'bp_get_buddypress_template', array( $this, 'single_template_hierarchy' ) ); 313 315 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'single_dummy_post' ) ); 314 316 add_filter( 'bp_replace_the_content', array( $this, 'single_dummy_content' ) ); … … 318 320 319 321 /** Directory *************************************************************/ 322 323 /** 324 * Add template hierarchy to theme compat for the members directory page. 325 * 326 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 327 * 328 * @since BuddyPress (1.8) 329 * 330 * @param string $templates The templates from bp_get_theme_compat_templates() 331 * @return array $templates Array of custom templates to look for. 332 */ 333 public function directory_template_hierarchy( $templates ) { 334 // Setup our templates based on priority 335 $new_templates = apply_filters( 'bp_template_hierarchy_members_directory', array( 336 'members/single/index-directory.php' 337 ) ); 338 339 // Merge new templates with existing stack 340 // @see bp_get_theme_compat_templates() 341 $templates = array_merge( (array) $new_templates, $templates ); 342 343 return $templates; 344 } 320 345 321 346 /** … … 350 375 351 376 /** 377 * Add custom template hierarchy to theme compat for member pages. 378 * 379 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 380 * 381 * @since BuddyPress (1.8) 382 * 383 * @param string $templates The templates from bp_get_theme_compat_templates() 384 * @return array $templates Array of custom templates to look for. 385 */ 386 public function single_template_hierarchy( $templates ) { 387 // Setup some variables we're going to reference in our custom templates 388 $user_nicename = buddypress()->displayed_user->userdata->user_nicename; 389 390 // Setup our templates based on priority 391 $new_templates = apply_filters( 'bp_template_hierarchy_members_single_item', array( 392 'members/single/index-id-' . sanitize_file_name( bp_displayed_user_id() ) . '.php', 393 'members/single/index-nicename-' . sanitize_file_name( $user_nicename ) . '.php', 394 'members/single/index-action-' . sanitize_file_name( bp_current_action() ) . '.php', 395 'members/single/index-component-' . sanitize_file_name( bp_current_component() ) . '.php', 396 'members/single/index.php' 397 ) ); 398 399 // Merge new templates with existing stack 400 // @see bp_get_theme_compat_templates() 401 $templates = array_merge( (array) $new_templates, $templates ); 402 403 return $templates; 404 } 405 406 /** 352 407 * Update the global $post with the displayed user's data 353 408 * … … 414 469 415 470 // Setup actions 471 add_filter( 'bp_get_buddypress_template', array( $this, 'template_hierarchy' ) ); 416 472 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'dummy_post' ) ); 417 473 add_filter( 'bp_replace_the_content', array( $this, 'dummy_content' ) ); … … 419 475 420 476 /** Template ***********************************************************/ 477 478 /** 479 * Add template hierarchy to theme compat for registration / activation pages. 480 * 481 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 482 * 483 * @since BuddyPress (1.8) 484 * 485 * @param string $templates The templates from bp_get_theme_compat_templates() 486 * @return array $templates Array of custom templates to look for. 487 */ 488 public function template_hierarchy( $templates ) { 489 $component = sanitize_file_name( bp_current_component() ); 490 491 // Setup our templates based on priority 492 $new_templates = apply_filters( "bp_template_hierarchy_{$component}", array( 493 "members/index-{$component}.php" 494 ) ); 495 496 // Merge new templates with existing stack 497 // @see bp_get_theme_compat_templates() 498 $templates = array_merge( (array) $new_templates, $templates ); 499 500 return $templates; 501 } 421 502 422 503 /**
Note: See TracChangeset
for help on using the changeset viewer.