Make WordPress Core

Changeset 3705


Ignore:
Timestamp:
04/13/2006 04:49:38 AM (18 years ago)
Author:
ryan
Message:

Add wp_revoke_user() and WP_User::remove_all_caps() to help those doing multi blog stuff.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-db.php

    r3700 r3705  
    275275}
    276276
     277function wp_revoke_user($id) {
     278    $id = (int) $id;
     279   
     280    $user = new WP_User($id);
     281    $user->remove_all_caps();   
     282}
     283
    277284function get_link($link_id, $output = OBJECT) {
    278285    global $wpdb;
  • trunk/wp-includes/capabilities.php

    r3668 r3705  
    231231        unset($this->caps[$cap]);
    232232        update_usermeta($this->id, $this->cap_key, $this->caps);
     233    }
     234
     235    function remove_all_caps() {
     236        global $wpdb;
     237        $this->caps = array();
     238        update_usermeta($this->id, $this->cap_key, '');
     239        update_usermeta($this->id, $wpdb->prefix.'user_level', '');
     240        $this->get_role_caps();
    233241    }
    234242
Note: See TracChangeset for help on using the changeset viewer.