Skip to content

Lead

Namespace: DMS\Lead Obtained via: dms_get_lead(), dms_get_all_leads()

Represents a single customer lead (enquiry) associated with a listing.


Public Properties

All properties are populated on load. Read them directly or use set() to update them.

Property Type Description
$id int Lead ID
$listing_id int Associated listing ID
$type_id int Associated inventory type ID
$source string Lead source (e.g. contact form name)
$contact_method string Preferred contact method (email, phone, text)
$customer_name string Customer full name
$customer_email string Customer email address
$customer_phone string Customer phone number
$customer_address string Customer street address
$customer_city string Customer city
$customer_state string Customer state/province
$customer_zip string Customer ZIP/postal code
$customer_country string Customer country
$message string Customer message
$internal_notes string Internal staff notes
$status string Lead status slug (new, contacted, working, won, lost)
$assigned_user_id int WordPress user ID of the assigned salesperson
$follow_up_date string Scheduled follow-up datetime string
$outcome string Lead outcome slug (pending, deal_closed, etc.)
$utm_source string UTM source
$utm_medium string UTM medium
$utm_campaign string UTM campaign
$ip_hash string Hashed IP address
$created_at string Creation datetime string
$updated_at string Last update datetime string
$data array Additional custom data

Methods

get_id(): int

Returns the lead ID.

$id = $lead->get_id();

get_name(): string

Returns the customer name.

echo esc_html( $lead->get_name() );

get_email(): string

Returns the customer email address.

echo esc_html( $lead->get_email() );

get_phone(): string

Returns the customer phone number.

echo esc_html( $lead->get_phone() );

get_listing(): Listing

Returns the Listing object associated with this lead.

$listing = $lead->get_listing();
echo esc_html( $listing->get_title() );

get_type(): Type

Returns the Type object associated with this lead.

$type = $lead->get_type();
echo esc_html( $type->get( 'plural' ) );

set( $key, $value ): void

Updates a lead property in memory. Only saves values for known properties. Call save() to persist.

$lead->set( 'status', 'contacted' );
$lead->set( 'outcome', 'deal_closed' );
$lead->set( 'internal_notes', 'Spoke on the phone, very interested.' );

save(): bool

Persists any changed values (set via set()) to the database.

$lead->set( 'status', 'working' );
$lead->save();