HasanMerkit there are 2 different challenges here:
- Changing the
href value
- Opening the link outside of the Flarum single page app
Changing the href value is quite simple. You can override the app.route.user method.
By default it does something like this:
app.route.user = (user: User) => {
return app.route('user', {
username: user.slug(),
})
}
There are also the different user.* routes used for the tabs on the user profile but I don't think you find links to those pages outside of the profile page itself, so if you are not using the native profile page you should be able to ignore them. It's possible some extensions still try to open those tabs directly. In that case you would probably have to override the entire app.route() method.
Based on your request, I assume you also want to open the link outside of the single page application. Flarum has 2 kinds of <a> tags, one for links in the SPA and one for external links. Switching the type of link tag will require a change everywhere you find a link to the user profile.
The easiest would be to extend the flarum/common/components/Link component and force its external property to true anytime the provided href looks like your profile URL. I can't think of any example extension that makes such a change though.
If you make your custom profile page into a Flarum SPA page, all you would need is to modify the path and/or component of the route registered with the user key in the app.routes registry, then everything would automatically use those new values.