Improved version, Update for BuddyPress 1.8.1 and WordPress 3.7.1
-
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)
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.