You are here

function messaging_user_setting in Messaging 6.4

Same name and namespace in other branches
  1. 6.2 messaging.module \messaging_user_setting()
  2. 6.3 messaging.module \messaging_user_setting()
  3. 7 messaging.module \messaging_user_setting()

Get setting from user account or get default setting if not available

If first checks for a 'messaging_$name' property in the user account and returns the value of the variable 'messaging_default_$name' if not set

There's an optional variable 'messaging_peruser_$name' that if true will block per user settings and use only global settings.

Parameters

$name: Option name

$account: Optional account to check setting for

$default: Default value if no option set

2 calls to messaging_user_setting()
messaging_xmpp_user in messaging_xmpp/messaging_xmpp.module
Implementation of hook_user()
messaging_xmpp_user_check in messaging_xmpp/messaging_xmpp.module
Message user callback. Check user destination and availability

File

./messaging.module, line 467

Code

function messaging_user_setting($name, $account = NULL, $default = NULL) {
  $variable = 'messaging_' . $name;
  if ($account && isset($account->{$variable}) && variable_get('messaging_peruser_' . $name, 1)) {
    return $account->{$variable};
  }
  else {
    return variable_get('messaging_default_' . $name, $default);
  }
}