Home › Forums › General Issues › Display Name and role using a user field › Reply To: Display Name and role using a user field
Thank you John for your answer!
You’re right, the field returns an array.
This is the code I’ve used, then:
<?php foreach ($user as $user): ?>
<li>
<p><?php echo $user['display_name'];
echo 'User roles: ' . implode(', ', $user_info['roles']) . "\n";?>
</p>
</li>
<?php endforeach; ?>
And got this error message:
Warning: implode(): Invalid arguments passed in /home/volunta6/staging/1/wp-content/plugins/acf-enhanced-message-field/acf-enhanced-message-v5.php(56) : eval()’d code on line 38
Any further help on this would be very appreciated!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.