You are here

public static function OpignoTourFunctions::isPageUserViewed in Opigno tour 8

Same name and namespace in other branches
  1. 3.x src/OpignoTourFunctions.php \Drupal\opigno_tour\OpignoTourFunctions::isPageUserViewed()

Checks if user has already viewed current page.

1 call to OpignoTourFunctions::isPageUserViewed()
opigno_tour_preprocess_page in ./opigno_tour.module
Implements hook_preprocess_page().

File

src/OpignoTourFunctions.php, line 34

Class

OpignoTourFunctions
Class OpignoTourFunctions.

Namespace

Drupal\opigno_tour

Code

public static function isPageUserViewed($route_name, $uid) {
  $viewed = \Drupal::database()
    ->select('opigno_tour_user_routes', 'ur')
    ->fields('ur', [
    'timestamp',
  ])
    ->condition('uid', $uid)
    ->condition('route', $route_name)
    ->execute()
    ->fetchAll();
  if ($viewed) {
    return TRUE;
  }
  return FALSE;
}