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

Comments

avpaderno’s picture

Title: Delete Filter does not work » Delete filter does not work
Version: 6.x-2.0-beta1 » 6.x-2.x-dev
avpaderno’s picture

Status: Active » Postponed (maintainer needs more info)

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.

acidtalks’s picture

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.

acidtalks’s picture

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.

avpaderno’s picture

Status: Postponed (maintainer needs more info) » Active
Issue tags: +6.x-2.0-beta1

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).

avpaderno’s picture

Version: 6.x-2.x-dev » 6.x-1.x-dev

Next time I should remember what I was doing, before to start to think of PH(is)H and chips.

avpaderno’s picture

Status: Active » Patch (to be ported)
avpaderno’s picture

Status: Patch (to be ported) » Fixed
Issue tags: +6.x-1.0-beta3

Status: Fixed » Closed (fixed)
Issue tags: -6.x-2.0-beta1, -6.x-1.0-beta3

Automatically closed -- issue fixed for 2 weeks with no activity.