This module is one of the most useful administrative tools available for Drupal 6. It would be great if it had operations available for taxonomy terms also. The ones I'm thinking of right now are:
* Delete term
* Switch vocabulary
* Set as a synonym

Comments

infojunkie’s picture

Status: Active » Postponed

Thanks for your suggestions. I'm not sure when I'll have time to work on these, because I usually focus on the core VBO functionality and only add new actions when I need them myself. In the mean time, you're welcome to contribute code, and I'd be happy to assist you.

EvanDonovan’s picture

Sounds reasonable. I can use the Actions API to add new bulk operations, correct?

infojunkie’s picture

Correct. Take a look at http://drupal.org/node/459070 for an (incomplete) intro on writing actions for VBO.

Another thing, not yet mentioned in that guide, is that VBO has a general mechanism to support classes that Views 2 supports (Nodes, Users, Comments, Terms, etc). VBO achieves this generality by relying on hook_views_bulk_operations_object_info() to supply it with relevant info about those classes. However, VBO itself only implements this hook for classes Nodes, Users and Comments. You will have to implement this hook for Terms, like so:

function hook_views_bulk_operations_object_info() {
  return array(
    'term' => array(
      'type' => 'term',
      'base_table' => 'term_data',
      'load' => 'some function to load a term object given tid',
      'title' => 'name of the attribute that contains the term name',
    ),
  );
}

Then, your actions should be declared with attribute type = 'term' because that's how you declared the type in the hook.

Hope that's not too confusing :-)

giorgio79’s picture

Evan have you made any progress on this?

I just wanted to create a term based view with Bulk Operations, because with the term node count
http://drupal.org/project/term_node_count module
it would be one of the best ways to manage a taxonomy. Maybe even better than taxonomy manager. It would be easy to find orphaned terms etc etc. by sorting on the term node count :)

I notice there is already a taxonomy.action.inc but that is for nodes, so adding, deleting etc terms related to nodes.

Should I be expanding that file if I try to do some coding?

infojunkie’s picture

@giorgio79: you can expand on taxonomy.action.inc if you wish. In any case you should attach your file here, to let me review it before committing it. If you start working on this, please set this issue to active and assigned to you. Thanks!

giorgio79’s picture

Thanks Karim.

I was looking at taxonomy.action.inc, which already has a
views_bulk_operations_taxonomy_action_info
but for operations on terms related to a node.

Do you have a preference for naming the term view related term operations sg like

views_bulk_operations_tern_action_info ?

Also, I noticed you have a delete.action.inc and a taxonomy.action.inc. Which one should contain the delete term action?
Could I get away with a delete term action in a term view just like this? (although I suspect this would not work because of the 'behavior' => array('deletes_node_property'), )

Add to delete_action.inc


// add this to function views_bulk_operations_delete_action_info() {
    'views_bulk_operations_delete_term_action' => array(
      'type' => 'term',
      'description' => t('Delete term'),
      'configurable' => FALSE,
      'behavior' => array('deletes_node_property'),
    ),
// end of  function views_bulk_operations_delete_action_info()  section


function views_bulk_operations_delete_term_action($tid) {
taxonomy_del_term($tid);
}


EvanDonovan’s picture

giorgio79:
I haven't worked on this at all since my original post. Other priorities have come up at work. If I get around to it at all, it won't be for probably a month at least. But I'd love to review anything you come up with :)

GreyHawk’s picture

I'd find this useful too -- I have a bunch of taxonomy terms and vocabularies that got loaded with incorrect node import and file settings, and need to eliminate a lot of them.

Can't seem to do it with Taxonomy Manager, and can't seem to do it with VBO (yet) -- in VBO, the lack of operations for taxonomy terms (and the complete lack of an "Operations" tab) are slowing me down.

:/

infojunkie’s picture

Status: Postponed » Fixed

@GreyHawk: are you talking about Drupal 5? The "Operations" tab was renamed to "Settings" in D5, and it has been replaced by the "Bulk Operations" settings in D6.

I added support for terms, including an action to delete terms, in the latest dev.

EvanDonovan’s picture

Excellent, thanks kratib!

GreyHawk’s picture

Ah -- Drupal 6, not 5 -- thanks for the correction, kratib.

I need to download the latest Dev version to test then; I'm using the non-dev version.

giorgio79’s picture

Wow Karim, that is massive :)

With a term VBO this module could easily beat taxonomy manager.

A few default views for terms, nodes and users would make it even easier for users to get started.

What do you think? Perhaps I could post here mine for inclusion?

I built a
manage-node
manage-term
manage-user

VBO pages for administrative tasks :)

giorgio79’s picture

Just a tip, for your VBO term view.

If you install http://drupal.org/project/term_node_count you can see how many nodes belong to a term in your view.

infojunkie’s picture

@giorgio, there's currently only one taxonomy action that I know of, namely the one to delete terms. As you said in your original report here, we need other actions such as move terms across taxonomies, make synonym, etc. Once we have those actions, we can create a HOWTO on the VBO guide to create a term administration interface.

GreyHawk’s picture

@kratib -- still not able to see or load operations for terms/vocabularies, but can see other operations. I probably need to spend more time with it.;

Re: your later note re: actions for taxonomies, I'd find it useful to delete vocabularies... (not sure about anyone else)

giorgio79’s picture

Status: Fixed » Reviewed & tested by the community

Hey Karim,

It seems term delete vbo gone missing in the latest dev release :)

It was working fine with the previous one.

infojunkie’s picture

@giorgio79: how is the "Delete term" action missing:

* Can you find it when you run an existing Term view?
* Can you find it when you edit an existing Term view?
* In delete.action.inc, are there a couple of places where you find views_bulk_operations_delete_term_action mentioned?
* In views_bulk_operations.module, function views_bulk_operations_views_bulk_operations_object_info(), can you find an entry for 'term'?

Also, please make sure you're not inadvertently using 2 copies of VBO in the same installation.

giorgio79’s picture

Status: Reviewed & tested by the community » Fixed

My apologies Karim, I was playing around with the Plugin Manager, and it overwritten my dev version with the previous stable one.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

benone’s picture

Component: Code » Core

Is this feature for term already working in VBO ?
Which version should I download ?