Group Mods

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

Accessing profile data in the member loop – checkbox? (6 posts)

Started 1 year, 9 months ago by: zoltok

  • Profile picture of zoltok zoltok said 1 year, 9 months ago:

    Hi there,

    I’m in the process of modifying the member loop for the member directory to show specific member fields. Everything is going well for text fields, but now I’d like to show a small badge if the user has identified themselves as a member of our service. In the profile, I’ve created a checkbox for people to identify themselves as subscribers. So, I’d like to test if that box is checked, and if it is, display a small badge.

    How would I do this? I’m using “bp_member_profile_data( ‘field=the field name’ );” for the text fields without any difficulties, but not sure of the syntax needed to test for the checkbox. All my attempts don’t return anything.

    TIA!

  • Profile picture of Paul Gibbs Paul Gibbs said 1 year, 9 months ago:

    off the top of my head, if nothing is returned then the user hasn’t checked it in their profile.

  • Profile picture of zoltok zoltok said 1 year, 9 months ago:

    I would have thought that too, and that’s the technique I’m using elsewhere to the same effect, with a different function – xprofile_get_field_data (‘Field Name’, $user_id). But using that function doesn’t seem to return anything, member or not, in the member loop.

  • Profile picture of zoltok zoltok said 1 year, 8 months ago:

    Anyone?? I found this forum discussion: http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/profile-field-adds-award/?topic_page=2&num=15

    I know it’s possible in the profile page, but can anyone tell me if the above method could be adapted for the directory loop?

  • Profile picture of zoltok zoltok said 1 year, 7 months ago:

    Ok, here was the solution! Indeed, if nothing is returned, the user hasn’t checked it. The problem was that I had to change the function to include the “get”.

    $isMember = bp_get_member_profile_data( 'field=Member' );
    				if ($isMember == "") {
    					?><?php
    				} else {
    					?><div class="member">Member</div><?php
    				}
  • Profile picture of thelandman thelandman said 1 year, 7 months ago:

    @zoltok, neat little solution. This will come in handy. Tks. ;)