Appnitro Software Forums » MachForm 2

Turn off form entries


  1. 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,
    Josh

    Posted 3 months ago #
  2. 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 3 months ago #
  3. Just a few of them.

    Posted 3 months ago #
  4. 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, 15

    Then 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 3 months ago #
  5. 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 3 months ago #
  6. 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 3 months ago #
  7. Works perfectly! Thanks so much for the assistance!

    Posted 3 months ago #

RSS feed for this topic

Reply