Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #41 from semanio/bugfix/unique_filename_callback-fix
Browse files Browse the repository at this point in the history
Wrapping $user->display_name within sanitize_file_name in a PHP strto…
  • Loading branch information
andrewlimaza authored Jul 8, 2021
2 parents a0c24c5 + 77da931 commit 204cdd4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion init.php
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,8 @@ public function avatar_delete( $user_id ) {
*/
public function unique_filename_callback( $dir, $name, $ext ) {
$user = get_user_by( 'id', (int) $this->user_id_being_edited );
$name = $base_name = sanitize_file_name( $user->display_name . '_avatar' );
$name = $base_name = sanitize_file_name( strtolower( $user->display_name ) . '_avatar' );

$number = 1;

while ( file_exists( $dir . "/$name$ext" ) ) {
Expand Down

0 comments on commit 204cdd4

Please sign in to comment.