0
votes

How to remove already enqueued messages in joomla 2.5? Thanks in advance!

I tried

$jAp = JFactory::getApplication();
$messagesexist = $jAp->getMessageQueue();

But the above code is showing all the enqued messages. From that I want to remove particular message.

2
A enqueue message from what? A component? If so, which component? What have you already tried? - Lodder
yes it is from component - Ramakrishna
Try looking in the controller for that specific view of the component. You will most likely see something like: $message = JText::_('LANG_STRING'); followed by $this->setRedirect($url, $message, $messageType); - Lodder

2 Answers

1
votes

Try this,

                $session = JFactory::getSession();
                $sessionQueue = $session->get('application.queue');
                if (count($sessionQueue)) {
                        $session->set('application.queue', null);
                }

Hope its works..

1
votes

To remove a particular message you will have to work through the array returned by getMessageQueue().

So something like this:

// Get the message queue
$messages = JFactory::getApplication()->getMessageQueue();

// If we have messages
if (is_array($messages) && count($messages))
{
    // Check each message for the one we want
    foreach ($messages as $message)
    {
        // do your checks here
    }
}