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.
Regards
Tony
`function myavatar_add_default_avatar( $url )
{
global $bp;
if (bp_get_profile_field_data(‘field=Gender’) === “Male”) :
return get_stylesheet_directory_uri() .’/_inc/images/default_avatar_male.jpg’;
else:
return get_stylesheet_directory_uri() .’/_inc/images/default_avatar_female.jpg’;
endif;
}
add_filter( ‘bp_core_mysteryman_src’, ‘myavatar_add_default_avatar’ );`
- The topic ‘Is it possible to check xprofile fields data from within bp-custom.php’ is closed to new replies.