Created
November 4, 2023 14:18
-
-
Save nextab/a5fdcb87aa6dfae6981ee7390c54ebd6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #region Registration part 1 - Custom Action for JetFormBuilder | |
| add_action( 'jet-form-builder/custom-action/user-activation-code', function( $request, $action_handler ) { | |
| $cct_id = ! empty( $request['inserted_cct_user_information'] ) ? $request['inserted_cct_user_information'] : false; | |
| $user_email = ! empty( $request['e_mail'] ) ? $request['e_mail'] : false; | |
| if($cct_id <= 0) { | |
| error_log("CCT for user information could not be created; CCT ID: {$cct_id};"); | |
| if($user_email !== false) { | |
| error_log("Submitted e-mail for user: {$user_email};"); | |
| } | |
| return; | |
| } | |
| if($user_email === false) { | |
| error_log("CCT ID submitted: {$cct_id}; user e-mail was not submitted."); | |
| return; | |
| } | |
| $activation_code = create_activation_code(); | |
| $itemarray = [ | |
| 'activation_code' => $activation_code, | |
| ]; | |
| if(update_cct($itemarray, ['_ID' => $cct_id])) { | |
| send_welcome_email($user_email, $activation_code); | |
| } | |
| $user = get_user_by( 'email', $user_email ); | |
| $user_id = $user->ID; | |
| if(update_user_meta($user_id,'user-information-cct-id',$cct_id) === false) error_log("User meta update failed; CCT ID: {$cct_id}; user e-mail: {$user_email}"); | |
| return; | |
| }, 10, 2 ); | |
| #endregion Registration part 1 - Custom Action for JetFormBuilder |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment