I used
<?php echo $curauth->profile-department-one; ?>
within the loop, but no results (it either throws Array, or 0).
There is nothing in the ACF documentation to help with this…
Hi Miguel,
I found this but can’t seem to figure out how to integrate a call to get user id:
/*
* Displaying multiple values
*/
?>
<p>Colors: <?php echo implode(', ', get_field('page_layout')); ?></p>
<?php
The above code was found at: http://www.advancedcustomfields.com/resources/field-types/select/
but you are correct. There is no documentation for displaying multi select values for user meta
I tried that too, but threw an error. The guys at ACF are not responding either, so I am all at sea… One would think this is a common occurrence, and it merits some documentation… I am sure lots of people out there are in the same predicament…
I agree. I posted this help request and another one at the advancedcustomfields.com website. No response from anyone. It’s kind of strange. Glad that you responded. At least I’m not the only one finding this to be a head-scratcher.
Ok, here is the solution (works outside the loop):
<?php echo implode(', ', get_the_author_meta('your_custom_field')); ?>
Great! But I tried it and I’m not getting any values returned. It’s just blank. My custom field is a drop down select menu. My user has selected 3 out of 5 options in this menu and saved them. The above code doesn’t yield any result.
Is it working for you?
It is working perfectly for me, and it is the same kind of multiple-choice select.
Maybe you haven’t preceded it by this?
<?php
$curauth = (isset($_GET['author_name'])) ? get_user_by('ID', $author_name) : get_userdata(intval($author));
?>
Ahhh, that might be the problem. I haven needed to use that one on this author.php page. I have around 400 plus fields. All work except the multis. Ill give it a try.
still getting blank. this what i have:
<?php
$curauth = (isset($_GET['author_name'])) ? get_user_by('ID', $author_name) : get_userdata(intval($author));
?>
<div class="thelabels">Relatives who also experience Albinism </div><div class="response"><?php echo implode(', ', get_the_author_meta('genetics_conditions_albinism_relatives')); ?></div>
That’s about right, yes. You must have configured the custom field incorrectly in ACF. I can confirm the code works perfectly.
Not sure how a field could be configured incorrectly if it is showing up where it needs to show up.
I’ve configured:
Field Name: genetics_conditions_albinism_relatives
Field Label: Relatives
Field Type: Select
Choices: name : name, etc.
Allow Null?: None
Select Multiple values: yes
Conditional Logic: No
I created a different role type and assigned a single custom field of checkboxes to it. I then created an empty author template specifically for this tempalte containing only the following code:
<?php
$curauth = (isset($_GET['author_name'])) ? get_user_by('ID', $author_name) : get_userdata(intval($author));
?>
<?php echo implode(', ', get_the_author_meta('test')); ?>
On the backend I checked 3 out of 5 checkboxes. Still I get a complete blank.