4

I am developing an application in which I want to perform some action on user block operation from Joomla User management screen.
In custom MVC component we are doing with the use of file which is in tables folder.
While joomla's com_users component is managing things with differently, so can anyone guide how I can do some db operation when we admin block any user.

Actually i also need similar help for category disable functionality, like I want to do some db operation based on category enable or disabled.

Please guide me. Thanks

1 Answer 1

2

This reply may be too late for you, but for anyone in future can refer to this. If you are a Joomla developer you must be knowing about the Plugins and triggers they work on, for any change in User block, update, delete etc. Joomla triggers events from User Plugin( refer here => User plugin events)(Joomla Plugin Events) For your case, you can use either onUserBeforeSave or onUserAfterSave better will be to use before save as it will be easy for you to find the change in the value.

public function onUserBeforeSave($oldUser, $isnew, $newUser)
{
    var_dump($oldUser, $isnew, $newUser);
    die;
}

The $oldUser gives the old values and $newUser gives the new values you need to apply proper condition for your operations only when the condition matches the user block. Also, onUserBeforeSave method if you return false the user will not be updated but, if you use the onUserAfterSave you will get the updated user object and you have to use your own logic to find the change in value.

I will request all the community users to provide answers to their questions if they have found a solution to the query they report. We can learn and grow together.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.