Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display the Group’s Mini Avatar In Group Activity Stream Listings

  • @bigjimmysisco

    Member

    Hello, I use a custom theme. And As seen on the default theme of buddypress, next to a group listing, there is a little mini avatar of the group they posted in.

    The template pack doesn’t have this.. how can I add it?

Viewing 15 replies - 1 through 15 (of 15 total)
  • @el_terko

    Participant

    +1, updated to 1.2.7 but my theme isnt

    @modemlooper

    Moderator

    template pack is outdated

    @bigjimmysisco

    Member

    No, I do not wish to update template pack because I have so many customizations that it would take me an hour to back it up

    @gunju2221

    Participant

    It would probably take some transferring of code from the bp-default theme to the template pack but i don’t know where that code would be right off hand

    @modemlooper

    Moderator

    I looked at template pack and it should be getting the group image. You say you edited the template pack files that could be the problem.

    @bigjimmysisco

    Member

    @modemlooper, are you the template pack owner? The image has never been there even before i made customizations.

    Is the image defined in the CSS?

    @r-a-y

    Keymaster

    The code you’re looking for is this:

    `if ( !function_exists( ‘bp_dtheme_activity_secondary_avatars’ ) ) :
    function bp_dtheme_activity_secondary_avatars( $action, $activity ) {
    switch ( $activity->component ) {
    case ‘groups’ :
    case ‘friends’ :
    // Only insert avatar if one exists
    if ( $secondary_avatar = bp_get_activity_secondary_avatar() ) {
    $reverse_content = strrev( $action );
    $position = strpos( $reverse_content, ‘a<' );
    $action = substr_replace( $action, $secondary_avatar, -$position – 2, 0 );
    }
    break;
    }

    return $action;
    }
    add_filter( ‘bp_get_activity_action_pre_meta’, ‘bp_dtheme_activity_secondary_avatars’, 10, 2 );
    endif;`

    Add to your theme’s functions.php.

    *Sidenote: I’m working on my own “template pack” plugin, tentatively titled “BuddyPress Theme Unite!”, which will make it way easier for theme developers to add support for BuddyPress to their WP theme.

    @bigjimmysisco

    Member

    @r-a-y, when I put your code inside, I get `Parse error: syntax error, unexpected T_FUNCTION`

    @gunju2221

    Participant

    @bigjimmysisco, remove

    `if ( !function_exists( ‘bp_dtheme_activity_secondary_avatars’ ) :`

    And

    `edif;`

    @bigjimmysisco

    Member

    Awesome! :D thanks r-a-y, and Savannah

    @mercime

    Participant

    @r-a-y looking forward to “BuddyPress Theme Unite!” :-)

    @r-a-y

    Keymaster

    @bigjimmysisco – Please try the amended code; I was typing on the fly and forgot to end the conditional statement!

    The function_exists() conditional is important because if you ever upgrade BP Template Pack, you’ll get an error.

    @mercime – Yeah, I’m looking forward to the release as well ;)

    @modemlooper

    Moderator

    Actually BuddyPress core should be amended to work with any WP theme :P

    @bigjimmysisco

    Member

    @r-a-y, fixed it and got:

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

    @gunju2221

    Participant

    it’s the colon at the end of the line: “:” you need a semicolon “;”

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Display the Group’s Mini Avatar In Group Activity Stream Listings’ is closed to new replies.
Skip to toolbar