Find a refill for one of the old ‘chemical-foam’ fire extinguishers. They came in a two-part water-soluble mix.
Put ‘Part A’ in his cistern. Then put ‘Part B’ down the pan. The next time anyone flushes the loo they will be surrounded by several square metres of foam before they can reach the door