Skip to:
Content
Pages
Categories
Search
Top
Bottom

Extended profile field wrapper


  • scomaco
    Participant

    @scomaco

    I’m using BuddyPress for a members only section of a website. I’ve created some custom profile fields for each member. I need the Member Number field to be converted to a barcode to display in the profile header of the member profile. I have the JS working to generate the barcode but I have to add an id to the Member Number wrapper to make it work correctly.

    This is what BuddyPress renders:

    <tr class=”field_52 field_member-number optional-field visibility-public field_type_textbox”>
    <td class=”label”>Member Number</td>
    <td class=”data”><p>cm12345</p></td>
    </tr>

    This is what I need:

    <tr class=”field_52 field_member-number optional-field visibility-public field_type_textbox”>
    <td class=”label”>Member Number</td>
    <td class=”data”><p id=”MemNum”>cm12345</p></td>
    </tr>

    Anyone know how this might be achieved?

    I’ve been trying this script but with no luck, not really competent with JS at all.

    <script type=”text/javascript”>
    $(document).find(‘.field_52 .data’).attr(‘id’, ‘MemNum’);
    </script>

    Any help or suggestions would be greatly appreciated.

Viewing 1 replies (of 1 total)

  • shanebp
    Moderator

    @shanebp

    Please use the code button when sharing code.

    Use the filter hook and write your own filter function.
    In buddypress\bp-xprofile\bp-xprofile-template.php
    find the filter hook in function bp_the_profile_field_value()

    BP uses that same hook for a lot of formatting. See buddypress\bp-xprofile\bp-xprofile-filters.php
    So be sure to set the priority to a high number like 99 so your filter function will run last.

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