| | |
| | | |
| | | use JVBase\JVB; |
| | | use JVBase\rest\RestRouteManager; |
| | | use JVBase\managers\CacheManager; |
| | | use JVBase\managers\Cache; |
| | | use JVBase\meta\MetaManager; |
| | | use JVBase\meta\MetaSanitizer; |
| | | use WP_REST_Request; |
| | |
| | | ]); |
| | | } |
| | | |
| | | $this->queue = JVB()->queue(); |
| | | |
| | | |
| | | $fields = JVB()->getFields('user'); |
| | | $meta = new MetaSanitizer(); |
| | |
| | | //Sanitize values |
| | | $data[$name] = $meta->sanitize($value, $fields[$name]); |
| | | if ($name === 'notify') { |
| | | CacheManager::for('usernames')->delete($user_id); |
| | | Cache::for('usernames')->forget($user_id); |
| | | } |
| | | } |
| | | } |
| | |
| | | $data['notification_preferences'] = $add; |
| | | } |
| | | |
| | | $this->queue->queueOperation( |
| | | JVB()->queue()->queueOperation( |
| | | 'user_settings', |
| | | $user_id, |
| | | $data, |
| | |
| | | } |
| | | |
| | | } |
| | | CacheManager::for($this->cache_name)->invalidate(); |
| | | $this->cache->flush(); |
| | | } |
| | | return [ |
| | | 'success' => true, |
| | |
| | | // Success - commit transaction |
| | | $wpdb->query('COMMIT'); |
| | | |
| | | CacheManager::for($this->cache_name)->invalidate(); |
| | | $this->cache->flush(); |
| | | return [ |
| | | 'success' => true, |
| | | 'result' => 'Notification preferences updated successfully' |