Delete filter does not work
acidtalks - July 5, 2009 - 11:15
| Project: | Custom filter |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
| Issue tags: | 6.x-1.0-beta3, 6.x-2.0-beta1 |
Jump to:
Description
When deleting a filter with the "Delete" button under the tab "List filters" nothing happens. After the confirmation message you are back on the "List filters" page but the filter is not deleted.
This issue occured in the 6.x-1.0 branch, too.
-- Tim

#1
#2
That is strange, because the module contains the code to delete the filter data from the database.
Are you sure the form is not being cached? Did you check if your Drupal installation has the cache enabled?
Thanks for your report.
#3
Yes, code is there, but it uses an uninitialized variable $fid in function customfilter_filter_delete_submit:
db_query('DELETE FROM {customfilter_filters} WHERE fid = %d', $fid);So the rules are deleted but not the filter.
A fix seems to be easy. Here's the code that works for me. Please review it.
function customfilter_filter_delete_submit($form, &$form_state) {
$fid = $form_state['values']['fid'];
$rules = customfilter_get_rules($fid);
foreach ($rules as $rule) {
customfilter_delete_rule($rule['rid']);
}
db_query('DELETE FROM {customfilter_filters} WHERE fid = %d', $fid);
$form_state['redirect'] = 'admin/settings/filters/customfilter';
}
PS: Your module is great, saved me hours of time.
#4
Ok, I see you have already fixed this in the actual development tree. Installing the lasted version of customfilter-6.x-2.x has fixed the problem, too.
#5
Yes, I changed the code before to have an issue report. I updated the content of CHANGELOG.txt so it now contains a reference to this report.
I will then verify that also branch 6.x-1 doesn't contain the same kind of error; I need to take a break from developing new code because I start to see PHP code also in the electric grill (I don't know if that is a good, or a bad thing because I have never tasted broiled PHP).
#6
Next time I should remember what I was doing, before to start to think of PH(is)H and chips.
#7
#8
#9
Automatically closed -- issue fixed for 2 weeks with no activity.