cacheName = 'user'; $this->cacheTtl = WEEK_IN_SECONDS; parent::__construct(); } public function registerRoutes(): void { // Standard login Route::for('user') ->post([$this, 'handleUpdate']) ->auth(PermissionHandler::combine(['user', 'nonce', ['actionNonce'=>'dash-']])) ->rateLimit() ->register(); } public function handleUpdate(WP_REST_Request $request):WP_REST_Response { $data = $request->get_params(); $user_id = get_current_user_id(); if (!$user_id) { return $this->unauthorized(); } if (!array_key_exists('changes', $data) || empty($data['changes'])) { return $this->success(); } error_log('User route data: '.print_r($data, true)); try { $meta = Meta::forUser($user_id); $meta->setAll($data['changes']); return $this->success(); } catch (Exception $e) { return $this->error($e->getMessage()); } } }