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?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
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
What you could do in this function is:
adultvariable in GET, appending your current path as a
destinationGET path, which is then used as the
actiontarget for the form, which itself uses the
GETmethod and has an options box with the
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.
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.
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.