It should be doable in a theme component. The user ID is available without an additional request, so you’d only need some JavaScript to show it in a plugin outlet on the profile page.
@pfaffman Thanks for the reply. Well, because a UID is immutable (never changes) it can act like a permanent fingerprint for someone’s account. Usernames can change so for support tickets it instantly can find their account, transactions, auth sessions etc… UID cannot be faked and are unique forever.
I would like the UID to increment by 1 with every new users
@Moin Thanks for the reply it was helpful. Yesd I can view the response in Network → XHR → Response. Perfect. But I am unaware as to how to show the UID on the users account profile. I want to display it here: https://mydomain.com/u//preferences/account
But within the create components there is only these options: , Before Header, After Header and Footer
/my/preferences/account is not public; other users cannot see that, but based on your use case, it might be enough for the user themselves to see their ID.
You need to find a plugin outlet that is close to where you want to show the information. I usually use the button in the developer toolbar to make them visible on a forum. Seeing them within the forum makes it easier for me to find the best outlet. You can find more information on how to show something in an outlet in the Theme Developer Tutorial: 1. Introduction
Okay so if I want everyone to see it (public) I would place it within: mydomain.com/u/<user>summary
So by use of enableDevTools() within the browser console I think user-profile-secondary will be a good place.
I will try now.
Im stuck. How would I get the id of the user I am viewing? Because api.getCurrentUser does the logged in user.
I just put the User ID on plugin outlet: header-contents__after
Yes api.renderInOutlet() came in clutch. However my issue which is now irrelevant since I approached it differently—was that I didn’t know how to retrieve the user.id of the profile being viewed.
Got any ideas?
I think it would be easier if you chose an outlet that provides the model of the user whose page you are viewing.
The outlet you chose offers information about the topic but not about users
The outlets on the user profile like user-post-names provide the user model:
With an outlet that provides the model you should be able to use @outletArgs like the example in Theme Developer Tutorial: 4. Using Outlets to insert and replace content. The example there uses discovery-list-container-top which provides @outletArgs={{lazyHash category=@model.category tag=@model.tag}}
That’s why I would choose an outlet that provides the user model. You can see the model when you hover over the outlet and see the ID of the user whose profile you look at. Many examples in the tutorial use the currentUser service, which provides the ID of the acting user, which is not what you seem to be looking for.