<?php
if ($invitationcode != 'wp2005') {
die (__('ERROR: You must enter your invitation code in the last box (below email)'));
}
?>
Super duper (it works..)!!
For Complete Solution.. see post below….
Simply Copy & Paste & Replace the code in your wp-register.php
Here’s the complete solution (with 99.999% going to Skippy..)
Open wp-register.php
case ‘register’:
$user_login = $_POST[‘user_login’];
$user_email = $_POST[‘user_email’];
$invitationcode = $_POST[‘invitationcode’]; /*Added*/
/* checking that username has been typed */
if ($user_login == ”) {
die (__(‘ERROR: Please enter a username.’));
}
/* This defines the invitation… type 1 or more invitationcodes*/
if (($invitationcode != ‘wp2005’) && ($invitationcode != ‘wprules’)) {
die (__(‘ERROR: You must enter your invitation code in the last box or you have typed a wrong invitationcode.’));
}
**Goto**
<form method=”post” action=”wp-register.php” id=”registerform”>
<input type=”hidden” name=”action” value=”register” />
<label for=”user_login”><?php _e(‘Username:’) ?></label>
<input type=”text” name=”user_login” id=”user_login” size=”20″ maxlength=”20″ />
<label for=”user_email”><?php _e(‘E-mail:’) ?></label>
<input type=”text” name=”user_email” id=”user_email” size=”25″ maxlength=”100″ />
A password will be emailed to you.
<label for=”invitationcode”><?php _e(‘Invitationcode:’) ?></label>
<input type=”text” name=”invitationcode” id=”invitationcode” size=”25″ maxlength=”100″ />
<p class=”submit”><input type=”submit” value=”<?php _e(‘Register’) ?> »” id=”submit” name=”submit” />
You know, I came on this morning looking for a way to blacklist registrations by email or IP … but I like this way better. Thanks for posting this! 😀
Thanks for this great idea. Being new to this, I’m not sure how much of the code in wp-register.php to replace. It sounds like you mean all of it. This is the first part of what my wp-register.php looks like:
<?php
require(‘./wp-config.php’);
$wpvarstoreset = array(‘action’);
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST[“$wpvar”])) {
if (empty($_GET[“$wpvar”])) {
$$wpvar = ”;
} else {
$$wpvar = $_GET[“$wpvar”];
}
} else {
$$wpvar = $_POST[“$wpvar”];
}
}
}
if ( !get_settings(‘users_can_register’) )
$action = ‘disabled’;
header( ‘Content-Type: ‘ . get_bloginfo(‘html_type’) . ‘; charset=’ . get_bloginfo(‘charset’) );
switch($action) {
case ‘register’:
$user_login = $_POST[‘user_login’];
$user_email = $_POST[‘user_email’];
/* checking that username has been typed */
if ($user_login == ”) {
die (__(‘ERROR: Please enter a username.’));
}
/* checking e-mail address */
if ($user_email == ”) {
die (__(‘ERROR: Please type your e-mail address.’));
} else if (!is_email($user_email)) {
die (__(‘ERROR: The email address isn’t correct.’));
}
/* checking the username isn’t already used by another user */
$result = $wpdb->get_results(“SELECT user_login FROM $wpdb->users WHERE user_login = ‘$user_login'”);
if (count($result) >= 1) {
die (__(‘ERROR: This username is already registered, please choose another one.’));
}
It continues…. So how much of this do I replace? Thanks.