function content_set_last_access

7.x content.module content_set_last_access($cid, $account = NULL)
6.x content.module content_set_last_access($cid, $account = NULL)

Sets the content_last_access timestamp for this user and content. Should be called whenever a "content" node is viewed by the user.

2 calls to content_set_last_access()
content_view_content in modules/content/content.module
Display the content specified in the GET's cid.
engagements_display_main in modules/engagements/engagements.module
displays the main Engagements tab, which shows the history of past engagements.

File

modules/content/content.module, line 638

Code

function content_set_last_access($cid, $account = NULL) {
  global $user;
  if ($account == NULL) {
    $account = $user;
  }

  db_query("DELETE FROM content_last_access WHERE cid = ? AND user_id = ?", array($cid, $account->id));
  db_query("INSERT INTO content_last_access(cid, user_id, last_access)
              VALUES (?, ?, ?)", array($cid, $account->id, time()));

  // We need to re-calculate our alerts count just in case now.
  fp_recalculate_alert_count_by_type($account);

}