Filter by author?
Low,
I don't need to filter by member data, per se. I was trying to adapt something that already worked for other fitters, but authors are a new frontier.
<span>
Author:
<select name="author:partner_org_profile_bios" onchange="window.location=generateUrl(this)">
<option value="">all Organizations</option>
{exp:channel:entries channel='partner_org_bios' class='clearfix' dynamic="no" sort="asc" order_by="title"}
<option value="{author_id}">{author}</option>
{/exp:channel:entries}
</select>
</span>
This crude test produced this search log:
https://www.dropbox.com/s/tnr855qrjsl...
This filter, for example, works perfectly for searching a State. Just want the same for entry authors.
<span>
State:
<select name="search:partner_org_bio_state" onchange="window.location=generateUrl(this)">
<option value="">all states</option>
{exp:channel:entries channel='partner_org_bios' class='clearfix' dynamic="no" sort="asc" order_by="title"}
<option value="{partner_org_bio_state}">
{partner_org_bio_state}
</option>
{/exp:channel:entries}
</select>
</span>
Been a long day; hope this question makes sense!
Replies
Low 7 Nov 2019 07:25
You can currently filter by author by using the native filters:
- author_id, which would accept one or more member IDs,
- username, which would accept one or more member usernames.
If you need to filter entries by their author's member data, you'll need Low Search Members.
Paul Larson 7 Nov 2019 23:10
Low,
Thanks! I think I'm just tripping over myself with the syntax.
<select name="search:author_id">
<option value="{author_id}">{author}</option>
The search log has: search:author_id=26653 which _seems_ right. Or at least close. (26653 is the proper member id)
What am I missing?
Low 8 Nov 2019 13:31
You're trying to apply the Field Search filter's syntax to a native parameter. You can just use the name as is.
Paul Larson 8 Nov 2019 18:30
That was it. Thank you!