Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of hnla

Remove Automatic Links in Profile (19 posts)

Started 2 years, 1 month ago by: henrybaum

  • Profile picture of henrybaum henrybaum said 2 years, 1 month ago:

    http://www.selfpublishingreview.com/members/stephentiano/

    In this profile, the word “Inexperienced” is linked, for no reason. So how can I remove this.

    This plugin was recommended: http://wordpress.org/extend/plugins/custom-profile-filters-for-buddypress/

    But this isn’t helpful because it says, “The plugin checks each profile for square brackets and activates if it finds any. If no square brackets are found, the default automatic filter will kick in.”

    I don’t want the default automatic filter, I want to change that. Another thread said, “If you wish to simply deactivate this “feature”, you could use a remove_filter() call to disable the offending filter.”

    I’m not sure where remove_filter should go and the full text of the code.

    I’m worried about removing HTML capability in the profile – I still want that – I just don’t want automatic links that don’t have http://

    Thanks.

  • Profile picture of henrybaum henrybaum said 2 years, 1 month ago:

    Anyone? Really just need to know where to add a remove_filter for links in profile fields.

  • Profile picture of Boone Gorges Boone Gorges said 2 years, 1 month ago:

    Hi henrybaum. The filter you’re looking for is xprofile_filter_link_profile_data() in bp-xprofile/bp-xprofile-filters.php. Try adding (to a plugin, to your theme’s functions.php file, or to your bp-custom.php file)
    remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 2 );

  • Profile picture of henrybaum henrybaum said 2 years, 1 month ago:

    Thanks, worked!

    …is there any way to control this so that it removes links for some words in the description BUT allows links for location? Not the end of the world if it doesn’t, but checking…

  • Profile picture of Boone Gorges Boone Gorges said 2 years, 1 month ago:

    Sure, there’s a couple ways to do it.

    If you want to turn off linking in specific profile fields (so that nothing in “About Me” gets linked, but locations in “Location” or “Hometown” do), you can use http://wordpress.org/extend/plugins/custom-profile-filters-for-buddypress/. Near the beginning of that plugin, there’s a spot for you to list fields that should NOT be linkable.

    If you want to be more specific and look for certain words in a field, here’s how. Copy the original xprofile_filter_link_profile_data function from bp-xprofile-filters.php, paste it into functions.php or wherever you put the remove_filter code, rename it something unique (like henry_xprofile_filter_link_profile_data), then afterwards add the line
    add_filter( 'bp_get_the_profile_field_value', 'henry_xprofile_filter_link_profile_data', 2, 2 );
    At this point you’ll have to customize the filter to look for certain words. Use something like this (untested, but something like it should work):

    if ( strpos( $field_value, 'Boston' ) ) {
       $field_value = str_replace( 'Boston', '<a href="' . site_url( BP_MEMBERS_SLUG ) . '/?s=Boston">', $field_value);
    }

    In other words, if ‘Boston’ is found in the field, replace the plaintext ‘Boston’ with a link to a search on the word ‘Boston’.

  • Profile picture of Kalman Labovitz Kalman Labovitz said 1 year, 8 months ago:

    I placed the code, remove_filter( ‘bp_get_the_profile_field_value’, ‘xprofile_filter_link_profile_data’, 2 ); , in my bp-custom.php file and it did not work, any ideas?

    Your plugin is not supported in 2.9.2, any plans to update or are you moving directly to 3.0?

    Thanks,

    Kalman

  • Profile picture of Boone Gorges Boone Gorges said 1 year, 8 months ago:

    Kalman, the plugin should work fine on 2.9.2, even if I haven’t tagged it as such. Should work for 3.0, for that matter.

    Is *any* of the code in bp-custom.php being activated? Maybe it’s a problem with that file.

  • Profile picture of Kalman Labovitz Kalman Labovitz said 1 year, 8 months ago:

    Yes, I have a code active that changes the slug of members to alumni (I am running an alumni site). Currently that is the only code I have in the file.

    I will try you plugin to see if it works.

    Does order of code make a difference?

  • Profile picture of dyrk dyrk said 1 year, 5 months ago:

    Hi Boone
    I’m also desperately trying to gt rid of the annoying links.
    The remove_filter line – does that still require your plugin? Or can it work without it?
    I have your plugin installed and added the line to functions and tried it in bp-custom – no luck either way – they’re still there.
    I don’t want ANY profile links. Just not needed in my system.
    Any ideas?

  • Profile picture of Boone Gorges Boone Gorges said 1 year, 5 months ago:

    My plugin is not needed. Do this: http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/remove-automatic-links-in-profile/#post-32749

  • Profile picture of thecorkboard thecorkboard said 1 year, 4 months ago:

    @Boone-

    I threw this in the fuctions.php with no success. Has anything changed since you posted this?
    remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 2 );

    ~Kyle~

  • Profile picture of Dimensionmedia Dimensionmedia said 1 year, 4 months ago:

    Tried this as well and no result. Hhhmm….

  • Profile picture of Dimensionmedia Dimensionmedia said 1 year, 4 months ago:

    Think I got it. Try using this instead in your functions.php file:

    remove_filter( ‘bp_get_the_profile_field_value’, ‘xprofile_filter_link_profile_data’, 50 );

    Somewhere along the line new filters were added to bp-xprofile-filters.php.

  • Profile picture of thecorkboard thecorkboard said 1 year, 4 months ago:

    @dimensionmedia

    worked like a charm. thanks!

  • Profile picture of zanzaboonda zanzaboonda said 1 year, 4 months ago:

    Okay, so what if I’m looking to do the exact opposite? What if I want to specify which fields are always clickable? I’d like to be have members’ locations always clickable.

    Any thoughts?

    Thanks and best wishes,
    Kristen