Accessing the store, e.g. users

I was wondering what the standard way is in order for plugins to access the discourse user store, for example you want to display the avatar or other general information about a certain user.

var storeMain = api.container.lookup('store:main');
var users = storeMain.find('user');

However, this doesn’t work. Any other ideas?

1 Like

You should be able to fetch information about a user from the store like this:

store.find('user', 'eviltrout').then(u => console.log(u.get('avatar_template')));
4 Likes

Yes that did the trick, thanks!!