Ticket #8663: 8663.diff
File 8663.diff, 4.7 KB (added by , 15 years ago) |
---|
-
wp-includes/user.php
582 582 } 583 583 } 584 584 585 $level = $wpdb-> prefix . 'user_level';585 $level = $wpdb->caps_prefix . 'user_level'; 586 586 if ( isset( $user->{$level} ) ) 587 587 $user->user_level = $user->{$level}; 588 588 -
wp-includes/wp-db.php
386 386 /** 387 387 * Sets the table prefix for the WordPress tables. 388 388 * 389 * Also allows for the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE to390 * override the WordPress users and usersmeta tables that would otherwise be determined by the $prefix.389 * To share WordPress users and usermeta tables across multiple installs, use 390 * the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE defines. 391 391 * 392 * To share their capabilities as well, use the CUSTOM_CAPS_PREFIX define in 393 * addition to the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE defines. 394 * 392 395 * @since 2.5.0 393 396 * 394 397 * @param string $prefix Alphanumeric name for the new prefix. … … 410 413 411 414 if ( defined('CUSTOM_USER_META_TABLE') ) 412 415 $this->usermeta = CUSTOM_USER_META_TABLE; 416 417 if ( defined('CUSTOM_CAPS_PREFIX') && defined('CUSTOM_USER_TABLE') && defined('CUSTOM_USER_META_TABLE') ) 418 $this->caps_prefix = CUSTOM_CAPS_PREFIX; 419 else 420 $this->caps_prefix = $wpdb->prefix; 413 421 414 422 return $old_prefix; 415 423 } -
wp-includes/capabilities.php
99 99 function _init () { 100 100 global $wpdb; 101 101 global $wp_user_roles; 102 $this->role_key = $wpdb-> prefix . 'user_roles';102 $this->role_key = $wpdb->caps_prefix . 'user_roles'; 103 103 if ( ! empty( $wp_user_roles ) ) { 104 104 $this->roles = $wp_user_roles; 105 105 $this->use_db = false; … … 501 501 */ 502 502 function _init_caps() { 503 503 global $wpdb; 504 $this->cap_key = $wpdb-> prefix . 'capabilities';504 $this->cap_key = $wpdb->caps_prefix . 'capabilities'; 505 505 $this->caps = &$this->{$this->cap_key}; 506 506 if ( ! is_array( $this->caps ) ) 507 507 $this->caps = array(); -
wp-admin/includes/upgrade.php
581 581 if ( !empty( $user->user_nickname ) ) 582 582 update_usermeta( $user->ID, 'nickname', $wpdb->escape($user->user_nickname) ); 583 583 if ( !empty( $user->user_level ) ) 584 update_usermeta( $user->ID, $wpdb-> prefix . 'user_level', $user->user_level );584 update_usermeta( $user->ID, $wpdb->caps_prefix . 'user_level', $user->user_level ); 585 585 if ( !empty( $user->user_icq ) ) 586 586 update_usermeta( $user->ID, 'icq', $wpdb->escape($user->user_icq) ); 587 587 if ( !empty( $user->user_aim ) ) … … 606 606 endif; 607 607 608 608 // FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set. 609 $caps = get_usermeta( $user->ID, $wpdb-> prefix . 'capabilities');609 $caps = get_usermeta( $user->ID, $wpdb->caps_prefix . 'capabilities'); 610 610 if ( empty($caps) || defined('RESET_CAPS') ) { 611 $level = get_usermeta($user->ID, $wpdb-> prefix . 'user_level');611 $level = get_usermeta($user->ID, $wpdb->caps_prefix . 'user_level'); 612 612 $role = translate_level_to_role($level); 613 update_usermeta( $user->ID, $wpdb-> prefix . 'capabilities', array($role => true) );613 update_usermeta( $user->ID, $wpdb->caps_prefix . 'capabilities', array($role => true) ); 614 614 } 615 615 616 616 endforeach; -
wp-admin/includes/user.php
204 204 */ 205 205 function get_author_user_ids() { 206 206 global $wpdb; 207 $level_key = $wpdb-> prefix . 'user_level';207 $level_key = $wpdb->caps_prefix . 'user_level'; 208 208 return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) ); 209 209 } 210 210 … … 256 256 return false; 257 257 } 258 258 259 $level_key = $wpdb-> prefix . 'user_level';259 $level_key = $wpdb->caps_prefix . 'user_level'; 260 260 261 261 $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key); 262 262 if ( $exclude_zeros ) … … 301 301 */ 302 302 function get_nonauthor_user_ids() { 303 303 global $wpdb; 304 $level_key = $wpdb-> prefix . 'user_level';304 $level_key = $wpdb->caps_prefix . 'user_level'; 305 305 306 306 return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) ); 307 307 }