How To Create WordPress User Using Jotform Form Builder

Here we learn about how to create WordPress users using jotform form builder.
Step 1: Create an Account in jotform.com.

Step 2: Create a new folder in jotform.

Step 3: Create a new form.

Step 4: Select the user template and select a new Customer registration form.

Step 5: Now you can see your form layout.

Step 6: How to Modify your form in jotform.

Step 7: How to enabled send post data in jotform.

Step 8: Now you can copy and paste embed code on your site.

Step 9: After form submit set redirect link in jotform.

Step 10: Custom code copied and paste into your child theme’s folder ‘page-jotform-thankyou.php’.

<?php
/*
Template Name: jotform thankyou
*/
global $wpdb, $user_ID;
get_header();
  if( isset( $_POST['email6'] ) && $_POST['email6'] != '' ){
    function myuser_send_password_reset_mail( $user_id, $password ){
      $user 	    = get_user_by( 'id', $user_id );
      $firstname  = $user->first_name;
      $email 		= $user->user_email;
      $adt_rp_key = get_password_reset_key( $user );
      $user_login = $user->user_login;
      
      $message  = "Hi ". $firstname .",<br>";
      $message .= "An account has been created.<br>";
      $message .= "User Id: ". $email ."<br>";
      $message .= "Password: ". $password;
      
      //deze functie moet je zelf nog toevoegen. 
      $subject = __("Your account on ".get_bloginfo( 'name' ));
      $headers = array();

      add_filter( 'wp_mail_content_type', function( $content_type ) { return 'text/html'; } );
      $headers[] = 'From: Your company name <info@your-domain.com>'."\r\n";
      wp_mail( $email, $subject, $message, $headers );
       remove_filter( 'wp_mail_content_type', 'set_html_content_type' );
    }
    
    if ( email_exists( $_POST['email6'] ) == false && username_exists( $_POST['typea'] ) == false) {
      $random_password = wp_generate_password( 12, false );
      $user_id = wp_create_user( $_POST['typea'], $random_password, $_POST['email6'] );
      
      wp_update_user([
        'ID' => $user_id, // this is the ID of the user you want to update.
        'first_name' => $_POST['fullname3'][0],
        'last_name' => $_POST['fullname3'][1],
        'role' => "subscriber",
      ]);			
      myuser_send_password_reset_mail( $user_id , $random_password );
?>	
      <p style="text-align: center;"><img src="https://cdn.jotfor.ms/img/check-icon.png" alt="" width="128" height="128" /></p>
      <div style="text-align: center;">
        <h1 style="text-align: center;">Thank You!</h1>
        <p style="text-align: center;">Your submission has been received.</p>
      </div>
<?php		
    } else {
      $error_message = __( 'User already exists!!!' );
      echo '<p style="text-align: center;">'. $error_message .'</p>';
    }	
  }	
get_footer(); 
?>

Step 11: After creating user received mail.

OUTPUT:

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories