Changeset 15698 for trunk/wp-includes/user.php
- Timestamp:
- 10/04/2010 07:38:32 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/user.php
r15671 r15698 652 652 // Index the blogs by userblog_id and set the visibility flag 653 653 // Visibility is on by default, unless a linked site then off 654 foreach ( $blogs AS$blog ) {654 foreach ( $blogs as $blog ) { 655 655 $blog->visible = true; 656 656 … … 662 662 663 663 // Add the blogs to our list by order 664 foreach ( (array)$order AS$id ) {664 foreach ( (array)$order as $id ) { 665 665 // A previous change was saving the entire blog details into ordered, not just the blog ID - this detects it 666 666 if ( is_object( $id ) && isset( $id->userblog_id ) ) … … 674 674 675 675 // Add any blog not yet ordered to the end 676 foreach ( $newblogs AS$blog ) {676 foreach ( $newblogs as $blog ) { 677 677 $ordered[$blog->userblog_id] = $blog; 678 678 } … … 680 680 // If we're only interested in visible blogs then remove the rest 681 681 if ( $visibility ) { 682 foreach ( (array)$ordered AS$pos => $blog ) {682 foreach ( (array)$ordered as $pos => $blog ) { 683 683 if ( $blog->visible == false ) 684 684 unset( $ordered[$pos] ); … … 1054 1054 global $wpdb; 1055 1055 1056 $clean = array_map('intval', $ids); 1057 if ( 0 == count($clean) ) 1056 $objects = array(); 1057 1058 $ids = array_map('intval', $ids); 1059 foreach ( $ids as $id ) 1060 $objects[$id] = array(); 1061 1062 if ( 0 == count($ids) ) { 1058 1063 return $objects; 1059 1060 $list = implode(',', $clean); 1064 } elseif ( 1 == count($ids) ) { 1065 // Take advantage of the single-user cache 1066 $id = $ids[0]; 1067 $meta = get_metadata('user', $id); 1068 foreach ( $meta as $key => $metavalues ) 1069 foreach ( $metavalues as $value ) 1070 $objects[$id][] = (object)array( 'user_id' => $id, 'meta_key' => $key, 'meta_value' => $value); 1071 1072 return $objects; 1073 } 1074 1075 $list = implode(',', $ids); 1061 1076 1062 1077 $show = $wpdb->hide_errors(); … … 1064 1079 $wpdb->show_errors($show); 1065 1080 1066 $objects = array(); 1067 foreach($clean as $id) { 1068 $objects[$id] = array(); 1069 } 1070 foreach($metavalues as $meta_object) { 1081 foreach ( $metavalues as $meta_object ) 1071 1082 $objects[$meta_object->user_id][] = $meta_object; 1072 }1073 1083 1074 1084 return $objects; … … 1115 1125 function _fill_many_users( &$users ) { 1116 1126 $ids = array(); 1117 foreach( $users as $user_object) {1127 foreach( $users as $user_object ) { 1118 1128 $ids[] = $user_object->ID; 1119 1129 } … … 1121 1131 $metas = get_user_metavalues($ids); 1122 1132 1123 foreach ($users as $user_object) {1124 if ( isset($metas[$user_object->ID])) {1133 foreach ( $users as $user_object ) { 1134 if ( isset($metas[$user_object->ID]) ) { 1125 1135 _fill_single_user($user_object, $metas[$user_object->ID]); 1126 1136 }
Note: See TracChangeset
for help on using the changeset viewer.