original_string: public static function role_unassigned(\core\event\role_unassigned $event) {
          if (!enrol_is_enabled('meta')) {
              // All roles are removed via cron automatically.
              return true;
          }
  
          // Prevent circular dependencies - we can not sync meta roles recursively.
          if ($event->other['component'] === 'enrol_meta') {
              return true;
          }
  
          // Only course level roles are interesting.
          if (!$parentcontext = context::instance_by_id($event->contextid, IGNORE_MISSING)) {
              return true;
          }
          if ($parentcontext->contextlevel != CONTEXT_COURSE) {
              return true;
          }
  
          self::sync_course_instances($parentcontext->instanceid, $event->relateduserid);
  
          return true;
      }
code: public static function role_unassigned(\core\event\role_unassigned $event) {
          if (!enrol_is_enabled('meta')) {
              // All roles are removed via cron automatically.
              return true;
          }
  
          // Prevent circular dependencies - we can not sync meta roles recursively.
          if ($event->other['component'] === 'enrol_meta') {
              return true;
          }
  
          // Only course level roles are interesting.
          if (!$parentcontext = context::instance_by_id($event->contextid, IGNORE_MISSING)) {
              return true;
          }
          if ($parentcontext->contextlevel != CONTEXT_COURSE) {
              return true;
          }
  
          self::sync_course_instances($parentcontext->instanceid, $event->relateduserid);
  
          return true;
      }
code_tokens: public static function role_unassigned ( \ core \ event \ role_unassigned $ event ) { if ( ! enrol_is_enabled ( 'meta' ) ) { // All roles are removed via cron automatically. return true ; } // Prevent circular dependencies - we can not sync meta roles recursively. if ( $ event -> other [ 'component' ] === 'enrol_meta' ) { return true ; } // Only course level roles are interesting. if ( ! $ parentcontext = context :: instance_by_id ( $ event -> contextid , IGNORE_MISSING ) ) { return true ; } if ( $ parentcontext -> contextlevel != CONTEXT_COURSE ) { return true ; } self :: sync_course_instances ( $ parentcontext -> instanceid , $ event -> relateduserid ) ; return true ; }
docstring: Triggered via role_unassigned event.
  
  @param \core\event\role_unassigned $event
  @return bool true on success
docstring_tokens: Triggered via role_unassigned event .