How to change collection data with code

I want the user to be able to make posts, kind of like on facebook, but I can’t figure out the part where it displays who posted it. How do I make it display the name and profile picture of who made the post, on the post?