How to Automatically Attach Member Names to Their Reviews

My website allows people to be members and write reviews on food. My question concerns how to automatically attach their names to their reviews.

To write a review, they fill out a form I have created. The form allows them to write a comment and provide ratings, but it does not ask for their name because that seems unnecessary since they are already members of the website.

My problem is this: when I “publish” their review elsewhere on the website, I can’t figure out how to include their name with the review. In the database where their review is stored, I don’t see a column that has their name. Should I somehow be autofilling their name initially on the review form? And if so, how do I do that? Or is there another way to solve this?

Thanks!

Hi,
I’m afraid that currently there’s no option to get the current user’s name. You can get his email address using the Users API and save it to the collection as well on the form submission. Check out the documentation here .

Note that you can check out the Stores Reviews example (which is a bit more complicated than your scenario) here to get inspiration of how to achieve this.

Good luck!
Tal.