Skip to:
Content
Pages
Categories
Search
Top
Bottom

group default avatar

  • @jimcale

    Participant

    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.

Viewing 25 replies - 1 through 25 (of 32 total)
  • @jimcale

    Participant

    any help in this one?

    @djpaul

    Keymaster

    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.

    @jimcale

    Participant

    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.

    @suzettekussnercom

    Participant

    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?

    @nuprn1

    Participant

    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.

    @r-a-y

    Keymaster

    Hook into the following filter:

    bp_get_group_avatar

    If there is no uploaded group avatar, then return your custom avatar in this filter.

    @jimcale

    Participant

    hmm. sorry guys i am really novice. so i will really appreciate if anyone can provide some code. thanks

    @nuprn1

    Participant

    using @r-a-y ‘s super simple method :-P

    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

    @r-a-y

    Keymaster

    @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)

    @nuprn1

    Participant

    nice catch! (don’t trust my code)

    @jimcale

    Participant

    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 ?

    @r-a-y

    Keymaster

    Do not paste the code in bp-core-avatars.php.

    Place it in either your theme’s functions.php or plugins/bp-custom.php.

    @airfoil

    Participant

    FWIW:

    I just tried out the revised code @r-a-y posted above in my bp-custom file, and it overwrote uploaded avatars.

    @jimcale

    Participant

    ok pasted in the functions.php, it overwrites all avatars including the uploaded ones. any correction? :)

    @r-a-y

    Keymaster

    Try the updated code snippet above, I’ve modified it.

    Let me know if it doesn’t work.

    @airfoil

    Participant

    That fixed it – thanks, much r-a-y!

    @jimcale

    Participant

    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.

    @r-a-y

    Keymaster

    I’ve updated the code above… report back and see if it works.

    @erich73

    Participant

    needed this as well.

    Many thanks Ray !

    @jimcale

    Participant

    Thanks Ray, now the size is perfect but again it overwrites all avatars including the uploaded ones.

    @jimcale

    Participant

    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.

    @r-a-y

    Keymaster

    Code updated again.

    @jimcale

    Participant

    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].

    @r-a-y

    Keymaster

    Code is updated once again… this should be the last update!

    @jimcale

    Participant

    works perfect. Thanks A lot.

Viewing 25 replies - 1 through 25 (of 32 total)
  • The topic ‘group default avatar’ is closed to new replies.
Skip to toolbar