I’m writing a Joomla plugin that looks more or less like:
<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
class plgSystemTest extends JPlugin {
function onAfterInitialise(){
static $showWarnings = true;
if($somecondition && $showWarnings)
JError::raiseWarning(100,'Some warning that shows up twice.');
$showWarnings = false;
}
}
?>
I’m testing this plugin on Joomla 1.5, 1.6 and 1.7. While the warning does show up in each of them, it shows up twice the second time the page loads.
By the way, it’s also worth noting that the $showWarnings flag doesn’t help at all.

As @alghimo hinted, warnings are somehow stored in a session.
Unfortunately, I don’t have time to waste investigating such strange issues in Joomla, so the technical details are still hazy.
The way I got it to work as I want is to not to show the message when
$_GET['layout']isedit:That said, I don’t feel this is the right answer to the issue. If anyone comes up with a better idea, I’ll be more than happy to switch answers accordingly.