0

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

1 Answer 1

0

You could use the wp_insert_user function to create the new user. And then with the wp_new_user_notification function you could send the notification.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.