Download Monitor
[resolved] Get Last DLM id for Email Before Download Shortcode (5 posts)

  1. Terrence LP
    Posted 2 years ago #


    I'm trying to dynamically fill in the download_id for the plugin Email Before Download -

    [email-download download_id="<?php echo last ID here ?>" contact_form_id="3288"]

    Should I be using the DLM shortcode or wp_query to hit the DB?

    The idea is everytime a new file is uploaded, the Email Before Download shortcode will always get the last ID from a specific Category from Download-Monitor.


  2. Terrence LP
    Posted 2 years ago #

    Here is what I did - hit the DB ~!

    global $wpdb;
    $myrows = $wpdb->get_results( "SELECT id FROM wp_download_monitor_files ORDER BY id DESC LIMIT 1" );

    [email-download download_id="<?php echo $myrows[0]->id; ?>" contact_form_id="3288"]

  3. Terrence LP
    Posted 2 years ago #

    if you need to verify the Download category ID as well - (wp prefix may be optional.)

    global $wpdb;
    $myrows = $wpdb->get_results(
    "SELECT wp_download_monitor_files.*, wp_download_monitor_relationships.*
    FROM wp_download_monitor_files, wp_download_monitor_relationships
    WHERE wp_download_monitor_files.id = wp_download_monitor_relationships.download_id
    ORDER BY wp_download_monitor_files.id DESC
    LIMIT 1"
    [email-download download_id="<?php echo $myrows[0]->download_id; ?>" contact_form_id="3288"]

  4. tanver
    Posted 2 years ago #

    @Terrence, I am also looking forward to achieve something like this where I have to change the 'download_id' to be decided what the options are as the visitor fill in the form?

    Is it possible to prepare this link after the form have been submitted?

  5. Terrence LP
    Posted 2 years ago #

    I'm not aware of being able to do that as the Email Before Download is pretty limited. My solution is pretty specific in that I'm only in need of one ID. With conditions coming from the form, you will need a more custom approach or a different plugin altogether.

    Try Exec-PHP plugin and via PHP and jQuery you can do it all in one page. Visually it can look the same but if any database update are needed, they will also have to be added.

    These three plugins are OK, but a real Download/Forms/Email plugin needs to be created from the ground up.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Download Monitor
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic