When I am logged in as a member of Admin group the following returns a count that is different from, when i am logged in as member of some group that is also a group member of cons!ALL_USERS
Any idea why those count could be different ?
count( a!groupmemers( group: cons!ALL_USERS, direct: false, memberType: "USER" ))
Discussion posts and replies are publicly visible
This is because a!groupmembers() function can only return members of the group which loggedInUser is part of, so it might be that there are some groups in All User system group for which the other user do not have permission that's why there is a count difference.
This is not completely true. a!groupmembers can only return members which are visible to the user in whose context the function is called.
Now the term "visible" becomes complicated because of multiple overlapping settings and security. There is group privacy and visibility, as well as a general configuration whether users are visible to each other in the admin console.