MyBB Hacks

Full Version: Changing the error message
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I am working on a setup with multiple forums and I decided to reuse fields across forums.

By using language files on the new thread and edit post and using two forum specific templates I think I have made it possible to reuse 10 "standard" fields across all forums and just call them something else per forum.

The only problem I am facing is the error message (see screenshot) - if a field is not entered on a forum then the name of the field is shown as an error. I can get round that by adding a default value for each field, but it would be better if the error message did not output the name of the missing field but rather used my language file name.

Is this possible?
If I understand you correctly, in the Custom Modify Error field for that Custom Thread Field, do something like this:

Code:
<if $fid == 1 then>
{$lang->err1}
<elseif $fid == 2 then>
{$lang->err2}

etc.

I already have a custom modify field there Seabody; but it is currently working like this:

if I set a default value then there is no warning at all;
if I set no default value but field as required then I get the field name but no custom message;
if I set no default value and field not required (just everyone) with a modify message then I get only the custom message and that does not say which field it is;

What I am looking to achieve is that if I set the modify message and field to not required (everyone) then the field name error does not show but the modify error does. Is there a language file? Then I can just use the existing forum language prefixes to set the field name the way I am doing it on new thread and editpost rather than putting it all in the modify message.

This is the current modify message

Code:
<if intval({VALUE}) < 1 or intval({VALUE}) > 5 then> 
  You must enter a value between 1 and 5. 
</if>

If I don't misunderstand what you mean, maybe you can try something like this:
Custom Modify Error:

Code:
<if intval({VALUE}) < 1 or intval({VALUE}) > 5 then> 
  You must enter a value between 1 and 5 for the field "{$lang->my_field_1_name}".
</if>


Then in your langprefix_global.lang.php (depends on the language prefix for each forum(s)) file:

PHP Code:
$l['my_field_1_name'] = "This Field Name For This Forum";

Thank you RateU, that indeed worked.
Reference URL's