Skip to:
Content
Pages
Categories
Search
Top
Bottom

Accessing profile data in the member loop – checkbox?


  • zoltok
    Participant

    @zoltok

    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!

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

  • Paul Gibbs
    Keymaster

    @djpaul

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


    zoltok
    Participant

    @zoltok

    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.


    zoltok
    Participant

    @zoltok

    Anyone?? I found this forum discussion: https://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?


    zoltok
    Participant

    @zoltok

    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 {
    ?>

    Member

    <?php
    }
    `


    thelandman
    Participant

    @thelandman

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Accessing profile data in the member loop – checkbox?’ is closed to new replies.
Skip to toolbar