This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
Turn off form entries
Started 12 years ago by joshualowery | 13 posts |
-
Hello,
My client is requesting sensitive information from the user and only wants the information emailed to them. Is it possible to receive a submission from the user, send that information to an email address, but not have the information stored in the database? Or is it possible to auto-delete entries from the database using a cron (so I could delete them every 5 minutes or so).
Thank you very much for the assistance,
JoshPosted 12 years ago # -
Hi Josh,
It is possible to delete the entry immediately after the email being sent.
Do you need to do this for all of your forms or just few of them?MachForm Founder
Posted 12 years ago # -
Just a few of them.
Posted 12 years ago # -
Ok, you'll need to edit "includes/post-functions.php" file for this.
Let say you need to disable the entries for forms with these id numbers: 3, 5, 9, 15Then search around line 1217 and you'll find this code:
$process_result['status'] = true;
exactly below that line, add this block of code:
if(in_array($form_id,array(3,5,9,15))){ do_query("delete from ap_form_{$form_id}"); }
that should do it.
MachForm Founder
Posted 12 years ago # -
hmm, that doesn't seem to work. Here is the code that I have in that file.
//this function handle password submission and general form submission if(isset($input['password'])){ //if there is password input, do validation $query = "select count(form_id) valid_password from <code>ap_forms</code> where form_password='{$input['password']}'"; $result = do_query($query); $row = do_fetch_result($result); if(!empty($row['valid_password'])){ $process_result['status'] = true; //LINES 1211-1213 ARE CUSTOM AND KEEP ENTRIES FROM BEING RECORDED IN THE DATABASE if(in_array($form_id,array(1,2,3,4,5))){ do_query("delete from ap_form_{$form_id}"); } $_SESSION['user_authenticated'] = $form_id; }else{ $process_result['status'] = false; $process_result['custom_error'] = $lang['form_pass_invalid']; } return $process_result; }
I verified that the file uploaded correctly and deleted all entries for form #3. Then I filled out form #3. I received an email with the information and the form was logged as normal in the database.
Posted 12 years ago # -
Ah.. it seems you have it on the wrong line. It should be around line 1217.
The block of code is like this://if there is any error message or elements, send false as status if(empty($error_elements) && empty($process_result['custom_error'])){ $process_result['status'] = true; //PUT CUSTOM CODE HERE...... //if 'form review' enabled, send review_id if(!empty($form_review)){ $process_result['review_id'] = $record_insert_id; } }else{ $process_result['status'] = false; }
MachForm Founder
Posted 12 years ago # -
Works perfectly! Thanks so much for the assistance!
Posted 12 years ago # -
I need to implement this on 3.4, but I am unable to locate the location mentioned above. Is this still possible in 3.4?
Posted 11 years ago # -
There are slight changes within v3.4 and the code is different, depend on your form.
1) are you using single page or multipage form?
2) is your form having "review" enabled or not?MachForm Founder
Posted 11 years ago # -
Yuniar, please consider building this functionality into Machform as a new feature. I can see that it might be useful for some applications at the community college where I work. It is marvelous that you provide so much help in customizing Machform at the code level, but after my experience of having to update from a heavily customized Machform 2 to 3, I am very reluctant to do any more customization directly to the code.
Posted 11 years ago # -
Hi, I agree that this feature could be added in the next version.
In the meantime Yuniar, I would need to optionally disable saving entries to db in version 3.4 with:
- single page form;
- having "review" disabled;Thank you very much!
Posted 11 years ago # -
Giorgio -- If you are using v3.4, having single page form and having review disabled, you can edit your "includes/post-functions.php" file. Search around line 2561 for this code:
if(empty($error_elements) && empty($process_result['custom_error'])){ $process_result['status'] = true;
exactly below that code, add this code:
https://gist.github.com/anonymous/bdc43a8e896cebea057aMachForm Founder
Posted 11 years ago # -
Yuniar, we will be implementing this on both single and multipage forms.
Thanks for all of the updates in 3.4. They have been great!
Posted 11 years ago #
Reply
You must log in to post.