I need to know if there's a way to remove the register
button on the WordPress login page along with the link to the registration form
... without messing with core files ... so that I don't get just "anyone" (or spammers) setting up accounts!
I do, however, still need the user registration
function to work.
I have a "private" photo uploader that is locked to anyone who doesn't have an account with the site ... but, the only way (the only way I'm wanting that is) new users to register is to be given the login information for a custom user that unlocks the registration form. Therefore limiting users to "invites" only.
NOTE: I'm working in a plugin already, so I cannot just use another plugin as it is bad practice. This must be something that I can put in a functions.php file or something like that.
UPDATE:
Based on the answer given by @Stephen Harris I've looked into using the wp_create_user
function ... However, I'm getting a little confused as to how I should go about adding it to my existing "customized" register form (this will be completely separate from the default register
form).
Here is my current form code:
<!-- Registration form -->
<h1 class="register-header">Register a new user</h1>
<?php $register = $_GET['register'];
if($register == true) {
echo '<p class="register-success">Check your email for the password! Logout and use your new username & password.</p>';
}?>
<a class="logout" href="<?php echo wp_logout_url( get_permalink() ); ?>">Logout</a>
<form method="post" id="register_form" class="wp-user-form" action="echo site_url('wp-login.php?action=register', 'login_post') ?>">
<!-- Username -->
<p>
<input type="text" name="user_login" id="user_login" class="input" placeholder="unique username" />
</p>
<!-- Email to send p/w to -->
<p>
<input type="email" name="user_email" id="user_email" class="input" placeholder="email address" />
</p>
<p class="small-text">You will receive an email with a generated password<br />(which you can change in your "user settings")</p>
<?php do_action('register_form'); ?>
<button name="wp-submit" id="wp-submit" class="btn">Register new user</button>
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>?register=true" />
<input type="hidden" name="user-cookie" value="1" />
</form><!-- end registration-form -->
This all works when "anyone can register" is turned on ... but how do I make it work when I turn it "off"?