BP_REST_XProfile_Fields_Endpoint::get_profile_field_rendered_value( string $value = '', integer|BP_XProfile_Field $profile_field = null )
Retrieve the rendered value of a profile field.
Description
Parameters
- $value
-
(Optional) The raw value of the field.
Default value: ''
- $profile_field
-
(Optional) The ID or the full object for the field.
Default value: null
Return
(string) The field value for the display context.
Source
File: bp-xprofile/classes/class-bp-rest-xprofile-fields-endpoint.php
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 | public function get_profile_field_rendered_value( $value = '' , $profile_field = null ) { if ( empty ( $value ) ) { return '' ; } $profile_field = xprofile_get_field( $profile_field ); if ( ! isset( $profile_field ->id ) ) { return '' ; } // Unserialize the BuddyPress way. $value = bp_unserialize_profile_field( $value ); global $field ; $reset_global = $field ; // Set the $field global as the `xprofile_filter_link_profile_data` filter needs it. $field = $profile_field ; /** * Apply Filters to sanitize XProfile field value. * * @param string $value Value for the profile field. * @param string $type Type for the profile field. * @param int $id ID for the profile field. * * @since 0.1.0 */ $value = apply_filters( 'bp_get_the_profile_field_value' , $value , $field ->type, $field ->id ); // Reset the global before returning the value. $field = $reset_global ; return $value ; } |
Changelog
Version | Description |
---|---|
0.1.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.