diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 9ee6f81..212fe1e 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1442,7 +1442,7 @@ function comment_num_new($nid, $timestamp = 0) { if ($user->uid && module_exists('history')) { // Retrieve the timestamp at which the current user last viewed this node. if (!$timestamp) { - $timestamp = history_read($nid); + $timestamp = history_read('node', $nid); } $timestamp = ($timestamp > HISTORY_READ_LIMIT ? $timestamp : HISTORY_READ_LIMIT); diff --git a/core/modules/history/history.module b/core/modules/history/history.module index 8246dd4..36e83dd 100644 --- a/core/modules/history/history.module +++ b/core/modules/history/history.module @@ -22,16 +22,16 @@ /** * Retrieves the timestamp for the current user's last view of a specified node. * + * @param string $entity_type + * The entity type. * @param int $entity_id * The entity ID. - * @param string $entity_type - * The entity type. Defaults to "node". * * @return int * If a node has been previously viewed by the user, the timestamp in seconds * of when the last view occurred; otherwise, zero. */ -function history_read($entity_id, $entity_type = 'node') { +function history_read($entity_type, $entity_id) { global $user; $history = &drupal_static(__FUNCTION__, array()); @@ -50,15 +50,15 @@ function history_read($entity_id, $entity_type = 'node') { /** * Updates 'last viewed' timestamp of the specified entity for the current user. * + * @param $entity_type + * The entity type. * @param $entity_id * The entity ID that has been read. - * @param $entity_type - * The entity type. Defaults to "node". * @param $account * (optional) The user account to update the history for. Defaults to the * current user. */ -function history_write($entity_id, $entity_type = 'node', $account = NULL) { +function history_write($entity_type, $entity_id, $account = NULL) { global $user; if (!isset($account)) { @@ -104,7 +104,6 @@ function history_user_cancel($edit, $account, $method) { case 'user_cancel_reassign': db_delete('history') ->condition('uid', $account->uid) - ->condition('entity_type', 'user') ->execute(); break; } @@ -116,6 +115,5 @@ function history_user_cancel($edit, $account, $method) { function history_user_delete($account) { db_delete('history') ->condition('uid', $account->uid) - ->condition('entity_type', 'user') ->execute(); } diff --git a/core/modules/node/node.module b/core/modules/node/node.module index ad79f6d..66f5072 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -333,7 +333,7 @@ function node_mark($nid, $timestamp) { return MARK_READ; } if (!isset($cache[$nid])) { - $cache[$nid] = history_read($nid); + $cache[$nid] = history_read('node', $nid); } if ($cache[$nid] == 0 && $timestamp > HISTORY_READ_LIMIT) { return MARK_NEW; @@ -1086,7 +1086,7 @@ function node_show(Node $node, $message = FALSE) { // Update the history table, stating that this user viewed this node. if (module_exists('history')) { - history_write($node->nid); + history_write('node', $node->nid); } return $nodes;