Drupal 7 Lists the organic groups current user is a member

2.8k views Asked by At

I want show in profile page the lists of organic groups that current user is a member. By default if i call <?php print render($user_profile); ?> on my result i have one field with the list of my groups membership. But I can not intercept the function or variable that generates this result. How i can obtain this with drupal 7? thanks in advance!

2

There are 2 answers

0
AudioBubble On BEST ANSWER

I found the direct access for this

<?php print render ($user_profile['og_user_node']); ?>

Or we can also create a simple view block for profile page..the og module already provides these views by default.

1
Sumoanand On

You can use og_get_groups_by_user() to get group of current user.

$groups = og_get_groups_by_user($account);

This will return group IDs of all the groups this user is an approved member of.