diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-04-14 15:51:21 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-04-14 15:51:21 +0000 |
commit | 0ad37ad057018eeed7a0734b98bda273f5f30aae (patch) | |
tree | 1cf83e27930cfa447906ebb4a1952f7167c4863e /modules/forum/forum.module | |
parent | 28fb603ae34c22ef10739a4f1f2500125985e51e (diff) | |
download | brdo-0ad37ad057018eeed7a0734b98bda273f5f30aae.tar.gz brdo-0ad37ad057018eeed7a0734b98bda273f5f30aae.tar.bz2 |
#652372 by matason, ksenzee, naxoc, jpmckinney, sun: Don't allow users to add forum topics when no forums exist.
Diffstat (limited to 'modules/forum/forum.module')
-rw-r--r-- | modules/forum/forum.module | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/forum/forum.module b/modules/forum/forum.module index c278c946b..10d55b1a3 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -299,7 +299,13 @@ function forum_node_validate($node, $form) { if (!empty($node->taxonomy_forums[$langcode])) { // Extract the node's proper topic ID. $containers = variable_get('forum_containers', array()); - foreach ($node->taxonomy_forums[$langcode] as $item) { + foreach ($node->taxonomy_forums[$langcode] as $delta => $item) { + // If no term was selected (e.g. when no terms exist yet), remove the + // item. + if (empty($item['tid'])) { + unset($node->taxonomy_forums[$langcode][$delta]); + continue; + } $term = taxonomy_term_load($item['tid']); $used = db_query_range('SELECT 1 FROM {taxonomy_term_data} WHERE tid = :tid AND vid = :vid',0 , 1, array( ':tid' => $term->tid, |