I have another question (bombarding today!). Right now I’ve put my user profile information in the Meteor.user.profile fields. So currently I have bio, avatar and cover image in this user sub-array.
In testing, I’ve added several users and the idea is that you go to the user profile page and you’ll see their profile (minus things like email etc). However, let’s say user A wants to view user B’s profile, they only see their own (despite the URL being for user B). It appears this is because using Meteor.users.find or whatever, you can only find your own profile data?
Should I make a separate profiles collection for the user? The issue then is I also want to display the user role, which I’ve added using the alanning:roles package. I suppose I could update the profiles collection when this role changes though.
Here’s my code right now, it could just be me being dumb-dumb:
Do I need to subscribe to a publication since right now it’s in the react component? It might be you can only see your own user data from the client hence the issues. If so, what’s the best way to do this? Since I understand how props pass down from the router but not to / from publications.
Thanks,
Korus.
PS. Had to edit a couple of time since I accidentally (somehow) posted early…
By default, any user gets to see their profile, but no other. You will either need a custom publication for the Users collection to override this behaviour, or use a separate collection.
Sorry for the slow response, I only received the email this morning telling me I had your reply…
Anyway, what I did was have a separate mongo collection called ‘profiles’ that grabbed their username on signup and generated other content with it such as avatar, website URL etc. In essence, it was separate to their profile entirely (in keeping with Meteor Accounts being only available to the current user) but they could still go in and edit their own profile in the profiles collection.
This was my profiles schema (it was a basic gaming web app):