Dynamically populate ConstantContact list field

I would like to dynamically populate fields in ConstantContact using Hustle optin, so users can choose their Location and then they'll be added to the respective ConstantContact list. Are there webhooks/filters for that kind of thing?

  • Katya Tsihotska

    Hi Joe Sernio

    Hope you're having a wonderful day!

    Since this is dealing with more advanced coding topics, I'm going to ping our SLS Team (code experts) to get their valuable feedback on this question. One of our SLS members will reply back here as soon as more information is available.

    Please keep in mind that our SLS Team deals with more complicated issues, thus it may take a little longer for them to reply here. Thank you for your patience while we look into this further.

    Kind regards,
    Katya

  • Ivan

    Hi Joe Sernio !

    You could try adding the following snippet in a mu-plugin

    <?php
    function wpmu_hustle_change_list( $optin ) {
    	$optin_id = 3;
    	$field_name = 'location';
    
    	if ( $optin_id == $optin->id && !empty( $_POST[ $field_name ] ) ) {
    		switch ( $_POST[ $field_name ] ) {
    			case 'europe':
    				$new_list = 5;
    				break;
    			case 'asia':
    				$new_list = 6;
    				break;
    		}
    		if ( !empty( $new_list ) ) {
    			$optin->optin_mail_list = $new_list;
    		}
    	}
    	return $optin;
    }
    add_filter( 'hustle_submit_optin', 'wpmu_hustle_change_list' );

    Note: 1. you should replace $optin_id to your own optin id (you can see it in URL address on Edit Opt-In page - for example, {your_domain/wp-admin/admin.php?page=inc_optin&optin=3&tab=design})
    2. you should replace $field_name to your own field name (you can see it here - Edit Opt-In page -> Content&Design tab -> Module Fields section - see image below)
    3. you should change logic to set $new_list in switch.

    Also, you should add the following line to {wordpress_folder}/wp-content/plugins/hustle/inc/opt-in-front-ajax.php file via FTP after this line $optin = Opt_In_Model::instance()->get( $data['optin_id'] ); (approximately 45th line)
    $optin = apply_filters( 'hustle_submit_optin' , $optin );

    If it will work for you - I'll ping our developer to implement this filter to the plugin.
    If you need another functionality or it won't work - please, provide me with additional login credentials, I can look into it more.

    https://premium.wpmudev.org/contact/#i-have-a-different-question
    Please visit our private Contact page and complete the form with the following information:

    Subject: "Attn: Ivan Svyrskyi"

    In the Message box, please provide the following:

    - link back to this thread for reference
    - any other relevant urls

    - Admin login:
    Admin username
    Admin password
    Login url

    - FTP/SFTP credentials
    host
    username
    password
    (and port if required)

    Note: Don't send any credentials via this forum because it's public forum.

    Best regards,
    Ivan.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.