/** * Responds to Ajax POSTs containing new position information of * responders/alerter, sends back the location of all of this * alert's responders. * * @global $_POST * * @todo Should the WP_Buoy_Alert object be responsible for handling * metadata associated with responder location updates? Right * now, this is all just manually updates of postmeta. Not the * best way to this in the long run, methinks. * * @return void */ public static function handleLocationUpdate() { check_ajax_referer(self::$prefix . '_incident_nonce', self::$prefix . '_nonce'); if (isset($_POST['incident_hash'])) { $alert = new WP_Buoy_Alert($_POST['incident_hash']); if (isset($_POST['pos'])) { $alert->set_responder_geo(get_current_user_id(), $_POST['pos']); wp_send_json_success($alert->get_incident_state()); } } wp_send_json_error(); }