Ticket #5032: 5032.001.2.diff
File 5032.001.2.diff, 4.9 KB (added by , 12 years ago) |
---|
-
bp-groups/bp-groups-functions.php
615 615 return false; 616 616 617 617 if ( !groups_is_user_member( $user_id, $group_id ) && !groups_check_user_has_invite( $user_id, $group_id, 'all' ) ) { 618 619 // Check if the user already requested members - if so, simply accept membership request 620 if ( $membership_id = groups_check_for_membership_request ( $user_id, $group_id ) ) { 621 groups_accept_membership_request ($membership_id, $user_id, $group_id); 622 return true; 623 } 624 618 625 $invite = new BP_Groups_Member; 619 626 $invite->group_id = $group_id; 620 627 $invite->user_id = $user_id; … … 833 840 if ( groups_is_user_member( $requesting_user_id, $group_id ) || groups_is_user_banned( $requesting_user_id, $group_id ) ) 834 841 return false; 835 842 843 // Check if the user is already invited - if so, simply accept invite 844 if ( groups_check_user_has_invite ( $requesting_user_id, $group_id ) ) { 845 groups_accept_invite ( $requesting_user_id, $group_id ); 846 return true; 847 } 848 836 849 $requesting_user = new BP_Groups_Member; 837 850 $requesting_user->group_id = $group_id; 838 851 $requesting_user->user_id = $requesting_user_id; -
bp-groups/bp-groups-screens.php
467 467 if ( 'private' != $bp->groups->current_group->status ) 468 468 return false; 469 469 470 // If the user is already invited, accept invitation 471 if ( groups_check_user_has_invite ( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) { 472 groups_accept_invite ( bp_loggedin_user_id(), $bp->groups->current_group->id ); 473 bp_core_add_message( __( 'Group invite accepted', 'buddypress' ) ); 474 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) ); 475 } 476 470 477 // If the user has submitted a request, send it. 471 478 if ( isset( $_POST['group-request-send']) ) { 472 479 -
bp-templates/bp-legacy/buddypress-functions.php
1004 1004 } elseif ( 'private' == $group->status ) { 1005 1005 check_ajax_referer( 'groups_request_membership' ); 1006 1006 1007 if ( ! groups_send_membership_request( bp_loggedin_user_id(), $group->id ) ) { 1007 if ( groups_check_user_has_invite ( bp_loggedin_user_id(), $groups->id ) ) { 1008 if ( ! groups_accept_invite ( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) { 1009 _e( 'Error requesting membership', 'buddypress' ); 1010 } else { 1011 echo '<a id="group-' . esc_attr( $group->id ) . '" class="leave-group" rel="leave" title="' . __( 'Leave Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>'; 1012 } 1013 } elseif ( ! groups_send_membership_request( bp_loggedin_user_id(), $group->id ) ) { 1008 1014 _e( 'Error requesting membership', 'buddypress' ); 1009 1015 } else { 1010 1016 echo '<a id="group-' . esc_attr( $group->id ) . '" class="membership-requested" rel="membership-requested" title="' . __( 'Membership Requested', 'buddypress' ) . '" href="' . bp_get_group_permalink( $group ) . '">' . __( 'Membership Requested', 'buddypress' ) . '</a>'; -
bp-themes/bp-default/_inc/ajax.php
719 719 } elseif ( 'private' == $group->status ) { 720 720 check_ajax_referer( 'groups_request_membership' ); 721 721 722 if ( ! groups_send_membership_request( bp_loggedin_user_id(), $group->id ) ) { 722 if ( groups_check_user_has_invite ( bp_loggedin_user_id(), $groups->id ) ) { 723 if ( ! groups_accept_invite ( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) { 724 _e( 'Error requesting membership', 'buddypress' ); 725 } else { 726 echo '<a id="group-' . esc_attr( $group->id ) . '" class="leave-group" rel="leave" title="' . __( 'Leave Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>'; 727 } 728 } elseif ( ! groups_send_membership_request( bp_loggedin_user_id(), $group->id ) ) { 723 729 _e( 'Error requesting membership', 'buddypress' ); 724 730 } else { 725 731 echo '<a id="group-' . esc_attr( $group->id ) . '" class="membership-requested" rel="membership-requested" title="' . __( 'Membership Requested', 'buddypress' ) . '" href="' . bp_get_group_permalink( $group ) . '">' . __( 'Membership Requested', 'buddypress' ) . '</a>';