Britney Spears has been ordered to undergo random drug and alcohol tests twice a week, according to court documents in her child custody dispute.
A LA judge said Britney, 25, showed "a habitual, frequent and continuous use of controlled substances and alcohol".
The judge also ordered Britney and her ex-husband Kevin Federline to complete a parenting class.
Both parents should also not make "derogatory remarks" about each other in their children's presence and not use drink/drugs 12 hours before either is to take care of the kids.
Federline, 29, is seeking increased custody of their two young sons.
The judge also prohibits Brit and K-Fed from "using corporal punishment with the minor children and from allowing anyone else to do so."