I get form data through ajax and I want to use it and add a new user with a subscriber role. to the original Wordpress users and also send them a notification about their account. Here is the bit of code that I have so far.
function set_form()
{
$fisrt_name = $_POST['fisrt_name'];
$email = $_POST['email'];
$email = $_POST['email'];
$admin =get_option('admin_email');
//Code to register user
die();
}
add_action('wp_ajax_set_form', 'set_form'); //execute when wp logged in
add_action('wp_ajax_nopriv_set_form', 'set_form'); //execute when logged out