Accessing current users custom field

by Robster   Last Updated July 08, 2017 13:10 PM

I´ve added a custom users field (called "test"). Now I want to call the value of this custom field for the current user who is logged in.

In the mysql databse I see the custom field under _fields. So how can I call this specific field?

Normally I get the current user object like this:


Answers 1

Basically you have all the custom fields corresponding to the current item accessible via a new property in your $item variable called jcfields. The $item->jcfields property is an array that holds data per field.

You could output the fields this way:

<?php foreach ($this->item->jcfields as $field) : ?>
// Render the field using the fields render method
<?php echo $field->label . ':' . $field->value; ?>
<?php endforeach ?>


Wim de Ruijter
Wim de Ruijter
July 27, 2017 13:34 PM

Related Questions

Custom form field not working on server

Updated April 26, 2017 10:10 AM