Forminator and Subscribe by email

When someone fills out a Forminator form to enable downloading an ebook, I want to add them to my weekly Subscribe by Email list so that they get my latest marketing information (blog posts). Its possible?

  • Konstantinos Xenos

    Hi Larry Levenson !

    Could you please try with adding this code into your themes functions.php ( preferably the child themes ).

    add_action( 'forminator_custom_form_after_save_entry', 'custom_after_my_form_submit' );
    function custom_after_my_form_submit() {
    	if ( ! empty( $_REQUEST['form_id'] ) && ! empty( $_REQUEST['email-1'] ) ) {
    		$form_id           = 67;
    		$user_email        = sanitize_email( $_REQUEST['email-1'] );
    		$subscription_type = 'Automated Books Form';
    
    		if ( intval( $_REQUEST['form_id'] ) == $form_id && class_exists( 'Incsub_Subscribe_By_Email' ) ) {
    			Incsub_Subscribe_By_Email::subscribe_user( $user_email, $subscription_type, 'Instant', true, array() );
    		}
    	}
    }

    You will have to do some edits to customize it to your needs so here's how to do that:

    The "$_REQUEST['email-1']" has to be changed if the fields name is different. You can easily find the identifier by making a Right Click with your mouse and select Inspect to view the fields code in the browser's console. For me it was "email-1" and it will most likely be the same for you, but just to be sure.

    The "$subscription_type = 'Automated Books Form';" will be the Type that you'll be able to see on the Subscribers List, you can change that into anything else that might fit your needs best.

    And the "$form_id = 67;" should be changed to your Form's ID, you can easily find that by the shortcode that you used to show the form.

    If you're not comfortable changing code yourself, you can send me the information needed to make the changes for you privately through our contact form: https://premium.wpmudev.org/contact/#i-have-a-different-question by following this example:

    Subject: "Attn: Konstantinos Xenos"
    
    - Admin login ( if Multisite please provide Super Admin details ):
    Admin Username:
    Admin Password:
    Login URL: 
    
    - FTP credentials
    Hostname:
    Username:
    Password:
    Port:
    Key-File ( and password ) if needed
    
    - Link back to this thread for reference
    - Link to a page that has the Form we're trying to read
    - Any other relevant URLs -or- information regarding the issue that was not included in this thread

    Regards,
    Konstantinos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.