On the module settings, when I click on the submit button nothing happens (except the browser loads a page from the server); it's not even clear if the module saved the settings, or it found an error.
It would be better to put a message on the screen using drupal_set_message() (like any other modules do, or should do).

Comments

psynaptic’s picture

Do you mean on this page: admin/settings/util/sysmods

There are only checkboxes there so not much can go wrong. Excuse me if I'm off the mark with my assumption.

avpaderno’s picture

Normally, all setting pages shows a message, and I think that is suggested to be done in the Drupal documentation. Even a page that has only the purpose to set some values with variable_set() (which could not know if the new values are really saved) shows a message to the user.

callison’s picture

Version: 6.x-2.3 » 6.x-2.x-dev
Priority: Normal » Minor
Status: Active » Needs review
StatusFileSize
new683 bytes

Added notification. Please review if this will check out. I'm not sure if the user_save() function is affected by the SQL queries above it.

psynaptic’s picture

Version: 6.x-2.x-dev » 6.x-2.3
Priority: Minor » Normal
StatusFileSize
new429 bytes

Ok. Patch attached.

Edit: Seems like the above patch is much better than mine.

psynaptic’s picture

Version: 6.x-2.3 » 6.x-2.x-dev
Priority: Normal » Minor

Resetting as my changes overrode callison's.

psynaptic’s picture

Looks like that code is trying to save the user data twice.

litwol’s picture

Status: Needs review » Needs work

patch from #3 doesnt apply. please re-roll.

psynaptic’s picture

How about this one?

litwol’s picture

Status: Needs work » Fixed

Hunk #1 succeeded at 69 with fuzz 1 (offset 7 lines).

Committed none the less. :)

avpaderno’s picture

Status: Fixed » Needs work

@callison: It's not really requested that the code checks if the values has been saved. It should just give a feedback to the user, making him understand the code to save the values has been executed; that of course, if it's not possible to check the value returned from the function called (like it happens with variable_set()).
I would never expect the code which calls variable_set() to check if the variable has the value set by the code. It's enough the user has a feedback, that is more important if the settings page is redirect to itself after the form has been submitted.

litwol’s picture

Status: Needs work » Fixed
avpaderno’s picture

Status: Fixed » Needs work
StatusFileSize
new695 bytes

It would be enough to present the message to the user.

litwol’s picture

Status: Needs work » Fixed

I have already committed this. stop reopening this issue. thanks.

avpaderno’s picture

Status: Fixed » Needs work
StatusFileSize
new809 bytes

The alternative would be to give a message even when the settings has not been successfully saved.

psynaptic’s picture

Status: Needs work » Fixed

Well, yes. It is usually enough to just display the message but it's been committed now and it seems fine as it is. :)

avpaderno’s picture

I am sorry; the status changed automatically. Or that, or we were adding the comment at the same time.

psynaptic’s picture

It happens when you're replying to a comment and someone changes the status before you submit.

avpaderno’s picture

I really didn't mean to change status; I didn't understand that the patch was already committed, or I would have stopped making suggestions.

psynaptic’s picture

We know that :)

Status: Fixed » Closed (fixed)

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