You are here

function community_tags_add_tags in Community Tags 6.2

Add tags to given node, attributed to given user, for all the given terms. Other modules or plugins may call this to add tags as a consquence of some action that is not explicitly a tagging operation.

Parameters

$node: A single node object with minimal properties of {nid, type}.

$user: A single user object with minimal properties of {uid}.

$terms: An array of term objects with minimal properties of {tid, vid}.

5 calls to community_tags_add_tags()
community_tags_node_rebuild_tags_batch_process in community_tags_node/community_tags_node.batch.inc
Batch process for rebuilding missing tags from node terms.
community_tags_tag in ./community_tags.module
Perform "user tags a node" operation. This should only be called directly as a result of user tagging activity. Usually via the CT interface but may be called by other modules providing their own interface.
_community_tags_node_insert in community_tags_node/community_tags_node.module
Node has been inserted. All node terms are added to ctags attributed to the node editor.
_community_tags_node_update in community_tags_node/community_tags_node.module
Node has been updated. All terms that are not ctags are added to ctags attributed to the current user. Removed terms are removed from ctags either for all users (sync mode) or just the current user.
_community_tags_unitag_save_suggestion_as_community_tags in community_tags_unitag/community_tags_unitag.admin.inc
Because of the way Unitag works, we have to handle all instances for any suggestion Add a suggested term as a community tag to all nodes of enabled types for all users that have tagged. Delete only suggestions for nodes that have CT unitag processing…

File

./community_tags.module, line 706
Implements community tagging of nodes using a specific vocabulary for Drupal v6.x

Code

function community_tags_add_tags($node, $user, $terms) {
  foreach ($terms as $term) {
    _community_tags_add_tag($node->nid, $term->tid, $user->uid);
  }

  // invoke hooks
  module_invoke_all('community_tags_tags_added', $node, $user, $terms);
}