I was wondering if it’s possible to create a post that references the username of whoever is logged in? Sort of like the /my route but for the frontend.
My use case would be to customize a URL pointing outside of Discourse so when a user clicks it, it will have the query ?username=MY_USERNAME appended to it. The same approach could be used to embed an iframe with that URL, for example.
If this is not possible out of the box, I assume the other alternative would be to write a custom plugin.
Yes. The post record has the username in it (see https://meta.discourse.org/t/is-there-a-recommended-way-to-get-the-current-username-from-a-post/178288.json).
Oh, well, the particulars are different but the answer is the same. There should be examples in the developer’s guide, so you can see how to access current_user.