Commit 8325d516 authored by ainur's avatar ainur Committed by Marco Villegas
Browse files

Issue #1407042 by Ainur, marvil07: Fixed Multiple calls to...

Issue #1407042 by Ainur, marvil07: Fixed Multiple calls to _vud_comment_get_node_type(), use static cache.
parent ee8e3fac
Loading
Loading
Loading
Loading
+5 −1
Changes for vud_comment/vud_comment.module: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -155,7 +155,11 @@ function vud_comment_preprocess_comment(&$variables) {
 * Function to return the node type of a particular node ID.
 */
function _vud_comment_get_node_type($nid) {
  return db_result(db_query("SELECT type from {node} where nid = %d", $nid));
  static $node_types_by_nid = array();
  if (!isset($node_types_by_nid[$nid])) {
    $node_types_by_nid[$nid] = db_result(db_query("SELECT type from {node} WHERE nid = %d", $nid));
  }
  return $node_types_by_nid[$nid];
}

/**