Changeset 12770
- Timestamp:
- 01/19/2010 08:12:04 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
wp-admin/ms-edit.php (modified) (1 diff)
-
wp-includes/capabilities.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/ms-edit.php
r12752 r12770 236 236 reset( $newroles ); 237 237 foreach ( (array) $newroles as $userid => $role ) { 238 $ role_len = strlen( $role);239 $existing_role = $wpdb->get_var( "SELECT meta_value FROM $wpdb->usermeta WHERE user_id = '$userid' AND meta_key = '" . $blog_prefix. "capabilities'" );240 if ( false == $existing_role )241 $wpdb->query( "INSERT INTO " . $wpdb->usermeta . "( `umeta_id` , `user_id` , `meta_key` , `meta_value` ) VALUES ( NULL, '$userid', '" . $blog_prefix . "capabilities', 'a:1:{s:" . strlen( $role ) . ":\"" . $role . "\";b:1;}')" );242 elseif ( $existing_role != "a:1:{s:" . strlen( $role ) . ":\"" . $role . "\";b:1;}" )243 $wpdb->query( "UPDATE $wpdb->usermeta SET meta_value = 'a:1:{s:" . strlen( $role ) . ":\"" . $role . "\";b:1;}' WHERE user_id = '$userid' AND meta_key = '" . $blog_prefix . "capabilities'");238 $user = new WP_User($userid); 239 if ( ! $user ) 240 continue; 241 // Hack. Init user caps for given blog. 242 $user->_init_caps($blog_prefix . 'capabilities'); 243 $user->set_role($role); 244 244 } 245 245 } -
trunk/wp-includes/capabilities.php
r12753 r12770 509 509 * 510 510 * @since 2.1.0 511 * 512 * @param string $cap_key Optional capability key 511 513 * @access protected 512 514 */ 513 function _init_caps( ) {515 function _init_caps( $cap_key = '' ) { 514 516 global $wpdb; 515 $this->cap_key = $wpdb->prefix . 'capabilities'; 517 if ( empty($cap_key) ) 518 $this->cap_key = $wpdb->prefix . 'capabilities'; 519 else 520 $this->cap_key = $cap_key; 516 521 $this->caps = &$this->{$this->cap_key}; 517 522 if ( ! is_array( $this->caps ) )
Note: See TracChangeset
for help on using the changeset viewer.