summaryrefslogtreecommitdiffstats
path: root/wp-includes/wpmu-functions.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-07-04 13:56:23 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-07-04 13:56:23 +0000
commit0bdecc24986ee6e8ec2afb888607ffc7b609ff0d (patch)
tree9a4ee8efc4ead76aef867d1b5906fefefc94e95d /wp-includes/wpmu-functions.php
parenta685530a1c9744419f8ad13f35f8c2f5477aef26 (diff)
downloadwordpress-mu-0bdecc24986ee6e8ec2afb888607ffc7b609ff0d.tar.gz
wordpress-mu-0bdecc24986ee6e8ec2afb888607ffc7b609ff0d.tar.xz
wordpress-mu-0bdecc24986ee6e8ec2afb888607ffc7b609ff0d.zip
Test if email address has been used in a signup already
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@633 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/wpmu-functions.php')
-rw-r--r--wp-includes/wpmu-functions.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/wp-includes/wpmu-functions.php b/wp-includes/wpmu-functions.php
index 4e84bed..ebecdae 100644
--- a/wp-includes/wpmu-functions.php
+++ b/wp-includes/wpmu-functions.php
@@ -907,9 +907,8 @@ function wpmu_validate_user_signup($user_name, $user_email) {
$errors->add('user_email', __("Sorry, that email address is already used!"));
// Has someone already signed up for this username?
- // TODO: Check email too?
$signup = $wpdb->get_row("SELECT * FROM $wpdb->signups WHERE user_login = '$user_name'");
- if ( ! empty($signup) ) {
+ if ( $signup != null ) {
$registered_at = mysql2date('U', $signup->registered);
$now = current_time( 'timestamp', true );
$diff = $now - $registered_at;
@@ -917,7 +916,20 @@ function wpmu_validate_user_signup($user_name, $user_email) {
if ( $diff > 172800 ) {
$wpdb->query("DELETE FROM $wpdb->signups WHERE user_login = '$user_name'");
} else {
- $errors->add('user_name', __("That username is currently reserved but may be available in a couple days."));
+ $errors->add('user_name', __("That username is currently reserved but may be available in a couple of days."));
+ }
+ }
+
+ $signup = $wpdb->get_row("SELECT * FROM $wpdb->signups WHERE user_email = '$user_email'");
+ if ( $signup != null ) {
+ $registered_at = mysql2date('U', $signup->registered);
+ $now = current_time( 'timestamp', true );
+ $diff = $now - $registered_at;
+ // If registered more than two days ago, cancel registration and let this signup go through.
+ if ( $diff > 172800 ) {
+ $wpdb->query("DELETE FROM $wpdb->signups WHERE user_email = '$user_email'");
+ } else {
+ $errors->add('user_email', __("That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing."));
}
}