Error color for discourse_publish_format_html

I recently ran a bunch of tests that involved clicking on the Update Topic button as I made changes to the discourse_publish snippet

Every time, I’d see the green message: The Discourse topic has been updated!

After a while, I only looked for the green color, until I finally realized the error message also has a green background.

If possible, it would be nice to give errors a red background.

1 Like

Sorry, can you provide a screenshot? I’m not following.

From the WP edit post screen:
image
The background for this message is green, but when there is an error message, it is also shown with a green background.

I think it would be preferable if the backgrounds for error messages were a different color, perhaps light red, to highlight the fact that something is wrong.

1 Like

Just got another error message from the WP Plugin and this one was on a red background. So either this has been fixed, or not all error messages are the same, or I had some kind of caching issue.

Hey @RichardC could you share which specific error you saw with a green background?

@angus I really wish I could, but I fixed the error as soon as possible and I don’t know how to recreate it. I’ll be on the lookout and grab it if I ever see it again.

1 Like

I finally caught an error in green
image

If you want to duplicate that error, this is what I’m trying to do:

		if ( has_post_thumbnail( $post_id ) ) {
			$image = get_the_post_thumbnail( $post->ID, 'medium' );
		} else {
			$image = "";
		} ?>

EDIT: The mistake was the ?> at the end of the above code

Thanks for following up! So just to be clear, you are saying you

  1. can produce an incorrect error color;

  2. when using the discourse_publish_format_html filter

  3. in certain circumstances. On those circumstances, which of these is true:

    • you’re always seeing the error in green when using the filter; or
    • you’re always seeing the error in green when using the filter with the above snippet; or
    • you’re sometimes seeing the error in green when using the filter with the above snippet

Also, as you seem to have some other customisations (e.g. the 15 / 100 element), so just checking if you see any javascript errors in the web console when the incorrect color appears?

That one. The 15/100 is a faux SEO score which shouldn’t affect anything else.

So, if the filter is incorrectly written (i.e. with an extra ?> that shouldn’t be there) the error message is incorrectly shown.

Cheers, RIchard