Ticket #6388: 6388.patch
File 6388.patch, 8.3 KB (added by , 9 years ago) |
---|
-
src/bp-groups/bp-groups-loader.php
diff --git src/bp-groups/bp-groups-loader.php src/bp-groups/bp-groups-loader.php index 58addca..21348fb 100644
class BP_Groups_Component extends BP_Component { 244 244 $this->current_group->user_has_access = true; 245 245 } 246 246 247 // Check once if the current group has a custom front template 248 $this->current_group->front_template = bp_groups_get_group_front_template( $this->current_group ); 249 247 250 // Set current_group to 0 to prevent debug errors 248 251 } else { 249 252 $this->current_group = 0; … … class BP_Groups_Component extends BP_Component { 356 359 */ 357 360 $this->default_extension = apply_filters( 'bp_groups_default_extension', defined( 'BP_GROUPS_DEFAULT_EXTENSION' ) ? BP_GROUPS_DEFAULT_EXTENSION : 'home' ); 358 361 362 // If the activity component is not active and the current group has no custom front, members are displayed in the home nav 363 if ( 'members' === $this->default_extension && ! bp_is_active( 'activity' ) && ! $this->current_group->front_template ) { 364 $this->default_extension = 'home'; 365 } 366 359 367 if ( !bp_current_action() ) { 360 368 buddypress()->current_action = $this->default_extension; 361 369 } … … class BP_Groups_Component extends BP_Component { 511 519 ); 512 520 } 513 521 514 $sub_nav[] = array( 515 'name' => sprintf( _x( 'Members <span>%s</span>', 'My Group screen nav', 'buddypress' ), number_format( $this->current_group->total_member_count ) ), 516 'slug' => 'members', 517 'parent_url' => $group_link, 518 'parent_slug' => $this->current_group->slug, 519 'screen_function' => 'groups_screen_group_members', 520 'position' => 60, 521 'user_has_access' => $this->current_group->user_has_access, 522 'item_css_id' => 'members', 523 'no_access_url' => $group_link, 524 ); 522 if ( $this->current_group->front_template || bp_is_active( 'activity' ) ) { 523 /** 524 * Only add the members subnav if it's not the home's nav 525 */ 526 $sub_nav[] = array( 527 'name' => sprintf( _x( 'Members <span>%s</span>', 'My Group screen nav', 'buddypress' ), number_format( $this->current_group->total_member_count ) ), 528 'slug' => 'members', 529 'parent_url' => $group_link, 530 'parent_slug' => $this->current_group->slug, 531 'screen_function' => 'groups_screen_group_members', 532 'position' => 60, 533 'user_has_access' => $this->current_group->user_has_access, 534 'item_css_id' => 'members', 535 'no_access_url' => $group_link, 536 ); 537 538 /** 539 * If the theme is using a custom front, create 540 * an activity nav 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' => 50, 550 'user_has_access' => $this->current_group->user_has_access, 551 'item_css_id' => 'activity', 552 'no_access_url' => $group_link, 553 ); 554 } 555 } 525 556 526 557 if ( bp_is_active( 'friends' ) && bp_groups_user_can_send_invites() ) { 527 558 $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 a21fcb5..82c6ad6 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 BuddyPress (?) 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 BuddyPress (?) 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 BuddyPress (?) 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 e6921a0..a238e6c 100644
function bp_group_has_members( $args = '' ) { 3752 3752 global $members_template; 3753 3753 3754 3754 $exclude_admins_mods = 1; 3755 $current_group = groups_get_current_group(); 3755 3756 3756 if ( bp_is_group_members() ) {3757 if ( bp_is_group_members() || ( empty( $current_group->front_template ) && ! bp_is_active( 'activity' ) && bp_is_group_home() ) ) { 3757 3758 $exclude_admins_mods = 0; 3758 3759 } 3759 3760 … … function bp_group_member_admin_pagination() { 4151 4152 } 4152 4153 4153 4154 /** 4155 * Load the appropriate current group's home page 4156 * 4157 * @since BuddyPress (?) 4158 */ 4159 function bp_groups_load_group_front_template( $require_once = false, $group = null ) { 4160 $located = bp_groups_get_group_front_template( $group ); 4161 4162 if ( false !== $located ) { 4163 $slug = str_replace( '.php', '', $located ); 4164 4165 /** 4166 * Let plugins adding an action to bp_get_template_part get it from here 4167 * 4168 * @param string $slug Template part slug requested. 4169 * @param string $name Template part name requested. 4170 */ 4171 do_action( 'get_template_part_' . $slug, $slug, false ); 4172 4173 load_template( $located, $require_once ); 4174 4175 } else if ( bp_is_active( 'activity' ) ) { 4176 bp_get_template_part( 'groups/single/activity' ); 4177 4178 } else if ( bp_is_active( 'members' ) ) { 4179 bp_groups_members_template_part(); 4180 } 4181 4182 return $located; 4183 } 4184 4185 /** 4186 * Locate a custom group front template if it exsists 4187 * 4188 * @since BuddyPress (?) 4189 */ 4190 function bp_groups_get_group_front_template( $group = null ) { 4191 if ( ! is_a( $group, 'BP_Groups_Group' ) ) { 4192 $group = groups_get_current_group(); 4193 } 4194 4195 if ( ! isset( $group->id ) ) { 4196 return false; 4197 } 4198 4199 if ( isset( $group->front_template ) ) { 4200 return $group->front_template; 4201 } 4202 4203 $template_names = apply_filters( 'bp_groups_get_front_template', array( 4204 'groups/single/front-id-' . sanitize_file_name( $group->id ) . '.php', 4205 'groups/single/front-slug-' . sanitize_file_name( $group->slug ) . '.php', 4206 'groups/single/front-status-' . sanitize_file_name( $group->status ) . '.php', 4207 'groups/single/front.php' 4208 ) ); 4209 4210 return bp_locate_template( $template_names, false, true ); 4211 } 4212 4213 /** 4154 4214 * Output the Group members template 4155 4215 * 4156 4216 * @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 12023a8..4ea132c 100644
65 65 </div> 66 66 <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> 67 67 68 <?php elseif ( bp_is_group_home() ) : ?>68 <?php elseif ( bp_is_group_home() || bp_is_group_activity() ) : ?> 69 69 70 70 <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> 71 71 <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 f22e339..7139418 100644
38 38 39 39 if ( bp_group_is_visible() ) { 40 40 41 // Use custom front if one exists 42 $custom_front = bp_locate_template( array( 'groups/single/front.php' ), false, true ); 43 if ( ! empty( $custom_front ) ) : load_template( $custom_front, true ); 44 45 // Default to activity 46 elseif ( bp_is_active( 'activity' ) ) : bp_get_template_part( 'groups/single/activity' ); 47 48 // Otherwise show members 49 elseif ( bp_is_active( 'members' ) ) : bp_groups_members_template_part(); 50 51 endif; 41 // Load appropriate front template 42 bp_groups_load_group_front_template(); 52 43 53 44 } else { 54 45