How to use extended fields with Fenom syntax?

I have some extended fields that I created for users. I am using the Profile snippet from the login package in order to display a specific user’s extended fields.


[[!Profile? &user=`123`]]

[[- extended fields are now available as placeholders ]]


I am using fenom and would like to store the processed values of these placeholders into fenom varialbles.


{var $residence = '[[+residence]]'}
{var $employment = '[[+employment]]'}

I’ve discovered that the literal [[+placeholder]] placeholders are being stored in the fenom variables instead of the processed values, which doesn’t allow me to use fenom to manipulate the stored data the way that I need to.

Is there a was to either access the extended fields using fenom initially, or a way to store their processed modx tag values into fenom placeholders?

Can’t you use the placeholders directly like this?

{'!Profile' | snippet : [
    'user' => 123,

{'residence' | placeholder}
{'employment' | placeholder} 

Thank you! I have implemented this and believe it’s working, however, I’m having an issue with one of the extended fields that holds multiple values. The field is called ethnicities and can hold 1 or more values (or be blank) depending on the user. For example, one user has multiple values stored and it appears like this:

["African Heritage","European Heritage","Hispanic Heritage","Native Heritage"]

I thought this to be a json array, but when using {$ethnicity|gettype}, it’s actually a string. Is there a way to read this as an array so that I can loop through and format the data as needed. I would like to display the data either in a list or comma-separated on the front end.

Thank you for you help!

I believe with Fenom you can do something like this:

{var $residences = 'residence' | placeholder | fromJSON }
{if $residences}
        {foreach $residences as $residence}

Or there is always the possibility to write a custom snippet with PHP.

Thank you! I was able to use:

{var $ethnicities = 'ethnicity' | placeholder | json_decode}

{if $ethnicity} 
        {foreach $ethnicities as $ethnicity}

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.