Ok. Going to try and explain this as best as I can, so bare with me. Anyway, I’m trying to include the default media uploader as a part of my plugin.
Currently, I’ve successfully managed to use the filter attachment_fields_to_edit
to hide most of the input fields, leaving only the title & alternate text fields, alongside a custom submit button. When clicked, this button gets the images URL and places it into a div
on the parent page.
Anyway, so here is my problem. Everything regarding the uploader itself is functioning how I want it to, but currently the filter is applying itself to the media uploader in posts, pages, the media library, etc. I only want the alternative fields & custom button to show within my plugin, but not elsewhere.
I’ve tried everything, but I cannot get it to work. I managed to apply my own query to the media-upload.php URL, and that way I could make the alternative fields only show within my plugin on the thickbox ‘library’ tab, but when uploading a new image the default fields were showing because WordPress uses an alternative file to upload the image; async-upload.php.
Here is the entire function: http://pastebin.com/5vpecMvL
Just some information on the various functions: riva_slider_pro_info()
is a function that returns an array of values. riva_slider_pro_uri( $search )
gets $_SERVER[ ‘REQUEST_URI’ ] and stores it in a variable, search its for the $search parameter and return true or false.
In the ‘libary’ tab within the media uploader thickbox, it is returning true
because I have passed a additional query onto the media-upload.php URL (for example, ‘media-upload.php?post_id=0$slideshow=true&type=image&TB_iframe=1’). BUT, it is returning false
after the user has just uploaded a new image within the same thickbox, because it uses the async-upload.php file instead. Not sure how I could pass the query onto this URL, if it would be possible to make it work that way.
I realise this may be hard to follow, but I’ve tried my best to explain it. I’m literally pulling my hair out over this one and spent a ridiculous amount of time trying to figure it out. Appreciate any comments or suggestions, or ideally a solution! Thanks in advance.
what i ended up doing was launching the thickbox uploaded manually via a jquery click event. then with setInterval i was able to hide the pieces i wanted.
jQuery(document).ready(function($) {