This seems like it should be a simple operation, but I must be completely blind because I can't find anything about it in the API docs at http://www.drupalcontrib.org/api/drupal/contributions!og!og.module/7.

I have a $gid. I need to check if it really is the gid of a valid group, and have access to the group information if it is.

I did find an old post somewhere saying to use og_load(), but that is out of date -- that function does not exist in the current API. Nor can I find a function with similar functionality.

There has to be a simple way to do this; it's hardly an outlier use-case. What am I missing?


You don't need to use group_load anymore! Use node_load instead. You gid is equivalent to nid.

  • With node_load .. It dosn't display if current user (subscribe or not) .. – a.alshamiri Mar 26 '17 at 14:21

you could use og_get_group() http://api.drupalhelp.net/api/og/og.module/function/og_get_group/7 API to get the og group. It Return a loaded group entity if exists or create a new one.

  • Actually, that's the 7.x 1.0 API. That function no longer exists in the 7.x 2.0 API. – LindaJeanne Mar 18 '16 at 12:57

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.