The function comment_count_notify_settings_save isn't doing anything. I suggest removing it.

Comments

fotuzlab’s picture

Status: Active » Fixed

Thanx for pointing that out. It was added in initial stage of project. Missed to remove that.

greggles’s picture

Status: Fixed » Active

I 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');

fotuzlab’s picture

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

greggles’s picture

Status: Active » Needs work

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

fotuzlab’s picture

Thanx for that elaboration Greg.
Would implement that and get back to you in a day.

fotuzlab’s picture

Assigned: Unassigned » fotuzlab
Status: Needs work » Fixed
greggles’s picture

Title: remove unnecessary comment_count_notify_settings_save » remove unnecessary comment_count_notify_settings_save, prefix variables/functions to avoid conflicts
Status: Fixed » Needs work

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

greggles’s picture

Title: remove unnecessary comment_count_notify_settings_save, prefix variables/functions to avoid conflicts » remove unnecessary comment_count_notify_settings_save
Status: Needs work » Fixed

Pardon me, I see that topic is discussed in #1136970: Better variable and function names .

fotuzlab’s picture

Version: » 6.x-1.0
Status: Fixed » Closed (fixed)
greggles’s picture

Status: Closed (fixed) » Fixed

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

fotuzlab’s picture

Indeed a better practice to follow :)

Status: Fixed » Closed (fixed)

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