Hide for students a moodle block with css

Hide for students a moodle block with css

by Franco CB -
Number of replies: 2

Hello everyone,

I would like to know if it is possible to display or hide a block for specyfic users. For exemple, I made: #page-header {display:none} and that works good but I would like to hide "page-header" just for students and no for administrators. Could anyone help me, please? Thank you in advance.

Franco

Average of ratings: -
In reply to Franco CB

Re: Hide for students a moodle block with css

by Mark Sharp -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Depending on the block you may not need to resort to CSS. You can hide things with capabilities. Also note that "students" only exist in a course context, so if you're talking about students on the Home page, or on the dashboard, there's no simple way of detecting them.
Average of ratings: Useful (1)
In reply to Mark Sharp

Re: Hide for students a moodle block with css

by Kurt Armbruster -
Hi @Mark

I'm working with a team that has a similar question. We have a block on the main dashboard that takes a student to specific module in a course (first incomplete module, course home page, etc), and we want to hide the block in the main dashboard if a user isn't registered in the course.

In case the issue is different, I've started a specific thread for our issue in the Moodle discussion forum here: https://moodle.org/mod/forum/discuss.php?d=431236

I'd welcome any elucidation on why the main dashboard can't hide blocks based on the enrolment of a student in a specific course.