Skip to:
Content
Pages
Categories
Search
Top
Bottom

Changing default individual & group avatars

  • I had good luck using the following method for changing the default avatars, :
    `function my_custom_set_avatar_constants() {
    define( ‘BP_AVATAR_DEFAULT’, get_stylesheet_directory_uri() .’/images/default_full_size.png’ );
    define( ‘BP_AVATAR_DEFAULT_THUMB’, get_stylesheet_directory_uri() .’/images/default_thumb_size.png’ );
    }
    add_action( ‘bp_init’, ‘my_custom_set_avatar_constants’, 2 );`

    But those constants control both group and individual defaults, and I’d like my groups to have a different avatar than my individuals.

    Replacing group avatars sort of works following @r-a-y‘s code here: http://pastebin.com/QSWtCJMb . But, it break if you use the groups widget in the sidebar of your groups page; the widget then pulls the full-size default avatars, not the thumbnail size. Anybody know of a good post-BP-1.5 way to do this? It looks in the code like group avatars are handled just like individual avatars except for one bit that sets the directory to search in:

    `else if ( ‘group’ == $object )
    $avatar_dir = ‘group-avatars’;`

    Thanks for any help you can give.

Viewing 1 replies (of 1 total)

  • r-a-y
    Keymaster

    @r-a-y

    That’s old, old code.

    Use something like this to change the default group avatar:

    `
    // turn gravatars off
    add_filter( ‘bp_core_fetch_avatar_no_grav’, ‘__return_true’ );

    // change the default group avatar
    function ray_change_group_avatar_default() {
    return ‘URL TO GROUP DEFAULT AVATAR’;
    }
    add_filter( ‘bp_core_default_avatar_group’, ‘ray_change_group_avatar_default’ );`

    Untested! This only works with gravatars turned off.

Viewing 1 replies (of 1 total)
  • The topic ‘Changing default individual & group avatars’ is closed to new replies.
Skip to toolbar