I see what you are saying, but not publishing the materials is not going to solve the problem. That's because the people who are attacking the professors will just get it by some other means, like having someone attend the class.
Remember, the attackers are not a few oddballs. The are members of a vast MAGA movement that has enough member to elect the present president and that encourages this sort of behavior. And they have tons of money behind them.