{exp:channel:entries channel="channel" dynamic="no" limit="10000" orderby="title" sort="asc" disable="categories|member_data|pagination"}
{if logged_in_username == "{entry_user_1 get="username"}" || logged_in_username == "{entry_user_2 get="username"}" || logged_in_username == "{entry_director_user_3 get="username"}"}
{title}, etc...
{/if}
{/exp:channel:entries}The code above will display all entries from a channel where the user logged into EE is one of the users specified in one of the entry’s CKI Member List custom fields.
This code segment executes very slowly, I’d imagine because it’s looping through every entry in the channel and then comparing three custom fields for each of them; is there any sort of way to apply the search=”” parameter to these custom fields in the entry loop? Since it’s not a “Text Input”, “Textarea”, or “Drop-down List” I’m not sure what the next step should be.
After briefly scanning the code for the CKI member list field type, the data being saved in the db is just the member_id. You could use PHP (input) in the template and pass a set of entry ids into the entries tag. Very basic example below:
field_id_x = the column name for those CKI custom field in the database.
<?php
$EE = get_instance();
$member_id = $EE->session->userdata('member_id');
$query = $EE->db->query("SELECT DISTINCT(entry_id) FROM exp_channel_data WHERE (field_id_x = $member_id OR field_id_x = $member_id OR field_id_x = $member_id)");
$entry_ids = array();
if ($query->num_rows > 0)
{
foreach ($query->result_array() as $row)
{
$entry_ids[] = $row['entry_id'];
}
}
$entry_ids = implode('|', $entry_ids);
?>
{exp:channel:entries channel="channel" entry_id="<?php echo $entry_ids; ?>" dynamic="no" limit="10000" orderby="title" sort="asc" disable="categories|member_data|pagination"}
{title}, etc...
{/exp:channel:entries}Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.