6

I've implemented my site's structure by creating a taxonomy for "areas" and making a term for each area I want in my site (guest info, newbie, facilities, news, and admin). I've let the main menu show these terms as menu items, so that each item shows the content of the corresponding area. When I add content, I specify which area it's for, and this works quite well.

Now, though, I would like to introduce a content type for users to create (for a "user-to-user" area) and I want to hard-code this content type to a specific taxonomy term.

  • If I leave out the field for this taxonomy, no term will be assigned. :-/
  • If I include the field for this taxonomy, the user can choose a term (and put the page in any area). :-/
  • It doesn't look like term assignment is something that can be done with Actions and Triggers. :-/

Is there perhaps a module that provides control over what terms are available for a given situation (user/role/content type)? I've googled, but all I can find is acces control modules for users and nodes, not taxonomy terms.

Edit: To be clear, I'd like to EITHER programmatically set a particular term of a particular vocabulary every time a user of a particular role saves a node of a particular type (but without me having to do PHP programming); OR allow users of a particular role access to only a subset of a particular vocabulary.

Help! :-)

2 Answers 2

6

Taxonomy Access Control will let you set up the permissions at the term level.

Access control for user roles based on taxonomy categories (vocabulary, terms).

  • Automatically controls access to nodes (based on their taxonomy
    terms).
  • Configuration page for each user role.
  • Three node access permission types: View, Update, Delete.
  • Two term access types: View tag, Add tag.
7
  • This controls access to nodes based on their taxonomy terms, yes, but does it control access to the taxonomy terms?
    – KlaymenDK
    Commented Aug 3, 2011 at 11:33
  • Yes it does, terms will be restricted on the list and the user will only see the one they're allowed to while editing the node.
    – tostinni
    Commented Aug 3, 2011 at 14:02
  • Awesome, must try this!
    – KlaymenDK
    Commented Aug 3, 2011 at 21:14
  • Hum, as far as I can see, under "Permissions:Taxonomy" I can set flags for "Administer vocabularies and terms" and "Edit terms in (my vocabulary)", but there's no per-term permissions as far as I can see. Neither is it filed under "Structure:Taxonomy" ... I hope I'm wrong and just looking the wrong place?
    – KlaymenDK
    Commented Aug 3, 2011 at 22:38
  • The documentation says, "On the category permissions page for each role, ..." but I have no idea where this is? It also mentions "admin/user/permissions", but the nearest I can find is "admin/people/permissions". I hope this is not on per-user basis, although I can't seem to find that either?
    – KlaymenDK
    Commented Aug 3, 2011 at 22:49
2

I'm not aware of any modules that provide this functionality. However, you could write a pretty simple module yourself that automatically assigns the correct taxonomy term. This can be done by adding the field for taxonomy to the content type in question, but not giving users permission to edit the taxonomy terms. It sounds like only the administrator (you) is using this taxonomy vocabulary. Another option would be to simply hide the field (using CSS or other means) on the form.

Either way, use hook_nodeapi() (or hook_node_insert in Drupal 7) to set the value of the taxonomy field automatically when the new node gets created. This way you're guaranteed that each user created node has the correct taxonomy terms.

1
  • Thanks for the answer. Actually, this content type is for regular users to work with, but I do have another role (let's say "super user") of non-admins that are allowed to use this taxonomy. Worse, I'm a real Drupal newbie (Drewbie?) and although I am a programmer, I'm really not looking to dip my feet into php code land. A module, or some other plug-in solution, would be preferred, even if it would mean having to restructure my current content.
    – KlaymenDK
    Commented Jul 27, 2011 at 20:25

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.