send_confirmation_on_profile_email() - WordPress 函数参考中文文档

返回介绍

send_confirmation_on_profile_email()

发布于 2017-09-11 字数3074 浏览 1067 评论 0

send_confirmation_on_profile_email()

Sends an email when an email address change is requested.


描述


源代码

File: wp-admin/includes/ms.php

function send_confirmation_on_profile_email() {
	global $errors, $wpdb;
	$current_user = wp_get_current_user();
	if ( ! is_object($errors) )
		$errors = new WP_Error();

	if ( $current_user->ID != $_POST['user_id'] )
		return false;

	if ( $current_user->user_email != $_POST['email'] ) {
		if ( !is_email( $_POST['email'] ) ) {
			$errors->add( 'user_email', __( "<strong>ERROR</strong>: The email address isn’t correct." ), array( 'form-field' => 'email' ) );
			return;
		}

		if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST['email'] ) ) ) {
			$errors->add( 'user_email', __( "<strong>ERROR</strong>: The email address is already used." ), array( 'form-field' => 'email' ) );
			delete_user_meta( $current_user->ID, '_new_email' );
			return;
		}

		$hash = md5( $_POST['email'] . time() . mt_rand() );
		$new_user_email = array(
			'hash' => $hash,
			'newemail' => $_POST['email']
		);
		update_user_meta( $current_user->ID, '_new_email', $new_user_email );

		$switched_locale = switch_to_locale( get_user_locale() );

		/* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
		$email_text = __( 'Howdy

更新日志

Version 描述
3.0.0 Introduced.

相关函数

Uses

  • wp-includes/l10n.php:
    restore_previous_locale()
  • wp-includes/l10n.php:
    switch_to_locale()
  • wp-includes/l10n.php:
    get_user_locale()
  • wp-admin/includes/ms.php:
    new_user_email_content
  • wp-includes/l10n.php:
    __()
  • wp-includes/formatting.php:
    esc_url()
  • wp-includes/formatting.php:
    is_email()
  • wp-includes/formatting.php:
    wp_specialchars_decode()
  • wp-includes/pluggable.php:
    wp_get_current_user()
  • wp-includes/pluggable.php:
    wp_mail()
  • wp-includes/link-template.php:
    self_admin_url()
  • wp-includes/link-template.php:
    network_home_url()
  • wp-includes/plugin.php:
    apply_filters()
  • wp-includes/option.php:
    get_site_option()
  • wp-includes/option.php:
    get_option()
  • wp-includes/user.php:
    delete_user_meta()
  • wp-includes/user.php:
    update_user_meta()
  • wp-includes/wp-db.php:
    wpdb::get_var()
  • wp-includes/wp-db.php:
    wpdb::prepare()
  • wp-includes/class-wp-error.php:
    WP_Error::__construct()
  • Show 15 more uses
    Hide more uses


User Contributed Notes

上一篇:self_link()

下一篇:send_frame_options_header()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!