Solved

Wordpress Automatic email response when new user is set up

Posted on 2014-09-11
9
295 Views
Last Modified: 2014-09-11
I have a wordpress site.  When I set up a new user they automatically get an email that let's them know there username and password and where to login.  How can I alter this file so I can add more information to the email body?

I am using WP 3.9.2
0
Comment
Question by:livewirewebsolutions
  • 3
  • 3
  • 3
9 Comments
 
LVL 16

Accepted Solution

by:
Joshua Grantom earned 500 total points
ID: 40317024
You can use a register plugin that can allow you to customize the messages to users.

Here is one for example but there are plenty more.

https://wordpress.org/plugins/register-plus-redux/

Here is a plugin just for editing the emails

https://wordpress.org/plugins/custom-user-emails
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40317102
There are also code-based ways to do it.  Are you interested in those or are plugins sufficient?
0
 

Author Comment

by:livewirewebsolutions
ID: 40317156
I am more interested in coding it in a file.  The current file must exist somewhere??
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40317174
If you mean "can I just open a file and edit the email message?" then you can but it's a core WordPress file so your edits will be blown away on the next WordPress update.

The correct way to do this is to use a plugin or write your own code that hooks into WordPress and substitutes the default message for your own.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 16

Expert Comment

by:Joshua Grantom
ID: 40317180
// Redefine user notification function
if ( !function_exists('wp_new_user_notification') ) {
    function wp_new_user_notification( $user_id, $plaintext_pass = '' ) {
        $user = new WP_User($user_id);

        $user_login = stripslashes($user->user_login);
        $user_email = stripslashes($user->user_email);

        $message  = sprintf(__('New user registration on your blog %s:'), get_option('blogname')) . "\r\n\r\n";
        $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
        $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";

        @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message);

        if ( empty($plaintext_pass) )
            return;

        $message  = __('Hi there,') . "\r\n\r\n";
        $message .= sprintf(__("Welcome to %s! Here's how to log in:"), get_option('blogname')) . "\r\n\r\n";
        $message .= wp_login_url() . "\r\n";
        $message .= sprintf(__('Username: %s'), $user_login) . "\r\n";
        $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n\r\n";
        $message .= sprintf(__('If you have any problems, please contact me at %s.'), get_option('admin_email')) . "\r\n\r\n";
        $message .= __('Adios!');

        wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);

    }
}

Open in new window


You can put this code into your own plugin.php file and add it to your plugins directory and activate. It isnt recommended to change anything in the functions.php because it will be overwritten when you update wordpress.
0
 

Author Comment

by:livewirewebsolutions
ID: 40317219
hi Joshua G.  as per your code above.  I created a folder in plugins and added a php file and uploaded with this code.  I assume there is more to this as it did not appear in my plugins section of the site
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40317242
It isnt recommended to change anything in the functions.php because it will be overwritten when you update wordpress.

Uh, no.  Functions.php is in your theme and is independent of WordPress core updates.  If you are modifying a downloaded theme that isn't a child theme already, you should make a child a theme and apply all modifications there.

Tl;dr it's okay to add code to functions.php unless you are doing it to a parent theme you didn't author.
0
 

Author Closing Comment

by:livewirewebsolutions
ID: 40317254
Using Register Plus Redux.  Looks pretty good.
0
 
LVL 16

Expert Comment

by:Joshua Grantom
ID: 40317318
Jason, my mistake. I meant updating the theme*
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Knowledge base software has turned out to be a quite reliable method for storing information, promoting collaborative work and for sharing valuable input and solutions.However, some organizations are trying to develop a knowledge base that works wit…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now