Ticket #6388: 6388.02.patch
| File 6388.02.patch, 9.4 KB (added by , 10 years ago) |
|---|
-
src/bp-core/bp-core-template.php
diff --git src/bp-core/bp-core-template.php src/bp-core/bp-core-template.php index 52bae24..3f60f17 100644
function bp_is_group_forum() { 2534 2534 * @return True if the current page is a group's activity page. 2535 2535 */ 2536 2536 function bp_is_group_activity() { 2537 return (bool) ( bp_is_single_item() && bp_is_groups_component() && bp_is_current_action( 'activity' ) ); 2537 $retval = false; 2538 2539 if ( bp_is_single_item() && bp_is_groups_component() && bp_is_current_action( 'activity' ) ) { 2540 $retval = true; 2541 } 2542 2543 if ( bp_is_group_home() && bp_is_active( 'activity' ) && ! bp_is_group_custom_front() ) { 2544 $retval = true; 2545 } 2546 2547 return $retval; 2538 2548 } 2539 2549 2540 2550 /** … … function bp_is_group_forum_topic_edit() { 2567 2577 * @return bool True if the current page is part of a group's Members page. 2568 2578 */ 2569 2579 function bp_is_group_members() { 2570 return (bool) ( bp_is_single_item() && bp_is_groups_component() && bp_is_current_action( 'members' ) ); 2580 $retval = false; 2581 2582 if ( bp_is_single_item() && bp_is_groups_component() && bp_is_current_action( 'members' ) ) { 2583 $retval = true; 2584 } 2585 2586 if ( bp_is_group_home() && ! bp_is_active( 'activity' ) && ! bp_is_group_custom_front() ) { 2587 $retval = true; 2588 } 2589 2590 return $retval; 2571 2591 } 2572 2592 2573 2593 /** … … function bp_is_group_single() { 2615 2635 } 2616 2636 2617 2637 /** 2638 * Is the current group page a custom front? 2639 * 2640 * @since 2.4.0 2641 * 2642 * @return bool True if the current group page is a custom front. 2643 */ 2644 function bp_is_group_custom_front() { 2645 $bp = buddypress(); 2646 return (bool) bp_is_group_home() && ! empty( $bp->groups->current_group->front_template ); 2647 } 2648 2649 /** 2618 2650 * Is the current page the Create a Blog page? 2619 2651 * 2620 2652 * Eg http://example.com/sites/create/. -
src/bp-groups/bp-groups-loader.php
diff --git src/bp-groups/bp-groups-loader.php src/bp-groups/bp-groups-loader.php index c5f6f05..02337d1 100644
class BP_Groups_Component extends BP_Component { 251 251 $this->current_group->user_has_access = true; 252 252 } 253 253 254 // Check once if the current group has a custom front template 255 $this->current_group->front_template = bp_groups_get_group_front_template( $this->current_group ); 256 254 257 // Set current_group to 0 to prevent debug errors 255 258 } else { 256 259 $this->current_group = 0; … … class BP_Groups_Component extends BP_Component { 364 367 365 368 $bp = buddypress(); 366 369 370 // If the activity component is not active and the current group has no custom front, members are displayed in the home nav 371 if ( 'members' === $this->default_extension && ! bp_is_active( 'activity' ) && ! $this->current_group->front_template ) { 372 $this->default_extension = 'home'; 373 } 374 367 375 if ( ! bp_current_action() ) { 368 376 $bp->current_action = $this->default_extension; 369 377 } … … class BP_Groups_Component extends BP_Component { 520 528 ); 521 529 } 522 530 523 $sub_nav[] = array( 524 'name' => sprintf( _x( 'Members <span>%s</span>', 'My Group screen nav', 'buddypress' ), number_format( $this->current_group->total_member_count ) ), 525 'slug' => 'members', 526 'parent_url' => $group_link, 527 'parent_slug' => $this->current_group->slug, 528 'screen_function' => 'groups_screen_group_members', 529 'position' => 60, 530 'user_has_access' => $this->current_group->user_has_access, 531 'item_css_id' => 'members', 532 'no_access_url' => $group_link, 533 ); 531 if ( $this->current_group->front_template || bp_is_active( 'activity' ) ) { 532 /** 533 * Only add the members subnav if it's not the home's nav 534 */ 535 $sub_nav[] = array( 536 'name' => sprintf( _x( 'Members <span>%s</span>', 'My Group screen nav', 'buddypress' ), number_format( $this->current_group->total_member_count ) ), 537 'slug' => 'members', 538 'parent_url' => $group_link, 539 'parent_slug' => $this->current_group->slug, 540 'screen_function' => 'groups_screen_group_members', 541 'position' => 60, 542 'user_has_access' => $this->current_group->user_has_access, 543 'item_css_id' => 'members', 544 'no_access_url' => $group_link, 545 ); 546 547 /** 548 * If the theme is using a custom front, create 549 * an activity nav 550 */ 551 if ( $this->current_group->front_template && bp_is_active( 'activity' ) ) { 552 $sub_nav[] = array( 553 'name' => _x( 'Activity', 'My Group screen nav', 'buddypress' ), 554 'slug' => 'activity', 555 'parent_url' => $group_link, 556 'parent_slug' => $this->current_group->slug, 557 'screen_function' => 'groups_screen_group_activity', 558 'position' => 50, 559 'user_has_access' => $this->current_group->user_has_access, 560 'item_css_id' => 'activity', 561 'no_access_url' => $group_link, 562 ); 563 } 564 } 534 565 535 566 if ( bp_is_active( 'friends' ) && bp_groups_user_can_send_invites() ) { 536 567 $sub_nav[] = array( -
src/bp-groups/bp-groups-screens.php
diff --git src/bp-groups/bp-groups-screens.php src/bp-groups/bp-groups-screens.php index 1477c00..ae309cb 100644
function groups_screen_group_request_membership() { 742 742 } 743 743 744 744 /** 745 * Handle the loading of a single group's activity. 746 * 747 * @since 2.4.0 748 */ 749 function groups_screen_group_activity() { 750 751 if ( ! bp_is_single_item() ) { 752 return false; 753 } 754 755 /** 756 * Fires before the loading of a single group's activity page. 757 * 758 * @since 2.4.0 759 */ 760 do_action( 'groups_screen_group_activity' ); 761 762 /** 763 * Filters the template to load for a single group's activity page. 764 * 765 * @since 2.4.0 766 * 767 * @param string $value Path to a single group's template to load. 768 */ 769 bp_core_load_template( apply_filters( 'groups_screen_group_activity', 'groups/single/activity' ) ); 770 } 771 772 /** 745 773 * Handle the display of a single group activity item. 746 774 */ 747 775 function groups_screen_group_activity_permalink() { -
src/bp-groups/bp-groups-template.php
diff --git src/bp-groups/bp-groups-template.php src/bp-groups/bp-groups-template.php index 0e3ec0a..4dbbb33 100644
function bp_group_member_admin_pagination() { 4323 4323 } 4324 4324 4325 4325 /** 4326 * Load the appropriate current group's home page 4327 * 4328 * @since 2.4.0 4329 */ 4330 function bp_groups_load_group_front_template( $require_once = false, $group = null ) { 4331 $located = bp_groups_get_group_front_template( $group ); 4332 4333 if ( false !== $located ) { 4334 $slug = str_replace( '.php', '', $located ); 4335 4336 /** 4337 * Let plugins adding an action to bp_get_template_part get it from here 4338 * 4339 * @param string $slug Template part slug requested. 4340 * @param string $name Template part name requested. 4341 */ 4342 do_action( 'get_template_part_' . $slug, $slug, false ); 4343 4344 load_template( $located, $require_once ); 4345 4346 } else if ( bp_is_active( 'activity' ) ) { 4347 bp_get_template_part( 'groups/single/activity' ); 4348 4349 } else if ( bp_is_active( 'members' ) ) { 4350 bp_groups_members_template_part(); 4351 } 4352 4353 return $located; 4354 } 4355 4356 /** 4357 * Locate a custom group front template if it exsists 4358 * 4359 * @since 2.4.0 4360 */ 4361 function bp_groups_get_group_front_template( $group = null ) { 4362 if ( ! is_a( $group, 'BP_Groups_Group' ) ) { 4363 $group = groups_get_current_group(); 4364 } 4365 4366 if ( ! isset( $group->id ) ) { 4367 return false; 4368 } 4369 4370 if ( isset( $group->front_template ) ) { 4371 return $group->front_template; 4372 } 4373 4374 $template_names = apply_filters( 'bp_groups_get_front_template', array( 4375 'groups/single/front-id-' . sanitize_file_name( $group->id ) . '.php', 4376 'groups/single/front-slug-' . sanitize_file_name( $group->slug ) . '.php', 4377 'groups/single/front-status-' . sanitize_file_name( $group->status ) . '.php', 4378 'groups/single/front.php' 4379 ) ); 4380 4381 return bp_locate_template( $template_names, false, true ); 4382 } 4383 4384 /** 4326 4385 * Output the Group members template 4327 4386 * 4328 4387 * @since BuddyPress (2.0.0) -
src/bp-templates/bp-legacy/buddypress/activity/post-form.php
diff --git src/bp-templates/bp-legacy/buddypress/activity/post-form.php src/bp-templates/bp-legacy/buddypress/activity/post-form.php index 9a2da4c..5993eaf 100644
67 67 </div> 68 68 <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> 69 69 70 <?php elseif ( bp_is_group_ home() ) : ?>70 <?php elseif ( bp_is_group_activity() ) : ?> 71 71 72 72 <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> 73 73 <input type="hidden" id="whats-new-post-in" name="whats-new-post-in" value="<?php bp_group_id(); ?>" /> -
src/bp-templates/bp-legacy/buddypress/groups/single/home.php
diff --git src/bp-templates/bp-legacy/buddypress/groups/single/home.php src/bp-templates/bp-legacy/buddypress/groups/single/home.php index 6e2727c..67a8be9 100644
59 59 60 60 if ( bp_group_is_visible() ) { 61 61 62 // Use custom front if one exists 63 $custom_front = bp_locate_template( array( 'groups/single/front.php' ), false, true ); 64 if ( ! empty( $custom_front ) ) : load_template( $custom_front, true ); 65 66 // Default to activity 67 elseif ( bp_is_active( 'activity' ) ) : bp_get_template_part( 'groups/single/activity' ); 68 69 // Otherwise show members 70 elseif ( bp_is_active( 'members' ) ) : bp_groups_members_template_part(); 71 72 endif; 62 // Load appropriate front template 63 bp_groups_load_group_front_template(); 73 64 74 65 } else { 75 66