Actions

API15

JTableUser/setLastVisit

From Joomla! Documentation

< API15:JTableUser
Revision as of 17:17, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Updates last visit time of user

[Edit Descripton]

Description:JTableUser/setLastVisit

Syntax

setLastVisit($timeStamp=null, $id=null)
Parameter Name Default Value Description
$timeStamp null The timestamp, defaults to 'now'
$id null

Returns

boolean False if an error occurs

Defined in

libraries/joomla/database/table/user.php

Importing

jimport( 'joomla.database.table.user' );

Source Body

function setLastVisit( $timeStamp=null, $id=null )
{
        // check for User ID
        if (is_null( $id )) {
                if (isset( $this )) {
                        $id = $this->id;
                } else {
                        // do not translate
                        jexit( 'WARNMOSUSER' );
                }
        }
 
        // if no timestamp value is passed to functon, than current time is used
        $date =& JFactory::getDate($timeStamp);
 
        // updates user lastvistdate field with date and time
        $query = 'UPDATE '. $this->_tbl
        . ' SET lastvisitDate = '.$this->_db->Quote($date->toMySQL())
        . ' WHERE id = '. (int) $id
        ;
        $this->_db->setQuery( $query );
        if (!$this->_db->query()) {
                $this->setError( $this->_db->getErrorMsg() );
                return false;
        }
 
        return true;
}

[Edit See Also] SeeAlso:JTableUser/setLastVisit

Examples

<CodeExamplesForm />