Skip to:
Content

BuddyPress.org

Changeset 4674


Ignore:
Timestamp:
07/17/2011 09:47:00 PM (14 years ago)
Author:
boonebgorges
Message:

Cast the current_comment as the activity item within certain Activity Loop template functions, to avoid PHP notices. Fixes #3341

Location:
trunk/bp-activity
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-functions.php

    r4654 r4674  
    923923        $activity_obj = new BP_Activity_Activity( $activity_id );
    924924
     925    if ( isset( $activity_obj->current_comment ) ) {
     926        $activity_obj = $activity_obj->current_comment;
     927    }
     928   
    925929    if ( 'new_blog_post' == $activity_obj->type || 'new_blog_comment' == $activity_obj->type || 'new_forum_topic' == $activity_obj->type || 'new_forum_post' == $activity_obj->type )
    926930        $link = $activity_obj->primary_link;
  • trunk/bp-activity/bp-activity-template.php

    r4669 r4674  
    549549        extract( $r, EXTR_SKIP );
    550550
     551        // Within the loop, we the current activity should be set first to the
     552        // current_comment, if available
     553        $current_activity_item = isset( $activities_template->activity->current_comment ) ? $activities_template->activity->current_comment : $activities_template->activity;
     554
    551555        // Primary activity avatar is always a user, but can be modified via a filter
    552         $object  = apply_filters( 'bp_get_activity_avatar_object_' . $activities_template->activity->component, 'user' );
    553         $item_id = $user_id ? $user_id : $activities_template->activity->user_id;
     556        $object  = apply_filters( 'bp_get_activity_avatar_object_' . $current_activity_item->component, 'user' );
     557        $item_id = $user_id ? $user_id : $current_activity_item->user_id;
    554558        $item_id = apply_filters( 'bp_get_activity_avatar_item_id', $item_id );
    555559
    556560        // If this is a user object pass the users' email address for Gravatar so we don't have to refetch it.
    557561        if ( 'user' == $object && empty( $user_id ) && empty( $email ) && isset( $activities_template->activity->user_email ) )
    558             $email = $activities_template->activity->user_email;
     562            $email = $current_activity_item->user_email;
    559563
    560564        return apply_filters( 'bp_get_activity_avatar', bp_core_fetch_avatar( array( 'item_id' => $item_id, 'object' => $object, 'type' => $type, 'alt' => $alt, 'class' => $class, 'width' => $width, 'height' => $height, 'email' => $email ) ) );
     
    720724    if ( !$activity )
    721725        $activity = $activities_template->activity;
     726   
     727    if ( isset( $activity->current_comment ) )
     728        $activity = $activity->current_comment;
    722729
    723730    $can_delete = false;
     
    826833                return false;
    827834               
    828             if ( !$comment->children )
     835            if ( empty( $comment->children ) )
    829836                return false;
    830837
Note: See TracChangeset for help on using the changeset viewer.