Skip to:
Content
Pages
Categories
Search
Top
Bottom

Remove Automatic Links in Profile

  • Avatar of henrybaum
    henrybaum
    Participant

    @henrybaum

    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.

Viewing 25 replies - 1 through 25 (of 28 total)
  • Avatar of henrybaum
    henrybaum
    Participant

    @henrybaum

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

    Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    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 );

    Avatar of henrybaum
    henrybaum
    Participant

    @henrybaum

    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…

    Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    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’.

    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

    Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    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.

    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?

    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?

    Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    Avatar of thecorkboard
    thecorkboard
    Participant

    @thecorkboard

    @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~

    Avatar of Dimensionmedia
    David Bisset
    Participant

    @dimensionmedia

    Tried this as well and no result. Hhhmm….

    Avatar of Dimensionmedia
    David Bisset
    Participant

    @dimensionmedia

    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.

    Avatar of thecorkboard
    thecorkboard
    Participant

    @thecorkboard

    @dimensionmedia

    worked like a charm. thanks!

    Avatar of zanzaboonda
    zanzaboonda
    Participant

    @zanzaboonda

    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

    Avatar of TJ
    TJ
    Participant

    @vicradioweb

    I had this working before, but it’s stopped and I can’t get it to work again. Have they made a change to the filter again?

    I’ve tried adding this to the functions.php file in my theme to no avail. I also created a bp-custom.php file, which also didn’t work.

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

    Does anyone have any idea why it’s not working? Is there somewhere specific to place it in the file?

    Thanks,
    TJ

    Avatar of michaelha
    michaelha
    Member

    @michaelha

    Stumbled into same problem and found this thread. Anyone has a robust solution for this? I don’t want to remove all the linking but just a certain field. I’ll try to do some testing on my own…

    Avatar of colemip
    colemip
    Member

    @colemip

    I have a related problem. I added remove_filter( ‘bp_get_the_profile_field_value’, ‘xprofile_filter_link_profile_data’, 50 ); to my functions.php file in my custom theme. It removed the comma-delimited links like I wanted, but unfortunately it also removed my newlines (presumable because it also filters newlines and inserts
    , or something like that). Even after I comment out the remove_filter line and re-enter the text and add the returns back in, I still don’t see the newlines or the links that probably should be there since I no longer have the filter being removed. Thoughts?

    Hi guys,

    I had the exact same problem and went to plugins > buddypress > bp-xprofile > bp-xprofile-filters.php and had a look. At the very top there is a very nice list of filters, all of them starting of “add_filter”. When you want to remove something WITHOUT touching the core, simply find the one you want, copy and paste it into your functions.php inside your theme, and then replace “add_filter” with “remove_filter”.

    In this case just replace what you had before with the code below and it should work:

    remove_filter( ‘bp_get_the_profile_field_value’, ‘xprofile_filter_link_profile_data’, 9, 2 );

    I’m running Buddypress 1.5.1 :)

    Avatar of EndlessRange
    EndlessRange
    Participant

    @endlessrange

    Where is the functions php file? The BP theme I’m using is not in themes.

    Thanks.

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    Which theme are you using?

    If you are working with bp-default and want to create any amends (such as adding functions in functions.php), you will be best to create a new theme (probably a child one). If you look in the menu tab called Codex on this site, you’ll find documentation on how to do this.

    Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    Install BP extended settings plugin to get this function and many more

    Avatar of davidkooo
    davidkooo
    Participant

    @davidkooo

    none of these help… I pasted it to my functions.php, but links are still visible.

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    @davidkooo – which theme are you using? I noticed one ‘off the shelf’ theme was adding additional profile field links – in which case you’d have to strip them in your templates as well.

    Avatar of davidkooo
    davidkooo
    Participant

    @davidkooo

    well I am using my own theme

    http://transformers.scifi-guide.net/

    Avatar of davidkooo
    davidkooo
    Participant

    @davidkooo

    so what should I do? Because BP extended settings plugin has no option to turning this off (or I am just blind)

Viewing 25 replies - 1 through 25 (of 28 total)

You must be logged in to reply to this topic.