Created
November 7, 2011 13:06
-
-
Save eteubert/1344887 to your computer and use it in GitHub Desktop.
WordPress: Activation Email Customization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function change_welcome_mail_loginlink( $welcome_email, $user_id, $password, $meta ) { | |
$welcome_email = str_replace( 'LOGINLINK', 'http://www.mysite.com/my/custom/login/url', $welcome_email ); | |
return $welcome_email; | |
} | |
add_filter( 'update_welcome_user_email', 'change_welcome_mail_loginlink', 10, 4 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function change_welcome_mail_loginlink( $welcome_email, $user_id, $password, $meta ) { | |
return "Welcome to SITE_NAME!\n\nYour account has been activated - yay! You may now log in with the following information:\n\nLogin: USERNAME\nPassword: PASSWORD\n\nWe look forward to your visit at LOGINLINK\n\nYour SITE_NAME Buddies"; | |
} | |
add_filter( 'update_welcome_user_email', 'change_welcome_mail_loginlink', 10, 4 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Notify a user that her account activation has been successful. | |
* | |
* Filter 'wpmu_welcome_user_notification' to disable or bypass. | |
* | |
* Filter 'update_welcome_user_email' and 'update_welcome_user_subject' to | |
* modify the content and subject line of the notification email. | |
* | |
* @since MU | |
* | |
* @param int $user_id | |
* @param string $password | |
* @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization. | |
* @return bool | |
*/ | |
function wpmu_welcome_user_notification($user_id, $password, $meta = '') { | |
/* ... */ | |
$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 ); | |
/* ... */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanx for the code. You know if is possible to change the activation email?, the one that is sent before the welcome email, have this text:
Hi,
You've been invited to join '' at
http://mydomain.com with the role of Editor.
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:
http://mydomain.com/wp-activate.php?key=0b1c55b36947988b