Changeset 1238 for trunk/bp-xprofile/bp-xprofile-templatetags.php
- Timestamp:
- 03/19/2009 01:35:32 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/bp-xprofile-templatetags.php
r1224 r1238 17 17 18 18 function bp_xprofile_template($user_id) { 19 $this->groups = BP_XProfile_Group::get_all(true); 19 if ( !$this->groups = wp_cache_get( 'xprofile_groups', 'bp' ) ) { 20 $this->groups = BP_XProfile_Group::get_all(true); 21 wp_cache_set( 'xprofile_groups', $this->groups, 'bp' ); 22 } 23 20 24 $this->group_count = count($this->groups); 21 25 $this->user_id = $user_id; … … 35 39 $this->field_count = count($this->group->fields); 36 40 37 for ( $i = 0; $i < $this->field_count; $i++ ) { 38 $this->group->fields[$i] = new BP_XProfile_Field( $this->group->fields[$i]->id, $this->user_id ); 39 } 41 if ( !$fields = wp_cache_get( 'xprofile_fields_' . $this->group->id . '_' . $this->user_id, 'bp' ) ) { 42 for ( $i = 0; $i < $this->field_count; $i++ ) { 43 $field = new BP_XProfile_Field( $this->group->fields[$i]->id, $this->user_id ); 44 $fields[$i] = $field; 45 } 46 47 wp_cache_set( 'xprofile_fields_' . $this->group->id . '_' . $this->user_id, $fields, 'bp' ); 48 } 49 50 $this->group->fields = $fields; 40 51 41 52 return $this->group; … … 227 238 global $bp, $group_name; 228 239 229 $groups = BP_XProfile_Group::get_all(); 230 240 if ( !$groups = wp_cache_get( 'xprofile_groups_inc_empty', 'bp' ) ) { 241 $groups = BP_XProfile_Group::get_all(); 242 wp_cache_set( 'xprofile_groups_inc_empty', $groups, 'bp' ); 243 } 244 231 245 if ( empty( $group_name ) ) 232 246 $group_name = bp_profile_group_name(false); … … 253 267 $group_id = 1; 254 268 255 $group = new BP_XProfile_Group($group_id); 269 if ( !$group = wp_cache_get( 'xprofile_group_' . $group_id, 'bp' ) ) { 270 $group = new BP_XProfile_Group($group_id); 271 wp_cache_set( 'xprofile_group_' . $group_id, $group, 'bp' ); 272 } 256 273 257 274 if ( $echo ) {
Note: See TracChangeset
for help on using the changeset viewer.