[buddypress-trac] [BuddyPress Trac] #6336: Improve bp_core_check_avatar_type() and introduce a function to get the allowed avatar types

buddypress-trac noreply at wordpress.org
Mon Mar 30 20:57:04 UTC 2015


#6336: Improve bp_core_check_avatar_type() and introduce a function to get the
allowed avatar types
---------------------------+-----------------------
 Reporter:  imath          |      Owner:
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  2.3
Component:  API - Avatars  |    Version:
 Severity:  normal         |   Keywords:  has-patch
---------------------------+-----------------------
 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 types
 - {{{bp_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.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6336>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list