Changeset 11544 for trunk/src/bp-groups/classes/class-bp-groups-group.php
- Timestamp:
- 04/28/2017 02:36:15 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/classes/class-bp-groups-group.php
r11533 r11544 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 * … … 157 166 */ 158 167 protected $user_has_access; 168 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; 159 176 160 177 /** … … 417 434 418 435 case 'is_member' : 436 case 'is_user_member' : 419 437 return $this->get_is_member(); 420 438 … … 427 445 case 'user_has_access' : 428 446 return $this->get_user_has_access(); 447 448 case 'is_visible' : 449 return $this->is_visible(); 429 450 430 451 default : … … 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' : … … 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; … … 606 629 607 630 return $this->user_has_access; 631 } 632 633 /** 634 * Checks whether the current user can know the group exists. 635 * 636 * @since 2.9.0 637 * 638 * @return bool 639 */ 640 protected function is_visible() { 641 if ( isset( $this->is_visible ) ) { 642 return $this->is_visible; 643 } 644 645 if ( 'hidden' === $this->status ) { 646 647 // Assume user can not know about hidden groups. 648 $this->is_visible = false; 649 650 // Group members or community moderators have access. 651 if ( ( is_user_logged_in() && $this->get_is_member() ) || bp_current_user_can( 'bp_moderate' ) ) { 652 $this->is_visible = true; 653 } 654 } else { 655 $this->is_visible = true; 656 } 657 658 return $this->is_visible; 608 659 } 609 660
Note: See TracChangeset
for help on using the changeset viewer.