• Resolved voviet1591

    (@voviet1591)


    Hello admin mkscripts
    I’m about to create a new “Download”. But the configs don’t allow to set multiple emails. We would really like to send different emails for each downloaded items.
    can you guide me how to use this code:$message = apply_filters( ‘dae_email_message’, $message, $values, $messages[’email_content’], $file, $download_url );, what do i need to do With it, where do I copy this code.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author mkscripts

    (@mkscripts)

    Hi,

    You can read here what filters are exactly and how to use them in your code. To help you on your way, we have made the following example:

    <?php
    
    add_filter( 'dae_email_message', 'my_content_email_message', 10, 5 );
    function my_content_email_message( $message, $values, $email_content, $file, $download_url ) {
    
        if ( 'new.txt' == $file ) {
            $message = '
                <h1>This is the title</h1>
                <p>This is a paragraph...you can use a placeholder like this: {email}</p>
                <p>You can find your Free Download here: <a href="{download_url}">Example-1</a></p>
            ';
        }
    
        if ( 'old.txt' == $file ) {
            $message = '
                <h1>This is the title</h1>
                <p>This is a paragraph...</p>
                <p>You can find your Free Download here: <a href="{download_url}">Example-2</a></p>
            ';
        }
    
        return $message;
    
    }
    
    ?>

    You can add the code to your theme’s functions.php or to your custom plugin. It is recommended that you always test your code before using it on a live site.

    Kind regards,
    Team Download After Email

    Thread Starter voviet1591

    (@voviet1591)

    thank you very much , may I ask: if ( ‘new.txt’ == $file ) , ‘new.txt’ and ‘old.txt’ is it default or can I change it to any value, What is a complete and correct code for the example below, thank you

    View post on imgur.com

    • This reply was modified 3 years, 6 months ago by voviet1591.
    Plugin Author mkscripts

    (@mkscripts)

    You are welcome. To make your code complete/working, you need to replace the example file names (new.txt and old.txt) and adjust the content (HTML code) of the messages to your needs.

    Kind regards,
    Team Download After Email

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘help using this filter’ is closed to new replies.