How change 1 line of code in a core module without hack? Every time I update Drupal core I get the error message, 


  Notice: Undefined variable: forum_term (line 764)


I've implemented this hack on forum.module to get rid of this problem.

How can I implement this change without hacking the core forum.module file?
You can take 3 different strategies to mitigate the problem the hack introduces.


Don't Hack/Ignore the error: Without knowing the deeper context of when this happens, this could be (as the d.o. thread suggests) just a quirk of other contrib modules that show up during the update process. You'll need to do more investigation to see if this occurs during a critical code (e.g. a module update) and if it can be ignored.
Don't Hack/Fix the error: Assuming the error is fundamentally a part of Drupal's forum module logic (i.e. not just something caused by a contrib module), you could submit a patch for the module to get it fixed for everyone that has the same issue.
Patch Management: Depending on your own codebase, process, &amp; issues, patching might be unavoidable here. If that's the case, you can create your own patch for Drupal core and create some process where it is consistently applied every time you need to you need to update your codebase.