well, seems that
if ($pun_user['g_read_board'] != '0') $permitted = 1;
is executed before, so you need to combine it with
$pun_user['g_view_users'] != '0'
also there is part
$pun_user['id'] != $id
it means - you can view your own profile, but not others. I don't know how to get this in new version, so just experiment a bit, could be the same.
So as i understand, in new version by default it is not permitted to view, so it could be something like this
if ($pun_user['g_read_board'] != '0' && ($pun_user['g_view_users'] != '0' || $pun_user['id'] == $id)) $permitted = 1;
If it works, could you please modify the notes, and post them here, as i dont have this version, and am quite busy right now.