API16:JTableContent/store
From Joomla! Documentation
Description
Overriden JTable::store to set modified data and user id.
Syntax
store($updateNulls=false)
| Parameter Name | Default Value | Description |
|---|---|---|
| $updateNulls | false | True to update fields even if they are null. |
Returns
boolean True on success.
Defined in
libraries/joomla/database/table/content.php
Importing
jimport( 'joomla.database.table.content' );
Source Body
public function store($updateNulls = false)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
if ($this->id) {
// Existing item
$this->modified = $date->toMySQL();
$this->modified_by = $user->get('id');
} else {
// New article. An article created and created_by field can be set by the user,
// so we don't touch either of these if they are set.
if (!intval($this->created)) {
$this->created = $date->toMySQL();
}
if (empty($this->created_by)) {
$this->created_by = $user->get('id');
}
}
return parent::store($updateNulls);
}
Examples
Code Examples