Ticket #2606: 2606-2.patch
File 2606-2.patch, 9.0 KB (added by , 14 years ago) |
---|
-
bp-core/bp-core-templatetags.php
311 311 'height' => false, 312 312 'class' => 'avatar', 313 313 'id' => false, 314 'alt' => __( ' Member avatar', 'buddypress' )314 'alt' => __( 'Picture of %s', 'buddypress' ) 315 315 ); 316 316 317 317 $r = wp_parse_args( $args, $defaults ); … … 686 686 'type' => 'thumb', 687 687 'width' => false, 688 688 'height' => false, 689 'html' => true 689 'html' => true, 690 'alt' => __( 'Picture of %s', 'buddypress' ) 690 691 ); 691 692 692 693 $r = wp_parse_args( $args, $defaults ); 693 694 extract( $r, EXTR_SKIP ); 694 695 695 return apply_filters( 'bp_get_loggedin_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'type' => $type, 'width' => $width, 'height' => $height, 'html' => $html ) ) );696 return apply_filters( 'bp_get_loggedin_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'type' => $type, 'width' => $width, 'height' => $height, 'html' => $html, 'alt' => $alt ) ) ); 696 697 } 697 698 698 699 function bp_displayed_user_avatar( $args = '' ) { … … 705 706 'type' => 'thumb', 706 707 'width' => false, 707 708 'height' => false, 708 'html' => true 709 'html' => true, 710 'alt' => __( 'Picture of %s', 'buddypress' ) 709 711 ); 710 712 711 713 $r = wp_parse_args( $args, $defaults ); 712 714 extract( $r, EXTR_SKIP ); 713 715 714 return apply_filters( 'bp_get_displayed_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => $type, 'width' => $width, 'height' => $height, 'html' => $html ) ) );716 return apply_filters( 'bp_get_displayed_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => $type, 'width' => $width, 'height' => $height, 'html' => $html, 'alt' => $alt ) ) ); 715 717 } 716 718 717 719 function bp_avatar_admin_step() { -
bp-core/bp-core-avatars.php
58 58 * @return string Formatted HTML <img> element, or raw avatar URL based on $html arg 59 59 */ 60 60 function bp_core_fetch_avatar( $args = '' ) { 61 global $bp, $current_blog ;61 global $bp, $current_blog, $members_template, $forum_template; 62 62 63 63 // Set a few default variables 64 64 $def_object = 'user'; … … 80 80 'email' => false, // Pass the user email (for gravatar) to prevent querying the DB for it 81 81 'no_grav' => false, // If there is no avatar found, return false instead of a grav? 82 82 'html' => true // Wrap the return img URL in <img /> 83 'title' => '' // Custom <img> title (string) 83 84 ); 84 85 85 86 // Compare defaults to passed and extract … … 117 118 // Add an identifying class to each item 118 119 $class .= ' ' . $object . '-' . $item_id . '-avatar'; 119 120 121 // Set alt tag 122 $item_name = ''; 123 124 if ( 'user' == $object ) { 125 if ( $members_template ) 126 $item_name = bp_get_member_name(); 127 else 128 $item_name = bp_core_get_user_displayname( $item_id ); 129 } elseif ( 'group' == $object ) { 130 if ( $forum_template ) { 131 $group = new BP_Groups_Group( $item_id ); 132 $item_name = bp_get_group_name( $group ); 133 } 134 else 135 $item_name = bp_get_group_name(); 136 } 137 138 $alt = sprintf( $alt, apply_filters( 'bp_core_avatar_alt', $item_name, $item_id, $object ) ); 139 140 // Set title tag 141 if ( $title ) 142 $title = " title='" . apply_filters( 'bp_core_avatar_title', $title, $item_id, $object ) . "'"; 143 elseif ( $item_name ) 144 $title = " title='" . apply_filters( 'bp_core_avatar_title', $item_name, $item_id, $object ) . "'"; 145 120 146 // Set CSS ID if passed 121 147 if ( !empty( $css_id ) ) 122 148 $css_id = " id='{$css_id}'"; … … 195 221 196 222 // Return it wrapped in an <img> element 197 223 if ( true === $html ) { 198 return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $avatar_url . '" alt="' . $alt . '" class="' . $class . '"' . $css_id . $html_width . $html_height . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );224 return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $avatar_url . '" alt="' . $alt . '" class="' . $class . '"' . $css_id . $html_width . $html_height . $title . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir ); 199 225 200 226 // ...or only the URL 201 227 } else { … … 246 272 247 273 // Return gravatar wrapped in <img /> 248 274 if ( true === $html ) 249 return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $gravatar . '" alt="' . $alt . '" class="' . $class . '"' . $css_id . $html_width . $html_height . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );275 return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $gravatar . '" alt="' . $alt . '" class="' . $class . '"' . $css_id . $html_width . $html_height . $title . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir ); 250 276 251 277 // ...or only return the gravatar URL 252 278 else -
bp-blogs/bp-blogs-templatetags.php
192 192 'height' => false, 193 193 'class' => 'avatar', 194 194 'id' => false, 195 'alt' => __( 'Blog a vatar', 'buddypress' ),195 'alt' => __( 'Blog authored by %s', 'buddypress' ), 196 196 'no_grav' => true 197 197 ); 198 198 -
bp-groups/bp-groups-templatetags.php
279 279 'height' => false, 280 280 'class' => 'avatar', 281 281 'id' => false, 282 'alt' => __( ' Group avatar', 'buddypress' )282 'alt' => __( 'Avatar for %s', 'buddypress' ) 283 283 ); 284 284 285 285 $r = wp_parse_args( $args, $defaults ); -
bp-forums/bp-forums-templatetags.php
278 278 'type' => 'thumb', 279 279 'width' => false, 280 280 'height' => false, 281 'alt' => __( 'Picture of %s', 'buddypress' ) 281 282 ); 282 283 283 284 $r = wp_parse_args( $args, $defaults ); 284 285 extract( $r, EXTR_SKIP ); 285 286 286 return apply_filters( 'bp_get_the_topic_poster_avatar', bp_core_fetch_avatar( array( 'item_id' => $forum_template->topic->topic_poster, 'type' => $type, 'width' => $width, 'height' => $height ) ) );287 return apply_filters( 'bp_get_the_topic_poster_avatar', bp_core_fetch_avatar( array( 'item_id' => $forum_template->topic->topic_poster, 'type' => $type, 'width' => $width, 'height' => $height, 'alt' => $alt ) ) ); 287 288 } 288 289 289 290 function bp_the_topic_poster_name() { … … 359 360 'type' => 'thumb', 360 361 'width' => false, 361 362 'height' => false, 363 'alt' => __( 'Avatar for %s', 'buddypress' ) 362 364 ); 363 365 364 366 $r = wp_parse_args( $args, $defaults ); 365 367 extract( $r, EXTR_SKIP ); 366 368 367 return apply_filters( 'bp_get_the_topic_object_avatar', bp_core_fetch_avatar( array( 'item_id' => $forum_template->topic->object_id, 'type' => $type, 'object' => 'group', 'width' => $width, 'height' => $height ) ) );369 return apply_filters( 'bp_get_the_topic_object_avatar', bp_core_fetch_avatar( array( 'item_id' => $forum_template->topic->object_id, 'type' => $type, 'object' => 'group', 'width' => $width, 'height' => $height, 'alt' => $alt ) ) ); 368 370 } 369 371 370 372 function bp_the_topic_last_poster_avatar( $args = '' ) { … … 377 379 'type' => 'thumb', 378 380 'width' => false, 379 381 'height' => false, 382 'alt' => __( 'Picture of %s', 'buddypress' ) 380 383 ); 381 384 382 385 $r = wp_parse_args( $args, $defaults ); 383 386 extract( $r, EXTR_SKIP ); 384 387 385 return apply_filters( 'bp_get_the_topic_last_poster_avatar', bp_core_fetch_avatar( array( 'email' => $forum_template->topic->topic_last_poster_email, 'item_id' => $forum_template->topic->topic_last_poster, 'type' => $type, 'width' => $width, 'height' => $height ) ) );388 return apply_filters( 'bp_get_the_topic_last_poster_avatar', bp_core_fetch_avatar( array( 'email' => $forum_template->topic->topic_last_poster_email, 'item_id' => $forum_template->topic->topic_last_poster, 'type' => $type, 'width' => $width, 'height' => $height, 'alt' => $alt ) ) ); 386 389 } 387 390 388 391 function bp_the_topic_start_time() { … … 892 895 'type' => 'thumb', 893 896 'width' => 20, 894 897 'height' => 20, 898 'alt' => __( 'Picture of %s', 'buddypress' ) 895 899 ); 896 900 897 901 $r = wp_parse_args( $args, $defaults ); 898 902 extract( $r, EXTR_SKIP ); 899 903 900 return apply_filters( 'bp_get_the_topic_post_poster_avatar', bp_core_fetch_avatar( array( 'item_id' => $topic_template->post->poster_id, 'type' => $type, 'width' => $width, 'height' => $height ) ) );904 return apply_filters( 'bp_get_the_topic_post_poster_avatar', bp_core_fetch_avatar( array( 'item_id' => $topic_template->post->poster_id, 'type' => $type, 'width' => $width, 'height' => $height, 'alt' => $alt ) ) ); 901 905 } 902 906 903 907 function bp_the_topic_post_poster_name() {