Skip to:
Content

BuddyPress.org

Changeset 13160


Ignore:
Timestamp:
12/04/2021 03:18:04 PM (5 years ago)
Author:
imath
Message:

Legacy: allow invited users to join a group from the Groups Directory

Unlike BP Nouveau, the BP Legacy Template pack wasn't allowing an invited user to directly join a group from the Groups Directory. They had to accept the Group invites. Both template pack are now behaving the same, leaving users to directly join a group without replying to the corresponding group invite.

Props mandro

Fixes #8574

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-legacy/buddypress-functions.php

    r13108 r13160  
    15371537        $group_id = (int) $_POST['gid'];
    15381538
    1539         if ( groups_is_user_banned( bp_loggedin_user_id(), $group_id ) )
    1540                 return;
    1541 
    1542         if ( ! $group = groups_get_group( $group_id ) )
    1543                 return;
     1539        if ( groups_is_user_banned( bp_loggedin_user_id(), $group_id ) ) {
     1540                return;
     1541        }
     1542
     1543        $group = groups_get_group( $group_id );
     1544
     1545        if ( ! $group ) {
     1546                return;
     1547        }
     1548
     1549        $action = '';
     1550        if ( isset( $_POST['action'] ) ) {
     1551                $action = sanitize_key( wp_unslash( $_POST['action'] ) );
     1552        }
    15441553
    15451554        // Client doesn't distinguish between different request types, so we infer from user status.
    15461555        if ( groups_is_user_member( bp_loggedin_user_id(), $group->id ) ) {
    15471556                $request_type = 'leave_group';
    1548         } elseif ( groups_check_user_has_invite( bp_loggedin_user_id(), $group->id ) ) {
     1557        } elseif ( groups_check_user_has_invite( bp_loggedin_user_id(), $group->id ) && 'joinleave_group' !== $action ) {
    15491558                $request_type = 'accept_invite';
    15501559        } elseif ( 'private' === $group->status ) {
Note: See TracChangeset for help on using the changeset viewer.