Changeset 15703
- Timestamp:
- 10/04/2010 09:59:53 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/user.php
r15702 r15703 1052 1052 */ 1053 1053 function get_user_metavalues($ids) { 1054 global $wpdb;1055 1056 1054 $objects = array(); 1057 1055 … … 1060 1058 $objects[$id] = array(); 1061 1059 1062 if ( 0 == count($ids) ) { 1063 return $objects; 1064 } elseif ( 1 == count($ids) ) { 1065 // Take advantage of the single-user cache 1066 $id = $ids[0]; 1060 update_meta_cache('user', $ids); 1061 1062 foreach ( $ids as $id ) { 1067 1063 $meta = get_metadata('user', $id); 1068 foreach ( $meta as $key => $metavalues ) 1069 foreach ( $metavalues as $value ) 1064 foreach ( $meta as $key => $metavalues ) { 1065 foreach ( $metavalues as $value ) { 1070 1066 $objects[$id][] = (object)array( 'user_id' => $id, 'meta_key' => $key, 'meta_value' => $value); 1071 1072 return $objects; 1073 } 1074 1075 $list = implode(',', $ids); 1076 1077 $show = $wpdb->hide_errors(); 1078 $metavalues = $wpdb->get_results("SELECT user_id, meta_key, meta_value FROM $wpdb->usermeta WHERE user_id IN ($list)"); 1079 $wpdb->show_errors($show); 1080 1081 foreach ( $metavalues as $meta_object ) 1082 $objects[$meta_object->user_id][] = $meta_object; 1067 } 1068 } 1069 } 1083 1070 1084 1071 return $objects; … … 1096 1083 1097 1084 foreach ( $metavalues as $meta ) { 1098 $value = maybe_unserialize($meta->meta_value);1099 1085 // Keys used as object vars cannot have dashes. 1100 1086 $key = str_replace('-', '', $meta->meta_key);
Note: See TracChangeset
for help on using the changeset viewer.