I am having an issue getting a dynamic field to populate a parameter inside a tag. From what I have read it is because of parsing order.

Specifically I am try to force a subscription via DevDemon Subscriptions plugin to start the bill cycle on a specific day of the next month. There is a parameter called "next_billing_date" which will force this, but since it is a parameter, I would have to change this manually every month, I cant seem to use javascript or php or other methods to calculate this date.

things I have tried:

  • embedded templates and javascript using moment.js or php like datediff to calculate the difference and output a new date, which works to get the date, but when embedded it only spits out the code and doesnt parse the script/php and fails.
  • {next_date format="%Y-%m-01"} -This actually works but will only work on the 1st day of the month (i.e. if someone subscribed on 2016-04-12 it will put out 2016-05-01, great, but if I wanted to renew on the 15th of the month using {next_date format="%Y-%m-15"} and someone subscribed on 2016-04-12 it would output 2016-05-15, meaning they would miss the next billing period.

Any ideas?

1 Answer 1


If I understood correctly on the first point, you calculated the proper date and passed it as an embed variable to an embedded template that has the DevDemon Subscription module code within it. But DevDemon Subscriptions doesn't like being inside an embed and is throwing errors? Javascript wouldn't work within the template as that's client-side code and EE parses the template server-side. I don't know about DevDemon Subscriptions throwing errors but here is what I would try:

Outer template: <-- You'll have to enable PHP on that page (and any parent template that the PHP code may be snippet/embed of) and set PHP Parsing Stage to Input

<?php $calc_date = calculate new date using PHP ?>
{embed="includes/dd_subs" next_bd="<?=$calc_date; ?>"}

Embed Template

{exp:subs:subscribe next_billing_date="{embed:next_bd}" register_member="yes" plan="{segment_3}" payment_method="stripe" return="/account/subscription/%SUBS_HASH%"}

<h1>Subscribe to: {subs:plan:label}</h1>
    Every <strong>{subs:plan:recurring_interval_count} {subs:plan:recurring_interval}</strong> {subs:plan:recurring_amount} {subs:plan:currency}

{if subs:total_errors}
<ul class="errors">

<h3>Credit Card</h3>

<label>Credit Card Number</label>
<input name="card_number" type="text" value="{subs:card_number}">

<label>Name on card</label>
<input name="card_name" type="text" value="{subs:card_name}">

<select name="card_exp_month">{subs:month_options}</select>
<select name="card_exp_year">{subs:year_options}</select>         

<label>Security Code</label>
<input name="card_cvc" type="text" value="{subs:card_cvc}" size="5">

<button type="submit">Subscribe</button>


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.