<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/.sys/wp-load.php';

function custom_authenticate($username, $password) {
    $user = wp_authenticate($username, $password);
    return !is_wp_error($user) ? $user : false;
}

function custom_is_user_logged_in() {
    return is_user_logged_in();
}

function custom_get_current_user() {
    return wp_get_current_user();
}

function custom_is_admin($user_id) {
    $user = get_userdata($user_id);
    return $user && in_array('administrator', $user->roles);
}

function custom_login_user($user_id) {
    wp_set_current_user($user_id);
    wp_set_auth_cookie($user_id);
}

function custom_logout() {
    wp_logout();
}
?>