I am writing my first Drupal module and am having a little bit of a hard time wrapping my head around when I should use nodes vs storing data directly in the database. Is there any documentation I can read on this subject or does anyone have any advice on this?

I've actually already written most of the module entirely using direct database access and my own tables. I am planning on open sourcing it but I want to make sure I'm following common Drupal development standards and I think this is the most glaring error I made. So now I am trying to figure out how much I need to move from my own tables into nodes.

What started me down this path of looking a nodes is that I need to implement permissions. The module has a bunch of projects and I need to be able to control which users have access to each individual project and all the data related to it. It's not obvious to me how to do that using nodes so I was considering doing this as yet another table in the database.

  • I would read this page: drupal.org/coding-standards. Only about half of that scroll-length is the documentation, the rest is comments, so it's not so bad. I have no beef with using custom tables whenever the project calls for it, but you may be happier using custom code/tables + hook_permission() to get your permission stuff working - api.drupal.org/api/drupal/modules%21system%21system.api.php/… Nov 21, 2012 at 0:11
  • 1
    Let me extend "I have no beef" to say "I do it all the time". But don't reinvent the wheel - if what you need already exists it may be a lot less time to use it, obviously. Nov 21, 2012 at 0:15
  • Thanks, I've read that code standards page and I wish it would talk a little more about when to use nodes vs tables. I use hook_permission() to define roles such as admin vs normal user but it's not obvious to me how I can be a little more granular with it. For example I want to be able to say a specific user has access to project A and B but not C. Nov 21, 2012 at 0:49
  • Well, if that's the case, and you're using hook_menu() to define page callbacks, you can specify the access callback parameter there to point to a function of your choosing. Then in that function you can check who the current user is and decide whether you should return TRUE or FALSE. Nov 21, 2012 at 17:04

1 Answer 1


Typically Nodes are content. Permissions in a webapp are typically not content. Content is a piece of factual text, an image, an uploaded pdf.

It sounds like you want to look at the Organic Groups module.

  • Thanks. Organic Groups looks interesting. I'm not so much interested in the group home page and users collaborating or being able to control the access to the group though. So perhaps the Organic portion of OG is not really what I am looking for. It might provide a good framework to implement my own groups to control who has access to a project though. Nov 20, 2012 at 23:54
  • yes, OG is designed to be used in a facet of different ways. You dont need group pages if you dont use them. If you just want to setup permissions, you may want to look at workbench moderation module.
    – tenken
    Nov 21, 2012 at 4:40

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.