function flag_lists_flag_delete in Flag Lists 6
Same name and namespace in other branches
- 7.3 flag_lists.module \flag_lists_flag_delete()
- 7 flag_lists.module \flag_lists_flag_delete()
Implementation of hook_flag_delete().
This is not in flag yet.
File
- ./
flag_lists.module, line 480 - The Flag Lists module.
Code
function flag_lists_flag_delete(&$flag) {
// Template flag is being deleted. Clean up our tables.
// Collect the sub-flag fids so we can delete counts and content records.
if ($fids = db_fetch_array(db_query("SELECT fid, name from {flag_lists_flags} WHERE pfid = %d", $flag->fid))) {
foreach ($fids as $fid) {
db_query("DELETE FROM {flag_lists_counts} WHERE fid = %d", $fid['fid']);
db_query("DELETE FROM {flag_lists_content} WHERE fid = %d", $fid['fid']);
}
}
// flag_lists_types uses the template flag name, not our own fid.
db_query("DELETE FROM {flag_lists_types} WHERE name = '%s'", $flag->name);
// Now delete the sub-flags.
db_query("DELETE FROM {flag_lists_flags} WHERE pfid = %d", $flag->fid);
drupal_set_message(t('The template flag "@title" and all its sub-flags have been deleted.', array(
'@title' => $flag->title,
)));
}