Details
Description
On the sticky blocks admin page, the role icon has an empty "contextid" parameters. So it is not possible to generate sticky blocks for teachers only.
Brief analysis:
It looks like validate_context fails because ist gets the id of the "block_pinned" table and not the id of the corresponding record in table block.
This appears to be caused by an incorrect 'contextid' on the 'assign roles' icon for sticky blocks. It seems to always pick a context id associated with a block on the main site page, rather than the actual sticky block...
Investigating further...
Ah. I see why. The pinned blocks still use 'CONTEXT_BLOCK', but are stored in a separate block table than blocks. Blocks are in 'block_instance', while sticky blocks are in 'block_pinned'. This means that the 'get_context_instance' function is getting records with an instance id referring to the wrong table. Worse yet, they may actually create a context id record for the wrong block!
Note that the original complaint said that icon had an empty context id. Unfortunately, it may not be empty if it finds a regular block entry with the same id as the sticky block.