I installed this module on our site and it works fine for admin users, but not for anonymous or other users without admin rights. The can see the block, but all counters are 0.
This is probably some setting in the acces control, but I can't figure out which one it is. Have been experimenting with the CiviCRM access right, but without unsuccessfull. As far as I can see, this is not documented anywere.
Can you please give me a point me in the right direction for this one?
Thanks.

Luc

(Tested on Drupal 4.7.5, CiviCRM 1.6)

Comments

GregoryHeller’s picture

You must grant all users, including anon users the "view contacts in [your group]" permissions in "admin/access" in order for users to see the count of contacts in [your group].

stroobl’s picture

That's strange, I only have this options for the CiviCRM module:

access CiviCRM
access CiviMail
access CiviMember
access uploaded files
add contacts
administer CiviCRM
edit all contacts
edit groups
edit memberships
import contacts
profile listings and forms
view all contacts

While I have 2 'normal' groups and 3 smart groups.

GregoryHeller’s picture

I am not sure why you are not seeing access options for:

edit contacts in Confirmed Users
view contacts in Confirmed Users

and similar options for all of your groups.

stroobl’s picture

In CiviCRM 1.6, the ACLs seem to be moved to the integrated CiviCRM access control module. (many thanks to Dave Greenberg on civicrm-dev to point that out ;-)

I tried to get your module working with CiviCRM 1.6, but it seems to fail, even after adding the group view permission to other users. I guess the changed ACL functions breaks civicrm count block?

douggreen’s picture

I'm not able to reproduce your problem. I reinstalled CiviCRM 1.6 on a Drupal 5 rc2 site and all seems to work fine for me. See the two blocks on the bottom left at http://drupal5.douggreenconsulting.com/.

Try setting the 'Count Precision' to "exact"; the default is to round to the nearest hundred, so if you have less than 50 people in your group, it will show 0.

stroobl’s picture

I think I found out what's wrong: CiviCRM count block probably has problems counting members in smart groups. Is it possible that it doesn't always count the members based on search criteria (unless you're an admin)?
Since I added the groups to our user profile and selected that particular group for two users, the counter says "2" now. The other users in the group (based on a field set in there profile) are ignored now.

When counting for a normal group and not a smart group, everything seems to work as expected.

GregoryHeller’s picture

On http://www.defectivebydesign.org the count block on the right hand side is displaying the count of users in a smart group. However this site is not yet using civicrm 1.6.

I have just checked on drupal 1.6 and indeed the access controls are different.
It seems that there is no way to grant any permissions to anonymous users under civicrm 1.6. Without the ability to grant permission to anonymous users, I don't think that this module will work as written.

douggreen’s picture

Title: Counters are always 0 for non admin users / Access rights? » Counters are always 0 for non admin users / Access rights for CiviiCRM 1.6 and smartgroups?
douggreen’s picture

Title: Counters are always 0 for non admin users / Access rights for CiviiCRM 1.6 and smartgroups? » Access rights for CiviCRM 1.6 and smartgroups?
douggreen’s picture

Thanks for reporting this! I've been able to reproduce with CiviCRM 1.6 smartgroups on Drupal 4.7 and Drupal 5.0.

Additionally, I get the following CiviCRM error.

warning: Invalid argument supplied for foreach() in /.../modules/civicrm/CRM/Core/BAO/Mapping.php on line 587.
warning: Invalid argument supplied for foreach() in /.../modules/civicrm/CRM/Core/BAO/Mapping.php on line 663.

I'll report the above problem and work with the CiviCRM team to find a solution to the smartgroup counting.

douggreen’s picture

Assigned: Unassigned » douggreen
Priority: Normal » Critical
douggreen’s picture

Priority: Critical » Normal
Status: Active » Closed (fixed)

The temporary solution is to grant anonymous users permission to "View All Contacts". Another option is to manually patch CiviCRM shown in CRM-1535. The long term solution is to implement CiviCRM Access Control List's (ACL's) for anonymous users, which, after some discussion may be under consideration for CiviCRM 1.7.

Since this was posted as a Drupal issue, since there is a Drupal work-around, and since the solution really lies with CiviCRM, I'm closing this issue.