Changeset 6013
- Timestamp:
- 05/03/2012 02:34:31 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-functions.php
r6012 r6013 324 324 $user_id = bp_loggedin_user_id(); 325 325 326 // Check if the user has an outstanding invite , is sodelete it.326 // Check if the user has an outstanding invite. If so, delete it. 327 327 if ( groups_check_user_has_invite( $user_id, $group_id ) ) 328 328 groups_delete_invite( $user_id, $group_id ); 329 329 330 // Check if the user has an outstanding request , is sodelete it.330 // Check if the user has an outstanding request. If so, delete it. 331 331 if ( groups_check_for_membership_request( $user_id, $group_id ) ) 332 332 groups_delete_membership_request( $user_id, $group_id ); … … 606 606 } 607 607 608 /** 609 * Process the acceptance of a group invitation. 610 * 611 * Returns true if a user is already a member of the group. 612 * 613 * @param int $user_id 614 * @param int $group_id 615 * @return bool True when the user is a member of the group, otherwise false 616 */ 608 617 function groups_accept_invite( $user_id, $group_id ) { 609 618 global $bp; 610 619 611 if ( groups_is_user_member( $user_id, $group_id ) ) 612 return false; 620 // If the user is already a member (because BP at one point allowed two invitations to 621 // slip through), delete all existing invitations/requests and return true 622 if ( groups_is_user_member( $user_id, $group_id ) ) { 623 if ( groups_check_user_has_invite( $user_id, $group_id ) ) 624 groups_delete_invite( $user_id, $group_id ); 625 626 if ( groups_check_for_membership_request( $user_id, $group_id ) ) 627 groups_delete_membership_request( $user_id, $group_id ); 628 629 return true; 630 } 613 631 614 632 $member = new BP_Groups_Member( $user_id, $group_id );
Note: See TracChangeset
for help on using the changeset viewer.