Changeset 7914 for trunk/bp-xprofile/bp-xprofile-classes.php
- Timestamp:
- 02/17/2014 07:42:03 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/bp-xprofile-classes.php
r7820 r7914 118 118 * 'exclude_groups' - Comma-separated list of groups to exclude 119 119 * 'exclude_fields' - Comma-separated list of fields to exclude 120 * 'update_meta_cache' - Whether to pre-fetch xprofilemeta 121 * for all retrieved groups, fields, and data 120 122 * 121 123 * @return array $groups … … 133 135 'fetch_visibility_level' => false, 134 136 'exclude_groups' => false, 135 'exclude_fields' => false 137 'exclude_fields' => false, 138 'update_meta_cache' => true, 136 139 ); 137 140 138 141 $r = wp_parse_args( $args, $defaults ); 139 142 extract( $r, EXTR_SKIP ); 143 144 // Keep track of object IDs for cache-priming 145 $object_ids = array( 146 'group' => array(), 147 'field' => array(), 148 'data' => array(), 149 ); 150 140 151 $where_sql = ''; 141 152 … … 162 173 } 163 174 175 // Store for meta cache priming 176 $object_ids['group'] = $group_ids; 177 164 178 $group_ids = implode( ',', (array) $group_ids ); 165 179 … … 183 197 // Fetch the fields 184 198 $fields = $wpdb->get_results( "SELECT id, name, description, type, group_id, is_required FROM {$bp->profile->table_name_fields} WHERE group_id IN ( {$group_ids} ) AND parent_id = 0 {$exclude_fields_sql} ORDER BY field_order" ); 199 200 // Store field IDs for meta cache priming 201 $object_ids['field'] = wp_list_pluck( $fields, 'id' ); 185 202 186 203 if ( empty( $fields ) ) … … 241 258 $fields[$field_key]->data->id = $data->id; 242 259 } 260 261 // Store for meta cache priming 262 $object_ids['data'][] = $data->id; 243 263 } 244 264 } … … 272 292 // Reset indexes 273 293 $groups = array_values( $groups ); 294 } 295 296 // Prime the meta cache, if necessary 297 if ( $update_meta_cache ) { 298 bp_xprofile_update_meta_cache( $object_ids ); 274 299 } 275 300
Note: See TracChangeset
for help on using the changeset viewer.