Cool running club! I was looking to join a club near me but Harold Wood is about a 30 minute drive away.
Regarding your question:
Is there a way of passing this path to Buddypress as the default avatar?
You can filter the default avatar URL using the bp_core_default_avatar_user
hook.
Hope this helps!
Hi Henry!
30 minutes too long for you? My cousin started it up last year and it’s apparently doing hugely well, if not in the running times, certainly socially. Very high proportion of female members which is undoubtedly a major proponent of a good social scene. The running is enthusiastic rather than olympian.
With regards to the avatar issue, that will change the default avatar, no?
All users have uploaded their custom avatars and these are in the directory mentioned in the OP.
Ah, ok, I see it!
The add_filter( 'bp_core_default_avatar_user', 'feed_user_avatar' );
function feed_user_avatar(){
$user_id=get_current_user_id();
if(!$user_id){
return;
}
$userMetaData=get_user_meta($user_id);
return 'wp-content/plugins/chron_reg/images/'.$userMetaData['avatar'][0];
}
Cheers!
That would be 30 minutes on a good day. At 6:30pm I’d hit the worst traffic imaginable (I’d be coming from the Isle of Dogs). But it’s great to hear it’s a success!
My apologies, yes that’ll change the default avatar. I just re read your whole post and realise that may not be what you want.
Yes, I’d probably want to override the gravatar entirely and just replace it with the local avatar.
You can disable Gravatar like this:
function no_grav() {
return true;
}
add_filter( 'bp_core_fetch_avatar_no_grav', 'no_grav' );
Ok, so if my function returns: 'wp-content/plugins/chron_reg/images/'.$userMetaData['avatar'][0];
, that will disable the gravatar anyway?
return 'wp-content/plugins/chron_reg/images/'.$userMetaData['avatar'][0];
will obviously return ‘true’?
So will that disable the gravatar even if it exists?
I haven’t tested or looked at the source but I suspect you will need to use my no_grav()
function as well. You could run a quick test to be sure?