Solution:
You need to add the code in wpcf7_before_send_mail
hook, please have a look at below completed working code.
add_action('wpcf7_before_send_mail', 'save_form' );
function save_form( $wpcf7 ) {
global $wpdb;
/*
Note: since version 3.9 Contact Form 7 has removed $wpcf7->posted_data
and now we use an API to get the posted data.
*/
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$submited = array();
$submited['posted_data'] = $submission->get_posted_data();
}
$email=$submited['posted_data']['your-email'];
$pass=$submited['posted_data']['pass'];
$userdata = array(
'user_login' => $email,
'user_email' => $email,
'user_pass' => $pass // When creating an user, `user_pass` is expected.
);
$user_id = wp_insert_user( $userdata ) ;
}