function user_can_addto($page) { // Don't allow people to add the block if they can't even use it if (!has_capability('moodle/community:add', $page->context)) { return false; } return parent::user_can_addto($page); }