You can extend default user preferences to add additional preferences. You even not need to change the php code, you just create a class that extend user preferences class and included that file in configuration file.
<?php /** * * Copyright (c) 2009, Stevanus DH * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * Neither the name of the CIISONLINE. nor the names of its contributors may * be used to endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * */ class Extension_Preferences extends CIISONLINE_Preferences_Extension{ static function ValidateChange() { return ''; } static function DoChange() { /*------------------------------- * Load all form fields into variables *------------------------------- */ $pPKuser_id = GetParam('PK_user_id'); $pPKaccount_id = GetParam('PK_account_id'); /* the value should be: user, users group, or role */ $flduser_type = GetParam('user_typeid'); /* the value should be: any registered approval path */ $fldreqapprovalpath1 = GetParam('reqapprovalpath1'); $fldaccptapprovalpath1 = GetParam('accptapprovalpath1'); $fldreqapprovalpath2 = GetParam('reqapprovalpath2'); $fldaccptapprovalpath2 = GetParam('accptapprovalpath2'); $fldreqapprovalpath3 = GetParam('reqapprovalpath3'); $fldaccptapprovalpath3 = GetParam('accptapprovalpath3'); $fldreqapprovalpath4 = GetParam('reqapprovalpath4'); $fldaccptapprovalpath4 = GetParam('accptapprovalpath4'); $fldreqapprovalpath5 = GetParam('reqapprovalpath5'); $fldaccptapprovalpath5 = GetParam('accptapprovalpath5'); /* if email notification is sent to the sender. the value should be: true or false*/ $fldownemailnotif = getCheckBoxValue(GetParam('OwnEm'), '1', '0', 'Number'); /* if email notification is sent on changing user form. the value should be: true or false*/ $fldnotifyformchange = getCheckBoxValue(GetParam('NotifMyFormChEm'), '1', '0', 'Number'); /* number of items display on a page*/ $fldnum_items_perpage = GetParam('num_items_perpage'); /* escalation information */ $fldescalate_approval_toid = ''; $fldescalate_approval_to = GetParam('escalate_approval_to'); $fldescalate_approval_info = GetParam('escalate_approval_info'); if ($fldescalate_approval_to!='') { $fldescalate_approval_toid = AccountIDFromUserSelectionMode($fldescalate_approval_to); if ((string)$fldescalate_approval_toid==(string)$pPKuser_id) $fldescalate_approval_toid = ''; } $sUserID = GetCurrentUserConfig('UserID'); if ((string)GetCurrentPageConfig('sPageErrorMessage') == '') { /*numbers forms */ SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigNumFormsPerPageDefPage'), $fldnum_items_perpage); SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigNumFormsPerPageSharedPage'), $fldnum_items_perpage); SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigNumFormsPerPageCtrPage'), $fldnum_items_perpage); SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigNumFormsPerPageApprPage'), $fldnum_items_perpage); SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigNumFormsPerPageListPage'), $fldnum_items_perpage); /*own email */ SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigSendOwnSubmittedForm'), $fldownemailnotif); /*notify form change */ SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigEmailMyFormChange'), $fldnotifyformchange); /*fldreqapprovalpath1 */ SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigRequestApprovalPath1'), $fldreqapprovalpath1); /*fldaccptapprovalpath1 */ SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigAcceptanceApprovalPath1'), $fldaccptapprovalpath1); /*fldreqapprovalpath2*/ SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigRequestApprovalPath2'), $fldreqapprovalpath2); /*fldaccptapprovalpath2 */ SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigAcceptanceApprovalPath2'), $fldaccptapprovalpath2); /*fldreqapprovalpath3 */ SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigRequestApprovalPath3'), $fldreqapprovalpath3); /*fldaccptapprovalpath3*/ SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigAcceptanceApprovalPath3'), $fldaccptapprovalpath3); /*fldreqapprovalpath4 */ SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigRequestApprovalPath4'), $fldreqapprovalpath4); /*fldaccptapprovalpath4 */ SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigAcceptanceApprovalPath4'), $fldaccptapprovalpath4); /*fldreqapprovalpath5 */ SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigRequestApprovalPath5'), $fldreqapprovalpath5); /*fldaccptapprovalpath5 */ SetUserConfigBy ($sUserID, $pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigAcceptanceApprovalPath5'), $fldaccptapprovalpath5); $sFormApplEscalTbColPrefix = GetTableConfig('sFormApplEscalTbColPrefix'); $sFormApplEscalTbNm = GetTableConfig('sFormApplEscalTbNm'); /* check if this assigned people delegate to other, if any you asiggned to this delegated people*/ if ((int)DLookup($sFormApplEscalTbNm, ' count(*) as n ', $sFormApplEscalTbColPrefix.'02='.ToSQL($pPKuser_id,'Text') .' and '.$sFormApplEscalTbColPrefix.'04<='.ToSQL(GetSystemDateTimeValue(),'Date') .' and ('.$sFormApplEscalTbColPrefix.'05>='.ToSQL(GetSystemDateTimeValue(),'Date') .' or '.$sFormApplEscalTbColPrefix.'05 is null)')>0) { $sSQL = 'update '.$sFormApplEscalTbNm.' set ' .$sFormApplEscalTbColPrefix.'0B='.ToSQL(GetTimestamp(), 'Number').',' .$sFormApplEscalTbColPrefix.'05='.ToSQL(GetSystemDateTimeValue(), 'Date').',' .$sFormApplEscalTbColPrefix.'08='.ToSQL(GetSystemDateTimeValue(), 'Date').',' .$sFormApplEscalTbColPrefix.'10='.ToSQL($sUserID,'Text') .' where '.$sFormApplEscalTbColPrefix.'02='.ToSQL($pPKuser_id,'Text') .' and '.$sFormApplEscalTbColPrefix.'04<='.ToSQL(GetSystemDateTimeValue(),'Date') .' and ('.$sFormApplEscalTbColPrefix.'05>='.ToSQL(GetSystemDateTimeValue(),'Date') .' or '.$sFormApplEscalTbColPrefix.'05 is null)'; ExecuteSQL2 ($sSQL); } if ($fldescalate_approval_toid!='') { $sSQL = 'insert into '.$sFormApplEscalTbNm.' (' .$sFormApplEscalTbColPrefix.'0A,' .$sFormApplEscalTbColPrefix.'01,' .$sFormApplEscalTbColPrefix.'02,' .$sFormApplEscalTbColPrefix.'03,' .$sFormApplEscalTbColPrefix.'04,' .$sFormApplEscalTbColPrefix.'05,' .$sFormApplEscalTbColPrefix.'06,' .$sFormApplEscalTbColPrefix.'07,' .$sFormApplEscalTbColPrefix.'09) ' .'values (' .ToSQL(GetTimestamp(),'Number').',' .ToSQL(GUID(),'Text').',' .ToSQL($pPKuser_id, 'Text').',' .ToSQL($fldescalate_approval_toid, 'Text').',' .ToSQL(GetSystemDateTimeValue(), 'Date').',' .'NULL,' .ToSQL($fldescalate_approval_info,'Text').',' .ToSQL(GetSystemDateTimeValue(), 'Date').',' .ToSQL($sUserID,'Text').')'; ExecuteSQL2 ($sSQL); } } } static function Preferences_Show() { /*------------------------------- * Preferences Show begin *------------------------------- */ $sAction = GetCurrentPageConfig('sAction'); $sForm = GetCurrentPageConfig('sForm'); $pPKaccount_id = ''; $flduser_localusercode = ''; /* the value should be: user, users group, or role */ $flduser_type = ''; /* number of items display on a page*/ $fldnum_items_perpage = ''; /* the value should be: any registered approval path */ $fldreqapprovalpath1 = ''; $fldaccptapprovalpath1 = ''; $fldreqapprovalpath2 = ''; $fldaccptapprovalpath2 = ''; $fldreqapprovalpath3 = ''; $fldaccptapprovalpath3 = ''; $fldreqapprovalpath4 = ''; $fldaccptapprovalpath4 = ''; $fldreqapprovalpath5 = ''; $fldaccptapprovalpath5 = ''; /* if email notification is sent to the sender. the value should be: true or false*/ $fldownemailnotif = ''; /* if email notification is sent on changing user form. the value should be: true or false*/ $fldnotifyformchange = ''; /* escalation information */ $fldescalate_approval_to = ''; $fldescalate_approval_info = ''; $bUpdateMode = false; $pPKuser_id = GetParam('PK_user_id'); if ((string)$pPKuser_id!='') { $bUpdateMode = UserExists($pPKuser_id); } $sPageErrorMessage = GetCurrentPageConfig('sPageErrorMessage'); if ($bUpdateMode) { if ($sPageErrorMessage=='') { $sUserTbNm = GetTableConfig('sUserTbNm'); $sUserTbColPrefix = GetTableConfig('sUserTbColPrefix'); $sSQL = 'select a.'.$sUserTbColPrefix.'01 as a_userid, ' .'a.'.$sUserTbColPrefix.'02 as a_login, ' .'a.'.$sUserTbColPrefix.'13 as a_usertype' .' from '.$sUserTbNm.' a ' .' where a.'.$sUserTbColPrefix.'20='.ToSQL(GetSystemConfig('sLocalUserCode'),GetLocalUserCodeSqlValueType()) .' and a.'.$sUserTbColPrefix.'01='.ToSQL($pPKuser_id,'Text'); OpenRS ($rs, $sSQL); $flduser_type = GetValue($rs, 'a_usertype'); $pPKaccount_id = GetValue($rs, 'a_login'); $fldlogin = GetLogin($pPKaccount_id); $rs->Close(); unset ($rs); /*own email notification */ $fldownemailnotif = GetUserConfigWithDefault($pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigSendOwnSubmittedForm'),0); /*notify form change */ $fldnotifyformchange = GetUserConfigWithDefault($pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigEmailMyFormChange'),0); /*forms per page */ $fldnum_items_perpage = GetUserConfigWithDefault($pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigNumItemsPerPageListPage'),0); $fldreqapprovalpath1 = GetUserConfig($pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigRequestApprovalPath1')); $fldaccptapprovalpath1 = GetUserConfig($pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigAcceptanceApprovalPath1')); $fldreqapprovalpath2 = GetUserConfig($pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigRequestApprovalPath2')); $fldaccptapprovalpath2 = GetUserConfig($pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigAcceptanceApprovalPath2')); $fldreqapprovalpath3 = GetUserConfig($pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigRequestApprovalPath3')); $fldaccptapprovalpath3 = GetUserConfig($pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigAcceptanceApprovalPath3')); $fldreqapprovalpath4 = GetUserConfig($pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigRequestApprovalPath4')); $fldaccptapprovalpath4 = GetUserConfig($pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigAcceptanceApprovalPath4')); $fldreqapprovalpath5 = GetUserConfig($pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigRequestApprovalPath5')); $fldaccptapprovalpath5 = GetUserConfig($pPKaccount_id, GetUserConfigPreferenceConst('iUserConfigAcceptanceApprovalPath5')); $fldescalate_approval_toid = $pPKuser_id; $sFormApplEscalTbColPrefix = GetTableConfig('sFormApplEscalTbColPrefix'); $sFormApplEscalTbNm = GetTableConfig('sFormApplEscalTbNm'); /* check if this assigned people delegate to other, if any you asiggned to this escalated people */ while ((int)DLookup($sFormApplEscalTbNm,' count(*) as n ',$sFormApplEscalTbColPrefix.'02='.ToSQL($fldescalate_approval_toid,'Text').' and '.$sFormApplEscalTbColPrefix.'04<='.ToSQL(GetSystemDateTimeValue(),'Date').' and ('.$sFormApplEscalTbColPrefix.'05>='.ToSQL(GetSystemDateTimeValue(),'Date').' or '.$sFormApplEscalTbColPrefix.'05 is null)')>0) { $fldescalate_approval_info = DLookup($sFormApplEscalTbNm,$sFormApplEscalTbColPrefix.'06',$sFormApplEscalTbColPrefix.'02='.ToSQL($fldescalate_approval_toid,'Text').' and '.$sFormApplEscalTbColPrefix.'04<='.ToSQL(GetSystemDateTimeValue(),'Date').' and ('.$sFormApplEscalTbColPrefix.'05>='.ToSQL(GetSystemDateTimeValue(),'Date').' or '.$sFormApplEscalTbColPrefix.'05 is null)'); $fldescalate_approval_toid = DLookup($sFormApplEscalTbNm,$sFormApplEscalTbColPrefix.'03',$sFormApplEscalTbColPrefix.'02='.ToSQL($fldescalate_approval_toid,'Text').' and '.$sFormApplEscalTbColPrefix.'04<='.ToSQL(GetSystemDateTimeValue(),'Date').' and ('.$sFormApplEscalTbColPrefix.'05>='.ToSQL(GetSystemDateTimeValue(),'Date').' or '.$sFormApplEscalTbColPrefix.'05 is null)'); break; } $fldescalate_approval_to = ''; if (strtolower((string)$fldescalate_approval_toid)!=strtolower((string)$pPKaccount_id)) { if ((string)$fldescalate_approval_toid!='') { $fldescalate_approval_to = UserFromUserSelectionMode($fldescalate_approval_toid); } } } } /*------------------------------- * Load primary key and form parameters *------------------------------- */ $sPageErrorMessage = GetCurrentPageConfig('sPageErrorMessage'); if ($sPageErrorMessage == '') { } else { $pPKaccount_id = GetParam('PK_account_id'); $flduser_localusercode = GetParam('user_localusercode'); $flduser_type = GetParam('user_typeid'); $fldnum_items_perpage = GetParam('num_items_perpage'); $fldreqapprovalpath1 = GetParam('reqapprovalpath1'); $fldaccptapprovalpath1 = GetParam('accptapprovalpath1'); $fldreqapprovalpath2 = GetParam('reqapprovalpath2'); $fldaccptapprovalpath2 = GetParam('accptapprovalpath2'); $fldreqapprovalpath3 = GetParam('reqapprovalpath3'); $fldaccptapprovalpath3 = GetParam('accptapprovalpath3'); $fldreqapprovalpath4 = GetParam('reqapprovalpath4'); $fldaccptapprovalpath4 = GetParam('accptapprovalpath4'); $fldreqapprovalpath5 = GetParam('reqapprovalpath5'); $fldaccptapprovalpath5 = GetParam('accptapprovalpath5'); $fldownemailnotif = getCheckBoxValue(GetParam('OwnEm'), '1', '0', 'Number'); $fldnotifyformchange = getCheckBoxValue(GetParam('NotifMyFormChEm'), '1', '0', 'Number'); $fldescalate_approval_to = GetParam('escalate_approval_to'); $fldescalate_approval_info = GetParam('escalate_approval_info'); } /*------------------------------- * Load all form fields *------------------------------- */ /*------------------------------- * Preferences Open Event begin * Preferences Open Event end *------------------------------- */ SetVar ('SendOwnSubmittedFormCaption', ToHTML(GetTextLanguage('sPreferencesSendOwnSubmittedFormCaptionTitle'))); SetVar ('NotifyMyFormChangeEmail', ToHTML(GetTextLanguage('sPreferencesNotifyMyFormChangeEmailTitle'))); SetVar ('RequestApprovalPath1Caption', ToHTML(GetTextLanguage('sPreferencesRequestApprovalPath1CaptionTitle'))); SetVar ('AcceptanceApprovalPath1Caption', ToHTML(GetTextLanguage('sPreferencesAcceptanceApprovalPath1CaptionTitle'))); SetVar ('RequestApprovalPath2Caption', ToHTML(GetTextLanguage('sPreferencesRequestApprovalPath2CaptionTitle'))); SetVar ('AcceptanceApprovalPath2Caption', ToHTML(GetTextLanguage('sPreferencesAcceptanceApprovalPath2CaptionTitle'))); SetVar ('RequestApprovalPath3Caption', ToHTML(GetTextLanguage('sPreferencesRequestApprovalPath3CaptionTitle'))); SetVar ('AcceptanceApprovalPath3Caption', ToHTML(GetTextLanguage('sPreferencesAcceptanceApprovalPath3CaptionTitle'))); SetVar ('RequestApprovalPath4Caption', ToHTML(GetTextLanguage('sPreferencesRequestApprovalPath4CaptionTitle'))); SetVar ('AcceptanceApprovalPath4Caption', ToHTML(GetTextLanguage('sPreferencesAcceptanceApprovalPath4CaptionTitle'))); SetVar ('RequestApprovalPath5Caption', ToHTML(GetTextLanguage('sPreferencesRequestApprovalPath5CaptionTitle'))); SetVar ('AcceptanceApprovalPath5Caption', ToHTML(GetTextLanguage('sPreferencesAcceptanceApprovalPath5CaptionTitle'))); SetVar ('ApprovalTitle', GetTextLanguage('sPreferencesApprovalTitle')); SetVar ('EscalateApprovalToColumn', GetTextLanguage('sPreferencesEscalateApprovalToColumnTitle')); SetVar ('EscalateApprovalInfoColumn', GetTextLanguage('sPreferencesEscalateApprovalInfoColumnTitle')); SetVar ('AddNewMembersOfidButton', ToHTML(GetTextLanguage('sPreferencesAddNewMembersOfidButtonTitle'))); SetVar ('ClearMembersOfidButton', ToHTML(GetTextLanguage('sPreferencesClearMembersOfidButtonTitle'))); SetVar ('AddNewMembersidButton', ToHTML(GetTextLanguage('sPreferencesAddNewMembersidButtonTitle'))); SetVar ('ClearMembersidButton', ToHTML(GetTextLanguage('sPreferencesClearMembersidButtonTitle'))); SetVar ('PermissionButton', ToHTML(GetTextLanguage('sPreferencesPermissionButtonTitle'))); SetVar ('UpdateButton', ToHTML(GetTextLanguage('sPreferencesUpdateButtonTitle'))); SetVar ('CancelButton', ToHTML(GetTextLanguage('sPreferencesCancelButtonTitle'))); SetVar ('BrowseUsersButton', ToHTML(GetTextLanguage('sPreferencesBrowseUsersButtonTitle'))); /*------------------------------- * Load all fields into variables from recordset or input parameters *------------------------------- */ /*------------------------------- * Preferences Show Event begin * Preferences Show Event end *------------------------------- */ /*------------------------------- * Show form field *------------------------------- */ SetVarIf ('OwnEmChecked', 'checked',((string)$fldownemailnotif == '1')); SetVarIf ('NotifMyFormChEmhecked', 'checked',((string)$fldnotifyformchange == '1')); SetVar ('reqapprovalpath1', ToHTML($fldreqapprovalpath1)); SetVar ('accptapprovalpath1', ToHTML($fldaccptapprovalpath1)); SetVar ('reqapprovalpath2', ToHTML($fldreqapprovalpath2)); SetVar ('accptapprovalpath2', ToHTML($fldaccptapprovalpath2)); SetVar ('reqapprovalpath3', ToHTML($fldreqapprovalpath3)); SetVar ('accptapprovalpath3', ToHTML($fldaccptapprovalpath3)); SetVar ('reqapprovalpath4', ToHTML($fldreqapprovalpath4)); SetVar ('accptapprovalpath4', ToHTML($fldaccptapprovalpath4)); SetVar ('reqapprovalpath5', ToHTML($fldreqapprovalpath5)); SetVar ('accptapprovalpath5', ToHTML($fldaccptapprovalpath5)); SetVar ('escalate_approval_to',$fldescalate_approval_to); SetVar ('escalate_approval_info',$fldescalate_approval_info); /*------------------------------- * Preferences Close Event begin * Preferences Close Event end *------------------------------- */ /*------------------------------- * Preferences Show end *------------------------------- */ } } ?>