diff --git src/bp-groups/classes/class-bp-groups-component.php src/bp-groups/classes/class-bp-groups-component.php
index 8515a5b..1df6542 100644
|
|
class BP_Groups_Component extends BP_Component { |
242 | 242 | bp_update_is_item_mod ( groups_is_user_mod ( bp_loggedin_user_id(), $this->current_group->id ), 'groups' ); |
243 | 243 | } |
244 | 244 | |
245 | | // Is the logged in user a member of the group? |
246 | | if ( ( is_user_logged_in() && groups_is_user_member( bp_loggedin_user_id(), $this->current_group->id ) ) ) { |
247 | | $this->current_group->is_user_member = true; |
248 | | } else { |
249 | | $this->current_group->is_user_member = false; |
250 | | } |
251 | | |
252 | | // Should this group be visible to the logged in user? |
253 | | if ( 'public' == $this->current_group->status || $this->current_group->is_user_member ) { |
254 | | $this->current_group->is_visible = true; |
255 | | } else { |
256 | | $this->current_group->is_visible = false; |
257 | | } |
258 | | |
259 | 245 | // Check once if the current group has a custom front template. |
260 | 246 | $this->current_group->front_template = bp_groups_get_front_template( $this->current_group ); |
261 | 247 | |
… |
… |
class BP_Groups_Component extends BP_Component { |
557 | 543 | // member and does not have an outstanding invitation, |
558 | 544 | // show a "Request Membership" nav item. |
559 | 545 | if ( is_user_logged_in() && |
560 | | ! $this->current_group->is_user_member && |
| 546 | ! $this->current_group->is_member && |
561 | 547 | ! groups_check_for_membership_request( bp_loggedin_user_id(), $this->current_group->id ) && |
562 | 548 | $this->current_group->status == 'private' && |
563 | 549 | ! groups_check_user_has_invite( bp_loggedin_user_id(), $this->current_group->id ) |
diff --git src/bp-groups/classes/class-bp-groups-group.php src/bp-groups/classes/class-bp-groups-group.php
index a851750..1eee026 100644
|
|
class BP_Groups_Group { |
126 | 126 | protected $is_member; |
127 | 127 | |
128 | 128 | /** |
| 129 | * Is the current user a member of this group? |
| 130 | * Alias of $is_member for backward compatibility. |
| 131 | * |
| 132 | * @since 2.9.0 |
| 133 | * @var bool |
| 134 | */ |
| 135 | protected $is_user_member; |
| 136 | |
| 137 | /** |
129 | 138 | * Does the current user have an outstanding invitation to this group? |
130 | 139 | * |
131 | 140 | * @since 1.9.0 |
… |
… |
class BP_Groups_Group { |
158 | 167 | protected $user_has_access; |
159 | 168 | |
160 | 169 | /** |
| 170 | * Can the current user know that this group exists? |
| 171 | * |
| 172 | * @since 2.9.0 |
| 173 | * @var bool |
| 174 | */ |
| 175 | protected $is_visible; |
| 176 | |
| 177 | /** |
161 | 178 | * Raw arguments passed to the constructor. |
162 | 179 | * |
163 | 180 | * @since 2.0.0 |
… |
… |
class BP_Groups_Group { |
416 | 433 | return $this->get_mods(); |
417 | 434 | |
418 | 435 | case 'is_member' : |
| 436 | case 'is_user_member' : |
419 | 437 | return $this->get_is_member(); |
420 | 438 | |
421 | 439 | case 'is_invited' : |
… |
… |
class BP_Groups_Group { |
427 | 445 | case 'user_has_access' : |
428 | 446 | return $this->get_user_has_access(); |
429 | 447 | |
| 448 | case 'is_visible' : |
| 449 | return $this->is_visible(); |
| 450 | |
430 | 451 | default : |
431 | 452 | return isset( $this->{$key} ) ? $this->{$key} : null; |
432 | 453 | } |
… |
… |
class BP_Groups_Group { |
448 | 469 | case 'admins' : |
449 | 470 | case 'is_invited' : |
450 | 471 | case 'is_member' : |
| 472 | case 'is_user_member' : |
451 | 473 | case 'is_pending' : |
452 | 474 | case 'last_activity' : |
453 | 475 | case 'mods' : |
454 | 476 | case 'total_member_count' : |
455 | 477 | case 'user_has_access' : |
| 478 | case 'is_visible' : |
456 | 479 | case 'forum_id' : |
457 | 480 | return true; |
458 | 481 | |
… |
… |
class BP_Groups_Group { |
604 | 627 | return $this->user_has_access; |
605 | 628 | } |
606 | 629 | |
| 630 | /** |
| 631 | * Checks whether the current user can know the group exists. |
| 632 | * |
| 633 | * @since 2.9.0 |
| 634 | * |
| 635 | * @return bool |
| 636 | */ |
| 637 | protected function is_visible() { |
| 638 | if ( isset( $this->is_visible ) ) { |
| 639 | return $this->is_visible; |
| 640 | } |
| 641 | |
| 642 | if ( 'hidden' === $this->status ) { |
| 643 | |
| 644 | // Assume user can not know about hidden groups. |
| 645 | $this->is_visible = false; |
| 646 | |
| 647 | // Group members or community moderators have access. |
| 648 | if ( ( is_user_logged_in() && $this->get_is_member() ) || bp_current_user_can( 'bp_moderate' ) ) { |
| 649 | $this->is_visible = true; |
| 650 | } |
| 651 | } else { |
| 652 | $this->is_visible = true; |
| 653 | } |
| 654 | |
| 655 | return $this->is_visible; |
| 656 | } |
| 657 | |
607 | 658 | /** Static Methods ****************************************************/ |
608 | 659 | |
609 | 660 | /** |