When user use pass reset link and submit new password we are getting next warning
Notice: Undefined index: Email_Preference in salsa_profile_email_preference_update() (line 796 of /home/pivica/moje/www/md-systems/unicef.dev.local/sites/all/modules/contrib/salsa_entity/salsa_profile/salsa_profile.module).
This is happening because in
/**
* Additional edit form callback that updates Email_Preference field.
*/
function salsa_profile_email_preference_update($form, $form_state) {
if (is_object($form_state['supporter'])) {
if (module_exists('mimemail')) {
$form_state['supporter']->Email_Preference = $form_state['values']['mimemail_textonly'] ? EMAIL_PREFERENCE_TEXT : EMAIL_PREFERENCE_HTML;
$form_state['supporter']->save();
}
else {
$form_state['supporter']->Email_Preference = $form_state['values']['Email_Preference'];
$form_state['supporter']->save();
}
}
}
we are missing $form_state['values']['Email_Preference']. Adding simple !empty() check for this there would be enough to fix this.
Comments
Comment #2
pivica commentedHere is a patch.
Comment #4
berdir!empty() is likely wrong. I'm not sure if the value for the unchecked checkbox is NULL or FALSE, we need isset() if it is FALSE and array_key_exists() if it is NULL. I think it is FALSE, but not 100% sure right now.
Comment #5
pivica commentedYeah was too quick with this you are right !empty() check would be wrong. Did a detail debug with all possible cases and $form['Email_Preference'] can be empty string (FALSE) or have a string definition - this is defined as constants in same module. And in the case when it is producing above warning then the Email_Preference is missing fully in values array.
Here is a new patch with isset() check which should be fine now.
Comment #6
pivica commentedComment #8
pivica commentedHmm CI says
But there is nothing wrong with that lines there, just checked
Probably some CI failure, but lets try one more time.
Comment #10
pivica commentedOkey see it now, CI is using PHP5.3 and we are using [] here...
Comment #11
pivica commentedOkey new patch fixing PHP incompatibility.
Comment #13
berdirThanks, committed.