Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

Support: Creating & Extending

Existing and new plugins/components and themes.

bp_get_profile_field_data to filter custom members-loop (8 posts)

Started 1 year ago by: mistercyril

  • Profile picture of mistercyril mistercyril said 1 year ago:

    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.

    <?php $type = bp_get_profile_field_data( array('user_id'=>bp_get_member_user_id(),'field'=>44 )); ?>
    <?php if ($type == '322') { ?>

    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.

  • Profile picture of 4ella 4ella said 1 year ago:

    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.

  • Profile picture of shanebp shanebp said 1 year ago:

    I’d use xprofile_get_field_data

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

  • Profile picture of Brandon Allen Brandon Allen said 1 year ago:

    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.

  • Profile picture of Brandon Allen Brandon Allen said 1 year ago:

    So, just a few hours ago, Boone just added a ticket with patch (http://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.

  • Profile picture of mistercyril mistercyril said 12 months ago:

    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?

  • Profile picture of mistercyril mistercyril said 11 months, 4 weeks ago:

    Up

  • Profile picture of DuableLLC DuableLLC said 8 months, 3 weeks ago:

    This is what you need:

    http://buddypress.org/community/groups/creating-extending/forum/topic/solved-limit-members-loop-by-profile-fields/