You are here

function poptin_fetch_row in Website Popups, Email Popup, Exit-Intent Popup, and Contact Forms – Poptin 8

Same name and namespace in other branches
  1. 7 poptin.module \poptin_fetch_row()

Implements poptin_fetch_row().

1 call to poptin_fetch_row()
poptin_page_attachments in ./poptin.module
Implements hook_page_attachments().

File

./poptin.module, line 88
Module for adding popups on website.

Code

function poptin_fetch_row() {
  $query = \Drupal::database()
    ->select('poptin', 'p');
  $query
    ->addField('p', 'user_id');
  $query
    ->addField('p', 'client_id');
  $query
    ->addField('p', 'token');
  $query
    ->range(0, 1);
  $result = $query
    ->execute()
    ->fetch();
  if ($result) {
    return [
      'userid' => $result->user_id,
      'client_id' => $result->client_id,
      'token' => $result->token,
    ];
  }
  else {
    return FALSE;
  }
}