My teacher told my class about my OCD.

The professor in this situation was totally out of line and violated FERPA by giving the class personal information about you. Best case scenario, he did it to try and help you by encouraging support from other students. Worst case, he was just being an a-hole. Did the friend who texted you about it give you context as to why the professor would do that?

At this point, you have a few options, but you definitely need to let someone know what he did. You gave him medical information in confidence to explain your absences and then he told other people about it. Contact the chair of his department or go directly to the dean of your college. You can also go to your school's office of students with disabilities or even HR to ask what resources are available to you.

If we completely ignore the fact that the prof gave personal info about you to other students, though, it's important to communicate with teachers and the school about your needs. The professor should not have had to ask you why you were missing so many classes and the school can't make reasonable accommodations without knowing you have particular needs.

I do hope you're receiving some professional help to deal with your OCD, though.

Good luck!

/r/education Thread