You are here

function _discussthis_get_forum in Discuss This! 6

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

\brief Read the node specific forum settings.

Load the Discuss This! data attached to the specified node.

For new nodes, load the defaults as defined in the global settings.

\param[in] $nid The node identifier, or 0 \param[in] $type The type of node

\return Array representing a discussthis_forums row

3 calls to _discussthis_get_forum()
discussthis_create_form_submit in ./discussthis.module
\brief Save the new comment.
discussthis_form_alter in ./discussthis.module
\brief hook_form_alter implementation
discussthis_link in ./discussthis.module
\brief Implementation of hook_link().

File

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

Code

function _discussthis_get_forum($nid, $type) {

  // try loading the data from the discussthis_forums table
  $sql = 'SELECT * FROM {discussthis_forums} WHERE nid = %d';
  $result = db_query($sql, $nid);
  $discussthis_forum = db_fetch_array($result);

  // create defaults if we cannot find data in the table
  if (!$discussthis_forum) {
    $discussthis_forum = array(
      'nid' => $nid,
      'forum_tid' => variable_get('discussthis_node_' . $type, 0),
    );
  }
  return $discussthis_forum;
}