This project is not covered by Drupal’s security advisory policy.

This API module provides storage for User Preferences. Beats creating fields on the User entity or using $user->data which leaves you feeling dirty :/

Define preferences via hooks, clear the caches if/when defining new ones as this is all cached.

For convenience in the hook definition you can target forms to have your preference field added to which will also auto save the submitted form preference values. Note that $form['#user']->uid must be defined in the target form else we can't work out which user we're working with. Patches welcome to improve this.

If not using the form stuff then there are a set of functions to call to get/set preferences.

  • user_preferences($uid) - grab all of a users preferences
  • user_preferences_save($uid, $preferences) - set a series of preferences
  • user_preferences_save_single($uid, $preference, $value) - you get the idea...


  • Behat tests (Travis CI)
  • Per user preference cache
  • Cross environment preference syncing

Project Information