Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
527 views
in Q2A Core by
I am trying to modify a theme to have eror messages in a more consistent style.

For example -

1.  When not logged on the error message 'Please log in or register to flag posts' shows in white on a red background.

2.  When searching with an empty string the error message 'Please enter some text into the search box and try again.' shows in white on a red background.

3.  However, the error message 'Please log in or register to answer this question.' has a style which is dependent on the theme selected.

Does anyone know where the 'white on red error messages' style can be changed to match the theme selected?

Thanks
Q2A version: 1.6.2

1 Answer

0 votes
by

Some error messages are styled using  <h2>  and others using  <div class="qa-error">

For a more consistent appearance the following changes can be made :

Copy this function into qa-theme.php

        function part_title($part)
        {
if (strlen(@$part['title']) || strlen(@$part['title_tags'])) {

$mystring = @$part['title'];

// assume all error messages contain the word 'Please' - case insensitive
$findme   = 'Please';

// case insensitive search
$pos = stristr($mystring, $findme);


if ($pos === false) {
$this->output('<h2'.rtrim(' '.@$part['title_tags']).'>'.@$part['title'].'</h2>');
} else {
$this->output('<div class="qa-error">'.@$part['title'].'</div>');
}
}

           }

 

This 'fix' assumes all error messages contain the word 'Please or please'.    Alternatively you could add the word ERROR to all the error messages in the language files and seach for the word ERROR instead.

...