Source code for file /joomla/database/table/user.php
Documentation is available at user.php
* @version $Id: user.php 6529 2007-02-08 06:57:00Z pasamio $
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
// Check to ensure this file is within the rest of the framework
* @package Joomla.Framework
* The users real name (or nickname)
* @var string activation hash
* @param database A database connector object
* Validation and filtering
* @return boolean True is satisfactory
// Validate user information
// check for existing username
.
' WHERE username = "' .
$this->username .
'"'
.
' AND id != '.
$this->id;
$this->_db->setQuery( $query );
if ($xid &&
$xid !=
intval( $this->id )) {
// check for existing email
.
' WHERE email = "'.
$this->email .
'"'
.
' AND id != '.
$this->id
$this->_db->setQuery( $query );
if ($xid &&
$xid !=
intval( $this->id )) {
function store( $updateNulls=
false )
$section_value =
'users';
$ret =
$this->_db->updateObject( $this->_tbl, $this, $this->_tbl_key, $updateNulls );
// 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' );
$acl->add_object( $section_value, $this->name, $this->$k, null, null, 'ARO' );
$acl->add_group_object( $this->gid, $section_value, $this->$k, 'ARO' );
$aro_id =
$acl->get_object_id( 'users', $this->$k, 'ARO' );
$acl->del_object( $aro_id, 'ARO', true );
$query =
'DELETE FROM '.
$this->_tbl
.
' WHERE '.
$this->_tbl_key .
' = "'.
$this->$k .
'"';
$this->_db->setQuery( $query );
if ($this->_db->query()) {
$query =
'DELETE FROM #__messages_cfg'
.
' WHERE user_id = '.
$this->$k
$this->_db->setQuery( $query );
if (!$this->_db->query()) {
$query =
'DELETE FROM #__messages'
.
' WHERE user_id_to = '.
$this->$k
$this->_db->setQuery( $query );
if (!$this->_db->query()) {
* Updates last visit time of user
* @param int The timestamp, defaults to 'now'
* @return boolean False if an error occurs
// if no timestamp value is passed to functon, than current time is used
$dateTime =
date( 'Y-m-d H:i:s', $timeStamp );
$dateTime =
date( 'Y-m-d H:i:s' );
// updates user lastvistdate field with date and time
$query =
'UPDATE '.
$this->_tbl
.
' SET lastvisitDate = "'.
$dateTime.
'"'
$this->_db->setQuery( $query );
if (!$this->_db->query()) {
* Overloaded bind function
* @param array $hash named array
* @return null|string null is operation was satisfactory, otherwise returns an error
function bind($array, $ignore =
'')
$registry->loadArray($array['params']);
$array['params'] =
$registry->toString();
return parent::bind($array, $ignore);
* Returns a complete user list
$this->_db->setQuery("SELECT username FROM #__users");
return $this->_db->loadAssocList();
* Gets the users from a group
* @param string The value for the group (not used 1.0)
* @param string The name for the group
* @param string If RECURSE, will drill into child groups
* @param string Ordering for the list
$group_id =
$acl->get_group_id( $name, $group_type =
'ARO');
$objects =
$acl->get_group_objects( $group_id, 'ARO', 'RECURSE');
if (isset
( $objects['users'] ))
$gWhere =
'(id =' .
implode( ' OR id =', $objects['users'] ) .
')';
$query =
'SELECT id AS value, name AS text'
$this->_db->setQuery( $query );
$options =
$this->_db->loadObjectList();