This happens when one user has created a new forum topic on a node by using the discuss this! link, but another user viewing the same page has not refreshed his page(which means his discuss this! link still points to ../discuss/new/{nid}), this will create a duplicate forum topic when this user clicks this link.

I fixed it by adding two lines to discussthis.module:

-------------------------------------------
/**
* Create a new forum topic for the given nid, store the correspondence in the db, and return the new topic nid
**/
function _discussthis_new_topic($nid) {
global $user;

++ $topic_nid = _discussthis_get_topic($nid);
++ if ($topic_nid) return $topic_nid;

// load the node, to get its title/details
$node = node_load(array('nid' => $nid));
$type = node_get_types('name', $node);
$tid = _discussthis_get_forum($nid, $node->type);

---------------------------------------------------------

Pretty simple, it checks for an existing forum topic for that node before creating a new one.

Comments

spiderman’s picture

Assigned: Unassigned » spiderman
Status: Active » Fixed

awesome, thanks for the fix. i've committed it here: http://drupal.org/cvs?commit=148212

aharown07’s picture

I was having that problem also in tests. Many thanks!!
Having a bit of trouble figuring out what lines you added though... and where to put them.
Can you give me line numbers?

Edit: nevermind. found it. Two new lines go after line 477 in my editor.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.