• Resolved Mr3lade

    (@mr3lade)


    Improved version, Update for BuddyPress 1.8.1 and WordPress 3.8

    1. Replace your whole filters-bp-functions.php with this code:

    <?php
    
    // Turns on manual linking using curly brackets: {search-term}
    function bcp_add_brackets( $field_value ) {
    	// We use curly brackets instead of square to prevent possible conflicts with bbcodes...
    	if ( strpos( $field_value, '{' ) | strpos( $field_value, '}' ) ) {
    		while ( strpos( $field_value, '}') ) {
    			$open_delin_pos = strpos( $field_value, '{' );
    			$close_delin_pos = strpos( $field_value, '}' );
    			$field_value =  substr($field_value, 0, $open_delin_pos) . '<a href="' . site_url( BP_MEMBERS_SLUG ) . '/?s=' . substr($field_value, $open_delin_pos+1, $close_delin_pos - $open_delin_pos - 1) . '">' . substr($field_value, $open_delin_pos+1, $close_delin_pos - $open_delin_pos - 1) . '</a>' . substr($field_value, $close_delin_pos+1);
    		}
    	}
    
    	return $field_value;
    }
    add_filter( 'bp_get_the_profile_field_value', 'bcp_add_brackets', 999, 1 );
    
    // Adds social networking links
    
    // Checks to see if we can allow bbcode and if so applies it, otherwise leaves field unchanged
    function bcp_check_safe_shortcodes( $field_value ) {
    	if (function_exists('bbp_whitelist_do_shortcode')) {
    		$field_value = bbp_whitelist_do_shortcode($field_value);
    	}
    
    	return $field_value;
    }
    add_filter( 'bp_get_the_profile_field_value', 'bcp_check_safe_shortcodes', 998, 1 );
    
    function cpfb_add_social_networking_links( $field_value ) {
    	global $bp, $social_networking_fields;
    
    	$bp_this_field_name = bp_get_the_profile_field_name();
    
    	if ( isset ( $social_networking_fields[$bp_this_field_name] ) ) {
    		$sp = strpos ( $field_value, $social_networking_fields[$bp_this_field_name] );
    		if ( $sp === false ) {
    			$url = str_replace( '***', strip_tags( $field_value ), $social_networking_fields[$bp_this_field_name] );
    			}
    		echo '<a href="https://' . $url . '">' . $field_value . '</a>';
    
    	} else {
    
    	return $field_value; }
    }
    add_filter( 'bp_get_the_profile_field_value', 'cpfb_add_social_networking_links', 1 );
    
    ?>

    2. Add the following class to the stylesheet of your activated theme:

    td.data a[href$="members/?s"] {
    	display: none !important;
    	visibility: hidden !hidden;
    }

    In case you use a highly customized theme for BuddyPress or another Permalink, you might have to customize the CSS Code.

    Have fun!

    https://www.ads-software.com/plugins/custom-profile-filters-for-buddypress/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi…
    Just tried using this on a multisite install with the latest wordpress/buddypress, and it doesn’t seem to have any effect.

    Any new updates?

    Thanks!

    Thanks for the update. For clarity, do I install this plugin and then add this code or just follow these instructions without first installing the plugin? Thanks again.

    OK so I’ve installed the plugin yet don’t know where to find filters-bp-functions.php so have assumed and edited/replaced custom-profile-filters-for-buddypress-bp-functions.php within the plugin directory instead. Incidentally WordPress informs me that this file is “inactive”. I have also added the code to the custom stylesheet yet no dice.

    Where am I going wrong? I can’t find filters-by-functions.php to alter it. Any help much appreciated. Running BuddyPress 1.9.2 with WordPress 3.8.1.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Improved version, Update for BuddyPress 1.8.1 and WordPress 3.7.1’ is closed to new replies.