API15

JTableUser/setLastVisit

From Joomla! Documentation

< API15:JTableUser

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]

Updates last visit time of user

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax[edit]

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

Returns[edit]

boolean False if an error occurs

Defined in[edit]

libraries/joomla/database/table/user.php

Importing[edit]

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

Source Body[edit]

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;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples[edit]

Code Examples[edit]