How to 'grab' member ID and save it when updating a collection.

There is more than one way to word this question im sure, but il explain what i’m trying to do. It’s a simple task in my view, but i can’t get my head around it.

So…
I have collection set up that only allows members to upload/submit to. there are various fields that the members will fill out, such as 'Title, Image, Document & Description.

I can get this to work no problem but theres a couple of fields i can’t get to work.

As any member can submit/upload to the collection, i need to know WHO made the submission/uploaded the content to the collection. I would like this to show up in the content manager, because, well i want to know who did it, and be able to ‘reference’ that member for other collections.

I’ve tried ‘referencing’ the Private/Member datasets, FullData sets and PublicDatasets in the fields. Ive tried reading the datasets on a page through the ‘inputs’, whilst i can get it to read what member is on the page, i can’t get it to write and update the collection dataset.

It’s been quite a frustrating feat this. Ive read many articles, watch many vidoes, but they are all missing something. Even the ‘Music’ video tutorials that refernce ‘Artists’ and ‘Songs’ look like they have what i need, but then they seem to just miss out.

I don’t know why i’m struggling to understand this. Please could someone help?

When a member submits content to a collection/dataset, how do we update that collection/dataset to show what member submitted the content.

Thanks

1 Like

Hi there,

By default whenever a member inserts data into a collection, their associated member id will be in the ‘_owner’ system field.

If you would like to handle future updates to a row, you may find data hooks helpful. They allow you to intercept and modify data before they are saved into your collection.

Using beforeUpdate() you should be able to get context about who caused the row to be updated using context.userId. You can then save this information in a column in the collection that stores the memberId which last updated that particular row.

Thanks for the response. i don’t think i need anything like data hooks. I just want when a user clicks on content that has been uploaded, it takes it to the content page, where i can then show the user who uploaded the content. Clicking on that user name should then take them to the content uploader ‘public page’.
Linking to each dynamic page is a bit of a logistical nightmare with wix i find(at the moment). it shouldn’t be that difficult. The info is there, i just can’t seem to use it, or find it efficiently to perform the task. :slight_smile:

Same problem, seems like an easy solution - but takes so much time