Developer documentation for the settings layer of the WPResidence real estate CRM. Lives in libs/settings.php.
Option Storage
All settings live in a single serialized option: wpestate_crm_settings. One row in wp_options keeps the entire configuration, reducing option lookups.
Getter API
wpestate_crm_get_setting( $key, $default = '' )
Reads from the wpestate_crm_settings array. Returns the value if present and non-empty, otherwise $default.
Admin Menu
- Parent menu: WPEstate CRM, slug wpestate-crm, position 4.5.
- Submenu: Settings, slug wpestate-crm-settings.
- Capability: manage_options.
Save Handler
wpestate_crm_save_settings()
Registered on admin_post_wpestate_crm_save_settings. Flow:
- Verify nonce action wpestate_crm_save_settings.
- current_user_can(‘manage_options’) check.
- Sanitize input per-field.
- wp_parse_args() merge into existing settings.
- update_option(‘wpestate_crm_settings’, $merged).
- Redirect to the referring tab with a success parameter.
Default Seeder
wpestate_crm_seed_defaults()
Called from the activation routine. Writes any missing keys with their default values but does not overwrite existing non-empty values – safe to re-run on every activation.
Full Key Map
Grouped by functional area:
Contact picklists
- crm_contact_prefixes – Mr, Mrs, Ms, Dr, Prof
- crm_contact_statuses – Active, Inactive, VIP, Blocked
- crm_lifecycle_stages – New Lead, Contacted, Appointment Set, Active Client, Under Contract, Closed
- crm_lead_sources, crm_lead_types, crm_lead_statuses – legacy, kept for compatibility
- crm_enquiry_types – Property Enquiry, General Enquiry, Valuation Request, Viewing Request
- crm_enquiry_statuses – New, Open, Responded, Closed
Deal picklists
- crm_deal_stages, crm_deal_stage_colors – index-matched
- crm_deal_statuses, crm_deal_next_actions, crm_deal_probabilities
Task picklists
- crm_task_statuses, crm_task_types, crm_task_priorities
HubSpot
- crm_hubspot_enabled, crm_hubspot_enabled_for_all, crm_hubspot_api_token, crm_hubspot_first_stage, hubspot_stage_map
Twilio
- crm_twilio_enabled, crm_twilio_account_sid, crm_twilio_auth_token, crm_twilio_from_number
- crm_notify_sms_new_contact_enabled, crm_notify_sms_new_contact_body
Webhooks
- crm_webhook_url, crm_webhook_events
Global
- crm_empty_value_text – default –
Deprecated Keys
These keys exist for back-compat but should not be relied on:
- crm_gdpr_consent_enabled, crm_gdpr_consent_text – the theme’s GDPR banner is authoritative now.
- crm_recaptcha_on_forms – never implemented.
- crm_notify_email_* – email templates moved to Theme Options → Email Management → CRM Emails.
Test Integrations AJAX
| Action | Nonce |
|---|---|
| wpestate_crm_test_hubspot_connection | wpestate_crm_test_hubspot |
| wpestate_crm_test_webhook | wpestate_crm_test_webhook |
| wpestate_crm_send_test_sms | via wpestate_crm_verify_ajax_nonce(‘send_test_sms’) |
All three require manage_options.
Reading Picklists in Your Code
$stages = wpestate_crm_get_setting('crm_deal_stages'); $items = array_map('trim', explode(',', $stages));
Picklists are stored as comma-separated strings and parsed at use time. If you need an array-form API, wrap it in a helper in a child plugin.
Extending
- Add your own settings by writing into the same wpestate_crm_settings option under a custom-prefixed key (for example, myplugin_crm_foo). The save handler accepts any POSTed key so the data survives a save-round-trip if you render an input with that name on the settings page.
- Add a new tab by filtering the tab list in a child plugin and hooking a render callback for it.