MyBB Community Forums

Full Version: Duplicate Threads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Often times members create duplicate threads by double clicking the 'Post Thread' button. Is there any way to prevent this?
Indeed there is - I'll post a fix in a few minutes after I apply the changes
1)
ALTER TABLE `mybb_threads` ADD `posthash` TEXT NOT NULL;
^^ Replace mybb_ with your table prefix and then execute the query


2) In newthread.php around line 532, find:
 $newthread = array(
			"fid" => $fid,

and add before:

$query = $db->query("SELECT COUNT(*) FROM ".TABLE_PREFIX."threads WHERE posthash='".addslashes($mybb->input['posthash'])."'");
$queryres = mysql_fetch_row($query);
if($queryres[0] > 0)
{	
      error("Sorry, but you already submitted this thread.");
}


3) Around line 543, find:
"visible" => $visible,

and replace with:
"visible" => $visible,
"posthash" => addslashes($mybb->input['posthash'])


That should atleast stop the duplicate threads