Modify the From section of email sent by WPMU to the user when a blog is created

Hi:

Still new to WPMU 2.8.4a.

When a blog is created an email is sent to the user with the following info:

Subject: [Sitename.com] Your username and password
From: "WordPress" <administrator@sitename.com>
To: urb3@email.com
Username: urb3
Password: b4f2e4f8
http://sitename.com/wp-login.php

I would like to modify the "From: WordPress" part. I want to modify WordPress for the site name.

Browsed a lot for the topic on WPMU Forums and can't find which file and which variable do I have to modify.

Any clues will be appreciated.

Thanks.

  • cbriere
    • Site Builder, Child of Zeus

    @Barry: In which file I am suppose to enter that code? and in what line?
    Is there an specific place to place all filters?

    Also, I found that there is a file named wpmu-functions.php in public_html\wp-includes\ that have a variable named $from_name and it seems to be the one. In my install is about line 1123. This is the partial code:

    $from_name = get_site_option( "site_name" ) == '' ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) );
    $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";

    However, I dont want to modify that file before having some input of someone that really nows the effect of modifying it. Last time I modified a core file, my site went down for several hours... :slight_frown:

    Thanks.

  • cbriere
    • Site Builder, Child of Zeus

    Hi,

    The code as pasted above triggered an error on our installation. I noticed that it was due to blank spaces in the code. Cleaned the spaces and it worked. I'm pasting the code here without spaces for others to reuse:

    <?php add_filter('wp_mail_from_name', 'changefromname');
    function changefromname($from){
    return "MySite.com";}
    ?>

    Now I would like to translate into our language the instructions of the emails (like activation email) sent to users. Noticed, as mentioned earlier, that a file named wpmu-functions.php in public_html\wp-includes\ is the one containing the text that has to be translated. Also notice the same file name into public_html\wpmu\wp-includes\

    Why there are 2 files with the same name in different folders?
    Should I modify both of them?
    @Barry: Should I create a filter for this translation as well? If yes, anyone willing to provide the code?

    Thanks.

  • Chris
    • The Bug Hunter

    I apologize for jumping on this thread, but it seems relevant to my issue and I'm not sure where else to find the answer. I'm using Contact Form 7 and the From field is not being passed into the email's header. It keeps returning the name of the website as the sender. I've since learned that this is an issue with Multisite. I have a function.php file in mu-plugins. Do you think the code (above) would work for this issue. If so, any idea what I would add for the return string below? I've tried $sender, but it didn't work.

    add_filter('wp_mail_from_name', 'changefromname');

    function changefromname($from) {
    return "The from name I want";
    }

    I appreciate any help you can offer.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.