You are here

function push_notification_get_user_tokens in Push Notifications 7

Same name and namespace in other branches
  1. 8 push_notifications.module \push_notification_get_user_tokens()

Determine all tokens for a specfic user.

Parameters

int $uid User Id.:

Return value

array Array of token database records.

1 call to push_notification_get_user_tokens()
push_notifications_send_message in ./push_notifications.module
Send a simple message alert to an array of recipients.

File

./push_notifications.module, line 1198
Push Notifications functionality.

Code

function push_notification_get_user_tokens($uid) {
  if (!is_numeric($uid)) {
    return FALSE;
  }

  // Select all tokens for this user.
  $query = db_select('push_notifications_tokens', 'pnt');
  $query
    ->fields('pnt');
  $query
    ->condition('pnt.uid', $uid);
  $result = $query
    ->execute();
  $tokens = array();
  foreach ($result as $record) {
    $tokens[$record->token] = $record;
  }
  return $tokens;
}