NO BUG: My dynamic conditions that I echo no longer work

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

Hi @yasmine,

did you also whitelist get_user_role_for_bricks function?

Additionally, can you just try to return some number from that function, just to test if that’s working?

–
Matej

Hello, thank you for your reply - I tried returning the value (which worked). So I tried to make it work by deleting and readding the condition with a !=0, and then when I returned back to >=1 it just started working again and I really don’t understand why ! But it now works and apologies for this unnecessary bug request

Hehe, ok. No worries. I’ll mark this topic as no bug then :slight_smile:

Matej