Hi I'm sure this is simple but it is eluding me. I want to pull out all the user profile fields with twig as an array that I can then check. When I dump the user or currentUser data it does not show any of the profile fields I have created in the returned object. I can however still access these fields with user.customfieldname. How can I return the array I am looking for?

  • You might want to check out a plugin called inspector, which outputs all methods, attributes, etc, all nicely formatted. {{ currentUser.getContent()|inspect }} Apr 22, 2015 at 18:23

1 Answer 1


Custom field data is accessible via currentUser.getContent().

Using dump:

{{ dump(currentUser.getContent()) }}

Or to output as string:

{{ currentUser.getContent()|join(', ') }}
  • Cheers dump brings back the object. But the output as string fails with 'Array to string conversion' error. I've also tried: [code]{% set profile = currentUser.getContent() %} {% for key, value in profile %} {{ value }} {{ key }} {% endfor %}
    – Lettie
    Apr 23, 2015 at 11:18
  • Hmm... 'join' works fine for me on my test DB. Maybe one of the fields is being returned as an array. Possibly a matrix or table field? Apr 23, 2015 at 16:15
  • yep that is exactly what was happening. I added a check to see if any returned data was also an array and it now works fine. Thanks
    – Lettie
    Apr 28, 2015 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.