Hi @swissprice,
the field type of “Website” should be URL.
The class who build this is defined here:
buddypress/bp-xprofile/classes/class-bp-xprofile-field-type-url.php
Function name is display_filter()
The line to change is the…latest (161).
Now be warned.
This function is not filterable ( but i may be wrong)
Modifying core files is not best practice as you will loose your change at next update.
Target _blank is kind of deprecated since many years now in favor of user decision. This one just in case you absolutely want to use target argument.
There is a filter hook for displaying profile fields – so you don’t need to hack core files.
apply_filters( 'bp_get_the_profile_field_value', $field->data->value, $field->type, $field->id );
Use str_replace to insert your target blank string.
function swiss_target_blank( $field_value, $field_type, $field_id ){
if( $field_id == 123 ) { // get the field_id from edit field url in wp-admin
$field_value = str_replace('rel="nofollow"', 'rel="nofollow" target="_blank"', $field_value);
}
return $field_value;
}
add_filter('bp_get_the_profile_field_value', 'swiss_target_blank', 11, 3);
Hello, thank you!
I will try that and tell you if it worked. 🙂
Hello shanebp
thank you for this – that works very well on the members page. Is there a smiliar approach possible on the members list page?
Kind regards,
Ralph