Tutorial :Drupal 6 Module Developement - Multiple Node Types, Perms & Access



Question:

I'm wondering how to declare permissions and access for more than one defined node type in a module. I'm guessing that as hook_node_info() returns the array like it does then more than one node type can be declared as part of the array but I'm stumped with regards to hook_perm() and hook_perm(). How do I separate the permissions in these hooks for each node type?


Solution:1

Take a look at my explanation in this answer to a similar question. The gist is that you do not need to declare your own node permissions, as the node module will create the 'standard' node permission set for every node you introduce automatically.

If you need additional permissions, just return them from hook_perm all at once.


Solution:2

I'd suggest creating submodules, i.e. your mymodule folder would have mymodule.module, which would depend on mymodule_type1.module and mymodule_type2.module (which could be in the same folder, or separated out into separate module folders if you prefer).


Solution:3

You might want to look into Features - a system of bundling modules, node types, permissions and other things all together into a single installable unit.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »