You are here

function _discussthis_get_topic in Discuss This! 6

Same name and namespace in other branches
  1. 5 discussthis.module \_discussthis_get_topic()
  2. 7.2 discussthis.node.inc \_discussthis_get_topic()
  3. 7 discussthis.node.inc \_discussthis_get_topic()

\brief Find forum topic attached to node.

Lookup the given nid in the discussthis db table, and return the corresponding forum topic nid, otherwise return the default for this node type

\param[in] $nid The node to be checked for a topic identifier.

\return The topic nid or 0 if no topic is found

4 calls to _discussthis_get_topic()
discussthis_comment_render in ./discussthis.module
\brief Render comments.
discussthis_form_alter in ./discussthis.module
\brief hook_form_alter implementation
discussthis_link in ./discussthis.module
\brief Implementation of hook_link().
discussthis_new in ./discussthis.module
\brief User is creating a new comment.

File

./discussthis.module, line 1192
Associations discussions in forums with specific nodes

Code

function _discussthis_get_topic($nid) {
  $sql = 'SELECT topic_nid FROM {discussthis} WHERE nid = %d';
  $topic_nid = db_result(db_query($sql, $nid));
  return $topic_nid ? $topic_nid : 0;
}