WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Terrence LP
    Member
    Posted 9 months ago #

    Hello,

    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.

    http://wordpress.org/plugins/download-monitor/

  2. Terrence LP
    Member
    Posted 9 months ago #

    Here is what I did - hit the DB ~!

    <?php
    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
    Member
    Posted 9 months ago #

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

    <?php
    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
    Member
    Posted 9 months 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
    Member
    Posted 9 months 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.

Reply

You must log in to post.

About this Plugin

About this Topic