1

I cant seem to get this working on my test but does anyone know if its possible to filter a related list of entrys by author_id using the new standard relationships? or am I better off using playa?

{exp:channel:entries channel="fairs" entry_id="{active_fair}" dynamic="no"}
  {parents field="application_related_fair" author_id="{member_id}" limit="1"}
    {parents:entry_id}
  {/parents}
{/exp:channel:entries}

Im pretty sure i can do this using playa, but not sure that it works with standard relationships?

UPDATE: so i got it working when i hard code the author_id so it says something like author_id="1"

my issue now seems to be parse order/stash related

here is the full code... basically trying to set a list but within the stash member_id is coming back blank?

{if logged_in}
    {exp:stash:set_list name="active_application"  parse_tags="yes" parse_vars="yes" scope="user"}
        {exp:channel:entries channel="fairs" entry_id="{active_fair}"  dynamic="no"}
            {parents field="application_related_fair" author_id="{member_id}" limit="1" status="not Closed"}
                {stash:app_id}{parents:entry_id}{/stash:app_id}
                {stash:app_status}{parents:status}{/stash:app_status}
            {/parents}
        {/exp:channel:entries}
    {/exp:stash:set_list}
{/if}

So this full block works perfectly if i set author_id to a specific number... but if i set it to {member_id} it still outputs but its not taking the author_id filter into effect.

2
  • Can you post how you are getting this list too? – Siebird Oct 30 '13 at 16:24
  • Sure right now its just a simple {exp:stash:get_list name="active_application"} Active Application: {app_id} - {app_status} {/exp:stash:get_list} – Keith Mancuso Oct 30 '13 at 16:26
2

Thanks to Stephen and Siebird for all your help working through. I finally got it to work just using {logged_in_member_id} instead of author_id or just member_id...

Not 100% sure why this works, i guess thats parsed earlier than just member_id?

{if logged_in}
    {exp:stash:set_list name="active_application"  parse_tags="yes" parse_vars="yes"}
        {exp:channel:entries channel="fairs" entry_id="{active_fair}"  dynamic="no" parse="inward"}
            {parents field="application_related_fair" author_id="{logged_in_member_id}" limit="1" status="not Closed"}
                {stash:app_id}{parents:entry_id}{/stash:app_id}
                {stash:app_status}{parents:status}{/stash:app_status}
            {/parents}
        {/exp:channel:entries}
    {/exp:stash:set_list}
{/if}

then the block thats reading it

{exp:stash:get_list name="active_application" }
    Active Application: {app_id} | app_status:{app_status} 
{/exp:stash:get_list}
1
  • Great. I guess I need to update my understanding of {logged_in_member_id}. I was dead wrong on that one. – Stephen Callender Oct 30 '13 at 17:12
1

Looks like your missing the closing " on the author_id parameter. Also, the {parents} tag needs to be nested inside the relationship field:

{exp:channel:entries channel="fairs" entry_id="{active_fair}" dynamic="no"}
    {application_related_fair}
        {application_related_fair:parents field="application_related_fair" author_id="{member_id}"" limit="1"}
            {application_related_fair:parents:entry_id}
         {/application_related_fair:parents}
    {/application_related_fair}
{/exp:channel:entries}
5
  • Hmm your right about the typo but still having issues... not seems to be a parse order issue.. will edit question to reflect – Keith Mancuso Oct 30 '13 at 16:16
  • I would also change your stash variables names so they don't conflict with the native EE single variables. Also, the syntax formatting in your question is off. Did you update to the one I provided? – Siebird Oct 30 '13 at 16:26
  • Sure not a bad idea.. same outcome tho... again outputs perfectly when i hardcode author_id. When its set to {member_id} it still outputs but not taking the author_id filter into effect. – Keith Mancuso Oct 30 '13 at 16:28
  • In your stash:get_list, what happens when you add the parameter process="end" to change when the data is retrieved – Siebird Oct 30 '13 at 16:32
  • hmm thought that might work, but same results...hmmm – Keith Mancuso Oct 30 '13 at 16:34
1

UPDATE 2 - use a stash embed

{exp:stash:set parse_tags="yes" scope="user"}
  {stash:mem-id}{member_id}{/stash:mem-id}
{/exp:stash:set}

{if logged_in}
  {exp:stash:set_list name="active_application" parse_tags="yes" scope="user"}
    {stash:embed:path-to:template parse_stage="both" process="start"}
  {/exp:stash:set_list}
{/if}

In path-to/template

{exp:channel:entries channel="fairs" entry_id="{active_fair}" dynamic="no"}
  {parents field="application_related_fair" author_id="{stash:mem-id}" limit="1" status="not Closed"}
    {stash:app_id}{parents:entry_id}{/stash:app_id}
    {stash:app_status}{parents:status}{/stash:app_status}
  {/parents}
{/exp:channel:entries}

 


UPDATE

Ah, I think I read your question incorrectly. Does using {author_id} instead of {member_id} work?  


ORIGINAL

{member_id} is not available inside of the exp:channel:entries tag pair because the tag pair is already parsing member data associated with the entry. {logged_in_member_id} will not work either. (ref).

You should be able to use Stash (or even a basic snippet) to set the {member_id} outside of the channel entries loop first.

{exp:stash:set name="mem-id" scope="user"}{member_id}{/exp:stash:set}

{exp:channel:entries channel="fairs" entry_id="{active_fair}" dynamic="no"}
    {application_related_fair}
        {application_related_fair:parents field="application_related_fair" author_id="{exp:stash:get name='mem-id'}" limit="1"}
            {application_related_fair:parents:entry_id}
         {/application_related_fair:parents}
    {/application_related_fair}
{/exp:channel:entries}
6
  • hmm yea i tried something like that too but no luck... still not passing properly? – Keith Mancuso Oct 30 '13 at 16:40
  • Are you trying to show entries from the FAIR channel be the logged in user? – Stephen Callender Oct 30 '13 at 16:41
  • no from the application channel..so one user might have applications from any number of fairs, so im trying to show all their application from the specific fair page they are looking at. – Keith Mancuso Oct 30 '13 at 16:43
  • Do you need the parse_vars parameter in the stash:set to parse the {member_id} variable. I've never used stash (yet), so just trying solutions – Siebird Oct 30 '13 at 16:51
  • No, you shouldn't. But give it a try. :) Also, if you use parse_tag="yes" you don't need parse_vars – Stephen Callender Oct 30 '13 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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