Tags can be assigned to all content types
advseb - April 17, 2009 - 09:19
| Project: | Community Tags |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
Hi,
I'm using the HEAD version of the 6.x branch. I created a vocabulary and selected not all content types. However, the community_tags settings appear in the workflow sections of all content types. Also, users can tag all content types. The settings in the vocabulary are not respected.
As a work-around, I configured the tagging widget to be a block for those content types, where I don't want user tagging. I have disabled this block. However, I think this is not the right way to go.

#1
Ok, seems that it can be easily fixed. Change community_tags.module (1.37.2.5) in function community_tags_node_view($node, $inline = TRUE):
below line 457
$vid = array_shift(community_tags_vids_for_node($node));add
if (! isset($vid)) {return '';
}
Currently, I don't have access to a good diff tool, therefore we have to live with this descriptional patch :-)
#2
I'm also having this issue.
What does that fix do specifically?
Is it safer to use the block solution temporarily?
#3
The patch prevents that the tag widget is shown for all content types instead of just showing it for the content types the vocabulary is enabled for.
#4
Has anyone else successfully tested this?
#5
I found this bug in a webform where I didn't have any assigned taxonomy, but the bug comes from the view operations in community_tags_nodeapi.
Here in the hook_nodeapi is the problem, where it assigns the $node->community_tags_form's without control if this content type has taxonomy with tags or not, or even the case where if it had some taxonomy with tags and later it was removed, in this case it is not updated neither. Only if the content type had the tags form inline settings on.
So probably it would be needed some best control of the $node->community_tags_form.
Checking the tagadelic module, that is mandatory for this module, I found that on its hook_nodeapi, the $node->tags is already created
if ($op == 'load') {
$node->tags = tagadelic_node_get_terms($node);
}
So I guess that is not needed to do the same in the community tags hook_nodeapi.
In the next line is where we could add the tags and taxonomy control:
$node->community_tags_form = variable_get('community_tags_display_'. $node->type, COMMUNITY_TAGS_MODE_TAB) == COMMUNITY_TAGS_MODE_INLINE;
The tagadelic_node_get_terms($node)) function return a $tags array if it could have tags (even empty) but it doesn't return anything if there is not taxonomy with tags (NULL), this is why I have added this conditional $node->community_tags_form creation.
(I also removed and unneeded global $user in view op)