You are here

function recipe_nodeapi in Recipe 6

Hook into generic node creation/update and check if the added node fixes any links in existing recipes.

File

./recipe.module, line 1334
recipe.module - share recipes

Code

function recipe_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'insert':
    case 'update':
      if ($node->type == 'ingredient') {
        db_query("UPDATE {recipe_ingredient} SET link = %d WHERE LOWER(name) = '%s'", $node->nid, trim(strtolower($node->title)));
      }
      break;
  }
}