Home Forums General Issues User Field (Relational) Reply To: User Field (Relational)

  • thanks john,

    turns out i hadn’t gotten as far as i thought earlier – i’ve added a new user and alternated the calls in the repeater field to check the results but it seems i’m calling only one user all the time:

    my guess is that i’m somehow calling the author of the page in question over the author specified in the sub field, but i can’t see how. have i missed something really obvious?

    here’s where my code is at for that part of the page template.

    <?php if( have_rows('author_profiles') ): ?>
      <div class="ca">
        <div id="pagebody">
          <h3>The Tap The Feed Team</h3>
          <?php while ( have_rows('author_profiles') ) : the_row(); ?>
          <div class="infoauthor">	
            <div class="infoauthorimg">
              $users = get_sub_field('author');
              echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 120 ) );
          <div class="infoauthorcopy">	
            <h4 class="nopad"><a href="<?php $users = get_sub_field('author'); echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php $users = get_sub_field('author'); echo the_author_meta( 'display_name' ); ?></a></h4>
            <p class="nopad"><?php the_sub_field('title'); ?></p>
            <p class="nopad"><a href="<?php $users = get_sub_field('author'); echo the_author_meta( 'user_url' ); ?>" target="_blank"><?php $users = get_sub_field('author'); echo the_author_meta( 'user_url' ); ?></a></p>
            <p><a href="<?php $users = get_sub_field('author'); echo the_author_meta( 'twitter' ); ?>" target="_blank">@<?php $users = get_sub_field('author'); echo the_author_meta( 'twitter' ); ?></a></p>
            <p><?php $users = get_sub_field('author'); echo the_author_meta( 'description' ); ?></p>	
        <?php endwhile; ?>
    <?php else : endif; ?>

    the role of each author (editor, sub-editor etc.) is a text field within the same repeater, and this is being called correctly, so i’m pretty sure the repeater is running as it should but i just haven’t targeted the author info within it, which would cause the code to fall back on the metadata for the page author i guess.

    as you can see, i’ve not added in those checks yet but your suggestion is pretty clear and makes sense to me. i’m assuming both for this and for the above (line 14) that if i have to specify the author ID in a changing repeater field then get_author_posts_url( get_the_author_meta( ‘ID’ ) ); will call it from the author in the sub field if used correctly?

    the trick is using it correctly, right?

    thanks again.