Posts: 42
Threads: 6
Joined: Dec 2011
Hello everyone!
I'm using r646 RC3 and found issue with plug-in hooks.
I tried to use 'files-uploaded' back-end hook, but my function wasn't called. I didn't check other hooks, but they may be malfunctioning too.
P.S. I was trying to write a plugin, that would filter uploaded images and resize them if necessary. Is it possible to do this with 'files-uploaded' back-end hook or I should use something else?
Posts: 1,108
Threads: 70
Joined: Aug 2009
yes your right... it seems it only fires correctly when you don't use uploadify to upload the files...
I'll log it as an issue on the bug tracker....
Posts: 42
Threads: 6
Joined: Dec 2011
n00dles101 Wrote:yes your right... it seems it only fires correctly when you don't use uploadify to upload the files...
I have this issue even with uploadify turned off. If it works without uploadify, could you please let me know about version you use.
n00dles101 Wrote:I'll log it as an issue on the bug tracker....
Thanks for that.
P.S. What about my 2nd question? Will I be able to get access to uploaded file (i.e. in $_FILES array) and to modify it before saving in uploads folder using this back-end hook?
Posts: 1,108
Threads: 70
Joined: Aug 2009
sorry forgot to say the hook is actually called "file-uploaded"
I'll fix the documentation.
Once you fire the hook you should have access to the $_FILES array.
to test I added the following to a plugin
Code:
add_action('file-uploaded','file_upload', array());
function file_upload(){
echo '<script type="text/javascript">alert("file has been uplaoded");</script>';
}
Posts: 42
Threads: 6
Joined: Dec 2011
n00dles101 Wrote:sorry forgot to say the hook is actually called "file-uploaded"
Thanks, working perfectly without uploadify (access to $_FILES granted). Will be waiting for fix for uploadify.
Posts: 1,108
Threads: 70
Joined: Aug 2009
Doesn't look like its going to be easy enough..
leave it with us...
Posts: 42
Threads: 6
Joined: Dec 2011
n00dles101 Wrote:Doesn't look like its going to be easy enough..
leave it with us...
Hi!
I've just looked at the code in upload.php, sidebar-files.php and upload-uploadify.php.
Hook is firing as it should (exec_action exists and is placed where it should be), so plugin works perfectly.
As for uploadify, hook works too, but since uploadify uses AJAX all the text I try to echo in plugin will be placed in responce. And uploadify javascript doesn't handle this response text in any way, so we could not see any plugin activity unless we are using debugging.
I don't need to print something, so there's no problem for me to use this hook for my new plugin.
Thank you for quick replies and support!