WP Residence Help WP Residence Help

  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API
Home / WPResidence / WPEstate CRM / WPResidence CRM Activity Timeline — Developer Reference

WPResidence CRM Activity Timeline — Developer Reference

50 views 0

The Activity module is the audit log of the WPResidence real estate CRM. This article documents the schema, the write API, the triggers, and the valid activity types.

Storage — wp_wpresidence_crm_activities

14 columns. Created in libs/db-setup.php. The schema mirrors legacy and new column names during the ongoing rename:

Legacy New
entity_id contact_id
action type

Other columns: activity_id, user_id, entity_type, deal_id, task_id, listing_id, subject, message, meta (JSON longtext), created_at.

Indexes on (entity_type, entity_id), user_id, contact_id, deal_id, type, created_at.

Write API — libs/activity-crud.php

Function Purpose
wpestate_crm_record_activity() Legacy schema writer (entity_type + entity_id + action)
wpestate_crm_record_activity_v2() New preferred writer (contact_id / deal_id / task_id / listing_id + type)
wpestate_crm_add_note($entity_type, $entity_id, $note) Convenience for adding a note
wpestate_crm_get_activities($args) Filters: user_id, contact_id, deal_id, task_id, type (scalar or array), date range, search

Valid Activity Types

From the source code:

  • note
  • form_submission
  • email_sent
  • call / call_logged
  • contact_created
  • lifecycle_changed
  • status_changed
  • deal_created
  • deal_stage_changed
  • deal_won
  • deal_lost
  • task_created
  • task_completed
  • property_matched
  • listing_email_sent
  • contact_assigned
  • viewed_listing
  • automation_triggered

Automatic Triggers

Source Resulting activity
wpestate_crm_after_insert_contact contact_created
wpestate_crm_after_update_contact lifecycle_changed (when stage differs), contact_assigned (when assigned_agent_id changes)
wpestate_crm_after_insert_deal deal_created
wpestate_crm_after_update_deal deal_stage_changed, deal_won, deal_lost
wpestate_crm_after_insert_task task_created
wpestate_crm_after_complete_task task_completed
libs/auto-create.php form_submission
libs/matching-functions.php property_matched, listing_email_sent
libs/viewed-functions.php viewed_listing
libs/automations.php automation_triggered
libs/notifications.php email_sent (on successful send)
libs/twilio.php sms_sent

Templates

  • page-templates/wpestate-crm-dashboard_activity.php — site-wide timeline.
  • templates/crm_activity_unit.php — single row partial. Reused on contact/deal detail pages.

Downstream Hook

wpestate_crm_after_record_activity fires after every insert. Subscribers include the automations engine (looks for call_logged to auto-promote contacts) and the webhooks dispatcher (emits form_submitted webhook for form_submission activities).

Meta Column

Activities can store structured extra data in meta as JSON. Examples: form_submission stores {form_type, listing_id}; listing_email_sent stores {listing_count, listing_ids}; property_matched stores {match_count, criteria_summary}. Read via json_decode($row->meta, true).

Permissions

Gated by wpestate_crm_user_can(‘activities’, $action). Non-admin queries scoped to the user’s contacts via joins on contact_id.

WPResidence / WPEstate CRM

Related Articles

  • WPResidence CRM Security Model — Developer Reference
  • CRM Security and Data Privacy
  • WPResidence CRM Installation and Updates — Developer Reference
  • Installing and Updating the WPResidence CRM

Help Categories

  • 18Agent, Agency & Developers
  • 5Blog Posts & Blog Lists
  • 38Elementor Shortcodes Built-In
  • 45FAQ
  • 15Footer
  • 5Getting Started
  • 37Header
  • 2IDX & MLSImport
  • 6Installation & Setup
  • 23Installation FAQ
  • 23Maps & Location Settings
  • 21Multi-Language Third Party Plugins
  • 6Other Third party Plugins
  • 19Pages
  • 4Payments & Monetization
  • 20Property Lists, Categories & Archive
  • 36Property Pages & Layouts
  • 31Search & Filtering
  • 162Technical how to | Custom Code Required
  • 8Technical: Actions and filters
  • 6Technical: Child Theme
  • 86Theme Options & Global Settings
  • 6Translations & Languages
  • 16WPBakery Shortcodes
  • 51WPResidence / WPEstate CRM
  • 50WPResidence 5.0 Documentation
  • 8WPResidence Elementor Studio
  • 50WPResidence Translate Plugin

Join Us On

Powered by WP Estate - All Rights Reserved
  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API