I can't count the members of a smartgroup as an anonymous user. I've tried to assign "view" privilege and assigned it to all users, but it still can't count the group. The code snipet here, no longer works with CiviCRM 1.6:
My code can be found in the Drupal CVS repositories:
You can see a test scenerio at: http://drupal5.douggreenconsulting.com. The last block at the bottom of the page is a smartgroup that was generated from the "Active Users" group and should have 1 member in it. When I'm logged in, it displays 2, and when I'm not logged in, it displays 0.
You can also read the Drupal bug thread here: http://drupal.org/node/107082
I'm not sure that this is related, but I also get the following errors:
Warning: Invalid argument supplied for foreach() in /.../modules/civicrm/CRM/Core/BAO/Mapping.php on line 587
Warning: Invalid argument supplied for foreach() in /.../civicrm/CRM/Core/BAO/Mapping.php on line 663