Home › Forums › General Issues › Showdown content if current user.. › Reply To: Showdown content if current user..
Hi VoiD2008, thank you for your reply.
Unfortunately it doesn’t work, and my php knowledge is not good enough to fix it.
I should insert a control to check if the array exists or not I think..
If I use this code, that works only with one username in that field,
<?php
global $current_user;
get_currentuserinfo();
if ($current_user->user_login == 'get_field(mustjoin)') { ?>
<?php while ($day['events']->have_posts()) : $day['events']->the_post() ?>
<?php tribe_get_template_part('month/single', 'event') ?>
<?php endwhile; ?>
<?php } ?>
Everything works.
Of course, with two usernames in the field, it doesn’t. But I don’t receive an error.. it just works as it should, because it checks for an username made by the 1st+2nd usernames together.
With a
var_dump( get_field('mustjoin') );
I receive this :
string(17) "User1 User2 User3"
Thank you for your help.
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.