Home › Forums › General Issues › Featured Profiles Section › Reply To: Featured Profiles Section
Update:
So far I have been able to find a way to pull in the name and gravatar image. However instead of the gravatar I want to be able to pull the image the user set on a subfield within a repeater. My users have a front-end form they setup for their profile, and there user image is what I want to pull in.
Currently working, not ideal:
$profilepic = get_sub_field('picture' );
$users = get_field("florida");
?>
<div class="avatar">
<span>
<?php
$user = wp_get_current_user();
if ( $user ) :
?>
<img src="<?php echo esc_url( get_avatar_url( $user->ID ) ); ?>" />
<?php endif; ?>
</span>
</div>
<div class="avatar-details">
<span>
<?php if( $users ): ?>
<?php foreach( $users as $user ): ?>
<a href="<?php echo esc_attr($user->user_url); ?>"><?php echo $user->display_name; ?></a>
</span>
<?php endforeach; ?>
</div>
<?php endif; ?>
Almost working? :
$users = get_field("florida");
?>
<div class="avatar">
<?php if( have_rows('contact_details', 'user_'. $author_id )): ?>
<div>
<?php while ( have_rows('contact_details', 'user_'. $author_id )): the_row();
$author_id = get_the_author_meta('ID');
$profilepic = get_sub_field('picture', 'user_'. $author_id ); ?>
<span>
<img src="<?php echo $profilepic; ?>" />
</span>
<?php endwhile; ?>
<?php endif; ?>
</div>
<div class="avatar-details">
<span>
<?php if( $users ): ?>
<?php foreach( $users as $user ): ?>
<a href="<?php echo esc_attr($user->user_url); ?>"><?php echo $user->display_name; ?></a>
</span>
<?php endforeach; ?>
</div>
<?php endif; ?>
So i think the issue is it doesen’t see the rows, so anything after <?php if( have_rows('contact_details', 'user_'. $author_id )): ?>
seems to get removed and doesent show within inspect?
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.