Make blocks visible only to selected users

With some help from Moodle forums, I ended up using a combination of solutions as none seemed to work on their own.

  1. In Administration > Site administration > Users > Permissions > Define roles, select ‘authenticated user on the front page’
  2. Click edit and then select ‘block’ in the ‘context types where this role may be assigned’ section
  3. At the bottom of the page, Set moodle/block:view to “allow”.
  4. Save the changes.
  5. Go to the page where the block appears and turn editing on.
  6. From the block actions menu, select ‘Assign roles’
  7. Click ‘authenticated user on front page’ and add the users who need to see this block (eg. teachers)
  8. Select ‘Permissions’ from the Administration block on the left.
  9. Next to the ‘view block’ option, remove all roles except ‘authenticated user on the front page’
  10. Job done!

Screenshot - user permissions in Block HTML