MU Advanced: Issues and Discussion
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • September 03, 2010, 12:26:11 PM
Home Forums Contact Tags FAQ Links News Login Register
* *
Navigation Menu
Search

Random Quotes
Reality is that which, when you stop believing in it, doesn't go away
- Philip K. Dick
Pages: [1]   Go Down
  Print  
Author Topic: why are media uploads disabled in mu2.6?  (Read 1508 times)
0 Members and 1 Guest are viewing this topic.
ZappoMan
Full Member
***

Karma: 1
Offline Offline

Posts: 157



View Profile
« on: August 14, 2008, 04:10:54 AM »

So I was noticing that the mu 2.6 code appears to have support for "video", "audio" and other uploads in the media uploader... but on line 659 of wp-admin/includes/mu.php we have this code:

Code:
add_action( 'media_buttons', 'mu_media_buttons' );
remove_action( 'media_buttons', 'media_buttons' );


This appears to remove those buttons.

Does anyone know why?
Logged

Yep, that's me... riding my bike 204 miles in one day.
ZappoMan
Full Member
***

Karma: 1
Offline Offline

Posts: 157



View Profile
« Reply #1 on: August 14, 2008, 04:57:06 AM »

Related to this question...

Has anyone written a plugin that makes the "video uploader" work similar to wp.com...

Which is to say, tells people how to embed videos by using the [youtube=xxxxxx] syntax.

I have the media filters implemented to correctly go from the square bracket style url psuedo-tags, I'm more wondering if anyone has hooked the new UI to show the help message.
Logged

Yep, that's me... riding my bike 204 miles in one day.
Andrea_R
Key Master
*****

Karma: 5
Offline Offline

Posts: 1627


The spiky-haired mistress of homeschooling. (R)


View Profile WWW
« Reply #2 on: August 14, 2008, 07:25:42 AM »

If they're able to put in shortcode at wp.com, then I'm 99% certain they added a plugin for it. Cheesy

I do remember seeing a line or comment from Donncha somewhere about him removing those buttons.
Logged

Am I the only one with a sig?
Ah well, might as well read my blog for lols.
drmike
Gate Keeper
*****

Karma: 3
Offline Offline

Posts: 2228



View Profile WWW
« Reply #3 on: August 14, 2008, 09:15:54 AM »

Actually it's been that way for quite sometime:

http://trac.mu.wordpress.org/ticket/598
Logged

Luke
Key Master
*****

Karma: 5
Offline Offline

Posts: 3710



View Profile WWW
« Reply #4 on: August 14, 2008, 09:39:11 AM »

You can add a plugin to bring them back, although they don't do anything the main button (the asterisk) does.
Logged

10 frames?
Heh, that's for Quakers.

Note: This message may be Canadian friendly.

"Pornographic monster on the floor"
ZappoMan
Full Member
***

Karma: 1
Offline Offline

Posts: 157



View Profile
« Reply #5 on: August 14, 2008, 11:29:04 AM »

Ok, cool... I get it...

So the logic goes something like this...

* wpmu's allowed types is controlled by the administrator.
* drmiketemp (was that you doc?) points out that there isn't a connection between these icons and the mechanisms that control file type.
* Donncha solves this by removing the buttons.

By the way, I was trying to figure out what was up with this last night so I went to wp.com... and I noticed that they have the upload audio button.... but don't allow you to actually upload any audio file types... LOL... so they have the same issue. Wink

I actually tried to add back these buttons by adding this to a plugin:
Code:
remove_action( 'media_buttons', 'mu_media_buttons' );
add_action( 'media_buttons', 'media_buttons' );

Which is the reverse of what mu does... but it seems like my plugin is called BEFORE the mu code runs, and so it doesn't actually have any effect. Before I try to dive into tracing this out or simply hacking the mu code (which would be as simple as commenting out two lines of code, but is a hack and that annoys me)...

Does anyone have specific tips on how to actually implement this with a plugin, such that the timing of all the add_/remove_ calls actually work properly?

Thanks.


Logged

Yep, that's me... riding my bike 204 miles in one day.
ZappoMan
Full Member
***

Karma: 1
Offline Offline

Posts: 157



View Profile
« Reply #6 on: August 14, 2008, 12:04:41 PM »

Ok I figured out my question...

If you want to modify the "add media buttons" you need to do the following...

Code:
add_action('admin_head', 'my_media_hooks');

function my_media_hooks()
{
    // Note: Since we're in the admin_head call back, the core+mu have already done
    // all the hook tweaking they plan to do, but they haven't yet been rendered.
    // So we can now remove the mu_media_buttons and add our own hook.
    remove_action( 'media_buttons', 'mu_media_buttons' );
    add_action( 'media_buttons', 'my_media_buttons' );

    // For the sake of discussion, let's say you want to tweak the video page to show
    // some extra help or to handle URLs in a different way (trust me you don't want
    // the default behavior. Same problem here! We need to remove the existing handler
    // but you need to do it in admin_head or later.
    remove_action('media_upload_video', 'media_upload_video');
    add_action('media_upload_video', 'my_media_upload_video');
}

function my_media_buttons()
{
    ...
}

function my_media_upload_video()
{
    ...
}


The key is that you can't just tweak the hooks in a plugin, you need to wait till after the core has done all it's hook tweaking... and to do that you need to add your tweaks in a later callback... admin_head seems like a pretty good place to do it.
Logged

Yep, that's me... riding my bike 204 miles in one day.
ZappoMan
Full Member
***

Karma: 1
Offline Offline

Posts: 157



View Profile
« Reply #7 on: August 14, 2008, 12:39:44 PM »

Sorry for all the posts here... but I am still not getting this...

I have the menu buttons working...

But man, trying to get your own custom video upload page installed is really crazy... or at least I don't get it. Has anyone got this working?

The problem I'm having is that there are all these hooks... you want to add your hook, and remove the standard one... but you can remove the standard one too soon, because it doesn't exist yet.

Jeez, it's crazy...

Anyone seen a plugin that handles this?
Logged

Yep, that's me... riding my bike 204 miles in one day.
Luke
Key Master
*****

Karma: 5
Offline Offline

Posts: 3710



View Profile WWW
« Reply #8 on: August 15, 2008, 01:01:33 PM »

As a note, you do know those buttons don't really do anything special, right?

For example, if you upload a video, it doesn't embed it or anything. Maybe in the future, or something.

It might in WP, but turning them back on in MU is nothing but cosmetic and confusing.

Although, as you're onto it, you could write your own routine to insert stuff.
Logged

10 frames?
Heh, that's for Quakers.

Note: This message may be Canadian friendly.

"Pornographic monster on the floor"
ZappoMan
Full Member
***

Karma: 1
Offline Offline

Posts: 157



View Profile
« Reply #9 on: August 15, 2008, 01:20:37 PM »

Yes... I know that these buttons don't do much...

Actually, I posted a different thread on the "official" forums about how to implement the hooks needed to actually make those pages useful... but I haven't seen a useful reply yet.

The idea case is that those buttons show UI's similar to the image upload, but that are specific to the media type.

Like for video, I think it would be great if it worked similar to wp.com where it gives help to the user on how to embeded the video short code... Or for that matter, if it just let you paste in the video URL and it figures out the proper short code.

One person suggested using viper's or anarchy's media plugins, which are fine, but not exactly what I'm looking for.


Logged

Yep, that's me... riding my bike 204 miles in one day.
Luke
Key Master
*****

Karma: 5
Offline Offline

Posts: 3710



View Profile WWW
« Reply #10 on: August 15, 2008, 05:19:15 PM »

Well, it would be nice if WP just used its own shortcode to embed the content. Video, MP3 or otherwise.

It may be that that is the direction they're heading in, but who knows. Would be nice if it were.
Logged

10 frames?
Heh, that's for Quakers.

Note: This message may be Canadian friendly.

"Pornographic monster on the floor"
ron_r
Key Master
*****

Karma: 4
Offline Offline

Posts: 1145



View Profile WWW
« Reply #11 on: August 15, 2008, 07:30:16 PM »

If the shortcode was extensible via plugin that would be even sweeter.
Logged

The key to problem solving is identifying the problem.
Luke
Key Master
*****

Karma: 5
Offline Offline

Posts: 3710



View Profile WWW
« Reply #12 on: August 15, 2008, 07:33:52 PM »

Having something working would be a nice start. Smiley
Logged

10 frames?
Heh, that's for Quakers.

Note: This message may be Canadian friendly.

"Pornographic monster on the floor"
ZappoMan
Full Member
***

Karma: 1
Offline Offline

Posts: 157



View Profile
« Reply #13 on: August 15, 2008, 07:39:31 PM »

yeah... well... I was tracing through all the crazy hooks to try to replace the UI, and it really made my brain hurt... I decided it wasn't worth it when I had bigger fish to fry.

But, I think there's value in figuring out how to use the add media hooks to improve that UI...

It almost looks like the API was built, but no one really tested trying to use it to extend the interface. My first cut at adding a new handler to replace the video insert UI resulted in two copies of the UI being displayed. My UI and the "original"... the tough part is that you have to remove the old hooks and add your own... but it's not clear when you can get a callback to remove the old hooks after the hooks exist. The only callbacks I could find get called way too early, or way too late.


Logged

Yep, that's me... riding my bike 204 miles in one day.
Tags:

Pages: [1]   Go Up
  Print  
 
Jump to:  


Login
 
 
Recent Posts
Recent Topics
No new topics.
Hot Tags
Whos Online
11 Guests, 0 Users
Home Forums Contact Tags FAQ Links News Login Register