how to change default avatar based on value of a field
-
Hi everybody,
How to change default avatar based on value of a field for user.
Example: Field name: Sex, Field value 1: male, Field value 2: female. When user change field value to male, display default avatar male (male.jpg) . When user change field value to female, display default avatar female (female.jpg).I tried this code in file wp-content/plugins/buddypress/bp-core/bp-core-avatars.php
`
if ( !defined( ‘BP_AVATAR_DEFAULT’ ) )
{
if (bp_get_profile_field_data(‘field=sex’)==’male’)
define( ‘BP_AVATAR_DEFAULT’, BP_PLUGIN_URL . ‘/bp-core/images/male.jpg’ );
else if (bp_get_profile_field_data(‘field=sex’)==’female’)
define( ‘BP_AVATAR_DEFAULT’, BP_PLUGIN_URL . ‘/bp-core/images/female.jpg’ );
else
define( ‘BP_AVATAR_DEFAULT’, BP_PLUGIN_URL . ‘/bp-core/images/mystery-man.jpg’ );}
`
but not work.thanks.
- The topic ‘how to change default avatar based on value of a field’ is closed to new replies.