Open slugaboga opened 3 years ago
Thanks so much for sharing this @slugaboga. Just spent the past 2 hours trying to figure out what I was doing wrong.
@KittenCodes I've had this one come up a couple of times now. Not just with ACF, but when using a "Time" condition and a PHP Return Value as well.
Everything looks good when logged in, but not when logged out. It just won't show the content, even if the condition is supposed to evaluate as true.
My only workaround has been to convert my function into a shortcode. So I'll have something like:
<?php
function st_presentation_expiry() {
$format = "m/d/Y g:i a";
$starttime = get_field('presentation_time');
$expiry=strtotime($starttime) + 60*60*24;
$expiry_f = date($format, $expiry);
return $expiry_f;
}
add_shortcode('expirytime', 'st_presentation_expiry');
?>
Then in my condition, instead of using the PHP Return Value, I have to past my [expirytime] shortcode in the field:
@sunnyt7 There's a known issue where date conditions don't work for logged out users when the value is set dynamically. We're aware of this and we're currently internally testing a fix for it, but I don't have an ETA for when the fix will be released.
@sunnyt7 There's a known issue where date conditions don't work for logged out users when the value is set dynamically. We're aware of this and we're currently internally testing a fix for it, but I don't have an ETA for when the fix will be released.
@KittenCodes Sounds great, thanks!
I have encountered some related issues too with oxygen conditions. USER ID == get_the_author_ID (PHP Return Value) is not working properly for non Administrator Role users.
@KittenCodes I've had this one come up a couple of times now. Not just with ACF, but when using a "Time" condition and a PHP Return Value as well.
Everything looks good when logged in, but not when logged out. It just won't show the content, even if the condition is supposed to evaluate as true.
My only workaround has been to convert my function into a shortcode. So I'll have something like:
<?php function st_presentation_expiry() { $format = "m/d/Y g:i a"; $starttime = get_field('presentation_time'); $expiry=strtotime($starttime) + 60*60*24; $expiry_f = date($format, $expiry); return $expiry_f; } add_shortcode('expirytime', 'st_presentation_expiry'); ?>
Then in my condition, instead of using the PHP Return Value, I have to past my [expirytime] shortcode in the field:
@sunnyt7 thanks, I'm using shortcode as a temporary solution.
Custom conditoin not working width ACF. Callback function oxygen_vsb_register_condition, not $value. When login superadmin $value worked. But login other roles, $value empty. Temporary salution: use ACF shortcode [acf field="field_name" post_id="123"] instead Oxygen shortcode
oxygen_vsb_register_condition( 'Show?', array( 'options'=>$roles, 'custom'=>true), array('==','!='), 'show_user_callback', 'User' ); function show_user_callback($value, $operator) { var_dump($value.'55'); var_dump($operator); $user = get_userdata( get_current_user_id() ); if ( is_user_logged_in() && in_array($value, $user->roles) ) { return true; }else{ return false; } }