diff --git src/bp-activity/bp-activity-screens.php src/bp-activity/bp-activity-screens.php
index 472b4e5..7de6980 100644
|
|
function bp_activity_screen_single_activity_permalink() { |
230 | 230 | return; |
231 | 231 | } |
232 | 232 | |
233 | | // Check to see if the group is not public, if so, check the |
234 | | // user has access to see this activity. |
| 233 | // Check to see if the user has access to to the activity's parent group. |
235 | 234 | if ( $group = groups_get_group( $activity->item_id ) ) { |
236 | | |
237 | | // Group is not public. |
238 | | if ( 'public' != $group->status ) { |
239 | | |
240 | | // User is not a member of group. |
241 | | if ( !groups_is_user_member( bp_loggedin_user_id(), $group->id ) ) { |
242 | | $has_access = false; |
243 | | } |
244 | | } |
| 235 | $has_access = $group->user_has_access; |
245 | 236 | } |
246 | 237 | } |
247 | 238 | |
diff --git src/bp-groups/bp-groups-actions.php src/bp-groups/bp-groups-actions.php
index 4f80495..7d84f39 100644
|
|
function bp_groups_group_access_protection() { |
41 | 41 | |
42 | 42 | $current_group = groups_get_current_group(); |
43 | 43 | $user_has_access = $current_group->user_has_access; |
| 44 | $is_visible = $current_group->is_visible; |
44 | 45 | $no_access_args = array(); |
45 | 46 | |
46 | | if ( ! $user_has_access && 'hidden' !== $current_group->status ) { |
| 47 | // The user can know about the group but doesn't have full access. |
| 48 | if ( ! $user_has_access && $is_visible ) { |
47 | 49 | // Always allow access to home and request-membership. |
48 | 50 | if ( bp_is_current_action( 'home' ) || bp_is_current_action( 'request-membership' ) ) { |
49 | 51 | $user_has_access = true; |
… |
… |
function bp_groups_group_access_protection() { |
90 | 92 | return; |
91 | 93 | } |
92 | 94 | |
93 | | // Hidden groups should return a 404 for non-members. |
| 95 | // Groups that the user cannot know about should return a 404 for non-members. |
94 | 96 | // Unset the current group so that you're not redirected |
95 | 97 | // to the default group tab. |
96 | | if ( 'hidden' == $current_group->status ) { |
| 98 | if ( ! $is_visible ) { |
97 | 99 | buddypress()->groups->current_group = 0; |
98 | 100 | buddypress()->is_single_item = false; |
99 | 101 | bp_do_404(); |
… |
… |
function groups_action_leave_group() { |
488 | 490 | bp_core_add_message( __( 'You successfully left the group.', 'buddypress' ) ); |
489 | 491 | } |
490 | 492 | |
491 | | $redirect = bp_get_group_permalink( groups_get_current_group() ); |
| 493 | $group = groups_get_current_group(); |
| 494 | $redirect = bp_get_group_permalink( $group ); |
492 | 495 | |
493 | | if( 'hidden' == $bp->groups->current_group->status ) { |
| 496 | if ( ! $group->is_visible ) { |
494 | 497 | $redirect = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ); |
495 | 498 | } |
496 | 499 | |
diff --git src/bp-groups/bp-groups-template.php src/bp-groups/bp-groups-template.php
index ac0d315..8ae0baa 100644
|
|
function bp_group_is_visible( $group = null ) { |
485 | 485 | $group =& $groups_template->group; |
486 | 486 | } |
487 | 487 | |
488 | | if ( 'public' == $group->status ) { |
| 488 | if ( ! empty( $group->is_visible ) ) { |
489 | 489 | return true; |
490 | | } else { |
491 | | if ( groups_is_user_member( bp_loggedin_user_id(), $group->id ) ) { |
492 | | return true; |
493 | | } |
494 | 490 | } |
495 | 491 | |
496 | 492 | return false; |