When creating/editing a relationship field, there is an option where you can restrict the entries returned, based on authors.

However, is there a way to set this so that you only return the entries that is authored by the current user logged in the Control panel?


There doesn't appear to be a way to do this in the field type settings. There is a hook setup for modifying the entries retrieved relationships_display_field however the best that I can tell it is only called on edit. You could modify the ft.relationship.php file yourself and modify the results shown based on user permissions

ft.relationship.php at line 400 (approximately) add:

$can_view = ee()->session->userdata('can_view_other_entries');
$can_edit = ee()->session->userdata('can_edit_other_entries');
if ($can_view == 'n' || $can_edit == 'n') {
  • Just a reminder to be very cautious when modifying core files. If you aren't extremely familiar with EE's inner workings, it's risky to make any changes. – Jeremy Gimbel Apr 23 '14 at 3:20
  • @Jeremy Is there any way to basically "extend" it? – developarvin Apr 23 '14 at 7:46
  • I would recommend using Playa which has an option to restrict the list to entries that can be edited by the current user. If your edit permissions are limited to entries the user authored, then the Playa field will only show the entries you want. – Jeremy Gimbel Apr 23 '14 at 12:25
  • @JeremyGimbel Are you saying that the hook only works on edit and not publish? In any case, I tried utilizing that hook but even with the barest minimum code, I had problems with it. See this question that I asked. – developarvin Apr 25 '14 at 6:27
  • I really don't know much about the hook. I would imagine it works on both, but I haven't tried it. – Jeremy Gimbel Apr 25 '14 at 15:56

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.