Skip to:
Content
Pages
Categories
Search
Top
Bottom

group default avatar


  • MJ
    Participant

    @jimcale

    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)

  • MJ
    Participant

    @jimcale

    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.


    MJ
    Participant

    @jimcale

    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.


    suzette1970
    Participant

    @suzettekussnercom

    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.


    r-a-y
    Keymaster

    @r-a-y

    Hook into the following filter:

    bp_get_group_avatar

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


    MJ
    Participant

    @jimcale

    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 :-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

    @r-a-y

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


    MJ
    Participant

    @jimcale

    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

    @r-a-y

    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

    @airfoil

    FWIW:

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


    MJ
    Participant

    @jimcale

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


    r-a-y
    Keymaster

    @r-a-y

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

    Let me know if it doesn’t work.


    airfoil
    Participant

    @airfoil

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


    MJ
    Participant

    @jimcale

    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

    @r-a-y

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


    abcde666
    Participant

    @erich73

    needed this as well.

    Many thanks Ray !


    MJ
    Participant

    @jimcale

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


    MJ
    Participant

    @jimcale

    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

    @r-a-y

    Code updated again.


    MJ
    Participant

    @jimcale

    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

    @r-a-y

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


    MJ
    Participant

    @jimcale

    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