You are here

function messaging_user_destination in Messaging 6.2

Same name and namespace in other branches
  1. 6.4 messaging.module \messaging_user_destination()
  2. 6 messaging.module \messaging_user_destination()
  3. 6.3 messaging.module \messaging_user_destination()
  4. 7 messaging.module \messaging_user_destination()

Get destination from user account.

This will handle also anonymous user accounts that should have a 'destination' property

4 calls to messaging_user_destination()
messaging_message_send_user in ./messaging.module
Send message to user represented by account
Messaging_Methods_Tests::testMessagingMethods in tests/messaging_methods.test
Test message sending callbacks for enabled plug-ins
messaging_method_list in ./messaging.module
List sending methods
messaging_store_unpack in ./messaging.store.inc
Unpack stored messages

File

./messaging.module, line 226

Code

function messaging_user_destination($account, $method, $message = NULL) {
  if ($info = messaging_method_info($method)) {
    if (($property = messaging_method_info($method, 'destination')) && !empty($account->{$property})) {

      // Get destination property from user account
      return $account->{$property};
    }
    elseif (empty($account->uid) && !empty($account->destination)) {

      // Anonymous account with destination property
      return $account->destination;
    }
    elseif ($callback = _messaging_callback_get($info, 'destination')) {

      // We have a mapping function, it may also work for anonymous users
      return _messaging_callback_invoke($callback, $account, $message);
    }
  }
}