• spikeh1

    (@spikeh1)


    Any way of editing the default notifications email messages? – they don’t really fit the requirement

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Support Mirza Hamza

    (@hamza1010)

    Hello @spikeh1,

    Thanks for contacting us,

    I hope you are doing well, We’ve informed our technical team about this, and they will work on it promptly. When we receive their response, we will get back to you. Our team is here to assist you.

    Thanks & Regards
    WP Experts Support Team

    Plugin Support Mirza Hamza

    (@hamza1010)

    Hello @spikeh1,

    You can use the following filter hooks to modify the default notification email messages.

    Here is the code:

    //User Pending Email
    add_filter('new_user_approve_welcome_user_message', function($message, $user_email) {
    return "type pending message here";
    });

    //User Approved Email
    add_filter('new_user_approve_approve_user_message', function($message, $user) {
    return "type approved message here";

    });

    // User Deny Email
    add_filter('new_user_approve_deny_user_message', function($message, $user) {
    return "type deny message here";
    });

    //Admin approval email:
    add_filter('new_user_approve_request_approval_message', function($message, $user_login, $user_email) {
    return "type admin approval request message here";
    });

    If you have any questions, feel free to reach out. We’re here to assist you.

    Thank you

    Hi, the filter ‘new_user_approve_welcome_user_message’ not work for me.

    I’ve been using this code but no email is sent:

    //User Pending Email
    function custom_welcome_user_message( $message, $user ) {
    $custom_message = “Your request is pending.”;

    return $custom_message;
    }
    add_filter( ‘new_user_approve_welcome_user_message’, ‘custom_welcome_user_message’, 10, 2 );

    Plugin Support Mirza Hamza

    (@hamza1010)

    Hello @marcodedo,

    Please create a ticket on our official website so that we can connect you directly with our Technical team.

    Looking forward to getting your issue resolved.

    Thank you

    Thread Starter spikeh1

    (@spikeh1)

    hi

    I added those 4 lines of code as suggested – it made no change to the original email text.

    Am I missing something here?

    For me, no email is sent. Else, for the other filter (‘new_user_approve_approve_user_message’ or ‘new_user_approve_deny_user_message’) the email is sent.

    Plugin Support Mirza Hamza

    (@hamza1010)

    Hello @spikeh1 @marcodedo,

    We have to check this and we will keep you updated on this.

    Thank you

    Plugin Support Mirza Hamza

    (@hamza1010)

    Hello @spikeh1 @marcodedo,

    Can you please confirm is the default welcome email working fine without text customization?

    When I’ve tried without customization, it worked fine, but when I’ve customized the text now it doesn’t work now. And if I remove the customization it doesn’t work the same

    Plugin Support Mirza Hamza

    (@hamza1010)

    Hello @marcodedo,

    Thanks for getting back to us, we will look into this and then update you.

    Thank you

    Thread Starter spikeh1

    (@spikeh1)

    In reply to your query, regardless of any added code, the message received by the newly registered user is

    Username: test.testmember

    To set your password, visit the following address:

    Even though a password has been added. I am trying to add a message like ‘your registration is now awaiting approval’

    Once approved, the approval email is received by the new user as expected. The ‘denied access’ email is also correct

    Plugin Support Mirza Hamza

    (@hamza1010)

    Hello @spikeh1,

    Actually, our team is looking into this so we will update you once we get a response from them.

    Thank you

    Plugin Support Mirza Hamza

    (@hamza1010)

    Hello @spikeh1,

    We are providing you with another solution that is tested and working fine on our side. Please add this code to the functions.php of the active theme and also remove the ‘new_user_approve_welcome_user_message‘ filter hook and its function from this code if you are already using it.

    Note: The solution is for both WP registration and WooCommerce registration.

    Please have a look at the screencast video:

    The code is Here:

    if(class_exists('pw_new_user_approve') || class_exists('PW_New_User_Approve')) {

    $nua = pw_new_user_approve()->instance();
    remove_action('register_post', array($nua, 'create_new_user'), 10, 3);
    remove_action('woocommerce_created_customer', array($nua, 'nua_welcome_email_woo_new_user'));

    add_action('register_post', 'nua_create_new_user', 10 ,3);
    add_action('woocommerce_created_customer','nua_woo_welcome_email_new_user');
    // ==============================================
    // for wp default
    function nua_create_new_user($user_login, $user_email, $errors) {

    if ( $errors->get_error_code() ) {
    return;
    }
    // create the user
    $user_pass = wp_generate_password( 12, false );
    $user_pass = apply_filters('nua_pass_create_new_user', $user_pass);
    $user_id = wp_create_user( $user_login, $user_pass, $user_email );
    if ( !$user_id ) {
    $errors->add( 'registerfail', sprintf( __( '<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !' ), get_option( 'admin_email' ) ) );
    } else {
    // User Registeration welcome email
    $disable = apply_filters('nua_disable_welcome_email',false, $user_id);
    if(false===$disable) {
    $message = nua_default_registeration_welcome_email();
    $message = apply_filters( 'new_user_approve_welcome_user_message', $message, $user_email );
    $subject = sprintf( __( 'Your registration is pending for approval - [%s]', 'new-user-approve' ), get_option( 'blogname' ) );
    $subject = apply_filters( 'new_user_approve_welcome_user_subject', $subject );

    wp_mail(
    $user_email,
    $subject,
    $message,
    nua_email_message_headers()
    );
    }
    }

    }
    // ==============================================
    // for woocommerce
    function nua_woo_welcome_email_new_user($customer_id ) {

    $customer = new WC_Customer( $customer_id );
    $user_email = $customer->get_email();
    $message = nua_default_registeration_welcome_email();
    $message = apply_filters( 'new_user_approve_welcome_user_message', $message, $user_email );
    $subject = sprintf( __( 'Your registration is pending for approval - [%s]', 'new-user-approve' ), get_option( 'blogname' ) );
    $subject = apply_filters( 'new_user_approve_welcome_user_subject', $subject );
    $disable_welcome_email = apply_filters('disable_welcome_email_woo_new_user', false );
    if($disable_welcome_email===true) {

    return;
    }

    wp_mail(
    $user_email,
    $subject,
    $message,
    nua_email_message_headers()
    );

    }


    function nua_email_message_headers()
    {
    $admin_email = get_option( 'admin_email' );
    if ( isset($_SERVER['SERVER_NAME']) && empty($admin_email) ) {
    $admin_email = 'support@' . sanitize_text_field(wp_unslash($_SERVER['SERVER_NAME']));
    }
    $from_name = get_option( 'blogname' );
    $headers = array( "From: \"{$from_name}\" <{$admin_email}>\n" );
    $headers = apply_filters( 'new_user_approve_email_header', $headers );
    return $headers;
    }

    // welcome user message filter
    add_filter('new_user_approve_welcome_user_message', 'nua_welcome_user_message',10, 2);

    function nua_welcome_user_message( $message, $user_email) {

    return 'your registration is now awaiting approval'; // you can add your message here
    }
    }

    If you have any questions, feel free to reach out. We’re here to assist you.

    Thank you

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.