Actions

API16

JTableContent/store

< API16:JTableContent

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

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


Advertisement