Ticket #7610: 7610.groups_request_membership.patch
File 7610.groups_request_membership.patch, 1.3 KB (added by , 6 years ago) |
---|
-
src/bp-groups/bp-groups-filters.php
232 232 break; 233 233 } 234 234 235 // Set to false to begin with. 236 $retval = false; 237 235 238 /* 236 239 * The group must accept membership requests, and the user should not 237 240 * currently be a member, have an active request, or be banned. -
tests/phpunit/testcases/groups/user_can.php
368 368 $this->assertTrue( bp_user_can( $u1, 'groups_see_group', array( 'group_id' => $g1 ) ) ); 369 369 } 370 370 371 /** 372 * @ticket BP7610 373 */ 374 public function test_user_can_groups_request_membership_for_super_admin() { 375 if ( ! is_multisite() ) { 376 return; 377 } 378 379 $g1 = $this->factory->group->create( array( 380 'status' => 'public' 381 ) ); 382 $u1 = $this->factory->user->create(); 383 $this->add_user_to_group( $u1, $g1 ); 384 385 // Grant super admin status. 386 grant_super_admin( $u1 ); 387 388 // Assert false since public groups shouldn't be able to request membership. 389 $this->assertFalse( bp_user_can( $u1, 'groups_request_membership', array( 'group_id' => $g1 ) ) ); 390 } 371 391 }