Skip to:
Content
Pages
Categories
Search
Top
Bottom

Check value of profile field – displaying images instead

  • @divvy

    Participant

    Hello,

    Is it possible to check if a custom profile field (checkbox) value is x, y, and z. My purpose for this is to display a corresponding image for each possible choice, in user profile and under user avatar in bbpress.

    Example:

    Male: male symbol image
    Female: female symbol image
    Couple: male+female symbols image

    I’m sure others would be looking for such a snippet like I was.

    Cheers

    I have found this code:

    $some_field = bp_get_member_profile_data( 'field=Name of Field' );
    if( !empty( $some_field ) ) {
         if( $some_field == 'x') 
            echo 'x'; 
         elseif( $some_field == 'y') 
            echo 'y'; 
         else
            echo 'z'; 
    }

    But for some reason, is not working… and it seems that is for profile page only…

    Help šŸ™‚

Viewing 2 replies - 1 through 2 (of 2 total)
  • @shanebp

    Moderator

    Outside of profile pages, use:

    xprofile_get_field_data

    @divvy

    Participant

    Hey @shanebp, thank you for your reply and for trying to help me.

    Unfortunately my PHP knowledge is very low.

    Is it possible to have the right function code for my case, please? šŸ™‚

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Check value of profile field – displaying images instead’ is closed to new replies.
Skip to toolbar