My block code is as follows:
mymodule_block_info() {
$blocks = array();
$blocks['my_contenttype_form_block'] = array(
'info' => t('My CustomContentType Add Form'),
'cache' => DRUPAL_CACHE_PER_PAGE,
);
return $blocks;
}
function mymodule_ui_block_view($block_name = '') {
global $user;
switch ($block_name) {
case 'my_contenttype_form_block':
module_load_include('inc', 'node', 'node.pages');
// Create a node for the content type.
$node = new stdClass();
$node->uid = $user->uid;
$node->name = (isset($user->name) ? $user->name : '');
$node->type = 'my_contenttype';
$node->language = LANGUAGE_NONE;
$block = array(
'subject' => t('Create New CustomContentType record'),
'title' => t('Create New CustomContentType record'),
'content' => drupal_get_form('my_contenttype_node_form', $node),
);
break;
}
return $block;
}
The "Groups audience" field is missing. It shows up in the standard add page (mysite.com/node/add/my_contenttype).
I've tried setting this programmatically via hook_form_alter, and also by setting the $form_state['values']['og_group_ref'][0], but nothing seems to work (although it makes sense that these approaches are failing when the field isn't even in the form.
Thanks in advance for the assist! Any thoughts as to why it's missing?