Commit 6900896e authored by dragonwize's avatar dragonwize
Browse files

Now deleting specific node type entires when a node type is deleted

parent 84f95b35
......@@ -235,7 +235,7 @@ function better_formats_new_role($form, &$form_state) {
// create stubs in per role table
$sql = "INSERT INTO {better_formats_defaults}
VALUES (%d, '%s', %d, %d, %d)";
VALUES (%d, '%s', %d, %d, %d)";
db_query($sql, $rid, 'node', 0, 1, 25);
db_query($sql, $rid, 'comment', 0, 1, 25);
}
......@@ -252,6 +252,21 @@ function better_formats_delete_role($form, &$form_state) {
db_query($sql, $form['rid']['#value']);
}
/**
* Implementation of hook_node_type().
*/
function better_formats_node_type($op, $info) {
if ($op === 'delete') {
// delete per node type settings on node type delete
$sql = "DELETE FROM {better_formats_defaults}
WHERE type IN ('node/%s', 'comment/%s')";
db_query($sql, $info->type, $info->type);
// delete node type variables
variable_del('better_formats_allowed_' . $info->type);
}
}
/**
* Implementation of hook_elements().
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment