Noptin_Gravity_Forms::process_feed( array $feed, array $entry, array $form )

Process the feed action.


Parameters Parameters

$feed

(array) (Required) The feed object to be processed.

$entry

(array) (Required) The entry object currently being processed.

$form

(array) (Required) The form object currently being processed.


Top ↑

Source Source

File: includes/integrations/class-noptin-gravity-forms.php

    public function process_feed( $feed, $entry, $form ) {

		// Map the submitted fields.
        $field_map = $this->get_field_map_fields( $feed, 'noptinFields' );

		// Prepare subscriber details.
		$subscriber = array(
			'_subscriber_via' => __( 'Gravity Forms', 'newsletter-optin-box' ),
			'conversion_page' => $entry['source_url'],
        );

        // Add the subscriber's IP address.
		$address = noptin_get_user_ip();
		if ( ! empty( $address ) && '::1' !== $address ) {
			$subscriber['ip_address'] = $address;
		}

		// Add mapped fields.
        foreach ( $field_map as $noptin => $gravity_forms ) {

			// If no field is mapped, skip it.
            if ( rgblank( $gravity_forms ) ) {
                continue;
			}

            $subscriber[ $noptin ] = $this->get_field_value( $form, $entry, $gravity_forms );
        }

		// We need an email.
		if ( empty( $subscriber['email'] ) ) {
			return;
		}

		// Add integration data.
		$subscriber['integration_data'] = compact( 'form', 'entry', 'feed' );

		// Filter the subscriber fields.
		$subscriber = apply_filters( 'noptin_gravity_forms_integration_new_subscriber_fields', $subscriber, $this );

		// Register the subscriber.
		add_noptin_subscriber( $subscriber );

    }


Top ↑

User Contributed Notes User Contributed Notes

30 day money back guarantee
Safe & Secure online payment
Custom CSS Slide Example
Custom Animation Example
Default Animation