Using J3.7.2 with MySQL 5.7.14 and PHP 5.6.25. I have built a Joomla user plugin (let's name it "My_Plugin") which does all the things that the default Joomla user plugin "User-Joomla" does, plus some extras. The site works perfectly well when the plugin User-Joomla is unpublished and My_Plugin is published, EXCEPT... when trying to add a new registered user from the back-end user panel. Joomla then throws a (non-fatal) notice "trying to get property of non-object...". The reason is, that com_users/models/user.php is trying to retrieve $pluginParams in function getForm ($plugin->params on line 116). This line fails when the User-Joomla plugin is disabled.
However, for My_Plugin to work properly, the event function onUserLogin must be called only once. When User-Joomla is also enabled (which must be because of com_users), the function onUserLogin is executed twice: once by My_Plugin and once by User-Joomla.
QUESTION How can I stop or 'untrigger' this event in My_Plugin to prevent it from triggering the same function in User-Joomla? The same goes for all other event functions, e.g. onUserAfterDelete, onUserAfterSave, onUserLogout, etc. Needless to say that I don't want to hack the Joomla core.
My_Plugin class is declared as follows (all comments removed):
use Joomla\Registry\Registry;
class plgMy_Plugin_User extends JPlugin
{
protected $app;
protected $db;
public function onUserAfterDelete($user, $success, $msg)
{
.............
}
public function onUserAfterSave($user, $isnew, $success, $msg)
{
.............
}
public function onUserLogin($user, $options = array())
.............
}
etcetera....