Skip to:
Content
Pages
Categories
Search
Top
Bottom

Need help locating filter definition


  • groston
    Participant

    @groston

    On our site, we have a page that displays member’s profile information. I believe that the contents of that page are generated by the file wp-content\themes\social-portfolio-child\buddypress\members\single\profile\profile-loop.php.

    The key line of code in this file seems to be:

    $data = bp_get_member_profile_data( ['field' => $name] );

    which retrieves the information to be displayed for each field. The function is defined in the file wp-content\plugins\buddypress\bp-members\bp-members-template.php at around line 1095.

    The one things that I cannot figure out, however, is line 1150:

    $data = apply_filters( 'bp_get_member_profile_data', $data, $r );

    for the simple reason that I cannot find where the filter is defined! Would you please point me to the definition of the filter? (The reason that I am asking is that one of the fields in question is a file and the text that is displayed as part of the hyperlink is ‘Download file’ and we would like to change that text.)

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)

  • shanebp
    Moderator

    @shanebp

    apply_filters is a hook. You can use that hook to define a function that will filter the $data that is returned.


    groston
    Participant

    @groston

    shanebp – thanks for the reply. Since the data in question is a path to a file name (just looked in the database and confirmed this), there is clearly some filtering going on in order to convert said file path into an href tag. My assumption was that this filtering was happening within the bp_get_member_profile_data filter and that this filter was already defined.

    Per your reply, my assumption seems to be wrong. So, more directly: where/how is this file path being converted into an tag?


    shanebp
    Moderator

    @shanebp

    Perhaps the tag is created by ‘Autolink’ ?

    You can disable Autolink by going to wp-admin > Users > Profile Fields > your field and look for ‘Autolink’ in the right-side column.

    Then you could write a filter function to create a custom tag.

    Or you could not disable autolink and write a filter function to change the text in the tag.


    groston
    Participant

    @groston

    Sorry about the slow reply – must have missed the notification email. I just checked and for the fields in question, autolink is set to disabled.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar