Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/26/2024 04:56:49 AM (19 months ago)
Author:
imath
Message:

Groups: joining a group needs to wait for group status to be defined

When the group create first step is completed, the group's status has not been defined by the group creator yet and defaults to public. As the group status & the invite status are set once the group create second step is completed, we need to wait for this step to be achieved to let users join the group being created otherwise it would be possible for a user to "pre-join" a private/hidden group. Checking if the invite status is set is the only way to make sure this second step has been completed. If it's not the case, no need to go further in groups_join_group().

Fixes #9162
Closes https://github.com/buddypress/buddypress/pull/294

File:
1 edited

Legend:

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

    r13873 r13874  
    662662    $group = bp_get_group( $group );
    663663
    664     if ( empty( $group->id ) ) {
     664    /*
     665     * When the group create first step is completed, the group's status has not been defined by the
     666     * group creator yet and defaults to public. As the group status & the invite status are set once
     667     * the group create second step is completed, we need to wait for this step to be achieved to let
     668     * users join the group being created otherwise it would be possible for a user to "pre-join" a
     669     * private/hidden group. Checking if the invite status is set is the only way to make sure this
     670     * second step has been completed. If it's not the case, no need to go further.
     671     */
     672    if ( empty( $group->id ) || ! groups_get_groupmeta( $group->id, 'invite_status' ) ) {
    665673        return false;
    666674    }
Note: See TracChangeset for help on using the changeset viewer.