0

Is it possible to make a plugin which will get triggered by specific database events in Joomla?

I need to watch the $this->getTable() request in Joomla. For eg:

$table = $this->getTable();
if ($table->load($id)).....

I have to catch this event to modify the $table before $table->load($id) happens. The reason that I want to use a plugin doing, is that I don't want to do directly changes in the Joomla core code. My thoughts are that this could be possible with a plugin?

  • There isn't a plugin event that is watching when Joomla is dealing with the Database. To be honest I don't make much sense of your question. Maybe you could add more context about what you are actually trying to achieve. – FFrewin Jan 31 '18 at 7:14
  • In my custom component I would like to store my user data in a custom table. Therefore I did a custom authentication plugin and a custom user plugin, which are responsible for separate registering and login to the custom component. Authentication and login is working. My last problem is, opening the new view after login in, that the $app->redirect(JRoute::_($redirect_url) command in a component subcontroller initialize a load of the original Joomla User Table to check the User. And on this place the whole idea and the whole effort fails. It is not checking the session nor the custom plugins. – Perino Jan 31 '18 at 7:37
  • So isn't any of the User Plugin Events suitable for your purpose? – FFrewin Jan 31 '18 at 9:14
  • The problem is as mentioned above, the public function load($id) in ../libraries/src/User/User.php line 877, which will be called after the $app->redirect. I don't know why this function will be called. In this function the authenticated user to my custom plugins will be downgraded as guest and finally dropped out. I'am a bit frustrated! – Perino Jan 31 '18 at 10:41
  • Then there is likely something wrong with your plugins which you need to fix. – FFrewin Jan 31 '18 at 10:52

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.