Listing User Assign for Listeo: Developer Guide
Developer notes for safe owner assignment customizations, package meta, cron queues, AJAX handlers, email templates, and license-safe extension points.
Architecture overview
The plugin is an admin-only onboarding tool. It registers a ListingPilot Hub submenu, renders a modern admin management screen, creates or matches owner users from listing metadata, updates listing authorship, assigns Listeo user packages, optionally creates WooCommerce payment orders, queues emails, sends SMS through Listeo SMS, and exposes license/update/support workflows.
LUUA_User_HandlerRenders the listing manager and handles user creation, batch processing, package assignment, paid orders, SMS, and inline edits.LUUA_SettingsRegisters settings, tabs, email templates, SMS template, license actions, support form, and license REST callback.{$wpdb->prefix}luua_email_queue stores email notifications and delivery state.Do not customize licensing
Do not modify, intercept, fake, or override license validation, stored license status, local detach state, update package downloads, license REST callbacks, or ListingPilot entitlement checks. License-related endpoints and options are product infrastructure, not extension points.
Core options
| Option | Purpose |
|---|---|
luua_listings_per_page | Admin listing table pagination. |
luua_user_creation_method | email or phone. Phone mode triggers Listeo SMS flow. |
luua_send_email | Enables email queueing for email-based assignment. |
luua_email_subject, luua_email_template | New-user email subject and content. |
luua_existing_user_email_subject, luua_existing_user_email_template | Existing-user assignment email subject and content. |
luua_sms_template | SMS content used when luua_user_creation_method is phone. |
luua_email_batch_size, luua_email_batch_interval | Email queue throughput. |
luua_default_package_id | Fallback package when the batch action does not select a package. |
luua_package_assignment_mode | immediate or paid_order. |
luua_package_duration | Fallback package duration used by the package insert fallback. |
luua_unclaimed_timeout_enabled, luua_unclaimed_timeout, luua_unclaimed_status | Daily unclaimed listing status management. |
luua_enable_debug_log | Enables protected debug logging under uploads. |
Email queue table
Activation creates {$wpdb->prefix}luua_email_queue with id, listing_id, recipient, subject, content, status, created_at, and sent_at. Supported statuses are queued, sent, failed, and cancelled. Uninstall drops this table and clears plugin options/transients.
Listing and user data model
| Data | Use |
|---|---|
listing._email | Email identifier for email mode. Existing users are matched with get_user_by('email'). |
listing._phone | Phone identifier for phone + SMS mode. |
user_meta.phone, user_meta.billing_phone | Existing user lookup keys for phone mode. |
listing._user_package_id | Stores the Listeo user package row ID connected to the listing. |
listing._verified | Used by filters and unclaimed timeout checks. |
listing._user_assigned_date | Used by the unclaimed timeout query. |
Assignment flow
- The admin selects listings from the management table.
- JavaScript sends batches to
luua_bulk_create_users_batch. - The handler validates the listing post type and required identifier.
- The handler matches an existing user by email or phone, or creates a new
owneruser. - The selected package overrides the default package; if neither exists, package assignment is skipped.
- Immediate mode changes
post_authorand assigns the package immediately. - Paid-order mode may create a WooCommerce order or hand off subscription checkout.
- Email mode queues email content; phone mode sends SMS through Listeo SMS.
Package behavior
Available packages are WooCommerce products with product type terms listing_package or listing_package_subscription. Assignment prefers listeo_core_give_user_package() when available. If not available, it inserts into {$wpdb->prefix}listeo_core_user_packages using product meta such as _listing_limit, _listing_duration, _listing_featured, and package option flags.
| Mode/case | Implementation detail |
|---|---|
| Immediate assignment | Runs wp_update_post() to change post_author, assigns package, updates _user_package_id, and may call listeo_core_increase_package_count(). |
| Paid non-subscription package | Creates a WooCommerce order with _luua_claim_listing_id, _luua_claim_user_id, _luua_claim_package_id, and _luua_claim_status=pending_payment. |
| Paid subscription package | Returns an official WooCommerce checkout URL using add-to-cart; the batch does not assign ownership automatically. |
| Payment completion | finalize_paid_claim_order() runs on payment complete, processing, and completed statuses to assign ownership and package. |
SMS integration
Phone mode builds an SMS message from luua_sms_template and sends through Listeo_Sms_Notification::send(). The plugin intentionally fails with clear errors when the official SMS class is missing, listeo_enable_sms is disabled, or listeo_sms_debug is enabled.
AJAX actions
| Action | Purpose |
|---|---|
luua_bulk_create_users_batch | Processes selected listing IDs in AJAX batches. |
luua_update_listing_meta | Inline update for listing _email or _phone. |
luua_update_listing_package | Inline package update/removal for one listing. |
luua_search_listings | Autocomplete search by title, email, or phone. |
luua_process_queue_now | Manual email queue processing. |
luua_get_package_info, luua_get_package_duration | Package metadata helpers for the admin UI. |
luua_test_email | Sends a Pro test email and records a sent log entry. |
luua_send_support_email | Sends support requests with optional validated attachment. |
luua_save_license_key, luua_detach_license_site, luua_reenable_license_site, luua_clear_license_transient | Reserved license actions. Do not override. |
Cron and automation
| Hook | Purpose |
|---|---|
luua_process_email_queue | Processes queued emails according to luua_email_batch_size and luua_email_batch_interval. |
luua_custom_interval | Custom WP-Cron schedule in minutes from luua_email_batch_interval. |
luua_check_unclaimed_listings | Daily status update for unverified listings older than the configured timeout. |
WooCommerce hooks
The plugin suppresses standard customer order emails for LUUA claim orders through WooCommerce email filters, because LUUA sends its own onboarding email/SMS with payment links. It finalizes paid claim orders on woocommerce_payment_complete, woocommerce_order_status_processing, and woocommerce_order_status_completed.
REST route
POST /wp-json/luua/v1/license-update is used for license status updates and is protected by X-LUA-API-TOKEN matching the stored luua_api_token. This route is license infrastructure and must not be used for custom workflows.
Safe customization patterns
- Add preflight reports for duplicate emails, duplicate phones, missing packages, or admin-owned listings.
- Add custom validation before batch processing, while preserving nonce and capability checks.
- Add audit logging after assignment or payment finalization.
- Customize email/SMS templates through settings, not by editing handler code.
- Use a small compatibility plugin for integrations with CRM, SMS logging, or custom package rules.
- Keep license, updater, and product API code untouched.
High-risk areas
- Phone mode can create users without email addresses. Make sure downstream plugins can handle that.
- Paid-order mode intentionally delays ownership assignment until payment completion.
- Subscription packages are not auto-finalized by the batch flow.
- Inline package removal deletes the listing
_user_package_idlink, so verify billing/package policy before exposing it to operators. - The debug log redacts license keys, but debug logging should still be disabled when not troubleshooting.
Regression test checklist
- Email mode creates a new owner user and queues the new-user email.
- Email mode matches an existing user and queues the existing-user email.
- Phone mode matches
phoneandbilling_phoneuser meta. - Phone mode sends SMS only when Listeo SMS is active, enabled, and not in debug mode.
- Immediate package assignment updates listing author and
_user_package_id. - Paid non-subscription packages create WooCommerce orders and finalize on processing/completed/payment complete.
- Subscription package batches include checkout links but do not assign ownership automatically.
- Email queue statuses move correctly from queued to sent or failed, and cancellation works.
- Unclaimed listing cron only affects the intended unverified listings.
- License and update screens remain unchanged and functional.