Ticket #6388: 6388.05.patch
File 6388.05.patch, 11.5 KB (added by , 8 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 be74901..93e0bb5 100644
function bp_is_group_forum() { 2552 2552 * @return True if the current page is a group's activity page. 2553 2553 */ 2554 2554 function bp_is_group_activity() { 2555 return (bool) ( bp_is_single_item() && bp_is_groups_component() && bp_is_current_action( 'activity' ) ); 2555 $retval = false; 2556 2557 if ( bp_is_single_item() && bp_is_groups_component() && bp_is_current_action( 'activity' ) ) { 2558 $retval = true; 2559 } 2560 2561 if ( bp_is_group_home() && bp_is_active( 'activity' ) && ! bp_is_group_custom_front() ) { 2562 $retval = true; 2563 } 2564 2565 return $retval; 2556 2566 } 2557 2567 2558 2568 /** … … function bp_is_group_forum_topic_edit() { 2585 2595 * @return bool True if the current page is part of a group's Members page. 2586 2596 */ 2587 2597 function bp_is_group_members() { 2588 return (bool) ( bp_is_single_item() && bp_is_groups_component() && bp_is_current_action( 'members' ) ); 2598 $retval = false; 2599 2600 if ( bp_is_single_item() && bp_is_groups_component() && bp_is_current_action( 'members' ) ) { 2601 $retval = true; 2602 } 2603 2604 if ( bp_is_group_home() && ! bp_is_active( 'activity' ) && ! bp_is_group_custom_front() ) { 2605 $retval = true; 2606 } 2607 2608 return $retval; 2589 2609 } 2590 2610 2591 2611 /** … … function bp_is_group_single() { 2633 2653 } 2634 2654 2635 2655 /** 2656 * Is the current group page a custom front? 2657 * 2658 * @since 2.4.0 2659 * 2660 * @return bool True if the current group page is a custom front. 2661 */ 2662 function bp_is_group_custom_front() { 2663 $bp = buddypress(); 2664 return (bool) bp_is_group_home() && ! empty( $bp->groups->current_group->front_template ); 2665 } 2666 2667 /** 2636 2668 * Is the current page the Create a Blog page? 2637 2669 * 2638 2670 * 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 3c5653b..d5b698f 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_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 { 371 374 372 375 $bp = buddypress(); 373 376 377 // If the activity component is not active and the current group has no custom front, members are displayed in the home nav 378 if ( 'members' === $this->default_extension && ! bp_is_active( 'activity' ) && ! $this->current_group->front_template ) { 379 $this->default_extension = 'home'; 380 } 381 374 382 if ( ! bp_current_action() ) { 375 383 $bp->current_action = $this->default_extension; 376 384 } … … class BP_Groups_Component extends BP_Component { 527 535 ); 528 536 } 529 537 530 $sub_nav[] = array( 531 'name' => sprintf( _x( 'Members <span>%s</span>', 'My Group screen nav', 'buddypress' ), number_format( $this->current_group->total_member_count ) ), 532 'slug' => 'members', 533 'parent_url' => $group_link, 534 'parent_slug' => $this->current_group->slug, 535 'screen_function' => 'groups_screen_group_members', 536 'position' => 60, 537 'user_has_access' => $this->current_group->user_has_access, 538 'item_css_id' => 'members', 539 'no_access_url' => $group_link, 540 ); 538 if ( $this->current_group->front_template || bp_is_active( 'activity' ) ) { 539 /** 540 * If the theme is using a custom front, create activity subnav. 541 */ 542 if ( $this->current_group->front_template && bp_is_active( 'activity' ) ) { 543 $sub_nav[] = array( 544 'name' => _x( 'Activity', 'My Group screen nav', 'buddypress' ), 545 'slug' => 'activity', 546 'parent_url' => $group_link, 547 'parent_slug' => $this->current_group->slug, 548 'screen_function' => 'groups_screen_group_activity', 549 'position' => 11, 550 'user_has_access' => $this->current_group->user_has_access, 551 'item_css_id' => 'activity', 552 'no_access_url' => $group_link, 553 ); 554 } 555 556 /** 557 * Only add the members subnav if it's not the home's nav 558 */ 559 $sub_nav[] = array( 560 'name' => sprintf( _x( 'Members <span>%s</span>', 'My Group screen nav', 'buddypress' ), number_format( $this->current_group->total_member_count ) ), 561 'slug' => 'members', 562 'parent_url' => $group_link, 563 'parent_slug' => $this->current_group->slug, 564 'screen_function' => 'groups_screen_group_members', 565 'position' => 60, 566 'user_has_access' => $this->current_group->user_has_access, 567 'item_css_id' => 'members', 568 'no_access_url' => $group_link, 569 ); 570 } 541 571 542 572 if ( bp_is_active( 'friends' ) && bp_groups_user_can_send_invites() ) { 543 573 $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 875527f..5ffcbcb 100644
function groups_screen_group_request_membership() { 741 741 } 742 742 743 743 /** 744 * Handle the loading of a single group's activity. 745 * 746 * @since 2.4.0 747 */ 748 function groups_screen_group_activity() { 749 750 if ( ! bp_is_single_item() ) { 751 return false; 752 } 753 754 /** 755 * Fires before the loading of a single group's activity page. 756 * 757 * @since 2.4.0 758 */ 759 do_action( 'groups_screen_group_activity' ); 760 761 /** 762 * Filters the template to load for a single group's activity page. 763 * 764 * @since 2.4.0 765 * 766 * @param string $value Path to a single group's template to load. 767 */ 768 bp_core_load_template( apply_filters( 'groups_screen_group_activity', 'groups/single/activity' ) ); 769 } 770 771 /** 744 772 * Handle the display of a single group activity item. 745 773 */ 746 774 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 9cbdcad..9aa5a2d 100644
function bp_group_member_admin_pagination() { 4343 4343 } 4344 4344 4345 4345 /** 4346 * Output the contents of the current group's home page. 4347 * 4348 * You should only use this when on a single group page. 4349 * 4350 * @since 2.4.0 4351 */ 4352 function bp_groups_front_template_part() { 4353 $located = bp_groups_get_front_template(); 4354 4355 if ( false !== $located ) { 4356 $slug = str_replace( '.php', '', $located ); 4357 4358 /** 4359 * Let plugins adding an action to bp_get_template_part get it from here 4360 * 4361 * @param string $slug Template part slug requested. 4362 * @param string $name Template part name requested. 4363 */ 4364 do_action( 'get_template_part_' . $slug, $slug, false ); 4365 4366 load_template( $located, true ); 4367 4368 } else if ( bp_is_active( 'activity' ) ) { 4369 bp_get_template_part( 'groups/single/activity' ); 4370 4371 } else if ( bp_is_active( 'members' ) ) { 4372 bp_groups_members_template_part(); 4373 } 4374 4375 return $located; 4376 } 4377 4378 /** 4379 * Locate a custom group front template if it exists. 4380 * 4381 * @since 2.4.0 4382 * 4383 * @param BP_Groups_Group|null $group Optional. Falls back to current group if not passed. 4384 * @return string|bool Path to front template on success; boolean false on failure. 4385 */ 4386 function bp_groups_get_front_template( $group = null ) { 4387 if ( ! is_a( $group, 'BP_Groups_Group' ) ) { 4388 $group = groups_get_current_group(); 4389 } 4390 4391 if ( ! isset( $group->id ) ) { 4392 return false; 4393 } 4394 4395 if ( isset( $group->front_template ) ) { 4396 return $group->front_template; 4397 } 4398 4399 $template_names = apply_filters( 'bp_groups_get_front_template', array( 4400 'groups/single/front-id-' . sanitize_file_name( $group->id ) . '.php', 4401 'groups/single/front-slug-' . sanitize_file_name( $group->slug ) . '.php', 4402 'groups/single/front-status-' . sanitize_file_name( $group->status ) . '.php', 4403 'groups/single/front.php' 4404 ) ); 4405 4406 return bp_locate_template( $template_names, false, true ); 4407 } 4408 4409 /** 4346 4410 * Output the Group members template 4347 4411 * 4348 4412 * @since 2.0.0 -
src/bp-templates/bp-legacy/buddypress-functions.php
diff --git src/bp-templates/bp-legacy/buddypress-functions.php src/bp-templates/bp-legacy/buddypress-functions.php index 2532123..d5c436e 100644
function bp_legacy_theme_post_update() { 925 925 exit( '-1<div id="message" class="error bp-ajax-message"><p>' . __( 'Please enter some content to post.', 'buddypress' ) . '</p></div>' ); 926 926 927 927 $activity_id = 0; 928 if ( empty( $_POST['object'] ) && bp_is_active( 'activity' ) ) { 928 $item_id = 0; 929 $object = ''; 930 931 932 // Try to get the item id from posted variables. 933 if ( ! empty( $_POST['item_id'] ) ) { 934 $item_id = (int) $_POST['item_id']; 935 } 936 937 // Try to get the object from posted variables. 938 if ( ! empty( $_POST['object'] ) ) { 939 $object = sanitize_key( $_POST['object'] ); 940 941 // If the object is not set and we're in a group, set the item id and the object 942 } elseif ( bp_is_group() ) { 943 $item_id = bp_get_current_group_id(); 944 $object = 'groups'; 945 } 946 947 if ( ! $object && bp_is_active( 'activity' ) ) { 929 948 $activity_id = bp_activity_post_update( array( 'content' => $_POST['content'] ) ); 930 949 931 } elseif ( $_POST['object'] == 'groups') {932 if ( ! empty( $_POST['item_id'] )&& bp_is_active( 'groups' ) )933 $activity_id = groups_post_update( array( 'content' => $_POST['content'], 'group_id' => $ _POST['item_id']) );950 } elseif ( 'groups' === $object ) { 951 if ( $item_id && bp_is_active( 'groups' ) ) 952 $activity_id = groups_post_update( array( 'content' => $_POST['content'], 'group_id' => $item_id ) ); 934 953 935 954 } else { 936 955 937 956 /** This filter is documented in bp-activity/bp-activity-actions.php */ 938 $activity_id = apply_filters( 'bp_activity_custom_update', false, $ _POST['object'], $_POST['item_id'], $_POST['content'] );957 $activity_id = apply_filters( 'bp_activity_custom_update', false, $object, $item_id, $_POST['content'] ); 939 958 } 940 959 941 960 if ( empty( $activity_id ) ) -
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 fb4f175..5632973 100644
66 66 </div> 67 67 <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> 68 68 69 <?php elseif ( bp_is_group_ home() ) : ?>69 <?php elseif ( bp_is_group_activity() ) : ?> 70 70 71 71 <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> 72 72 <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 5097547..94dc19a 100644
68 68 69 69 if ( bp_group_is_visible() ) { 70 70 71 // Use custom front if one exists 72 $custom_front = bp_locate_template( array( 'groups/single/front.php' ), false, true ); 73 if ( ! empty( $custom_front ) ) : load_template( $custom_front, true ); 74 75 // Default to activity 76 elseif ( bp_is_active( 'activity' ) ) : bp_get_template_part( 'groups/single/activity' ); 77 78 // Otherwise show members 79 elseif ( bp_is_active( 'members' ) ) : bp_groups_members_template_part(); 80 81 endif; 71 // Load appropriate front template 72 bp_groups_front_template_part(); 82 73 83 74 } else { 84 75