function tft_check_vocabulary_setting in Taxonomy File Tree 7.2
Same name and namespace in other branches
- 7 tft.module \tft_check_vocabulary_setting()
Deprecated
Check that a valid vocabulary vid is set in the settings. Else, redirect to either the settings page (if the user has access) or the home page.
File
- ./
tft.module, line 1382 - Hook implementations and module logic for TFT.
Code
function tft_check_vocabulary_setting() {
if (!variable_get('tft_vocabulary_vid', 0) || !db_query("SELECT COUNT(vid) FROM {taxonomy_vocabulary} WHERE vid = :vid", array(
':vid' => variable_get('tft_vocabulary_vid', 0),
))
->fetchField()) {
drupal_set_message(t("You must first enter which vocabulary is used by Taxonomy File Tree."), 'error');
watchdog('tft', "TFT isn't properly configured. A valid vocabulary must be set as the TFT vocabulary.", array(), WATCHDOG_ERROR);
if (user_access(TFT_PERM__ADMIN)) {
drupal_goto('admin/settings/tft');
}
else {
drupal_goto();
}
}
}