Opened 5 years ago
Closed 5 years ago
#48668 closed defect (bug) (worksforme)
Plupload integration not working after WP update and PHP upgrade
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.2.4 |
Component: | External Libraries | Keywords: | |
Focuses: | Cc: |
Description
This is a follow-up to #27763.
Hello All,
I know this is maybe a wrong place, but I am struggling with this issue for weeks now and there's nothing I can do anymore, so I am writing this as a last resort help cry.
I have a WordPress website (a listings/directory portal) that uses a theme that I inherited and it's not updated/supported anymore (GeoTheme).
That theme was built on PHP 5.6 and it is not compatible with PHP 7+. Some time ago I went through the process of upgrading it to PHP 7.2 and I restored most of the functionality, except in the listing adding page, when you upload the images, the 'Select files' button does not trigger the images browser as it did before.
I tried countless things, but no luck so far. I thought there's gotta be someone that hit their head against this issue or have more experience with plupload and would have an idea what's wrong.
The URL with the issue is: http://www.regionad.co.uk/?ptype=post_listing&pkg=1&user_val=existing
This is an output of the configuration:
pconfig: {"runtimes":"html5,silverlight,flash,html4","browse_button":"file_infoplupload-browse-button","container":"file_infoplupload-upload-ui","drop_element":"file_infodrag-drop-area","file_data_name":"file_infoasync-upload","multiple_queues":true,"max_file_size":"2mb","url":"http://www.regionad.co.uk/wp-admin/admin-ajax.php","flash_swf_url":"http://www.regionad.co.uk/wp-includes/js/plupload/plupload.flash.swf","silverlight_xap_url":"http://www.regionad.co.uk/wp-includes/js/plupload/plupload.silverlight.xap","filters":[{"title":"Allowed Files","extensions":"jpeg,jpg,gif,png"}],"multipart":true,"urlstream_upload":true,"multi_selection":true,"multipart_params":{"_ajax_nonce":"0ed3e0658e","action":"plupload_action","imgid":"file_info"},"resize":{"width":800,"height":800,"quality":90}}
The code that I think manages plupload is (in the theme 'functions' file):
<?php if(!function_exists('gt_plupload_admin_head')) { function gt_plupload_admin_head() { // place js config array for plupload $plupload_init = array( 'runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader 'container' => 'plupload-upload-ui', // will be adjusted per uploader 'drop_element' => 'drag-drop-area', // will be adjusted per uploader 'file_data_name' => 'async-upload', // will be adjusted per uploader 'multiple_queues' => true, //'max_file_size' => wp_max_upload_size() . 'b', 'max_file_size' => gt_max_upload_size(), 'url' => admin_url('admin-ajax.php'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => 'jpeg,jpg,gif,png')), 'multipart' => true, 'urlstream_upload' => true, 'multi_selection' => false, // will be added per uploader // additional post data to send to our ajax hook 'multipart_params' => array( '_ajax_nonce' => "", // will be added per uploader 'action' => 'plupload_action', // the ajax action name 'imgid' => 0 // will be added per uploader ) ); ?> <script type="text/javascript"> var base_plupload_config=<?php echo json_encode($plupload_init); ?>; </script> <?php } }
Thank you very much for your time!
Hi @somedev123 yes, you're right this is not the best place for such questions. Sorry but will have to close the ticket as "worksforme" as this works as expected in WordPress.
Looking at the code you pasted, seems it was copied from an old version of WP. For example this line
'runtimes' => 'html5,silverlight,flash,html4'
was changed to'runtimes' => 'html5,html4'
few years ago and eventually removed.WordPress doesn't include the Flash and Silverlight binaries any more. They were meant to support multi-file uploading in old old browsers. All current browsers support that as part of HTML 5.0 now.
Sounds like there may be a js error there. Perhaps "fixing" the config to match the default WP config will help? See: https://core.trac.wordpress.org/browser/tags/5.3/src/wp-admin/includes/media.php#L2122.