Viewing 9 replies - 1 through 9 (of 9 total)
  • Here is a sample of what you would do to modify the email sent to approved users. https://gist.github.com/picklewagon/7093339

    The password should be included in the email if they have not already received their password.

    Hi,
    I tried adding that function that you suggested above. When I click approve on a new user, I get an error:

    Warning: Missing argument 2 for my_custom_message() in /home/petstop/public_html/wp-content/themes/Avada-Child-Theme/functions.php on line 9
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/petstop/public_html/wp-content/themes/Avada-Child-Theme/functions.php:9) in /home/petstop/public_html/wp-includes/pluggable.php on line 896

    When I remove your function the error goes away. How can I edit the email sent to approved new users?

    Thanks!

    Thread Starter remymedranda

    (@remymedranda)

    After some investigation and playing around.. I discovered that Pw is included in email normally.

    I am using a plugin called Formidable, and I found that if the user selected their password in the wholesale inquiry form, when an admin approves them for some reason the password they created changes to some auto generated password.

    My original work around to this problem, what to remove password field from new user creation, thinking that when you approve the user it will then auto generate a password for them. BUT I was wrong. So I added the password field back to my form, but just set it to auto generate passwords instead of letting user create them, and it fixed problem.

    @remymedranda Thanks for the update. I’m glad you were able to find a workaround. I will take a look at the Formidable plugin and try to come up with a solution that works better with the New User Approve plugin.

    @caleb I have the gist to get it to work for you. You’ll need to update this line:

    add_filter( 'new_user_approve_approve_user_message', 'my_custom_message' );

    to this:

    add_filter( 'new_user_approve_approve_user_message', 'my_custom_message', 10, 2 );

    Thread Starter remymedranda

    (@remymedranda)

    @josh question, what code would I add to show the customers name, so the email greets them?

    Thanks for your help.

    Thread Starter remymedranda

    (@remymedranda)

    I’ll take a stab at it $user ? — SO that didn’t work.

    I’ve been able to get the custom message part added, just now have to add that personal touch and greet the user by First Name to make it come across as professional.

    Thank you!

    Josh Harrison

    (@picklewagon)

    To get firstname you would use:

    $first_name = get_user_meta( $user_id, 'first_name', true );

    To get lastname you would use:

    $last_name = get_user_meta( $user_id, 'last_name', true );

    Use caution when using this. The user might not have filled out these details since they have probably only registered at this point in the signup process.

    Good luck.

    can you post a sample of this with a message? I’m not sure if i’m supposed to change the content in this?
    add_filter( 'new_user_approve_approve_user_message', 'my_custom_message', 10, 2 );

    as in

    add_filter( 'new_user_approve_approve_user_message', 'I want my message to say this. I approve you.', 10, 2 );

    or just the information on this line:
    $message = 'Custom message here';

    redknife,

    You would do something like this:

    function my_custom_message( $message, $user ) {
    	$first_name = get_user_meta( $user->ID, 'first_name', true );
    	$last_name = get_user_meta( $user->ID, 'last_name', true );
    	$user_login = stripslashes( $user->data->user_login );
    
    	$name = $user_login;
    	if ( !empty( $first_name ) ) {
    		$name = $first_name;
    		if ( !empty( $last_name ) ) {
    			$name .= $last_name;
    		}
    	}
    
    	$message = $name . ','; // greet the user
    	$message .= 'Put your custom message here.';
    
    	return $message;
    }
    add_filter( 'new_user_approve_approve_user_message', 'my_custom_message', 10, 2 );

    The 2nd parameter for the add_filter function is a callback, meaning the code is looking for a function with that title. In that function, the modifications can take place like what I have done above.

    Good luck.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Approval Email doesn't contain Password.’ is closed to new replies.