FWIW I put this code in a plugin on both hooks and it worked in both places, both with and without 16 in the list of groups in data2.txt.
PHP Code:
$sbmemgroups2 = file_get_contents('data2.txt');
$sbusergroups = explode(",", $sbmemgroups2);
foreach($sbusergroups as $sbgroup)
{
$sbgroupint = intval($sbgroup);
if ($sbgroupint == 16)
{
$sbpaid = true;
}
}
$fp = fopen('output.txt', "w");
fwrite($fp, "sbpaid = $sbpaid");
fclose($fp);