original_string: protected static function delete_user_data($userid) {
          global $DB;
  
          // Delete the stuff.
          $DB->delete_records('badge_manual_award', ['recipientid' => $userid]);
          $DB->delete_records('badge_criteria_met', ['userid' => $userid]);
          $DB->delete_records('badge_issued', ['userid' => $userid]);
  
          // Delete the backpacks and related stuff.
          $backpackids = $DB->get_fieldset_select('badge_backpack', 'id', 'userid = :userid', ['userid' => $userid]);
          if (!empty($backpackids)) {
              list($insql, $inparams) = $DB->get_in_or_equal($backpackids, SQL_PARAMS_NAMED);
              $DB->delete_records_select('badge_external', "backpackid $insql", $inparams);
              $DB->delete_records_select('badge_backpack', "id $insql", $inparams);
          }
      }
code: protected static function delete_user_data($userid) {
          global $DB;
  
          // Delete the stuff.
          $DB->delete_records('badge_manual_award', ['recipientid' => $userid]);
          $DB->delete_records('badge_criteria_met', ['userid' => $userid]);
          $DB->delete_records('badge_issued', ['userid' => $userid]);
  
          // Delete the backpacks and related stuff.
          $backpackids = $DB->get_fieldset_select('badge_backpack', 'id', 'userid = :userid', ['userid' => $userid]);
          if (!empty($backpackids)) {
              list($insql, $inparams) = $DB->get_in_or_equal($backpackids, SQL_PARAMS_NAMED);
              $DB->delete_records_select('badge_external', "backpackid $insql", $inparams);
              $DB->delete_records_select('badge_backpack', "id $insql", $inparams);
          }
      }
code_tokens: protected static function delete_user_data ( $ userid ) { global $ DB ; // Delete the stuff. $ DB -> delete_records ( 'badge_manual_award' , [ 'recipientid' => $ userid ] ) ; $ DB -> delete_records ( 'badge_criteria_met' , [ 'userid' => $ userid ] ) ; $ DB -> delete_records ( 'badge_issued' , [ 'userid' => $ userid ] ) ; // Delete the backpacks and related stuff. $ backpackids = $ DB -> get_fieldset_select ( 'badge_backpack' , 'id' , 'userid = :userid' , [ 'userid' => $ userid ] ) ; if ( ! empty ( $ backpackids ) ) { list ( $ insql , $ inparams ) = $ DB -> get_in_or_equal ( $ backpackids , SQL_PARAMS_NAMED ) ; $ DB -> delete_records_select ( 'badge_external' , "backpackid $insql" , $ inparams ) ; $ DB -> delete_records_select ( 'badge_backpack' , "id $insql" , $ inparams ) ; } }
docstring: Delete all the data for a user.
  
  @param int $userid The user ID.
  @return void
docstring_tokens: Delete all the data for a user .