Signature
do_action( 'mam_ride_share_driver_update' );
No parameters. The handler reads everything from the request and the resolved app user:
| Request param | Meaning |
|---|---|
subaction=mam_ride_share_driver_update |
Routed by MAM Main’s AJAX dispatcher (do_action() on any registered mam_* subaction) |
actual_lat / actual_lon |
Driver GPS, validated as numerics within ±90/±180 (otherwise treated as 0) |
The acting user comes from mam_user_id(); the ride from the driver’s current_assignment user meta. The handler responds with wp_send_json() (refreshed phone data) and exits — it never returns to the caller.
What one call does
- No current assignment → toggles the driver’s duty state:
tsl_activity_user_is_punched_in(1 = on duty, 2 = off) andtsl_activity_user_active_date(today, WP timezone). - Assignment with no
transport_statusyet → stampsAssigned to Driver. - Otherwise → advances the state machine one step and records a checkpoint; authorization is checked first via
mam_wc_ride_share_user_can_update_ride(assigned driver or manager only).
Current transport_status |
Becomes | Checkpoint meta written | Rider notification |
|---|---|---|---|
| (empty) | Assigned to Driver |
— | — |
Assigned to Driver |
Enroute to Pickup |
enroute_to_pickup |
wc-rc-driver-enroute |
Enroute to Pickup |
Arrived at Pickup |
arrived_at_pickup |
wc-rc-driver-arrived-at-pickup |
Arrived at Pickup |
Departed Pickup |
departed_pickup |
— |
Departed Pickup |
Arrived at Destination |
arrived_at_dest |
— |
Arrived at Destination |
Completed (order → completed, current_assignment cleared) |
trip_completed |
wc-rc-driver-completed-trip |
Each checkpoint value is array( 'time' => <unix>, 'lat' => <float>, 'lon' => <float> ). Cancellation (the rider’s mam_cancel_current_ride subaction) sets transport_status = 'Cancelled' and the order status to cancelled.
The GPS ping path
Between button taps the driver app posts subaction=mam_gps_ping (same dispatcher, handled on the mam_main_ajax filter) with actual_lat, actual_lon, speed. Per ping, on the assigned order:
current_lat,current_lon,current_speed— latest positionpings— appended array of{ lat, lon, speed, time }eta— recomputed via Mapbox against the coordinates of the post returned bymam_post_id_for_eta; stored as a site-local clock string (g:i a) or'NA'arriving_notice— set once when the ETA drops under 2.5 minutes whileEnroute to Pickup(fireswc-rc-arriving-in-two-minutes)
The order-meta contract (read by the apps and sibling plugins)
These keys are a stable contract — the mobile apps and MAM WooCommerce Delivery read them by name. Do not rename them.
| Key | Written at | Value |
|---|---|---|
driver_id |
booking | assigned driver’s WP user id — read by mam-woocommerce-delivery to find a driver’s active order |
transport_status |
every state change | ladder values above — read by mam-woocommerce-delivery when rendering ride-share orders |
eta |
every GPS ping | g:i a clock string or 'NA' — read by mam-woocommerce-delivery‘s service-details card |
enroute_to_pickup, arrived_at_pickup, departed_pickup, arrived_at_dest, trip_completed |
per checkpoint | { time, lat, lon } |
current_lat / current_lon / current_speed, pings, in_motion, arriving_notice |
GPS pings / state changes | live-tracking state |
origin_street, origin_lat/origin_lon, dest_lat/dest_lon, trip_distance (miles), trip_duration (minutes), departure_time, vendor_id, manager_assigned |
booking | trip definition |
Driver-side user meta in the same contract: current_assignment (active order id — also the “driver is busy” marker), parent_pv_account_id, enrollment_code, _user_lat/_user_lon, tsl_activity_user_active_date, tsl_activity_user_is_punched_in.
Interop warning — shared subaction with MAM WooCommerce Delivery
MAM WooCommerce Delivery registers its own handler on this same hook name for its delivery state machine. Both handlers end with wp_send_json() + exit, so if both plugins are active the one registered first answers every driver-update tap. Run a single fulfillment owner (ride-share or delivery) per app.
Related articles
- Recipe: Driver home screen and duty toggle
- Hooks: ride-share authorization filters
- Hook:
mam_post_id_for_eta
Metadata
| Field | Value |
|---|---|
| Article type | Hook Reference |
| Plugin slug | mam-woocommerce-ride-share |
| Applies to plugin version | 1.3.1+ |
| Category | Extending MAM Suite |
| Hook type | action (AJAX subaction entry point) |
| Audience | PHP developer |
| Last verified | 2026-06-10 |
