• Hi,

    I love the plugin and thanks for keeping it supported!

    I was wondering if it is possible to be able to delete an entry from the frontend? Right now, when a user submits the form (using Contact Form 7) the info gets displayed on a page on my website (using the cfdb-html function, which is perfect). When I’m done with the information the user submitted, instead of going through the control panel to delete the info, could I just add a ‘Delete’ button for each form submitted on the frontend?

    https://www.ads-software.com/extend/plugins/contact-form-7-to-database-extension/

Viewing 1 replies (of 1 total)
  • Hi, I created something like you said, follows the logic that i used:
    First I insert on field on wp_cf7dbplugin_submits table (status) set the default value “N”, after this, created a contact form named: anuncio. On my index page from front end, I used a sql query to get values using that both fields and listed by submit_time.
    SELECT * FROM wp_cf7dbplugin_submits WHERE status = 'N' and form_name = 'anuncio' GROUP BY submit_time DESC
    In my index.php (page that was listed all the records) I passed the values to a delete page (apagar.php) by submit_time (using id=submit_time). In page to delete (apagar.php) I used a simple sql function to delete the data by submit_time.
    So my code stayed this way:

    if ((isset($_GET['id'])) && ($_GET['id'] != "")) {
      $deleteSQL = sprintf("DELETE FROM wp_cf7dbplugin_submits WHERE submit_time=%s",
                           GetSQLValueString($_GET['id'], "text"));
    
      mysql_select_db($database_conexao, $conexao); //My mysql connection
      $Result1 = mysql_query($deleteSQL, $conexao) or die(mysql_error());//My mysql connection
    
      $deleteGoTo = "index.php"; //page to redirect after deleted
      if (isset($_SERVER['QUERY_STRING'])) {
        $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
        $deleteGoTo .= $_SERVER['QUERY_STRING'];
      }
      header(sprintf("Location: %s", $deleteGoTo));
    }

    And my link to this page: <a href="apagar.php?id=<?php echo $row_Anuncios['submit_time']; ?>">Delete</a>

    Hope this help!

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Contact Form 7 to Database Extension] Delete from Frontend’ is closed to new replies.