mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Add wp_revoke_user() and WP_User::remove_all_caps() to help those doing multi blog stuff.
git-svn-id: http://svn.automattic.com/wordpress/trunk@3705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a8eac8ee6d
commit
b1af79fb05
@ -274,6 +274,13 @@ function wp_delete_user($id, $reassign = 'novalue') {
|
||||
return true;
|
||||
}
|
||||
|
||||
function wp_revoke_user($id) {
|
||||
$id = (int) $id;
|
||||
|
||||
$user = new WP_User($id);
|
||||
$user->remove_all_caps();
|
||||
}
|
||||
|
||||
function get_link($link_id, $output = OBJECT) {
|
||||
global $wpdb;
|
||||
|
||||
|
@ -232,6 +232,14 @@ class WP_User {
|
||||
update_usermeta($this->id, $this->cap_key, $this->caps);
|
||||
}
|
||||
|
||||
function remove_all_caps() {
|
||||
global $wpdb;
|
||||
$this->caps = array();
|
||||
update_usermeta($this->id, $this->cap_key, '');
|
||||
update_usermeta($this->id, $wpdb->prefix.'user_level', '');
|
||||
$this->get_role_caps();
|
||||
}
|
||||
|
||||
//has_cap(capability_or_role_name) or
|
||||
//has_cap('edit_post', post_id)
|
||||
function has_cap($cap) {
|
||||
|
Loading…
Reference in New Issue
Block a user