You are here

function discussthis_new in Discuss This! 5

Same name and namespace in other branches
  1. 6 discussthis.module \discussthis_new()
1 string reference to 'discussthis_new'
discussthis_menu in ./discussthis.module
hook_menu implementation

File

./discussthis.module, line 489

Code

function discussthis_new($nid) {
  $node = node_load(array(
    'nid' => $nid,
  ));
  $tid = _discussthis_get_forum($nid, $node->type);
  $form['discuss-tid'] = array(
    '#type' => 'value',
    '#value' => $tid,
  );
  $form['discuss-nid'] = array(
    '#type' => 'value',
    '#value' => $nid,
  );
  $message = t('Do you want to be the first to Discuss "%item"?', array(
    '%item' => $node->title,
  ));
  $desc = t('No one has started this discussion yet. If you click Discuss This, you will be able to submit a new forum topic to discuss this %node-type', array(
    '%node-type' => $node->type,
  ));
  $topic_nid = _discussthis_get_topic($nid);
  if ($topic_nid) {
    drupal_goto('comment/reply/' . $topic_nid, null, 'comment-form');
  }
  return confirm_form($form, $message, $destination, $desc, t('Discuss This!'));
}