It sounds like you are doing all the right things. I would ask your pediatrician when you talk to him/her about the constipation. I have a hunch the constipation may play a role in this somehow, but I'd ask your doctor.
My daughter has trouble with constipation as well and we are now giving her 1/2 tsp of metamucil mixed into a beverage once a day and that has solved the problem.
You should never punish your child for potty issues as suggested by someone else. This can cause serious potty issues.
Good luck. I think you're doing all the right things and he'll get it eventually.