diff --git a/lang/en/admin.php b/lang/en/admin.php index a57937e197b..10a8f997a68 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -374,7 +374,7 @@ $string['configstatsruntimestart'] = 'What time should the cronjob that does the $string['configstatsuserthreshold'] = 'This setting specifies the minimum number of enrolled users for a course to be included in statistics calculations.'; $string['configstrictformsrequired'] = 'If enabled, users are prevented from entering a space or line break only in required fields in forms.'; $string['configstripalltitletags'] = 'Uncheck this setting to allow HTML tags in activity and resource names.'; -$string['configsupportemail'] = 'If SMTP is configured on this site and a support page is not configured, this email address will be sent general help requests submitted through the support form (for example, when new users create their own accounts). If SMTP is not configured, this email address will be displayed to logged in users on the support form page.'; +$string['configsupportemail'] = 'If SMTP is configured on this site and a support page is not configured, this email address will be sent general help requests submitted through the support form (for example, when new users create their own accounts). If sending fails, this email address will be displayed to logged in users.'; $string['configsupportname'] = 'This is the name of a person or other entity offering general help via the support email or web address.'; $string['configsupportpage'] = 'This web address will be published to users of this site as the one to go to when they need general help (for example, when new users create their own accounts). If this address is left blank then a link to the support email form will be supplied.'; $string['configtempdatafoldercleanup'] = 'Remove temporary data files from the data folder that are older than the selected time.'; diff --git a/theme/boost/scss/moodle/user.scss b/theme/boost/scss/moodle/user.scss index dc62fc561f7..fd46765746c 100644 --- a/theme/boost/scss/moodle/user.scss +++ b/theme/boost/scss/moodle/user.scss @@ -321,7 +321,7 @@ #page-user-contactsitesupport { .supporticon { i { - font-size: 64px; + font-size: 35px; } } diff --git a/theme/boost/style/moodle.css b/theme/boost/style/moodle.css index b9ffcd2abda..51fc70ff916 100644 --- a/theme/boost/style/moodle.css +++ b/theme/boost/style/moodle.css @@ -17150,7 +17150,7 @@ body.path-question-type .mform fieldset.hidden { display: block; } #page-user-contactsitesupport .supporticon i { - font-size: 64px; } + font-size: 35px; } .search-results .result { margin-left: 0; diff --git a/theme/classic/style/moodle.css b/theme/classic/style/moodle.css index 0b074281110..9af149d2de9 100644 --- a/theme/classic/style/moodle.css +++ b/theme/classic/style/moodle.css @@ -17150,7 +17150,7 @@ body.path-question-type .mform fieldset.hidden { display: block; } #page-user-contactsitesupport .supporticon i { - font-size: 64px; } + font-size: 35px; } .search-results .result { margin-left: 0; diff --git a/user/contactsitesupport.php b/user/contactsitesupport.php index 7bf8342b358..ba4482f2649 100644 --- a/user/contactsitesupport.php +++ b/user/contactsitesupport.php @@ -38,34 +38,34 @@ $PAGE->has_secondary_navigation_setter(false); $user = isloggedin() && !isguestuser() ? $USER : null; $renderer = $PAGE->get_renderer('user'); -if (!$CFG->smtphosts) { - $supportemail = $CFG->supportemail; - $templatectx = $user ? ['supportemail' => html_writer::link("mailto:{$supportemail}", $supportemail)] : []; - $output = $renderer->render_from_template('user/contact_site_support_not_available', $templatectx); -} else { - $form = new \core_user\form\contactsitesupport_form(null, $user); - if ($form->is_cancelled()) { - redirect($CFG->wwwroot); - } else if ($form->is_submitted() && $form->is_validated() && confirm_sesskey()) { - $data = $form->get_data(); +$form = new \core_user\form\contactsitesupport_form(null, $user); +if ($form->is_cancelled()) { + redirect($CFG->wwwroot); +} else if ($form->is_submitted() && $form->is_validated() && confirm_sesskey()) { + $data = $form->get_data(); - $from = $user ?? core_user::get_noreply_user(); - $subject = get_string('supportemailsubject', 'admin', format_string($SITE->fullname)); - $data->notloggedinuser = (!$user); - $message = $renderer->render_from_template('user/contact_site_support_email_body', $data); + $from = $user ?? core_user::get_noreply_user(); + $subject = get_string('supportemailsubject', 'admin', format_string($SITE->fullname)); + $data->notloggedinuser = (!$user); + $message = $renderer->render_from_template('user/contact_site_support_email_body', $data); - if (!email_to_user(core_user::get_support_user(), $from, $subject, $message)) { - $form->set_data($data); - $notificationmessage = get_string('supportmessagenotsent', 'user'); - \core\notification::add($notificationmessage, \core\output\notification::NOTIFY_ERROR); - } else { - $level = \core\output\notification::NOTIFY_SUCCESS; - redirect($CFG->wwwroot, get_string('supportmessagesent', 'user'), 3, $level); - } + if (!email_to_user(core_user::get_support_user(), $from, $subject, $message)) { + $supportemail = $CFG->supportemail; + $form->set_data($data); + $templatectx = [ + 'supportemail' => $user ? html_writer::link("mailto:{$supportemail}", $supportemail) : false, + 'supportform' => $form->render(), + ]; + $output = $renderer->render_from_template('user/contact_site_support_not_available', $templatectx); + } else { + $level = \core\output\notification::NOTIFY_SUCCESS; + redirect($CFG->wwwroot, get_string('supportmessagesent', 'user'), 3, $level); } +} else { $output = $form->render(); } + echo $OUTPUT->header(); echo $output; diff --git a/user/templates/contact_site_support_not_available.mustache b/user/templates/contact_site_support_not_available.mustache index cf5571544b3..a14b0a70865 100644 --- a/user/templates/contact_site_support_not_available.mustache +++ b/user/templates/contact_site_support_not_available.mustache @@ -17,23 +17,29 @@ {{! @template core_user/contact_site_support_not_available - Fallback for the contact support page if smtp is not configured. + Content displayed on the contact site support page if attempting to submit the support form fails. Example context (json): { - "supportemail": "support@mail.com" + "supportemail": "support@mail.com", + "supportform": "" } }}
-
-
{{#pix}}t/life-ring, core{{/pix}}
-
{{#str}}supportmessagenotsent, user{{/str}}
- {{#supportemail}} -
- - {{#str}}supportmessagealternative, user, {{{supportemail}}}{{/str}} - +
+
{{#pix}}t/life-ring, core{{/pix}}
+
+
{{#str}}supportmessagenotsent, user{{/str}}
+ {{#supportemail}} +
+ + {{#str}}supportmessagealternative, user, {{{supportemail}}}{{/str}} + +
+ {{/supportemail}}
- {{/supportemail}}
+
+ {{{supportform}}} +