Hello, I have a dynamic condition that was working, before the last couple of updates but has stopped working. It returns a 0 or a number, then I check if it is greater than or equal to 1. This is then combined with two other statements- one being another dynamic condition that does work.
{echo:get_unpublished_summaries_for_bricks}
=1
Is there an issue with passing multiple functions as conditions?
Is there an issue returning a number?
Since it used to work, I do not think it is the code:
//For Bricks logic to show a container or not
function get_unpublished_summaries_for_bricks() {
$current_user_id = get_current_user_id();
if (!$current_user_id) {
return '0';
}
$post_author_id = get_post_field('post_author', get_the_ID());
if (is_page('manage')) {
$post_author_id = $current_user_id;
}
if ($current_user_id == $post_author_id) {
$args = array(
'post_type' => 'research',
'author' => $post_author_id,
'post_status' => ['pending', 'review', 'started', 'draft'],
'posts_per_page' => -1,
);
$research_query = new WP_Query($args);
$unpublished_count = $research_query->post_count;
return $unpublished_count;
}}
And I have it in the echo functions filter:
add_filter( 'bricks/code/echo_function_names', function() {
return [
'get_unpublished_summaries_for_bricks',
];
} );
I have 3 AND statements and then multiple OR with the same statements, except with different user roles.
Eg[ {echo:get_user_role_for_bricks} contains administrator AND
{echo:get_unpublished_summaries_for_bricks} >=1 AND
User ID == {author_meta:ID} ]
OR [ {echo:get_user_role_for_bricks} contains contributor AND
{echo:get_unpublished_summaries_for_bricks} >=1 AND
User ID == {author_meta:ID} ] OR
[ {echo:get_user_role_for_bricks} contains editor AND
{echo:get_unpublished_summaries_for_bricks} >=1 AND
User ID == {author_meta:ID} ] etc