I have used OG module to implement the Groups functionality. I want to get:

  1. Count of all groups that are there on the website
  2. 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);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.