/**
* Method to delete the User object from the database
*
* @return boolean True on success
*
* @since 1.7.0
*/
public function delete()
{
PluginHelper::importPlugin('user');
// Trigger the onUserBeforeDelete event
Factory::getApplication()->triggerEvent('onUserBeforeDelete', array($this->getProperties()));
// Create the user table object
$table = $this->getTable();
if (!($result = $table->delete($this->id))) {
$this->setError($table->getError());
}
// Trigger the onUserAfterDelete event
Factory::getApplication()->triggerEvent('onUserAfterDelete', array($this->getProperties(), $result, $this->getError()));
return $result;
}