I have a error that keeps popping up through my website after I added tags to print custom user profile fields. The code i'm using is
<?php
global $user;
$user_fields = user_load($user->uid);
$name = $user_fields->field_name;
$department = $user_fields->field_department;
?>
<?php
to pint the fields i'm using
<?php print $name['und'][0]['value'];?>
<?php print $department['und'][0]['value'];?>
i'm not sure if this is the correct way to do this or if there is a better way. I tried to remove [0] and the tag no longer works. I have also tried to use the following:
<?php if (!empty($action_links)): ?>
<?php print $name['und'][0]['value'];?>
<?php endif ?>
This again did not display the custom field.