Advertisements

update_option_new_admin_email

Definition:
function update_option_new_admin_email( $old_value, $value ) {}

Parameters

  • $old_value
  • $value

Defined filters

  • new_admin_email_content
    apply_filters( 'new_admin_email_content', __( "Dear user,

    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### ")

Source code

function update_option_new_admin_email( $old_value, $value ) {

	$email = get_option( 'admin_email' );

	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 );



	$content = apply_filters( 'new_admin_email_content', __( "Dear user,



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### "), $new_admin_email );



	$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' ), get_option( 'blogname' ) ), $content );

}

3187

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: