Changeset 9685
- Timestamp:
- 04/03/2015 03:49:35 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-template.php
r9684 r9685 256 256 } 257 257 258 /** 259 * Query for XProfile groups and fields 260 * 261 * @since BuddyPress (1.0.0) 262 * 263 * @global object $profile_template 264 * @param array $args 265 * 266 * @return bool 267 */ 258 268 function bp_has_profile( $args = '' ) { 259 269 global $profile_template; 260 270 261 // Only show empty fields if we're on the Dashboard, or we're on a user's profile edit page,262 // or this is a registration page263 $hide_empty_fields_default = ( ! is_network_admin() && !is_admin() && !bp_is_user_profile_edit() && !bp_is_register_page() );271 // Only show empty fields if we're on the Dashboard, or we're on a user's 272 // profile edit page, or this is a registration page 273 $hide_empty_fields_default = ( ! is_network_admin() && ! is_admin() && ! bp_is_user_profile_edit() && ! bp_is_register_page() ); 264 274 265 275 // We only need to fetch visibility levels when viewing your own profile … … 270 280 } 271 281 272 $defaults = array( 273 'user_id' => bp_displayed_user_id(), 274 'profile_group_id' => false, 275 'hide_empty_groups' => true, 276 'hide_empty_fields' => $hide_empty_fields_default, 277 'fetch_fields' => true, 278 'fetch_field_data' => true, 282 // Parse arguments 283 $r = bp_parse_args( $args, array( 284 'user_id' => bp_displayed_user_id(), 285 'profile_group_id' => false, 286 'hide_empty_groups' => true, 287 'hide_empty_fields' => $hide_empty_fields_default, 288 'fetch_fields' => true, 289 'fetch_field_data' => true, 279 290 'fetch_visibility_level' => $fetch_visibility_level_default, 280 'exclude_groups' => false, // Comma-separated list of profile field group IDs to exclude 281 'exclude_fields' => false, // Comma-separated list of profile field IDs to exclude 282 'update_meta_cache' => true, 291 'exclude_groups' => false, // Comma-separated list of profile field group IDs to exclude 292 'exclude_fields' => false, // Comma-separated list of profile field IDs to exclude 293 'update_meta_cache' => true, 294 ), 'has_profile' ); 295 296 // Populate the template loop global 297 $profile_template = new BP_XProfile_Data_Template( 298 $r['user_id'], 299 $r['profile_group_id'], 300 $r['hide_empty_groups'], 301 $r['fetch_fields'], 302 $r['fetch_field_data'], 303 $r['exclude_groups'], 304 $r['exclude_fields'], 305 $r['hide_empty_fields'], 306 $r['fetch_visibility_level'], 307 $r['update_meta_cache'] 283 308 ); 284 285 $r = bp_parse_args( $args, $defaults, 'has_profile' );286 extract( $r, EXTR_SKIP );287 288 $profile_template = new BP_XProfile_Data_Template( $user_id, $profile_group_id, $hide_empty_groups, $fetch_fields, $fetch_field_data, $exclude_groups, $exclude_fields, $hide_empty_fields, $fetch_visibility_level, $update_meta_cache );289 309 290 310 /**
Note: See TracChangeset
for help on using the changeset viewer.