Skip to:
Content

BuddyPress.org

Changeset 11896


Ignore:
Timestamp:
03/07/2018 12:56:49 PM (7 years ago)
Author:
dcavins
Message:

Revert bp_group_is_visible() to check access.

In r11761, bp_group_is_visible() was changed to rely on the BP_Groups_Group->is_visible property. However, bp_group_is_visible() has been used to check access, not visibility, making the new logic, even though it seems sensible, wrong.

This changeset also replaces bp_group_is_visible() in the BP Nouveau template parts, to start retiring this no-longer-correctly-named function.

Props r-a-y.

See #7608.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-template.php

    r11828 r11896  
    468468
    469469/**
    470  * Is the group visible to the currently logged-in user?
     470 * Is the group accessible to the currently logged-in user?
     471 * Despite the name of the function, it has historically checked
     472 * whether a user has access to a group.
     473 * In BP 2.9, a property was added to the BP_Groups_Group class,
     474 * `is_visible`, that describes whether a user can know the group exists.
     475 * If you wish to check that property, use the check:
     476 * bp_current_user_can( 'groups_see_group' ).
    471477 *
    472478 * @since 1.0.0
     
    486492    }
    487493
    488     if ( ! empty( $group->is_visible ) ) {
    489         return true;
    490     }
    491 
    492     return false;
     494    return bp_current_user_can( 'groups_access_group', array( 'group_id' => $group->id ) );
    493495}
    494496
  • trunk/src/bp-templates/bp-nouveau/buddypress/groups/single/parts/header-item-actions.php

    r11861 r11896  
    88<div id="item-actions" class="group-item-actions">
    99
    10     <?php if ( bp_group_is_visible() ) : ?>
     10    <?php if ( bp_current_user_can( 'groups_access_group' ) ) : ?>
    1111
    1212        <dl class="moderators-lists">
  • trunk/src/bp-templates/bp-nouveau/includes/groups/template-tags.php

    r11856 r11896  
    11541154    $bp_is_group_home = bp_is_group_home();
    11551155
    1156     if ( $bp_is_group_home && ! bp_group_is_visible() ) {
     1156    if ( $bp_is_group_home && ! bp_current_user_can( 'groups_access_group' ) ) {
    11571157        /**
    11581158         * Fires before the display of the group status message.
Note: See TracChangeset for help on using the changeset viewer.