Detecting user privileges?

Is there a way to detect if ativity is running in student or teacher mode?

Not sure what you mean. If you have to log in to do an activity, then you’re in student mode. Teacher mode is just clicking preview, and will say “Student Screen Preview” in the upper left.

I want to be able to check if student is running activity or teacher and to unhide some data for teacher.
Basically I want to create activities that I could modify for different classes and let teacher to check activity before publish. This way I will not have to change a main boolean to show or hide some data.
It seems easier if activity could check if username is student and then hide extra data.

You can just share your activity link with a teacher, and they can go into preview mode, which let’s them see teacher tips and whatnot. If you make updates to your activity, they will see those updates (unless they’ve made a copy).