Hi @itsmir,
Sorry to know that you are experiencing an issue.
Wouldn’t you mind sharing an export of the Formiantior form along with the ACF field groups so that we can take a closer look at the issue and help you with a workaround?
I hope the following guide comes in handy:
https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export
Please share the export file using Google Drive or Patebin.com in your next response.
We look forward to hearing back from you.
Kind Regards,
Nebu John
Thread Starter
itsmir
(@itsmir)
Hello @itsmir,
Thank you for sharing the export file. Please test it after adding the following snippet as a must use plugin:
https://gist.github.com/adczk/671c79c2ca431bbf79e4b638484c2436
– paste the code in your text editor, and change ‘mygal‘ to ‘job_images‘ on line 22. On the next line please also change 16502 to your form ID (same as in the form shortcode).
Save it as a PHP file, for example “forminator-acf-gallery-postdata-upload-map.php“, and upload to /wp-content/mu-plugins/ directory on the server.
Hope this code helps as a workaround, until the fix is implemented in the plugin. Please let us know if you have any questions.
Best Regards,
Dmytro
Thread Starter
itsmir
(@itsmir)
Thanks for the code. I’ve set it up as mu plugin and tested.
The form now errors on submission – gallery/images upload field
This field is required. Please upload a file.
and yes, there are images added to that field.
see screenshot : https://drive.google.com/file/d/1Ip310C51Uqsq1VJfSV0NlFeYSCIsdfjV/view?usp=sharing
(ignore lack of styling – just a-testing right now 😊 )
Hi @itsmir
Thanks for response!
That’s interesting actually – the added code should not affect how the field works or uploads files; it’s executed later.
I just imported your custom fields and your form to my own test setup, added suggested code and tested it and I couldn’t replicate such issue at all – it worked just fine.
I’m wondering if this is the only custom code related to that form that you are getting. Is it or is there also something else? If there is other code – what is it?
Also, in the code itself, did you correctly set ACF field name and form ID in these lines?:
$acf_fields = array( 'mygal' ); // set your ACF gallery fields names
$form_ids = array( 16502 ); // set your form IDs
Is it happening regardless of the browser you are using or in some specific one(s) only and did you try with all other plugins except Forminator and ACF (and that custom code) disabled?
Kind regards,
Adam
Thread Starter
itsmir
(@itsmir)
Did a little checking and the mu plugin works, but only for non-logged in users. I was testing whilst logged in and got the “required field” error. Tested in incognito chrome & std edge as not logged in and all is OK.
So how do we get the mu-plugin work for logged in users?
Thread Starter
itsmir
(@itsmir)
Update: if I’m logged in as me (admin) and the post-data field assigns the posts to me then the image upload error re: required field appears.
If I’m logged in as me and the post-data field assigns the posts to another user then the form submits correctly
HI @itsmir
Thanks for response!
That’s quite surprising and interesting finding, I must say.
There’s nothing in that MU plugin code that would be supposed to behave differently based on whether user is logged-in or not.
It should be the same for logged-in and logged-out users unless there’s something additional (like some other piece of custom code, or some specific setting on site that I’m missing or some other plugin) interfering.
Just to test something: if you remove the code entirely and then test submitting the same way – logged-in as you and logged-out – does it still show that error about required field or is it working fine then (I mean, the form submission itself and the upload field, not the ACF mapping because that will not work without custom code anywyay)?
Best regards,
Adam
Thread Starter
itsmir
(@itsmir)
Found a solution – unchecked the “Assign all posts to user” box in the Post-data field settings and now all users (logged in or out) can use the form with the MU plugin successfully.
I also updated ACF pro & elementor which could also have fixed something – who knows. Anyway, many thanks for your help – will mark this resolved.