Make WordPress Core

Changeset 13329


Ignore:
Timestamp:
02/23/2010 10:42:40 AM (15 years ago)
Author:
nacin
Message:

Switch over to *_user_meta() syntax. The old get_usermeta() would return a string when only one value was found, get_user_meta() requires $single = true. Fixes #10837

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ms.php

    r13311 r13329  
    544544    if ( !empty( $blogs ) ) {
    545545        foreach( $blogs as $blogid => $blog ) {
    546             if ( $blogid != $dashboard_blog->blog_id && get_user_meta( $current_user->ID , 'primary_blog' ) == $dashboard_blog->blog_id ) {
     546            if ( $blogid != $dashboard_blog->blog_id && get_user_meta( $current_user->ID , 'primary_blog', true ) == $dashboard_blog->blog_id ) {
    547547                update_user_meta( $current_user->ID, 'primary_blog', $blogid );
    548548                continue;
    549549            }
    550550        }
    551         $blog = get_blog_details( get_user_meta( $current_user->ID , 'primary_blog' ) );
     551        $blog = get_blog_details( get_user_meta( $current_user->ID, 'primary_blog', true ) );
    552552        $protocol = ( is_ssl() ? 'https://' : 'http://' );
    553553        wp_redirect( $protocol . $blog->domain . $blog->path . 'wp-admin/?c=' . $c ); // redirect and count to 5, "just in case"
     
    691691        <?php
    692692        $all_blogs = get_blogs_of_user( $current_user->ID );
    693         $primary_blog = get_user_meta($current_user->ID, 'primary_blog');
     693        $primary_blog = get_user_meta($current_user->ID, 'primary_blog', true);
    694694        if ( count( $all_blogs ) > 1 ) {
    695695            $found = false;
  • trunk/wp-admin/includes/upgrade.php

    r13311 r13329  
    705705        $caps = get_user_meta( $user->ID, $wpdb->prefix . 'capabilities');
    706706        if ( empty($caps) || defined('RESET_CAPS') ) {
    707             $level = get_user_meta($user->ID, $wpdb->prefix . 'user_level');
     707            $level = get_user_meta($user->ID, $wpdb->prefix . 'user_level', true);
    708708            $role = translate_level_to_role($level);
    709709            update_user_meta( $user->ID, $wpdb->prefix . 'capabilities', array($role => true) );
  • trunk/wp-includes/ms-functions.php

    r13311 r13329  
    8383    }
    8484
    85     $primary_blog = get_user_meta( $user_id, "primary_blog" );
     85    $primary_blog = get_user_meta( $user_id, 'primary_blog', true );
    8686    $details = get_dashboard_blog();
    8787    if ( $primary_blog ) {
     
    110110                    $ret = $blog;
    111111                    $changed = false;
    112                     if ( get_user_meta( $user_id , 'primary_blog' ) != $blog_id ) {
     112                    if ( get_user_meta( $user_id , 'primary_blog', true ) != $blog_id ) {
    113113                        update_user_meta( $user_id, 'primary_blog', $blog_id );
    114114                        $changed = true;
    115115                    }
    116                     if ( !get_user_meta($user_id , 'source_domain') ) {
     116                    if ( !get_user_meta($user_id , 'source_domain', true) ) {
    117117                        update_user_meta( $user_id, 'source_domain', $blog->domain );
    118118                        $changed = true;
     
    249249        return new WP_Error('user_does_not_exist', __('That user does not exist.'));
    250250
    251     if ( !get_user_meta($user_id, 'primary_blog') ) {
     251    if ( !get_user_meta($user_id, 'primary_blog', true) ) {
    252252        update_user_meta($user_id, 'primary_blog', $blog_id);
    253253        $details = get_blog_details($blog_id);
     
    271271    // If being removed from the primary blog, set a new primary if the user is assigned
    272272    // to multiple blogs.
    273     $primary_blog = get_user_meta($user_id, 'primary_blog');
     273    $primary_blog = get_user_meta($user_id, 'primary_blog', true);
    274274    if ( $primary_blog == $blog_id ) {
    275275        $new_id = '';
     
    827827    update_option( 'blog_public', $meta['public'] );
    828828
    829     if ( !is_super_admin() && get_user_meta( $user_id, 'primary_blog' ) == get_site_option( 'dashboard_blog', 1 ) )
     829    if ( !is_super_admin() && get_user_meta( $user_id, 'primary_blog', true ) == get_site_option( 'dashboard_blog', 1 ) )
    830830        update_user_meta( $user_id, 'primary_blog', $blog_id );
    831831
Note: See TracChangeset for help on using the changeset viewer.