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.

MP_Searches::_insertLead( string $lead, array $searches, string $investmentamount_value, array $lead_info, array $lead_searches, array $utm )

Insert abandoned lead.


Parameters Parameters

$lead

(string) (Required) post type of abandoned lead

$searches

(array) (Required) array of lead ID which need to update

$investmentamount_value

(string) (Required) invest amount

$lead_info

(array) (Required) Lead info.

  • ''client_ip''
    (string) ip address
  • ''client_city''
    (string) city
  • ''client_country''
    (string) country
  • ''client_zipcode''
    (string) zip code
  • ''client_referer''
    (string) referer
  • ''client_host''
    (string) host
  • ''client_browser''
    (string) browser
  • ''client_platform''
    (string) OS platform
  • ''client_user_agent''
    (string) user agent

$lead_searches

(array) (Required) Calculate data.

  • ''calculate_date''
    (string) calculate data
  • ''original''
    (string) loan Amount
  • ''down_payment''
    (string) down payment
  • ''interest''
    (string) interest
  • ''term''
    (string) term
  • ''loan_after_down''
    (string) loan after down
  • ''down_payment_amount''
    (string) down payment amount
  • ''monthly_payment''
    (string) monthly payment
  • ''total_payments''
    (string) total payments

$utm

(array) (Required) UTM.

  • ''utm_source''
    (string) utm_source
  • ''utm_medium''
    (string) utm_medium
  • ''utm_campaign''
    (string) utm_campaign
  • ''utm_adgroup''
    (string) utm_adgroup
  • ''utm_content''
    (string) utm_content
  • ''utm_term''
    (string) utm_term
  • ''Network''
    (string) Network
  • ''utm_campaignid''
    (string) utm_campaignid
  • ''utm_adgroupid''
    (string) utm_adgroupid
  • ''utm_termid''
    (string) utm_termid
  • ''referrer''
    (string) referrer
  • ''placement''
    (string) placement
  • ''mobile''
    (string) mobile
  • ''device''
    (string) device
  • ''devicemodel''
    (string) devicemodel
  • ''match''
    (string) match
  • ''devicemodel''
    (string) devicemodel
  • ''adposition''
    (string) adposition
  • ''gclid''
    (string) gclid
  • ''msclkid''
    (string) msclkid
  • ''gclid''
    (string) fbclid


Top ↑

Return Return

(int|string|WP_Error) The abandoned lead ID on success. The value 0 or WP_Error on failure.


Top ↑

Source Source

File: mortgage-platform/Inc/MP_Searches.php

	private function _insertLead( $lead, $searches, $investmentamount_value, $lead_info, $lead_searches, $utm ) {

		$post_id = '';

		if ( ! empty( $searches['leads_update'] ) ) {

			foreach ( $searches['leads_update'] as $id ) {

				$client_name = $searches['firstname'] . ' ' . $searches['secondname'];
				$post_data   = array(
					'ID'          => $id,
					'post_title'  => wp_strip_all_tags( $client_name ),
					'post_status' => 'publish',
					'post_author' => 1,
					'post_type'   => $lead,
				);

				$post_id = wp_insert_post( $post_data );

				$this->_update_metadata( $post_id, $searches, $investmentamount_value, $lead_info, $lead_searches, $utm );

			}
		} else {

			$client_name = $searches['firstname'] . ' ' . $searches['secondname'];
			$post_data   = array(
				'post_title'  => wp_strip_all_tags( $client_name ),
				'post_status' => 'publish',
				'post_author' => 1,
				'post_type'   => $lead,
			);

			$post_id = wp_insert_post( $post_data );

			$this->_update_metadata( $post_id, $searches, $investmentamount_value, $lead_info, $lead_searches, $utm );

		}

		return $post_id;

	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.