Indeed, I have undertaken this task: Overriding user_guardian.rb in a plugin (no fork necessary!) - #29 by pfaffman. As you suggested, I experimented with both methods. The first approach resulted in an error, as documented here: Overriding user_guardian.rb in a plugin (no fork necessary!) - #30 by kuaza.
The second method rendered the site inaccessible. I am exploring alternative solutions in my quest for resolution, but progress has been limited, prompting me to consider other avenues.
Since I prefer not to make extensive modifications, I contemplated forking Discourse. I would simply update my fork with the latest changes from the main repository each time, then reapply only the modifications I have made, accepting this approach.
My primary challenge lies in identifying an effective and correct solution. I am willing to delete and rewrite the code, trying new approaches. However, in the face of uncertain errors, I am unfortunately unable to produce a definitive resolution.
thanks