Ouch, yes, that is the culprit - it's using an sql query to directly write the maxloggedin record, erasing the maxposters and visitors data, that's
very bad of whoever wrote it, the correct way is to use the build_datastore() function;
Try changing this line ;
PHP Code:
$db->query_write("UPDATE " . TABLE_PREFIX . "datastore SET data='" . addslashes(serialize($maxusers)) . "' WHERE title = 'maxloggedin'");
to this
PHP Code:
build_datastore('maxloggedin', serialize($vbulletin->maxloggedin));