You are here

function notifications_user_setting in Notifications 7

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

Gets a user setting, defaults to default system setting for each

Parameters

$name: Setting name

$account: Optional user account, will default to current user

$default: Optional default to return if this is not set

3 calls to notifications_user_setting()
NotificationsContentTests::testNotificationsContent in tests/notifications_content.test
Play with creating, retrieving, deleting a pair subscriptions
notifications_account_overview in notifications_account/notifications_account.pages.inc
Menu callback. Overview page for user subscriptions.
Notifications_Subscription::set_user in ./notifications.subscription.inc
Set user account as the owner of this subscription and take care of defaults for this account.

File

./notifications.module, line 699
Notifications module

Code

function notifications_user_setting($name, $account = NULL, $default = NULL) {
  global $user;
  $account = $account ? $account : $user;

  // Default send method is taken from messaging module
  if ($name == 'send_method') {
    return messaging_method_default($account);
  }
  $field = 'notifications_' . $name;
  if (isset($account->{$field})) {
    return $account->{$field};
  }
  else {
    return variable_get('notifications_default_' . $name, $default);
  }
}