Is it possible to check xprofile fields data from within bp-custom.php
Hi im trying to do a check on a xprofile field “Gender” as i want to have a different default avatar depending on whether the user is male or female, i have the following code which doesnt seem to work (it displays female avatar for both).
Im guessing you cant check xprofile feilds like this in bp-custom.php, can anyone point me in the right direction on how i can accomplish this?
Thanks in adavnce for any help.
`function myavatar_add_default_avatar( $url )
if (bp_get_profile_field_data(‘field=Gender’) === “Male”) :
return get_stylesheet_directory_uri() .’/_inc/images/default_avatar_male.jpg’;
return get_stylesheet_directory_uri() .’/_inc/images/default_avatar_female.jpg’;
add_filter( ‘bp_core_mysteryman_src’, ‘myavatar_add_default_avatar’ );`
You must be logged in to reply to this topic.