Ticket #6388: 6388.03.patch
| File 6388.03.patch, 9.2 KB (added by , 10 years ago) |
|---|
-
src/bp-core/bp-core-template.php
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 /** … … 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 /** … … 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
252 252 $this->current_group->user_has_access = true; 253 253 } 254 254 255 // Check once if the current group has a custom front template 256 $this->current_group->front_template = bp_groups_get_front_template( $this->current_group ); 257 255 258 // Set current_group to 0 to prevent debug errors 256 259 } else { 257 260 $this->current_group = 0; … … 365 368 366 369 $bp = buddypress(); 367 370 371 // If the activity component is not active and the current group has no custom front, members are displayed in the home nav 372 if ( 'members' === $this->default_extension && ! bp_is_active( 'activity' ) && ! $this->current_group->front_template ) { 373 $this->default_extension = 'home'; 374 } 375 368 376 if ( ! bp_current_action() ) { 369 377 $bp->current_action = $this->default_extension; 370 378 } … … 521 529 ); 522 530 } 523 531 524 $sub_nav[] = array( 525 'name' => sprintf( _x( 'Members <span>%s</span>', 'My Group screen nav', 'buddypress' ), number_format( $this->current_group->total_member_count ) ), 526 'slug' => 'members', 527 'parent_url' => $group_link, 528 'parent_slug' => $this->current_group->slug, 529 'screen_function' => 'groups_screen_group_members', 530 'position' => 60, 531 'user_has_access' => $this->current_group->user_has_access, 532 'item_css_id' => 'members', 533 'no_access_url' => $group_link, 534 ); 532 if ( $this->current_group->front_template || bp_is_active( 'activity' ) ) { 533 /** 534 * If the theme is using a custom front, create activity subnav. 535 */ 536 if ( $this->current_group->front_template && bp_is_active( 'activity' ) ) { 537 $sub_nav[] = array( 538 'name' => _x( 'Activity', 'My Group screen nav', 'buddypress' ), 539 'slug' => 'activity', 540 'parent_url' => $group_link, 541 'parent_slug' => $this->current_group->slug, 542 'screen_function' => 'groups_screen_group_activity', 543 'position' => 11, 544 'user_has_access' => $this->current_group->user_has_access, 545 'item_css_id' => 'activity', 546 'no_access_url' => $group_link, 547 ); 548 } 549 550 /** 551 * Only add the members subnav if it's not the home's nav 552 */ 553 $sub_nav[] = array( 554 'name' => sprintf( _x( 'Members <span>%s</span>', 'My Group screen nav', 'buddypress' ), number_format( $this->current_group->total_member_count ) ), 555 'slug' => 'members', 556 'parent_url' => $group_link, 557 'parent_slug' => $this->current_group->slug, 558 'screen_function' => 'groups_screen_group_members', 559 'position' => 60, 560 'user_has_access' => $this->current_group->user_has_access, 561 'item_css_id' => 'members', 562 'no_access_url' => $group_link, 563 ); 564 } 535 565 536 566 if ( bp_is_active( 'friends' ) && bp_groups_user_can_send_invites() ) { 537 567 $sub_nav[] = array( -
src/bp-groups/bp-groups-screens.php
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
4327 4327 } 4328 4328 4329 4329 /** 4330 * Output the contents of the current group's home page. 4331 * 4332 * You should only use this when on a single group page. 4333 * 4334 * @since 2.4.0 4335 */ 4336 function bp_groups_front_template_part() { 4337 $located = bp_groups_get_front_template(); 4338 4339 if ( false !== $located ) { 4340 $slug = str_replace( '.php', '', $located ); 4341 4342 /** 4343 * Let plugins adding an action to bp_get_template_part get it from here 4344 * 4345 * @param string $slug Template part slug requested. 4346 * @param string $name Template part name requested. 4347 */ 4348 do_action( 'get_template_part_' . $slug, $slug, false ); 4349 4350 load_template( $located, true ); 4351 4352 } else if ( bp_is_active( 'activity' ) ) { 4353 bp_get_template_part( 'groups/single/activity' ); 4354 4355 } else if ( bp_is_active( 'members' ) ) { 4356 bp_groups_members_template_part(); 4357 } 4358 4359 return $located; 4360 } 4361 4362 /** 4363 * Locate a custom group front template if it exists. 4364 * 4365 * @since 2.4.0 4366 * 4367 * @param BP_Groups_Group|null $group Optional. Falls back to current group if not passed. 4368 * @return string|bool Path to front template on success; boolean false on failure. 4369 */ 4370 function bp_groups_get_front_template( $group = null ) { 4371 if ( ! is_a( $group, 'BP_Groups_Group' ) ) { 4372 $group = groups_get_current_group(); 4373 } 4374 4375 if ( ! isset( $group->id ) ) { 4376 return false; 4377 } 4378 4379 if ( isset( $group->front_template ) ) { 4380 return $group->front_template; 4381 } 4382 4383 $template_names = apply_filters( 'bp_groups_get_front_template', array( 4384 'groups/single/front-id-' . sanitize_file_name( $group->id ) . '.php', 4385 'groups/single/front-slug-' . sanitize_file_name( $group->slug ) . '.php', 4386 'groups/single/front-status-' . sanitize_file_name( $group->status ) . '.php', 4387 'groups/single/front.php' 4388 ) ); 4389 4390 return bp_locate_template( $template_names, false, true ); 4391 } 4392 4393 /** 4330 4394 * Output the Group members template 4331 4395 * 4332 4396 * @since BuddyPress (2.0.0) -
src/bp-templates/bp-legacy/buddypress/activity/post-form.php
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
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_front_template_part(); 73 64 74 65 } else { 75 66