WP Residence Help WP Residence Help

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

WPResidence CRM Tasks — Developer Reference

8 views 0

This article documents the Tasks module of the WPResidence real estate CRM plugin: custom table, CRUD API, AJAX endpoints, overdue detection, and the daily notification cron.

Storage — wp_wpresidence_crm_tasks

19 columns, created in libs/db-setup.php. Like Deals, the schema keeps legacy and new column names side by side during the rename transition.

Dual Column Names

Legacy New
task_title title
task_status status
task_type type
task_priority priority

Default task_status values: Pending / to_do. Default task_priority: Medium / medium.

Additional Columns

task_id, description, due_date, completed_at, contact_id, deal_id, entity_type, entity_id, assigned_to, user_id, created_at, updated_at.

Indexes: user_id, task_status, contact_id, deal_id, status, due_date.

CRUD API — libs/task-crud.php

Function Purpose
wpestate_crm_insert_task($data) Insert; fires wpestate_crm_after_insert_task
wpestate_crm_get_task($id) Fetch one
wpestate_crm_get_tasks($args) Filters: user_id, assigned_to, contact_id, deal_id, task_status, task_type, task_priority, due range, search
wpestate_crm_update_task($id, $data) Update; triggers wpestate_crm_after_complete_task when status becomes Done
wpestate_crm_delete_task($id) Delete
wpestate_crm_bulk_delete_tasks($ids) Bulk delete

AJAX Endpoints

Action Nonce
wpestate_crm_save_task wpestate_crm_save_task
wpestate_crm_delete_task wpestate_crm_delete_task
wpestate_crm_bulk_delete_tasks wpestate_crm_bulk_delete_tasks
wpestate_crm_bulk_update_tasks wpestate_crm_bulk_update_tasks

Templates

  • page-templates/wpestate-crm-dashboard_tasks.php — list with 7 filters.
  • templates/crm_add_task.php — add/edit form.
  • templates/dashboard_task_unit.php — row partial.

Default Picklists

  • crm_task_statuses — To Do, In Progress, Done
  • crm_task_types — Call, Email, Meeting, Showing, Follow Up, Paperwork, Other
  • crm_task_priorities — Low, Medium, High, Urgent

Overdue Detection

A task is overdue when due_date < CURDATE() AND task_status NOT IN (‘Done’, ‘Completed’, ‘Cancelled’). The helper wpestate_crm_stats_tasks_overdue() in libs/stats-functions.php returns the count.

Daily Notification Cron

Cron event wpestate_crm_daily_notifications (scheduled at plugin activation) runs wpestate_crm_daily_task_notifications() in libs/notifications.php. The function:

  1. Queries overdue tasks grouped by user_id.
  2. Queries tasks due today, same grouping.
  3. Sends one task_overdue email per agent, templated with placeholders.
  4. Sends one task_due_today email per agent.
  5. Both templates are editable in Theme Options → Email Management → CRM Emails (legacy keys) or CRM Settings.

Hooks

  • wpestate_crm_after_insert_task — fires after insert.
  • wpestate_crm_after_complete_task — fires when status transitions to Done; webhooks consume it as task.completed.

Permissions and Scope

wpestate_crm_user_can(‘tasks’, $action) enforces role-level access. Non-admin queries filter by user_id or assigned_to. The list page also respects wpestate_crm_get_ownership_where().

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