3

I am having a little problem I cannot figure out how to solve.

I have a 3 content types:

  • campaign
  • post
  • publication

Post contains a node reference to campaign. Publication contains a node reference to post. I am making a view that lists all publication and I would like to give user an option to filter them by campaign.

However when I am making an exposed filter that allows a user to select a campaign to filter and it works just fine, but I am not able to figure out how to limit exposed filter options to campaign nodes created only by current user?

I know how to do this through code, but I'd like to figure out if this is possible to do via UI.

enter image description here

12
  • before the filter is applied, do you want to list nodes by everyone? or the current user only?
    – No Sssweat
    Aug 4, 2016 at 9:09
  • I want that filter options would be only campaigns created by current user Aug 4, 2016 at 9:22
  • understood, but before the filter happens/gets applied, is it only current user? or everyone?
    – No Sssweat
    Aug 4, 2016 at 9:24
  • The publication nodes that are shown by the view are only of current user. I added a contextual filter to deal with that, but the filter options (campaign nodes) are still by everyone. Aug 4, 2016 at 9:25
  • hmm that's odd, what did you use for contextual filter?
    – No Sssweat
    Aug 4, 2016 at 9:27

1 Answer 1

1

Either it's a bug by the references module or works as designed.

You can accomplish your goal using the Entity Reference and Views Reference Filter modules.

In Views, add relationship of Referenced Entity.

Click the +Add button and add an entity reference view.

Add relationship of Referenced Entity (this is probably already done as it clones your current view) and make field title have a relationship. Remove all other unnecessary fields, if you have them, and just leave the title (make sure you select for This entity reference (override), so it doesn't affect your page view).

In settings, checkmark ☑ content title.

enter image description here

Now go back to your page view and add your entity reference field as a filter.

2
  • DId you actually try it? I am not even seeing an exposed filter in your view. Aug 4, 2016 at 12:00
  • Yes, I did, the screen shot is from the Entity Reference view (as you can see in the top right under Displays). The expose filter is in the Page view.
    – No Sssweat
    Aug 5, 2016 at 0:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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