lundi 5 octobre 2015

wp_new_user_notification() conflict

I'm using the following to change notification emails when a new user registers

<?php
/*
Plugin Name: Custom New User Email
Description: Changes the copy in the email sent out to new users
*/

// Redefine user notification function
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);
    $user_name = stripslashes($user->user_nicename);
    $user_phone = stripslashes($user->user_phone);


    $message  = sprintf(__('New user registration on your site %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\r\n";
    $message .= sprintf(__('Name: %s'), $user_name) . "\r\n\r\n";
    $message .= sprintf(__('Phone: %s'), $user_phone) . "\r\n";

    $multiple_recipients = array(
       'email@mail.com',
       get_option('admin_email')
    );

    @wp_mail($multiple_recipients, sprintf(__('[%s] New User Registration'), get_option('blogname')), $message);

    if ( empty($plaintext_pass) )
        return;

    $message  = __('Hello,') . "\r\n\r\n";
    $message .= sprintf(__("Welcome to The Business Connection. Here's how to log in:"), get_option('blogname')) . "\r\n\r\n";
    $message .= wp_login_url() . "\r\n";
    $message .= sprintf(__('Username: %s'), $user_login) . "\r\n";
    $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n\r\n";
    $message .= sprintf(__('If you have any problems, please contact us at %s.'), get_option('admin_email')) . "\r\n";


    wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);

}
}

?>

The mail is leaving the web server fine but isn't arriving to the inbox.

Any thoughts/suggestions as to why or how to go about debugging.

Tested with this and it's all good http://ift.tt/1XVitvv



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire