$email, 'inviter_id' => bp_displayed_user_id(), 'content' => $message, 'send_invite' => 1 ); // Check the nonce and delete the invitation. if ( bp_verify_nonce_request( 'bp_members_invitation_send_' . bp_displayed_user_id() ) && bp_members_invitations_invite_user( $invite_args ) ) { bp_core_add_message( __( 'Invitation successfully sent!', 'buddypress' ) ); } else { bp_core_add_message( __( 'There was a problem sending that invitation. The user could already be a member of the site or have chosen not to receive invitations from this site.', 'buddypress' ), 'error' ); } // Redirect. $user_id = bp_displayed_user_id(); bp_core_redirect( bp_get_members_invitations_send_invites_permalink( $user_id ) ); } add_action( 'bp_actions', 'bp_network_invitations_catch_send_action' );