Changeset 1441
- Timestamp:
- 04/29/2009 01:50:26 PM (17 years ago)
- Location:
- trunk/bp-xprofile
- Files:
-
- 2 edited
-
bp-xprofile-classes.php (modified) (1 diff)
-
bp-xprofile-templatetags.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/bp-xprofile-classes.php
r1366 r1441 148 148 149 149 if ( $hide_empty ) { 150 $sql = $wpdb->prepare( "SELECT DISTINCT g. *FROM {$bp->profile->table_name_groups} g INNER JOIN {$bp->profile->table_name_fields} f ON g.id = f.group_id ORDER BY g.id ASC" );151 } else { 152 $sql = $wpdb->prepare( "SELECT *FROM {$bp->profile->table_name_groups} ORDER BY id ASC" );150 $sql = $wpdb->prepare( "SELECT DISTINCT g.id FROM {$bp->profile->table_name_groups} g INNER JOIN {$bp->profile->table_name_fields} f ON g.id = f.group_id ORDER BY g.id ASC" ); 151 } else { 152 $sql = $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_groups} ORDER BY id ASC" ); 153 153 } 154 154 -
trunk/bp-xprofile/bp-xprofile-templatetags.php
r1408 r1441 16 16 var $user_id; 17 17 18 function bp_xprofile_template($user_id) { 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 18 function bp_xprofile_template( $user_id, $group_id ) { 19 20 if ( !$group_id ) { 21 if ( !$this->groups = wp_cache_get( 'xprofile_groups', 'bp' ) ) { 22 $this->groups = BP_XProfile_Group::get_all(true); 23 wp_cache_set( 'xprofile_groups', $this->groups, 'bp' ); 24 } 25 } else { 26 if ( !$this->groups = wp_cache_get( 'xprofile_group_' . $group_id, 'bp' ) ) { 27 $this->groups = new BP_XProfile_Group( $group_id ); 28 wp_cache_set( 'xprofile_group_' . $group_id, 'bp' ); 29 } 30 31 /* We need to put this single group into the same format as multiple group (an array) */ 32 $this->groups = array( $this->groups ); 33 } 34 24 35 $this->group_count = count($this->groups); 25 36 $this->user_id = $user_id; … … 148 159 } 149 160 150 function bp_has_profile( ) {161 function bp_has_profile( $args = '' ) { 151 162 global $bp, $profile_template; 152 153 $profile_template = new BP_XProfile_Template($bp->displayed_user->id); 163 164 $defaults = array( 165 'user_id' => $bp->displayed_user->id, 166 'group_id' => false 167 ); 168 169 $r = wp_parse_args( $args, $defaults ); 170 extract( $r, EXTR_SKIP ); 171 172 $profile_template = new BP_XProfile_Template( $user_id, $group_id ); 154 173 155 174 return $profile_template->has_groups();
Note: See TracChangeset
for help on using the changeset viewer.