Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/29/2023 01:50:21 AM (3 years ago)
Author:
imath
Message:

Improve 404 management in BP_Members_Component::check_parsed_query()

  • Make sure to do a 404 if corresponding Members primary navigation does not exist.
  • Take in account Members navigations not generated by a BP Component.

Fixes #8932

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/classes/class-bp-members-component.php

    r13618 r13621  
    998998
    999999                        $bp = buddypress();
     1000                        if ( ! bp_is_active( $single_item_component ) && ! $bp->members->nav->get_primary( array( 'slug' => $single_item_component ), false ) ) {
     1001                                bp_do_404();
     1002                                return;
     1003                        }
     1004
     1005                        // Navigation is generated by a component.
    10001006                        if ( isset( $bp->{$single_item_component} ) ) {
    10011007                                $screen_function = '';
     
    10191025
    10201026                                if ( ! $single_item_action || ! $screen_function || ! is_callable( $screen_function ) ) {
     1027                                        bp_do_404();
     1028                                        return;
     1029                                }
     1030
     1031                                // Navigation is not generated by a component.
     1032                        } else {
     1033                                $sub_nav = $bp->members->nav->get_secondary(
     1034                                        array(
     1035                                                'parent_slug' => $single_item_component,
     1036                                                'slug'        => $single_item_action,
     1037                                        ),
     1038                                        false
     1039                                );
     1040
     1041                                if ( ! $sub_nav ) {
    10211042                                        bp_do_404();
    10221043                                        return;
Note: See TracChangeset for help on using the changeset viewer.