• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP user_validate_mail函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中user_validate_mail函数的典型用法代码示例。如果您正苦于以下问题:PHP user_validate_mail函数的具体用法?PHP user_validate_mail怎么用?PHP user_validate_mail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了user_validate_mail函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: install_configure_form_validate

/**
 * Form API validate for the site configuration form.
 */
function install_configure_form_validate($form, &$form_state)
{
    if ($error = user_validate_name($form_state['values']['account']['name'])) {
        form_error($form['admin_account']['account']['name'], $error);
    }
    if ($error = user_validate_mail($form_state['values']['account']['mail'])) {
        form_error($form['admin_account']['account']['mail'], $error);
    }
    if ($error = user_validate_mail($form_state['values']['site_mail'])) {
        form_error($form['site_information']['site_mail'], $error);
    }
}
开发者ID:alexismb5,项目名称:ckan-drupal,代码行数:15,代码来源:install.php


示例2: checkUserNameEmailExists

 /**
  * Check if username and email exists in the drupal db
  *
  * @params $params    array   array of name and mail values
  * @params $errors    array   array of errors
  * @params $emailName string  field label for the 'email'
  *
  * @return void
  */
 static function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email')
 {
     $config = CRM_Core_Config::singleton();
     $dao = new CRM_Core_DAO();
     $name = $dao->escape(CRM_Utils_Array::value('name', $params));
     $email = $dao->escape(CRM_Utils_Array::value('mail', $params));
     $errors = form_get_errors();
     if ($errors) {
         // unset drupal messages to avoid twice display of errors
         unset($_SESSION['messages']);
     }
     if (!empty($params['name'])) {
         if ($nameError = user_validate_name($params['name'])) {
             $errors['cms_name'] = $nameError;
         } else {
             $uid = db_query("SELECT uid FROM {users} WHERE name = :name", array(':name' => $params['name']))->fetchField();
             if ((bool) $uid) {
                 $errors['cms_name'] = ts('The username %1 is already taken. Please select another username.', array(1 => $params['name']));
             }
         }
     }
     if (!empty($params['mail'])) {
         if ($emailError = user_validate_mail($params['mail'])) {
             $errors[$emailName] = $emailError;
         } else {
             $uid = db_query("SELECT uid FROM {users} WHERE mail = :mail", array(':mail' => $params['mail']))->fetchField();
             if ((bool) $uid) {
                 $resetUrl = $config->userFrameworkBaseURL . 'user/password';
                 $errors[$emailName] = ts('The email address %1 is already registered. <a href="%2">Have you forgotten your password?</a>', array(1 => $params['mail'], 2 => $resetUrl));
             }
         }
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:42,代码来源:Drupal.php


示例3: createRandom

 /**
  * Create new users with default field values.
  *
  * @param int $num
  *   Number of entities to create.
  * @param array $options
  *   Options array. This array can have "roles" key that provides an array of
  *   role names that the newly created user will need to be assigned.
  *
  * @return Response
  *   Response object.
  */
 public static function createRandom($num = 1, $options = array())
 {
     if (!is_numeric($num)) {
         return new Response(FALSE, NULL, 'Number of users to be created has to be an integer.');
     }
     $options += array('roles' => array(), 'required_fields_only' => TRUE);
     // First get the references that need to be created.
     //static::processBeforeCreateRandom($options);
     $output = array();
     for ($i = 0; $i < $num; $i++) {
         // Get a random username.
         do {
             $username = Utils::getRandomString(20);
         } while (!is_null(user_validate_name($username)) || user_load_by_name($username));
         // Get a random email address.
         do {
             $email = $username . '@' . Utils::getRandomString(20) . '.com';
         } while (!is_null(user_validate_mail($email)) || user_load_by_mail($email));
         // Get a random password.
         $password = Utils::getRandomString();
         $response = User::registerUser($username, $email, $password, $options);
         if (!$response->getSuccess()) {
             $response->setVar($output);
             return $response;
         }
         $output[] = $response->getVar();
     }
     return new Response(TRUE, Utils::normalize($output), "");
 }
开发者ID:redcrackle,项目名称:redtest-core,代码行数:41,代码来源:User.php


示例4: createRandom

 /**
  * Create new users with default field values.
  *
  * @param int $num
  *   Number of entities to create.
  * @param array $options
  *   Options array. This array can have "roles" key that provides an array of
  *   role names that the newly created user will need to be assigned.
  *
  * @return Response
  *   Response object.
  */
 public static function createRandom($num = 1, $options = array())
 {
     $options += array('roles' => array(), 'required_fields_only' => TRUE);
     $output = array();
     for ($i = 0; $i < $num; $i++) {
         // Get a random username.
         do {
             $username = Utils::getRandomString(20);
         } while (!is_null(user_validate_name($username)) || user_load_by_name($username));
         // Get a random email address.
         do {
             $email = $username . '@' . Utils::getRandomString(20) . '.com';
         } while (!is_null(user_validate_mail($email)) || user_load_by_mail($email));
         // Get a random password.
         $password = Utils::getRandomString();
         $response = User::registerUser($username, $email, $password, $options['roles']);
         if (!$response->getSuccess()) {
             $response->setVar($output);
             return $response;
         }
         $output[] = $response->getVar();
     }
     return new Response(TRUE, Utils::normalize($output), "");
 }
开发者ID:vishalred,项目名称:redtest-core-pw,代码行数:36,代码来源:User.php


示例5: os_poker_user_edit_validate

function os_poker_user_edit_validate($uid, &$edit)
{
    $user = user_load(array('uid' => $uid));
    // Validate the username:
    if (user_access('change own username') || user_access('administer users') || !$user->uid) {
        if ($error = user_validate_name($edit['name'])) {
            form_set_error('name', $error);
        } else {
            if (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE uid != %d AND LOWER(name) = LOWER('%s')", $uid, $edit['name'])) > 0) {
                form_set_error('name', t('The name %name is already taken.', array('%name' => $edit['name'])));
            } else {
                if (drupal_is_denied('user', $edit['name'])) {
                    form_set_error('name', t('The name %name has been denied access.', array('%name' => $edit['name'])));
                }
            }
        }
    }
    // Validate the e-mail address:
    if ($error = user_validate_mail($edit['mail'])) {
        form_set_error('mail', $error);
    } else {
        if (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $uid, $edit['mail'])) > 0) {
            form_set_error('mail', t('The e-mail address %email is already registered.', array('%email' => $edit['mail'])));
        } else {
            if (drupal_is_denied('mail', $edit['mail'])) {
                form_set_error('mail', t('The e-mail address %email has been denied access.', array('%email' => $edit['mail'])));
            }
        }
    }
}
开发者ID:jakob-stoeck,项目名称:os_poker,代码行数:30,代码来源:os_poker_forms.php



注:本文中的user_validate_mail函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP user_validate_name函数代码示例发布时间:2022-05-23
下一篇:
PHP user_username2uid函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap