[wp-trac] [WordPress Trac] #32544: No function exposes all supported MIME types
WordPress Trac
noreply at wordpress.org
Mon Jun 8 15:34:54 UTC 2015
#32544: No function exposes all supported MIME types
----------------------------------------+------------------------------
Reporter: dan.rossiter | Owner:
Type: enhancement | Status: new
Priority: low | Milestone: Awaiting Review
Component: Media | Version: 4.2.2
Severity: normal | Resolution:
Keywords: needs-patch good-first-bug | Focuses:
----------------------------------------+------------------------------
Comment (by dan.rossiter):
Replying to [comment:3 ipm-frommen]:
> To me, it is not clear what the desired functionality exactly is.
>
> Since the `upload_mimes` filter passes the current user ID, there is no
way to include all MIME types, for every possible user.
I agree. This functionality cannot be achieved without a structural change
to the way that additional MIME types are added.
>
> For example, a plugin could use the above filter as well as the user ID
like so:
>
> {{{
> add_filter( 'upload_mimes', 'user_mimes', 10, 2 );
>
> function user_mimes( $mimes, $user_id ) {
>
> $user = get_userdata( $user_id );
> if ( $user && $user->user_firstname === 'Abe' ) {
> $mimes[ 'foo' ] = 'text/foo';
> }
>
> return $mimes;
> }
> }}}
>
> If I understand your last sentence correctly, you would like to have
`'foo'` included in the result of your desired `wp_get_all_mime_types`
function. Is this correct? If so, this is not possible.
It is absolutely possible. As stated above, it would require a structural
change.
>
> Also, your example code is wrong (there is an endless loop).
Not sure where you're seeing a looping construct...
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32544#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list