est3ban129
Well-known member
Hi,
I'm trying to create a widget that displays the values of a custom user field for each user. The custom field is a checkbox field (
Here’s what I want to achieve:
Here’s the code I’m trying to use in the widget template:
The issue is that the custom field always appears empty, even though users have selected values. I’ve confirmed in the admin panel that the field is properly set up, and users have selected options.
What I've checked:
1. The custom field ID (
2. Users have values selected for this field.
3. The field is set to display in “Personal details” and should be accessible.
Goal:
I want each user to see their own selected values from the
Any help or guidance would be greatly appreciated!
I'm trying to create a widget that displays the values of a custom user field for each user. The custom field is a checkbox field (
servercustomfield
) with multiple options (e.g., 1, 2, 3, etc.). Each user can select one or more options, and I want to display the values they have selected.Here’s what I want to achieve:
- For each user, show the values they’ve selected in this custom field as a list.
- If a user hasn’t selected anything, display a message like “No servers assigned.”
Here’s the code I’m trying to use in the widget template:
HTML:
<h3>Servers of each user</h3>
<xf:foreach loop="$users" value="$user">
<div>
<h4>{$user.username}</h4>
<xf:if is="!empty($user.custom_fields.servercustomfield)">
<p>Assigned servers:</p>
<ul>
<xf:foreach loop="$user.custom_fields.servercustomfield" value="$server">
<li>{$server}</li>
</xf:foreach>
</ul>
<xf:else />
<p>No servers assigned.</p>
</xf:if>
</div>
</xf:foreach>
The issue is that the custom field always appears empty, even though users have selected values. I’ve confirmed in the admin panel that the field is properly set up, and users have selected options.
What I've checked:
1. The custom field ID (
servercustomfield
) is correct.2. Users have values selected for this field.
3. The field is set to display in “Personal details” and should be accessible.
Goal:
I want each user to see their own selected values from the
servidoresplex
field in the widget. How can I make sure the custom field data is properly loaded and displayed for each user?Any help or guidance would be greatly appreciated!