isNew(); if ($this->xpdo instanceof modX) { $this->xpdo->invokeEvent('OnUserProfileBeforeSave', array( 'mode' => $isNew ? modSystemEvent::MODE_NEW : modSystemEvent::MODE_UPD, 'userprofile' => &$this, 'cacheFlag' => $cacheFlag, )); } $saved = parent:: save($cacheFlag); if ($saved && $this->xpdo instanceof modX) { $this->xpdo->invokeEvent('OnUserProfileSave', array( 'mode' => $isNew ? modSystemEvent::MODE_NEW : modSystemEvent::MODE_UPD, 'userprofile' => &$this, 'cacheFlag' => $cacheFlag, )); } return $saved; } /** * Overrides xPDOObject::remove to fire modX-specific events * * {@inheritDoc} */ public function remove(array $ancestors = array()) { if ($this->xpdo instanceof modX) { $this->xpdo->invokeEvent('OnUserProfileBeforeRemove', array( 'userprofile' => &$this, 'ancestors' => $ancestors, )); } $removed = parent:: remove($ancestors); if ($this->xpdo instanceof modX) { $this->xpdo->invokeEvent('OnUserProfileRemove', array( 'userprofile' => &$this, 'ancestors' => $ancestors, )); } return $removed; } }