Home Forums Newsletter Plugin Support Wrong sequence of tags and shortcodes processing in welcome message e-mail tpl

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #299706
    Anonymous
    Inactive

    Hello 😉
    I’d like to show a coupon code on the welcome page and send that coupon in the welcome e-mail as well.
    I use such shortcode in welcome message template:
    [generate_newsletter_coupon email="{email}"]
    So the subscriber’s e-mail is passed to the shortcode as attribute and everything works great.
    The same shortcode in welcome e-mail template doesn’t work as expected. The “{emial}” string is passed to the shortcode instead of an actual e-mail address.

    Is there any reason for that or is it a bug?

    #299784
    Stefano
    Keymaster

    Hi, that behavior is correct, shortcodes are executed once not per subscriber. But with this little code sample, you can add a filter to get the code executed per subscriber:

    https://github.com/TheNewsletterPlugin/newsletter-codesamples/blob/master/subscriber-coupon.php

    #299785
    Stefano
    Keymaster

    Sorry, I said the wrong thing: the shortcode should be executed per subscriber, are the shortcodes enabled on Newsletter’s main settings? If so and still they’re not executed, it means they’re not registered in the admin context… they would work on a real delivery since the delivery is executed in the “scheduler” context, but the code sample is even more “secure”.

    #299945
    Anonymous
    Inactive

    Shortocdes are enabled. I gave a try this code snippet but newsletter_message filter doesn’t seem to be triggered when the welcome email is sent. {coupon} tag string in the welcome email template is unaffected. I’ve tried to change the filter’s priority with no luck 🙁
    //edit
    newsletter_replace filter works like a charm!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.