You are here

function notifications_load_user in Notifications 6.2

Same name and namespace in other branches
  1. 5 notifications.cron.inc \notifications_load_user()
  2. 6.4 notifications.module \notifications_load_user()
  3. 6 notifications.cron.inc \notifications_load_user()
  4. 6.3 notifications.cron.inc \notifications_load_user()

Get users with static caching for existing users

If not uid passed it will return an anonymous fake user (with destination, send_method) We need to pass the send method to produce the right tokens later

This provides some API support for user-less subscriptions, i.e. when we've got just an email address but no user associated. The idea is that these fake users will be properly handled by messaging module

@todo Possibly all this should be handled by messaging layer

Parameters

$uid: Uid of the user account to load, none to use anonymous user

$destination: Messaging destination (mail, sms number, etc..), just for anonymous users

$send_method: Messaging send method key (mail, sms, xmpp, etc..), just for anonymous users

1 call to notifications_load_user()
notifications_process_compose in ./notifications.cron.inc
Message composition.

File

./notifications.cron.inc, line 634

Code

function notifications_load_user($uid, $destination = NULL, $send_method = NULL) {
  if ($uid) {
    return messaging_load_user($uid);
  }
  else {
    $account = drupal_anonymous_user();
    $account->destination = $destination;
    $account->send_method = $send_method;
    return $account;
  }
}