Changeset 6607
- Timestamp:
- 12/10/2012 02:25:26 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-template.php
r6524 r6607 1049 1049 1050 1050 $defaults = array( 1051 'type' => 'thumb', 1052 'width' => 20, 1053 'height' => 20, 1054 'class' => 'avatar', 1055 'email' => false 1051 'type' => 'thumb', 1052 'width' => 20, 1053 'height' => 20, 1054 'class' => 'avatar', 1055 'link_class' => '', 1056 'linked' => true, 1057 'email' => false 1056 1058 ); 1057 1059 … … 1064 1066 $object = 'group'; 1065 1067 $item_id = $activities_template->activity->item_id; 1068 $link = bp_get_group_permalink( groups_get_group( array( 'group_id' => $item_id ) ) ); 1066 1069 1067 1070 if ( empty( $alt ) ) { … … 1070 1073 if ( bp_is_active( 'groups' ) ) { 1071 1074 $group = groups_get_group( $item_id ); 1072 if ( isset( $group->name ) ) 1075 if ( isset( $group->name ) ) { 1073 1076 $alt = sprintf( __( 'Group logo of %s', 'buddypress' ), $group->name ); 1077 } 1074 1078 } 1075 1079 } … … 1079 1083 $object = 'blog'; 1080 1084 $item_id = $activities_template->activity->item_id; 1081 1082 if ( !$alt ) { 1085 $link = home_url(); 1086 1087 if ( empty( $alt ) ) { 1083 1088 $alt = sprintf( __( 'Profile picture of the author of the site %s', 'buddypress' ), get_blog_option( $item_id, 'blogname' ) ); 1084 1089 } … … 1088 1093 $object = 'user'; 1089 1094 $item_id = $activities_template->activity->secondary_item_id; 1095 $link = bp_core_get_userlink( $item_id ); 1090 1096 1091 1097 if ( empty( $alt ) ) { … … 1098 1104 $item_id = $activities_template->activity->user_id; 1099 1105 $email = $activities_template->activity->user_email; 1100 1101 if ( !$alt ) { 1106 $link = bp_core_get_userlink( $item_id ); 1107 1108 if ( empty( $alt ) ) { 1102 1109 $alt = sprintf( __( 'Profile picture of %s', 'buddypress' ), $activities_template->activity->display_name ); 1103 1110 } … … 1106 1113 } 1107 1114 1108 // Allow object and item_idto be filtered1115 // Allow object, item_id, and link to be filtered 1109 1116 $object = apply_filters( 'bp_get_activity_secondary_avatar_object_' . $activities_template->activity->component, $object ); 1110 1117 $item_id = apply_filters( 'bp_get_activity_secondary_avatar_item_id', $item_id ); 1111 1118 1112 1119 // If we have no item_id or object, there is no avatar to display 1113 if ( empty( $item_id ) || empty( $object ) ) 1120 if ( empty( $item_id ) || empty( $object ) ) { 1114 1121 return false; 1115 1116 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 ) ) ); 1122 } 1123 1124 // Get the avatar 1125 $avatar = bp_core_fetch_avatar( array( 1126 'item_id' => $item_id, 1127 'object' => $object, 1128 'type' => $type, 1129 'alt' => $alt, 1130 'class' => $class, 1131 'width' => $width, 1132 'height' => $height, 1133 'email' => $email 1134 ) ); 1135 1136 if ( !empty( $linked ) ) { 1137 $link = apply_filters( 'bp_get_activity_secondary_avatar_link', $link, $activities_template->activity->component ); 1138 1139 return sprintf( '<a href="%s" class="%s">%s</a>', 1140 $link, 1141 $link_class, 1142 apply_filters( 'bp_get_activity_secondary_avatar', $avatar ) 1143 ); 1144 } 1145 1146 // else 1147 return apply_filters( 'bp_get_activity_secondary_avatar', $avatar ); 1117 1148 } 1118 1149 -
trunk/bp-templates/bp-legacy/buddypress-functions.php
r6605 r6607 87 87 */ 88 88 private function setup_actions() { 89 90 // Template Output 91 add_filter( 'bp_get_activity_action_pre_meta', array( $this, 'secondary_avatars' ), 10, 2 ); 89 92 90 93 /** Scripts ***********************************************************/ … … 292 295 public function localize_scripts() { 293 296 297 } 298 299 /** 300 * Add secondary avatar image to this activity stream's record, if supported. 301 * 302 * @since BuddyPress (1.7) 303 * 304 * @param string $action The text of this activity 305 * @param BP_Activity_Activity $activity Activity object 306 * @package BuddyPress Theme 307 * @return string 308 */ 309 function secondary_avatars( $action, $activity ) { 310 switch ( $activity->component ) { 311 case 'groups' : 312 case 'friends' : 313 // Only insert avatar if one exists 314 if ( $secondary_avatar = bp_get_activity_secondary_avatar() ) { 315 $reverse_content = strrev( $action ); 316 $position = strpos( $reverse_content, 'a<' ); 317 $action = substr_replace( $action, $secondary_avatar, -$position - 2, 0 ); 318 } 319 break; 320 } 321 322 return $action; 294 323 } 295 324 }
Note: See TracChangeset
for help on using the changeset viewer.