function taxonomy_access_update_7002 in Taxonomy Access Control 7
Add vocabulary defaults for all configured vocabularies.
File
- ./
taxonomy_access.install, line 184 - Install, update, and uninstall functions for Taxonomy Access Control.
Code
function taxonomy_access_update_7002() {
// Get a list of all vocabularies with any term configurations for each role.
$ta_configs = db_query("SELECT td.vid, ta.rid\n FROM {taxonomy_access_term} ta\n INNER JOIN {taxonomy_term_data} td ON ta.tid = td.tid\n GROUP BY td.vid, ta.rid")
->fetchAll();
// Get a list of all configured vocabularies.
$td_configs = db_query("SELECT vid, rid\n FROM {taxonomy_access_default}")
->fetchAll();
$records = array();
$global_defaults = taxonomy_access_global_defaults();
foreach ($ta_configs as $config) {
if (!in_array($config, $td_configs)) {
$record = (array) $global_defaults[$config->rid];
$records[] = _taxonomy_access_format_grant_record($config->vid, $config->rid, $record, TRUE);
}
}
if (taxonomy_access_set_default_grants($records)) {
return t('Update completed successfully.');
}
else {
return t('Update failed.');
}
}