Check value of profile field – displaying images instead

Status
Not open for further replies.

Divvy

Active Member
806
2009
18
0
Hello guys,

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 have found this code:

PHP:
$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…
For outside of profile pages, I need to use this code: xprofile_get_field_data | function | WordPress | hookr.io

Unfortunately my PHP knowledge is very low.

Is it possible to have the right function code for my case, please? :)

Thanks!!
 
Status
Not open for further replies.
Back
Top