Previous "Sticky blocks" Not Working in 3.9

Previous "Sticky blocks" Not Working in 3.9

le Blair F. -
Number of replies: 6
Dealbh dhe Particularly helpful Moodlers

On Moodle 3.6, we had a number of "sticky blocks" set up that were visible to Teachers, Managers and Admins only. After upgrading to 3.9, they are now only visible to Administrators. Teachers and Managers can't see them, anymore. I've played around with the settings for days to no avail. Has anyone else noticed this issue after the upgrade? I realize that, as Admins, this is one of those things you may not noticed until someone reports it.

This was my process for creating them, back with 3.6 (or even earlier):

  1. Add a HIDDEN HTML block to the front page.  Keep it hidden. 
  2. Edit the block contents. 
  3. From the Moodle home page, click on the Assign Roles icon and Edit the PERMISSIONS of the block, removing all roles from “Edit a block’s settings” and all roles except Teacher and Manager from the “view block” settings. 
  4. Go back to update the settings of the block and change the “Page contexts” setting to “Display throughout the entire site” 
  5. OPTIONAL: Go to any course and update the settings of the block to appear only on certain types of pages. 

I have tried adding Authenticated User, but then students can see it. I tried then adding Students to the prohibited list, while keeping Authenticated User on the list, but that no effect. Students could still see it.

Attachment permisions1.PNG
Attachment Permissions2.PNG
Average of ratings: -
In reply to Blair F.

Re: Previous "Sticky blocks" Not Working in 3.9

le Blair F. -
Dealbh dhe Particularly helpful Moodlers
Additional information:

When I check the permissions of the block for my Teacher (Testing123), his teacher role doesn't even show up. 

I went back and checked our old 3.6 environment and the permissions were similar, EXCEPT Authenticated user also showed up on the frontpage, so I'm going to pursue that and see where it takes me.


In reply to Blair F.

Re: Previous "Sticky blocks" Not Working in 3.9

le Blair F. -
Dealbh dhe Particularly helpful Moodlers
This has become my nightmare. I simply cannot make sense of any of this.
In reply to Blair F.

Re: Previous "Sticky blocks" Not Working in 3.9

le Blair F. -
Dealbh dhe Particularly helpful Moodlers
Update: I have found that both of the following hide the block from the students while keeping it visible to the Teacher when this block is created within a course. However, when I do the same thing to a "sticky block" (created on the front page, first), it doesn't work. In that case it completely ignores the PROHIBIT settings.




In reply to Blair F.

Re: Previous "Sticky blocks" Not Working in 3.9

le John Provasnik -
Dealbh dhe Particularly helpful Moodlers Dealbh dhe Testers
Student and teacher are course roles so they will not work on non course pages. Since all uses are authenticated users, removing that will stop all users from seeing the block. manager is both a site-context and course-context role so it works in both places. Consider making a "Staff" role at the site-context so "staff" Can view the block (when on the front page) while also preventing the remaining authenticated users (i.e. students) from seeing it. There are examples in the Moodle docs on how to achieve this - see if that can help guide you
In reply to Blair F.

Re: Previous "Sticky blocks" Not Working in 3.9

le John Provasnik -
Dealbh dhe Particularly helpful Moodlers Dealbh dhe Testers
Something else to mention, if you edit your Front Page settings, there is an option to pick which "role" is used for the front page. I wonder if before you upgraded, you had 'student' selected here. Check to see what it is now (usually it's set to either 'authenticated user' or 'authenticated user on front page'). But changing this to student could get you back to the behavior you had before, or just remove 'authenticated user' from the "view block" permission within the desired blocks (see Moodle docs here: https://docs.moodle.org/39/en/Blocks_FAQ#How_do_I_make_a_front_page_block_visible_to_teachers_but_not_students.3F)
In reply to John Provasnik

Re: Previous "Sticky blocks" Not Working in 3.9

le Blair F. -
Dealbh dhe Particularly helpful Moodlers
Thank you, John, for trying to help me with this. Unfortunately, your tips wouldn't work with my situation, which I'll clarify here:

The end goal is to have a "sticky" HTML block which is hidden on the front page, but visible in every course, but only to TEACHERS and not students. This could be either with editing turned off or only when it's on. In the past (Pre-Moodle 3.9), I was able to successfully accomplish this ONLY with editing turned ON and I just accepted that. If I could do it with editing turned OFF, that would be a bonus. Too help understand the use for this, I'm including an image of one of the sticky HTML blocks we use:

Previously (Moodle 3.6), I was able to create this scenario following these instructions
Making a block sticky throughout the whole site: https://docs.moodle.org/39/en/Block_settings#Making_a_block_sticky_throughout_the_whole_site
Then, still from the frontpage, I would change the Permissions the moodle/block:view to ALLOW Teachers. I wouldn't even need to Prohibit students, although I've been trying that while struggling through this.

Note: Then (3.6) and now (3.9), our defaultfrontpageroleid was the role FRONTPAGE (based on what I'd read here: https://docs.moodle.org/32/en/Front_page_settings#Default_front_page_role )

While trying various permissions to get this to work in 3.9, what surprises me the most is that Prohibit seems to do nothing, at all, when I set it for moodle/block:view.
Attachment CourseInformation.PNG