I'm having problems getting onUserAfterSaveGroup to fire on Joomla3.4.x
I've published a system plugin and tested that it works using function onUserLogin()
, but when I try to use function onUserAfterSaveGroup()
I fail to trigger the event.
To test the plugin, I logged into the frontend as the testuser and I logged into the backend as Admin and went to Users>Usermanager>testuser>Assigned User Groups. I then added testuser to a new usergroup and clicked Save.
In the plugin I had the following code (UPDATED)
defined('_JEXEC') or die;
jimport('joomla.plugin.plugin');
class plgSystemcustomcheckJoomlaEvents extends JPlugin {
/**
* Constructor.
*
* @param $subject
* @param array $config
*/
public function onUserAfterSaveGroup()
{
echo "onUserAfterSaveGroup triggered";
die();
}
public function onUserLogin($user,$options)
{
/*THis WORkS */
//echo 'onUserLogin triggered';
//die();
}
}
I expected to see the message "onUserAfterSaveGroup" show for testuser, but this didn't happen. I tried refreshing the page, but that didn't do anything either. The event wasn't triggered for Admin either (although I wasn't expecting it to). Can someone explain why the event is not triggered for testuser?
This is a follow up to my question posted at What Joomla events are triggered when a usergroup is changed?