Advertisement
Guest User

Untitled

a guest
Aug 30th, 2017
449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. From: WordPress [wordpress@siteurl.com]
  2. Subject: [site name] Your user name and password
  3. Message:
  4. username: user
  5. Password: password
  6. siteurl.com/wp-login.php
  7.  
  8. From: My Site Name [info@siteurl.com]
  9. Subject: siteurl.com customer account activated
  10. Message:
  11. Your customer account has been activated.
  12.  
  13. Your Login credentials are:
  14.  
  15. Username: user email
  16. Password: password
  17.  
  18. Thanks,
  19. abcd
  20.  
  21. <?php
  22. /**
  23. * Plugin Name: Custom new user notification email
  24. * Description: Overwrites the pluggable 'wp_new_user_notification()' plugin to allow the sending of a custom email
  25. * Author: David Gard
  26. * Version: 1.0
  27. */
  28.  
  29. if ( !function_exists('wp_new_user_notification') ) :
  30. /**
  31. * Pluggable - Email login credentials to a newly-registered user
  32. *
  33. * A new user registration notification is also sent to admin email.
  34. *
  35. * @since 2.0.0
  36. *
  37. * @param int $user_id User ID.
  38. * @param string $plaintext_pass Optional. The user's plaintext password. Default empty.
  39. */
  40. function wp_new_user_notification($user_id, $plaintext_pass = ''){
  41.  
  42. $user = get_userdata($user_id);
  43.  
  44. // The blogname option is escaped with esc_html on the way into the database in sanitize_option
  45. // we want to reverse this for the plain text arena of emails.
  46. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
  47.  
  48. $message = sprintf(__('New user registration on your site %s:'), $blogname) . "rnrn";
  49. $message .= sprintf(__('Username: %s'), $user->user_login) . "rnrn";
  50. $message .= sprintf(__('E-mail: %s'), $user->user_email) . "rn";
  51.  
  52. @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
  53.  
  54. if ( empty($plaintext_pass) )
  55. return;
  56.  
  57. $message = sprintf(__('Username: %s'), $user->user_login) . "rn";
  58. $message .= sprintf(__('Password: %s'), $plaintext_pass) . "rn";
  59. $message .= wp_login_url() . "rn";
  60.  
  61. wp_mail($user->user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
  62.  
  63. }
  64. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement