xprofile_format_profile_field

Formats a profile field according to its type.

Description

(string|bool) xprofile_format_profile_field( (string) $field_type, (string) $field_value ); 

[ TODO: Should really be moved to filters ]

Returns (string|bool)

The formatted value, or false if value is empty.

Parameters (2)

0. $field_type (string)
The type of field: datebox, selectbox, textbox etc.
1. $field_value (string)
The actual value.

Usage

  1. if ( !function_exists( 'xprofile_format_profile_field' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-xprofile/bp-xprofile-functions.php'; 
  3.  
  4. // The type of field: datebox, selectbox, textbox etc. 
  5. $field_type = ''; 
  6.  
  7. // The actual value. 
  8. $field_value = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = xprofile_format_profile_field($field_type, $field_value); 
  12.  

Defined (1)

The function is defined in the following location(s).

/bp-xprofile/bp-xprofile-functions.php  
  1. function xprofile_format_profile_field( $field_type, $field_value ) { 
  2.  
  3. if ( empty( $field_value ) ) { 
  4. return false; 
  5.  
  6. $field_value = bp_unserialize_profile_field( $field_value ); 
  7.  
  8. if ( 'datebox' != $field_type ) { 
  9. $content = $field_value; 
  10. $field_value = str_replace( ']]>', ']]>', $content ); 
  11.  
  12. return xprofile_filter_format_field_value_by_type( stripslashes_deep( $field_value ), $field_type );