2

Assume two channels: Channel A and Channel B.

Say that Channel A has a relationship field type that points to Channel B. When a Member is making an entry in Channel A, is there any way to limit the relationship field's options to display only the current Member's entries in Channel B?

Right now, I am seeing ALL of Channel B's entries regardless of which Member made the entry.

5

Not with the native relationship field but you can with Playa.

| improve this answer | |
1

This will probably be too late but it is possible to do that natively.

Allow PHP on the template and set it to input on the template preferences. Then add the following query in your template. Replace 'your relationship field' with the name of your relationship field and change the channel id number to the id of the channel the entry is related to.

This will list all of the members entries from the related channel.

<select name="your_relationship_field" id="your_relationship_field">

{exp:query sql="SELECT entry_id AS rel_entry_id, title AS rel_title, (SELECT rel_child_id FROM exp_relationships WHERE rel_id = '{your_relationship_field}' LIMIT 1) AS rel_child_id FROM exp_channel_titles WHERE channel_id =1 AND author_id = <?php echo $this->EE->session->userdata('member_id'); ?>"}
        <option value="{rel_entry_id}"{if rel_child_id == rel_entry_id} selected="selected"{/if}>{rel_title}</option>

{/exp:query}
</select> 
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.