forum_submit

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/forum/forum.module, строка 321

Версии
5
forum_submit(&$node)

Implementation of hook_submit().

Check in particular that only a 'leaf' term in the associated taxonomy vocabulary is selected, not a 'container' term.

Код

<?php
function forum_submit(&$node) {
  // Make sure all fields are set properly:
  $node->icon = !empty($node->icon) ? $node->icon : '';

  if ($node->taxonomy) {
    // Get the forum terms from the (cached) tree
    $tree = taxonomy_get_tree(_forum_get_vid());
    if ($tree) {
      foreach ($tree as $term) {
        $forum_terms[] = $term->tid;
      }
    }
    foreach ($node->taxonomy as $term) {
      if (in_array($term, $forum_terms)) {
        $node->tid = $term;
      }
    }
    $old_tid = db_result(db_query_range("SELECT tid FROM {forum} WHERE nid = %d ORDER BY vid DESC", $node->nid, 0,1));
    if ($old_tid) {
      if (($node->tid != $old_tid) && $node->shadow) {
        // A shadow copy needs to be created. Retain new term and add old term.
        $node->taxonomy[] = $old_tid;
      }
    }
  }
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему