MP_Addon_API_Callback::prepare_post_data( int|string $lead_id, string $client_name )
Prepare lead data.
Contents
Parameters Parameters
- $lead_id
-
(int|string) (Required) lead id
- $client_name
-
(string) (Required) First name and second name of the Lead
Return Return
(array|bool)
Source Source
File: calculator-API-add-on/inc/MP_Addon_API_Callback.php
protected static function prepare_post_data( $lead_id, $client_name ) {
$post_data = false;
if ( 'add' === $lead_id || 'new' === $lead_id ) {
$post_data = array(
'post_title' => wp_strip_all_tags( $client_name ),
'post_status' => 'pending',
'post_author' => 1,
'post_type' => MortgagePlatform::$lead,
);
} elseif ( get_post_type( $lead_id ) === MortgagePlatform::$lead ) {
$post_data = array(
'post_title' => wp_strip_all_tags( $client_name ),
'ID' => $lead_id,
'post_type' => MortgagePlatform::$lead,
);
}
return $post_data;
}
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |