Skip to:
Content
Pages
Categories
Search
Top
Bottom

Load profile field link in new page


  • HorrorUK
    Participant

    @horroruk

    I have some extra profile fields for Facebook/Twitter profiles, but when they are clicked on, the page is loaded in the same tab/window.

    Is there a way to get these to load into a new tab instead?

Viewing 1 replies (of 1 total)
  • It’s generally preferred to let the user decide whether he wants to open a link in a new window or the same window. That said, you can use jQuery to force content to open a new window to happen:
    http://stackoverflow.com/questions/4742746/jquery-open-new-window-on-page-load

    Or, you could filter the output for the fields by adding a filter to bp_get_the_profile_field_value (you’ll be adding target="_blank" to the anchor tag). Here’s an example that removes hyperlinks from the output for specific fields:

    function cpfb_unlink_fields( $field_value ) { 
     
    	$options = array ( //These are the ids of the fields you want to target
    					12,
    					14 
    	)
    		
    	if ( in_array( bp_get_the_profile_field_id(), $options ) )
    		$field_value = strip_tags( $field_value );
    
    	return $field_value;
    
    }
    add_filter( 'bp_get_the_profile_field_value', 'cpfb_unlink_fields', 998, 1 );
Viewing 1 replies (of 1 total)
  • The topic ‘Load profile field link in new page’ is closed to new replies.
Skip to toolbar