Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_get_profile_field_data to filter custom members-loop

  • @mistercyril

    Participant

    Hello,

    I’m using bp_get_profile_field_data to render a list of members based on custom profile field values. It kind of works, but out of the 27 results it should find, it only renders 4… I don’t have the faintest idea why and nothing I have done explains this behavior.

    The only idea i’ve had so far is to replace the content of the custom field by the id of its value. The custom field type is a select box with 5 possible values. Each of these values has an individual id in the database so I figure I could use the value’s id but this doesn’t work.

    `bp_get_member_user_id(),’field’=>44 )); ?>
    `

    How could I get bp_get_profile_field_data to test for a custom profile field’s value ID?

    Is this possible or a good solution?

    Thanks for any help.
    Best,

    C.

Viewing 7 replies - 1 through 7 (of 7 total)
  • @4ella

    Participant

    Hope that somebody will answer , I would like to achieve the same and in best I wish I would get the list of custom profile people in each (profile custom field) specific TAB on memberlist page . For example I want dancers , hostesses , models in every TAB on memberlist page . Thanks D.

    @shanebp

    Moderator

    I’d use xprofile_get_field_data

    Like so:
    xprofile_get_field_data(‘your field name’, member_id);

    @cnorris23

    Participant

    This is most likely happening because you’re using it inside the members loop. The members loop contains a long list of users, but then you’re limiting the ones displayed using your code. You can try filtering the $sql statement with ‘bp_core_get_paged_users_sql’.

    Also, definitely stick with `bp_get_profile_field_data` if you decide to go that route. `bp_get_profile_field_data` is currently a wrapper for `xprofile_get_field_data`, and BP will be moving towards prefixing all function with ‘bp_’ if it hasn’t already been done. `bp_get_profile_field_data` will be more future proof.

    @cnorris23

    Participant

    So, just a few hours ago, Boone just added a ticket with patch (https://buddypress.trac.wordpress.org/ticket/3205) to make this very easy. If any of you could go test this, then add any feedback, that would be great. The patch is for 1.3, but you should be able to make it work on 1.2.x.

    @mistercyril

    Participant

    Oh wow, this is GREAT News!
    Thank you Boone for addressing this issue, it was really frustrating.

    I tried implementing the patch, but there are 2 files I can’t find (bp-members/bp-members-functions.php) & (bp-members/bp-members-template.php). I don’t even have these directories in my version of BuddyPress.

    I am using Buddypress 1.2.8

    Am I missing something?

    @mistercyril

    Participant

    Up

    @duablellc

    Participant
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘bp_get_profile_field_data to filter custom members-loop’ is closed to new replies.
Skip to toolbar