aurovrata / cf7-grid-layout

A WordPress plugin extension for Contact Form 7 to design responsive grid-layout forms.
https://wordpress.org/plugins/cf7-grid-layout/
GNU General Public License v2.0
6 stars 7 forks source link

Fix a bug where file input in tabbed section were not sent as mail at… #3

Closed Birmania closed 5 years ago

Birmania commented 5 years ago

…tachment.

-Add a section in validation to take into account the $_FILES from tabbed input file. -Add a hook to add these new uploaded_files to the "attachments" part of the mail.

aurovrata commented 5 years ago

nice addition, something i had indeed overlooked. I will check these and revert back

aurovrata commented 5 years ago

Hi Birmania,

first of all thank you for taking the time to look into the code (sometimes quite complex) and making an attempt to fix this issue.

-Add a section in validation to take into account the $_FILES from tabbed input file.

so this is good a solution, I modified it slightly to ensure it also fits the other cases where fields can be array values, namely tables and tables within tabs. The code can now come after the the line if(!isset($_POST[$tag['name']])){ rather than before as you have in your file. I have already handled the case of required file fields.

Add a hook to add these new uploaded_files to the "attachments" part of the mail.

the mail attachment functionality is actually part of the backend, hooked by cf7 plugin on admin filters and actions. As such I have now moved it to the admin section of the plugin. I have also made it more generic to fit the other cases of tables and tables within tabs.

I have released this update as v2.4.0.

thank you for your PR. However, I didn't merge it as it was easier for me to copy your code contributions.

Birmania commented 5 years ago

first of all thank you for taking the time to look into the code (sometimes quite complex) and making an attempt to fix this issue.

Thank you too for maintaining this awesome plugin. I tried my best to follow your patterns. ;)

aurovrata commented 5 years ago

PS: do let me know if you get time to test it further. There are some many combinations of possible usage of this plugin that testing all these variations make it too time consuming for me, so I very much appreciate the help in ironing out these bugs.

Birmania commented 5 years ago

Gloups, I just updated the version to 2.4.0 and there is a little mistake : PHP Fatal error: Call to undefined method Cf7_Grid_Layout_Admin::field_type() in /home/nouveaucte/www/wp-content/plugins/cf7-grid-layout/admin/class-cf7-grid-layout-admin.php on line 942

The method need the field_type which was available from "self" in the previous code as it was in public.

aurovrata commented 5 years ago

dang! Ya, that's kind of silly of me. Just released a fix with v2.4.1, can you give it a try