Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/28/2017 02:36:15 PM (8 years ago)
Author:
dcavins
Message:

Add $is_visible and $is_user_member properties to BP_Groups_Group object.

During single group setup in the BP_Groups_Component, we're doing
some checks that duplicate logic that is, or should be, handled in
BP_Groups_Group. Then, BP_Groups_Component can rely on
BP_Groups_Group to provide the details via recently added magic
methods.

Note: $is_user_member is an alias of $is_member for backward
compatibility.

Fixes #7494.

File:
1 edited

Legend:

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

    r11405 r11544  
    241241            if ( ! bp_is_item_admin() ) {
    242242                bp_update_is_item_mod  ( groups_is_user_mod  ( bp_loggedin_user_id(), $this->current_group->id ), 'groups' );
    243             }
    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;
    257243            }
    258244
     
    558544            // show a "Request Membership" nav item.
    559545            if ( is_user_logged_in() &&
    560                  ! $this->current_group->is_user_member &&
     546                 ! $this->current_group->is_member &&
    561547                 ! groups_check_for_membership_request( bp_loggedin_user_id(), $this->current_group->id ) &&
    562548                 $this->current_group->status == 'private' &&
Note: See TracChangeset for help on using the changeset viewer.