Ticket #2606: 2606.patch
File 2606.patch, 7.5 KB (added by , 15 years ago) |
---|
-
bp-core/bp-core-filters.php
222 222 if ( !is_admin() || ( is_admin() && empty( $_POST['noconfirmation'] ) ) ) 223 223 add_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_notification', 1, 4 ); 224 224 225 add_filter( 'bp_core_avatar_alt', 'wp_filter_kses', 1 ); 226 add_filter( 'bp_core_avatar_alt', 'wptexturize' ); 227 add_filter( 'bp_core_avatar_alt', 'convert_chars' ); 228 add_filter( 'bp_core_avatar_alt', 'stripslashes_deep' ); 225 229 ?> 230 No newline at end of file -
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 $members_template Members/Group Members template loop object 57 58 * @param array $args Determine the output of this function 58 59 * @return string Formatted HTML <img> element, or raw avatar URL based on $html arg 59 60 */ 60 61 function bp_core_fetch_avatar( $args = '' ) { 61 global $bp, $current_blog ;62 global $bp, $current_blog, $members_template; 62 63 63 64 // Set a few default variables 64 65 $def_object = 'user'; … … 79 80 'alt' => $def_alt, // Custom <img> alt (string) 80 81 'email' => false, // Pass the user email (for gravatar) to prevent querying the DB for it 81 82 '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 'html' => true, // Wrap the return img URL in <img /> 84 'title' => '' // Custom <img> title (string) 83 85 ); 84 86 85 87 // Compare defaults to passed and extract … … 117 119 // Add an identifying class to each item 118 120 $class .= ' ' . $object . '-' . $item_id . '-avatar'; 119 121 122 // Set alt tag 123 $item_name = ''; 124 125 if ( 'user' == $object ) { 126 if ( $members_template->member ) 127 $item_name = bp_get_member_name(); 128 else 129 $item_name = bp_core_get_user_displayname( $item_id ); 130 } elseif ( 'group' == $object ) { 131 $item_name = bp_get_group_name(); 132 } elseif ( 'blog' == $object ) { 133 $item_name = bp_get_blog_name(); 134 } 135 136 $alt = sprintf( $alt, esc_attr( apply_filters( 'bp_core_avatar_alt', $item_name, $item_id, $object ) ) ); 137 138 // Set title tag 139 if ( $title ) 140 $title = " title='" . esc_attr( apply_filters( 'bp_core_avatar_title', $title ) ) . "'"; 141 elseif ( $item_name ) 142 $title = " title='" . esc_attr( apply_filters( 'bp_core_avatar_title', $item_name, $item_id, $object ) ) . "'"; 143 120 144 // Set CSS ID if passed 121 145 if ( !empty( $css_id ) ) 122 146 $css_id = " id='{$css_id}'"; … … 195 219 196 220 // Return it wrapped in an <img> element 197 221 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 );222 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 223 200 224 // ...or only the URL 201 225 } else { … … 246 270 247 271 // Return gravatar wrapped in <img /> 248 272 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 );273 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 274 251 275 // ...or only return the gravatar URL 252 276 else … … 499 523 if ( empty( $id ) ) 500 524 return !empty( $avatar ) ? $avatar : $default; 501 525 526 if ( !$alt ) 527 $alt = __( 'Picture of %s', 'buddypress' ); 528 502 529 // Let BuddyPress handle the fetching of the avatar 503 530 $bp_avatar = bp_core_fetch_avatar( array( 'item_id' => $id, 'width' => $size, 'height' => $size, 'alt' => $alt ) ); 504 531 -
bp-blogs/bp-blogs-templatetags.php
192 192 'height' => false, 193 193 'class' => 'avatar', 194 194 'id' => false, 195 'alt' => __( ' Blog avatar', 'buddypress' ),195 'alt' => __( 'Avatar of blog %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 of group %s', 'buddypress' ) 283 283 ); 284 284 285 285 $r = wp_parse_args( $args, $defaults );