Adding User Information into HTML Body Class

Adding User Information into HTML Body Class

by Silvan H. -
Number of replies: 1

Dear community,

I would like to apply some custom css based on the user accessing my site. So far, it is working on a course and category level, since I am applying my css code when certain strings are apparent in the site's body class (e.g. containing "course-2" in the attached example). 

However, I would like to apply custom css also when certain users access my site. My idea is to append user information into the body class. The ideal solution would be to append the users Email domain into the body class. Thus, the attached screenshot's body class would be extended with e.g. "email-yahoo.com" if the user is registered with a yahoo account. It does not matter at which specific location within the class the string is added. 

Also, the sole purpose is to place this information into the body class without applying any logics behind it. However, it must appear on every site within Moodle.

Does anyone have a neat solution to this?

I am grateful for every support!



Average of ratings: -