Wondering if this will always be free?  See why free is better.

Main Menu

Minor inconsistency in PersonalMessage.Template

Started by Spuds, January 03, 2011, 01:53:47 PM

Previous topic - Next topic


2.0 RC4, no mods

The way error messages are handled / displayed varies from template to template and they really should be more consistent in appearance.

In the personal message template they are formed as

// If there were errors for sending the PM, show them.
if (!empty($context['post_error']['messages']))
echo '
<div class="errorbox">
<strong>', $txt['error_while_submitting'], '</strong>

foreach ($context['post_error']['messages'] as $error)
echo '
<li class="error">', $error, '</li>';

echo '

So you get bullets next to the error message, the only place I could find that style was in the PM template.  I changed mine to be like the post template error, specifically:

// If there were errors for sending the PM, show them.
if (!empty($context['post_error']['messages']))
echo '
<div class="errorbox"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors">
<strong style="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'display: none;' : '', '" id="error_serious">', $txt['error_while_submitting'], '</strong>
<dt class="error" id="error_list">
', empty($context['post_error']['messages']) ? '' : implode('<br />', $context['post_error']['messages']), '

Note for this to work correctly the $context['error_type'] also needs to be set to minor or serious in personalmessage.php, similar to how its done in post.php.

IMO I'd consider changing minor errors to show a notification style error and the serious (ie not is the form fill out) errors to be error style.  For example  I don't think we really need a red background for forgetting to put in a subject, but perhaps a more gentile caution triangle yellow and a you forgot to fill in the subject message.  So basically move form fields to minor and provide a minor css style and show that if there are not serious errors returned.

Baby Daisy

I would assume it was leftovers from the previous SMF 1.1 style...


Take a peek at what I'm doing! ;D

Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.


Missed this one. Frankly I like the code in the PM template better. It's less messy and does a perfectly good job. Removing bullets is easy.


Yeah add the reset class to the ul and done.



ETA: Done.