Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Is it possible to check xprofile fields data from within bp-custom.php

@julien760

Member

hello,

I try to do the same thing. I want to display a specific picture following the gender of the members.

I use add_filter and the picture of the profil is the good one but all others pictures from sidebar, for example, are the same…

Have you finally find a solution for this issue ?

Thanks in advance,

My test code :
function bp_remove_gravatar ($image, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir) {
$default = get_stylesheet_directory_uri() .’/images/bp_default_avatar.gif’;
if( $image && strpos( $image, “gravatar.com” ) ){
if ( bp_get_profile_field_data( ‘field=Gender’ ) == ‘Female’ ) {
$default = get_stylesheet_directory_uri() .’/images/def_f_avatar.gif’;
return ‘female‘;
}
if ( bp_get_profile_field_data( ‘field=Gender’ ) == ‘Male’ ) {
$default = get_stylesheet_directory_uri() .’/images/def_m_avatar.gif’;
return ‘male‘;
}
else {
return $image;
}
} else {
return $image;
}
}
add_filter(‘bp_core_fetch_avatar’, ‘bp_remove_gravatar’, 1, 9 );

Skip to toolbar