Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP is automatically creating links of certain words in my user profile. How to stop/remove that?

  • @haungo

    Member

    So, on my user Profile page, it has my name, about me, etc.. .. .. It kind of makes sense to have the name link back to the user profile, but you area already on that user profile, so never mind.. .. it doesn’t make sense. But my REAL concern is that other words or phrases are being turned into links.. links that seem to do a search for that word or something.

    For example:
    The About Me field is describing the user; ” Mr White is an author, historian, and teacher from East Tennessee…”

    and somehow, the words “author” and “historian” are turned into links, but not “teacher” or “East Tennessee”. I don’t understand.
    This is what “author” links to:
    http://my-buddypress-site.com/members/?s=author

    ?s=author Is that a search of some kind?

    I don’t want any of the words to be links.

    I found this, in profile-loop.php:

    
    <table class="profile-fields zebra">
    
    <tr>
    
    <td class="label">
    
    </td>
    
    <td class="data">
    
    </td>
    
    </tr>
    
    </table>
    

    Then tracked down “bp_the_profile_field_value()” in bp-xprofile-templatetags.php :

    
    function bp_the_profile_field_value() {
    echo bp_get_the_profile_field_value();
    }
    function bp_get_the_profile_field_value() {
    global $field;
    
    $field->data->value = bp_unserialize_profile_field( $field->data->value );
    
    return apply_filters( 'bp_get_the_profile_field_value', $field->data->value, $field->type, $field->id );
    }
    

    Which led me to “bp-xprofile-filters.php”, Where I found this:

    
    /**
    * xprofile_sanitize_data_value_before_save ( $field_value, $field_id )
    *
    * Safely runs profile field data through kses and force_balance_tags.
    *
    * <a href='http://buddypress.org/community/members/param/' rel='nofollow'>@param</a> string $field_value
    * <a href='http://buddypress.org/community/members/param/' rel='nofollow'>@param</a> int $field_id
    * @return string
    */
    

    I’m not sure what to make of this, or even if I’m on the right track. Can someone please help with this issue? Thanks in advance!

    I’m not very familiar with php, and this is my first BuddyPress project, and only my third WordPress project.

    -Brandon

Viewing 8 replies - 1 through 8 (of 8 total)
  • @haungo

    Member

    Amazing! I was exploring the documentation, and found this page:
    https://codex.buddypress.org/extending-buddypress/bp-custom-php/

    What’s amazing is that the example used is EXACTLY what I was looking for! wow.

    Thanks Universe! & Whoever decided to use THAT particular example.

    
    /*
    https://codex.buddypress.org/extending-buddypress/bp-custom-php/
    Removing the links automatically created in a member's profile may be done by adding the following function to the bp-custom.php file.
    */
    function remove_xprofile_links() {
    remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 50, 2 );
    }
    add_action( 'plugins_loaded', 'remove_xprofile_links' );
    

    @brainiacwebdesigns

    Participant

    i had the same issue, theres a plugin that solved it for me. its called

    Custom Profile Filters for BuddyPress

    and its by

    Boone Gorges

    hope it works for you like it did me.

    @haungo

    Member

    Excellent.. Thank you!

    @wdfee

    Participant

    Oh, both doesn’t work with branch 1.5 (#5338), neither the plugin nor the code. Does anybody know why, what changed there?

    @wdfee

    Participant

    are there other possibilities now?

    @wdfee

    Participant

    @boonebgorges Sorry I’ve to ask, just a short question: Do you think an update of your plugin concerning this problem would be possible?

    @wdfee

    Participant

    Oh my God, this was really easy! The answer is on the linked page https://codex.buddypress.org/extending-buddypress/bp-custom-php/, the code changed for 1.5:

    <div class="bbcode_code">
    <div class="bbcode_code_head">Code:</div>
    <div class="bbcode_code_body">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' );</div>
    </div>

    @nahummadrid

    Participant

    Does the plugin work with 1.5?

    Instead of using the plugin how could i just exclude one profile field group using the bp-custom hack

    function remove_xprofile_links() {
    
    if ( !bp_get_profile_field_data('field=Interests'))
    
    remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 );
    }
    add_action( 'bp_init', 'remove_xprofile_links' );
    

    I tried this..doesn’t work….

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘BP is automatically creating links of certain words in my user profile. How to stop/remove that?’ is closed to new replies.
Skip to toolbar