[Plugin: Verve Meta Boxes] Issue uploading images
-
We uncovered an issue uploading images after upgrading to WP 3.3. The issue is caused by WP calling wp_update_post twice when saving a post. The first call correctly moves the uploaded file to the permanent location, but during the second call (called via _fix_attachment_links()), the file is not seen as an valid uploaded file (because is_uploaded_file() fails in wp_handle_upload()). Therefore, Verve Meta Boxes removes the meta field as it thinks the user is trying to delete the file.
Here’s the patch to fix the issue:
--- verve-meta-boxes.php.original 2011-12-16 07:02:16.000000000 -0800 +++ verve-meta-boxes.php 2011-12-16 07:04:09.000000000 -0800 @@ -587,12 +587,14 @@ /////////////////// HANDLE FILE UPLOAD and POPULATE VALUE VARIABLE $overrides = array('test_form' => false); //WHY DOES THIS NEED TO BE HERE? $image = wp_handle_upload($_FILES[$key],$overrides); - $value = $image["url"]; - if( vmb_is_empty($value) ){ - delete_post_meta($post_id, $key); - }else{ - update_post_meta($post_id, $key, $value); + if (empty($image['error'])) { + $value = $image["url"]; + if( vmb_is_empty($value) ){ + delete_post_meta($post_id, $key); + }else{ + update_post_meta($post_id, $key, $value); + } } } }
https://www.ads-software.com/extend/plugins/verve-meta-boxes/
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘[Plugin: Verve Meta Boxes] Issue uploading images’ is closed to new replies.