Steps to create and use User Preferences

How to create the menus

  • Create a file called <your_mod_prefix> in mod/pref/ directory


  • add menu items using the menu functions. To avoid conflicts of the actions prefix your module to the action (i.e. <mod_prefix>_<action>)
shn_mod_menuitem("ims_config",_("Multiple Incident Management"));
 NOTE: remember that you **DO NOT** need to include the library

How to create User Preference Form

  • Create a file called <your_mod_prefix> in mod/pref directory
  • Create the functions such as shn_pref_<mod_prefix>_<action>
function shn_pref_ims_config()
 NOTE: You may create files inside the mod/pref but make sure you are prefixing them with the <mod_prefix> 

How to set user preference

  • Use shn_user_pref_update to manage your user preferences
shn_user_pref_update(<module_id>,<key>,<value>,[<delete flag>]);
 NOTE: If your preference is not specific to any particular module use 'base' for the module_id
       if you set delete flag the preference will be deleted, remember setting preference to '' or null may be differ from deleting the preference

How to get the user preference

  • You have the direct access to the session so, you can access them $_SESSION['user_pref_<mod_prefix>_<key>']

QR Code
QR Code dev:userprefmodule (generated for current page)