Make WordPress Core

Changeset 25615


Ignore:
Timestamp:
09/24/2013 11:40:41 PM (10 years ago)
Author:
nacin
Message:

Use the wpdb method instead of $wpdb->prefix.

props hakre.
fixes #16756.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/capabilities.php

    r25438 r25615  
    9696    function _init () {
    9797        global $wpdb, $wp_user_roles;
    98         $this->role_key = $wpdb->prefix . 'user_roles';
     98        $this->role_key = $wpdb->get_blog_prefix() . 'user_roles';
    9999        if ( ! empty( $wp_user_roles ) ) {
    100100            $this->roles = $wp_user_roles;
     
    132132
    133133        // Duplicated from _init() to avoid an extra function call.
    134         $this->role_key = $wpdb->prefix . 'user_roles';
     134        $this->role_key = $wpdb->get_blog_prefix() . 'user_roles';
    135135        $this->roles = get_option( $this->role_key );
    136136        if ( empty( $this->roles ) )
     
    710710
    711711        if ( empty($cap_key) )
    712             $this->cap_key = $wpdb->prefix . 'capabilities';
     712            $this->cap_key = $wpdb->get_blog_prefix() . 'capabilities';
    713713        else
    714714            $this->cap_key = $cap_key;
     
    860860        global $wpdb;
    861861        $this->user_level = array_reduce( array_keys( $this->allcaps ), array( $this, 'level_reduction' ), 0 );
    862         update_user_meta( $this->ID, $wpdb->prefix . 'user_level', $this->user_level );
     862        update_user_meta( $this->ID, $wpdb->get_blog_prefix() . 'user_level', $this->user_level );
    863863    }
    864864
     
    902902        $this->caps = array();
    903903        delete_user_meta( $this->ID, $this->cap_key );
    904         delete_user_meta( $this->ID, $wpdb->prefix . 'user_level' );
     904        delete_user_meta( $this->ID, $wpdb->get_blog_prefix() . 'user_level' );
    905905        $this->get_role_caps();
    906906    }
  • trunk/src/wp-includes/ms-blogs.php

    r25276 r25615  
    499499
    500500    $wpdb->set_blog_id( $new_blog );
    501     $GLOBALS['table_prefix'] = $wpdb->prefix;
     501    $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix();
    502502    $prev_blog_id = $GLOBALS['blog_id'];
    503503    $GLOBALS['blog_id'] = $new_blog;
     
    562562    $prev_blog_id = $GLOBALS['blog_id'];
    563563    $GLOBALS['blog_id'] = $blog;
    564     $GLOBALS['table_prefix'] = $wpdb->prefix;
     564    $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix();
    565565
    566566    if ( function_exists( 'wp_cache_switch_to_blog' ) ) {
  • trunk/src/wp-includes/user.php

    r25606 r25615  
    249249        return false;
    250250
    251     if ( $user->has_prop( $wpdb->prefix . $option ) ) // Blog specific
    252         $result = $user->get( $wpdb->prefix . $option );
     251    $prefix = $wpdb->get_blog_prefix();
     252    if ( $user->has_prop( $prefix . $option ) ) // Blog specific
     253        $result = $user->get( $prefix . $option );
    253254    elseif ( $user->has_prop( $option ) ) // User specific and cross-blog
    254255        $result = $user->get( $option );
     
    281282
    282283    if ( !$global )
    283         $option_name = $wpdb->prefix . $option_name;
     284        $option_name = $wpdb->get_blog_prefix() . $option_name;
    284285
    285286    return update_user_meta( $user_id, $option_name, $newvalue );
     
    305306
    306307    if ( !$global )
    307         $option_name = $wpdb->prefix . $option_name;
     308        $option_name = $wpdb->get_blog_prefix() . $option_name;
    308309    return delete_user_meta( $user_id, $option_name );
    309310}
Note: See TracChangeset for help on using the changeset viewer.