0

I have this nodes:

enter image description here

I want to filter the nodes display based on the user logged in and the value of a specific field in the 'Document' Content Type.

How will I do that? In the picture above first node must not be displayed.

1
  • 1
    By setting roles as authenticated user in page setting section of the view.
    – developer
    Mar 13, 2017 at 10:19

1 Answer 1

1

you have to create a custom template for your nodes : node--"ContentTypeMachineName".tpl.php , then check if the use is login with : user_is_logged_in() and the value for the field inside your content type in your case document , after that you can simply use conditional statements to control the output of your template.

4
  • 1
    Thanks for giving me an idea, can you point me something that will guide me in creating custom template for nodes. I really dont have any idea in theming but I know module development. Mar 14, 2017 at 0:52
  • 1
    it's easy to do , go to your theme's template forlder create a new file and name it "node--article.tpl.php" copy the default node.tpl.php inside of it then start dumping some vars to know what you have as variables and use some functions to filter the display per user login status Mar 14, 2017 at 9:17
  • 1
    One more question. Whats the difference between node--article.tpl.php and node-article.tpl.php? Which is the right filename convention? Mar 17, 2017 at 3:13
  • 1
    node-article.tpl.php will never work no matter what you do , you have to put node--[contenttypemachinename].tpl.php for drupal to see it Mar 17, 2017 at 10:06

Your Answer

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

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