Home › Forums › General Issues › AWESUM! › Reply To: AWESUM!
Etic your code did not work. It was still not outputting the expiration date when Credentials was set to expired.
As I mentioned I’m barely a novice at PHP. After some hours using Google I was able to modify what you gave me into this, and it appears to work:
<?php
$args = array(
'orderby'=>'nicename',
'role'=>'instructor'
);
$users = get_users( $args );
foreach ( $users as $user ) {
print($user->display_name);
the_field('credentials', 'user_'.$user->ID);
if (get_field('credentials', 'user_'.$user->ID) == 'expired')
the_field('credentials_expired_date', 'user_'.$user->ID);
the_field('background_check_status', 'user_'.$user->ID);
echo '<br/>';
}
?>
As I add more fields using ACF I’d like to copy/paste/modify so as to output those fields too. But because it appears different than what you suggested, could you confirm this is correct coding?
My page output now for Credentials current & Background expired is (still needs CSS):
Lisa RhodescurrentExpired
Output for Credentials expired & Background current:
Timmy Biggsexpired20130802Current
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.