Support

Account

Home Forums Front-end Issues User field displaying "Array"

Helping

User field displaying "Array"

  • I’m using a user field to display a user’s first and last name. The name is displayed but there is an Array field before it :

    My code:

    	<?php echo
    		$users = get_field('formateur');
    foreach ($users as $user) {
      $posts = get_field('sessions_a_venir', $user);
    }
    if( $user ): ?><?php echo $user['user_firstname']; ?>  <?php echo $user['user_lastname']; ?>
       
        <?php endif; ?>

    The result(Ex: Formateur ArrayJohnDupond)

    Thank you in advance

  • Could you show us more context, please? It seems like that’s something outside of the code you provided. What code comes before that?

    Edit: Oh, wait, I just saw this:
    You are doing <?php echo in the very beginning. Remove that echo statement and see if that helps.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘User field displaying "Array"’ is closed to new replies.