function push_notification_get_user_tokens in Push Notifications 8
Same name and namespace in other branches
- 7 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()
File
- ./
push_notifications.module, line 208  - Contains push_notifications.module 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;
}