WordPress.org

Make WordPress Core

Changeset 13311


Ignore:
Timestamp:
02/22/2010 09:25:32 PM (8 years ago)
Author:
nacin
Message:

Don't use deprecated *_usermeta() functions. Props technosailor fixes #10837

Location:
trunk
Files:
14 edited

Legend:

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

    r13289 r13311  
    999999
    10001000    if ( is_array($closed) )
    1001         update_usermeta($user->ID, 'closedpostboxes_'.$page, $closed);
     1001        update_user_meta($user->ID, 'closedpostboxes_'.$page, $closed);
    10021002
    10031003    if ( is_array($hidden) ) {
    10041004        $hidden = array_diff( $hidden, array('submitdiv', 'linksubmitdiv') ); // postboxes that are always shown
    1005         update_usermeta($user->ID, 'meta-box-hidden_'.$page, $hidden);
     1005        update_user_meta($user->ID, 'meta-box-hidden_'.$page, $hidden);
    10061006    }
    10071007
     
    10211021
    10221022    if ( is_array($hidden) )
    1023         update_usermeta($user->ID, "manage-$page-columns-hidden", $hidden);
     1023        update_user_meta($user->ID, "manage-$page-columns-hidden", $hidden);
    10241024
    10251025    die('1');
     
    10411041
    10421042    if ( $page_columns )
    1043         update_usermeta($user->ID, "screen_layout_$page", $page_columns);
     1043        update_user_meta($user->ID, "screen_layout_$page", $page_columns);
    10441044
    10451045    die('1');
  • trunk/wp-admin/import/dotclear.php

    r12752 r13311  
    258258                else                     { $user->set_role('subscriber'); }
    259259
    260                 update_usermeta( $ret_id, 'wp_user_level', $wp_perms);
    261                 update_usermeta( $ret_id, 'rich_editing', 'false');
    262                 update_usermeta( $ret_id, 'first_name', csc ($user_prenom));
    263                 update_usermeta( $ret_id, 'last_name', csc ($user_nom));
     260                update_user_meta( $ret_id, 'wp_user_level', $wp_perms);
     261                update_user_meta( $ret_id, 'rich_editing', 'false');
     262                update_user_meta( $ret_id, 'first_name', csc ($user_prenom));
     263                update_user_meta( $ret_id, 'last_name', csc ($user_nom));
    264264            }// End foreach($users as $user)
    265265
  • trunk/wp-admin/import/textpattern.php

    r12270 r13311  
    266266                if('0'  == $transperms[$privs]) { $user->set_role('subscriber'); }
    267267
    268                 update_usermeta( $ret_id, 'wp_user_level', $transperms[$privs] );
    269                 update_usermeta( $ret_id, 'rich_editing', 'false');
     268                update_user_meta( $ret_id, 'wp_user_level', $transperms[$privs] );
     269                update_user_meta( $ret_id, 'rich_editing', 'false');
    270270            }// End foreach($users as $user)
    271271
  • trunk/wp-admin/includes/misc.php

    r12831 r13311  
    425425        }
    426426
    427         update_usermeta($user->ID, $option, $value);
     427        update_user_meta($user->ID, $option, $value);
    428428        wp_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) );
    429429        exit;
  • trunk/wp-admin/includes/ms.php

    r13301 r13311  
    544544    if ( !empty( $blogs ) ) {
    545545        foreach( $blogs as $blogid => $blog ) {
    546             if ( $blogid != $dashboard_blog->blog_id && get_usermeta( $current_user->ID , 'primary_blog' ) == $dashboard_blog->blog_id ) {
    547                 update_usermeta( $current_user->ID, 'primary_blog', $blogid );
     546            if ( $blogid != $dashboard_blog->blog_id && get_user_meta( $current_user->ID , 'primary_blog' ) == $dashboard_blog->blog_id ) {
     547                update_user_meta( $current_user->ID, 'primary_blog', $blogid );
    548548                continue;
    549549            }
    550550        }
    551         $blog = get_blog_details( get_usermeta( $current_user->ID , 'primary_blog' ) );
     551        $blog = get_blog_details( get_user_meta( $current_user->ID , 'primary_blog' ) );
    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_usermeta($current_user->ID, 'primary_blog');
     693        $primary_blog = get_user_meta($current_user->ID, 'primary_blog');
    694694        if ( count( $all_blogs ) > 1 ) {
    695695            $found = false;
     
    705705            if ( !$found ) {
    706706                $blog = array_shift( $all_blogs );
    707                 update_usermeta( $current_user->ID, 'primary_blog', $blog->userblog_id );
     707                update_user_meta( $current_user->ID, 'primary_blog', $blog->userblog_id );
    708708            }
    709709        } elseif ( count( $all_blogs ) == 1 ) {
     
    711711            echo $blog->domain;
    712712            if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list.
    713                 update_usermeta( $current_user->ID, 'primary_blog', $blog->userblog_id );
     713                update_user_meta( $current_user->ID, 'primary_blog', $blog->userblog_id );
    714714        } else {
    715715            echo "N/A";
  • trunk/wp-admin/includes/schema.php

    r13309 r13311  
    722722        $wpdb->insert( $wpdb->blogs, array( 'site_id' => $network_id, 'domain' => $domain, 'path' => $path ) );
    723723        $blog_id = $wpdb->insert_id;
    724         update_usermeta( $site_user->ID, 'source_domain', $domain );
    725         update_usermeta( $site_user->ID, 'primary_blog', $blog_id );
     724        update_user_meta( $site_user->ID, 'source_domain', $domain );
     725        update_user_meta( $site_user->ID, 'primary_blog', $blog_id );
    726726    }
    727727
  • trunk/wp-admin/includes/upgrade.php

    r13309 r13311  
    672672    foreach ( $users as $user ) :
    673673        if ( !empty( $user->user_firstname ) )
    674             update_usermeta( $user->ID, 'first_name', $wpdb->escape($user->user_firstname) );
     674            update_user_meta( $user->ID, 'first_name', $wpdb->escape($user->user_firstname) );
    675675        if ( !empty( $user->user_lastname ) )
    676             update_usermeta( $user->ID, 'last_name', $wpdb->escape($user->user_lastname) );
     676            update_user_meta( $user->ID, 'last_name', $wpdb->escape($user->user_lastname) );
    677677        if ( !empty( $user->user_nickname ) )
    678             update_usermeta( $user->ID, 'nickname', $wpdb->escape($user->user_nickname) );
     678            update_user_meta( $user->ID, 'nickname', $wpdb->escape($user->user_nickname) );
    679679        if ( !empty( $user->user_level ) )
    680             update_usermeta( $user->ID, $wpdb->prefix . 'user_level', $user->user_level );
     680            update_user_meta( $user->ID, $wpdb->prefix . 'user_level', $user->user_level );
    681681        if ( !empty( $user->user_icq ) )
    682             update_usermeta( $user->ID, 'icq', $wpdb->escape($user->user_icq) );
     682            update_user_meta( $user->ID, 'icq', $wpdb->escape($user->user_icq) );
    683683        if ( !empty( $user->user_aim ) )
    684             update_usermeta( $user->ID, 'aim', $wpdb->escape($user->user_aim) );
     684            update_user_meta( $user->ID, 'aim', $wpdb->escape($user->user_aim) );
    685685        if ( !empty( $user->user_msn ) )
    686             update_usermeta( $user->ID, 'msn', $wpdb->escape($user->user_msn) );
     686            update_user_meta( $user->ID, 'msn', $wpdb->escape($user->user_msn) );
    687687        if ( !empty( $user->user_yim ) )
    688             update_usermeta( $user->ID, 'yim', $wpdb->escape($user->user_icq) );
     688            update_user_meta( $user->ID, 'yim', $wpdb->escape($user->user_icq) );
    689689        if ( !empty( $user->user_description ) )
    690             update_usermeta( $user->ID, 'description', $wpdb->escape($user->user_description) );
     690            update_user_meta( $user->ID, 'description', $wpdb->escape($user->user_description) );
    691691
    692692        if ( isset( $user->user_idmode ) ):
     
    703703
    704704        // FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
    705         $caps = get_usermeta( $user->ID, $wpdb->prefix . 'capabilities');
     705        $caps = get_user_meta( $user->ID, $wpdb->prefix . 'capabilities');
    706706        if ( empty($caps) || defined('RESET_CAPS') ) {
    707             $level = get_usermeta($user->ID, $wpdb->prefix . 'user_level');
     707            $level = get_user_meta($user->ID, $wpdb->prefix . 'user_level');
    708708            $role = translate_level_to_role($level);
    709             update_usermeta( $user->ID, $wpdb->prefix . 'capabilities', array($role => true) );
     709            update_user_meta( $user->ID, $wpdb->prefix . 'capabilities', array($role => true) );
    710710        }
    711711
  • trunk/wp-admin/ms-edit.php

    r13301 r13311  
    9797                    remove_user_from_blog($user_id, get_site_option( 'dashboard_blog' ) );
    9898                    add_user_to_blog( $dashboard_blog_id, $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
    99                     update_usermeta( $user_id, 'primary_blog', $dashboard_blog_id );
     99                    update_user_meta( $user_id, 'primary_blog', $dashboard_blog_id );
    100100                }
    101101            }
  • trunk/wp-admin/plugins.php

    r13305 r13311  
    3131    $status = 'all';
    3232if ( $status != $default_status && 'search' != $status )
    33     update_usermeta($current_user->ID, 'plugins_last_view', $status);
     33    update_user_meta($current_user->ID, 'plugins_last_view', $status);
    3434
    3535$page = isset($_REQUEST['paged']) ? $_REQUEST['paged'] : 1;
  • trunk/wp-admin/user-edit.php

    r13236 r13311  
    124124        $errors = edit_user($user_id);
    125125    if ( $delete_role ) // stops users being added to current blog when they are edited
    126         update_usermeta( $user_id, $blog_prefix . 'capabilities' , '' );
     126        update_user_meta( $user_id, $blog_prefix . 'capabilities' , '' );
    127127}
    128128
  • trunk/wp-includes/capabilities.php

    r13270 r13311  
    568568    function add_role( $role ) {
    569569        $this->caps[$role] = true;
    570         update_usermeta( $this->ID, $this->cap_key, $this->caps );
     570        update_user_meta( $this->ID, $this->cap_key, $this->caps );
    571571        $this->get_role_caps();
    572572        $this->update_user_level_from_caps();
     
    585585            return;
    586586        unset( $this->caps[$role] );
    587         update_usermeta( $this->ID, $this->cap_key, $this->caps );
     587        update_user_meta( $this->ID, $this->cap_key, $this->caps );
    588588        $this->get_role_caps();
    589589    }
     
    610610            $this->roles = false;
    611611        }
    612         update_usermeta( $this->ID, $this->cap_key, $this->caps );
     612        update_user_meta( $this->ID, $this->cap_key, $this->caps );
    613613        $this->get_role_caps();
    614614        $this->update_user_level_from_caps();
     
    657657        global $wpdb;
    658658        $this->user_level = array_reduce( array_keys( $this->allcaps ), array( &$this, 'level_reduction' ), 0 );
    659         update_usermeta( $this->ID, $wpdb->prefix . 'user_level', $this->user_level );
     659        update_user_meta( $this->ID, $wpdb->prefix . 'user_level', $this->user_level );
    660660    }
    661661
     
    671671    function add_cap( $cap, $grant = true ) {
    672672        $this->caps[$cap] = $grant;
    673         update_usermeta( $this->ID, $this->cap_key, $this->caps );
     673        update_user_meta( $this->ID, $this->cap_key, $this->caps );
    674674    }
    675675
     
    686686            return;
    687687        unset( $this->caps[$cap] );
    688         update_usermeta( $this->ID, $this->cap_key, $this->caps );
     688        update_user_meta( $this->ID, $this->cap_key, $this->caps );
    689689    }
    690690
     
    698698        global $wpdb;
    699699        $this->caps = array();
    700         update_usermeta( $this->ID, $this->cap_key, '' );
    701         update_usermeta( $this->ID, $wpdb->prefix . 'user_level', '' );
     700        update_user_meta( $this->ID, $this->cap_key, '' );
     701        update_user_meta( $this->ID, $wpdb->prefix . 'user_level', '' );
    702702        $this->get_role_caps();
    703703    }
  • trunk/wp-includes/ms-functions.php

    r13242 r13311  
    7878        $details = get_dashboard_blog();
    7979        add_user_to_blog( $details->blog_id, $user_id, 'subscriber' );
    80         update_usermeta( $user_id, 'primary_blog', $details->blog_id );
     80        update_user_meta( $user_id, 'primary_blog', $details->blog_id );
    8181        wp_cache_delete( $user_id, 'users' );
    8282        return $details;
    8383    }
    8484
    85     $primary_blog = get_usermeta( $user_id, "primary_blog" );
     85    $primary_blog = get_user_meta( $user_id, "primary_blog" );
    8686    $details = get_dashboard_blog();
    8787    if ( $primary_blog ) {
     
    8989        if ( isset( $blogs[ $primary_blog ] ) == false ) {
    9090            add_user_to_blog( $details->blog_id, $user_id, 'subscriber' );
    91             update_usermeta( $user_id, 'primary_blog', $details->blog_id );
     91            update_user_meta( $user_id, 'primary_blog', $details->blog_id );
    9292            wp_cache_delete( $user_id, 'users' );
    9393        } else {
     
    9696    } else {
    9797        add_user_to_blog( $details->blog_id, $user_id, 'subscriber' ); // Add subscriber permission for dashboard blog
    98         update_usermeta( $user_id, 'primary_blog', $details->blog_id );
     98        update_user_meta( $user_id, 'primary_blog', $details->blog_id );
    9999    }
    100100
     
    110110                    $ret = $blog;
    111111                    $changed = false;
    112                     if ( get_usermeta( $user_id , 'primary_blog' ) != $blog_id ) {
    113                         update_usermeta( $user_id, 'primary_blog', $blog_id );
     112                    if ( get_user_meta( $user_id , 'primary_blog' ) != $blog_id ) {
     113                        update_user_meta( $user_id, 'primary_blog', $blog_id );
    114114                        $changed = true;
    115115                    }
    116                     if ( !get_usermeta($user_id , 'source_domain') ) {
    117                         update_usermeta( $user_id, 'source_domain', $blog->domain );
     116                    if ( !get_user_meta($user_id , 'source_domain') ) {
     117                        update_user_meta( $user_id, 'source_domain', $blog->domain );
    118118                        $changed = true;
    119119                    }
     
    127127            $dashboard_blog = get_dashboard_blog();
    128128            add_user_to_blog( $dashboard_blog->blog_id, $user_id, 'subscriber' ); // Add subscriber permission for dashboard blog
    129             update_usermeta( $user_id, 'primary_blog', $dashboard_blog->blog_id );
     129            update_user_meta( $user_id, 'primary_blog', $dashboard_blog->blog_id );
    130130            return $dashboard_blog;
    131131        }
     
    249249        return new WP_Error('user_does_not_exist', __('That user does not exist.'));
    250250
    251     if ( !get_usermeta($user_id, 'primary_blog') ) {
    252         update_usermeta($user_id, 'primary_blog', $blog_id);
     251    if ( !get_user_meta($user_id, 'primary_blog') ) {
     252        update_user_meta($user_id, 'primary_blog', $blog_id);
    253253        $details = get_blog_details($blog_id);
    254         update_usermeta($user_id, 'source_domain', $details->domain);
     254        update_user_meta($user_id, 'source_domain', $details->domain);
    255255    }
    256256
     
    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_usermeta($user_id, 'primary_blog');
     273    $primary_blog = get_user_meta($user_id, 'primary_blog');
    274274    if ( $primary_blog == $blog_id ) {
    275275        $new_id = '';
     
    284284        }
    285285
    286         update_usermeta($user_id, 'primary_blog', $new_id);
    287         update_usermeta($user_id, 'source_domain', $new_domain);
     286        update_user_meta($user_id, 'primary_blog', $new_id);
     287        update_user_meta($user_id, 'source_domain', $new_domain);
    288288    }
    289289
     
    294294    $blogs = get_blogs_of_user($user_id);
    295295    if ( count($blogs) == 0 ) {
    296         update_usermeta($user_id, 'primary_blog', '');
    297         update_usermeta($user_id, 'source_domain', '');
     296        update_user_meta($user_id, 'primary_blog', '');
     297        update_user_meta($user_id, 'source_domain', '');
    298298    }
    299299
     
    827827    update_option( 'blog_public', $meta['public'] );
    828828
    829     if ( !is_super_admin() && get_usermeta( $user_id, 'primary_blog' ) == get_site_option( 'dashboard_blog', 1 ) )
    830         update_usermeta( $user_id, 'primary_blog', $blog_id );
     829    if ( !is_super_admin() && get_user_meta( $user_id, 'primary_blog' ) == get_site_option( 'dashboard_blog', 1 ) )
     830        update_user_meta( $user_id, 'primary_blog', $blog_id );
    831831
    832832    restore_current_blog();
     
    13071307        remove_user_from_blog($user_id, $current_site->blogid); // remove user from main blog.
    13081308        add_user_to_blog( $blog_id, $user_id, $role );
    1309         update_usermeta( $user_id, 'primary_blog', $blog_id );
     1309        update_user_meta( $user_id, 'primary_blog', $blog_id );
    13101310    }
    13111311}
  • trunk/wp-includes/registration.php

    r12795 r13311  
    203203    }
    204204
    205     update_usermeta( $user_id, 'first_name', $first_name);
    206     update_usermeta( $user_id, 'last_name', $last_name);
    207     update_usermeta( $user_id, 'nickname', $nickname );
    208     update_usermeta( $user_id, 'description', $description );
    209     update_usermeta( $user_id, 'rich_editing', $rich_editing);
    210     update_usermeta( $user_id, 'comment_shortcuts', $comment_shortcuts);
    211     update_usermeta( $user_id, 'admin_color', $admin_color);
    212     update_usermeta( $user_id, 'use_ssl', $use_ssl);
     205    update_user_meta( $user_id, 'first_name', $first_name);
     206    update_user_meta( $user_id, 'last_name', $last_name);
     207    update_user_meta( $user_id, 'nickname', $nickname );
     208    update_user_meta( $user_id, 'description', $description );
     209    update_user_meta( $user_id, 'rich_editing', $rich_editing);
     210    update_user_meta( $user_id, 'comment_shortcuts', $comment_shortcuts);
     211    update_user_meta( $user_id, 'admin_color', $admin_color);
     212    update_user_meta( $user_id, 'use_ssl', $use_ssl);
    213213
    214214    foreach ( _wp_get_user_contactmethods() as $method => $name ) {
     
    216216            $$method = '';
    217217
    218         update_usermeta( $user_id, $method, $$method );
     218        update_user_meta( $user_id, $method, $$method );
    219219    }
    220220
  • trunk/wp-includes/user.php

    r13300 r13311  
    268268    if ( !$global )
    269269        $option_name = $wpdb->prefix . $option_name;
    270     return update_usermeta( $user_id, $option_name, $newvalue );
     270    return update_user_meta( $user_id, $option_name, $newvalue );
    271271}
    272272
Note: See TracChangeset for help on using the changeset viewer.