bookmark_bordergform_mailchimp_subscription

Description

Modify the subscription object before it is executed.

Usage

add_filter( 'gform_mailchimp_subscription', 'my_function', 10, 6 );

Parameters

  • $subscription array
    Subscription arguments.

  • $list_id string
    MailChimp list ID.

  • $form array
    The form object.

  • $entry array
    The entry object.

  • $feed array
    The feed object.

  • $member array
    The existing member object. (False if member does not currently exist in MailChimp.)

Examples

If a subscriber already exists, set them as subscribed.

Doing this will avoid the double opt-in for existing members.

add_filter( 'gform_mailchimp_subscription', 'update_existing', 10, 6 );

function update_existing( $subscription, $list_id, $form, $entry, $feed, $member ) {
    if ( $member ) {
        $subscription['status'] = 'subscribed';
    }

    return $subscription;
}

Changelog

4.1.9

Added existing member object as $member parameter.

Location

includes/addon/class-gf-mailchimp.php