• Resolved eprez

    (@eprez)


    Hello,
    I am experiencing some unexpected behaviour with Forminator.
    I am implementing some user registration forms. I have selected the default activation method and no activation email. I have then added my own custom email notifications in the form (both for admin and user). So far, so good.

    When I register a test user I get the following behaviour: for both admin and user I get the custom email AND another seemingly default wordpress notification.
    I have tried several methods to change or block such extra emails, but even specialised plugins begin to work to that effect only after Forminator is disabled: it seems that it is messing somehow with the normal handling of email notifications.

    In fact the extra registration email the user gets seems not to be so default after all. It shows username, password (in cleartext) and WP login link, while the real wordpress default notification doesn’t show the password in that way.

    Do you have any idea on how to restore the normal email behaviour, allowing other notification plugins to function? Can the extra system notifications be changed or disabled?

    Thanks

    • This topic was modified 5 years, 7 months ago by eprez.
Viewing 12 replies - 1 through 12 (of 12 total)
  • Hi @eprez,

    If you edit your registration form and go to “User Registration” tab you will see “Activation Email” option under “User Account Activation” section, if you set that to NONE it will stop sending the default WP user email (the one with text password).

    I did some tests on my end and this worked fine but I couldn’t stop duplicate Admin email notifications, this is something I’ve already reported to our devs to check it out further and in the meantime you can go to Email Notifications tab for your form and remove Admin email so only the default WP one is sent to to admin.

    Cheers,
    Predrag

    Thread Starter eprez

    (@eprez)

    Hi @wpmudev-support1,

    setting “Activation Email” to “None” works for stopping the extra email to the user. As you said it doesn’t work the same way with admin, and I noticed that even plugins like Manage Notification E-mails and Better Notifications for WP fail to disable/edit the notification while Forminator is active. Looks like Forminator overrides such customizations somehow.

    Please let me know if there are any updates on this.
    Thank you.

    • This reply was modified 5 years, 7 months ago by eprez.
    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @eprez

    Thank you for the information.

    I sent this to our developers and asked if we have any hook to prevent it.

    Once the developer update, we will let you know.

    Best Regards
    Patrick Freitas

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @eprez

    Could you please try this code as a mu-plugin?

    <?php
    
    add_action(
    	'forminator_custom_form_mail_before_send_mail',
    	function(){
    		add_filter( 'wp_mail', function( $email_data ){
    			$backtrace_functions = array_column( debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ), 'function' );
    			if ( in_array( 'forminator_new_user_notification', $backtrace_functions ) ) {
    				$email_data['to'] = array( '' );
    			}
    		 	return $email_data;
    		} );
    	}
    );

    If you are not familiar with mu-plugins:
    https://premium.wpmudev.org/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    We also tasked it to the plugin developers to improve the plugin.

    Let us know if the code worked.
    Best Regards
    Patrick Freitas

    Thread Starter eprez

    (@eprez)

    Hey @wpmudevsupport12,

    the code seems to do the trick!
    The system mail is blocked and the custom one gets sent.

    Thanks Patrick!

    EDIT: doesn’t seem to work with “Email Activation” activation method.

    • This reply was modified 5 years, 6 months ago by eprez.
    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @eprez

    I forwarded this new information to our developers to double-check the “Email Activation”

    We will keep you posted.

    Best Regards
    Patrick Freitas

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @eprez

    Could you please try this code instead of the previous one?

    add_action(
    	'forminator_custom_form_mail_before_send_mail',
    	function(){
    		add_filter( 'wp_mail', function( $email_data ){
    			$backtrace_functions = array_column( debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ), 'function' );
    			if ( in_array( 'process_registration', $backtrace_functions ) ) {
    				$email_data['to'] = array( '' );
    			}
    		 	return $email_data;
    		} );
    	}
    );

    Best Regards
    Patrick Freitas

    Thread Starter eprez

    (@eprez)

    Hello @wpmudevsupport12,

    I tried the new code as a MU-plugin and it seems to kill all registration emails both to the user and admin. The user won’t even get the activation link.

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @eprez

    Sorry to hear this, I pinged our developers again.

    Best Regards
    Patrick Freitas

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @eprez

    I hope you are doing well.

    EDIT: doesn’t seem to work with “Email Activation” activation method.

    Do you have any email configured on Forminator > Form > Email?

    If so, have you tried to remove it and check if makes any difference?

    Could you also extend a but more on what is happening on the Email Activation when the first mu-plugin is enabled?

    Bet Regards
    Patrick Freitas

    Thread Starter eprez

    (@eprez)

    Hi @wpmudevsupport12.

    Situation before was this.
    Had 1st mu-plugin and 2 custom emails configured in the form: 1 for the user and 1 for the admin. Result was:

    • User gets system activation email and custom email (OK)
    • Admin gets custom email AND system email (which should have been disabled).

    Now I have made further tests by using the 1st mu-plugin and deleting the custom emails from the form. Turns out things seem to work out ok after re-creating the emails! Not sure what changed, if anything. At the moment the situation is:

    • User gets system activation email and custom email (OK)
    • Admin gets just the custom email (OK!)

    Again, not exactly sure what changed. I’ve been doing the tests in a local sandbox environment, so I haven’t fiddle with much else in the mean time.

    Things are working fine this way, thank you for the support Patrick. Seems the mu-plugin code works well even as a code snippet.

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @eprez

    Thank you for the update, we sent this to the plugin team.

    We are also going to improve this directly on the plugin core, so please, keep the plugin updated.

    Best Regards
    Patrick Freitas

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

The topic ‘Interfering with email notifications’ is closed to new replies.