Ticket #7423: 7423.01.patch
File 7423.01.patch, 2.5 KB (added by , 8 years ago) |
---|
-
src/bp-groups/bp-groups-screens.php
21 21 */ 22 22 function groups_directory_groups_setup() { 23 23 if ( bp_is_groups_directory() ) { 24 // Set group type if available.25 if ( bp_is_current_action( bp_get_groups_group_type_base() ) && bp_action_variable() ) {26 $matched_types = bp_groups_get_group_types( array(27 'has_directory' => true,28 'directory_slug' => bp_action_variable(),29 ) );30 31 // Redirect back to group directory if no match.32 if ( empty( $matched_types ) ) {33 bp_core_redirect( bp_get_groups_directory_permalink() );34 }35 36 // Set our global variable.37 buddypress()->groups->current_directory_type = reset( $matched_types );38 }39 40 24 bp_update_is_directory( true, 'groups' ); 41 25 42 26 /** -
src/bp-groups/classes/class-bp-groups-component.php
267 267 $this->current_group = 0; 268 268 } 269 269 270 // Set group type if available. 271 if ( bp_is_groups_directory() && bp_is_current_action( bp_get_groups_group_type_base() ) && bp_action_variable() ) { 272 $matched_types = bp_groups_get_group_types( array( 273 'has_directory' => true, 274 'directory_slug' => bp_action_variable(), 275 ) ); 276 277 // Redirect back to group directory if no match. 278 if ( empty( $matched_types ) ) { 279 add_action( 'bp_template_redirect', function() { 280 bp_core_redirect( bp_get_groups_directory_permalink() ); 281 } ); 282 } 283 284 // Set our directory type marker. 285 $this->current_directory_type = reset( $matched_types ); 286 } 287 270 288 // Set up variables specific to the group creation process. 271 289 if ( bp_is_groups_component() && bp_is_current_action( 'create' ) && bp_user_can_create_groups() && isset( $_COOKIE['bp_new_group_id'] ) ) { 272 290 $bp->groups->new_group_id = (int) $_COOKIE['bp_new_group_id']; … … 297 315 ) ); 298 316 299 317 // If the user was attempting to access a group, but no group by that name was found, 404. 300 if ( bp_is_groups_component() && empty( $this->current_group ) && bp_current_action() && !in_array( bp_current_action(), $this->forbidden_names ) ) {318 if ( bp_is_groups_component() && empty( $this->current_group ) && empty( $this->current_directory_type ) && bp_current_action() && ! in_array( bp_current_action(), $this->forbidden_names ) ) { 301 319 bp_do_404(); 302 320 return; 303 321 }