Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Noptin_Contact_Form_7::map_fields( array $posted_data, array $mapped_fields )
Maps custom fields.
Parameters Parameters
- $posted_data
(array) (Required) Posted data
- $mapped_fields
(array) (Required) Fields to map
Return Return
(array)
Source Source
File: includes/integrations/class-noptin-contact-form-7.php
private function map_fields( $posted_data, $mapped_fields ) { // Prepare subscriber details. $subscriber = array( '_subscriber_via' => __( 'Contact Form 7', 'newsletter-optin-box' ), ); // Add the subscriber's IP address. $address = noptin_get_user_ip(); if ( ! empty( $address ) && '::1' !== $address ) { $subscriber['ip_address'] = $address; } // Referral page. if ( ! empty( $_REQUEST['referrer'] ) ) { $subscriber['conversion_page'] = esc_url_raw( $_REQUEST['referrer'] ); } if ( ! empty( $posted_data['_wpcf7_container_post'] ) ) { $subscriber['conversion_page'] = get_permalink( $posted_data['_wpcf7_container_post'] ); } // Add mapped fields. foreach ( $mapped_fields as $noptin => $cf7 ) { if ( isset( $posted_data[ $cf7 ] ) && '' !== $posted_data[ $cf7 ] ) { $subscriber[ $noptin ] = $posted_data[ $cf7 ]; } } return $subscriber; }
Expand full source code Collapse full source code View on GitHub