Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/14/2017 01:24:01 PM (6 years ago)
Author:
dcavins
Message:

Use bp_user_can for group-related permissions.

Centralize and de-duplicate permissions checks for group-related functions, like checking whether a user can join a group or send invitations from a group.

Props dcavins, djpaul.

Fixes #7610.

File:
1 edited

Legend:

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

    r11763 r11776  
    421421
    422422        // User wants to join a group that is not public.
    423         if ( $bp->groups->current_group->status != 'public' ) {
     423        if ( bp_current_user_can( 'groups_join_group', array( 'group_id' => $bp->groups->current_group->id ) ) ) {
    424424            if ( !groups_check_user_has_invite( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) {
    425425                bp_core_add_message( __( 'There was an error joining the group.', 'buddypress' ), 'error' );
Note: See TracChangeset for help on using the changeset viewer.