Skip to:
Content
Pages
Categories
Search
Top
Bottom

Remove profile links

  • @jdhall1972

    Participant

    BuddyPress is automatically turns custom fields into links on profile pages. I’ve tried turning off this feature with the code below, but it doesn’t work. Any suggestions? Thanks.

    `
    function remove_xprofile_links() {
    remove_filter( ‘bp_get_the_profile_field_value’, ‘xprofile_filter_link_profile_data’, 9, 2 );
    }
    add_action( ‘bp_init’, ‘remove_xprofile_links’ );
    `

Viewing 12 replies - 1 through 12 (of 12 total)
  • @bphelp

    Participant

    @jdhall1972
    That code should work providing you added it to bp-custom.php or your themes functions.php between opening and closing php tags.

    @jdhall1972

    Participant

    You’re right. It SHOULD work. But it doesn’t, and that’s why I’m writing.

    http://missionsfund.org/missions/jane-masterson/profile/

    @bphelp

    Participant

    @jdhall1972
    I just checked the link you provided and there is no auto links so the code is working. Maybe you need to do a hard refresh. CTRL+F5

    @mercime

    Participant

    Make sure you added it to bp-custom.php -> https://codex.buddypress.org/developer/customizing/bp-custom-php/

    @jimmmy

    Participant

    I was having the same problem, and it wouldn’t work for me with any of the suggested hacks in bp-custom.php

    I found a thread in the WordPress forum on the same topic which worked. Just put:

    remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9);

    in your theme functions.php

    Hope that helps.

    @bphelp

    Participant

    @jimmmy
    I made a small plugin that should remove those links:
    https://github.com/bphelp/bp-remove-profile-links
    Feel free to try it out and let me know if it works for you!

    @modemlooper

    Moderator

    use init not bp_init

    function remove_xprofile_links() {
    remove_filter( ‘bp_get_the_profile_field_value’, ‘xprofile_filter_link_profile_data’, 9, 2 );
    }
    add_action( ‘init’, ‘remove_xprofile_links’ );

    @bphelp

    Participant

    @modemlooper
    Has this changed since 1.5 because the codex:
    https://codex.buddypress.org/developer/customizing/bp-custom-php/
    Uses bp_init in the examples?

    @modemlooper

    Moderator

    I’m not sure but it works for me when using init. I’m also calling the file the function is in by using bp_include

    @bphelp

    Participant

    @modemlooper
    Reason I asked is because bp_init and init both work fine with the plugin I made on my test environment. I did update the plugin I made to remove profile auto links on github with init for compatibility sake. BTW bp-include has been in the plugin since conception in the loader.php. If someone knows better then feel free to chime in. Maybe someone will find it a useful nugget. If anyone wants to use it, download the zip file from here, upload, and activate:
    https://github.com/bphelp/bp-remove-profile-links

    @modemlooper

    Moderator

    I think the reason I’m having funkiness is because the remove links code is inside a function that only runs if a wp option is true.

    @bphelp

    Participant

    @modemlooper
    That definitely would make a difference. Anyway thank you for your input!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Remove profile links’ is closed to new replies.
Skip to toolbar