Only allow Teachers to view HTML Block

Only allow Teachers to view HTML Block

by Fred Weiss -
Number of replies: 8

I wish to have a HTML block which is only visible to teachers.  However, if I go to permissions and prevent Authenticated user from viewing the block and Allow teachers, they can still not see it.

It would appear that authenticated user must have view for anyone to see it.

Then if I create a authenticated user role for MyBlock (see  - http://docs.moodle.org/20/en/Block_permissions) I have over 2000 teachers to add to the role.  To search and locate these individually is too much work.  I tried searching on email domain (teachers.edu) but this does not work.

Does anyone have any suggestions?

Can the block be hidden from users using php?

I used to use    if (isteacherinanycourse())   but this does not seem to work with Moodle 2.1

Thanks

Average of ratings: -
In reply to Fred Weiss

Re: Only allow Teachers to view HTML Block

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

Where is this HTML block? Is it on the front page or is it "sticky"?

In reply to Mary Cooch

Re: Only allow Teachers to view HTML Block

by Fred Weiss -
It was to go on the mymoodle page
In reply to Fred Weiss

Re: Only allow Teachers to view HTML Block

by C D -

I have a cimilar issue where I want to PREVENT students from seeing certain HTML blocks, but I can't as when I select this it just states:

"No capabilities available in this context"

In reply to Mary Cooch

Re: Only allow Teachers to view HTML Block

by Amanda Baxter -

I am trying to get an HTML block to be only visible for teachers on the front page of my Moodle site.  I can't seem to find even how to get started.  I've set the roles of teacher for that block but I can't seem to find where to set the visibility based on account.  Help would be greatly appreciated!!

In reply to Amanda Baxter

Re: Only allow Teachers to view HTML Block

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

Amanda - you don't say which version of Moodle you are using but this is for 2 : http://docs.moodle.org/21/en/Blocks_FAQ#How_do_I_make_a_front_page_block_visible_to_teachers_but_not_students.3F

In reply to Mary Cooch

Re: Only allow Teachers to view HTML Block

by Amanda Baxter -

I tried this but I must have a different version of Moodle.  I'm not sure but I think it's 1.9.  I couldn't make it work sad