Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to modify the email that's sent to users when they are invited to join my multisite network. Understanding I can only use the pluggable function, how do I override the default email with a must use plugin? Right now it's not allowing me to override and shows the default text.

Here's my current code:

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);
        $siteUrl = get_site_url().'/login';
        $email_subject = "Welcome to Dewsly ".$user_login;

        $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'), $email_subject, $message);

        if ( empty($plaintext_pass) )
            return;

        ob_start();

        ?>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            </head>
            <body style="background:#e5f6fb">

            </body>
        </html>

        <?php

        $message = ob_get_contents();
        ob_end_clean();

        wp_mail($user_email, $email_subject, $message);

    }
}
share|improve this question

1 Answer 1

up vote 0 down vote accepted

That function isn't for MS signups, the wpmu_signup_user_notification function in wp-includes/ms-functions.php handles that. here's the docblock from that function:

/**
 * Notify user of signup success.
 *
 * This is the notification function used when no new site has
 * been requested.
 *
 * Filter 'wpmu_signup_user_notification' to bypass this function or
 * replace it with your own notification behavior.
 *
 * Filter 'wpmu_signup_user_notification_email' and
 * 'wpmu_signup_user_notification_subject' to change the content
 * and subject line of the email sent to newly registered users.
 *
share|improve this answer
    
What would that filter look like? I've got this and it's not working: function change_activation_subject( $user_id ) { $user = new WP_User($user_id); $user_login = stripslashes($user->user_login); $email_subject = "Welcome to Dewsly ".$user_login; return $subject; } add_filter( "wpmu_signup_user_notification_subject", "change_activation_subject" ); –  Jake Lisby Feb 6 '13 at 19:44
    
I haven't tried the filter out, I don't have a MS setup at the moment. Did you get it to work? I can give it a shot later today if you still need help. –  Milo Feb 7 '13 at 16:38
    
Unfortunately I didn't get it running yet. Not sure why, but I can't get it to filter those at all. It seems to always access the default unless it's been updated in the Multisite Settings. –  Jake Lisby Feb 7 '13 at 20:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.