You are here

function recipe_get_term_by_name in Recipe 6

Same name and namespace in other branches
  1. 7.2 modules/recipe_recipeML.module \recipe_get_term_by_name()
  2. 7 includes/recipe_recipeML.module \recipe_get_term_by_name()

Get the term from a specific vocab from its name. Used by bulk import routines that load the category.

Parameters

$name: The name of the term to get (String).

$vocab_id: The ID of the vocabulary that contains the term (Int).

Return value

The term data from the database. False if not found.

2 calls to recipe_get_term_by_name()
recipe_mastercook4_import_form_submit in plugins/recipe_mastercook4.module
recipe_recipeML_import_form_submit in plugins/recipe_recipeML.module

File

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

Code

function recipe_get_term_by_name($name, $vocab_id) {
  $db_result = db_query(db_rewrite_sql("SELECT t.tid, t.* FROM {term_data} t WHERE t.vid=%d and LOWER(t.name) = LOWER('%s')", 't', 'tid'), $vocab_id, trim($name));
  while ($term = db_fetch_object($db_result)) {
    return $term;
  }
  return FALSE;
}