Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From: WordPress [wordpress@siteurl.com]
- Subject: [site name] Your user name and password
- Message:
- username: user
- Password: password
- siteurl.com/wp-login.php
- From: My Site Name [info@siteurl.com]
- Subject: siteurl.com customer account activated
- Message:
- Your customer account has been activated.
- Your Login credentials are:
- Username: user email
- Password: password
- Thanks,
- abcd
- <?php
- /**
- * Plugin Name: Custom new user notification email
- * Description: Overwrites the pluggable 'wp_new_user_notification()' plugin to allow the sending of a custom email
- * Author: David Gard
- * Version: 1.0
- */
- if ( !function_exists('wp_new_user_notification') ) :
- /**
- * Pluggable - Email login credentials to a newly-registered user
- *
- * A new user registration notification is also sent to admin email.
- *
- * @since 2.0.0
- *
- * @param int $user_id User ID.
- * @param string $plaintext_pass Optional. The user's plaintext password. Default empty.
- */
- function wp_new_user_notification($user_id, $plaintext_pass = ''){
- $user = get_userdata($user_id);
- // The blogname option is escaped with esc_html on the way into the database in sanitize_option
- // we want to reverse this for the plain text arena of emails.
- $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
- $message = sprintf(__('New user registration on your site %s:'), $blogname) . "rnrn";
- $message .= sprintf(__('Username: %s'), $user->user_login) . "rnrn";
- $message .= sprintf(__('E-mail: %s'), $user->user_email) . "rn";
- @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
- if ( empty($plaintext_pass) )
- return;
- $message = sprintf(__('Username: %s'), $user->user_login) . "rn";
- $message .= sprintf(__('Password: %s'), $plaintext_pass) . "rn";
- $message .= wp_login_url() . "rn";
- wp_mail($user->user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
- }
- endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement