0

Attempting to customize the list of users displayed based upon a custom field in a channel entry.

{exp:channel:entries channel="messages"}
  {exp:user:users group_id="{member_groups backspace="1"}{option_name}|{/member_groups}"}
    {email} - {group_id}
  {/exp:user:users}
{/exp:channel:entries}


The 'member_groups' custom field will output the chosen groups in this format...

group_id="7|8|9"


No matter what, I always get the logged in super admin account as a result. Is this possible with User or do I need to use a query here?

Would really prefer to not have to use an embed since I also need to this to work for sending email notifications when a new entry is posted to the messages channel.

Thanks!

  • What happens if you add parse="inward" to the channel entries tag as a parameter? – Romans-8---31-39 Aug 11 '14 at 21:30
  • Same result as before - no joy. – Danielle LeComte Aug 11 '14 at 23:15
  • What is the fieldtype of the member_groups custom field? That can make a difference. Also, did you turn on Template Debugging to see if group_id="" contains parsed and accurate data? – Solspace Aug 12 '14 at 7:44
  • The field type is a multi-select that outputs in the format mentioned above. Template debugging shows the accurate data in the users tag. – Danielle LeComte Aug 12 '14 at 12:36
0

Pretty sure this will not work unless you use an embed. That said, I am not sure why using an embed would stop email notifications from working (though I do not know how and what you intend on setting that up with). I am also assuming {member_groups} is a custom channel field?

Main template:

{exp:channel:entries channel="messages"}
  {embed="path_to/embed" member_groups="{member_groups backspace="1"}{option_name}|{/member_groups}"}
{/exp:channel:entries}

Embedded template:

  {exp:user:users group_id="{embed:member_groups}"}
    {email} - {group_id}
  {/exp:user:users}
| improve this answer | |
  • Yes, as mentioned above 'member_groups' is my custom field. Embed won't work because this also has to fit into Postmaster to send users of the chosen member groups an email notification for new entries. – Danielle LeComte Aug 11 '14 at 22:07
  • Unfortunately I have no experience with Postmaster, and don't know how it works, how it's set up, and why embeds wouldn't work. If embeds can't be used for some reason, maybe using PHP or Stash to pass the data over? It would likely be more complex, however. The goal is to circumvent parse order so that your member group ids wind up parsed before {exp:user:users} is. – Solspace Aug 12 '14 at 7:39
  • Just going to mark your answer that it won't work. Thx!! – Danielle LeComte Aug 12 '14 at 19:11

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.