Changeset 9811
- Timestamp:
- 04/27/2015 07:10:10 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-functions.php
r9810 r9811 432 432 } 433 433 434 // This is exactly the same as deleting an invite, just is_confirmed = 1 NOT 0. 435 if ( !groups_uninvite_user( $user_id, $group_id ) ) { 434 if ( ! groups_remove_member( $user_id, $group_id ) ) { 436 435 return false; 437 436 } … … 1406 1405 function groups_remove_member( $user_id, $group_id ) { 1407 1406 1408 if ( ! bp_is_item_admin() ) 1409 return false; 1407 if ( ! bp_is_item_admin() ) { 1408 // bp_is_item_admin may not be set if this function is called outside of group context. 1409 // Site admins and group admins can remove a member from a group. 1410 // A member may also request to remove herself from a group. 1411 if ( ! current_user_can( 'bp_moderate' ) 1412 && ! groups_is_user_admin( bp_loggedin_user_id(), $group_id ) 1413 && $user_id != bp_loggedin_user_id() ) { 1414 return false; 1415 } 1416 } 1410 1417 1411 1418 $member = new BP_Groups_Member( $user_id, $group_id ); -
trunk/tests/phpunit/testcases/groups/functions.php
r9654 r9811 38 38 groups_join_group( $g2, $u2 ); 39 39 40 // Set the current user so the leave group request goes through. 41 $this->set_current_user( $u2 ); 40 42 groups_leave_group( $g1, $u2 ); 41 43 $this->assertEquals( 1, bp_get_user_meta( $u2, 'total_group_count', true ) );
Note: See TracChangeset
for help on using the changeset viewer.