WordPress函数文档email_exists()
判断邮箱地址是否已经被注册过 描述 译文 该函数判断所给电子邮件地址($email)是否已被某一用户名注册,并…
判断邮箱地址是否已经被注册过
描述
译文
该函数判断所给电子邮件地址($email)是否已被某一用户名注册,并返回用户编号(邮件地址不存在则返回false)。参见username_exists.
原文
This function will check whether or not a given email address ($email) has already been registered to a username, and returns that users ID (or false if none exists). See also username_exists.
This function is normally used when a user is registering, to ensure that the E-mail address the user is attempting to register with has not already been registered.
用法
<?php
if( email_exists( $email )) {
/* stuff to do when email address exists */
}
?>
示例
If the E-mail exists, echo the ID number to which the E-mail is registered. Otherwise, tell the viewer that it does not exist.
1
2
3
4
5
6
7
8
9
10
11
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
<?php
$email = ‘[email protected]’;
$exists = email_exists($email);
if ( $exists )
echo “That E-mail is registered to user number “ . $exists;
else
echo “That E-mail doesn’t belong to any registered users on this site”;
?>
|
历史
添加于 版本: 2.1.0
源文件
email_exists() 函数的代码位于 wp-includes/user.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
/**
* Checks whether the given email exists.
*
* @since 2.1.0
*
* @param string $email Email.
* @return int|false The user’s ID on success, and false on failure.
*/
function email_exists( $email ) {
if ( $user = get_user_by( ’email’, $email) ) {
return $user->ID;
}
return false;
}
|
相关
- Article(文章): Introduction to WordPress conditional functions
- Function(函数): comments_open()
- Function(函数): is_404()
- Function(函数): is_admin()
- Function(函数): is_admin_bar_showing()
- Function(函数): is_archive()
- Function(函数): is_attachment()
- Function(函数): is_author()
- Function(函数): is_category()
- Function(函数): is_comments_popup()
- Function(函数): is_date()
- Function(函数): is_day()
- Function(函数): is_feed()
- Function(函数): is_front_page()
- Function(函数): is_home()
- Function(函数): is_local_attachment()
- Function(函数): is_main_query
- Function(函数): is_multi_author
- Function(函数): is_month()
- Function(函数): is_new_day()
- Function(函数): is_page()
- Function(函数): is_page_template()
- Function(函数): is_paged()
- Function(函数): is_plugin_active()
- Function(函数): is_plugin_active_for_network()
- Function(函数): is_plugin_inactive()
- Function(函数): is_plugin_page()
- Function(函数): is_post_type_archive()
- Function(函数): is_preview()
- Function(函数): is_search()
- Function(函数): is_single()
- Function(函数): is_singular()
- Function(函数): is_sticky()
- Function(函数): is_tag()
- Function(函数): is_tax()
- Function(函数): is_taxonomy_hierarchical()
- Function(函数): is_time()
- Function(函数): is_trackback()
- Function(函数): is_year()
- Function(函数): in_category()
- Function(函数): in_the_loop()
- Function(函数): is_active_sidebar()
- Function(函数): is_active_widget()
- Function(函数): is_blog_installed()
- Function(函数): is_rtl()
- Function(函数): is_dynamic_sidebar()
- Function(函数): is_user_logged_in()
- Function(函数): has_excerpt()
- Function(函数): has_post_thumbnail()
- Function(函数): has_tag()
- Function(函数): pings_open()
- Function(函数): email exists()
- Function(函数): post_type_exists()
- Function(函数): taxonomy_exists()
- Function(函数): term_exists()
- Function(函数): username exists()
- Function(函数): wp_attachment_is_image()
- Function(函数): wp_script_is()
- 原文:http://codex.wordpress.org/Function_Reference/email_exists
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
评论功能已经关闭!