Putting
PHP Code:
$threadids = array();
all the way at the top of the code segment you pasted in the first post should do it.
HOWEVER!
This code gives you the exact same results and is cleaner and simpler:
PHP Code:
$datecut = ($bbuserinfo['userid'] != 0) ? $bbuserinfo['lastvisit'] : TIMENOW - (24 * 60 * 60 * 1);
$new = $DB_site->query_first("SELECT COUNT(post.postid) as posts, COUNT(DISTINCT(post.threadid)) as threads
FROM " . TABLE_PREFIX . "post AS post
WHERE dateline >= $datecut
AND visible = '1'");
Depending on the amount of data, it can be a lot faster (with lots of threads and posts) to a little bit slower (with few threads and posts on a big board nonetheless).
You may want to do some benchmarking on your own board to see which method is faster on your forums. Keep in mind that the results (speed-wise) will depend solely on how many new threads / posts there actually are in the result.
Good luck