| | |
| | | */ |
| | | function jvbGetUserByFirstName(string $first_name):WP_User|false |
| | | { |
| | | $cache = CacheManager::for('userFirstname'); |
| | | $cache = CacheManager::for('userFirstname')->connectTo('user'); |
| | | $cached = $cache->get($first_name)??false; |
| | | if ($cached) { |
| | | return get_userdata($cached); |
| | |
| | | */ |
| | | function jvbGetUserByDisplayName(string $display_name):WP_User|false |
| | | { |
| | | $cache = CacheManager::for('user_displaynames'); |
| | | $cache = CacheManager::for('user_displaynames')->connectTo('user'); |
| | | $cached = $cache->get($display_name)??false; |
| | | |
| | | if ($cached && is_int($cached)) { |
| | |
| | | function jvbGetUsername(int $user_id):string |
| | | { |
| | | $key = 'user_display_names'; |
| | | $cache = CacheManager::for('userNames', WEEK_IN_SECONDS); |
| | | $cache = CacheManager::for('userNames', WEEK_IN_SECONDS)->connectTo('user'); |
| | | $cached = $cache->get($user_id); |
| | | |
| | | if ($cached) { |
| | |
| | | return false; |
| | | } |
| | | |
| | | $cache = CacheManager::for('artist', 3600); |
| | | $cache = CacheManager::for('artist', 3600)->connectTo('post'); |
| | | $cached = $cache->get($userID); |
| | | if ($cached) { |
| | | return match ($return) { |
| | |
| | | return 'admin'; |
| | | } |
| | | $user = ($ID === 0) ? wp_get_current_user() : get_userdata($ID); |
| | | error_log('Current User: '.print_r($user, true)); |
| | | return array_values(array_intersect( |
| | | array_keys(array_merge(JVB_USER, ['administrator'])), |
| | | array_map(function ($role) { |