示例#1
0
 function init_OLD()
 {
     if (is_multisite()) {
         $gMemberNetwork = gMemberNetwork::getInstance();
         if ($gMemberNetwork->get_option('signup_extra', false)) {
             add_action('signup_extra_fields', array($this, 'signup_extra_fields'), 10, 2);
             add_action('wpmu_validate_user_signup', array($this, 'wpmu_validate_user_signup'), 10);
             add_action('add_signup_meta', array($this, 'add_signup_meta'), 10);
             add_action('wpmu_activate_user', array($this, 'wpmu_activate_user'), 10, 3);
         }
     }
 }
示例#2
0
 public function wpmu_validate_user_signup_email($result)
 {
     $gMemberNetwork =& gMemberNetwork::getInstance();
     if (!$gMemberNetwork->get_option('signup_with_email', false)) {
         return $result;
     }
     if (!is_wp_error($result['errors'])) {
         return $result;
     }
     // WHAT TO DO? : check if user_name is_email too?
     $new_errors = new WP_Error();
     foreach ($result['errors']->get_error_codes() as $code) {
         $messages = $result['errors']->get_error_messages($code);
         if ($code == 'user_name') {
             foreach ($messages as $message) {
                 if ($message == __('Only lowercase letters (a-z) and numbers are allowed.') || $message == __('Sorry, usernames may not contain the character “_”!')) {
                     if (is_email($result['user_name'])) {
                         continue;
                     }
                 }
                 $new_errors->add($code, $message);
             }
         } else {
             foreach ($messages as $message) {
                 $new_errors->add($code, $message);
             }
         }
     }
     $result['errors'] = $new_errors;
     return $result;
 }