xprofile_filter_link_profile_data( string $field_value, string $field_type = 'textbox' )
Filter an Extended Profile field value, and attempt to make clickable links to members search results out of them.
Description
- Not run on datebox field types.
- Not run on values without commas with less than 5 words.
- URL’s are made clickable.
To disable globally: remove_filter( ‘bp_get_the_profile_field_value’, ‘xprofile_filter_link_profile_data’, 9, 3 );
To disable for a single field, use the ‘Autolink’ settings in Dashboard > Users > Profile Fields.
Parameters
- $field_value
-
(Required) Profile field data value.
- $field_type
-
(Optional) Profile field type.
Default value: 'textbox'
Return
(string|array)
Source
File: bp-xprofile/bp-xprofile-filters.php
function xprofile_filter_link_profile_data( $field_value, $field_type = 'textbox' ) { global $field; if ( 'datebox' === $field_type ) { return $field_value; } if ( strpos( $field_value, ',' ) === false && strpos( $field_value, ';' ) === false && ( count( explode( ' ', $field_value ) ) > 5 ) ) { return $field_value; } // If the value is a URL, make it clickable. if ( preg_match( '@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', $field_value ) ) { $field_value = make_clickable( $field_value ); } return $field_value; }
Changelog
Version | Description |
---|---|
BuddyPress 1.1.0 | BuddyPress 1.1.0 |
BuddyBoss 1.0.0 Removed checking autolink, as autolinking is disabled on all fields now. All this function does now is make links clickable. | 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.