I'm passing an embed variable to an email form. The email form can either send an email to one member or multiple members. If the embed variable is just one entry id, then it's an email for one member. If the ember variable is a piped list of entry ids, then it's an email for multiple members.
I'm trying to capture certain values in a Stash variable, but it's not working for me:
{exp:stash:set name="recipients"}{/exp:stash:set}
{exp:stash:set name="user_recipients"}no{/exp:stash:set}
{if {embed:advertisers_entry_id}}
{exp:channel:entries
channel="advertisers"
entry_id="{embed:advertisers_entry_id}"
}
{if {absolute_results} == 1}
{exp:stash:set name="recipients"}
{author}
{/exp:stash:set}
{if:elseif absolute_results > 1}
{exp:stash:set name="user_recipients"}yes{/exp:stash:set}
{/if}
{/exp:channel:entries}
{/if}
I've tried adding parser="inward"
to the Channel entry loop and also parse_tags="yes" parse_vars="yes"
in the Stash setters. No go.
How do I set Stash variables inside the Channel entry loop?
EDIT 1:
I wrote a test script, based on https://github.com/croxton/Stash/wiki/%7Bexp%3Astash%3Aset%7D#basic-usage:
{exp:channel:entries limit="1" disable="member_data|pagination|categories"}
{exp:stash:set name="title"}{title}{/exp:stash:set}
{/exp:channel:entries}
{exp:stash:set name="recipients"}me@domain.com{/exp:stash:set}
{exp:stash:set name="user_recipients"}no{/exp:stash:set}
<h2>title: {exp:stash:title}</h2>
<h2>recipients: {exp:stash:recipients}</h2>
<h2>user_recipients: {exp:stash:user_recipients}</h2>
{exp:stash:title}
outputs nothing. {exp:stash:recipients}
and {exp:stash:user_recipients}
outputs as expected. Does this mean that there is something about the setup of my environment that makes Stash not work as expected?
EDIT 2:
Once I have those variables set, I want to be able to use them in:
{exp:email:contact_form
charset="utf-8"
form_class="customer-email-form"
recipients="{exp:stash:recipients}"
user_recipients="{exp:stash:user_recipients}"
}
They aren't getting parsed. I have tried adding `parse="inward". No go.