#6336 closed enhancement (fixed)
Improve bp_core_check_avatar_type() and introduce a function to get the allowed avatar types
Reported by: | imath | Owned by: | imath |
---|---|---|---|
Milestone: | 2.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Media | Keywords: | has-patch |
Cc: |
Description
During WC London, DJPaul recommended:
- to improve the i18n of #6278 for the error message when a file is not a supported image file type.
- bp_core_check_avatar_type (and related functions) should be committed separately and have its own ticket.
I've attached a unit test 'current_check_avatar_type.patch' which is only testing the current bp_core_check_avatar_type(). This unit test requires 2 files i'm not attaching
- tests/phpunit/assets/files/buddypress_logo.pdf
- tests/phpunit/assets/files/disc.png
You'll see that the current function is failing the last assertion.
In 01.patch, i'm suggesting 2 new functions :
bp_core_get_allowed_avatar_types()
which include a filter to restrict image typesbp_core_get_allowed_avatar_mimes()
to get the corresponding mime types
I think bp_core_check_avatar_type()
should use wp_check_filetype_and_ext() to be absolutely sure an image was uploaded.
Attachments (5)
Change History (8)
Note: See
TracTickets for help on using
tickets.
6336.02.patch is improving 01.patch