Skip to:
Content

BuddyPress.org

Changeset 3173


Ignore:
Timestamp:
08/10/2010 12:27:53 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Hardcode component names and check for empty variables in secondary avatar

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-activity/bp-activity-templatetags.php

    r3169 r3173  
    478478        // Set item_id and object (default to user)
    479479        switch ( $activities_template->activity->component ) {
    480             case $bp->groups->id :
     480            case 'blogs' :
    481481                $object = 'group';
    482482                $item_id = $activities_template->activity->item_id;
    483483                break;
    484             case $bp->blogs->id :
     484            case 'blogs' :
    485485                $object = 'blog';
    486486                $item_id = $activities_template->activity->item_id;
     487                break;
     488            case 'friends' :
     489                $object  = 'user';
     490                $item_id = $activities_template->activity->secondary_item_id;
    487491                break;
    488492            default :
    489493                $object  = 'user';
    490494                $item_id = $activities_template->activity->user_id;
     495                $email = $activities_template->activity->user_email;
    491496                break;
    492497        }
     
    496501        $item_id = apply_filters( 'bp_get_activity_secondary_avatar_item_id', $item_id );
    497502
    498         // Used for any user to user activity
    499         if ( 'user' == $object && empty( $email ) )
    500             $email = $activities_template->activity->user_email;
     503        // If we have no item_id or object, there is no avatar to display
     504        if ( empty( $item_id ) || empty( $object ) )
     505            return false;
    501506
    502507        return apply_filters( 'bp_get_activity_secondary_avatar', bp_core_fetch_avatar( array( 'item_id' => $item_id, 'object' => $object, 'type' => $type, 'alt' => $alt, 'class' => $class, 'width' => $width, 'height' => $height, 'email' => $email ) ) );
Note: See TracChangeset for help on using the changeset viewer.