Skip to content

Commit

Permalink
message MDL-25264 made it possible to edit another user's message pre…
Browse files Browse the repository at this point in the history
…ferences
  • Loading branch information
Andrew Davis committed Nov 18, 2010
1 parent 861fa91 commit fa8f03e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 4 additions & 3 deletions message/edit.php
Expand Up @@ -144,7 +144,7 @@
$preferences['message_blocknoncontacts'] = !empty($form->blocknoncontacts)?1:0;
//$preferences['message_beepnewmessage'] = !empty($form->beepnewmessage)?1:0;

/// Save all the new preferences to the database
// Save all the new preferences to the database
if (!set_user_preferences( $preferences, $user->id ) ){
print_error('cannotupdateusermsgpref');
}
Expand All @@ -154,6 +154,7 @@

/// Load preferences
$preferences = new stdClass();
$preferences->userdefaultemail = $user->email;//may be displayed by the email processor

/// Get providers preferences
$providers = message_get_my_providers();
Expand Down Expand Up @@ -204,8 +205,8 @@
}
echo $OUTPUT->header();

/// Start the form. We're not using mform here because of our special formatting needs ...
echo '<form class="mform" method="post" action="'.$CFG->wwwroot.'/message/edit.php">';
// Start the form. We're not using mform here because of our special formatting needs ...
echo '<form class="mform" method="post" action="'.$PAGE->url.'">';

/// Settings table...
echo '<fieldset id="providers" class="clearfix">';
Expand Down
8 changes: 7 additions & 1 deletion message/output/email/message_output_email.php
Expand Up @@ -67,7 +67,13 @@ function config_form($preferences){
global $USER;
$string = get_string('email','message_email').': <input size="30" name="email_email" value="'.$preferences->email_email.'" />';
if (empty($preferences->email_email)) {
$string .= ' ('.get_string('default').': '.$USER->email.')';
$userdefaultemail = null;
if (empty($preferences->userdefaultemail)) {
$userdefaultemail = $USER->email;
} else {
$userdefaultemail = $preferences->userdefaultemail;
}
$string .= ' ('.get_string('default').': '.$userdefaultemail.')';
}
return $string;
}
Expand Down

0 comments on commit fa8f03e

Please sign in to comment.