Ticket #2606: 2606-3.patch
| File 2606-3.patch, 17.7 KB (added by , 15 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
52 52 * Fetches an avatar from a BuddyPress object. Supports user/group/blog as 53 53 * default, but can be extended to include your own custom components too. 54 54 * 55 * @global object $bp 56 * @global object $current_blog 55 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() 56 * @global $current_blog WordPress global containing information and settings for the current blog being viewed. 57 * @global $groups_template Groups template loop object 58 * @global $members_template Members/Group Members template loop object 57 59 * @param array $args Determine the output of this function 58 60 * @return string Formatted HTML <img> element, or raw avatar URL based on $html arg 59 61 */ 60 62 function bp_core_fetch_avatar( $args = '' ) { 61 global $bp, $current_blog ;63 global $bp, $current_blog, $groups_template, $members_template; 62 64 63 65 // Set a few default variables 64 66 $def_object = 'user'; … … 79 81 'alt' => $def_alt, // Custom <img> alt (string) 80 82 'email' => false, // Pass the user email (for gravatar) to prevent querying the DB for it 81 83 'no_grav' => false, // If there is no avatar found, return false instead of a grav? 82 'html' => true // Wrap the return img URL in <img /> 84 'html' => true, // Wrap the return img URL in <img /> 85 'title' => '' // Custom <img> title (string) 83 86 ); 84 87 85 88 // Compare defaults to passed and extract … … 117 120 // Add an identifying class to each item 118 121 $class .= ' ' . $object . '-' . $item_id . '-avatar'; 119 122 123 // Set alt tag 124 $item_name = ''; 125 126 if ( 'user' == $object ) { 127 if ( $members_template ) 128 $item_name = bp_get_member_name(); 129 else 130 $item_name = bp_core_get_user_displayname( $item_id ); 131 132 } elseif ( 'group' == $object && $groups_template ) { 133 $item_name = bp_get_group_name(); 134 } elseif ( 'blog' == $object ) { 135 $item_name = get_blog_option( $item_id, 'blogname' ); 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 … … 499 525 if ( empty( $id ) ) 500 526 return !empty( $avatar ) ? $avatar : $default; 501 527 528 if ( !$alt ) 529 $alt = __( 'Picture of %s', 'buddypress' ); 530 502 531 // Let BuddyPress handle the fetching of the avatar 503 532 $bp_avatar = bp_core_fetch_avatar( array( 'item_id' => $id, 'width' => $size, 'height' => $size, 'alt' => $alt ) ); 504 533 -
bp-activity/bp-activity-templatetags.php
422 422 'width' => 20, 423 423 'height' => 20, 424 424 'class' => 'avatar', 425 'alt' => __( ' Avatar', 'buddypress' ),425 'alt' => __( 'Picture of %s', 'buddypress' ), 426 426 'email' => false 427 427 ); 428 428 … … 468 468 'width' => 20, 469 469 'height' => 20, 470 470 'class' => 'avatar', 471 'alt' => __( 'Avatar', 'buddypress' ),472 471 'email' => false 473 472 ); 474 473 … … 480 479 case 'groups' : 481 480 $object = 'group'; 482 481 $item_id = $activities_template->activity->item_id; 482 483 if ( !$alt ) 484 $alt = __( 'Group avatar', 'buddypress' ); 485 483 486 break; 484 487 case 'blogs' : 485 488 $object = 'blog'; 486 489 $item_id = $activities_template->activity->item_id; 490 491 if ( !$alt ) 492 $alt = sprintf( __( 'Blog avatar of %s', 'buddypress' ), get_blog_option( $item_id, 'blogname' ) ); 493 487 494 break; 488 495 case 'friends' : 489 496 $object = 'user'; 490 497 $item_id = $activities_template->activity->secondary_item_id; 498 499 if ( !$alt ) 500 $alt = __( 'Picture of %s', 'buddypress' ); 501 491 502 break; 492 503 default : 493 504 $object = 'user'; 494 505 $item_id = $activities_template->activity->user_id; 495 506 $email = $activities_template->activity->user_email; 507 508 if ( !$alt ) 509 $alt = __( 'Picture of %s', 'buddypress' ); 510 496 511 break; 497 512 } 498 513 -
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-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() { -
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' => __( 'Group avatar for %s', 'buddypress' ) 283 283 ); 284 284 285 285 $r = wp_parse_args( $args, $defaults ); … … 462 462 <ul id="group-admins"> 463 463 <?php foreach( (array)$group->admins as $admin ) { ?> 464 464 <li> 465 <a href="<?php echo bp_core_get_user_domain( $admin->user_id, $admin->user_nicename, $admin->user_login ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'email' => $admin->user_email ) ) ?></a>465 <a href="<?php echo bp_core_get_user_domain( $admin->user_id, $admin->user_nicename, $admin->user_login ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'email' => $admin->user_email, 'alt' => __( 'Picture of %s', 'buddypress' ) ) ) ?></a> 466 466 </li> 467 467 <?php } ?> 468 468 </ul> … … 482 482 <ul id="group-mods"> 483 483 <?php foreach( (array)$group->mods as $mod ) { ?> 484 484 <li> 485 <a href="<?php echo bp_core_get_user_domain( $mod->user_id, $mod->user_nicename, $mod->user_login ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'email' => $mod->user_email ) ) ?></a>485 <a href="<?php echo bp_core_get_user_domain( $mod->user_id, $mod->user_nicename, $mod->user_login ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'email' => $mod->user_email, 'alt' => __( 'Picture of %s', 'buddypress' ) ) ) ?></a> 486 486 </li> 487 487 <?php } ?> 488 488 </ul> … … 723 723 <?php foreach ( (array)$admins as $admin ) { ?> 724 724 <?php if ( $admin_list ) { ?> 725 725 <li> 726 <?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'type' => 'thumb', 'width' => 30, 'height' => 30 ) ) ?>726 <?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'type' => 'thumb', 'width' => 30, 'height' => 30, 'alt' => __( 'Picture of %s', 'buddypress' ) ) ) ?> 727 727 <h5><?php echo bp_core_get_userlink( $admin->user_id ) ?> <span class="small"> — <a class="confirm" href="<?php bp_group_member_demote_link($admin->user_id) ?>"><?php _e( 'Demote to Member', 'buddypress' ) ?></a></span></h5> 728 728 </li> 729 729 <?php } else { ?> 730 730 <li> 731 <?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'type' => 'thumb' ) ) ?>731 <?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'type' => 'thumb', 'alt' => __( 'Picture of %s', 'buddypress' ) ) ) ?> 732 732 <h5><?php echo bp_core_get_userlink( $admin->user_id ) ?></h5> 733 733 <span class="activity"><?php echo bp_core_get_last_activity( strtotime( $admin->date_modified ), __( 'joined %s ago', 'buddypress') ); ?></span> 734 734 … … 761 761 <?php foreach ( (array)$group_mods as $mod ) { ?> 762 762 <?php if ( $admin_list ) { ?> 763 763 <li> 764 <?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'type' => 'thumb', 'width' => 30, 'height' => 30 ) ) ?>764 <?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'type' => 'thumb', 'width' => 30, 'height' => 30, 'alt' => __( 'Picture of %s', 'buddypress' ) ) ) ?> 765 765 <h5><?php echo bp_core_get_userlink( $mod->user_id ) ?> <span class="small"> — <a href="<?php bp_group_member_promote_admin_link( array( 'user_id' => $mod->user_id ) ) ?>" class="confirm" title="<?php _e( 'Promote to Admin', 'buddypress' ); ?>"><?php _e( 'Promote to Admin', 'buddypress' ); ?></a> | <a class="confirm" href="<?php bp_group_member_demote_link($mod->user_id) ?>"><?php _e( 'Demote to Member', 'buddypress' ) ?></a></span></h5> 766 766 </li> 767 767 <?php } else { ?> 768 768 <li> 769 <?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'type' => 'thumb' ) ) ?>769 <?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'type' => 'thumb', 'alt' => __( 'Picture of %s', 'buddypress' ) ) ) ?> 770 770 <h5><?php echo bp_core_get_userlink( $mod->user_id ) ?></h5> 771 771 <span class="activity"><?php echo bp_core_get_last_activity( strtotime( $mod->date_modified ), __( 'joined %s ago', 'buddypress') ); ?></span> 772 772 … … 1316 1316 function bp_get_group_member_avatar() { 1317 1317 global $members_template; 1318 1318 1319 return apply_filters( 'bp_get_group_member_avatar', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->user_id, 'type' => 'full', 'email' => $members_template->member->user_email ) ) );1319 return apply_filters( 'bp_get_group_member_avatar', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->user_id, 'type' => 'full', 'email' => $members_template->member->user_email, 'alt' => __( 'Picture of %s', 'buddypress' ) ) ) ); 1320 1320 } 1321 1321 1322 1322 function bp_group_member_avatar_thumb() { … … 1325 1325 function bp_get_group_member_avatar_thumb() { 1326 1326 global $members_template; 1327 1327 1328 return apply_filters( 'bp_get_group_member_avatar_thumb', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->user_id, 'type' => 'thumb', 'email' => $members_template->member->user_email ) ) );1328 return apply_filters( 'bp_get_group_member_avatar_thumb', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->user_id, 'type' => 'thumb', 'email' => $members_template->member->user_email, 'alt' => __( 'Picture of %s', 'buddypress' ) ) ) ); 1329 1329 } 1330 1330 1331 1331 function bp_group_member_avatar_mini( $width = 30, $height = 30 ) { … … 1334 1334 function bp_get_group_member_avatar_mini( $width = 30, $height = 30 ) { 1335 1335 global $members_template; 1336 1336 1337 return apply_filters( 'bp_get_group_member_avatar_mini', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->user_id, 'type' => 'thumb', 'width' => $width, 'height' => $height, 'email' => $members_template->member->user_email ) ) );1337 return apply_filters( 'bp_get_group_member_avatar_mini', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->user_id, 'type' => 'thumb', 'width' => $width, 'height' => $height, 'email' => $members_template->member->user_email, 'alt' => __( 'Picture of %s', 'buddypress' ) ) ) ); 1338 1338 } 1339 1339 1340 1340 function bp_group_member_name() { … … 1975 1975 function bp_group_request_user_avatar_thumb() { 1976 1976 global $requests_template; 1977 1977 1978 echo apply_filters( 'bp_group_request_user_avatar_thumb', bp_core_fetch_avatar( array( 'item_id' => $requests_template->request->user_id, 'type' => 'thumb' ) ) );1978 echo apply_filters( 'bp_group_request_user_avatar_thumb', bp_core_fetch_avatar( array( 'item_id' => $requests_template->request->user_id, 'type' => 'thumb', 'alt' => __( 'Picture of %s', 'buddypress' ) ) ) ); 1979 1979 } 1980 1980 1981 1981 function bp_group_request_reject_link() {