diff --git a/invite_og_plugin.module b/invite_og_plugin.module
index e9dddaf..f86b148 100644
--- a/invite_og_plugin.module
+++ b/invite_og_plugin.module
@@ -25,9 +25,10 @@ function invite_og_plugin_invite_accept($invite, $account) {
     $group_permission = 'invite';
 
     foreach ($groups as $gid) {
+      list($entity_type, $entity_id) = split('_', $gid);
       // If we are authorized to add a new user, we add this group to our array.
-      if (og_user_access($gid, $group_permission, $invite->inviter)) {
-        og_group($gid, array("entity" => $account));
+      if (og_user_access($entity_type, $entity_id, $group_permission, $invite->inviter)) {
+        og_group($entity_type, $entity_id, array("entity" => $account));
       }
     }
   }
@@ -56,18 +57,24 @@ function invite_og_plugin_form_alter(&$form, &$form_state, $form_id) {
     $groups = array();
 
     // Get all the groups and check if we are authorized to invite a user into.
-    $all_groups = og_get_all_group();
-    $group_permission = 'invite';
-    global $user;
 
-    foreach ($all_groups as $gid) {
-      // If we are authorized to add a user, we add this group to our array.
-      if (og_user_access($gid, $group_permission, $user)) {
-        $cur_group = og_load($gid);
-        $groups[$gid] = $cur_group->label;
+    // First get group entity types
+    $entity_types = og_get_all_group_entity();
+    $group_permission = 'invite';
+
+    foreach ($entity_types as $entity_type => $entity_type_label) {
+
+      $all_groups = og_get_all_group($entity_type);
+      global $user;
+
+      foreach ($all_groups as $gid) {
+        // If we are authorized to add a user, we add this group to our array.
+        if (og_user_access($entity_type, $gid, $group_permission, $user)) {
+          $cur_group = entity_load_single($entity_type, $gid);
+          $groups[$entity_type . '_' . $gid] = $cur_group->title;
+        }
       }
     }
-
     // Add the multiselect form element.
     $form["organic_groups"] = array(
       '#type' => 'select',
@@ -110,7 +117,8 @@ function invite_og_plugin_invite_send($invite, $send) {
     /* We need to check again, if the user is authorized to add user into this
     group, otherwise anyone could just change the POST-Parameters. */
     foreach ($_POST["organic_groups"] as $gid) {
-      if (og_user_access($gid, $group_permission, $user)) {
+      list($entity_type, $entity_id) = split('_', $gid);
+      if (og_user_access($entity_type, $entity_id, $group_permission, $user)) {
         array_push($groups, $gid);
       }
     }
