summaryrefslogtreecommitdiffstats
path: root/wp-includes/wpmu-functions.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-12-15 11:54:03 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-12-15 11:54:03 +0000
commit6dbbdee2ef5770f792ad9d4aee0f9f339383d9f2 (patch)
tree3a300464b7aef3f6a72dd330c90316fa90079a4f /wp-includes/wpmu-functions.php
parenta14a6c1201b773cd2ef57a7526190ff43d20fe22 (diff)
downloadwordpress-mu-6dbbdee2ef5770f792ad9d4aee0f9f339383d9f2.tar.gz
wordpress-mu-6dbbdee2ef5770f792ad9d4aee0f9f339383d9f2.tar.xz
wordpress-mu-6dbbdee2ef5770f792ad9d4aee0f9f339383d9f2.zip
is_blog_user() is now blog_id aware (Matt)
Move email domain check into it's own function Another check email on signup git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@825 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/wpmu-functions.php')
-rw-r--r--wp-includes/wpmu-functions.php43
1 files changed, 27 insertions, 16 deletions
diff --git a/wp-includes/wpmu-functions.php b/wp-includes/wpmu-functions.php
index ec9746c..1ab66da 100644
--- a/wp-includes/wpmu-functions.php
+++ b/wp-includes/wpmu-functions.php
@@ -795,10 +795,13 @@ function wpmu_admin_redirect_url() {
}
}
-function is_blog_user() {
+function is_blog_user( $blog_id = 0 ) {
global $current_user, $wpdb, $wpmuBaseTablePrefix;
- $cap_key = $wpmuBaseTablePrefix . $wpdb->blogid . '_capabilities';
+ if ( !$blog_id )
+ $blog_id = $wpdb->blogid;
+
+ $cap_key = $wpmuBaseTablePrefix . $blog_id . '_capabilities';
if ( is_array($current_user->$cap_key) && in_array(1, $current_user->$cap_key) )
return true;
@@ -824,6 +827,24 @@ function validate_email( $email, $check_domain = true) {
return false;
}
+function is_email_address_unsafe( $user_email ) {
+ $banned_names = get_site_option( "banned_email_domains" );
+ if ( is_array( $banned_names ) && empty( $banned_names ) == false ) {
+ $email_domain = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) );
+ foreach( $banned_names as $banned_domain ) {
+ if (
+ strstr( $email_domain, $banned_domain ) ||
+ (
+ strstr( $banned_domain, '/' ) &&
+ preg_match( $banned_domain, $email_domain )
+ )
+ )
+ return true;
+ }
+ }
+ return false;
+}
+
function wpmu_validate_user_signup($user_name, $user_email) {
global $wpdb, $current_site;
@@ -849,20 +870,8 @@ function wpmu_validate_user_signup($user_name, $user_email) {
$errors->add('user_name', __("That username is not allowed"));
}
- $banned_names = get_site_option( "banned_email_domains" );
- if ( is_array( $banned_names ) && empty( $banned_names ) == false ) {
- $email_domain = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) );
- foreach( $banned_names as $banned_domain ) {
- if (
- strstr( $email_domain, $banned_domain ) ||
- (
- strstr( $banned_domain, '/' ) &&
- preg_match( $banned_domain, $email_domain )
- )
- )
- $errors->add('user_email', __("You cannot use that email address to signup. We are having problems with them blocking some of our email. Please use another email provider."));
- }
- }
+ if( is_email_address_unsafe( $user_email ) )
+ $errors->add('user_email', __("You cannot use that email address to signup. We are having problems with them blocking some of our email. Please use another email provider."));
if( strlen( $user_name ) < 4 ) {
$errors->add('user_name', __("Username must be at least 4 characters"));
@@ -910,6 +919,8 @@ function wpmu_validate_user_signup($user_name, $user_email) {
} else {
$errors->add('user_name', __("That username is currently reserved but may be available in a couple of days."));
}
+ if( $signup->active == 0 && $signup->user_email == $user_email )
+ $errors->add('user_email_used', __("username and email used"));
}
$signup = $wpdb->get_row("SELECT * FROM $wpdb->signups WHERE user_email = '$user_email'");