diff -ru ./og_content_type_admin-5.x-1.x_20060524/og_content_type_admin.module ./og_content_type_admin/og_content_type_admin.module --- ./og_content_type_admin-5.x-1.x_20060524/og_content_type_admin.module 2007-05-23 15:32:11.000000000 -0700 +++ ./og_content_type_admin/og_content_type_admin.module 2007-05-29 13:53:33.000000000 -0700 @@ -946,6 +946,29 @@ if ($form_id == 'og_admin_settings') { $form['#submit']['_og_content_type_admin_rebuild_table'] = array(); } + elseif (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) { + $group = new stdClass; // used for call _og_content_type_is_admin() + if (!empty($form['og_nodeapi']['visible']['og_groups']['#options'])) { + foreach($form['og_nodeapi']['visible']['og_groups']['#options'] as $nid => $name) { + //see if they can add this content-type for this group + $group->nid = $nid; + if (_og_content_type_is_admin($group)) { + continue; + } + else { + //see if they are allowed to add this content type + $sql = "SELECT octa.types_active FROM {og_content_type_admin} octa WHERE octa.gid = %d"; + if (!$result = db_fetch_object(db_query($sql, $nid))) { + $result = db_fetch_object(db_query($sql, 0)); + } + $activated_types = unserialize($result->types_active); + if (empty($activated_types->{$form['type']['#value']})) { + unset($form['og_nodeapi']['visible']['og_groups']['#options'][$nid]); // remove the checkbox to add this content to the og + } + } + } + } + } } // function og_content_type_admin_form_alter() //Helper/ utility functions-------------------------------------------------------------------------------