--- og_content_type_admin.module.orig 2009-10-15 14:04:26.000000000 +0300 +++ og_content_type_admin.module 2010-02-15 12:18:33.000000000 +0200 @@ -1094,10 +1094,27 @@ function og_content_type_admin_form_alte $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_admin_is_admin() if (!empty($form['og_nodeapi']['visible']['og_groups']['#options'])) { - foreach ($form['og_nodeapi']['visible']['og_groups']['#options'] as $nid => $name) { + _og_content_type_admin_form_alter($form['og_nodeapi']['visible']['og_groups']['#options'], $form['type']['#value']); + } + } +} // function og_content_type_admin_form_alter() + + //Helper/ utility functions------------------------------------------------------------------------------- + //Functions that help those above and don't accomplish directly any of the design items + +/** + * Helper function for og_content_type_admin_form_alter(). + */ +function _og_content_type_admin_form_alter(&$form, $type) { + if (is_array($form)) { + foreach ($form as $nid => $name) { + if (is_array($name)) { + _og_content_type_admin_form_alter($name, $type); + } + else { //see if they can add this content-type for this group + $group = new stdClass; // used for call _og_content_type_admin_is_admin() $group->nid = $nid; if (_og_content_type_admin_is_admin($group)) { continue; @@ -1109,17 +1126,14 @@ function og_content_type_admin_form_alte $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 + if (empty($activated_types[$type])) { + unset($form[$nid]); // remove the checkbox to add this content to the og } } } } } -} // function og_content_type_admin_form_alter() - - //Helper/ utility functions------------------------------------------------------------------------------- - //Functions that help those above and don't accomplish directly any of the design items +} // function _og_content_type_admin_form_alter() /** * Return an array containing all groups that we're monitoring. Suitable for a form item.