I have developed a custom component that store some user information in separate tables, I want to store/update user information when user deleted or updated from admin section or front end.

  • In regards to code, show us how you currently are doing it.
    – Lodder
    Commented Nov 9, 2014 at 10:41
  • Its basic functionality to update the custom component table when user database updated . Commented Nov 9, 2014 at 14:02

1 Answer 1


You should save your data using a User Plugin - they're very easy to write. An example can be found at Creating a profile plugin, though the example might have more than you need.

The events your code would go into are onUserAfterSave and onUserAfterDelete and are documented at Plugin/Events/User. These events will fire when a user is saved or deleted in the admin or Front-end.

The guts of the plugin would be this:

defined('_JEXEC') or die;
class PlgUserMyPlugin extends JPlugin
    protected $app;
    protected $db;

    public function onUserAfterDelete($user, $success, $msg) {
        if (!$success) 
            return false;

        $query = $this->db->getQuery(true)
        ->where($this->db->quoteName('userid') . ' = ' . (int) $user['id']);
        return true;

    public function onUserAfterSave($user, $isnew, $success, $msg) {
        if (!$success) 
            return false;

        // Update your table here
        if ($isnew) {
            // New User
            // Existing User
  • thanks @GDP, I think this is the best way to achieve the required functionality without modifying core files. Commented Nov 10, 2014 at 4:08

Your Answer

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

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