I noticed what while Flarum provides a clear API to change the display name via the GetDisplayName
event, we don't provide any official recommendation on how to extend the user search.
Extensions can add custom search gambits, but those gambits need a prefix, like displayname:
which the users need to know exist. I see this extension currently provides no such gambit at all.
To enable users searching for users by their display name in the forum search box as well as other extensions using user search without typing a gambit prefix (Byobu, Author change, User directory, ...), you could create a gambit that extends or replicates the User's FullTextGambit and register it using setFulltextGambit
on the GambitManager
.
The full text gambit is the search gambit applied for all terms that don't match any other gambit, so essentially free-text search.
Unfortunately the full text gambit is not extensible, only replaceable. So if multiple extensions alter the user full text search gambit, only the last enabled extension's full text gambit will be applied. But so far I don't know of any extension replacing a full text gambit.