You are here

function heartbeat_get_tuaid in Heartbeat 6.4

Function to get the corresponding tuaid

Parameters

Integer $uaid:

Return value

Integer $tuaid

2 calls to heartbeat_get_tuaid()
heartbeat_comments_form_submit in modules/heartbeat_comments/heartbeat_comments.module
User submitted a heartbeat comment.
heartbeat_comments_heartbeat_load in modules/heartbeat_comments/heartbeat_comments.module
Implementation of hook_heartbeat_load().

File

./heartbeat.common.inc, line 221
Commonly functions used in heartbeat

Code

function heartbeat_get_tuaid($uaid) {

  // Untranslated messages have the original activity id.
  if (!module_exists('locale')) {
    return $uaid;
  }

  // Translated messages will have the original activity id as "tuaid".
  if ($result = db_fetch_object(db_query("SELECT tuaid FROM {heartbeat_translations} WHERE uaid = %d", $uaid))) {
    return $result->tuaid;
  }
  else {
    db_query("INSERT INTO {heartbeat_translations} SET uaid = %d, tuaid = %d", $uaid, $uaid);
    return $uaid;
  }
}