Changeset 3300 for trunk/bp-core/bp-core-wpabstraction.php
- Timestamp:
- 10/24/2010 09:22:29 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/bp-core/bp-core-wpabstraction.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-wpabstraction.php
r3284 r3300 23 23 24 24 return true; 25 } 26 27 /** 28 * bp_core_is_main_site 29 * 30 * Checks if current blog is root blog of site 31 * 32 * @since 1.2.6 33 * @package BuddyPress 34 * 35 * @param int $blog_id optional blog id to test (default current blog) 36 * @return bool True if not multisite or $blog_id is main site 37 */ 38 function bp_core_is_main_site( $blog_id = '' ) { 39 global $current_site, $current_blog; 40 41 if ( !bp_core_is_multisite() ) 42 return true; 43 44 if ( empty( $blog_id ) ) 45 $blog_id = $current_blog->blog_id; 46 47 return $blog_id == $current_site->blog_id; 25 48 } 26 49 … … 74 97 } 75 98 76 if ( !function_exists( 'wpmu_validate_user_signup' ) ) { 77 function wpmu_validate_user_signup( $user_name, $user_email ) { 78 global $wpdb; 99 if ( !function_exists( 'is_subdomain_install' ) ) { 100 function is_subdomain_install() { 101 if ( ( defined( 'VHOST' ) && 'yes' == VHOST ) || ( defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL ) ) 102 return true; 79 103 80 $errors = new WP_Error(); 81 82 $user_email = sanitize_email( $user_email ); 83 84 if ( empty( $user_name ) ) 85 $errors->add('user_name', __("Please enter a username")); 86 87 $maybe = array(); 88 preg_match( "/[a-z0-9]+/", $user_name, $maybe ); 89 90 $illegal_names = get_site_option( "illegal_names" ); 91 if( is_array( $illegal_names ) == false ) { 92 $illegal_names = array( "www", "web", "root", "admin", "main", "invite", "administrator" ); 93 add_site_option( "illegal_names", $illegal_names ); 94 } 95 96 if ( !validate_username( $user_name ) || in_array( $user_name, $illegal_names ) == true || $user_name != $maybe[0] ) { 97 $errors->add('user_name', __("Only lowercase letters and numbers allowed")); 98 } 99 100 if( strlen( $user_name ) < 4 ) { 101 $errors->add('user_name', __("Username must be at least 4 characters")); 102 } 103 104 if ( strpos( " " . $user_name, "_" ) != false ) 105 $errors->add('user_name', __("Sorry, usernames may not contain the character '_'!")); 106 107 // all numeric? 108 $match = array(); 109 preg_match( '/[0-9]*/', $user_name, $match ); 110 if ( $match[0] == $user_name ) 111 $errors->add('user_name', __("Sorry, usernames must have letters too!")); 112 113 if ( !is_email( $user_email ) ) 114 $errors->add('user_email', __("Please check your email address.")); 115 116 $limited_email_domains = get_site_option( 'limited_email_domains' ); 117 if ( is_array( $limited_email_domains ) && empty( $limited_email_domains ) == false ) { 118 $emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) ); 119 if( in_array( $emaildomain, $limited_email_domains ) == false ) { 120 $errors->add('user_email', __("Sorry, that email address is not allowed!")); 121 } 122 } 123 124 // Check if the username has been used already. 125 if ( username_exists($user_name) ) 126 $errors->add('user_name', __("Sorry, that username already exists!")); 127 128 // Check if the email address has been used already. 129 if ( email_exists($user_email) ) 130 $errors->add('user_email', __("Sorry, that email address is already used!")); 131 132 $result = array('user_name' => $user_name, 'user_email' => $user_email, 'errors' => $errors); 133 134 return apply_filters('wpmu_validate_user_signup', $result); 104 return false; 135 105 } 136 106 } 107 108 // Deprecated - 1.2.6 109 if ( !function_exists( 'is_site_admin' ) ) { 110 function is_site_admin( $user_id = false ) { 111 return is_super_admin( $user_id ); 112 } 113 } 114 137 115 ?>
Note:
See TracChangeset
for help on using the changeset viewer.