Discord How to Get Discord Username

When editing a template, how can I recover the user's Discord username?

I dumped {{ dump($xf.visitor.Profile) }} and I can recover the connected_accounts property, however this only contains the user's snowflake value.

Is there a better way to get this directly or do I need to use this snowflake, if it exists, as a variable value in another function?

I'd like to get the user's Discord username to display on their postbit, should they enable this in the settings.
 
Solution
The add-on doesn't currently store the user's Discord username so it's not possible to display it in the postbit like this.

We only store the user's ID / snowflake and their access and refresh tokens, as it stands.
The add-on doesn't currently store the user's Discord username so it's not possible to display it in the postbit like this.

We only store the user's ID / snowflake and their access and refresh tokens, as it stands.
 
Solution
Got it. Explains why the connected accounts screen always just falls back to the "account associated" screen rather than showing the person's Discord username. I saw that if/else in the template and was curious.

I take it the reason behind this is a caching issue?
 
Before Discord transitioned to @username, the add-on used to display the old format of username#1234 so it's just leftover from that.

Shouldn't be too hard to get the username and keep that synced with XF though.
 
Back
Top