Closed (fixed)
Project:
Comment Count Notify
Version:
6.x-1.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
24 Apr 2011 at 12:48 UTC
Updated:
19 May 2011 at 18:21 UTC
The function comment_count_notify_settings_save isn't doing anything. I suggest removing it.
Comments
Comment #1
fotuzlab commentedThanx for pointing that out. It was added in initial stage of project. Missed to remove that.
Comment #2
gregglesI like to link to the commit message when I make a comment saying I've fixed something - http://drupalcode.org/sandbox/arijit/1127432.git/commit/110bb1a - that helps others to review the change and in this case you didn't remove all the code.
See
97 $form['#submit'] = array('comment_count_notify_settings_save');
Comment #3
fotuzlab commentedHi Greg
I restored the submit handler in commit http://drupalcode.org/sandbox/arijit/1127432.git/commit/67e93fb
I feel i misunderstood system_settings_form. It only renders the standard form. I do not think it handles the form elements.
after removing the function, i found the code to be buggy and hence restored the function. I have commented it now.
Comment #4
gregglesThe system_settings_form will add its own submit handler that saves form values into a variable based on the name of the form element.
$form['interval'] = array( is saved to a variable called "interval" (not Interval).
I suggest removing the custom submit function, and renaming all of your form keys and the corresponding variables so they are unique to this module. The Drupal best practice is to prefix all function names and variable names with the module name. So, interval should be comment_count_notify_interval.
If you do that change and then create a fresh test site and fresh install of the module, save the settings form and look in the variables table in the database. There you can find the names and values of all variables on your site.
Comment #5
fotuzlab commentedThanx for that elaboration Greg.
Would implement that and get back to you in a day.
Comment #6
fotuzlab commentedremoved custom submit handler http://drupalcode.org/sandbox/arijit/1127432.git/commit/f7dd031
Comment #7
gregglesLooks great!
I'm still really concerned about the variable names and function names: interval, email, subject, getAdminMail(). These are all very likely to cause conflicts.
Comment #8
gregglesPardon me, I see that topic is discussed in #1136970: Better variable and function names .
Comment #9
fotuzlab commentedComment #10
gregglesNote that when you fix something the best Status is "fixed." This leaves it visible in the queue for two weeks at which point it gets automatically closed by an automated process.
Leaving it in the queue makes it visible to people who may be looking for the same issue and helps prevent duplicate issues.
Comment #11
fotuzlab commentedIndeed a better practice to follow :)