Show admin-generated content to specific members

Hi,
I have searched this forum for hours but I can’t figure this out.

I have a members area on my site and would like a simple page where each member can view their invoices as an image in a gallery linked to a collection. They will not be able to create or edit this content, only read it.

I plan to manually upload the images into the database but don’t how I assign it to a specific member userID, or even to the logged in users email address?

I have read the “How to build you own members area using code” which would mean redesigning my whole members area and doesn’t make it clear how they see content that isn’t their own. I’v also read the Wix Users API but can’t get my head around how to get their ID/email and link it to what I’ve entered into the database.

Any help would be much appreciated.

Thanks

Hey,
You can try using the ability to filter by logged in user - https://support.wix.com/en/article/how-to-filter-a-page-based-on-the-currently-logged-in-user
The main thing to note there is that this solution uses the “owner” field, which, in your use case, will be your own user as you’re the one adding the content. So you’d need to modify the owner field to reflect the the user’s.

Thank you, that makes sense but does give me another question.

How would I know what to modify the owners field to? Is the members user ID stored anywhere from previous logins, or would I have to get their ID next time they log in and make sure all future entries for them use that ID?

I thought of an easier approach -
For each logged in user, you can get its email - https://www.wix.com/code/reference/wix-users.User.html#getEmail.
When the admin uploaded the data, add the user’s email to a field in that collection, and then, on the members page - filter by the current users’ email.

Thanks, that does seem like an easier option. I’ve not used the get email before. Is it as simple as placing this in the code?

user.getEmail()
.then( (email) => {
let userEmail = email; } );

“on the members page - filter by the current users’ email.”

Hi Ohad, in this case can you teach me how to filter by the current users 'email"? Does it require code ? I don’t know what to put in the Condition and Value box.

1 Like

Im trying to do something very similar… My problem is that when I attempt to add that sort of filter it says " My dataset is not valid for this type of filter" any advise?