Wrap metavalue loop in is_array to check to avoid invalid argument warning.

git-svn-id: http://svn.automattic.com/wordpress/trunk@2640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-06-14 22:54:58 +00:00
parent 4a25d166b4
commit fa147528c6
1 changed files with 4 additions and 3 deletions

View File

@ -1168,9 +1168,10 @@ function update_user_cache() {
if ( $users = $wpdb->get_results( $query ) ) :
foreach ($users as $user) :
$metavalues = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->usermeta WHERE user_id = '$user->ID'");
foreach ( $metavalues as $meta )
$user->{$meta->meta_key} = $meta->meta_value;
if ( is_array($metavalues) )
foreach ( $metavalues as $meta )
$user->{$meta->meta_key} = $meta->meta_value;
$cache_userdata[$user->ID] = $user;
$cache_userdata[$user->user_login] =& $cache_userdata[$user->ID];
endforeach;