For this particular WordPress project, I needed to create a custom meta data field for users with Advanced Custom Fields, to allow them to upload their profile photo. I then created a team page, and wanted an easy way for them to add their photo to their team listing.
So, I had to:
- Get the user’s login – stored in a custom field, which they input on the Team edit page
- Use that to get the user’s ID
- Query the array containing the user’s metadata and find the custom photo
- Get the attachment URL of that photo
- Use that to display the photo, not forgetting to deference the array parameter
It was also useful in displaying their custom photo on their Author page, which was a bit easier as I already had the user ID, so could user