Hello,
I'm trying to use FlashMessenger to notify another user of an event. Does anyone know if this is possible?
Something like
$flashMessenger->addMessage( array('status'=> '', 'message'=> 'Hello!'), $user);
Hello,
I'm trying to use FlashMessenger to notify another user of an event. Does anyone know if this is possible?
Something like
$flashMessenger->addMessage( array('status'=> '', 'message'=> 'Hello!'), $user);
Hi,
Quoting the manual page of the FlashMessenger :
The FlashMessenger helper allows you to pass messages that the user may need to see on the next request. To accomplish this, FlashMessenger uses
Zend_Session_Namespace
to store messages for future or next request retrieval.
So, the messages are stored in session -- and a session is attached to / corresponds to a user ; the current user, actually.
The session is not meant to store data that is shared between different users -- so I would say that this component cannot be used to notify other users of an event ; not natively, at least.
A possible solution would be :
A bit tricky, and not as easy as you'd hope, I admit...
Another idea, instead of using a database, would be to use some Caching engine (like APC, memcached, ... see Zend_Cache
, to avoid hitting the DB.
Have fun !
Other option would be to implemment your own session handling and store it in DB (along with username). You can then access it and alter it in any way. We've implemented this when we needed to get past some crazy restrictions (one day limited session lifetime) of hosted enviroment's session setup. It works really good and offers much more possibilities over the default implementation (like sign out all users if some specific user signs in - superadmin for example or signout user if his password is changed in admin section, etc.).
But I guess this is a bit overkill for your purposes. And Pascal's way would be good enough.