We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

display list of members along with related entries that uses Members fieldtype

How Do I?

Susan Wohlgemuth's avatar
Susan Wohlgemuth
5 posts
10 months ago
Susan Wohlgemuth's avatar Susan Wohlgemuth

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.

       
Rob Allen's avatar
Rob Allen
3,105 posts
10 months ago
Rob Allen's avatar Rob Allen

I’ve not used the Members fieldtype yet but here’s a couple of things to check:

  1. 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>

  2. In the embed template take out the conditional to test whether the boats entries are being generated, e.g.

{selected_member}
  {title}
{/selected_member}
  1. Long shot but have you tried using the embedded entries tag search parameter:
{exp:channel:entries channel="boats" status="not closed" dynamic="no" search:selected_member="{embed:member_id}"}
   {title}
{/exp:channel:entries}
       
Susan Wohlgemuth's avatar
Susan Wohlgemuth
5 posts
10 months ago
Susan Wohlgemuth's avatar Susan Wohlgemuth

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.

       
Susan Wohlgemuth's avatar
Susan Wohlgemuth
5 posts
10 months ago
Susan Wohlgemuth's avatar Susan Wohlgemuth

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}
       
Rob Allen's avatar
Rob Allen
3,105 posts
10 months ago
Rob Allen's avatar Rob Allen

Are your members “authors” of their own boats entries?

       
Susan Wohlgemuth's avatar
Susan Wohlgemuth
5 posts
10 months ago
Susan Wohlgemuth's avatar Susan Wohlgemuth

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}
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.