| | |
| | | public function handlePOST(WP_REST_Request $request):WP_REST_Response |
| | | { |
| | | $data = $request->get_params(); |
| | | error_log('Handling update with this data: '.print_r($data, true)); |
| | | $user = $data['user']; |
| | | if (!$this->checkUser($user) || !$this->userCheck($user)) { |
| | | return new WP_REST_Response([ |
| | |
| | | 'message' => 'Looks like you may not be who you say you are...' |
| | | ]); |
| | | } |
| | | error_log('User passed'); |
| | | if ($this->route === 'shop' && !$this->checkTerm([ |
| | | 'term_id' => $data['shop'], |
| | | 'taxonomy' => $this->route |
| | |
| | | 'message' => 'This shop doesn\'t exist?' |
| | | ]); |
| | | } |
| | | error_log('Processing...'); |
| | | $queue = JVB()->queue(); |
| | | unset($data['user']); |
| | | $operationID = $data['id']; |
| | |
| | | } |
| | | protected function handleUpdateOperation(int $userID, array $data):WP_Error|array |
| | | { |
| | | error_log('Handling update Operation with route: '.print_r($this->route, true)); |
| | | if ($this->route === 'options') { |
| | | if (!user_can($userID, 'manage_options')) { |
| | | return [ |
| | |
| | | return array_key_exists($v, $this->config['fields']??[]); |
| | | }, ARRAY_FILTER_USE_BOTH); |
| | | |
| | | error_log('Allowed Result: '.print_r($allowed, true)); |
| | | |
| | | foreach ($allowed as $name => $value) { |
| | | if (empty($value)) { |