My humble opinion... call her pediatrician and see if there may be a medical problem?
I had the same problems with my 7yr daughter last year. I was so frustrated and didn't have a clue on how to handle it, we punished her by sending her to her room, not allowing playtime after supper etc.
Nothing worked, until I took her to see a social worker who deals with children, and had experience with exactly what we were going through. It wasn't long before we found out that she was being picked on by another girl at school, not so much as being bullied, more of being bossed around.
My daughter is very sensitive and takes alot of things to heart, she also compares her ablities to her older sister and feels that she is not good enough if she can't do the same things as her sister. She makes friends but only a couple and becomes very attached to them. In our profession we move quite often, so long story short it was a combination of the girl at school and low self-esteme, stress of moving etc. Also my husband and I are military she is well aware of whats going on and is concerned that we would have to go away.
With a lot of positive reinforcement, we sorted it out within the yr, it was tough at times but we made it.
We were told to try not to make a big deal out of it, I would ask each day after school how her day was and if there were any accidents.
Rewarding them too, worked really well, for each day she did'nt have and accident she would get a sticker to put on the calander at the end of the week we would go to the store, and buy a small toy or treat.
I am curious to see what kind of responce you get. I am having the same problem with my stepson, I think it is stress related. He acts completely different at our house than he does at his mothers house. He is an awesome kid with us, but a terror with her. UGH! I am doing research right now because of the behavior and pooping problem.