Skip to content

Instantly share code, notes, and snippets.

@sebasoffia
Created October 20, 2017 19:03
Show Gist options
  • Save sebasoffia/2390375001ad88042d9fa54e7f309e0b to your computer and use it in GitHub Desktop.
Save sebasoffia/2390375001ad88042d9fa54e7f309e0b to your computer and use it in GitHub Desktop.
//Primero configuramos nombre y email del remitente
//Este es el filtro del mail de remitente:
add_filter('wp_mail_from', 'new_mail_from');
//Este es el filtro para el nombre del remitente:
add_filter('wp_mail_from_name', 'new_mail_from_name');
//Aquí es donde va el nuevo email remitente. Cámbialo a tu gusto
function new_mail_from($old) {
return 'miemail@midominio.com';
}
//Aquí es donde va el nombre del remitente
function new_mail_from_name($old) {
return 'Nombre del remitente';
}
//A continuación hacemos un gancho en el asunto y configuramos una función para cambiarlo
add_filter( 'wpmu_signup_user_notification_subject', 'my_activation_subject', 10, 4 );
function my_activation_subject( $text ) {
//Aquí es donde introducimos el nuevo asunto para el email de activación
return 'Personalízame: Tienes que activar tu cuenta o lo que sea que quieras poner.';
}
// Para finalizar hacemos un gancho en el email y ejecutamos una función para modificar el mensaje
add_filter('wpmu_signup_user_notification_email', 'my_custom_email_message', 10, 4);
function my_custom_email_message($message, $user, $user_email, $key) {
//Y este es el nuevo mensaje
$message = sprintf(__(( "Para activar tu cuenta haz clic en el enlace siguiente:\n\n%s\n\n Luego bla bla bla.\n\n" ),
$user, $user_email, $key, $meta),site_url( "?page=gf_activation&key=$key" ));
return sprintf($message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment