You are here

function messaging_user_setting in Messaging 7

Same name and namespace in other branches
  1. 6.4 messaging.module \messaging_user_setting()
  2. 6.2 messaging.module \messaging_user_setting()
  3. 6.3 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

File

./messaging.module, line 397

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);
  }
}