• Resolved giorgosm

    (@giorgosm)


    Hello! Im sorry to bother you again with a question!

    When a user is submitting my account creation form and i go and approve the submission through the back end button that you provide, the successful email doesn’t go to the recipient.

    That can be solved by clicking the “RESEND NOTIFICATION EMAIL” button and the email is delivered fine but it will be nice if it was automatically be done.

    Also this successful email notification doesn’t seem to have a template that can be edited?

    Thanks a LOT for your time!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @giorgosm ,

    Can you check if Activation Email setting is set to Default?
    https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#user-account-activation

    As for changing the email template please check this custom code:

    <?php
    add_filter(
    	'forminator_custom_form_user_registration_before_insert',
    	function ( $new_user_data ) {
    		add_action( 'user_register', 'wpmudev_forminator_filter_user_register_email', 10, 2 );
    
    		return $new_user_data;
    	}
    );
    
    function wpmudev_forminator_filter_user_register_email( int $user_id, array $userdata ) {
    	remove_action( 'user_register', 'wpmudev_forminator_filter_user_register_email' );
    
    	add_filter(
    		'wp_mail',
    		function ( array $mail_args ) use ( $user_id, $userdata ) {
    			$needle       = 'Account Activated';
    			$filter_email = substr( $mail_args['subject'], - strlen( $needle ) ) === $needle;
    
    			if ( $filter_email ) {
    				$userdata['user_id']  = $user_id;
    				$mail_args['message'] = wpmudev_forminator_registration_email_template( $userdata );
    				$mail_args['headers'] = array( 'Content-Type: text/html; charset=UTF-8' );
    
    				remove_action( 'user_register', 'wpmudev_forminator_filter_user_register_email', 10 );
    			}
    
    			return $mail_args;
    		}
    	);
    }
    
    function wpmudev_forminator_registration_email_template( array $user_data = array() ) {
    	if ( empty( $user_data ) ) {
    		return __( 'Hey! You have registered succesfully!' );
    	}
    
    	extract( $user_data );
    
    	$user            = get_user_by( 'id', $user_id );
    	$site_name       = get_bloginfo( 'name' );
    	$home_url        = home_url();
    	$login_page      = wp_login_url();
    	$key             = get_password_reset_key( $user );
    	$pass_reset_link = network_site_url( "wp-login.php?action=rp&key={$key}&login=" . rawurlencode( $user_login ), 'login' );
    
    	$tpl = "Dear {$user_login},
    
    <p>Your account on {$site_name} has been activated! Please find your login details below.</p>
    
    <p>Login page: {$login_page}</p>
    
    <p>Username: qwe2</p>
    
    <p>
    Password: Use the password that you submitted when registering your account, or set a new password at the link below.<br />
    <a href=\"{$pass_reset_link}\">{$pass_reset_link}</a>
    </p>
    
    <p>This message was sent from https://single2.local</p>";
    
    	do_action( 'retrieve_password_key', $user_login, $key );
    
    	return $tpl;
    }

    This can be added in a MU plugin file as mentioned here:
    https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    All changes should be made inside the wpmudev_forminator_registration_email_template() function above.

    kind regards,
    Kasia

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @giorgosm ,

    We haven’t heard from you for some time now, so it looks like you don’t require our further assistance.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

    Thread Starter giorgosm

    (@giorgosm)

    Thanks for the reply!

    Yes the activation email was not set, you were right.

    As of the template i dont want to bother to change php code just to change the email template so i ll send the email manually…

    Thanks a lot!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Submissions email notification’ is closed to new replies.