Make WordPress Core

Changeset 3038


Ignore:
Timestamp:
11/11/2005 12:55:31 AM (19 years ago)
Author:
ryan
Message:

Don't loop over empty list. Props skippy. fixes #1467

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/pluggable-functions.php

    r3035 r3038  
    4343    $metavalues = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->usermeta WHERE user_id = '$user_id'");
    4444
    45     foreach ( $metavalues as $meta ) {
    46         @ $value = unserialize($meta->meta_value);
    47         if ($value === FALSE)
    48             $value = $meta->meta_value;
    49         $user->{$meta->meta_key} = $value;
    50 
    51         // We need to set user_level from meta, not row
    52         if ( $wpdb->prefix . 'user_level' == $meta->meta_key )
    53             $user->user_level = $meta->meta_value;
    54     }
     45    if ($metavalues) {
     46        foreach ( $metavalues as $meta ) {
     47            @ $value = unserialize($meta->meta_value);
     48            if ($value === FALSE)
     49                $value = $meta->meta_value;
     50            $user->{$meta->meta_key} = $value;
     51
     52            // We need to set user_level from meta, not row
     53            if ( $wpdb->prefix . 'user_level' == $meta->meta_key )
     54                $user->user_level = $meta->meta_value;
     55        } // end foreach
     56    } //end if
    5557
    5658    wp_cache_add($user_id, $user, 'users');
Note: See TracChangeset for help on using the changeset viewer.