When a term is deleted while it is still assigned to a link the link is not changed to 'Unclassified'. Second the link does not show up aynmore on the Web Links page. Attempting to display the link the following error message may be displayed: Invalid group requested (287) in function weblinks_get_tree, called from _weblinks_blocks_related_block.

When editing the link by changing the Web Links term to an existing one then it appears on the Web Links page again.

Comments

jonathan1055’s picture

Title: Deleting an used taxonomy term does not change a link to 'Unclassified' » Deleting a used taxonomy term does not change a link to 'Unclassified'

Yes, there are two problems here:
(a) if the weblink node only has that one term which was deleted then the node is not shown on the main weblinks page because the group fieldset is not shown. If multiple terms are allowed then you would expect the link to still be shown in the remaining fieldset (need to check if this is the case)
(b) If the 'Related Weblinks' block is active and displayed when the node is edited then the error as mentioned above is displayed. The error is not shown when simply viewing the node, only during edit (this need more investigation)

We can implement hook_taxonomy_term_delete() to react to the deleting of a term, probably in both weblinks and weblinks_blocks modules. However I am not sure yet what needs to be done. I assume that deleting the term within Taxonomy module removes the terms from all nodes. There must be something else that Weblinks needs to do to maintain a clean database.

gstegemann’s picture

(a): that would not occur when affected weblinks nodes would be ungroupd, i.e. when term reference would be set to '- None -' as it is done/happens in D6.

(b): that could be avoided as well when all affected weblinks nodes would be ungrouped.

There must be something else that Weblinks needs to do to maintain a clean database.

Yes. Under D6 this seems to happen 'automatically', i.e. the property ->taxonomy is not set anymore when such weblinks nodes are loaded later. In D7 we have field(s) which are still bundled to the content type. And second the fields value will not be changed when the affected term will be deleted. So the required action should be to lookup the applicable term reference fiield and set its value to '0'.