Show warning for viewing only some nodes I am developing one website where I have one content type (News). Now, some of news content type nodes is adult and must to have age confirmation popup (just warning text, accept and decline button). 

Any suggestion how to do that?
If you have registered users, you might do it with a role. This would have the benefit of not having to show this more than once.

Other than that, (this is just an idea, I haven't tried it), you could write a small module which implements hook_node_access() .

What you could do in this function is:


allow the user to view the node if there's an adult=true GET variable
disallow the user to view the node if there's an adult=false GET variable
redirect the user to your own YES/NO form when there's no adult variable in GET, appending your current path as a destination GET path, which is then used as the action target for the form, which itself uses the GET method and has an options box with the name of adult


I have no idea how easy it actually is to pull this off, but it seems quite reasonable.

Tell me whether you've done it and if it worked well, that'd be interesting.

EDIT: References you should read to accomplish this task, as you mentioned you are totally new to this.


Learn the basics about creating a new D7 module
Learn what hooks are
Learn how to create a new page with a path with the hook_menu() hook
In the callback function for hook_menu() provide the yes/no-form: Learn about the Drupal form API . Maybe get started with this tutorial on forms and complete it with the given API link.
Learn about hook_node_access() here and what to return. In this function, do what I mentioned in the list above and complete your functions.


I hope I could help you in any way, and trust me I know how hard it is to get started.