1

I am working on a view where I need to show publications (a content type) in which authors (another content type) should be active (have a specific value for one of their fields).

I am using a relationship to add the fields for the node authors, and then add a filter criteria for checking if they are active or not. It is working in a way that is not what I want. It shows all the publications which has at least one active user (and maybe some other inactive users), but I want to have the ones in which all of authors are active.

What am I getting wrong here? could you please help me?

  • Welcome to Drupal Answers! For Drupal, there is normally just one node author, even in the case the node author is changed by an administrator user. It's not clear in which way you would have a node with more authors, if you are speaking of that. – kiamlaluno Nov 28 '16 at 2:16
  • @kiamlaluno thanks! I tried to clarify this, by telling that the "authors" in my case are another extra field (A node reference). This field is referring to another content type which are the author's profile. I'm not discussing about the author of the node, rather the author of publication. The authors of a publication, e.g. a journal, could be more than one and there, my problem appears. – Alireza Amiri Nov 28 '16 at 8:40
1

Step 1

To have such a list of authors that can be referenced, you should first (repeat: first) create a view (with the Views module) to create a list of all the authors that are allowed to be selected. And the display type of such view must be an Entity Reference display.

Step 2

Your select box field (to select from a filtered list of authors) should be field that looks like so:

  • Field Name = Anything you want, eg field_authors_list.
  • Field Type = Entity Reference, using these additional settings for it:

    • Target type = node
    • Number of values = 1, though something like "unlimited may do as well (not clear to me from your question).
    • "Mode" (within "entity selection") = Views: Filter by an entity reference view. However, before you can select an appropriate view at this point (which is eligible to do so), you first need to create a view with an Entity Reference display, or add such a display to an existing view. In your case, you should select the view created in "Step 1".
    • Pick any of the other options to define this field as you see fit.

Step 3

If the list of authors you can select (after completing the previous 2 steps) is not exactly what you want, eg "you want to have the ones in which all of authors are active, whereas active means 'have a specific value for one of their fields'" (as in your question), then refine/tune the view in step 1 so that the Views results do match with what you want the list to look like.

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.