/** * 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); }
/** * Formats a profile field according to its type. [ TODO: Should really be moved to filters ] * * @package BuddyPress Core * @param $field_type The type of field: datebox, selectbox, textbox etc * @param $field_value The actual value * @uses bp_format_time() Formats a time value based on the NXTClass date format setting * @return $field_value The formatted value */ function xprofile_format_profile_field($field_type, $field_value) { if (!isset($field_value) || empty($field_value)) { return false; } $field_value = bp_unserialize_profile_field($field_value); if ('datebox' == $field_type) { $field_value = bp_format_time($field_value, true); } else { $content = $field_value; $field_value = str_replace(']]>', ']]>', $content); } return stripslashes_deep($field_value); }
/** * Returns the XProfile field edit value. * * @since 1.1.0 * * @return mixed|void */ function bp_get_the_profile_field_edit_value() { global $field; /** * Check to see if the posted value is different, if it is re-display this * value as long as it's not empty and a required field. */ if (!isset($field->data)) { $field->data = new stdClass(); } if (!isset($field->data->value)) { $field->data->value = ''; } if (isset($_POST['field_' . $field->id]) && $field->data->value != $_POST['field_' . $field->id]) { if (!empty($_POST['field_' . $field->id])) { $field->data->value = $_POST['field_' . $field->id]; } else { $field->data->value = ''; } } $field_value = isset($field->data->value) ? bp_unserialize_profile_field($field->data->value) : ''; /** * Filters the XProfile field edit value. * * @since 1.1.0 * * @param string $field_value Current field edit value. * @param string $type Type for the profile field. * @param int $id ID for the profile field. */ return apply_filters('bp_get_the_profile_field_edit_value', $field_value, $field->type, $field->id); }
function bp_get_the_profile_field_edit_value() { global $field; /** * Check to see if the posted value is different, if it is re-display this * value as long as it's not empty and a required field. */ if (!isset($field->data->value)) { $field->data->value = ''; } if (isset($_POST['field_' . $field->id]) && $field->data->value != $_POST['field_' . $field->id]) { if (!empty($_POST['field_' . $field->id])) { $field->data->value = $_POST['field_' . $field->id]; } else { $field->data->value = ''; } } $field_value = isset($field->data->value) ? bp_unserialize_profile_field($field->data->value) : ''; return apply_filters('bp_get_the_profile_field_edit_value', $field_value, $field->type, $field->id); }
function bp_get_the_profile_field_value() { global $field; $field->data->value = bp_unserialize_profile_field($field->data->value); return apply_filters('bp_get_the_profile_field_value', $field->data->value, $field->type, $field->id); }