Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
How can i check if user is a member of a group or not?
I want to show different thing to both of them.
Thank you very much!
Comments
Comment #1
amitaibuog_is_member()
Comment #2
WEBstar CreditAttribution: WEBstar commentedYes...
But where do i put this?
Comment #3
amitaibuFeel free to look at the tests that show how to use the API.
Comment #4
WEBstar CreditAttribution: WEBstar commentedWhere can i find them?
Thank you!
Comment #5
WEBstar CreditAttribution: WEBstar commentedI tried this one:
But not working... I get an error: Illegal offset type in og_get_entity_groups() (line 1986 ... )
Comment #6
balagan CreditAttribution: balagan commentedI don't know what you want to show them, but maybe you can try to use the views module for this.
Comment #7
WEBstar CreditAttribution: WEBstar commentedsimple text..
Comment #9
alienzed CreditAttribution: alienzed commentedI got that too... ever figure this out?
Comment #10
simon_j_nichols CreditAttribution: simon_j_nichols commentedamitaibu is referring to the og.test file in the module directory. Great source of api calls
og_is_member documentation can be found here
http://www.drupalcontrib.org/api/drupal/contributions%21og%21og.module/f...
Very quick look at your example I would suggest trying og_is_member('node', '19', 'user', $account))
Comment #11
Bhanuji CreditAttribution: Bhanuji as a volunteer commentedwe have a function.
og_is_member('node', $gid, 'user', $user)
Return TRUE if a user belongs to a group.
For reference please check og_is_member()
Comment #12
Rahulmon JohnsonHow it check in group module???