The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Automatic delete entries by day, hours, minute etc...

Labels

This Discussion is public

Notifications

This only work on Linux server, or you can use same idea on Windows Server.

  1. Connecting via SSH to your server
  2. Create sql file on your server nano drop_formidable_entries.sql and save it on any location that you want. exp: /home/formidable
  3. Insert example the following queries inside the sql file:
    use wordpress;
    DELETE FROM wp_frm_items WHERE form_id=x and created_at < (NOW() - INTERVAL 1 MINUTE);

    wordpress: it's database name.
    wp_frm_items: it's table name
    form_id=x: input form id that you wanted delete entries from it.
    1 MINUTE: in this case will delete all entries from form id x older than 1 minute. You can change it into HOUR, DAY, WEEK or etc. For more value click here

  4. Save it
  5. In command line type crontab -e to add cron job into system, with following command.
    */30 * * * * /usr/bin/mysql < /home/formidable/drop_formidable_entries.sql >/dev/null 2>&1
    Here */30 mean every 30 minutes will delete entries. You can change it as you want. For crontab generator click here

    NB: If you have cPanel or Plesk you can simple create file and cron job inside cPanel or Plesk control panel. It's easy as command line.

Thanks for posting, Hozhan!

I can't wait to try this out.  Will probably get back with some questions.   I guess you need to know what country/timezone your host is in and offset this to local time?

 

@John yes if your hosting/server time are not the same as your local time.

But in my example, you don't need to know hosting/server time if you want delete older than 1 minute. If you want older than 1 hours, then you need only change 1 to 60.

Discussion closed.