I've been looking for a way to customize the misc. error messages that Drupal generates for users (not admin). Many of these messages are either cryptically or annoyingly written.

For instance, when user enters a not fully specified URL for their homepage in comment form, they get this annoying message: "The URL of your homepage is not valid. Remember that it must be fully qualified, i.e. of the form http://example.com/directory." 'Remember'? How can they remember if they were never told in the first place.

But I have not found easy way to do this. StringOverrides module won't change them. I've read that might be doable with Language module, but tried and doesn't seem to work either. I've looked at Inline Messages and Better Messages modules and neither focuses on changing message content, only how it is presented.

Is there a simple way to customize these messages? A module I've missed? A simple format for overrides to insert in template.php that'd work for any message like this?

If nothing exists, could a module be written to do it? How hard would that be? Or is it a structurally difficult problem because these msgs can come from any and all modules?

Any ideas welcome.

Comments

vm’s picture

stringoverrides.module maybe

john.kenney’s picture

in the 5 minutes since I posted this, i figured out how to do it - and stringoverrides is the answer (or an answer).

but it took me about 20 tries to get it to work. stringoverrides works off of things that are printed with t() statements and i guess it requires that the t() statement be specified in its entirety with precise accuracy. i thought i was doing so by copying text/HTML code out of 'print source' view and/or firebug, but it simply didn't play. i also thought it would work off of partial strings, but it doesn't seem to - seems to require the entire statement.

so i just tracked down one of the error messages in the original module and copied entire thing directly from there. that worked! not sure why -- there is no visible difference between the two versions, but there must have been something hidden in the other character sets that it didn't like.

anyway, i think that'll do it!

since i've been trying to figure this out for a few days and the answer appears to easy once you get it right, i'm adding some other words to this post with the idea that others might find it more easily.

custom error messages, customize error messages, custom messages, customize drupal messages, change messages, change error message text, replace error message text