plugin doesn't work with wordpress 4.3
-
I used Media Rename for une year but after updating wordpress to release 4.3 the plugin has stopped working.
Someone found a way to repair the plugin?
-
Same here, I had to disable it in order to be able to use the media library
I found a solution, in plugins/media-rename/js/scripts.js replace:
$(document).ready(function() {
$form = $(‘.wrap form’);
is_media_single = !$(‘.wp-list-table’).length;
if (!is_media_single) {
$(‘.tablenav select[name^=action]’).each(function() {
for (label in MRSettings.labels) {
$(‘option:last’, this).before( $(‘<option>’).attr(‘value’, label).text( decodeURIComponent(MRSettings.labels[label].replace(/\+/g, ‘%20’)) ) );
}
});
}
$(‘#post’).submit(process_form_submit);
$(‘.tablenav .button.action’).click(process_form_submit);
});with:
$(document).ready(function() {
$form = $(‘.wrap form’);if ($(‘.wp_attachment_holder .thumbnail’).length == 1){
is_media_single = true;
}
else{
is_media_single = false;
}if (!is_media_single) {
$(‘.tablenav select[name^=action]’).each(function() {
for (label in MRSettings.labels) {
$(‘option:last’, this).before( $(‘<option>’).attr(‘value’, label).text( decodeURIComponent(MRSettings.labels[label].replace(/\+/g, ‘%20’)) ) );
}
});
}$(‘#post’).submit(process_form_submit);
$(‘.tablenav .button.action’).click(process_form_submit);
});Hello,
I have replaced the part of the script as you have indicated, but for me it’s still not working.
For you it really works?Best regards
Yes, runs like a charm on three test sites (I’m still testing it before releasing on customers servers ^^).
This is the complete js file:(function($) { var $form, $fields, type, is_media_single, fields_count, current_field = 0; $.fn.do_rename = function() { var $field = this; $.post( ajaxurl, { action: 'media_rename', type: type, _wpnonce: $('input[name=_mr_wp_nonce]', $form).val(), new_filename: $('input', $field).val(), post_id: $('input', $field).data('post-id') }, function (response) { $('.loader', $field).hide(); if (response != '1') { $('.error', $field).text(response).css('display', 'inline-block'); } else { $('input[type=text]', $field).attr('title', $('input[type=text]', $field).val()); $('.success', $field).css('display', 'inline-block'); } if (++current_field == fields_count) { current_field = 0; if (!$form.find('.error:visible').length) { $form.submit(); } } else { $fields.eq(current_field).do_rename(); } } ); } $(document).ready(function() { $form = $('.wrap form'); if ($('.wp_attachment_holder .thumbnail').length == 1){ is_media_single = true; } else{ is_media_single = false; } if (!is_media_single) { $('.tablenav select[name^=action]').each(function() { for (label in MRSettings.labels) { $('option:last', this).before( $('<option>').attr('value', label).text( decodeURIComponent(MRSettings.labels[label].replace(/\+/g, '%20')) ) ); } }); } $('#post').submit(process_form_submit); $('.tablenav .button.action').click(process_form_submit); }); var process_form_submit = function() { type = $(this).siblings('select').length ? $(this).siblings('select').val() : 'rename'; if (!is_media_single && (type != 'rename' && type != 'rename_retitle') ) return; $fields = (is_media_single) ? $('.media-rename', $form) : $('#the-list input:checked', $form).closest('tr').find('.media-rename'); $fields = $fields.filter(function() { return $('input[type=text]', this).val() != $('input[type=text]', this).attr('title'); }); if (fields_count = $fields.length) { $fields.find('.loader, .error, .success').hide(); $fields.find('.loader').css('display', 'inline-block'); $fields.eq(current_field).do_rename(); return false; } }; })(jQuery);
I also added sanitize_file_name in class-media-rename.php but this is only required to process file name containing white spaces.
Hello,
I just copy / paste the entire js file, but for me it does not work for the moment …
Have you anything else to do?
Best regards
Hello again,
I just uninstall the plug-in and reinstall it by changing all the js file again, but it still does not work …Hello again,
Looking carefully at the edit table, I see that it states: Changing media-rename / js / scripts.js (off).
Can you m indicate how to switch to the mode (activated)?
Thank you
Send me an email at claudio_at_eurosoftlab_dot_com I’ll send you a full copy of my modified plugin so we can test it on your server.
it works, big thank you !!!
I wish you the best
Can you send me a copy as well. I just sent you an email
Hello,
crossi72 is the script editor, I suggest you contact him directly. You have his email address in his last post.
Best regards
I’d like to contact the plugin author to send him my fix, someone may tell me if is possible to contact the author?
I’m receiving lots of requests so I published my modified plugin here: https://www.eurosoftlab.com/media-rename.zip
Hope this help
C.Thanks, this fix sort of works, but it conflicts with the WPML plugin + wpml-media. So I can’t use it.
@crossi72, wonderfull job
- The topic ‘plugin doesn't work with wordpress 4.3’ is closed to new replies.