Viewing 4 replies - 1 through 4 (of 4 total)
  • +1

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello @ sparky672,

    We have tried adding integration with GravityForms, however due the complex nature of their forms, there is no easy way to do it. Below is a method that can be used to only send the email field to your MailChimp.com account.

    To integrate “MailChimp for WordPress” with “Gravity Forms“, you would first need to create a custom field in your GF form and add a css class ‘mc4wp_subscribe” to the custom field. Once done, you would also need to add the below code to the “functions.php” file in your active theme.

    add_filter( 'gform_field_input', 'tracker', 10, 5 );
    function tracker( $input, $field, $value, $lead_id, $form_id ) {
        if ( $field->cssClass == 'mc4wp_subscribe' ) {
            $input = '<input type="checkbox" name="mc4wp-subscribe" value="1" />';
        }
        return $input;
    }

    Please note:

    This does not work for me. Also, it is easy enough to add your custom fields to the a gravity forms HTML field. Still, looking for the code to do this manually. Might be useful to add a function that takes some param options so that it can be called manually from anywhere. Right now, it seems I have to instantiate MC4WP_Custom_Integration and maybe just call the process method, but I am not certain that the values will be gathered correctly since the method you explained above does not work.

    I really do not have much appreciation for over ooping things. Many will argue that it is cleaner and more extendable, I say it’s extreme and you have to hunt down class files throughout excessive directory structures and so on. Makes it too time consuming to path everything out so you can study the code and make sure you are doing what you need.

    Anyway, if you have the time, would you provide me with the code necessary to manually call the process method for MC4WP_Custom_Integration? I’d prefer not to chase down all the classes and methods that are chained here just to get the necessary data values; CLASS MC4WP_Custom_Integration >> method process >> CLASS MC4WP_Integration >> function mc4wp >> CLASS MC4WP_Container >> method get(param “I already have a damn headache”) And here I expect …_Container was supposed to be previously instantiated?

    So, if you could, I would appreciate the quick hack code to process a mailchimp request. That way, I could simply do that at any point I wish within one of the gravity forms hooks.

    If you created a simple function for this (params would be the same or similar option as in the custom integration UI in the admin along with whatever data fields that can be populated), anyone could REALLY use this plugin with any system they have in place. It would be very easy, actually, to integrate this in/with gravity forms by hooking into the “gform_after_submission” action (which has all of the data that was submitted with the form and processing mailchimp in whatever way the user set. The only other work with GF that would be needed is to add a UI in the integrations page for GF where the user can select 1) the forms they wish to use to send data to mailchip and 2)The fields within those forms they want to match to appropriate data fields that mailchimp needs.

    GF completely overcomplicated their code (ridiculously so). I used to have a CSV importer plugin (still there but have not updated to work with their newer api) and when they changed their api, I took a look at their code and did not even want to bother with it. The way they structure their database and field (lead) id’s is beyond ridiculous. It works, but it sucks balls.

    Anyway, your plugin can be easily adjusted to work with GF and any other platform if you would make the quick use function to perform actions in mailchimp. I’d appreciate the code for now if you can. Thanks either way.

    Or maybe I should just access the MC4WP_API class. Going through your docs now.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘What about integration with Gravity Forms?’ is closed to new replies.