Jump to content

Created User Image?


bowenac
 Share

Recommended Posts

NM figured it out typo... Delete if you want.

Hello all, started playing with processwire last night, been developing for wp for years and so far I am liking some things with PW.

Currently I edited the users template and added some profile fields etc. I am able to get all the fileds except the image field.

This is what I am currently trying.

$page->createdUser->images->first();

This is not working for me. Is this not the correct way to get a user profile image?

Edited by bowenac
Link to comment
Share on other sites

Your images field is probably set to Automatic because you use it for multiple images in another template, but for user profiles you limited it to 1, which means you don’t have to use →first(). You can also configure the field to always give you an array, regardless of the max-setting. Then you have to write →first() every time, but you’ll always know what you’re working with.

Maybe a single image should throw a descriptive exception when accessed like a WireArray.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...