Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-30544 message: prevented the temporarily disable notifications ch…

…eckbox from accidently clearing your messaging preferences
  • Loading branch information...
commit 133a23e130a6417483a73693145fbb1575fdc5e0 1 parent 779085b
@andyjdavis andyjdavis authored
Showing with 23 additions and 18 deletions.
  1. +23 −18 message/edit.php
View
41 message/edit.php
@@ -106,28 +106,33 @@
$preferences = array();
- $possiblestates = array('loggedin', 'loggedoff');
- foreach ( $providers as $providerid => $provider){
- foreach ($possiblestates as $state){
- $linepref = '';
- $componentproviderstate = $provider->component.'_'.$provider->name.'_'.$state;
- if (array_key_exists($componentproviderstate, $form)) {
- foreach ($form->{$componentproviderstate} as $process=>$one){
- if ($linepref == ''){
- $linepref = $process;
- } else {
- $linepref .= ','.$process;
+ // Turning on emailstop disables the preference checkboxes in the browser.
+ // Disabled checkboxes may not be submitted with the form making them look (incorrectly) like they've been unchecked.
+ // Only alter the messaging preferences if emailstop is turned off
+ if (!$user->emailstop) {
+ $possiblestates = array('loggedin', 'loggedoff');
+ foreach ( $providers as $providerid => $provider){
+ foreach ($possiblestates as $state){
+ $linepref = '';
+ $componentproviderstate = $provider->component.'_'.$provider->name.'_'.$state;
+ if (array_key_exists($componentproviderstate, $form)) {
+ foreach ($form->{$componentproviderstate} as $process=>$one){
+ if ($linepref == ''){
+ $linepref = $process;
+ } else {
+ $linepref .= ','.$process;
+ }
}
}
+ $preferences['message_provider_'.$provider->component.'_'.$provider->name.'_'.$state] = $linepref;
}
- $preferences['message_provider_'.$provider->component.'_'.$provider->name.'_'.$state] = $linepref;
}
- }
- foreach ( $providers as $providerid => $provider){
- foreach ($possiblestates as $state){
- $preferencekey = 'message_provider_'.$provider->component.'_'.$provider->name.'_'.$state;
- if (empty($preferences[$preferencekey])) {
- $preferences[$preferencekey] = 'none';
+ foreach ( $providers as $providerid => $provider){
+ foreach ($possiblestates as $state){
+ $preferencekey = 'message_provider_'.$provider->component.'_'.$provider->name.'_'.$state;
+ if (empty($preferences[$preferencekey])) {
+ $preferences[$preferencekey] = 'none';
+ }
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.