Boy...It seems as if I am relating to almost everyone here! Here goes. My "now" 9 year old had the same bathroom problem. It began at the age of four and didn't stop til last year! You talk about happy! I was ecstatic! I tried to link it to everything. His father and I were seperated, maybe that was it.
He wanted attention...etc, etc.
His father and I rejoined, began to think that could be it. But when it all boiled down to it (after the long talks, me even cryin, yelling at him and Shamefully spanking him for telling me "he didn't know") this is what he told me. When he was in kindergarten he went to the bathroom. It hurt really bad so he decided he wouldn't go anymore. He began to cross his legs which took me a while to catch on to, but he did it. Yep, controlled something on his own. It became so bad I was ashamed, but after educating myself more I only became ashamed of me. Your child isn't lieing. If they have been doing this for awhile, then more than likely the sphincter has become stretched and unaware of the occurance of a bowel movement. (my kid could hold it even when given barre liquid to drink), But that was because he was so constipated. Listen to your child, I wish I would have had more compassion. The next thing to go will be their socialization for fear of rejection for his/her problem.
Just in case it may be, you may want to check out sites on Encopresis. It helped me a whole lot! All the luck to you and your child.
Is this behavior a regression? That is, had he achieved good toileting habits and now has regressed? The first thing to rule out is chronic constipation; impacted bowels is the most common cause of encopresis in children who have already achieved toilet training. Be sure to have this checked with his pediatrician. The nail biting is likely a stress/tension reduction behavior. It would be prudent to have your son evaluated by a mental health clinician. The evaluation will also help you to develop some sound approaches to managing the behaviors at home.