Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/31/2017 08:31:10 PM (8 years ago)
Author:
r-a-y
Message:

Groups: Fix AJAX pagination when on a group type directory page.

This commit moves group type directory detection from the
'template_redirect' hook to our groups component class to ensure
detection is available for AJAX purposes.

Commit also changes invalid group type directory requests to 404 instead
of redirecting back to the main Groups directory.

Props r-a-y, dcavins.

Fixes #7423.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-screens.php

    r11360 r11405  
    2222function groups_directory_groups_setup() {
    2323    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 
    4024        bp_update_is_directory( true, 'groups' );
    4125
Note: See TracChangeset for help on using the changeset viewer.