Hello, is it possible to enable Akismet globally for all formidable forms? For example, we have about 100 forms, I don't want to have to go into every single forms settings and select 'Use Akismet to check entries for spam for' then click update. I'd rather click one button in global settings that enables 'Use Akismet to check entries for spam for' for all forms.
Is such a thing possible? If not, can you give advice how to implement this in code please.
Formidable stores the value for the Akismet field in the wp_frm_forms options field. All form options entered on the settings page are stored in this single field as a serialized array. If you've never seen a serialized array before, here's the options value from a form in my test environment:
a:59:{s:14:"success_action";s:7:"message";s:11:"success_url";s:0:"";s:15:"success_page_id";s:0:"";s:7:"akismet";s:1:"1";s:8:"honeypot";s:5:"basic";s:8:"antispam";s:1:"1";s:11:"success_msg";s:54:"Your responses were successfully submitted. Thank you!";s:8:"edit_msg";s:39:"Your submission was successfully saved.";s:9:"draft_msg";s:26:"Your draft has been saved.";s:14:"logged_in_role";a:1:{i:0;s:0:"";}s:17:"single_entry_type";s:4:"user";s:17:"cookie_expiration";s:4:"8000";s:13:"editable_role";a:1:{i:0;s:0:"";}s:18:"open_editable_role";a:1:{i:0;s:13:"administrator";}s:11:"edit_action";s:7:"message";s:8:"edit_url";s:0:"";s:12:"edit_page_id";s:0:"";s:13:"protect_files";s:1:"0";s:13:"noindex_files";s:1:"0";s:11:"open_status";s:0:"";s:9:"open_date";s:16:"2019-01-03 22:34";s:10:"close_date";s:0:"";s:11:"max_entries";s:0:"";s:10:"closed_msg";s:53:"This form is currently closed for submissions.";s:12:"custom_style";s:1:"1";s:10:"transition";s:0:"";s:12:"submit_value";s:6:"Submit";s:10:"edit_value";s:6:"Update";s:11:"draft_label";s:10:"Save Draft";s:12:"submit_align";s:0:"";s:17:"submit_conditions";a:2:{s:9:"show_hide";s:4:"show";s:7:"any_all";s:3:"all";}s:16:"start_over_label";s:10:"Start Over";s:19:"landing_bg_image_id";s:1:"0";s:15:"landing_opacity";s:3:"100";s:14:"landing_layout";s:7:"default";s:18:"chat_progress_type";s:0:"";s:18:"chat_continue_text";s:8:"Continue";s:22:"chat_start_button_text";s:5:"Start";s:10:"form_class";s:0:"";s:11:"before_html";s:232:"[form_name]
[if form_name][form_name][/if form_name]
[if form_description][form_description][/if form_description]";s:10:"after_html";s:0:"";s:11:"submit_html";s:418:"
[if back_button][back_label][/if back_button]
[button_label]
[if save_draft][draft_label][/if save_draft]
";s:9:"show_form";i:0;s:7:"no_save";i:0;s:9:"ajax_load";i:0;s:11:"js_validate";i:0;s:10:"show_title";i:0;s:16:"show_description";i:0;s:10:"save_draft";i:0;s:4:"copy";i:0;s:12:"single_entry";i:0;s:11:"ajax_submit";i:0;s:10:"prev_value";s:8:"Previous";s:8:"rootline";s:0:"";s:19:"pagination_position";s:0:"";s:18:"rootline_titles_on";i:0;s:15:"rootline_titles";a:0:{}s:18:"rootline_lines_off";i:0;s:20:"rootline_numbers_off";i:0;}
IN order to update the Akismet setting for every form globally, you would have to create a custom PHP function that loads and unserializes this field so you can programmatically add the Akismet setting to the array. Then, reserialize the field and save it again. It's not an easy task and one that many developers would avoid. Unless you're highly skilled with PHP and MySQL functions, you'd be better off changing each form one at a time.
Please login or Register to submit your answer