Project:Similar By Terms
Version:5.x-1.15
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

After installing this module, I went to the settings page at http://example.com/admin/settings/similarterms and changed all the settings to non-defaults and clicked on 'Save configuration'. The settings page showed the values still set to the defaults. Inspecting the variables table showed that the admin settings entries (e.g., similarterms_display_options) were not present.

This worked correctly in release 5.x-1.10.

Comments

#1

Title:Admin settings not saved» Admin settings not saved in 5.x-1.15

Ops,

That was a mistake. I added a submit function to clear the cache. Get what no longer gets set any more. I will need to fix that.

Thanks
Robert

#2

function similarterms_admin_settings_submit($form_id, $form_values) {
variable_set('similarterms_vocabularies', $form_values['similarterms_vocabularies']);
variable_set('similarterms_display_options', $form_values['similarterms_display_options']);
variable_set('similarterms_ncount_options', $form_values['similarterms_ncount_options']);
variable_set('similarterms_cache_options', $form_values['similarterms_cache_options']);
if ($form_values['similarterms_clear_cache']) {
cache_clear_all('*', 'cache_similarterms', TRUE);
drupal_set_message(t('Similarterms Block Cache is now cleared'));
}
}

This will fix the problem. Although I'm not sure if we should filter the values for script injections?

#3

Status:active» needs work

@FVANtom, can you submit this change as a patch so that others can test it?

Thanks!

#4

may I ask you what is this $form['#submit']['similarterms_admin_settings_submit'] = array(); for?
I think you can remove this line and replace _submit function with _validate one:

<?php
function similarterms_admin_settings_validate($form_id, $form_values){
  if (
$form_values['similarterms_clear_cache']) {
   
cache_clear_all('*', 'cache_similarterms', TRUE);
   
drupal_set_message(t('Similarterms Block Cache is now cleared'));
  }
}
?>

#5

Status:needs work» closed (won't fix)

5.x is no longer supported. Closing it.

Thanks
Robert