You are here

public function PrivateMessageThread::getLastDeleteTimestamp in Private Message 8.2

Same name and namespace in other branches
  1. 8 src/Entity/PrivateMessageThread.php \Drupal\private_message\Entity\PrivateMessageThread::getLastDeleteTimestamp()

Get the last delete timestamp for the given user.

Parameters

\Drupal\Core\Session\AccountInterface $account: The user whose last delete time should be retrieved.

Return value

int A UNIX timestamp indicating the last time the user marked the thread as deleted.

Overrides PrivateMessageThreadInterface::getLastDeleteTimestamp

1 call to PrivateMessageThread::getLastDeleteTimestamp()
PrivateMessageThread::filterUserDeletedMessages in src/Entity/PrivateMessageThread.php
Filter messages in the thread deleted by the given account.

File

src/Entity/PrivateMessageThread.php, line 183

Class

PrivateMessageThread
Defines the Private Message Thread entity.

Namespace

Drupal\private_message\Entity

Code

public function getLastDeleteTimestamp(AccountInterface $account) {
  return \Drupal::database()
    ->select('pm_thread_history', 'pm_thread_history')
    ->condition('uid', $account
    ->id())
    ->condition('thread_id', $this
    ->id())
    ->fields('pm_thread_history', [
    'delete_timestamp',
  ])
    ->execute()
    ->fetchField();
}