Saving User Specific Data Or Preferences

The quickest way to save user specific data or preferences within a Drupal module is to simply pull the $user object into local scope, and then create new properties as needed. These additional properties are then serialized and saved within the 'data' column of a user's row with the invocation of user_save(). This contrasts the site-wide usage of the variable_% series of functions.

Pulling User Into Local Scope

function mymodule_function() {
  global $user;
}

Adding Preferences

function mymodule_function() {
  global $user;

  $user->mymodule = array();
  $user->mymodule['use_wysiwygs'] = FALSE;
  $user->mymodule['allow_email_notifications'] = TRUE;
}