original_string: protected static function delete_user_data(int $userid, \context $context) {
          global $DB;
  
          // Delete password history.
          $DB->delete_records('user_password_history', ['userid' => $userid]);
          // Delete last access.
          $DB->delete_records('user_lastaccess', ['userid' => $userid]);
          // Delete password resets.
          $DB->delete_records('user_password_resets', ['userid' => $userid]);
          // Delete user devices.
          $DB->delete_records('user_devices', ['userid' => $userid]);
          // Delete user course requests.
          $DB->delete_records('course_request', ['requester' => $userid]);
          // Delete sessions.
          $DB->delete_records('sessions', ['userid' => $userid]);
          // Do I delete user preferences? Seems like the right place to do it.
          $DB->delete_records('user_preferences', ['userid' => $userid]);
  
          // Delete all of the files for this user.
          $fs = get_file_storage();
          $fs->delete_area_files($context->id, 'user');
  
          // For the user record itself we only want to remove unnecessary data. We still need the core data to keep as a record
          // that we actually did follow the request to be forgotten.
          $user = \core_user::get_user($userid);
          // Update fields we wish to change to nothing.
          $user->deleted = 1;
          $user->idnumber = '';
          $user->emailstop = 0;
          $user->icq = '';
          $user->skype = '';
          $user->yahoo = '';
          $user->aim = '';
          $user->msn = '';
          $user->phone1 = '';
          $user->phone2 = '';
          $user->institution = '';
          $user->department = '';
          $user->address = '';
          $user->city = '';
          $user->country = '';
          $user->lang = '';
          $user->calendartype = '';
          $user->theme = '';
          $user->timezone = '';
          $user->firstaccess = 0;
          $user->lastaccess = 0;
          $user->lastlogin = 0;
          $user->currentlogin = 0;
          $user->lastip = 0;
          $user->secret = '';
          $user->picture = '';
          $user->url = '';
          $user->description = '';
          $user->descriptionformat = 0;
          $user->mailformat = 0;
          $user->maildigest = 0;
          $user->maildisplay = 0;
          $user->autosubscribe = 0;
          $user->trackforums = 0;
          $user->timecreated = 0;
          $user->timemodified = 0;
          $user->trustbitmask = 0;
          $user->imagealt = '';
          $user->lastnamephonetic = '';
          $user->firstnamephonetic = '';
          $user->middlename = '';
          $user->alternatename = '';
          $DB->update_record('user', $user);
      }
code: protected static function delete_user_data(int $userid, \context $context) {
          global $DB;
  
          // Delete password history.
          $DB->delete_records('user_password_history', ['userid' => $userid]);
          // Delete last access.
          $DB->delete_records('user_lastaccess', ['userid' => $userid]);
          // Delete password resets.
          $DB->delete_records('user_password_resets', ['userid' => $userid]);
          // Delete user devices.
          $DB->delete_records('user_devices', ['userid' => $userid]);
          // Delete user course requests.
          $DB->delete_records('course_request', ['requester' => $userid]);
          // Delete sessions.
          $DB->delete_records('sessions', ['userid' => $userid]);
          // Do I delete user preferences? Seems like the right place to do it.
          $DB->delete_records('user_preferences', ['userid' => $userid]);
  
          // Delete all of the files for this user.
          $fs = get_file_storage();
          $fs->delete_area_files($context->id, 'user');
  
          // For the user record itself we only want to remove unnecessary data. We still need the core data to keep as a record
          // that we actually did follow the request to be forgotten.
          $user = \core_user::get_user($userid);
          // Update fields we wish to change to nothing.
          $user->deleted = 1;
          $user->idnumber = '';
          $user->emailstop = 0;
          $user->icq = '';
          $user->skype = '';
          $user->yahoo = '';
          $user->aim = '';
          $user->msn = '';
          $user->phone1 = '';
          $user->phone2 = '';
          $user->institution = '';
          $user->department = '';
          $user->address = '';
          $user->city = '';
          $user->country = '';
          $user->lang = '';
          $user->calendartype = '';
          $user->theme = '';
          $user->timezone = '';
          $user->firstaccess = 0;
          $user->lastaccess = 0;
          $user->lastlogin = 0;
          $user->currentlogin = 0;
          $user->lastip = 0;
          $user->secret = '';
          $user->picture = '';
          $user->url = '';
          $user->description = '';
          $user->descriptionformat = 0;
          $user->mailformat = 0;
          $user->maildigest = 0;
          $user->maildisplay = 0;
          $user->autosubscribe = 0;
          $user->trackforums = 0;
          $user->timecreated = 0;
          $user->timemodified = 0;
          $user->trustbitmask = 0;
          $user->imagealt = '';
          $user->lastnamephonetic = '';
          $user->firstnamephonetic = '';
          $user->middlename = '';
          $user->alternatename = '';
          $DB->update_record('user', $user);
      }
code_tokens: protected static function delete_user_data ( int $ userid , \ context $ context ) { global $ DB ; // Delete password history. $ DB -> delete_records ( 'user_password_history' , [ 'userid' => $ userid ] ) ; // Delete last access. $ DB -> delete_records ( 'user_lastaccess' , [ 'userid' => $ userid ] ) ; // Delete password resets. $ DB -> delete_records ( 'user_password_resets' , [ 'userid' => $ userid ] ) ; // Delete user devices. $ DB -> delete_records ( 'user_devices' , [ 'userid' => $ userid ] ) ; // Delete user course requests. $ DB -> delete_records ( 'course_request' , [ 'requester' => $ userid ] ) ; // Delete sessions. $ DB -> delete_records ( 'sessions' , [ 'userid' => $ userid ] ) ; // Do I delete user preferences? Seems like the right place to do it. $ DB -> delete_records ( 'user_preferences' , [ 'userid' => $ userid ] ) ; // Delete all of the files for this user. $ fs = get_file_storage ( ) ; $ fs -> delete_area_files ( $ context -> id , 'user' ) ; // For the user record itself we only want to remove unnecessary data. We still need the core data to keep as a record // that we actually did follow the request to be forgotten. $ user = \ core_user :: get_user ( $ userid ) ; // Update fields we wish to change to nothing. $ user -> deleted = 1 ; $ user -> idnumber = '' ; $ user -> emailstop = 0 ; $ user -> icq = '' ; $ user -> skype = '' ; $ user -> yahoo = '' ; $ user -> aim = '' ; $ user -> msn = '' ; $ user -> phone1 = '' ; $ user -> phone2 = '' ; $ user -> institution = '' ; $ user -> department = '' ; $ user -> address = '' ; $ user -> city = '' ; $ user -> country = '' ; $ user -> lang = '' ; $ user -> calendartype = '' ; $ user -> theme = '' ; $ user -> timezone = '' ; $ user -> firstaccess = 0 ; $ user -> lastaccess = 0 ; $ user -> lastlogin = 0 ; $ user -> currentlogin = 0 ; $ user -> lastip = 0 ; $ user -> secret = '' ; $ user -> picture = '' ; $ user -> url = '' ; $ user -> description = '' ; $ user -> descriptionformat = 0 ; $ user -> mailformat = 0 ; $ user -> maildigest = 0 ; $ user -> maildisplay = 0 ; $ user -> autosubscribe = 0 ; $ user -> trackforums = 0 ; $ user -> timecreated = 0 ; $ user -> timemodified = 0 ; $ user -> trustbitmask = 0 ; $ user -> imagealt = '' ; $ user -> lastnamephonetic = '' ; $ user -> firstnamephonetic = '' ; $ user -> middlename = '' ; $ user -> alternatename = '' ; $ DB -> update_record ( 'user' , $ user ) ; }
docstring: Deletes non vital information about a user.
  
  @param  int      $userid  The user ID to delete
  @param  \context $context The user context
docstring_tokens: Deletes non vital information about a user .