You are here

function _hashtags_index_get_comment_tags in Hashtags 7

Return a array(name => tid) list of hashtags that belongs to passed comment

Parameters

int $comment_id:

string $type:

Return value

array (name => tid)

1 call to _hashtags_index_get_comment_tags()
hashtags_comment_presave in ./hashtags.module
Implements hook_comment_presave().

File

./hashtags.module, line 581

Code

function _hashtags_index_get_comment_tags($comment_id, $type) {
  $result = db_query('SELECT hi.tid, td.name
    FROM {hashtags_index} hi
    INNER JOIN {taxonomy_term_data} td ON hi.tid = td.tid
    WHERE hi.comment_id = :comment_id AND hi.type = :type', array(
    ':comment_id' => $comment_id,
    ':type' => $type,
  ));
  $tags = array();
  foreach ($result as $data) {
    $tags[$data->name] = $data->tid;
  }
  return $tags;
}