diff --git a/wp-comments-post.php b/wp-comments-post.php index 0a8df47a5..5492bc6e2 100644 --- a/wp-comments-post.php +++ b/wp-comments-post.php @@ -77,7 +77,9 @@ VALUES ('$comment_post_ID', '$author', '$email', '$url', '$user_ip', '$now', '$now_gmt', '$comment', '$approved', '$user_agent') "); -$comment_ID = $wpdb->get_var('SELECT last_insert_id()'); +$comment_ID = $wpdb->insert_id; + +do_action('comment_post', $comment_ID); if (!$approved) { wp_notify_moderator($comment_ID); @@ -87,8 +89,6 @@ if ((get_settings('comments_notify')) && ($approved)) { wp_notify_postauthor($comment_ID, 'comment'); } -do_action('comment_post', $comment_ID); - setcookie('comment_author_' . $cookiehash, stripslashes($author), time() + 30000000, COOKIEPATH); setcookie('comment_author_email_' . $cookiehash, stripslashes($email), time() + 30000000, COOKIEPATH); setcookie('comment_author_url_' . $cookiehash, stripslashes($url), time() + 30000000, COOKIEPATH);