Make block available only to teachers

Re: Make block available only to teachers

by Mary Cooch -
Number of replies: 9
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

I haven't looked at the rest of this (old) thread but have you tried number 3 in Blocks FAQ ?

In reply to Mary Cooch

Re: Make block available only to teachers

by Susana L. -

Hi Mary,

I'm having again this same problem...

I want to have an html block in all moodle courses (course main page) not visible to students.

I create a block at system level to appear throught all moodle site, then, at course level, I edit the block to set that it will be displayed through all course main pages. Everything is OK. The block is displayed in all courses main page to teachers and students.

The problem is how to set it invisible to students... in assign roles>permissions, if I remove Students from the "View block" list, students can still see the block... and if I remove "Authenticated users", neither students nor teachers can see the block. What am I missing?

Thank you,
susana


In reply to Susana L.

Re: Make block available only to teachers

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

You need to create a new role and assign it system wide to the teachers and then "allow" them to see the block.

In reply to Mary Cooch

Re: Make block available only to teachers

by Susana L. -

Hi,

I think that would be the best solution if I wanted to have the block on frontpage (where a user is not a student nor a teacher). But we want to have the block on a course context. On a course context we can distinguish teachers from students... why is it not possible to allow only teachers to see the html block? (we used to do it some years ago with sticky blocks on moodle 1.9)...

Another option would be to create a new block module only to have the html information we need to have... and control visibility from the block permissions... like has_capability('moodle/course:update')... 

... but there must be a easier way to make an html block available to teachers...

Thanks,
susana


In reply to Susana L.

Re: Make block available only to teachers

by Susana L. -

I think this is a Moodle bug!!...

Because the block was created on system level, Moodle does not recognise teacher and student roles even when the block is showed on a course context... right?

In reply to Susana L.

Re: Make block available only to teachers

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

I don't think it is a bug because teachers and students are only teachers and students in the course context and not site context.  (If you were able to do it in 1.9 perhaps your teachers and students were assigned globally?) I would be glad however, to hear what others with more knowledge of roles and contexts would say smile

In reply to Mary Cooch

Re: Make block available only to teachers

by Susana L. -
The point here is that the block (we may call it a sticky block) although it is created on system context (to make it available site wide), it is shown only on course context. So i think course roles should work...


I was saying this is a bug also because I get the following behaviour:
After setting permissions with "View Block" only to Teachers and Managers (as image attached), the block is not shown to teachers (as I have been explaining)... but if the teacher turns "editing on" the block is shown... I think this is a misbehaviour. 

Thank you for spending some time with this smile
Best regards,
susana

block permissions


In reply to Mary Cooch

Re: Make block available only to teachers

by mandy honeyman -

Hi Mary,

I am probably posting this in slightly the wrong place but hopefully not (and apologies if so)!

I am trying to set up two html blocks on the dashboard 

  1. only for students
  2. only for tutors

This is because they are going to contain navigation (to an external site and an internal course) that are only relevant to each group. I can't see how to manage the permissions for this (easily preferably because I have to explain to someone else how to do it).

thanks

Mandy

In reply to mandy honeyman

Re: Make block available only to teachers

by Priyanka Sinha -

Hi Mandy,

 Were you able to achieve this? I have this exact requirement.

Thanks,

Priyanka


In reply to Priyanka Sinha

Re: Make block available only to teachers

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Priyanka,

It is a real shame that you can only add one copy of the Links block, but since you can add multiple HTML blocks, it is still easy to do what you want.

Since you didn't mention what roles and what version of Moodle, I am going to guess at student and a role you created called tutor, and that you want to do this on Moodle 3.

Add your two blocks, let's call them Student Links and Tutor Links. Go edit the permissions for Students Links and remove View block permissions for everyone but Student, Non-editing teacher, and Teacher.  Go edit the permissions for Tutor Links and remove View block permissions for everyone but Tutor, Non-editing teacher, and Teacher.

Once you've done both permission changes, student can only see their HTML block and Tutors can only see theirs. Teachers can still see both and edit both.