WordPress.org

Support

Support » Plugins and Hacks » Adding a user to the site through a form

Adding a user to the site through a form

  • Hi, I’m working on my WordPress blog on a local installation before I upload it online. On my site, I want the ability to add users to my site through a form. I have a form with “Username”, “Password”, “Email”, and “Terms of Service” fields, but I’m kind of stuck as to where to go from there. I have a basic understanding of PHP, but a good understanding of programming concepts, and I’ve gone this far with handling the input:

    <?php
    
    $username = $_POST['username'];
    $password = $_POST['password'];
    $email 	  = $_POST['email'];
    
    if(isset($_POST['termsofservice']) && $_POST['termsofservice'] == 'Yes')
    {
    	wp_create_user($username, $password, $email);
    }
    else
    {
    	echo "Sorry, you didn't accept the Terms and Conditions of Service, so you can't be a poster.";
    }
    
    ?>

    .

    I’m confused though as to how I can upload this script for the HTML form to contact, and where I should put it so that it has access to the wp_create_user function. Please help me figure this out.

  • The topic ‘Adding a user to the site through a form’ is closed to new replies.
Skip to toolbar