I have found many examples about how to add a user to an organic group but I can't find any info on how to remove a user from an organic group programmatically. Does anyone have an example of how to do this?
1 Answer
Part of me thinks that og_membership_delete
would be a good option, you can pass the entity ID in as a parameter (and by "can", I really mean "need to"). Also, og_ungroup
seems useful as well.
You can find more functions that OG defines at: http://www.drupalcontrib.org/api/drupal/contributions!og!og.module/7
Here's an example of og_ungroup
:
og_ungroup('node', $gid, 'user', $uid);