group default avatar
-
hello everyone.
I understand the default avatar for groups is generated from Gravatar. is there anyway i can define my own default avatar for groups.
thanks a lot in advance.
-
any help in this one?
Try setting the avatar settings in the backend to be “mystery man”, and then overwriting /bp-core/images/mystery-man.jpg.
If that does what you want it to do — I’m not 100% clear on your request — let us know here and we can give you a code snippet to put in another file to save you overwriting a core BP file.
thanks DJ for the reply, my request is when i create a group it gets a default avatar from gravatar, i want to provide my own avatar such as the mystery man.
Mystery man is already setup as the default avatar, but only works for users, not for groups. so i want a way i can use something like the mystery man for groups.
thanks a lot.
I am also looking for the same function. I set the default avatar for users, but also would like to set the default avatar for groups if possible. Is there a way to do this?
I am also looking for the same function. I set the default avatar for users, but also would like to set the default avatar for groups if possible. Is there a way to do this?
You could hook on groups_create_group with a function to handle some default avatar for the group.
Otherwise the avatar process is the last step in the group creation process – one could remove that step and create your own (have a look at my restrict group creation plugin for the code on this) – maybe have some sort of default selection of avatars.
Oh and say hi to Ryan for me.
Hook into the following filter:
bp_get_group_avatar
If there is no uploaded group avatar, then return your custom avatar in this filter.
hmm. sorry guys i am really novice. so i will really appreciate if anyone can provide some code. thanks
using @r-a-y ‘s super simple method
function my_default_get_group_avatar($avatar) {
global $groups_template;
return '<img src="http://locationtomygroupdefaultthumbimage.gif" class="avatar" alt="' . attribute_escape( $groups_template->group->name ) . '" />';
}
add_filter( 'bp_get_group_avatar', 'my_default_get_group_avatar', 1, 1 );replace with proper src attribute (no idea if that works – just typed it up) – this only replaces the big thumb though, the smaller thumb on the forums index is filtered on
bp_get_the_topic_object_avatar
@etiviti (rich!)
I think that code would override uploaded group avatars as well.
What I think Jim and Suzette want is to define a default group avatar if an uploaded one doesn’t exist.
Updated code:
http://buddypress.pastebin.com/QSWtCJMb (updated July 16, 2010 – fix for group avatar on forum directory)
nice catch! (don’t trust my code)
r-a-y i passed the code in /buddypress/bp-core/bp-core-avatars.php , it disables all the group avatars including the ones i uploaded. maybe i pasted in the wrong place? what can i replace ?
Do not paste the code in bp-core-avatars.php.
Place it in either your theme’s functions.php or plugins/bp-custom.php.
FWIW:
I just tried out the revised code @r-a-y posted above in my bp-custom file, and it overwrote uploaded avatars.
ok pasted in the functions.php, it overwrites all avatars including the uploaded ones. any correction?
Try the updated code snippet above, I’ve modified it.
Let me know if it doesn’t work.
That fixed it – thanks, much r-a-y!
great, that works, except the size in groups directory, for example the size of the uploaded avatars are small but the default avatar is huge.
I’ve updated the code above… report back and see if it works.
needed this as well.
Many thanks Ray !
Thanks Ray, now the size is perfect but again it overwrites all avatars including the uploaded ones.
I also discovered that the size is not perfect yet, for example when you are visiting Forum undergroup, the avatar gets small.
and of course, it overwrote all avatars including the uploaded ones.
Code updated again.
Thanks A lot Ray, you are a star. everything works great now except the size of the group avatar gets smaller when visiting a group plugin page [example Maps or Documents].
Code is updated once again… this should be the last update!
works perfect. Thanks A lot.
- The topic ‘group default avatar’ is closed to new replies.