diff --git src/bp-members/classes/class-bp-members-component.php src/bp-members/classes/class-bp-members-component.php
index 9d6b3d831..8047d2e76 100644
|
|
|
class BP_Members_Component extends BP_Component { |
| 1014 | 1014 | } |
| 1015 | 1015 | |
| 1016 | 1016 | if ( ! $single_item_action || ! $screen_function || ! is_callable( $screen_function ) ) { |
| | 1017 | /* |
| | 1018 | * Before returning 404, check if this is a valid nav item that exists |
| | 1019 | * but the user doesn't have access to. In that case, redirect to login |
| | 1020 | * instead of showing 404. This fixes the issue where non-logged-in users |
| | 1021 | * clicking invitation links get 404 instead of login redirect. |
| | 1022 | * |
| | 1023 | * @since 15.0.0 |
| | 1024 | * @see https://buddypress.trac.wordpress.org/ticket/8712 |
| | 1025 | */ |
| | 1026 | if ( $single_item_action && ! is_user_logged_in() ) { |
| | 1027 | $sub_nav_item = $this->nav->get( $single_item_component . '/' . $single_item_action ); |
| | 1028 | |
| | 1029 | // If nav item exists but user doesn't have access, redirect to login. |
| | 1030 | if ( $sub_nav_item && isset( $sub_nav_item->user_has_access ) && false === $sub_nav_item->user_has_access ) { |
| | 1031 | bp_core_no_access(); |
| | 1032 | return; |
| | 1033 | } |
| | 1034 | } |
| | 1035 | |
| 1017 | 1036 | bp_do_404(); |
| 1018 | 1037 | return; |
| 1019 | 1038 | } |
| … |
… |
class BP_Members_Component extends BP_Component { |
| 1029 | 1048 | ); |
| 1030 | 1049 | |
| 1031 | 1050 | if ( ! $sub_nav ) { |
| | 1051 | /* |
| | 1052 | * Before returning 404, check if this is a valid nav item that exists |
| | 1053 | * but the user doesn't have access to. Redirect to login instead of 404. |
| | 1054 | * |
| | 1055 | * @since 15.0.0 |
| | 1056 | * @see https://buddypress.trac.wordpress.org/ticket/8712 |
| | 1057 | */ |
| | 1058 | if ( $single_item_action && ! is_user_logged_in() ) { |
| | 1059 | $nav_item = $this->nav->get( $single_item_component . '/' . $single_item_action ); |
| | 1060 | |
| | 1061 | if ( $nav_item && isset( $nav_item->user_has_access ) && false === $nav_item->user_has_access ) { |
| | 1062 | bp_core_no_access(); |
| | 1063 | return; |
| | 1064 | } |
| | 1065 | } |
| | 1066 | |
| 1032 | 1067 | bp_do_404(); |
| 1033 | 1068 | return; |
| 1034 | 1069 | } |