I am sorry that I can't offer any help, just a similar experience.
When MIL was in her first CH she could never find the toilet down the corridor. The staff got cross with her wandering around at night so they thought the solution was to put a commode in her room. She would get the bowl out and try to tip the contents out of the window. Since there was a security limiter on the window it would only open 4 inches. Thus the contents of the pot were spilled inside the UPV window frame, inside the radiator, down the wall, and on the carpet. She also hid pieces of poo in a vase under her bed.
We were livid at their poor management of her toileting, and the resulting embarrassment, loss of dignity, and hideous pong. In a CH, where night staff are employed, there is no excuse for lack of care at night.
What to do when you don't have carers on night duty? I just don't know. It sounds as if your MIL needs night-time toileting supervision. I can't see how you can stop her trying to empty the commode if she thinks it is dirty to leave her wee in the bowl.