mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Users: In wp_new_user_notification()
, sdd 'user'
option for the $notify
parameter, which allows for sending notification only to the user created.
Props akibjorklund. Fixes #36009. Built from https://develop.svn.wordpress.org/trunk@37276 git-svn-id: http://core.svn.wordpress.org/trunk@37242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a47fa4f197
commit
c371296223
@ -1691,6 +1691,7 @@ if ( !function_exists('wp_new_user_notification') ) :
|
|||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
* @since 4.3.0 The `$plaintext_pass` parameter was changed to `$notify`.
|
* @since 4.3.0 The `$plaintext_pass` parameter was changed to `$notify`.
|
||||||
* @since 4.3.1 The `$plaintext_pass` parameter was deprecated. `$notify` added as a third parameter.
|
* @since 4.3.1 The `$plaintext_pass` parameter was deprecated. `$notify` added as a third parameter.
|
||||||
|
* @since 4.6.0 The `$notify` parameter accepts 'user' for sending notification only to the user created.
|
||||||
*
|
*
|
||||||
* @global wpdb $wpdb WordPress database object for queries.
|
* @global wpdb $wpdb WordPress database object for queries.
|
||||||
* @global PasswordHash $wp_hasher Portable PHP password hashing framework instance.
|
* @global PasswordHash $wp_hasher Portable PHP password hashing framework instance.
|
||||||
@ -1698,7 +1699,7 @@ if ( !function_exists('wp_new_user_notification') ) :
|
|||||||
* @param int $user_id User ID.
|
* @param int $user_id User ID.
|
||||||
* @param null $deprecated Not used (argument deprecated).
|
* @param null $deprecated Not used (argument deprecated).
|
||||||
* @param string $notify Optional. Type of notification that should happen. Accepts 'admin' or an empty
|
* @param string $notify Optional. Type of notification that should happen. Accepts 'admin' or an empty
|
||||||
* string (admin only), or 'both' (admin and user). Default empty.
|
* string (admin only), 'user', or 'both' (admin and user). Default empty.
|
||||||
*/
|
*/
|
||||||
function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) {
|
function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) {
|
||||||
if ( $deprecated !== null ) {
|
if ( $deprecated !== null ) {
|
||||||
@ -1712,11 +1713,13 @@ function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' )
|
|||||||
// we want to reverse this for the plain text arena of emails.
|
// we want to reverse this for the plain text arena of emails.
|
||||||
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
||||||
|
|
||||||
$message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n";
|
if ( 'user' !== $notify ) {
|
||||||
$message .= sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
|
$message = sprintf( __( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";
|
||||||
$message .= sprintf(__('Email: %s'), $user->user_email) . "\r\n";
|
$message .= sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n";
|
||||||
|
$message .= sprintf( __( 'Email: %s' ), $user->user_email ) . "\r\n";
|
||||||
|
|
||||||
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
|
@wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] New User Registration' ), $blogname ), $message );
|
||||||
|
}
|
||||||
|
|
||||||
// `$deprecated was pre-4.3 `$plaintext_pass`. An empty `$plaintext_pass` didn't sent a user notifcation.
|
// `$deprecated was pre-4.3 `$plaintext_pass`. An empty `$plaintext_pass` didn't sent a user notifcation.
|
||||||
if ( 'admin' === $notify || ( empty( $deprecated ) && empty( $notify ) ) ) {
|
if ( 'admin' === $notify || ( empty( $deprecated ) && empty( $notify ) ) ) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.6-alpha-37273';
|
$wp_version = '4.6-alpha-37276';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user