How to get a count of groups that user has joined? I have used OG module to implement the Groups functionality. I want to get:


Count of all groups that are there on the website
Count of groups that a user has joined


How can I do this?

Note:
My preference would be to use an existing function (if there is any).
To get Count of all groups....

$groups = og_get_all_group($group_type = 'node');
$count = count($groups);


To get User Groups Count

$user_groups = og_get_groups_by_user();
$user_count = count($user_groups);