WP Residence Help WP Residence Help

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

WPResidence CRM Activity Timeline — Developer Reference

13 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.

13. 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

WP Residence Documentation

  • 01. Getting Started
    • How to Get Support
    • Get your buyer license code.
    • Use SSL / https
    • Server / Theme Requirements
  • 02. Installation & Setup
  • 03. Installation FAQ
  • 06. Search & Filtering
    • Advanced Search Display Settings
    • Advanced Search Form
    • Geolocation Search for Half Map
    • Save Search Theme Options
    • Advanced Search Colors
  • 09. Agent, Agency & Developers
  • 08. Property Pages & Layouts
  • 07. Property Lists, Categories & Archive
  • 14. WPResidence Elementor Studio
  • 10. Blog Posts & Blog List
  • 11. Shortcodes
    • Contact Form
    • Featured Agency/Developer
    • Membership Packages
    • Testimonials
    • Google Map with Property Marker
    • Listings per Agent, Agency or Developer
    • Display Categories
    • Agent List
    • Recent Items Slider
    • Recent items
    • List Properties or Articles by ID
    • Featured Agent
    • Featured Article
    • Featured Property
    • Login & Register Form
    • Icon Content Box Shortcode
  • 12. Widgets
  • 04. Theme Options & Global Settings
    • General Settings
    • User Types Settings
    • Appearance
    • Logos & Favicon
    • Header
    • Footer Style and Colors
    • Price & Currency
    • Property Custom Fields
    • Features & Amenities
    • Listing Labels
    • Theme Slider
    • Permalinks
    • Splash Page
    • Social & Contact
    • Map Settings
    • Pin Management
    • How read from file works
    • General Design Settings
    • Custom Colors Settings
    • Header Design & Colors
    • Mobile Menu Colors
    • User Dashboard Colors
    • Print PDF Design
    • Property, Agent, Blog Lists Design Settings
    • Sidebar Widget Design
    • Font management
    • How to add custom CSS
    • Custom Property Card Unit – Beta version
    • Email Management
    • Import & Export theme options
    • reCaptcha settings
    • YELP API Integration
    • iHomefinder Optima Express IDX
    • MEMBERSHIP & PAYMENT Settings
    • Property Submission Page
    • PayPal Setup
    • Stripe Setup
    • Wire Transfer Payment Method
  • 20. Translations & Languages
  • 26. FAQ
  • 10. Pages
  • 11. Header
  • 12. Footer
  • 05. Maps & Location Settings
  • 18. Payments & Monetization
  • Plugins
    • 19. Included Plugins
    • 22. Third Party Plugins – IDX Compatibility
    • 21. Third-Party Plugins – Multi-Language
    • 23. Third party Plugins – Other
  • Technical
    • 24. Technical how to | Custom Code Required
    • 25. Technical: Child Theme

Join Us On

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