Is it possible to hook in and override the default notification message for WP MS? I know the message being sent out is in /wp-admin/user-new.php

if ( is_multisite() ) {
    function admin_created_user_email( $text ) {
        /* translators: 1: Site name, 2: site URL, 3: role */
        return sprintf( __( 'Hi,
You\'ve been invited to join \'%1$s\' at
%2$s as a %3$s.
If you do not want to join this site please ignore
this email. This invitation will expire in a few days.

Please click the following link to activate your user account:
%%s' ), get_bloginfo('name'), site_url(), esc_html( $_REQUEST[ 'role' ] ) );
    }
    add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' );

    function admin_created_user_subject( $text ) {
        return "[" . get_bloginfo('name') . "] Your site invite";
    }
}

I believe I can do it if I can find the right hook in so that I can remove_filter() and then add my own in. I had been toying with the following (admin_created_user_email2 is my new function):

function reset_admin_email(){
    remove_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' );
    add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email2', 1 );
}

I was reading this page that lists the actions/hooks I can tie into, but I can’t figure out which one to use (if any of them will even work)

Does anyone have experience with this to point me in the right direction?

Thanks

Levi

6 s
6

I was able to override the multi-site notification email by adding these:

remove_filter('wpmu_signup_user_notification_email','admin_created_user_email');
add_filter('wpmu_signup_user_notification_email',<function_name_here>);
add_filter('wpmu_signup_user_notification',<function_name_here>);
add_filter('wpmu_signup_user_notification_subject',<function_name_here>);

Adding the three filters at bottom i.e. email,notification and subject allows you to override the content and the subject of the email.

Leave a Reply

Your email address will not be published. Required fields are marked *