function taxonomy_access_restore_terms in Taxonomy Access Control 5.2
Same name and namespace in other branches
- 5 taxonomy_access.module \taxonomy_access_restore_terms()
- 6 taxonomy_access.module \taxonomy_access_restore_terms()
used to restore terms deleted by taxonomy_node_delete() that the user shouldn't have access to delete. see http://drupal.org/node/92355 and http://drupal.org/node/93086
Called by taxonomy_access_nodeapi()
1 call to taxonomy_access_restore_terms()
- taxonomy_access_nodeapi in ./
taxonomy_access.module - Implementation of hook_nodeapi().
File
- ./
taxonomy_access.module, line 435 - Allows administrators to specify how each category (in the taxonomy) can be used by various roles.
Code
function taxonomy_access_restore_terms($nid, $protected_terms) {
if (isset($protected_terms)) {
$terms = $protected_terms;
if (count($terms)) {
$args = array_merge(array(
$nid,
), $terms);
$placeholders = implode(', ', array_fill(0, count($terms), "%d"));
db_query('DELETE FROM {term_node} WHERE nid = %d AND tid IN ' . '(' . $placeholders . ')', $args);
foreach ($terms as $tid) {
db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $tid);
}
}
}
}