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:
ryan 2006-04-13 04:49:38 +00:00
parent a8eac8ee6d
commit b1af79fb05
2 changed files with 15 additions and 0 deletions

View File

@ -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;

View File

@ -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) {