You are here

function notifications_user_setting in Notifications 6.2

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.3 notifications.module \notifications_user_setting()
  5. 7 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

12 calls to notifications_user_setting()
NotificationsContentTests::testNotificationsContent in tests/notifications_content.test
Play with creating, retrieving, deleting a pair subscriptions
notifications_add_subscription_form in ./notifications.pages.inc
Form for creating new subscriptions
notifications_autosubscribe in notifications_autosubscribe/notifications_autosubscribe.module
Subscribes users to content they post, if not already subscribed
notifications_autosubscribe_form_alter in notifications_autosubscribe/notifications_autosubscribe.module
Implementation of hook_form_alter()
notifications_autosubscribe_notifications_node_form_alter in notifications_autosubscribe/notifications_autosubscribe.module
Implementation of hook_notifications_node_form_alter

... See full list

File

./notifications.module, line 362
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);
  }
}