The MU forums have moved to WordPress.org

Variables for welcome email? (6 posts)

  1. mark.ristaino
    Member
    Posted 14 years ago #

    I'm trying to customize my welcome email, and i want to print the person who is registerings' email address within the body of the email, using the WPMU sitewide settings admin page ( editing "Welcome Email" field on the page /wp-admin/wpmu-options.php )

    I tried inserting the variables "EMAIL" and "USER_EMAIL"

    Neither worked. What is the correct variable name for user email?

  2. wpmuguru
    Member
    Posted 14 years ago #

    The user email address isn't replaced in the email, so to do that you would need to write a plugin to do the substitution.

  3. mark.ristaino
    Member
    Posted 14 years ago #

    aha! ok... sounds simple enough

    thank you

  4. lampstax
    Member
    Posted 14 years ago #

    So I tried to write this plugin as:

    add_filter('update_welcome_user_email', 'wpmu_do_apply_extra_filters_welcome_email');
    
    function wpmu_do_apply_extra_filters_welcome_email( $content ){
        return str_replace( "USER_EMAIL", '[replaced_email]', $content );
    }

    Seems like this should work since in wpmu-functions.php, the filter is applied as follow:

    $welcome_email = get_site_option( 'welcome_user_email' ); 
    
    	$user = new WP_User($user_id);
    
    	$welcome_email = apply_filters( "update_welcome_user_email", $welcome_email, $user_id, $password, $meta);
    	$welcome_email = str_replace( "SITE_NAME", $current_site->site_name, $welcome_email );
    	$welcome_email = str_replace( "USERNAME", $user->user_login, $welcome_email );
    	$welcome_email = str_replace( "PASSWORD", $password, $welcome_email );
    	$welcome_email = str_replace( "LOGINLINK", wp_login_url(), $welcome_email );

    I "could" make this work by adding a str_replace here, but much rather do it as a plugin if someone can help point out my mistake.

    Thanks

  5. lampstax
    Member
    Posted 14 years ago #

    bump

  6. jamk
    Member
    Posted 14 years ago #

    Are the variables that one can use in the emails documented in anywhere?

    I have the problem that my WPMU has SSL-secured admin-side but the Welcome email uses "BLOG_URLwp-login.php" variable as login link which contains "http" instead of "https". This causes some unwanted redirect consequences after login...

About this Topic

  • Started 14 years ago by mark.ristaino
  • Latest reply from jamk