diff --git a/src/Model/Behavior/UserBehavior.php b/src/Model/Behavior/UserBehavior.php index 97ba6b3..e99e5ff 100644 --- a/src/Model/Behavior/UserBehavior.php +++ b/src/Model/Behavior/UserBehavior.php @@ -170,7 +170,9 @@ public function expirationTime($time = '+1 day', $dateFormat = 'Y-m-d H:i:s') { */ public function updateLastActivity($userId = null, $field = 'last_action', $options = []) { $options = Hash::merge($this->_config['updateLastActivity'], $options); - if ($this->_table->exists([$this->_table->alias() . '.' . $this->_table->primaryKey()])) { + if ($this->_table->exists([ + $this->_table->alias() . '.' . $this->_table->primaryKey() => $userId + ])) { return $this->_table->updateAll( [$field => date($options['dateFormat'])], [$this->_table->primaryKey() => $userId]