Support » Plugin: Simple Download Monitor » Squeeze form downloads don’t seem to be recorded in sdm_downloads table

  • Resolved Tim

    (@timwakeling-1)


    We have a variety of download links using the squeeze form on this page:
    https://williamtemplefoundation.org.uk/temple-tracts/

    Unfortunately when the user clicks the button, then enters their name and email address and downloads the file, although the PDF appears correctly, no entry is added to the sdm_downloads table and the download count in the admin interface doesn’t increment.

    I’ve checked the settings and everything looks OK…
    – Hide download count is ticked
    – PHP dispatching is ticked
    – Do not capture IP is ticked
    – All other tick boxes are NOT ticked

    I ticked debug as well actually, but the log didn’t show any failures, only entries that suggested everything had worked:

    2020-04-06 10:25:00: [SUCCESS] Sqeeze form submitted. Processing submission.
    2020-04-06 10:25:00: [SUCCESS] Sqeeze form submission recorded in DB.
    2020-04-06 10:25:00: [SUCCESS] Mailchimp signup is enabled.
    2020-04-06 10:25:01: [SUCCESS] Making API call to subscribe user to list ID: 11dd9e5b9a
    2020-04-06 10:25:01: [SUCCESS] Mailchimp sign-up API query successful.

    Any idea what might be going on here? I’m fairly experienced with JS / PHP and have had a look at the code but can’t work it out…

    Thanks!

    Tim

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Tim

    (@timwakeling-1)

    Update: I have made it work by adding this to my functions.php, but couldn’t work out why the plugin wasn’t doing it…?
    `
    // Make SDM downloads log
    add_action( ‘sdm_sf_process_download_request’, ‘wt_record_download’, 10, 2 );
    function wt_record_download( $download_id, $download_link ) {

    global $wpdb;

    $table = $wpdb->prefix . ‘sdm_downloads’;
    $data = array(
    ‘post_id’ => $download_id,
    ‘post_title’ => get_the_title( $download_id ),
    ‘file_url’ => $download_link,
    ‘visitor_ip’ => ”,
    ‘date_time’ => date( ‘Y-m-d H:i:s’ ),
    ‘visitor_country’=> $visitor_country,
    ‘visitor_name’ => ”
    );

    $data = array_filter( $data ); //Remove any null values.
    $insert_table = $wpdb->insert( $table, $data );

    if ( $insert_table ) {
    //Download request was logged successfully
    } else {
    //Failed to log the download request
    wp_die( __( ‘Error! Failed to log the download request in the database table’, ‘simple-download-monitor’ ) );
    }

    }

    • This reply was modified 2 years, 5 months ago by Tim.
    Plugin Contributor mbrsolution

    (@mbrsolution)

    Hi, please use the following contact form. A developer will contact you as soon as possible.

    Thank you

    Plugin Author mra13

    (@mra13)

    The squeeze form submissions go to the admin menu of the “Squeeze form” addon. Since that addon captures some additional data which can’t be captured in my main plugin.

    Thread Starter Tim

    (@timwakeling-1)

    Thank you for the explanation!

    The Squeeze Form admin area is useful, but it doesn’t seem to show a total number of downloads for each item, which would be very helpful. The client was also confused as it wasn’t clear that the original download count would no longer be incremented as well as the squeeze form data being collected. Might be worth offering the option to do both? Anyway, my snippet does the job for this client so they are a happy bunny. šŸ™‚

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Squeeze form downloads don’t seem to be recorded in sdm_downloads table’ is closed to new replies.