WordPress.org

Ready to get started?Download WordPress

Forums

Adding a user to the site through a form (1 post)

  1. techsparta
    Member
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic