whmguy Posted September 19, 2011 Share Posted September 19, 2011 I have created a server module and placed it in /server/modules/mymodule, it shows up and works great! Now I need to have some custom fields created automatically (programatically) when the module is used for the first time. How can I do that? 0 Quote Link to comment Share on other sites More sharing options...
sdemidko Posted September 20, 2011 Share Posted September 20, 2011 I have created a server module and placed it in/server/modules/mymodule, it shows up and works great! Now I need to have some custom fields created automatically (programatically) when the module is used for the first time. How can I do that? I assume you mean custom fields for a clients? there is no way to do it via API or some built-in instrument I researched the way whmcs inserts custom fields into DB: they are stored in tblcustomfields table and to insert a record via PHP you just need to run SQL code something like this: INSERT INTO `tblcustomfields` (`type`, `relid`, `fieldname`, `fieldtype`, `description`, `fieldoptions`, `regexpr`, `adminonly`, `required`, `showorder`, `showinvoice`, `sortorder`) VALUES ('client', 0, 'Customer field name', 'tickbox', 'Customer field description', '', '', '', '', 'on', '', 0); 0 Quote Link to comment Share on other sites More sharing options...
whmguy Posted September 23, 2011 Author Share Posted September 23, 2011 Still haven't found a way to do this. Also: how can I update the values of those customfields from my code? Is there a way to save data to them? If not, how are people storing extra data for addon services? creating a table and storing there? if so, where is the best place to create a table? In $mymodule_ConfigOptions() ? 0 Quote Link to comment Share on other sites More sharing options...
shane.easton Posted April 28, 2012 Share Posted April 28, 2012 I need to know this too.. Bump? 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.