I fixed the AJAX process by adding..
Code:
$vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "p=$id";
eval(print_standard_redirect('redirect_automerged', true, true));
at the bottom of the "if ($isdoublepost)" before the "} else".
You need to add a new phrase "redirect_automerged" too.
edit: It works but is printing the message twice.