Changeset 6684
- Timestamp:
- 12/28/2012 05:21:31 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-template.php
r6624 r6684 958 958 */ 959 959 function bp_get_activity_avatar( $args = '' ) { 960 global $activities_template, $bp; 960 global $activities_template; 961 962 $bp = buddypress(); 961 963 962 964 // On activity permalink pages, default to the full-size avatar 963 965 $type_default = bp_is_single_activity() ? 'full' : 'thumb'; 964 966 965 if ( !empty( $activities_template->activity->display_name ) ) { 966 $dn_default = $activities_template->activity->display_name; 967 } else if ( !empty( $activities_template->current_comment->display_name ) ) { 968 $dn_default = $activities_template->current_comment->display_name; 969 } 970 971 $alt_default = isset( $dn_default ) ? sprintf( __( 'Profile picture of %s', 'buddypress' ), $activities_template->activity->display_name ) : __( 'Profile picture', 'buddypress' ); 967 // Within the activity comment loop, the current activity should be set 968 // to current_comment. Otherwise, just use activity. 969 $current_activity_item = isset( $activities_template->activity->current_comment ) ? $activities_template->activity->current_comment : $activities_template->activity; 970 971 // Activity user display name 972 $dn_default = isset( $current_activity_item->display_name ) ? $current_activity_item->display_name : ''; 973 974 // Prepend some descriptive text to alt 975 $alt_default = !empty( $dn_default ) ? sprintf( __( 'Profile picture of %s', 'buddypress' ), $dn_default ) : __( 'Profile picture', 'buddypress' ); 972 976 973 977 $defaults = array( … … 983 987 984 988 if ( !isset( $height ) && !isset( $width ) ) { 989 985 990 // Backpat 986 991 if ( isset( $bp->avatar->full->height ) || isset( $bp->avatar->thumb->height ) ) { … … 996 1001 $width = 20; 997 1002 } 998 999 1003 } 1000 1001 // Within the loop, we the current activity should be set first to the1002 // current_comment, if available1003 $current_activity_item = isset( $activities_template->activity->current_comment ) ? $activities_template->activity->current_comment : $activities_template->activity;1004 1004 1005 1005 // Primary activity avatar is always a user, but can be modified via a filter 1006 1006 $object = apply_filters( 'bp_get_activity_avatar_object_' . $current_activity_item->component, 'user' ); 1007 $item_id = $user_id? $user_id : $current_activity_item->user_id;1007 $item_id = !empty( $user_id ) ? $user_id : $current_activity_item->user_id; 1008 1008 $item_id = apply_filters( 'bp_get_activity_avatar_item_id', $item_id ); 1009 1009 1010 1010 // If this is a user object pass the users' email address for Gravatar so we don't have to refetch it. 1011 if ( 'user' == $object && empty( $user_id ) && empty( $email ) && isset( $ activities_template->activity->user_email ) )1011 if ( 'user' == $object && empty( $user_id ) && empty( $email ) && isset( $current_activity_item->user_email ) ) 1012 1012 $email = $current_activity_item->user_email; 1013 1013 1014 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 ) ) ); 1014 return apply_filters( 'bp_get_activity_avatar', bp_core_fetch_avatar( array( 1015 'item_id' => $item_id, 1016 'object' => $object, 1017 'type' => $type, 1018 'alt' => $alt, 1019 'class' => $class, 1020 'width' => $width, 1021 'height' => $height, 1022 'email' => $email 1023 ) ) ); 1015 1024 } 1016 1025
Note: See TracChangeset
for help on using the changeset viewer.