diff --git src/bp-members/bp-members-invitations.php src/bp-members/bp-members-invitations.php
index 2fadc0e94..0ad23999e 100644
|
|
add_filter( 'bp_core_signup_send_activation_key', 'bp_members_invitations_cancel |
105 | 105 | function bp_members_invitations_complete_signup( $user_id ) { |
106 | 106 | $bp = buddypress(); |
107 | 107 | |
108 | | if ( ! $user_id ) { |
109 | | return; |
110 | | } |
111 | | |
112 | 108 | // Check to see if this signup is the result of a valid invitation. |
113 | 109 | $invite = bp_get_members_invitation_from_request(); |
114 | 110 | if ( ! $invite->id ) { |
115 | 111 | return; |
116 | 112 | } |
117 | 113 | |
118 | | // Accept the invitation. |
119 | | $invites_class = new BP_Members_Invitation_Manager(); |
120 | | $args = array( |
121 | | 'id' => $invite->id, |
122 | | ); |
123 | | $invites_class->accept_invitation( $args ); |
124 | | |
125 | 114 | // User has already verified their email by responding to the invitation, so we can activate. |
126 | | $key = bp_get_user_meta( $user_id, 'activation_key', true ); |
| 115 | $signup = bp_members_get_signup_by( 'user_email', $invite->invitee_email ); |
| 116 | $key = false; |
| 117 | if ( ! empty( $signup->activation_key ) ) { |
| 118 | $key = $signup->activation_key; |
| 119 | } |
| 120 | |
127 | 121 | if ( $key ) { |
128 | 122 | $redirect = bp_get_activation_page(); |
129 | 123 | |
… |
… |
function bp_members_invitations_complete_signup( $user_id ) { |
137 | 131 | */ |
138 | 132 | $user = apply_filters( 'bp_core_activate_account', bp_core_activate_signup( $key ) ); |
139 | 133 | |
| 134 | // Accept the invitation now that the user has been created. |
| 135 | $invites_class = new BP_Members_Invitation_Manager(); |
| 136 | $args = array( |
| 137 | 'id' => $invite->id, |
| 138 | ); |
| 139 | $invites_class->accept_invitation( $args ); |
| 140 | |
140 | 141 | // If there were errors, add a message and redirect. |
141 | 142 | if ( ! empty( $user->errors ) ) { |
142 | 143 | /** |