MBF Knowledge Base

How to set default user preferences

If SquirrelMail is configured to use file-based preferences, default preferences are stored in your data directory in a file called default_pref. As you add plugins to your SquirrelMail installation, you might want to configure some of them on your own account and then propagate those settings to all of your users. Or you may simply want to change the default theme, etc. This is what you need to do to accomplish that. Log into your own account (or a test account) and get all your configuration set to what you'd like the defaults to be.
 
  Open the preference file related to the account you used. It's in the data directory and looks something like username.pref or user@example.com.pref, depending on what your usernames look like.
Find the relevant settings. Most plugin settings are identified by the plugin's name being the first thing on the line. Note that some plugins can have multiple setting lines.

Copy those settings into the default_pref file in the data directory. If you want to duplicate all settings, you can copy the entire file, but be careful that nothing with your name, mail address, or other personal items get copied.

Note that the default_pref file works only for users that don't have an existing preference file (i.e. new users which haven't logged in yet). If you want to add preferences to existing user accounts, you should edit (manually or by a script) their existing preference files. It's not recommended to delete the preference files, since that will revert all preferences edited by your users, including such settings as their real names.

An example script TODO: Write a better script (in Perl) providing this functionality and include it the SquirrelMail distribution.

This is a simple shell solution to edit more than one user preference file at once.

If you, for example, want mails to display as HTML by default and change the font to a custom one by using CSS, create a file containing:

    show_html_default=1
    custom_css=sans-10.css

Save the file as /tmp/default.pref, change to the data directory, and run the following command from the prompt:  for l in `ls *.pref`; do cat /tmp/default.pref >> $l; done

Forced preferences
If you want to force some preference settings for all your users, it's possible when using the Forced Preferences plugin. It works regardless of if the users have set their own preferences or not.