hello @infocade
Hope you are doing well today.
Forminator does have an option to disable database storage however it will not work for a specific field, when you disable it in the form setting, it will disable the storage for all fields.
I’m afraid there are any out of box options that allow to prevent storage for specific fields.
https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#data-storage
Kind Regards
Amin
Hello @wpmudev-support2 ,
thanks for the swift reply!
Yes, I see that the option available in the UI affects all data.
I’m thinking about adding some PHP-code that can do this.
Do you think that is possible?
By which attribute could I get the fields? name or ID?
Thank you!
Michael
-
This reply was modified 1 year, 4 months ago by
infocade.
Hello @infocade,
I hope things are going well for you.
You can prepare a custom PHP code with this hook forminator_custom_form_submit_before_set_fields that can help limit the field sent to the database.
Furthermore, achieving your goal will require some custom development work, which is outside our support scope.
For that, you’ll need to hire a developer. so they can provide the required custom code. WordPress provides a jobs directory here: https://jobs.wordpress.net/. If you need further advice about it, feel free to email wpsupport@incsub.com.
Subject: ATTN: WPMU DEV support - wp.org
Topic URL :- https://wordpress.org/support/topic/prevent-some-fields-from-being-stored-into-database/
–
Kind Regards,
Imran Khan
Thank you, Imran @wpmudev-support9
I consider, as a workaround, to disable the storing and store those form entry data that I need to store in a separate table that I set up on the side.
However, it seems that the data are handled in an object not an array and are not accessible with the hook forminator_custom_form_submit_before_set_fields
Can you share some information on that? Or would you recommend a different hook?
Or do you think this isn’t possible whatsoever?
Many thanks!
PS.: just to clarify
“to disable the storing”
refers to the UI-option of forminator
“store those form entry data that I need to store in a separate table”
This I want to achieve by some additional PHP-code
Hello @infocade
That is correct but you should be able to use that hook to run your custom function on submit data. you can check the plugin files to find more information about that hook, here is some info:
* Action called before setting fields to database
* @param Forminator_Form_Entry_Model $entry - the entry model.
* @param int $form_id - the form id.
* @param array $field_data_array - the entry data.
The hook is in library\modules\custom-forms\front\front-action.php:1048 file, I’m afraid I can’t share any examples since custom coding is out of scope of our support but you should be able to find more information by checking the mentioned file.
Kind Regards
Amin
Hi @infocade
We haven’t heard from you in a while, I’ll go and mark this thread as resolved. If you have any additional questions or require further help, please let us know!
Kind Regards,
Kris
Hi Kris,
yes, the issue is solved! The information on the hook was helpful. Our custom script to insert form-data into a custom table is working now! 🙂
Thank you so much!