Ticket #4436: 4436-secondary-avatar-link.diff
File 4436-secondary-avatar-link.diff, 2.6 KB (added by , 12 years ago) |
---|
-
bp-activity/bp-activity-template.php
1049 1049 'width' => 20, 1050 1050 'height' => 20, 1051 1051 'class' => 'avatar', 1052 'email' => false 1052 'link_class' => '', 1053 'email' => false, 1054 'linked' => false 1053 1055 ); 1054 1056 1055 1057 $r = wp_parse_args( $args, $defaults ); … … 1070 1072 $alt = sprintf( __( 'Group logo of %s', 'buddypress' ), $group->name ); 1071 1073 } 1072 1074 } 1075 $link = bp_get_group_permalink( $item_id ); 1073 1076 1074 1077 break; 1075 1078 case 'blogs' : … … 1079 1082 if ( !$alt ) { 1080 1083 $alt = sprintf( __( 'Profile picture of the author of the site %s', 'buddypress' ), get_blog_option( $item_id, 'blogname' ) ); 1081 1084 } 1082 1085 $link = home_url(); 1086 1083 1087 break; 1084 1088 case 'friends' : 1085 1089 $object = 'user'; … … 1088 1092 if ( empty( $alt ) ) { 1089 1093 $alt = sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_core_get_user_displayname( $activities_template->activity->secondary_item_id ) ); 1090 1094 } 1091 1095 $link = bp_core_get_userlink($item_id); 1096 1092 1097 break; 1093 1098 default : 1094 1099 $object = 'user'; … … 1098 1103 if ( !$alt ) { 1099 1104 $alt = sprintf( __( 'Profile picture of %s', 'buddypress' ), $activities_template->activity->display_name ); 1100 1105 } 1101 1106 $link = bp_core_get_userlink($item_id); 1107 1102 1108 break; 1103 1109 } 1104 1110 1105 // Allow object and item_idto be filtered1111 // Allow object, item_id, and link to be filtered 1106 1112 $object = apply_filters( 'bp_get_activity_secondary_avatar_object_' . $activities_template->activity->component, $object ); 1107 1113 $item_id = apply_filters( 'bp_get_activity_secondary_avatar_item_id', $item_id ); 1114 if( $linked ) $link = apply_filters('bp_get_activity_secondary_avatar_link', $link, $activities_template->activity->component); 1108 1115 1109 1116 // If we have no item_id or object, there is no avatar to display 1110 1117 if ( empty( $item_id ) || empty( $object ) ) 1111 1118 return false; 1119 1120 if( $linked ) { 1121 return sprintf('<a href="%s" class="%s">%s</a>', 1122 $link, 1123 $link_class, 1124 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 ) ) ), 1125 ); 1112 1126 1127 // else 1113 1128 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 ) ) ); 1114 1129 } 1115 1130