update_option_new_admin_email()
update_option_new_admin_email( string $old_value, strin…
update_option_new_admin_email( string $old_value, string $value )
尝试更改站点管理员电子邮件地址时发送确认请求电子邮件。
Send a confirmation request email when a change of site admin email address is attempted.
尝试更改站点管理员电子邮件地址时发送确认请求电子邮件。
Send a confirmation request email when a change of site admin email address is attempted.
目录锚点:#说明#参数#源码#笔记
说明(Description)
新的站点管理员地址在确认之前不会变为活动的。
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $old_value | (string) | 旧站点管理员电子邮件地址。 |
| $value | (string) | 建议的新网站管理员电子邮件地址。 |
源码(Source)
/**
* Sends an email when a site administrator email address is changed.
*
* @since 3.0.0
*
* @param string $old_value The old email address. Not currently used.
* @param string $value The new email address.
*/
function update_option_new_admin_email( $old_value, $value ) {
if ( $value == get_option( 'admin_email' ) || !is_email( $value ) )
return;
$hash = md5( $value. time() .mt_rand() );
$new_admin_email = array(
'hash' => $hash,
'newemail' => $value
);
update_option( 'adminhash', $new_admin_email );
/* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
$email_text = __( 'Howdy ###USERNAME###,
You recently requested to have the administration email address on
your site changed.
If this is correct, please click on the following link to change it:
###ADMIN_URL###
You can safely ignore and delete this email if you do not want to
take this action.
This email has been sent to ###EMAIL###
Regards,
All at ###SITENAME###
###SITEURL###' );
/**
* Filter the email text sent when the site admin email is changed.
*
* The following strings have a special meaning and will get replaced dynamically:
* ###USERNAME### The current user's username.
* ###ADMIN_URL### The link to click on to confirm the email change.
* ###EMAIL### The new email.
* ###SITENAME### The name of the site.
* ###SITEURL### The URL to the site.
*
* @since MU
*
* @param string $email_text Text in the email.
* @param string $new_admin_email New admin email that the current administration email was changed to.
*/
$content = apply_filters( 'new_admin_email_content', $email_text, $new_admin_email );
$current_user = wp_get_current_user();
$content = str_replace( '###USERNAME###', $current_user->user_login, $content );
$content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'options.php?adminhash='.$hash ) ), $content );
$content = str_replace( '###EMAIL###', $value, $content );
$content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content );
$content = str_replace( '###SITEURL###', network_home_url(), $content );
wp_mail( $value, sprintf( __( '[%s] New Admin Email Address' ), wp_specialchars_decode( get_option( 'blogname' ) ) ), $content );
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 4.9.0 | wp-admin/includes/misc.php | 18 | 5 |
笔记(Notes)
当管理员更改电子邮件地址时禁用确认通知。
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。





还没有任何评论,赶紧来占个楼吧!