Bulk update of Drupal 7 taxonomy terms - drupal

My Drupal 7 site has a bit redundant taxonomy structure with taxonomy terms "Article" and "Document" being used synonymously. Hence a large number (several hundreds) of nodes has both "Article" and "Document" terms applied to them. What I want to do is to "separate" these terms shuffling nodes randomly between them so about half of the nodes currently marked "Article" and "Document" will only have "Article" term and the other half will only be marked "Document".
What's the best way to go about this? Is there a module for bulk updating nodes adding/removing taxonomy terms? Am I better off with updating the database directly?
Thank you.

I found a solution for this:
I have "Administrative Views" module installed (Requires: Views, Chaos tools, Views Bulk Operations, Entity API - links are on the module page under dependencies).
From there you select the nodes you want to change and select "change value" in the "operations" dropdown and hit execute. Under "Fields for type {your nodetype}" you can click "tags" for example and enter the new value to overwrite all - or you click "Add new value(s) to Tags, instead of overwriting the existing values." and the value will be added.
It turns out adding a tag this way, there are new tags added for every updated node - so if you edit 20 nodes and add the tag "stackoverflow" there will be 20 tags called "stackoverflow" in the terms list. You may then merge the duplicates with "Term Merge" into one final term.

Since you need to update the taxonomy structure in bulk you can use - Taxonomy Manager
http://drupal.org/project/taxonomy_manager/
Which apart from other features has -
dynamic treeview
mass deleting
mass adding of new terms
moving of terms in hierarchies
You can also take a look at a similar question -
https://drupal.stackexchange.com/questions/11494/adding-taxonomy-terms-to-multiple-nodes-at-once
If nothing helps updating the database sure seems a simpler option, but use it only if you are very sure of your query, and don't forget to take a backup before.. :)

Taxonomy Manager is the a very good module for these purposes I used it myself to tag and add vocabularies to my website that has more than 100 posts. Its interface is also very intuitive and user-friendly.

Related

Drupal views: list referenced nodes except the one used as contextual filter

i have the following case: I am building a website that has information on filmmakers and their films. I have a node type for the filmmaker, with biographical content, etc and another one for the films, with a field 'author' that references one or more of the filmmakers (since one film may have been made by several of them).
I also have a views block called 'filmography' that lists all the films whose author is the filmmaker (node) the user is seeing. Setting this up with a contextual filter was quite easy.
But now I want to present in this block along with the film name, all the filmmakers that may have made the film ('author' field in the film node) and that are different from the filmmaker being viewed. Displaying all the filmmaker nodes referenced by the author field is immediate, but I want to remove the filmmaker that I am using in the contextual filter. The goal is to get something like this:
Filmmaker 1
Movie 1
Movie 2 (with Filmmaker 2)
Movie 3
I have the notion that this might be done using views php and filtering the node references returned, but I wonder if there is an easier solution for that...
Thanks
Update: I have managed to get a result using the Views Field View module, passing the list of referenced nodes (filmmakers) as a contextual filter (node ID) and then adding another contextual filter (node ID as well) as an exclusion, and getting the default value of the letter from 'node id from URL option' (that is, from filmmaker's page the filmography view is embedded in). Keeping the question open for a while to get other, possibly more efficient, alternatives.
As I read your question, the Views Field View module popped into my mind as the obvious solution (then I saw your edit). I think this will still be your best bet. Definitely avoid using php fields as that is not a good practice in general from a security standpoint. If you are concerned about efficiency/performance, then you should just use views caching setting under the advanced options. Seems like this option is always looked over.
If you are looking for alternative options, one might be to use rendered nodes as your View style instead of fields, then use Display Suite to generate additional display modes beyond "Default" and "Teaser," create a view with the filters, then use the Entity Views Attachment (EVA) module to insert a view as a display mode field. While this is certainly a robust approach, it adds a lot of processing overhead with the rendered entities, so you definitely want to cache the results of that as well.
p.s. You might get faster/more responses over at https://drupal.stackexchange.com/

How to set relationship when I create a new (custom) content to another (custom) content in Drupal

Premise: I'm new in the world of Drupal, so sorry if this is a stupid question.
What I need is to set some relationships for some new content types I created. For example, I created the "Person" content type and the "Group" content type. Using the "Relation" module I have defined the relation "is in", but now if I want to add a field for setting the relation at creation time, there are no edit widget available. The only way I found to set relationships is using the entity collector: too complicated for a user.
Example: a user creates the Person "John", and he want for him to set the relation "is in" with the Group "Drupal fans". So, during the creation of this Person he needs, for example, a select control that lets him to choose from all the groups already registered in the site.
In brief, I need to manage some entities created by me, with CRUD controls, list, etc. and I need to set some relationships from these entities.
What is the best method/ what are the best module/ how I can do this?
Try the references module: http://drupal.org/project/references
You can create an taxanomy list of your'e groups at Structure -> Taxonomy.
This list you can use in creating an field. By the creation of the field choose for "Term reference" type and then "Autocomplete term widget". Click on save and choose the Taxonomy list that you created.
Hope this is what you need!

A way to limit taxonomy exposed filter options in view with arguments in drupal

I'm building a product catalog where a particular section is displayed by views with an argument, a taxonomy id of a section.
But I also need to give user the ability to further narrow down the search by specifying the producer by choosing term in another vocabulary in the exposed filter.
I'm trying to limit the selection to terms for which nodes in a chosen section exist. Looks like the views_selective_filter and view_hacks are especially for that, but looks like out of the box neither of them takes into account the view argument. Is there a remedy or workaround?
Use Firebug or the devel_themer module to find the form ID of the form displaying those terms, then use a hook_form_alter in a custom module to intercept, and modify that form.
In the end I used views_taxonomy_selective_filter. I had to patch views module as I described in the comment in order to make it generate select options after processing arguments.

Refreshing existing nodes to pick up Automatic Nodetitles in Drupal

I have a set of existing nodes for a content type ('foo'). Since then I have installed the Automatic Nodetitles module, which has helped tremendously, since I no longer need to work hard to make standardized names for each node of that type. I have used Automatic Nodetitles in conjunction with Tokens to create an automatic title naming pattern based on Node and CCK fields. This works perfectly for any new node I create of this content types?
How do I refresh existing nodes to pick up their titles with the "Automatic Nodetitles" Drupal 6 module?
Thanks,
Had to do quite a bit of searching to find the solution, but I found it:
http://drupal.org/node/265773#comment-3055470
Specifically:
"Updating nodetitles from existing
nodes
If you set the nodetitle to be auto
generated for some content type,
existing nodes are not affected. You
can update existing nodes by going to
'admin/content/node', then filter for
your content type, mark some nodes and
choose the "Update option" "Update
automatic nodetitles"
Posted to SO for everyone's benefit. One of the "Update options" Is "update automatic nodetitles". I never would have guessed! No need for an additional module or function; it is already there (once Automatic Nodetitles is installed, of course).
You can also use Views Bulk Operations' built-in "List all content" replacement view (defaults to admin/content/node2), which will give you more flexibility in selecting/filtering nodes to update. VBO also allows you to select and perform an action on all nodes, rather than just a page at a time, like Drupal's default content listing.
Than only works well if you have a bunch of nodes, what if you have 5000?

Drupal: Display only specific NodeReferrer field in Views

I have a content type appointment with a date field that references nodes of the content type person using the Nodereference module. In the content type person I added a Nodereferrer field that shows the reverse of this references (Person -> appointments).
I now want to create a view of person nodes that shows the last appointment date of that person. I can create a View of persons with a relationship to appointments that displays all appointments, but I have no idea on how to display only the most recent one.
Any ideas on how to achieve this?
Personally I have not had much success with using views and node reference. It never seems to work out the relationships properly.
So my advice would be to write your own query. If you look here you can see a way to override the SQL generated by views, so you still get a lot of the goodness which comes with views.
By the way I would be very interest to see if there is a better answer than this
Instead of adding the Nodereferrer field to the view, try adding the Nodereferrer relationship then adding the Node title (using that relationship) as a field. You should be able to sort from newest to oldest, and then set the view to be Distinct so that only the first row for each person shows up.

Resources