JTableUser/store
From Joomla! Documentation
< API15:JTableUserRevision as of 13:54, 12 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)
Revision as of 13:54, 12 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)
The "API15" 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[edit]
Inserts a new row if id is zero or updates an existing row in the database table
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
store($updateNulls=false)
Parameter Name | Default Value | Description |
---|---|---|
$updateNulls | false | If false, null object variables are not updated |
Returns[edit]
null|string null if successful otherwise returns and error message
Defined in[edit]
libraries/joomla/database/table/user.php
Importing[edit]
jimport( 'joomla.database.table.user' );
Source Body[edit]
function store( $updateNulls=false )
{
$acl =& JFactory::getACL();
$section_value = 'users';
$k = $this->_tbl_key;
$key = $this->$k;
if ($key)
{
// existing record
$ret = $this->_db->updateObject( $this->_tbl, $this, $this->_tbl_key, $updateNulls );
// syncronise ACL
// single group handled at the moment
// trivial to expand to multiple groups
$object_id = $acl->get_object_id( $section_value, $this->$k, 'ARO' );
$groups = $acl->get_object_groups( $object_id, 'ARO' );
$acl->del_group_object( $groups[0], $section_value, $this->$k, 'ARO' );
$acl->add_group_object( $this->gid, $section_value, $this->$k, 'ARO' );
$acl->edit_object( $object_id, $section_value, $this->_db->getEscaped( $this->name ), $this->$k, 0, 0, 'ARO' );
}
else
{
// new record
$ret = $this->_db->insertObject( $this->_tbl, $this, $this->_tbl_key );
// syncronise ACL
$acl->add_object( $section_value, $this->name, $this->$k, null, null, 'ARO' );
$acl->add_group_object( $this->gid, $section_value, $this->$k, 'ARO' );
}
if( !$ret )
{
$this->setError( strtolower(get_class( $this ))."::". JText::_( 'store failed' ) ."<br />" . $this->_db->getErrorMsg() );
return false;
}
else
{
return true;
}
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
<CodeExamplesForm />