You need to add the target=”_blank” attribute to the profile field value anchors.
I think the best way to do this is by using str_replace. Add this to your functions.php or bp-custom.php
function profile_target_blank( $field_value, $field_type, $field_id ){
$field_value = str_replace('rel="nofollow"', 'rel="nofollow" target="_blank"', $field_value);
return $field_value;
}
add_filter('bp_get_the_profile_field_value', 'profile_target_blank', 11, 3);
I’ve tested this and it works. This should open a new browser window/tab for all profile fields that have a URL’s.
This one is probably better:
function profile_target_blank( $field_value, $field_type, $field_id ){
if($field_type == 'url') {
$field_value = str_replace('rel="nofollow"', 'rel="nofollow" target="_blank"', $field_value);
}
return $field_value;
}
add_filter('bp_get_the_profile_field_value', 'profile_target_blank', 11, 3);
Just tried this and it works great, thanks for the code.