Closed (fixed)
Project:
OG Forum
Version:
5.x-1.3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
3 May 2007 at 16:08 UTC
Updated:
3 May 2007 at 16:49 UTC
when going to a page like "node/add/forum/89" My secondary select box of taxonomy was getting deleted. I found that when I changed this one line of code it fixed it.
So I am subbmitting this as a bug fix. I am not sure if I removed some functionality, but my site appears to be working now with this patch applied
function og_forum_form_alter($form_id, &$form) {
// Auto-select group's forum when adding/editing a forum topic
if ($form_id == 'forum_node_form') {
$gid = db_result(db_query("SELECT nid FROM {og_term} WHERE tid = %d", arg(3)));
if (!empty($gid)) {
$group = node_load($gid);
og_set_group_context($group);
$vid = _forum_get_vid();
$old_form = $form['taxonomy'][$vid];
- foreach ($form['taxonomy'] as $key => $value) {
+ foreach ($form['taxonomy'][$vid] as $key => $value) {
if (substr($key, 0, 1) != '#') {
- unset($form['taxonomy'][$key]);
+ unset($form['taxonomy'][$vid][$key]);
}
}
$form['taxonomy'][$vid] = $old_form;
if (user_access('administer organic groups') || variable_get('og_audience_checkboxes', TRUE)) {
$form['og_nodeapi']['visible']['og_groups']['#default_value'][] = $gid;
}
else {
$form['og_nodeapi']['invisible']['og_groups']['#default_value'][] = $gid;
}
$form['og_nodeapi']['#collapsed'] = $gid ? TRUE : FALSE;
}
}
}
Comments
Comment #1
markDrupal commentedI found a whole different chunk of code that worked better.