/**
 * Apply display_filter() filters as defined by the BP_XProfile_Field_Type classes, when fetched
 * by xprofile_get_field_data().
 *
 * @since 2.1.0
 *
 * @param mixed $field_value Field value.
 * @param int   $field_id    Field type.
 * @return string
 */
function xprofile_filter_format_field_value_by_field_id($field_value, $field_id)
{
    $field = xprofile_get_field($field_id);
    return xprofile_filter_format_field_value_by_type($field_value, $field->type, $field_id);
}
Пример #2
0
/**
 * Formats a profile field according to its type. [ TODO: Should really be moved to filters ]
 *
 * @package BuddyPress Core
 * @param string $field_type The type of field: datebox, selectbox, textbox etc
 * @param string $field_value The actual value
 * @return string|bool The formatted value, or false if value is empty
 */
function xprofile_format_profile_field($field_type, $field_value)
{
    if (empty($field_value)) {
        return false;
    }
    $field_value = bp_unserialize_profile_field($field_value);
    if ('datebox' != $field_type) {
        $content = $field_value;
        $field_value = str_replace(']]>', ']]>', $content);
    }
    return xprofile_filter_format_field_value_by_type(stripslashes_deep($field_value), $field_type);
}
/**
 * Apply display_filter() filters as defined by the BP_XProfile_Field_Type classes, when fetched by xprofile_get_field_data().
 *
 * @since 2.1.0
 *
 * @param mixed $field_value Field value.
 * @param int $field_id Field type.
 */
function xprofile_filter_format_field_value_by_field_id($field_value, $field_id)
{
    $field = new BP_XProfile_Field($field_id);
    return xprofile_filter_format_field_value_by_type($field_value, $field->type);
}