Support » Plugin: Download Monitor » Get Last DLM id for Email Before Download Shortcode

  • Resolved Terrence LP



    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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″]

    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_relationships.download_id
    LIMIT 1″
    [email-download download_id=”<?php echo $myrows[0]->download_id; ?>” contact_form_id=”3288″]

    @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?

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Get Last DLM id for Email Before Download Shortcode’ is closed to new replies.