One of my channels has a field using the members fieldtype.
I have a front end table with a member directory, and want to add a column with the titles of the entries related to each member from the Members fieldtype. My Members field is called {selected_member}. I am able to display these entries on the members profile page using channel entry tags with the member_id being the {logged_in_member_id}, but can’t figure out how to display them in a table with each member listed with it’s related entries. I’m using eeHarbor User to create the table. I think I need an embed to get the entries for the Members fieldtype, but it’s not working. Could I get some help getting this to work?
This is my table:
{exp:user:users}
<table>
<tr>
<th>Name</th>
<th>Boats</th>
</tr>
<tr>
<td>{screen_name}</td>
</td>{embed="_includes/_boats" member_id="{member_id}"} </td>
</tr>
</table>
{/exp:user:users}And then for the embedded template, I have:
{exp:channel:entries channel="boats" status="not closed" dynamic="no"}
{selected_member}
{if selected_member:member_id == "{embed:member_id}"}
{title}
{/if}
{/selected_member}
{/exp:channel:entries}Thank you.
I’ve not used the Members fieldtype yet but here’s a couple of things to check:
In the Users table add in the member_id variable just to make sure it’s being outputted, e.g. <td>{screen_name} {member_id}</td>
In the embed template take out the conditional to test whether the boats entries are being generated, e.g.
{selected_member}
{title}
{/selected_member}{exp:channel:entries channel="boats" status="not closed" dynamic="no" search:selected_member="{embed:member_id}"}
{title}
{/exp:channel:entries}Thanks for looking Rob. 1. {member_id} outputs correctly in the table 2. If I remove the conditional, all entries display for all members in the table 3. I didn’t get any results using the embedded search tag: search:selected_member=”{embed:member_id}”
I did find that I got closer using screen_name instead of member_id. The following got it to display the entries of the logged in user for every member. While using member_id instead of screen_name got no results.
{exp:channel:entries channel="boats" status="not closed" dynamic="no"}
{selected_member}
{if selected_member:screen_name == "{screen_name}"}
{title}
{/if}
{/selected_member}
{/exp:channel:entries}So far I haven’t been able to get it to output the entries of each member in the table.
The following is as close as I’ve been able to get. It works when the member list is very short (~10 members) and correctly displays the entries in a column, but when I have longer member lists, it times out. So I think Rob is correct that I should use the search parameter, but haven’t been able to get it to work using search:selected_member=”{embed:member_id}”.
If anyone has experience making a member list with a members fieldtype column for related entries, I could use some help.
`
{exp:user:users}
<table>
<tr>
<th>Name</th>
<th>Boats</th>
</tr>
<tr>
<td>{screen_name}</td>
</td>{embed="_includes/_boats" member_id="{member_id}"} </td>
</tr>
</table>
{/exp:user:users}With the include of:
{exp:channel:entries channel="boats" status="not closed" dynamic="no" member_id="{embed:member_id}" limit="100"}
{selected_member}
{if selected_member:member_id == "{embed:member_id}"}
{title}
{/if}
{/selected_member}
{/exp:channel:entries}No, they are not the authors.
I have been using the 3rd party addon GB Member Select, which works fine, but I would like to switch to the native fieldtype. The addon uses the following in the embed, and it works fast for all member lists.
{exp:gb_member_select:entries channel="boats" status="not closed" member_id="{embed:member_id}" field_name="multiple-select-field"}
{title}</br>
{/exp:gb_member_select:entries}Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.