8

I would like to allow users to add new taxonomy terms, but I would like this to be verified by an administrator. The way I envision this working would have a user filling out a form which would send a notification to the specified admin; then, if the admin accepted the users request some hook or method would be triggered that would create the new taxonomy term.

Is there way to do this kind of thing with Drupal?

  • 2
    That's definitely a good idea for a new module (I am unaware of any module to offer that functionality currently). Best start is probably to screw around with hook_taxonomy_term_insert. – Paul May 9 '12 at 6:19
8
+50

Brainstorming here...now that taxonomy is part of the entity system, it should be possible to do something like this:

  1. Install http://drupal.org/project/workflow
  2. Add a field to your taxonomy called "Published" or "Approved" that is a boolean checkbox
  3. Setup a workflow that is triggered on taxonomy term creation with Approved as a field only accessible to admins
  4. Write a hook into taxonomy terms that removes a term unless it is approved (this is the tricky part - there are a lot of ways to get to taxonomy terms, so this might make this approach moot).

Alternative: Since you mentioned a user filling out a form - you could pretty easily have a content type called "Taxonomy Term" or something with the needed Taxonomy fields, then use workflow/Rules to send the submission to an admin, upon approval use Rules or custom code to create a new taxonomy term.

  • 1
    Nice idea. To address the 4th point, you could easily implement hook_taxonomy_term_view_alter(), check to see if the term is approved or not, and apply '#access' => FALSE to the render array to prevent it from being displayed. That should work system wide (except possibly for taxonomy based views that use fields instead of view modes, and don't do the extra checking). – Clive May 26 '12 at 18:10
3

I never did something like this, but my approach would be to create a "proposed taxonomy term" content type and model the logic via the Rules module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.