Changeset 2320 for trunk/bp-xprofile/bp-xprofile-templatetags.php
- Timestamp:
- 01/17/2010 07:42:57 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/bp-xprofile/bp-xprofile-templatetags.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/bp-xprofile-templatetags.php
r2168 r2320 20 20 21 21 function bp_xprofile_data_template( $user_id, $profile_group_id ) { 22 23 if ( !$profile_group_id ) { 24 if ( !$this->groups = wp_cache_get( 'xprofile_groups', 'bp' ) ) { 25 $this->groups = BP_XProfile_Group::get_all(true); 26 wp_cache_set( 'xprofile_groups', $this->groups, 'bp' ); 27 } 28 } else { 29 if ( !$this->groups = wp_cache_get( 'xprofile_group_' . $profile_group_id, 'bp' ) ) { 30 $this->groups = new BP_XProfile_Group( $profile_group_id ); 31 wp_cache_set( 'xprofile_group_' . $profile_group_id, 'bp' ); 32 } 33 34 /* We need to put this single group into the same format as multiple group (an array) */ 35 $this->groups = array( $this->groups ); 36 } 22 $this->groups = BP_XProfile_Group::get( array( 23 'profile_group_id' => $profile_group_id, 24 'user_id' => $user_id, 25 'hide_empty_groups' => true, 26 'fetch_fields' => true, 27 'fetch_field_data' => true 28 ) ); 37 29 38 30 $this->group_count = count($this->groups); … … 51 43 52 44 $this->group = $this->groups[$this->current_group]; 53 54 if ( !$fields = wp_cache_get( 'xprofile_fields_' . $this->group->id . '_' . $this->user_id, 'bp' ) ) { 55 for ( $i = 0; $i < count($this->group->fields); $i++ ) { 56 /* Don't try and fetch any existing profile data if we are using this loop on the registration page */ 57 $get_data = ( !bp_is_register_page() ) ? true : false; 58 59 $field = new BP_XProfile_Field( $this->group->fields[$i]->id, $this->user_id, $get_data ); 60 $fields[$i] = $field; 61 } 62 63 wp_cache_set( 'xprofile_fields_' . $this->group->id . '_' . $this->user_id, $fields, 'bp' ); 64 } 65 66 $this->group->fields = apply_filters( 'xprofile_group_fields', $fields, $this->group->id ); 45 $this->group->fields = apply_filters( 'xprofile_group_fields', $this->group->fields, $this->group->id ); 67 46 $this->field_count = count( $this->group->fields ); 68 47 … … 386 365 $r = wp_parse_args( $args, $defaults ); 387 366 extract( $r, EXTR_SKIP ); 367 368 if ( !method_exists( $field, 'get_children' ) ) 369 $field = new BP_XProfile_Field( $field->id ); 388 370 389 371 $options = $field->get_children(); … … 584 566 585 567 if ( !$groups = wp_cache_get( 'xprofile_groups_inc_empty', 'bp' ) ) { 586 $groups = BP_XProfile_Group::get _all();568 $groups = BP_XProfile_Group::get( array( 'fetch_fields' => true ) ); 587 569 wp_cache_set( 'xprofile_groups_inc_empty', $groups, 'bp' ); 588 570 }
Note: See TracChangeset
for help on using the changeset viewer.