My DD has encopresis. She was an easy baby and is a happy-go-lucky kid (she is now 7). She has always hated stopping what she is doing to go to the bathroom. I didn't try to potty train her until she turned 3 and it was an enormous struggle. She wound up with this because she trained for pee, then would hold poop and started pooping only a couple times a week. I didn't think much of it because she never soiled in her underwear and never complained of stomach pains or anything. Around 5 1/2 she started soiling a lot and I brought her to the ped. Her colon was stretched from all the holding (they saw in an xray) so she could not longer feel when she had to go. She's been going to the Developmental Medicine Center at Children's Hospital Boston for about a year and a half, and they are just now starting to wean her off he daily miralax and exlax.
It's a long, immensely frustrating process, and apparently more common than we would think (10% of boys have it?). Change in routine, change in diet, and she'd get backed up.
The Docs at Children's got her on a schedule where there were very few surprise accidents so socially she's had no issues. Feel free to PM me if you want to talk in more detail.