A restraining order preventing the mayor from coming within 100 yards of a student was issued just days after the graduation ceremony.