0

I try to store member_id/author_id for session during visit of other users. Goal: show content of a certain user without showing the id in a URL.

My testing template has the author_id in segment_2. I can get this segment_2 with stash, this outputs in the template allright. Like this:

{exp:stash:set name="sn_author" scope="user" save="yes" type="snippet"}{segment_2}{/exp:stash:set}


{if sn_author == segment_2}success{/if}

But I cannot make this work inside a regular EE entrees tag.

The EE tag outputs correct when hardcoding the desired author_id. But when I use stash get, it does not work. I understand this is a parsing order. I tried process="end" no luck.

My EE entrees tag

{exp:channel:entries channel="member_profiles" dynamic="off" author_id="{exp:stash:sn_author process="end"}"}{member_first_name} {member_last_name} {/exp:channel:entries}

I am rather new to stash, cannot get around this, and do hope for an answer here, thank you very much.

1 Answer 1

0

When you pass a tag as a parameter (any tag, not just Stash) you need to add parse="inward" to the parent tag to tell EE to parse the parameters.

{exp:stash:set name="sn_author" scope="user" save="yes"}{segment_2}{/exp:stash:set}

{exp:channel:entries channel="member_profiles" dynamic="no" author_id="{exp:stash:sn_author}" parse="inward"}
   {member_first_name} {member_last_name} 
{/exp:channel:entries}
5
  • Ehm, Mark? I accepted your answer, but I am afraid I still have problems with it, I am sorry...... The tag returns all the entrees, so author_id is not parsed inside the EE tag at all It is given allright by stash which I can see if I call it outside EE tag. Tried this on a plain template, nothing else there. Could you give me advise why this could be so?
    – Hansl
    Commented Mar 12, 2014 at 20:56
  • dynamic="no", not "off" Commented Mar 13, 2014 at 9:56
  • Thanks for coming back. No luck, result is still empty stash tag. How can I test my setup of stash? Maybe something wrong there? This is so difficult......
    – Hansl
    Commented Mar 13, 2014 at 12:53
  • Mark, could you please look one more time at my code? I am running in circles, getting nowhere. Setting this in template one: {exp:stash:set name="sn_author" scope="user" save="yes" type="snippet"}{segment_3}{/exp:stash:set} and getting in template two (=same user, same session) {exp:channel:entries channel="member_profiles" dynamic="no" author_id="{exp:stash:sn_author trim="yes" scope="user" save="yes" type="snippet"}" parse="inward"} {member_first_name} {member_last_name} {/exp:channel:entries} just gives all the names, not the one from the author. Thank you very very much....
    – Hansl
    Commented Mar 13, 2014 at 16:36
  • You set the variable to type="snippet" but were trying to access it as one would a native variable. github.com/croxton/Stash/wiki/Terminology#type I have edited my answer above to show you how to set the variable. Btw, I don't get notifications on these things so please contact me direct to bring to my attention @croxton on twitter. Commented Mar 31, 2014 at 18:33

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.