Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have created a custom user profile field

<?php $basics = get_the_author_meta( 'fbasics', $user->ID ); ?>
    <ul>
        <li><input value="lesson1" name="fbasics[]" <?php if (is_array($basics)) { if (in_array("lesson1", $basics)) { ?>checked="checked"<?php } }?> type="checkbox" /> <?php _e('Lesson 1', 'gprofile'); ?></li>
        <li><input value="lesson2" name="fbasics[]" <?php if (is_array($basics)) { if (in_array("lesson2", $basics)) { ?>checked="checked"<?php } }?> type="checkbox" /> <?php _e('Lesson 2', 'gprofile'); ?></li>
    </ul>

I now need to use the data on the front end of wordpress to display information. I think I need to use the get_user_meta() function but I do not understand how to use is to get the value of an array.

How to get data from an array using get_user_meta()?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

The function is <?php get_user_meta($user_id, $key, $single); ?>

The $single is a boolean that returns a single value for true or an array if set to false, in your case you would set it to false.

$user_output =  get_user_meta($user_id, 'fbasics', false);
 var_dump($user_output);
share|improve this answer
    
Perfect, thanks that worked. –  Nick May 12 '12 at 7:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.