Changeset 13874
- Timestamp:
- 05/26/2024 04:56:49 AM (9 months ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-functions.php
r13873 r13874 662 662 $group = bp_get_group( $group ); 663 663 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' ) ) { 665 673 return false; 666 674 } -
trunk/tests/phpunit/includes/factory.php
r13414 r13874 94 94 95 95 $this->default_generation_definitions = array( 96 'name' => new WP_UnitTest_Generator_Sequence( 'Group %s' ), 97 'description' => new WP_UnitTest_Generator_Sequence( 'Group description %s' ), 98 'slug' => new WP_UnitTest_Generator_Sequence( 'group-slug-%s' ), 99 'status' => 'public', 100 'enable_forum' => true, 101 'date_created' => bp_core_current_time(), 96 'name' => new WP_UnitTest_Generator_Sequence( 'Group %s' ), 97 'description' => new WP_UnitTest_Generator_Sequence( 'Group description %s' ), 98 'slug' => new WP_UnitTest_Generator_Sequence( 'group-slug-%s' ), 99 'status' => 'public', 100 'enable_forum' => true, 101 'date_created' => bp_core_current_time(), 102 'invite_status' => 'members', 102 103 ); 103 104 } … … 131 132 $last_activity = isset( $args['last_activity'] ) ? $args['last_activity'] : bp_core_current_time(); 132 133 groups_update_groupmeta( $group_id, 'last_activity', $last_activity ); 134 groups_update_groupmeta( $group_id, 'invite_status', $args['invite_status'] ); 135 133 136 134 137 return $group_id; -
trunk/tests/phpunit/testcases/groups/cache.php
r13592 r13874 42 42 $time, 43 43 ), 44 'invite_status' => array( 45 'members', 46 ), 44 47 'foo' => array( 45 48 'bar', … … 52 55 'last_activity' => array( 53 56 $time, 57 ), 58 'invite_status' => array( 59 'members', 54 60 ), 55 61 'foo' => array( -
trunk/tests/phpunit/testcases/groups/class-bp-groups-member.php
r13437 r13874 208 208 // Test with no status 209 209 // In bp_group_get_invite_status(), no status falls back to "members" 210 $this->assertTrue( '' == groups_get_groupmeta( $g, 'invite_status' ) );211 210 $this->assertFalse( bp_groups_user_can_send_invites( $g, $u_nonmembers ) ); 212 211 $this->assertTrue( bp_groups_user_can_send_invites( $g, $u_members ) );
Note: See TracChangeset
for help on using the changeset viewer.