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::_getAboundedLeadstoUpdate( int|string $id, array $lead_data,  $searches, array $leads_update = array() )

Collect id of abandoned leads to update.


Parameters Parameters

$id

(int|string) (Required) post id

$lead_data

(array) (Required) lead data

$leads_update

(array) (Optional) array of leads to update

Default value: array()


Top ↑

Return Return

(array) Abandoned leads to update.

  • 'id'
    (string) post id


Top ↑

Source Source

File: mortgage-platform/Inc/MP_Searches.php

	private function _getAboundedLeadstoUpdate( $id, $lead_data, $searches, $leads_update = array() ) {

		if ( ! $this->options_leads['abandoned_leads_first_name'] &&
			 ! $this->options_leads['abandoned_leads_second_name'] &&
			 ! $this->options_leads['abandoned_leads_phone'] &&
			 ! $this->options_leads['abandoned_leads_email'] &&
			 ! $this->options_leads['abandoned_leads_zipcode'] &&
			 ! $this->options_leads['abandoned_leads_yearofbirth']
		) {
			$leads_update = array();
		} else {

			if ( $this->options_leads['abandoned_leads_first_name'] ) {
				if ( $searches['firstname'] === $lead_data['firstname'] ) {
					$field_first_name = true;
				} else {
					$field_first_name = false;
				}
			} else {
				$field_first_name = true;
			}

			if ( $this->options_leads['abandoned_leads_second_name'] ) {
				if ( $this->searches['secondname'] === $lead_data['secondname'] ) {
					$field_second_name = true;
				} else {
					$field_second_name = false;
				}
			} else {
				$field_second_name = true;
			}

			if ( $this->options_leads['abandoned_leads_phone'] ) {
				if ( $this->searches['phone'] === $lead_data['phone'] ) {
					$field_phone = true;
				} else {
					$field_phone = false;
				}
			} else {
				$field_phone = true;
			}

			if ( $this->options_leads['abandoned_leads_email'] ) {
				if ( $this->searches['email'] === $lead_data['email'] ) {
					$field_email = true;
				} else {
					$field_email = false;
				}
			} else {
				$field_email = true;
			}

			if ( $this->options_leads['abandoned_leads_zipcode'] ) {
				if ( $this->searches['zipcode'] === $lead_data['zipcode'] ) {
					$field_zipcode = true;
				} else {
					$field_zipcode = false;
				}
			} else {
				$field_zipcode = true;
			}

			if ( $this->options_leads['abandoned_leads_yearofbirth'] ) {
				if ( $this->searches['yearofbirth'] === $lead_data['yearofbirth'] ) {
					$field_yearofbirth = true;
				} else {
					$field_yearofbirth = false;
				}
			} else {
				$field_yearofbirth = true;
			}

			if ( $field_first_name && $field_second_name && $field_phone && $field_email && $field_zipcode && $field_yearofbirth ) {
				$leads_update[] = $id;
			}
		}

		return $leads_update;

	}