Forum Replies Created
-
AuthorPosts
-
January 11, 2023 at 10:03 PM in reply to: Multiple type file fields in cloneable groups not cloning properly #40201
Virgile Bedin
Participantme again, to give a la up and hope to my previous message, to inform you that the fix you've pushed in the last update did not really fix the problem, see my last message..
it makes the field duplicate but they keep the same temporary name, so they are not usable for upload.. as only one file gets uploaded.i pasted my fix on my last message, again : not sure it's optimal but looks like it works, and i would be glad to know what devs thinks about it, if it's not breaking anyhting elsewhere, then i'll continue using it. untille you really fix it ๐
have a nice day !
VirgilDecember 16, 2022 at 1:19 AM in reply to: Multiple type file fields in cloneable groups not cloning properly #39840Virgile Bedin
ParticipantHello,
I'm sorry to have to tell you that it doesn't exactly fix the problem, the fields get cloned, but not properly, as they are all given the same temporary name.
by the way i could use your code to find a way to fix it, and this seems to do it,
between lines 109 and 118 of js/file.js//$clone.find( '.rwmb-file-input' ).attr( 'name', inputName + '[]' ).not( ':first' ).remove(); $clone.find( '.rwmb-file-new' ).each( function() { inputName = '_file_' + rwmb.uniqid(); // need to generate a temp unique name for each new input file $( this ).find( '.rwmb-file-input' ).attr( 'name', inputName + '[]' ).not( ':first' ).remove(); $key = $( this ).siblings( '.rwmb-file-index' ); // find the nearest index_field $key.val( inputName ); // assign the new temporary name to the file_index field } ); //$key.val( inputName );but i guess that there is a little bit more refactor and cleaning to do in this function as there is still pieces of code that are maybe useless..
can you at least ask the devs if what i did is ok and doesn't risk to break anything else ?
as a result, i seem to be able to upload multiple files even when cloning multiple times befors sending the form. looks like it's working .
December 14, 2022 at 11:43 PM in reply to: Multiple type file fields in cloneable groups not cloning properly #39802Virgile Bedin
ParticipantHello, me again to up this post..
i see there was an update on metabox Groupn but nothing about my issue, and i really need it.
could you please ask devs for a quick fix?November 22, 2022 at 12:08 AM in reply to: Multiple type file fields in cloneable groups not cloning properly #39253Virgile Bedin
ParticipantHello,
thank you for you answer,
if you could give me a quick fix, however complicated it is (not scared of js and php),
so i don't have to wait the next update it would be great. I really need this functionnality for a dev, and i could'nt fix it by myself.Virgile Bedin
Participantsecurity is hard to guarantee, specially on wordpress's front end... the main rule to have in mind would be "never trust data coming from the front end".
about, resolving the issue, do you think that if i compare $config['user_id'] with wp_get_current_user() ' s ID inside your "rwmb_profile_validate" filter and return false if they don't match would do the trick ?
-
AuthorPosts