You are here

function _discussthis_get_topic in Discuss This! 5

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

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

4 calls to _discussthis_get_topic()
discussthis_form_alter in ./discussthis.module
hook_form_alter implementation Adds per-node override forum dropdown and topic autocomplete form for node edit forms
discussthis_link in ./discussthis.module
hook_link implementation This adds the custom link to the node view
discussthis_new in ./discussthis.module
discussthis_nodeapi in ./discussthis.module
hook_nodeapi implementation This is the meat of the module. Here we add the Discuss This link which will create a new forum topic if none exists, or link to the existing one if it does. Also adds forum override dropdown on add/edit screen for users…

File

./discussthis.module, line 562

Code

function _discussthis_get_topic($nid) {

  // lookup the nid in the db table, and return it's corresponding forum topic nid, otherwise 0
  $sql = 'SELECT topic_nid FROM {discussthis} WHERE nid=%d';
  $topic = db_result(db_query($sql, $nid));
  if ($topic) {
    return $topic;
  }
  else {
    return 0;
  }
}