Changeset 3635
- Timestamp:
- 01/01/2011 06:26:18 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-templatetags.php
r3610 r3635 457 457 'height' => 20, 458 458 'class' => 'avatar', 459 'alt' => __( ' Avatar', 'buddypress' ),459 'alt' => __( 'Profile picture of %s', 'buddypress' ), 460 460 'email' => false 461 461 ); … … 503 503 'height' => 20, 504 504 'class' => 'avatar', 505 'alt' => __( 'Avatar', 'buddypress' ),506 505 'email' => false 507 506 ); … … 515 514 $object = 'group'; 516 515 $item_id = $activities_template->activity->item_id; 516 517 if ( !$alt ) 518 $alt = __( 'Group logo of %s', 'buddypress' ); 519 517 520 break; 518 521 case 'blogs' : 519 522 $object = 'blog'; 520 523 $item_id = $activities_template->activity->item_id; 524 525 if ( !$alt ) 526 $alt = sprintf( __( 'Blog authored by %s', 'buddypress' ), get_blog_option( $item_id, 'blogname' ) ); 527 521 528 break; 522 529 case 'friends' : 523 530 $object = 'user'; 524 531 $item_id = $activities_template->activity->secondary_item_id; 532 533 if ( !$alt ) 534 $alt = __( 'Profile picture of %s', 'buddypress' ); 535 525 536 break; 526 537 default : … … 528 539 $item_id = $activities_template->activity->user_id; 529 540 $email = $activities_template->activity->user_email; 541 542 if ( !$alt ) 543 $alt = __( 'Profile picture of %s', 'buddypress' ); 544 530 545 break; 531 546 } -
trunk/bp-blogs/bp-blogs-templatetags.php
r3627 r3635 200 200 'class' => 'avatar', 201 201 'id' => false, 202 'alt' => __( 'Blog a vatar', 'buddypress' ),202 'alt' => __( 'Blog authored by %s', 'buddypress' ), 203 203 'no_grav' => true 204 204 ); -
trunk/bp-core/bp-core-avatars.php
r3592 r3635 53 53 * default, but can be extended to include your own custom components too. 54 54 * 55 * @global object $bp56 * @global object $current_blog55 * @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 57 * @param array $args Determine the output of this function 58 58 * @return string Formatted HTML <img> element, or raw avatar URL based on $html arg … … 62 62 63 63 // Set a few default variables 64 $def_object 65 $def_type 66 $def_class 67 $def_alt 64 $def_object = 'user'; 65 $def_type = 'thumb'; 66 $def_class = 'avatar'; 67 $def_alt = __( 'Avatar Image', 'buddypress' ); 68 68 69 69 // Set the default variables array 70 70 $defaults = array( 71 'item_id' => false, 72 'object' => $def_object, // user/group/blog/custom type (if you use filters) 73 'type' => $def_type, // thumb or full 74 'avatar_dir' => false, // Specify a custom avatar directory for your object 75 'width' => false, // Custom width (int) 76 'height' => false, // Custom height (int) 77 'class' => $def_class, // Custom <img> class (string) 78 'css_id' => false, // Custom <img> ID (string) 79 'alt' => $def_alt, // Custom <img> alt (string) 80 'email' => false, // Pass the user email (for gravatar) to prevent querying the DB for it 81 '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 /> 71 'item_id' => false, 72 'object' => $def_object, // user/group/blog/custom type (if you use filters) 73 'type' => $def_type, // thumb or full 74 'avatar_dir' => false, // Specify a custom avatar directory for your object 75 'width' => false, // Custom width (int) 76 'height' => false, // Custom height (int) 77 'class' => $def_class, // Custom <img> class (string) 78 'css_id' => false, // Custom <img> ID (string) 79 'alt' => $def_alt, // Custom <img> alt (string) 80 'email' => false, // Pass the user email (for gravatar) to prevent querying the DB for it 81 '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 /> 83 'title' => '' // Custom <img> title (string) 83 84 ); 84 85 … … 98 99 $item_id = apply_filters( 'bp_core_avatar_item_id', $item_id, $object ); 99 100 100 if ( !$item_id ) return false; 101 if ( !$item_id ) 102 return false; 101 103 } 102 104 … … 112 114 $avatar_dir = apply_filters( 'bp_core_avatar_dir', $avatar_dir, $object ); 113 115 114 if ( !$avatar_dir ) return false; 116 if ( !$avatar_dir ) 117 return false; 115 118 } 116 119 117 120 // Add an identifying class to each item 118 121 $class .= ' ' . $object . '-' . $item_id . '-avatar'; 122 123 // Get item name for alt/title tags 124 $item_name = ''; 125 126 if ( 'user' == $object ) 127 $item_name = bp_core_get_user_displayname( $item_id ); 128 elseif ( 'group' == $object ) 129 $item_name = bp_get_group_name( new BP_Groups_Group( $item_id ) ); 130 elseif ( 'blog' == $object ) 131 $item_name = get_blog_option( $item_id, 'blogname' ); 132 133 $alt = sprintf( $alt, apply_filters( 'bp_core_avatar_alt', $item_name, $item_id, $object ) ); 134 135 // Set title tag 136 if ( $title ) 137 $title = " title='" . esc_attr( apply_filters( 'bp_core_avatar_title', $title, $item_id, $object ) ) . "'"; 138 elseif ( $item_name ) 139 $title = " title='" . esc_attr( apply_filters( 'bp_core_avatar_title', $item_name, $item_id, $object ) ) . "'"; 119 140 120 141 // Set CSS ID if passed … … 196 217 // Return it wrapped in an <img> element 197 218 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 );219 return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $avatar_url . '" alt="' . esc_attr( $alt ) . '" class="' . esc_attr( $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 220 200 221 // ...or only the URL … … 247 268 // Return gravatar wrapped in <img /> 248 269 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 );270 return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $gravatar . '" alt="' . esc_attr( $alt ) . '" class="' . esc_attr( $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 271 251 272 // ...or only return the gravatar URL … … 506 527 return !empty( $avatar ) ? $avatar : $default; 507 528 529 if ( !$alt ) 530 $alt = __( 'Avatar of %s', 'buddypress' ); 531 508 532 // Let BuddyPress handle the fetching of the avatar 509 533 $bp_avatar = bp_core_fetch_avatar( array( 'item_id' => $id, 'width' => $size, 'height' => $size, 'alt' => $alt ) ); -
trunk/bp-core/bp-core-templatetags.php
r3631 r3635 322 322 'class' => 'avatar', 323 323 'id' => false, 324 'alt' => __( ' Member avatar', 'buddypress' )324 'alt' => __( 'Profile picture of %s', 'buddypress' ) 325 325 ); 326 326 … … 671 671 'width' => false, 672 672 'height' => false, 673 'html' => true 673 'html' => true, 674 'alt' => __( 'Profile picture of %s', 'buddypress' ) 674 675 ); 675 676 … … 677 678 extract( $r, EXTR_SKIP ); 678 679 679 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 ) ) );680 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 ) ) ); 680 681 } 681 682 … … 690 691 'width' => false, 691 692 'height' => false, 692 'html' => true 693 'html' => true, 694 'alt' => __( 'Profile picture of %s', 'buddypress' ) 693 695 ); 694 696 … … 696 698 extract( $r, EXTR_SKIP ); 697 699 698 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 ) ) );700 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 ) ) ); 699 701 } 700 702 -
trunk/bp-forums/bp-forums-templatetags.php
r3627 r3635 288 288 'width' => false, 289 289 'height' => false, 290 'alt' => __( 'Profile picture of %s', 'buddypress' ) 290 291 ); 291 292 … … 293 294 extract( $r, EXTR_SKIP ); 294 295 295 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 ) ) );296 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 ) ) ); 296 297 } 297 298 … … 369 370 'width' => false, 370 371 'height' => false, 372 'alt' => __( 'Group logo for %s', 'buddypress' ) 371 373 ); 372 374 … … 374 376 extract( $r, EXTR_SKIP ); 375 377 376 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 ) ) );378 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 ) ) ); 377 379 } 378 380 … … 387 389 'width' => false, 388 390 'height' => false, 391 'alt' => __( 'Profile picture of %s', 'buddypress' ) 389 392 ); 390 393 … … 392 395 extract( $r, EXTR_SKIP ); 393 396 394 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 ) ) );397 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 ) ) ); 395 398 } 396 399 … … 909 912 'width' => 20, 910 913 'height' => 20, 914 'alt' => __( 'Profile picture of %s', 'buddypress' ) 911 915 ); 912 916 … … 914 918 extract( $r, EXTR_SKIP ); 915 919 916 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 ) ) );920 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 ) ) ); 917 921 } 918 922 -
trunk/bp-groups/bp-groups-templatetags.php
r3627 r3635 291 291 'class' => 'avatar', 292 292 'id' => false, 293 'alt' => __( 'Group avatar', 'buddypress' )293 'alt' => __( 'Group logo of %s', 'buddypress' ) 294 294 ); 295 295 … … 474 474 <?php foreach( (array)$group->admins as $admin ) { ?> 475 475 <li> 476 <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>476 <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' => __( 'Profile picture of %s', 'buddypress' ) ) ) ?></a> 477 477 </li> 478 478 <?php } ?> … … 494 494 <?php foreach( (array)$group->mods as $mod ) { ?> 495 495 <li> 496 <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>496 <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' => __( 'Profile picture of %s', 'buddypress' ) ) ) ?></a> 497 497 </li> 498 498 <?php } ?> … … 737 737 <?php if ( $admin_list ) { ?> 738 738 <li> 739 <?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'type' => 'thumb', 'width' => 30, 'height' => 30 ) ) ?>739 <?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'type' => 'thumb', 'width' => 30, 'height' => 30, 'alt' => __( 'Profile picture of %s', 'buddypress' ) ) ) ?> 740 740 <h5><?php echo bp_core_get_userlink( $admin->user_id ) ?> <span class="small"> — <a class="confirm admin-demote-to-member" href="<?php bp_group_member_demote_link($admin->user_id) ?>"><?php _e( 'Demote to Member', 'buddypress' ) ?></a></span></h5> 741 741 </li> 742 742 <?php } else { ?> 743 743 <li> 744 <?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'type' => 'thumb' ) ) ?>744 <?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'type' => 'thumb', 'alt' => __( 'Profile picture of %s', 'buddypress' ) ) ) ?> 745 745 <h5><?php echo bp_core_get_userlink( $admin->user_id ) ?></h5> 746 746 <span class="activity"><?php echo bp_core_get_last_activity( strtotime( $admin->date_modified ), __( 'joined %s ago', 'buddypress') ); ?></span> … … 775 775 <?php if ( $admin_list ) { ?> 776 776 <li> 777 <?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'type' => 'thumb', 'width' => 30, 'height' => 30 ) ) ?>777 <?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'type' => 'thumb', 'width' => 30, 'height' => 30, 'alt' => __( 'Profile picture of %s', 'buddypress' ) ) ) ?> 778 778 <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 mod-promote-to-admin" title="<?php _e( 'Promote to Admin', 'buddypress' ); ?>"><?php _e( 'Promote to Admin', 'buddypress' ); ?></a> | <a class="confirm mod-demote-to-member" href="<?php bp_group_member_demote_link($mod->user_id) ?>"><?php _e( 'Demote to Member', 'buddypress' ) ?></a></span></h5> 779 779 </li> 780 780 <?php } else { ?> 781 781 <li> 782 <?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'type' => 'thumb' ) ) ?>782 <?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'type' => 'thumb', 'alt' => __( 'Profile picture of %s', 'buddypress' ) ) ) ?> 783 783 <h5><?php echo bp_core_get_userlink( $mod->user_id ) ?></h5> 784 784 <span class="activity"><?php echo bp_core_get_last_activity( strtotime( $mod->date_modified ), __( 'joined %s ago', 'buddypress') ); ?></span> … … 1442 1442 global $members_template; 1443 1443 1444 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 ) ) );1444 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' => __( 'Profile picture of %s', 'buddypress' ) ) ) ); 1445 1445 } 1446 1446 … … 1451 1451 global $members_template; 1452 1452 1453 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 ) ) );1453 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' => __( 'Profile picture of %s', 'buddypress' ) ) ) ); 1454 1454 } 1455 1455 … … 1460 1460 global $members_template; 1461 1461 1462 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 ) ) );1462 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' => __( 'Profile picture of %s', 'buddypress' ) ) ) ); 1463 1463 } 1464 1464 … … 2117 2117 global $requests_template; 2118 2118 2119 echo apply_filters( 'bp_group_request_user_avatar_thumb', bp_core_fetch_avatar( array( 'item_id' => $requests_template->request->user_id, 'type' => 'thumb' ) ) );2119 echo apply_filters( 'bp_group_request_user_avatar_thumb', bp_core_fetch_avatar( array( 'item_id' => $requests_template->request->user_id, 'type' => 'thumb', 'alt' => __( 'Profile picture of %s', 'buddypress' ) ) ) ); 2120 2120 } 2121 2121
Note: See TracChangeset
for help on using the changeset viewer.