Changeset 7212
- Timestamp:
- 06/13/2013 01:27:01 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-screens.php
r7193 r7212 319 319 * 320 320 * This class sets up the necessary theme compatability actions to safely output 321 * grouptemplate parts to the_title and the_content areas of a theme.321 * activity template parts to the_title and the_content areas of a theme. 322 322 * 323 323 * @since BuddyPress (1.7) … … 351 351 do_action( 'bp_activity_screen_index' ); 352 352 353 add_filter( 'bp_get_buddypress_template', array( $this, 'directory_template_hierarchy' ) ); 353 354 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'directory_dummy_post' ) ); 354 355 add_filter( 'bp_replace_the_content', array( $this, 'directory_content' ) ); … … 356 357 // Single activity 357 358 } elseif ( bp_is_single_activity() ) { 359 add_filter( 'bp_get_buddypress_template', array( $this, 'single_template_hierarchy' ) ); 358 360 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'single_dummy_post' ) ); 359 361 add_filter( 'bp_replace_the_content', array( $this, 'single_dummy_content' ) ); … … 362 364 363 365 /** Directory *************************************************************/ 366 367 /** 368 * Add template hierarchy to theme compat for the activity directory page. 369 * 370 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 371 * 372 * @since BuddyPress (1.8) 373 * 374 * @param string $templates The templates from bp_get_theme_compat_templates() 375 * @return array $templates Array of custom templates to look for. 376 */ 377 public function directory_template_hierarchy( $templates ) { 378 // Setup our templates based on priority 379 $new_templates = apply_filters( 'bp_template_hierarchy_activity_directory', array( 380 'activity/index-directory.php' 381 ) ); 382 383 // Merge new templates with existing stack 384 // @see bp_get_theme_compat_templates() 385 $templates = array_merge( (array) $new_templates, $templates ); 386 387 return $templates; 388 } 364 389 365 390 /** … … 394 419 395 420 /** 421 * Add custom template hierarchy to theme compat for activity permalink pages. 422 * 423 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 424 * 425 * @since BuddyPress (1.8) 426 * 427 * @param string $templates The templates from bp_get_theme_compat_templates() 428 * @return array $templates Array of custom templates to look for. 429 */ 430 public function single_template_hierarchy( $templates ) { 431 // Setup our templates based on priority 432 $new_templates = apply_filters( 'bp_template_hierarchy_activity_single_item', array( 433 'activity/single/index.php' 434 ) ); 435 436 // Merge new templates with existing stack 437 // @see bp_get_theme_compat_templates() 438 $templates = array_merge( (array) $new_templates, $templates ); 439 440 return $templates; 441 } 442 443 /** 396 444 * Update the global $post with the displayed user's data 397 445 * -
trunk/bp-blogs/bp-blogs-screens.php
r6419 r7212 87 87 do_action( 'bp_blogs_screen_index' ); 88 88 89 add_filter( 'bp_get_buddypress_template', array( $this, 'directory_template_hierarchy' ) ); 89 90 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'directory_dummy_post' ) ); 90 91 add_filter( 'bp_replace_the_content', array( $this, 'directory_content' ) ); … … 92 93 // Create blog 93 94 } elseif ( is_user_logged_in() && bp_blog_signup_enabled() ) { 95 add_filter( 'bp_get_buddypress_template', array( $this, 'create_template_hierarchy' ) ); 94 96 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'create_dummy_post' ) ); 95 97 add_filter( 'bp_replace_the_content', array( $this, 'create_content' ) ); … … 98 100 99 101 /** Directory *************************************************************/ 102 103 /** 104 * Add template hierarchy to theme compat for the blog directory page. 105 * 106 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 107 * 108 * @since BuddyPress (1.8) 109 * 110 * @param string $templates The templates from bp_get_theme_compat_templates() 111 * @return array $templates Array of custom templates to look for. 112 */ 113 public function directory_template_hierarchy( $templates ) { 114 // Setup our templates based on priority 115 $new_templates = apply_filters( 'bp_template_hierarchy_blogs_create', array( 116 'blogs/index-directory.php' 117 ) ); 118 119 // Merge new templates with existing stack 120 // @see bp_get_theme_compat_templates() 121 $templates = array_merge( (array) $new_templates, $templates ); 122 123 return $templates; 124 } 100 125 101 126 /** … … 138 163 139 164 /** 165 * Add custom template hierarchy to theme compat for the blog create page. 166 * 167 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 168 * 169 * @since BuddyPress (1.8) 170 * 171 * @param string $templates The templates from bp_get_theme_compat_templates() 172 * @return array $templates Array of custom templates to look for. 173 */ 174 public function create_template_hierarchy( $templates ) { 175 // Setup our templates based on priority 176 $new_templates = apply_filters( 'bp_template_hierarchy_blogs_create', array( 177 'blogs/index-create.php' 178 ) ); 179 180 // Merge new templates with existing stack 181 // @see bp_get_theme_compat_templates() 182 $templates = array_merge( (array) $new_templates, $templates ); 183 184 return $templates; 185 } 186 187 /** 140 188 * Update the global $post with create screen data 141 189 * -
trunk/bp-groups/bp-groups-screens.php
r6956 r7212 972 972 do_action( 'groups_directory_groups_setup' ); 973 973 974 add_filter( 'bp_get_buddypress_template', array( $this, 'directory_template_hierarchy' ) ); 974 975 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'directory_dummy_post' ) ); 975 976 add_filter( 'bp_replace_the_content', array( $this, 'directory_content' ) ); … … 977 978 // Creating a group 978 979 } elseif ( bp_is_groups_component() && bp_is_current_action( 'create' ) ) { 980 add_filter( 'bp_get_buddypress_template', array( $this, 'create_template_hierarchy' ) ); 979 981 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'create_dummy_post' ) ); 980 982 add_filter( 'bp_replace_the_content', array( $this, 'create_content' ) ); 981 983 982 // Group admin984 // Group page 983 985 } elseif ( bp_is_single_item() ) { 986 add_filter( 'bp_get_buddypress_template', array( $this, 'single_template_hierarchy' ) ); 984 987 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'single_dummy_post' ) ); 985 988 add_filter( 'bp_replace_the_content', array( $this, 'single_content' ) ); … … 989 992 990 993 /** Directory *************************************************************/ 994 995 /** 996 * Add template hierarchy to theme compat for the group directory page. 997 * 998 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 999 * 1000 * @since BuddyPress (1.8) 1001 * 1002 * @param string $templates The templates from bp_get_theme_compat_templates() 1003 * @return array $templates Array of custom templates to look for. 1004 */ 1005 public function directory_template_hierarchy( $templates ) { 1006 // Setup our templates based on priority 1007 $new_templates = apply_filters( 'bp_template_hierarchy_groups_directory', array( 1008 'groups/index-directory.php' 1009 ) ); 1010 1011 // Merge new templates with existing stack 1012 // @see bp_get_theme_compat_templates() 1013 $templates = array_merge( (array) $new_templates, $templates ); 1014 1015 return $templates; 1016 } 991 1017 992 1018 /** … … 1029 1055 1030 1056 /** 1057 * Add custom template hierarchy to theme compat for the group create page. 1058 * 1059 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 1060 * 1061 * @since BuddyPress (1.8) 1062 * 1063 * @param string $templates The templates from bp_get_theme_compat_templates() 1064 * @return array $templates Array of custom templates to look for. 1065 */ 1066 public function create_template_hierarchy( $templates ) { 1067 // Setup our templates based on priority 1068 $new_templates = apply_filters( 'bp_template_hierarchy_groups_create', array( 1069 'groups/index-create.php' 1070 ) ); 1071 1072 // Merge new templates with existing stack 1073 // @see bp_get_theme_compat_templates() 1074 $templates = array_merge( $new_templates, $templates ); 1075 1076 return $templates; 1077 } 1078 1079 /** 1031 1080 * Update the global $post with create screen data 1032 1081 * … … 1065 1114 1066 1115 /** Single ****************************************************************/ 1116 1117 /** 1118 * Add custom template hierarchy to theme compat for group pages. 1119 * 1120 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 1121 * 1122 * @since BuddyPress (1.8) 1123 * 1124 * @param string $templates The templates from bp_get_theme_compat_templates() 1125 * @return array $templates Array of custom templates to look for. 1126 */ 1127 public function single_template_hierarchy( $templates ) { 1128 // Setup some variables we're going to reference in our custom templates 1129 $group = groups_get_current_group(); 1130 1131 // Setup our templates based on priority 1132 $new_templates = apply_filters( 'bp_template_hierarchy_groups_single_item', array( 1133 'groups/single/index-id-' . sanitize_file_name( bp_get_current_group_id() ) . '.php', 1134 'groups/single/index-slug-' . sanitize_file_name( bp_get_current_group_slug() ) . '.php', 1135 'groups/single/index-action-' . sanitize_file_name( bp_current_action() ) . '.php', 1136 'groups/single/index-status-' . sanitize_file_name( $group->status ) . '.php', 1137 'groups/single/index.php' 1138 ) ); 1139 1140 // Merge new templates with existing stack 1141 // @see bp_get_theme_compat_templates() 1142 $templates = array_merge( (array) $new_templates, $templates ); 1143 1144 return $templates; 1145 } 1067 1146 1068 1147 /** -
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.