I more or less replicate- got the ‘Call to a member function on a non-object’ error- which would then jam up defininte $batch- which would then jam up
foreach($forum_topics_count->result as $result)
{
$update_forum_topics .= "\n\tWHEN member_id = '".$result['author_id']."' THEN ".$result['count'];
// build member update in batches, no need to do the first one
if ($current_row % $batch == 0 AND $current_row != 0)
{
$update_forum_topics_array[] = $update_forum_topics;
$update_forum_topics = "UPDATE exp_members SET total_forum_topics = \nCASE";
}
Think it can be solved by just adding $PREFS to the initial global list at the top of the function:
global $DSP, $LANG, $IN, $DB, $FNS, $PREFS;
You might want to recount stats- as it’s possible they got off. Check in ‘Admin- Utilities’ for that. And I’ll put in a bug report.
Make sense?
ETA- edited the path in the error because it’s always a good idea to keep your system folder private.