I’m trying to use exp:query and it is not allowing me to use the {exp:channel:entries} tag within it.
The goal of my code:
- Pull a custom member field from the URL ({segment_3})
- Use {exp:query} to look at that custom field in the URL and find the user’s group_id
- If the group_id matches, then display the contents of {exp:channel:entries}
What’s working:
- I can get the query to recognize the custom field, and to grant permission based on group_id, and display anything NOT within the {exp:channel:entries}
What’s broken:
- Once we’ve validated group_id, I cannot get it to display the contents of {exp:channel:entries}
Interesting Note: I am using a custom field in the query ({segment_3}). If I changed this to a built-in field, like username, then the {exp:channel:entries} data displays just fine.
The broken code:
{exp:query sql="
SELECT m_field_id_3, group_id, a.member_id
FROM exp_member_data a
JOIN exp_members b
ON a.member_id=b.member_id
WHERE m_field_id_3='{segment_3}'
"}
{if group_id=='8'}
{exp:channel:entries channel='audio' category='219|220|259' rdf='off' limit='44' start_on='2012-09-01 12:00 am' show_future_entries='yes' show_expired='no' }
{title}<br>
{/exp:channel:entries}
<item>
<title>{exp:xml_encode}TEST HEADLINE{/exp:xml_encode}</title>
<description>{exp:xml_encode}THIS IS A TEST ITEM THAT IS NOT CONTAINED INSIDE EXP:CHANNEL:ENTRIES {/exp:xml_encode}</description>
</item>
{/if}
{/exp:query}Any idea?