Tagged: default avatar change
Hi,
I have visited the links below for more guidance but the code below still does not work. I’ve added two png images in the assets folder in the theme child directory (buddyboss) and use this code:
add_filter( 'bp_core_fetch_avatar_no_grav', '__return_true' ); function buddydev_set_default_use_avatar_based_on_member_type( $avatar, $params) { $user_id = $params['item_id']; $type = bp_get_member_type( $user_id ); if ( $type == 'club' ) { $avatar = get_template_directory_uri() . '/assets/images/profile.png'; } elseif( $type =='student' ) { $avatar = get_template_directory_uri() . '/assets/images/profile2.png'; } else { $avatar = get_template_directory_uri() . '/assets/images/profile2.png';; } return $avatar; }
This was the forum I referred to
https://buddydev.com/using-different-default-avatar-buddypress-users-based-profile-fields-member-type/Thanks in advance
Please try changing ‘get_template_directory_uri’ to ‘get_stylesheet_directory_uri’ if you are putting it in the child theme.
Regards
BrajeshHi,
I hope it worked. marking resolved due to lack of replies.Regards
Brajesh
Viewing 3 posts - 1 through 3 (of 3 total)
The topic ‘ [Resolved] Change default avatar issue’ is closed to new replies.
This topic is: resolved