Legal Dictionary has a good overview of the subject, and references case law. "In place of parent," schools were given broad powers to control the rights, punishments, and responsiblities of their students.
By far the most common usage of in loco parentis relates to teachers and students. For hundreds of years, the English common-law concept shaped the rights and responsibilities of public school teachers: until the late nineteenth century, their legal authority over students was as broad as that of parents. Changes in U.S. education, concurrent with a broader reading by courts of the rights of students, began bringing the concept into disrepute by the 1960s. Cultural changes, however, brought a resurgence of the doctrine in the twenty-first century.
One Supreme Court ruling found that students off campus behavior could be controlled:
In dismissing a claim by a restaurant owner against a college, the Kentucky Supreme Court found that a college's duties under in loco parentis gave it the power to forbid students to patronize the restaurant (Gott v. Berea College, 156 Ky. 376, 161 S.W. 204 ).
This pretty much ended during the free speech movement, that began on college campuses like Berkeley.
the landmark Dixon v. Alabama State Board of Education, 294 F.2d 150 (5th Cir. 1961). In Dixon, the U.S. Court of Appeals for the Fifth Circuit extended DUE PROCESS rights to students at tax-supported colleges, ruling that the Constitution "requires notice and some opportunity for hearing" before students can be expelled for misconduct. After Dixon, courts largely turned to contract law for adjudicating disputes between students and their institutions.
It still isn't clear exactly how far free speech extends for students. Tinker v. Des Moines Independent Community School District found that students don't lose their First Amendment rights unless unless their speech is disruptive or infringes on the rights of others. They decided that black ARM bands to protest the Vietnam war were not disruptive. In Morse v. Frederick, a student was suspended for a banner at an off-campus event that read "BONG HiTS 4 JESUS." The court ruled in favor of the school, concluding that:
school officials did not violate the First Amendment. To do so, he made three legal determinations: first, that "school speech" doctrine should apply because Frederick's speech occurred "at a school event"; second, that the speech was "reasonably viewed as promoting illegal drug use"; and third, that a principal may legally restrict that speech—based on the three existing First Amendment school speech precedents, other Constitutional jurisprudence relating to schools, and a school's "important—indeed, perhaps compelling interest" in deterring drug use by students.
To further confuse the issue, the Third and Fourth district courts have differing rulings that the Supreme Court has decided not to hear.
In a pair of Pennsylvania cases, an appeals court upheld the right of two students to create fake MySpace profiles ridiculing their principals. Justin Layshock created a profile mocking Hickory High School principal Eric Trosch in 2005.
an eighth-grade student at Blue Mountain Middle School created a fake profile in 2007 for her principal, James McGonigle. [...] The profile claimed McGonigle liked to have sex in his office and hit on students and parents. [...] The mother, Terry Snyder, sued on her daughter’s behalf, claiming the punishment violated the First Amendment. In June 2011, the Third Circuit agreed.
The above cases seems in direct conflict with thus ruling:
Kara Kowalski, then a senior at Musselman High School in West Virginia, who created a group on MySpace in 2005. The was called “S.A.S.H.” and featured the tagline “No No Herpes, We don’t want no herpes.” Kowalski claims the group is an acronym for “Students Against Sluts Herpes,” and was designed to bring awareness to sexually transmitted diseases. Others believe it stood for “Students Against Shay’s Herpes,” referring to “Shay N.” – a fellow student at Musselman.
Kowalski ultimately received a five-day, out-of-school suspension, [...] Kowalski sued, claiming the discipline violated her right to free speech, but in July 2011 the 4th U.S. Circuit Court of Appeals upheld the punishment.