Ticket #1231: bp-core-avatars.patch
File bp-core-avatars.patch, 1.8 KB (added by , 15 years ago) |
---|
-
bp-core-avatars.php
123 123 return false; 124 124 125 125 /* Set the file names to search for to select the full size or thumbnail image. */ 126 $avatar_name = ( 'full' == $type ) ? '-bpfull' : '-bpthumb'; 127 $legacy_user_avatar_name = ( 'full' == $type ) ? '-avatar2' : '-avatar1'; 128 $legacy_group_avatar_name = ( 'full' == $type ) ? '-groupavatar-full' : '-groupavatar-thumb'; 126 $avatar_suffixes = array(); 127 $avatar_suffixes[] = $avatar_name = ( 'full' == $type ) ? '-bpfull' : '-bpthumb'; 128 $avatar_suffixes[] = $legacy_user_avatar_name = ( 'full' == $type ) ? '-avatar2' : '-avatar1'; 129 $avatar_suffixes[] = $legacy_group_avatar_name = ( 'full' == $type ) ? '-groupavatar-full' : '-groupavatar-thumb'; 129 130 130 131 if ( $av_dir = opendir( $avatar_folder_dir ) ) { 131 while ( false !== ( $avatar_file = readdir($av_dir) ) ) { 132 if ( preg_match( "/{$avatar_name}/", $avatar_file ) || preg_match( "/{$legacy_user_avatar_name}/", $avatar_file ) || preg_match( "/{$legacy_group_avatar_name}/", $avatar_file ) ) 133 $avatar_url = $avatar_folder_url . '/' . $avatar_file; 134 } 132 while ( is_null( $avatar_url ) && false !== ( list( $key, $avatar_suffix ) = each( $avatar_suffixes ) ) ) { 133 while ( false !== ( $avatar_file = readdir($av_dir) ) ) { 134 if ( preg_match( "/{$avatar_suffix}/", $avatar_file ) ) { 135 $avatar_url = $avatar_folder_url . '/' . $avatar_file; 136 break; 137 } 138 } 139 rewinddir($av_dir); 140 } 135 141 } 136 142 closedir($av_dir); 137 143 138 144 return apply_filters( 'bp_core_fetch_avatar', "<img src='{$avatar_url}' alt='{$alt}' id='{$css_id}' class='{$class}'{$html_width}{$html_height} />", $params ); 139 145 }